cfg80211: Parsing of Multiple BSSID information in scanning
PATCH v2 1/5 cfg80211: Parsing of Multiple BSSID information in scanning
From: Peng Xu <[email protected]>
This extends cfg80211 BSS table processing to be able to parse Multiple BSSID element from Beacon and Probe Response frames and to update the BSS profiles in internal database for non-transmitted BSSs.
--- net/wireless/core.h | 1 + net/wireless/scan.c | 508 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 470 insertions(+), 39 deletions(-)
v2:
- add missing rcu_read_unlock() calls to address kbuild report
net/wireless/core.h +1 -0
@@ -152,6 +152,7 @@ extern int cfg80211_rdev_list_generation;struct cfg80211_internal_bss {struct list_head list;struct list_head hidden_list; +struct list_head nontrans_list;struct rb_node rbn;u64 ts_boottime;unsigned long ts;
net/wireless/scan.c +469 -39
572 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 2/5 cfg80211: Properly track transmitting and non-transmitting BSS
From: Sara Sharon <[email protected]>
When holding data of the non-transmitting BSS, we need to keep the transmitting BSS data on. Otherwise it will be released, and release the non-transmitting BSS with it.
--- net/wireless/core.h | 12 ++++++++++++ net/wireless/scan.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-)
v2:
- avoid recursive calls within inline functions to address kbuild warnings
net/wireless/core.h +12 -0
@@ -153,6 +153,7 @@ struct cfg80211_internal_bss {struct list_head list;struct list_head hidden_list;struct list_head nontrans_list; +struct cfg80211_bss *transmitted_bss;struct rb_node rbn;u64 ts_boottime;unsigned long ts;
@@ -183,12 +184,23 @@ static inline struct cfg80211_internal_bss *bss_from_pub(struct cfg80211_bss *pustatic inline void cfg80211_hold_bss (struct cfg80211_internal_bss *bss) {atomic_inc (&bss->hold); +if (bss->transmitted_bss) { + bss =container_of (bss->transmitted_bss, + struct cfg80211_internal_bss, pub); +atomic_inc (&bss->hold); + } }static inline void cfg80211_unhold_bss (struct cfg80211_internal_bss *bss) {int r =atomic_dec_return (&bss->hold);WARN_ON (r <0 ); +if (bss->transmitted_bss) { + bss =container_of (bss->transmitted_bss, + struct cfg80211_internal_bss, pub); + r =atomic_dec_return (&bss->hold); +WARN_ON (r <0 ); + } }
net/wireless/scan.c +34 -2
@@ -109,6 +109,12 @@ static inline void bss_ref_get(struct cfg80211_registered_device *rdev, pub); bss->refcount++; } +if (bss->transmitted_bss) { + bss =container_of (bss->transmitted_bss, + struct cfg80211_internal_bss, + pub); + bss->refcount++; + } } static inline void bss_ref_put(struct cfg80211_registered_device *rdev,
@@ -125,6 +131,18 @@ static inline void bss_ref_put(struct cfg80211_registered_device *rdev,if (hbss->refcount ==0 )bss_free (hbss); } + +if (bss->transmitted_bss) { +struct cfg80211_internal_bss *tbss; + + tbss =container_of (bss->transmitted_bss, + struct cfg80211_internal_bss, + pub); + tbss->refcount--; +if (tbss->refcount ==0 ) +bss_free (tbss); + } + bss->refcount--;if (bss->refcount ==0 )bss_free (bss);
@@ -1030,6 +1048,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev,static struct cfg80211_internal_bss *cfg80211_bss_update (struct cfg80211_registered_device *rdev,struct cfg80211_internal_bss *tmp, +struct cfg80211_bss *trans_bss,bool signal_valid) {struct cfg80211_internal_bss *found =NULL ;
@@ -1186,6 +1205,17 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, goto drop; } +/* This must be before the call to bss_ref_get */ +if (trans_bss) { +struct cfg80211_internal_bss *pbss = +container_of (trans_bss, + struct cfg80211_internal_bss, + pub); + + new->transmitted_bss = trans_bss; +bss_ref_get (rdev, pbss); + } +list_add_tail (&new->list, &rdev->bss_list); rdev->bss_entries++;rb_insert_bss (rdev, new);
@@ -1341,7 +1371,8 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy, signal_valid =abs (data->chan->center_freq - channel->center_freq) <= wiphy->max_adj_channel_rssi_comp; - res =cfg80211_bss_update (wiphy_to_rdev (wiphy), &tmp, signal_valid); + res =cfg80211_bss_update (wiphy_to_rdev (wiphy), &tmp, trans_bss, + signal_valid);if (!res)return NULL ;
@@ -1661,7 +1692,8 @@ cfg80211_inform_single_bss_frame_data(struct wiphy *wiphy, signal_valid =abs (data->chan->center_freq - channel->center_freq) <= wiphy->max_adj_channel_rssi_comp; - res =cfg80211_bss_update (wiphy_to_rdev (wiphy), &tmp, signal_valid); + res =cfg80211_bss_update (wiphy_to_rdev (wiphy), &tmp, trans_bss, + signal_valid);if (!res)return NULL ;
Signature · 1 line
2.7.4
PATCH v2 3/5 cfg80211: Move Multiple BSS info to struct cfg80211_bss to be visible
In reply to Jouni MalinenFrom: Sara Sharon <[email protected]>
Previously the transmitted BSS and the non-trasmitted BSS list were defined in struct cfg80211_internal_bss. Move them to struct cfg80211_bss since mac80211 needs this info.
--- include/net/cfg80211.h | 2 ++ net/wireless/core.h | 10 +++---- net/wireless/scan.c | 79 +++++++++++++++++++++++++------------------------- 3 files changed, 45 insertions(+), 46 deletions(-)
v2:
- rebased on top of changes in previous patches
include/net/cfg80211.h +2 -0
@@ -2021,6 +2021,8 @@ struct cfg80211_bss {const struct cfg80211_bss_ies __rcu *proberesp_ies;struct cfg80211_bss *hidden_beacon_bss; +struct cfg80211_bss *transmitted_bss; +struct list_head nontrans_list;s32 signal;
net/wireless/core.h +4 -6
@@ -152,8 +152,6 @@ extern int cfg80211_rdev_list_generation;struct cfg80211_internal_bss {struct list_head list;struct list_head hidden_list; -struct list_head nontrans_list; -struct cfg80211_bss *transmitted_bss;struct rb_node rbn;u64 ts_boottime;unsigned long ts;
@@ -184,8 +182,8 @@ static inline struct cfg80211_internal_bss *bss_from_pub(struct cfg80211_bss *pustatic inline void cfg80211_hold_bss (struct cfg80211_internal_bss *bss) {atomic_inc (&bss->hold); -if (bss->transmitted_bss) { - bss =container_of (bss->transmitted_bss, +if (bss->pub.transmitted_bss) { + bss =container_of (bss->pub.transmitted_bss, struct cfg80211_internal_bss, pub);atomic_inc (&bss->hold); }
@@ -195,8 +193,8 @@ static inline void cfg80211_unhold_bss(struct cfg80211_internal_bss *bss) {int r =atomic_dec_return (&bss->hold);WARN_ON (r <0 ); -if (bss->transmitted_bss) { - bss =container_of (bss->transmitted_bss, +if (bss->pub.transmitted_bss) { + bss =container_of (bss->pub.transmitted_bss, struct cfg80211_internal_bss, pub); r =atomic_dec_return (&bss->hold);WARN_ON (r <0 );
net/wireless/scan.c +39 -40
194 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 4/5 mac80211: Declare support for Multi-BSSID if driver supports it
In reply to Jouni MalinenFrom: Sara Sharon <[email protected]>
Define bits and flags for indicating support of Multi-BSSID feature and indicate support for this if the driver supports it.
--- include/linux/ieee80211.h | 5 +++++ include/net/mac80211.h | 3 +++ net/mac80211/debugfs.c | 1 + net/mac80211/main.c | 4 ++++ 4 files changed, 13 insertions(+)
v2:
- remove an extra empty line to silence checkpatch.pl --strict
include/linux/ieee80211.h +5 -0
@@ -2656,6 +2656,11 @@ enum ieee80211_tdls_actioncode {*/ #define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2) +/* Multiple BSSID capability is set in the 6th bit of the 3rd byte of the +* @WLAN_EID_EXT_CAPABILITY information element +*/ +#define WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT BIT(6) +/* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */ #define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)#define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
include/net/mac80211.h +3 -0
@@ -2181,6 +2181,8 @@ struct ieee80211_txq {* MMPDUs on station interfaces. This of course requires the driver to use * TXQs to start with. * +* @IEEE80211_HW_SUPPORTS_MULTI_BSSID: Hardware supports multi BSSID +* * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays */ enum ieee80211_hw_flags {
@@ -2229,6 +2231,7 @@ enum ieee80211_hw_flags {IEEE80211_HW_BUFF_MMPDU_TXQ ,IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW ,IEEE80211_HW_STA_MMPDU_TXQ , +IEEE80211_HW_SUPPORTS_MULTI_BSSID ,/* keep last, obviously */ NUM_IEEE80211_HW_FLAGS
net/mac80211/debugfs.c +1 -0
@@ -218,6 +218,7 @@ static const char *hw_flag_names[] = {FLAG (BUFF_MMPDU_TXQ ),FLAG (SUPPORTS_VHT_EXT_NSS_BW ),FLAG (STA_MMPDU_TXQ ), +FLAG (SUPPORTS_MULTI_BSSID ), #undef FLAG };
net/mac80211/main.c +4 -0
@@ -1104,6 +1104,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)if (ieee80211_hw_check (&local->hw,CHANCTX_STA_CSA )) local->ext_capa[0 ] |=WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING ; +/* mac80211 supports multi BSSID, if the driver supports it */ +if (ieee80211_hw_check (&local->hw,SUPPORTS_MULTI_BSSID )) + local->ext_capa[2 ] |=WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT ; + local->hw.wiphy->max_num_csa_counters =IEEE80211_MAX_CSA_COUNTERS_NUM ; result =wiphy_register (local->hw.wiphy);
Signature · 1 line
2.7.4
PATCH v2 5/5 mac80211_hwsim: Declare support for Multi-BSSID
In reply to Jouni MalinenThis can be used to test cfg80211 support for Multi-BSSID scan result parsing.
--- drivers/net/wireless/mac80211_hwsim.c | 1 + 1 file changed, 1 insertion(+)
v2:
- no changes
drivers/net/wireless/mac80211_hwsim.c +1 -0
@@ -2794,6 +2794,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,ieee80211_hw_set (hw,TDLS_WIDER_BW );if (rctbl)ieee80211_hw_set (hw,SUPPORTS_RC_TABLE ); +ieee80211_hw_set (hw,SUPPORTS_MULTI_BSSID ); hw->wiphy->flags |=WIPHY_FLAG_SUPPORTS_TDLS | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Signature · 1 line
2.7.4
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Peng,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on mac80211-next/master]
[also build test ERROR on v4.20-rc7 next-20181220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Jouni-Malinen/cfg80211-Parsing-of-Multiple-BSSID-information-in-scanning/20181221-123747 base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master config: i386-randconfig-x0-12211724 (attached as .config) compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
net/wireless/scan.o: In function `cfg80211_gen_new_bssid':
>> net/wireless/scan.c:174: undefined reference to `__umoddi3'
vim +174 net/wireless/scan.c
162
163 static void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
164 u8 mbssid_index, u8 *new_bssid_addr)
165 {
166 u64 bssid_tmp, new_bssid = 0;
167 u64 lsb_n;
168
169 bssid_tmp = ether_addr_to_u64(bssid);
170
171 lsb_n = bssid_tmp & ((1 << max_bssid) - 1);
172 new_bssid = bssid_tmp;
173 new_bssid &= ~((1 << max_bssid) - 1);
> 174 new_bssid |= (lsb_n + mbssid_index) % (1 << max_bssid);
175
176 u64_to_ether_addr(new_bssid, new_bssid_addr);
177 }
178
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botThank you for the patch! Yet something to improve:
Hi Peng,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on mac80211-next/master]
[also build test ERROR on v4.20-rc7 next-20181221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Jouni-Malinen/cfg80211-Parsing-of-Multiple-BSSID-information-in-scanning/20181221-123747 base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master config: i386-randconfig-a0-12230948 (attached as .config) compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
>> ERROR: "__umoddi3" [net/wireless/cfg80211.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation