aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-01-15 10:14:02 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-01-15 16:41:32 -0500
commitb51f3beecfbbfc946749a91fb444cb8917cf444f (patch)
tree68ecd024ca26b392b48599dc3725e4416d053d1f /net/wireless/nl80211.c
parent97d910d0aaa619ca530d08e2b1125b8014ccb030 (diff)
cfg80211: change bandwidth reporting to explicit field
For some reason, we made the bandwidth separate flags, which is rather confusing - a single rate cannot have different bandwidths at the same time. Change this to no longer be flags but use a separate field for the bandwidth ('bw') instead. While at it, add support for 5 and 10 MHz rates - these are reported as regular legacy rates with their real bitrate, but tagged as 5/10 now to make it easier to distinguish them. In the nl80211 API, the flags are preserved, but the code now can also clearly only set a single one of the flags. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8998484ea970..8e56eeb583aa 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3578,6 +3578,7 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info,
3578 struct nlattr *rate; 3578 struct nlattr *rate;
3579 u32 bitrate; 3579 u32 bitrate;
3580 u16 bitrate_compat; 3580 u16 bitrate_compat;
3581 enum nl80211_attrs rate_flg;
3581 3582
3582 rate = nla_nest_start(msg, attr); 3583 rate = nla_nest_start(msg, attr);
3583 if (!rate) 3584 if (!rate)
@@ -3594,12 +3595,36 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info,
3594 nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat)) 3595 nla_put_u16(msg, NL80211_RATE_INFO_BITRATE, bitrate_compat))
3595 return false; 3596 return false;
3596 3597
3598 switch (info->bw) {
3599 case RATE_INFO_BW_5:
3600 rate_flg = NL80211_RATE_INFO_5_MHZ_WIDTH;
3601 break;
3602 case RATE_INFO_BW_10:
3603 rate_flg = NL80211_RATE_INFO_10_MHZ_WIDTH;
3604 break;
3605 default:
3606 WARN_ON(1);
3607 /* fall through */
3608 case RATE_INFO_BW_20:
3609 rate_flg = 0;
3610 break;
3611 case RATE_INFO_BW_40:
3612 rate_flg = NL80211_RATE_INFO_40_MHZ_WIDTH;
3613 break;
3614 case RATE_INFO_BW_80:
3615 rate_flg = NL80211_RATE_INFO_80_MHZ_WIDTH;
3616 break;
3617 case RATE_INFO_BW_160:
3618 rate_flg = NL80211_RATE_INFO_160_MHZ_WIDTH;
3619 break;
3620 }
3621
3622 if (rate_flg && nla_put_flag(msg, rate_flg))
3623 return false;
3624
3597 if (info->flags & RATE_INFO_FLAGS_MCS) { 3625 if (info->flags & RATE_INFO_FLAGS_MCS) {
3598 if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs)) 3626 if (nla_put_u8(msg, NL80211_RATE_INFO_MCS, info->mcs))
3599 return false; 3627 return false;
3600 if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH &&
3601 nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH))
3602 return false;
3603 if (info->flags & RATE_INFO_FLAGS_SHORT_GI && 3628 if (info->flags & RATE_INFO_FLAGS_SHORT_GI &&
3604 nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) 3629 nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI))
3605 return false; 3630 return false;
@@ -3608,15 +3633,6 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info,
3608 return false; 3633 return false;
3609 if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_NSS, info->nss)) 3634 if (nla_put_u8(msg, NL80211_RATE_INFO_VHT_NSS, info->nss))
3610 return false; 3635 return false;
3611 if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH &&
3612 nla_put_flag(msg, NL80211_RATE_INFO_40_MHZ_WIDTH))
3613 return false;
3614 if (info->flags & RATE_INFO_FLAGS_80_MHZ_WIDTH &&
3615 nla_put_flag(msg, NL80211_RATE_INFO_80_MHZ_WIDTH))
3616 return false;
3617 if (info->flags & RATE_INFO_FLAGS_160_MHZ_WIDTH &&
3618 nla_put_flag(msg, NL80211_RATE_INFO_160_MHZ_WIDTH))
3619 return false;
3620 if (info->flags & RATE_INFO_FLAGS_SHORT_GI && 3636 if (info->flags & RATE_INFO_FLAGS_SHORT_GI &&
3621 nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI)) 3637 nla_put_flag(msg, NL80211_RATE_INFO_SHORT_GI))
3622 return false; 3638 return false;