diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-02-18 12:45:06 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-27 14:52:42 -0500 |
commit | 77965c970d7da9c9b6349ff2b1d9adecf54c403b (patch) | |
tree | bda8a85fa872a46d5cb5c48891cf3ee21c91e838 /net | |
parent | 630e64c487c0a9550f05b465216a1cd9125b52f2 (diff) |
cfg80211: clean up signal type
It wasn't a good idea to make the signal type a per-BSS option,
although then it is closer to the actual value. Move it to be
a per-wiphy setting, update mac80211 to match.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-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 |
4 files changed, 18 insertions, 21 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index fce9d08986e..f38db4d37e5 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 c063f820426..23f4de27474 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 245fddcc77c..a7e751edc73 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 01c136d98c5..60600657b65 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; |