diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-04-22 10:29:31 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-05-16 16:39:38 -0400 |
commit | ef0621e805f9ef76eaf31ce6205028fe467e9ca9 (patch) | |
tree | 44a6af5c68b914cc8bec0b08b5a72d9ed7d6ef00 /net/mac80211 | |
parent | 119363c7dc2bcc0c33c255a7b4979c8c0fdc1896 (diff) |
mac80211: add support for per-chain signal strength reporting
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
[fix unit documentation]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 13 | ||||
-rw-r--r-- | net/mac80211/rx.c | 14 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 2 | ||||
-rw-r--r-- | net/mac80211/sta_info.h | 5 |
4 files changed, 33 insertions, 1 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 1a89c80e6407..1f51bdfe574a 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -444,7 +444,7 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
444 | struct ieee80211_local *local = sdata->local; | 444 | struct ieee80211_local *local = sdata->local; |
445 | struct timespec uptime; | 445 | struct timespec uptime; |
446 | u64 packets = 0; | 446 | u64 packets = 0; |
447 | int ac; | 447 | int i, ac; |
448 | 448 | ||
449 | sinfo->generation = sdata->local->sta_generation; | 449 | sinfo->generation = sdata->local->sta_generation; |
450 | 450 | ||
@@ -488,6 +488,17 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
488 | sinfo->signal = (s8)sta->last_signal; | 488 | sinfo->signal = (s8)sta->last_signal; |
489 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); | 489 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); |
490 | } | 490 | } |
491 | if (sta->chains) { | ||
492 | sinfo->filled |= STATION_INFO_CHAIN_SIGNAL | | ||
493 | STATION_INFO_CHAIN_SIGNAL_AVG; | ||
494 | |||
495 | sinfo->chains = sta->chains; | ||
496 | for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { | ||
497 | sinfo->chain_signal[i] = sta->chain_signal_last[i]; | ||
498 | sinfo->chain_signal_avg[i] = | ||
499 | (s8) -ewma_read(&sta->chain_signal_avg[i]); | ||
500 | } | ||
501 | } | ||
491 | 502 | ||
492 | sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); | 503 | sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); |
493 | sta_set_rate_info_rx(sta, &sinfo->rxrate); | 504 | sta_set_rate_info_rx(sta, &sinfo->rxrate); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c8447af76ead..22e412b0767f 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1372,6 +1372,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1372 | struct sk_buff *skb = rx->skb; | 1372 | struct sk_buff *skb = rx->skb; |
1373 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); | 1373 | struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); |
1374 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1374 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1375 | int i; | ||
1375 | 1376 | ||
1376 | if (!sta) | 1377 | if (!sta) |
1377 | return RX_CONTINUE; | 1378 | return RX_CONTINUE; |
@@ -1422,6 +1423,19 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1422 | ewma_add(&sta->avg_signal, -status->signal); | 1423 | ewma_add(&sta->avg_signal, -status->signal); |
1423 | } | 1424 | } |
1424 | 1425 | ||
1426 | if (status->chains) { | ||
1427 | sta->chains = status->chains; | ||
1428 | for (i = 0; i < ARRAY_SIZE(status->chain_signal); i++) { | ||
1429 | int signal = status->chain_signal[i]; | ||
1430 | |||
1431 | if (!(status->chains & BIT(i))) | ||
1432 | continue; | ||
1433 | |||
1434 | sta->chain_signal_last[i] = signal; | ||
1435 | ewma_add(&sta->chain_signal_avg[i], -signal); | ||
1436 | } | ||
1437 | } | ||
1438 | |||
1425 | /* | 1439 | /* |
1426 | * Change STA power saving mode only at the end of a frame | 1440 | * Change STA power saving mode only at the end of a frame |
1427 | * exchange sequence. | 1441 | * exchange sequence. |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 11216bc13b27..a04c5671d7fd 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -358,6 +358,8 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
358 | do_posix_clock_monotonic_gettime(&uptime); | 358 | do_posix_clock_monotonic_gettime(&uptime); |
359 | sta->last_connected = uptime.tv_sec; | 359 | sta->last_connected = uptime.tv_sec; |
360 | ewma_init(&sta->avg_signal, 1024, 8); | 360 | ewma_init(&sta->avg_signal, 1024, 8); |
361 | for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++) | ||
362 | ewma_init(&sta->chain_signal_avg[i], 1024, 8); | ||
361 | 363 | ||
362 | if (sta_prepare_rate_control(local, sta, gfp)) { | 364 | if (sta_prepare_rate_control(local, sta, gfp)) { |
363 | kfree(sta); | 365 | kfree(sta); |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index adc30045f99e..41c28b977f7c 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -344,6 +344,11 @@ struct sta_info { | |||
344 | int last_signal; | 344 | int last_signal; |
345 | struct ewma avg_signal; | 345 | struct ewma avg_signal; |
346 | int last_ack_signal; | 346 | int last_ack_signal; |
347 | |||
348 | u8 chains; | ||
349 | s8 chain_signal_last[IEEE80211_MAX_CHAINS]; | ||
350 | struct ewma chain_signal_avg[IEEE80211_MAX_CHAINS]; | ||
351 | |||
347 | /* Plus 1 for non-QoS frames */ | 352 | /* Plus 1 for non-QoS frames */ |
348 | __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; | 353 | __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; |
349 | 354 | ||