Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315211
b: refs/heads/master
c: 8eb41c8
h: refs/heads/master
i:
  315209: 27f2908
  315207: 467b994
v: v3
  • Loading branch information
Vladimir Kondratiev authored and Johannes Berg committed Jul 5, 2012
1 parent ec7bdba commit e911a23
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5a7e582490c423f0685e42ee5cfb7c6de81adb0
refs/heads/master: 8eb41c8dfb9e2396d2452ada9023a83d610b9051
9 changes: 9 additions & 0 deletions trunk/include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1638,12 +1638,20 @@ struct nl80211_sta_flag_update {
*
* These attribute types are used with %NL80211_STA_INFO_TXRATE
* when getting information about the bitrate of a station.
* There are 2 attributes for bitrate, a legacy one that represents
* a 16-bit value, and new one that represents a 32-bit value.
* If the rate value fits into 16 bit, both attributes are reported
* with the same value. If the rate is too high to fit into 16 bits
* (>6.5535Gbps) only 32-bit attribute is included.
* User space tools encouraged to use the 32-bit attribute and fall
* back to the 16-bit one for compatibility with older kernels.
*
* @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved
* @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s)
* @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8)
* @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate
* @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval
* @NL80211_RATE_INFO_BITRATE32: total bitrate (u32, 100kbit/s)
* @NL80211_RATE_INFO_MAX: highest rate_info number currently defined
* @__NL80211_RATE_INFO_AFTER_LAST: internal use
*/
Expand All @@ -1653,6 +1661,7 @@ enum nl80211_rate_info {
NL80211_RATE_INFO_MCS,
NL80211_RATE_INFO_40_MHZ_WIDTH,
NL80211_RATE_INFO_SHORT_GI,
NL80211_RATE_INFO_BITRATE32,

/* keep last */
__NL80211_RATE_INFO_AFTER_LAST,
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -3487,7 +3487,7 @@ void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
*
* return 0 if MCS index >= 32
*/
u16 cfg80211_calculate_bitrate(struct rate_info *rate);
u32 cfg80211_calculate_bitrate(struct rate_info *rate);

/* Logging, debugging and troubleshooting/diagnostic helpers. */

Expand Down
9 changes: 7 additions & 2 deletions trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2618,16 +2618,21 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info,
int attr)
{
struct nlattr *rate;
u16 bitrate;
u32 bitrate;
u16 bitrate_compat;

rate = nla_nest_start(msg, attr);
if (!rate)
goto nla_put_failure;

/* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */
bitrate = cfg80211_calculate_bitrate(info);
/* report 16-bit bitrate only if we can */
bitrate_compat = bitrate < (1UL << 16) ? bitrate : 0;
if ((bitrate > 0 &&
nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate)) ||
nla_put_u32(msg, NL80211_RATE_INFO_BITRATE32, bitrate)) ||
(bitrate_compat > 0 &&
nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat)) ||
((info->flags & RATE_INFO_FLAGS_MCS) &&
nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) ||
((info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) &&
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/wireless/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
return err;
}

u16 cfg80211_calculate_bitrate(struct rate_info *rate)
u32 cfg80211_calculate_bitrate(struct rate_info *rate)
{
int modulation, streams, bitrate;

Expand Down

0 comments on commit e911a23

Please sign in to comment.