aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-02-27 16:08:01 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-03-01 13:48:21 -0500
commit3af6334c9e4fbf41ef0ebd3b4d5762f26b675c40 (patch)
treeffc05f816754d2393963ee13f4c7a3eb515e0627 /net/mac80211/cfg.c
parentc8dcfd8a046c1f49af0c15726761af17b957962d (diff)
mac80211: add support for showing the last rx bitrate
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8b436c768c4e..7b701dcddb50 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -316,6 +316,17 @@ static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
316 return 0; 316 return 0;
317} 317}
318 318
319static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, int idx)
320{
321 if (!(rate->flags & RATE_INFO_FLAGS_MCS)) {
322 struct ieee80211_supported_band *sband;
323 sband = sta->local->hw.wiphy->bands[
324 sta->local->hw.conf.channel->band];
325 rate->legacy = sband->bitrates[idx].bitrate;
326 } else
327 rate->mcs = idx;
328}
329
319static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) 330static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
320{ 331{
321 struct ieee80211_sub_if_data *sdata = sta->sdata; 332 struct ieee80211_sub_if_data *sdata = sta->sdata;
@@ -330,6 +341,7 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
330 STATION_INFO_TX_RETRIES | 341 STATION_INFO_TX_RETRIES |
331 STATION_INFO_TX_FAILED | 342 STATION_INFO_TX_FAILED |
332 STATION_INFO_TX_BITRATE | 343 STATION_INFO_TX_BITRATE |
344 STATION_INFO_RX_BITRATE |
333 STATION_INFO_RX_DROP_MISC; 345 STATION_INFO_RX_DROP_MISC;
334 346
335 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); 347 sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
@@ -355,15 +367,16 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
355 sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; 367 sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
356 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_SHORT_GI) 368 if (sta->last_tx_rate.flags & IEEE80211_TX_RC_SHORT_GI)
357 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 369 sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
358 370 rate_idx_to_bitrate(&sinfo->txrate, sta, sta->last_tx_rate.idx);
359 if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) { 371
360 struct ieee80211_supported_band *sband; 372 sinfo->rxrate.flags = 0;
361 sband = sta->local->hw.wiphy->bands[ 373 if (sta->last_rx_rate_flag & RX_FLAG_HT)
362 sta->local->hw.conf.channel->band]; 374 sinfo->rxrate.flags |= RATE_INFO_FLAGS_MCS;
363 sinfo->txrate.legacy = 375 if (sta->last_rx_rate_flag & RX_FLAG_40MHZ)
364 sband->bitrates[sta->last_tx_rate.idx].bitrate; 376 sinfo->rxrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH;
365 } else 377 if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI)
366 sinfo->txrate.mcs = sta->last_tx_rate.idx; 378 sinfo->rxrate.flags |= RATE_INFO_FLAGS_SHORT_GI;
379 rate_idx_to_bitrate(&sinfo->rxrate, sta, sta->last_rx_rate_idx);
367 380
368 if (ieee80211_vif_is_mesh(&sdata->vif)) { 381 if (ieee80211_vif_is_mesh(&sdata->vif)) {
369#ifdef CONFIG_MAC80211_MESH 382#ifdef CONFIG_MAC80211_MESH