diff options
-rw-r--r-- | include/net/cfg80211.h | 8 | ||||
-rw-r--r-- | include/net/wireless.h | 3 | ||||
-rw-r--r-- | net/mac80211/main.c | 5 | ||||
-rw-r--r-- | net/mac80211/scan.c | 11 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 2 | ||||
-rw-r--r-- | net/wireless/scan.c | 21 |
6 files changed, 24 insertions, 26 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 8dcc46444037..e0312746a8cc 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -577,8 +577,7 @@ enum cfg80211_signal_type { | |||
577 | * @information_elements: the information elements (Note that there | 577 | * @information_elements: the information elements (Note that there |
578 | * is no guarantee that these are well-formed!) | 578 | * is no guarantee that these are well-formed!) |
579 | * @len_information_elements: total length of the information elements | 579 | * @len_information_elements: total length of the information elements |
580 | * @signal: signal strength value | 580 | * @signal: signal strength value (type depends on the wiphy's signal_type) |
581 | * @signal_type: signal type | ||
582 | * @free_priv: function pointer to free private data | 581 | * @free_priv: function pointer to free private data |
583 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes | 582 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes |
584 | */ | 583 | */ |
@@ -593,7 +592,6 @@ struct cfg80211_bss { | |||
593 | size_t len_information_elements; | 592 | size_t len_information_elements; |
594 | 593 | ||
595 | s32 signal; | 594 | s32 signal; |
596 | enum cfg80211_signal_type signal_type; | ||
597 | 595 | ||
598 | void (*free_priv)(struct cfg80211_bss *bss); | 596 | void (*free_priv)(struct cfg80211_bss *bss); |
599 | u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); | 597 | u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); |
@@ -782,6 +780,7 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); | |||
782 | * | 780 | * |
783 | * @wiphy: the wiphy reporting the BSS | 781 | * @wiphy: the wiphy reporting the BSS |
784 | * @bss: the found BSS | 782 | * @bss: the found BSS |
783 | * @signal: the signal strength, type depends on the wiphy's signal_type | ||
785 | * @gfp: context flags | 784 | * @gfp: context flags |
786 | * | 785 | * |
787 | * This informs cfg80211 that BSS information was found and | 786 | * This informs cfg80211 that BSS information was found and |
@@ -791,8 +790,7 @@ struct cfg80211_bss* | |||
791 | cfg80211_inform_bss_frame(struct wiphy *wiphy, | 790 | cfg80211_inform_bss_frame(struct wiphy *wiphy, |
792 | struct ieee80211_channel *channel, | 791 | struct ieee80211_channel *channel, |
793 | struct ieee80211_mgmt *mgmt, size_t len, | 792 | struct ieee80211_mgmt *mgmt, size_t len, |
794 | s32 signal, enum cfg80211_signal_type sigtype, | 793 | s32 signal, gfp_t gfp); |
795 | gfp_t gfp); | ||
796 | 794 | ||
797 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | 795 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, |
798 | struct ieee80211_channel *channel, | 796 | struct ieee80211_channel *channel, |
diff --git a/include/net/wireless.h b/include/net/wireless.h index 1c6285eb1666..d815aa8b4534 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h | |||
@@ -200,6 +200,7 @@ struct ieee80211_supported_band { | |||
200 | * the regulatory_hint() API. This can be used by the driver | 200 | * the regulatory_hint() API. This can be used by the driver |
201 | * on the reg_notifier() if it chooses to ignore future | 201 | * on the reg_notifier() if it chooses to ignore future |
202 | * regulatory domain changes caused by other drivers. | 202 | * regulatory domain changes caused by other drivers. |
203 | * @signal_type: signal type reported in &struct cfg80211_bss. | ||
203 | */ | 204 | */ |
204 | struct wiphy { | 205 | struct wiphy { |
205 | /* assign these fields before you register the wiphy */ | 206 | /* assign these fields before you register the wiphy */ |
@@ -213,6 +214,8 @@ struct wiphy { | |||
213 | bool custom_regulatory; | 214 | bool custom_regulatory; |
214 | bool strict_regulatory; | 215 | bool strict_regulatory; |
215 | 216 | ||
217 | enum cfg80211_signal_type signal_type; | ||
218 | |||
216 | int bss_priv_size; | 219 | int bss_priv_size; |
217 | u8 max_scan_ssids; | 220 | u8 max_scan_ssids; |
218 | 221 | ||
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index fce9d08986e9..f38db4d37e5d 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -861,6 +861,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
861 | /* mac80211 always supports monitor */ | 861 | /* mac80211 always supports monitor */ |
862 | local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); | 862 | local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); |
863 | 863 | ||
864 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) | ||
865 | local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; | ||
866 | else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) | ||
867 | local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; | ||
868 | |||
864 | result = wiphy_register(local->hw.wiphy); | 869 | result = wiphy_register(local->hw.wiphy); |
865 | if (result < 0) | 870 | if (result < 0) |
866 | goto fail_wiphy_register; | 871 | goto fail_wiphy_register; |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index c063f8204263..23f4de274744 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -63,20 +63,15 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
63 | { | 63 | { |
64 | struct ieee80211_bss *bss; | 64 | struct ieee80211_bss *bss; |
65 | int clen; | 65 | int clen; |
66 | enum cfg80211_signal_type sigtype = CFG80211_SIGNAL_TYPE_NONE; | ||
67 | s32 signal = 0; | 66 | s32 signal = 0; |
68 | 67 | ||
69 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) { | 68 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) |
70 | sigtype = CFG80211_SIGNAL_TYPE_MBM; | ||
71 | signal = rx_status->signal * 100; | 69 | signal = rx_status->signal * 100; |
72 | } else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) { | 70 | else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) |
73 | sigtype = CFG80211_SIGNAL_TYPE_UNSPEC; | ||
74 | signal = (rx_status->signal * 100) / local->hw.max_signal; | 71 | signal = (rx_status->signal * 100) / local->hw.max_signal; |
75 | } | ||
76 | 72 | ||
77 | bss = (void *)cfg80211_inform_bss_frame(local->hw.wiphy, channel, | 73 | bss = (void *)cfg80211_inform_bss_frame(local->hw.wiphy, channel, |
78 | mgmt, len, signal, sigtype, | 74 | mgmt, len, signal, GFP_ATOMIC); |
79 | GFP_ATOMIC); | ||
80 | 75 | ||
81 | if (!bss) | 76 | if (!bss) |
82 | return NULL; | 77 | return NULL; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 245fddcc77c3..a7e751edc739 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2457,7 +2457,7 @@ static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags, | |||
2457 | NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability); | 2457 | NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability); |
2458 | NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq); | 2458 | NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq); |
2459 | 2459 | ||
2460 | switch (res->signal_type) { | 2460 | switch (rdev->wiphy.signal_type) { |
2461 | case CFG80211_SIGNAL_TYPE_MBM: | 2461 | case CFG80211_SIGNAL_TYPE_MBM: |
2462 | NLA_PUT_U32(msg, NL80211_BSS_SIGNAL_MBM, res->signal); | 2462 | NLA_PUT_U32(msg, NL80211_BSS_SIGNAL_MBM, res->signal); |
2463 | break; | 2463 | break; |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 01c136d98c5b..60600657b657 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -370,7 +370,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
370 | found->pub.beacon_interval = res->pub.beacon_interval; | 370 | found->pub.beacon_interval = res->pub.beacon_interval; |
371 | found->pub.tsf = res->pub.tsf; | 371 | found->pub.tsf = res->pub.tsf; |
372 | found->pub.signal = res->pub.signal; | 372 | found->pub.signal = res->pub.signal; |
373 | found->pub.signal_type = res->pub.signal_type; | ||
374 | found->pub.capability = res->pub.capability; | 373 | found->pub.capability = res->pub.capability; |
375 | found->ts = res->ts; | 374 | found->ts = res->ts; |
376 | kref_put(&res->ref, bss_release); | 375 | kref_put(&res->ref, bss_release); |
@@ -392,8 +391,7 @@ struct cfg80211_bss * | |||
392 | cfg80211_inform_bss_frame(struct wiphy *wiphy, | 391 | cfg80211_inform_bss_frame(struct wiphy *wiphy, |
393 | struct ieee80211_channel *channel, | 392 | struct ieee80211_channel *channel, |
394 | struct ieee80211_mgmt *mgmt, size_t len, | 393 | struct ieee80211_mgmt *mgmt, size_t len, |
395 | s32 signal, enum cfg80211_signal_type sigtype, | 394 | s32 signal, gfp_t gfp) |
396 | gfp_t gfp) | ||
397 | { | 395 | { |
398 | struct cfg80211_internal_bss *res; | 396 | struct cfg80211_internal_bss *res; |
399 | size_t ielen = len - offsetof(struct ieee80211_mgmt, | 397 | size_t ielen = len - offsetof(struct ieee80211_mgmt, |
@@ -401,7 +399,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
401 | bool overwrite; | 399 | bool overwrite; |
402 | size_t privsz = wiphy->bss_priv_size; | 400 | size_t privsz = wiphy->bss_priv_size; |
403 | 401 | ||
404 | if (WARN_ON(sigtype == NL80211_BSS_SIGNAL_UNSPEC && | 402 | if (WARN_ON(wiphy->signal_type == NL80211_BSS_SIGNAL_UNSPEC && |
405 | (signal < 0 || signal > 100))) | 403 | (signal < 0 || signal > 100))) |
406 | return NULL; | 404 | return NULL; |
407 | 405 | ||
@@ -415,7 +413,6 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, | |||
415 | 413 | ||
416 | memcpy(res->pub.bssid, mgmt->bssid, ETH_ALEN); | 414 | memcpy(res->pub.bssid, mgmt->bssid, ETH_ALEN); |
417 | res->pub.channel = channel; | 415 | res->pub.channel = channel; |
418 | res->pub.signal_type = sigtype; | ||
419 | res->pub.signal = signal; | 416 | res->pub.signal = signal; |
420 | res->pub.tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp); | 417 | res->pub.tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp); |
421 | res->pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); | 418 | res->pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); |
@@ -607,9 +604,9 @@ static inline unsigned int elapsed_jiffies_msecs(unsigned long start) | |||
607 | } | 604 | } |
608 | 605 | ||
609 | static char * | 606 | static char * |
610 | ieee80211_bss(struct iw_request_info *info, | 607 | ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, |
611 | struct cfg80211_internal_bss *bss, | 608 | struct cfg80211_internal_bss *bss, char *current_ev, |
612 | char *current_ev, char *end_buf) | 609 | char *end_buf) |
613 | { | 610 | { |
614 | struct iw_event iwe; | 611 | struct iw_event iwe; |
615 | u8 *buf, *cfg, *p; | 612 | u8 *buf, *cfg, *p; |
@@ -638,13 +635,13 @@ ieee80211_bss(struct iw_request_info *info, | |||
638 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, | 635 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, |
639 | IW_EV_FREQ_LEN); | 636 | IW_EV_FREQ_LEN); |
640 | 637 | ||
641 | if (bss->pub.signal_type != CFG80211_SIGNAL_TYPE_NONE) { | 638 | if (wiphy->signal_type != CFG80211_SIGNAL_TYPE_NONE) { |
642 | memset(&iwe, 0, sizeof(iwe)); | 639 | memset(&iwe, 0, sizeof(iwe)); |
643 | iwe.cmd = IWEVQUAL; | 640 | iwe.cmd = IWEVQUAL; |
644 | iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED | | 641 | iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED | |
645 | IW_QUAL_NOISE_INVALID | | 642 | IW_QUAL_NOISE_INVALID | |
646 | IW_QUAL_QUAL_UPDATED; | 643 | IW_QUAL_QUAL_UPDATED; |
647 | switch (bss->pub.signal_type) { | 644 | switch (wiphy->signal_type) { |
648 | case CFG80211_SIGNAL_TYPE_MBM: | 645 | case CFG80211_SIGNAL_TYPE_MBM: |
649 | sig = bss->pub.signal / 100; | 646 | sig = bss->pub.signal / 100; |
650 | iwe.u.qual.level = sig; | 647 | iwe.u.qual.level = sig; |
@@ -823,8 +820,8 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev, | |||
823 | spin_unlock_bh(&dev->bss_lock); | 820 | spin_unlock_bh(&dev->bss_lock); |
824 | return -E2BIG; | 821 | return -E2BIG; |
825 | } | 822 | } |
826 | current_ev = ieee80211_bss(info, bss, | 823 | current_ev = ieee80211_bss(&dev->wiphy, info, bss, |
827 | current_ev, end_buf); | 824 | current_ev, end_buf); |
828 | } | 825 | } |
829 | spin_unlock_bh(&dev->bss_lock); | 826 | spin_unlock_bh(&dev->bss_lock); |
830 | return current_ev - buf; | 827 | return current_ev - buf; |