aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
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
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')
-rw-r--r--net/mac80211/cfg.c31
-rw-r--r--net/mac80211/util.c25
2 files changed, 37 insertions, 19 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,
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index db7216124736..fbd37d43dfce 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2541,7 +2541,9 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
2541 ri.mcs = status->rate_idx; 2541 ri.mcs = status->rate_idx;
2542 ri.flags |= RATE_INFO_FLAGS_MCS; 2542 ri.flags |= RATE_INFO_FLAGS_MCS;
2543 if (status->flag & RX_FLAG_40MHZ) 2543 if (status->flag & RX_FLAG_40MHZ)
2544 ri.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 2544 ri.bw = RATE_INFO_BW_40;
2545 else
2546 ri.bw = RATE_INFO_BW_20;
2545 if (status->flag & RX_FLAG_SHORT_GI) 2547 if (status->flag & RX_FLAG_SHORT_GI)
2546 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; 2548 ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
2547 } else if (status->flag & RX_FLAG_VHT) { 2549 } else if (status->flag & RX_FLAG_VHT) {
@@ -2549,11 +2551,13 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
2549 ri.mcs = status->rate_idx; 2551 ri.mcs = status->rate_idx;
2550 ri.nss = status->vht_nss; 2552 ri.nss = status->vht_nss;
2551 if (status->flag & RX_FLAG_40MHZ) 2553 if (status->flag & RX_FLAG_40MHZ)
2552 ri.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 2554 ri.bw = RATE_INFO_BW_40;
2553 if (status->vht_flag & RX_VHT_FLAG_80MHZ) 2555 else if (status->vht_flag & RX_VHT_FLAG_80MHZ)
2554 ri.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; 2556 ri.bw = RATE_INFO_BW_80;
2555 if (status->vht_flag & RX_VHT_FLAG_160MHZ) 2557 else if (status->vht_flag & RX_VHT_FLAG_160MHZ)
2556 ri.flags |= RATE_INFO_FLAGS_160_MHZ_WIDTH; 2558 ri.bw = RATE_INFO_BW_160;
2559 else
2560 ri.bw = RATE_INFO_BW_20;
2557 if (status->flag & RX_FLAG_SHORT_GI) 2561 if (status->flag & RX_FLAG_SHORT_GI)
2558 ri.flags |= RATE_INFO_FLAGS_SHORT_GI; 2562 ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
2559 } else { 2563 } else {
@@ -2561,10 +2565,15 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
2561 int shift = 0; 2565 int shift = 0;
2562 int bitrate; 2566 int bitrate;
2563 2567
2564 if (status->flag & RX_FLAG_10MHZ) 2568 if (status->flag & RX_FLAG_10MHZ) {
2565 shift = 1; 2569 shift = 1;
2566 if (status->flag & RX_FLAG_5MHZ) 2570 ri.bw = RATE_INFO_BW_10;
2571 } else if (status->flag & RX_FLAG_5MHZ) {
2567 shift = 2; 2572 shift = 2;
2573 ri.bw = RATE_INFO_BW_5;
2574 } else {
2575 ri.bw = RATE_INFO_BW_20;
2576 }
2568 2577
2569 sband = local->hw.wiphy->bands[status->band]; 2578 sband = local->hw.wiphy->bands[status->band];
2570 bitrate = sband->bitrates[status->rate_idx].bitrate; 2579 bitrate = sband->bitrates[status->rate_idx].bitrate;