diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-04-22 10:29:30 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-05-16 16:39:37 -0400 |
commit | 119363c7dc2bcc0c33c255a7b4979c8c0fdc1896 (patch) | |
tree | 85c7eb2b9104968d017eee14065a2d93ce0150a7 /net/wireless | |
parent | f722406faae2d073cc1d01063d1123c35425939e (diff) |
cfg80211: add support for per-chain signal strength reporting
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index afa283841e8c..f687a8d0d026 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3376,6 +3376,32 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, | |||
3376 | return true; | 3376 | return true; |
3377 | } | 3377 | } |
3378 | 3378 | ||
3379 | static bool nl80211_put_signal(struct sk_buff *msg, u8 mask, s8 *signal, | ||
3380 | int id) | ||
3381 | { | ||
3382 | void *attr; | ||
3383 | int i = 0; | ||
3384 | |||
3385 | if (!mask) | ||
3386 | return true; | ||
3387 | |||
3388 | attr = nla_nest_start(msg, id); | ||
3389 | if (!attr) | ||
3390 | return false; | ||
3391 | |||
3392 | for (i = 0; i < IEEE80211_MAX_CHAINS; i++) { | ||
3393 | if (!(mask & BIT(i))) | ||
3394 | continue; | ||
3395 | |||
3396 | if (nla_put_u8(msg, i, signal[i])) | ||
3397 | return false; | ||
3398 | } | ||
3399 | |||
3400 | nla_nest_end(msg, attr); | ||
3401 | |||
3402 | return true; | ||
3403 | } | ||
3404 | |||
3379 | static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, | 3405 | static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, |
3380 | int flags, | 3406 | int flags, |
3381 | struct cfg80211_registered_device *rdev, | 3407 | struct cfg80211_registered_device *rdev, |
@@ -3447,6 +3473,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, | |||
3447 | default: | 3473 | default: |
3448 | break; | 3474 | break; |
3449 | } | 3475 | } |
3476 | if (sinfo->filled & STATION_INFO_CHAIN_SIGNAL) { | ||
3477 | if (!nl80211_put_signal(msg, sinfo->chains, | ||
3478 | sinfo->chain_signal, | ||
3479 | NL80211_STA_INFO_CHAIN_SIGNAL)) | ||
3480 | goto nla_put_failure; | ||
3481 | } | ||
3482 | if (sinfo->filled & STATION_INFO_CHAIN_SIGNAL_AVG) { | ||
3483 | if (!nl80211_put_signal(msg, sinfo->chains, | ||
3484 | sinfo->chain_signal_avg, | ||
3485 | NL80211_STA_INFO_CHAIN_SIGNAL_AVG)) | ||
3486 | goto nla_put_failure; | ||
3487 | } | ||
3450 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { | 3488 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { |
3451 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, | 3489 | if (!nl80211_put_sta_rate(msg, &sinfo->txrate, |
3452 | NL80211_STA_INFO_TX_BITRATE)) | 3490 | NL80211_STA_INFO_TX_BITRATE)) |