aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.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/mac80211/cfg.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/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6d5076fbf87a..ff090ef1ea2c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -428,11 +428,13 @@ void sta_set_rate_info_tx(struct sta_info *sta,
428 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 428 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
429 } 429 }
430 if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) 430 if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
431 rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 431 rinfo->bw = RATE_INFO_BW_40;
432 if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) 432 else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
433 rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 433 rinfo->bw = RATE_INFO_BW_80;
434 if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) 434 else if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
435 rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 435 rinfo->bw = RATE_INFO_BW_160;
436 else
437 rinfo->bw = RATE_INFO_BW_20;
436 if (rate->flags & IEEE80211_TX_RC_SHORT_GI) 438 if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
437 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 439 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
438} 440}
@@ -459,14 +461,21 @@ void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo)
459 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 461 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift);
460 } 462 }
461 463
462 if (sta->last_rx_rate_flag & RX_FLAG_40MHZ)
463 rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
464 if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) 464 if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI)
465 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; 465 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI;
466 if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ) 466
467 rinfo->flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 467 if (sta->last_rx_rate_flag & RX_FLAG_5MHZ)
468 if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ) 468 rinfo->bw = RATE_INFO_BW_5;
469 rinfo->flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 469 else if (sta->last_rx_rate_flag & RX_FLAG_10MHZ)
470 rinfo->bw = RATE_INFO_BW_10;
471 else if (sta->last_rx_rate_flag & RX_FLAG_40MHZ)
472 rinfo->bw = RATE_INFO_BW_40;
473 else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_80MHZ)
474 rinfo->bw = RATE_INFO_BW_80;
475 else if (sta->last_rx_rate_vht_flag & RX_VHT_FLAG_160MHZ)
476 rinfo->bw = RATE_INFO_BW_160;
477 else
478 rinfo->bw = RATE_INFO_BW_20;
470} 479}
471 480
472static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, 481static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,