All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless-next] mac80211: introduce BSS color collision detection
@ 2022-03-21 10:33 Lorenzo Bianconi
  2022-03-22  6:14   ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2022-03-21 10:33 UTC (permalink / raw)
  To: johannes
  Cc: nbd, linux-wireless, lorenzo.bianconi, ryder.lee, evelyn.tsai,
	chui-hao.chiu, j

Add ieee80211_rx_check_bss_color_collision routine in order to introduce
BSS color collision detection in mac80211 if it is not supported in HW/FW
(e.g. for mt7915 chipset).
Add NL80211_EXT_FEATURE_HW_COLOR_COLLISION flag to let the driver notify
BSS color collision detection is supported in HW/FW.

Tested-by: Peter Chiu <Chui-Hao.Chiu@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/ath/ath11k/mac.c |  6 +++-
 include/uapi/linux/nl80211.h          |  4 +++
 net/mac80211/rx.c                     | 44 +++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index d5b83f90d27a..12af2b073574 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8483,9 +8483,13 @@ static int __ath11k_mac_register(struct ath11k *ar)
 
 	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
 	wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
-	if (test_bit(WMI_TLV_SERVICE_BSS_COLOR_OFFLOAD, ar->ab->wmi_ab.svc_map))
+	if (test_bit(WMI_TLV_SERVICE_BSS_COLOR_OFFLOAD,
+		     ar->ab->wmi_ab.svc_map)) {
 		wiphy_ext_feature_set(ar->hw->wiphy,
 				      NL80211_EXT_FEATURE_BSS_COLOR);
+		wiphy_ext_feature_set(ar->hw->wiphy,
+				      NL80211_EXT_FEATURE_HW_COLOR_COLLISION);
+	}
 
 	ar->hw->wiphy->cipher_suites = cipher_suites;
 	ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 0568a79097b8..c54dca41ff89 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -6172,6 +6172,9 @@ enum nl80211_feature_flags {
  * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC
  *	detection.
  *
+ * @NL80211_EXT_FEATURE_HW_COLOR_COLLISION: The driver supports BSS color
+ *	collision detection in hw/fw.
+ *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -6239,6 +6242,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_BSS_COLOR,
 	NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD,
 	NL80211_EXT_FEATURE_RADAR_BACKGROUND,
+	NL80211_EXT_FEATURE_HW_COLOR_COLLISION,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index beb6b92eb780..0ad961be6afa 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3178,6 +3178,47 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,
 	ieee80211_tx_skb(sdata, skb);
 }
 
+static void
+ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
+{
+	struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
+	const struct element *ie;
+	size_t baselen;
+
+	if (!wiphy_ext_feature_isset(rx->local->hw.wiphy,
+				     NL80211_EXT_FEATURE_BSS_COLOR))
+		return;
+
+	if (wiphy_ext_feature_isset(rx->local->hw.wiphy,
+				    NL80211_EXT_FEATURE_HW_COLOR_COLLISION))
+		return;
+
+	baselen = mgmt->u.beacon.variable - rx->skb->data;
+	if (baselen > rx->skb->len)
+		return;
+
+	ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION,
+				    mgmt->u.beacon.variable,
+				    rx->skb->len - baselen);
+	if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) &&
+	    ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) {
+		struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf;
+		const struct ieee80211_he_operation *he_oper;
+		u8 color;
+
+		he_oper = (void *)(ie->data + 1);
+		if (le32_get_bits(he_oper->he_oper_params,
+				  IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED))
+			return;
+
+		color = le32_get_bits(he_oper->he_oper_params,
+				      IEEE80211_HE_OPERATION_BSS_COLOR_MASK);
+		if (color == bss_conf->he_bss_color.color)
+			ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
+							       BIT(color));
+	}
+}
+
 static ieee80211_rx_result debug_noinline
 ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)
 {
@@ -3203,6 +3244,9 @@ ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)
 	    !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) {
 		int sig = 0;
 
+		/* sw bss color collision detection */
+		ieee80211_rx_check_bss_color_collision(rx);
+
 		if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM) &&
 		    !(status->flag & RX_FLAG_NO_SIGNAL_VAL))
 			sig = status->signal;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH wireless-next] mac80211: introduce BSS color collision detection
  2022-03-21 10:33 [PATCH wireless-next] mac80211: introduce BSS color collision detection Lorenzo Bianconi
  2022-03-22  6:14   ` Dan Carpenter
@ 2022-03-22  6:14   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2022-03-21 21:22 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 5384 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <6226a016389e034fd9c208b3a7a75edd01aba6f4.1647858505.git.lorenzo@kernel.org>
References: <6226a016389e034fd9c208b3a7a75edd01aba6f4.1647858505.git.lorenzo@kernel.org>
TO: Lorenzo Bianconi <lorenzo@kernel.org>
TO: johannes(a)sipsolutions.net
CC: nbd(a)nbd.name
CC: linux-wireless(a)vger.kernel.org
CC: lorenzo.bianconi(a)redhat.com
CC: ryder.lee(a)mediatek.com
CC: evelyn.tsai(a)mediatek.com
CC: chui-hao.chiu(a)mediatek.com
CC: j(a)w1.fi

Hi Lorenzo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main kvalo-ath/ath-next v5.17 next-20220321]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mac80211-introduce-BSS-color-collision-detection/20220321-183456
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: nios2-randconfig-m031-20220321 (https://download.01.org/0day-ci/archive/20220322/202203220555.BHvsEAhe-lkp(a)intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/mac80211/rx.c:3218 ieee80211_rx_check_bss_color_collision() warn: should '(((1))) << color' be a 64 bit type?

Old smatch warnings:
net/mac80211/rx.c:877 ieee80211_rx_monitor() warn: variable dereferenced before check 'origskb' (see line 770)
arch/nios2/include/asm/thread_info.h:71 current_thread_info() error: uninitialized symbol 'sp'.

vim +3218 net/mac80211/rx.c

fea147328908b7 Jouni Malinen    2009-01-08  3180  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3181  static void
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3182  ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3183  {
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3184  	struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3185  	const struct element *ie;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3186  	size_t baselen;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3187  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3188  	if (!wiphy_ext_feature_isset(rx->local->hw.wiphy,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3189  				     NL80211_EXT_FEATURE_BSS_COLOR))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3190  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3191  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3192  	if (wiphy_ext_feature_isset(rx->local->hw.wiphy,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3193  				    NL80211_EXT_FEATURE_HW_COLOR_COLLISION))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3194  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3195  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3196  	baselen = mgmt->u.beacon.variable - rx->skb->data;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3197  	if (baselen > rx->skb->len)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3198  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3199  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3200  	ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3201  				    mgmt->u.beacon.variable,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3202  				    rx->skb->len - baselen);
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3203  	if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) &&
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3204  	    ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) {
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3205  		struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3206  		const struct ieee80211_he_operation *he_oper;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3207  		u8 color;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3208  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3209  		he_oper = (void *)(ie->data + 1);
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3210  		if (le32_get_bits(he_oper->he_oper_params,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3211  				  IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3212  			return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3213  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3214  		color = le32_get_bits(he_oper->he_oper_params,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3215  				      IEEE80211_HE_OPERATION_BSS_COLOR_MASK);
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3216  		if (color == bss_conf->he_bss_color.color)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3217  			ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
964596b43c17b4 Lorenzo Bianconi 2022-03-21 @3218  							       BIT(color));
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3219  	}
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3220  }
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3221  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [kbuild] Re: [PATCH wireless-next] mac80211: introduce BSS color collision detection
@ 2022-03-22  6:14   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-03-22  6:14 UTC (permalink / raw)
  To: kbuild, Lorenzo Bianconi, johannes
  Cc: lkp, kbuild-all, nbd, linux-wireless, lorenzo.bianconi,
	ryder.lee, evelyn.tsai, chui-hao.chiu, j

Hi Lorenzo,

url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mac80211-introduce-BSS-color-collision-detection/20220321-183456 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git  main
config: nios2-randconfig-m031-20220321 (https://download.01.org/0day-ci/archive/20220322/202203220555.BHvsEAhe-lkp@intel.com/config )
compiler: nios2-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/mac80211/rx.c:3218 ieee80211_rx_check_bss_color_collision() warn: should '(((1))) << color' be a 64 bit type?

vim +3218 net/mac80211/rx.c

964596b43c17b4 Lorenzo Bianconi 2022-03-21  3181  static void
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3182  ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3183  {
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3184  	struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3185  	const struct element *ie;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3186  	size_t baselen;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3187  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3188  	if (!wiphy_ext_feature_isset(rx->local->hw.wiphy,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3189  				     NL80211_EXT_FEATURE_BSS_COLOR))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3190  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3191  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3192  	if (wiphy_ext_feature_isset(rx->local->hw.wiphy,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3193  				    NL80211_EXT_FEATURE_HW_COLOR_COLLISION))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3194  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3195  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3196  	baselen = mgmt->u.beacon.variable - rx->skb->data;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3197  	if (baselen > rx->skb->len)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3198  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3199  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3200  	ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3201  				    mgmt->u.beacon.variable,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3202  				    rx->skb->len - baselen);
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3203  	if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) &&
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3204  	    ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) {
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3205  		struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3206  		const struct ieee80211_he_operation *he_oper;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3207  		u8 color;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3208  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3209  		he_oper = (void *)(ie->data + 1);
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3210  		if (le32_get_bits(he_oper->he_oper_params,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3211  				  IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3212  			return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3213  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3214  		color = le32_get_bits(he_oper->he_oper_params,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3215  				      IEEE80211_HE_OPERATION_BSS_COLOR_MASK);

IEEE80211_HE_OPERATION_BSS_COLOR_MASK gives us 63

964596b43c17b4 Lorenzo Bianconi 2022-03-21  3216  		if (color == bss_conf->he_bss_color.color)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3217  			ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
964596b43c17b4 Lorenzo Bianconi 2022-03-21 @3218  							       BIT(color));

So this should be BIT_ULL()

964596b43c17b4 Lorenzo Bianconi 2022-03-21  3219  	}
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3220  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp 
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [kbuild] Re: [PATCH wireless-next] mac80211: introduce BSS color collision detection
@ 2022-03-22  6:14   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-03-22  6:14 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4338 bytes --]

Hi Lorenzo,

url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mac80211-introduce-BSS-color-collision-detection/20220321-183456 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git  main
config: nios2-randconfig-m031-20220321 (https://download.01.org/0day-ci/archive/20220322/202203220555.BHvsEAhe-lkp(a)intel.com/config )
compiler: nios2-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/mac80211/rx.c:3218 ieee80211_rx_check_bss_color_collision() warn: should '(((1))) << color' be a 64 bit type?

vim +3218 net/mac80211/rx.c

964596b43c17b4 Lorenzo Bianconi 2022-03-21  3181  static void
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3182  ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3183  {
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3184  	struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3185  	const struct element *ie;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3186  	size_t baselen;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3187  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3188  	if (!wiphy_ext_feature_isset(rx->local->hw.wiphy,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3189  				     NL80211_EXT_FEATURE_BSS_COLOR))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3190  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3191  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3192  	if (wiphy_ext_feature_isset(rx->local->hw.wiphy,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3193  				    NL80211_EXT_FEATURE_HW_COLOR_COLLISION))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3194  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3195  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3196  	baselen = mgmt->u.beacon.variable - rx->skb->data;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3197  	if (baselen > rx->skb->len)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3198  		return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3199  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3200  	ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3201  				    mgmt->u.beacon.variable,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3202  				    rx->skb->len - baselen);
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3203  	if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) &&
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3204  	    ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) {
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3205  		struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3206  		const struct ieee80211_he_operation *he_oper;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3207  		u8 color;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3208  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3209  		he_oper = (void *)(ie->data + 1);
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3210  		if (le32_get_bits(he_oper->he_oper_params,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3211  				  IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED))
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3212  			return;
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3213  
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3214  		color = le32_get_bits(he_oper->he_oper_params,
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3215  				      IEEE80211_HE_OPERATION_BSS_COLOR_MASK);

IEEE80211_HE_OPERATION_BSS_COLOR_MASK gives us 63

964596b43c17b4 Lorenzo Bianconi 2022-03-21  3216  		if (color == bss_conf->he_bss_color.color)
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3217  			ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
964596b43c17b4 Lorenzo Bianconi 2022-03-21 @3218  							       BIT(color));

So this should be BIT_ULL()

964596b43c17b4 Lorenzo Bianconi 2022-03-21  3219  	}
964596b43c17b4 Lorenzo Bianconi 2022-03-21  3220  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp 
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [kbuild] Re: [PATCH wireless-next] mac80211: introduce BSS color collision detection
  2022-03-22  6:14   ` Dan Carpenter
@ 2022-03-22  9:43     ` Lorenzo Bianconi
  -1 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2022-03-22  9:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kbuild, Lorenzo Bianconi, johannes, lkp, kbuild-all, nbd,
	linux-wireless, ryder.lee, evelyn.tsai, chui-hao.chiu, j

[-- Attachment #1: Type: text/plain, Size: 4526 bytes --]

> Hi Lorenzo,
> 
> url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mac80211-introduce-BSS-color-collision-detection/20220321-183456 
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git  main
> config: nios2-randconfig-m031-20220321 (https://download.01.org/0day-ci/archive/20220322/202203220555.BHvsEAhe-lkp@intel.com/config )
> compiler: nios2-linux-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> New smatch warnings:
> net/mac80211/rx.c:3218 ieee80211_rx_check_bss_color_collision() warn: should '(((1))) << color' be a 64 bit type?
> 
> vim +3218 net/mac80211/rx.c
> 
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3181  static void
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3182  ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3183  {
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3184  	struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3185  	const struct element *ie;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3186  	size_t baselen;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3187  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3188  	if (!wiphy_ext_feature_isset(rx->local->hw.wiphy,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3189  				     NL80211_EXT_FEATURE_BSS_COLOR))
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3190  		return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3191  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3192  	if (wiphy_ext_feature_isset(rx->local->hw.wiphy,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3193  				    NL80211_EXT_FEATURE_HW_COLOR_COLLISION))
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3194  		return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3195  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3196  	baselen = mgmt->u.beacon.variable - rx->skb->data;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3197  	if (baselen > rx->skb->len)
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3198  		return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3199  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3200  	ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3201  				    mgmt->u.beacon.variable,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3202  				    rx->skb->len - baselen);
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3203  	if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) &&
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3204  	    ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) {
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3205  		struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3206  		const struct ieee80211_he_operation *he_oper;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3207  		u8 color;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3208  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3209  		he_oper = (void *)(ie->data + 1);
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3210  		if (le32_get_bits(he_oper->he_oper_params,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3211  				  IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED))
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3212  			return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3213  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3214  		color = le32_get_bits(he_oper->he_oper_params,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3215  				      IEEE80211_HE_OPERATION_BSS_COLOR_MASK);
> 
> IEEE80211_HE_OPERATION_BSS_COLOR_MASK gives us 63
> 
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3216  		if (color == bss_conf->he_bss_color.color)
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3217  			ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21 @3218  							       BIT(color));
> 
> So this should be BIT_ULL()

ack, I will fix it in v2.

Regards,
Lorenzo

> 
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3219  	}
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3220  }
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://01.org/lkp 
> _______________________________________________
> kbuild mailing list -- kbuild@lists.01.org
> To unsubscribe send an email to kbuild-leave@lists.01.org
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [kbuild] Re: [PATCH wireless-next] mac80211: introduce BSS color collision detection
@ 2022-03-22  9:43     ` Lorenzo Bianconi
  0 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Bianconi @ 2022-03-22  9:43 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4532 bytes --]

> Hi Lorenzo,
> 
> url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/mac80211-introduce-BSS-color-collision-detection/20220321-183456 
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git  main
> config: nios2-randconfig-m031-20220321 (https://download.01.org/0day-ci/archive/20220322/202203220555.BHvsEAhe-lkp(a)intel.com/config )
> compiler: nios2-linux-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> New smatch warnings:
> net/mac80211/rx.c:3218 ieee80211_rx_check_bss_color_collision() warn: should '(((1))) << color' be a 64 bit type?
> 
> vim +3218 net/mac80211/rx.c
> 
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3181  static void
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3182  ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3183  {
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3184  	struct ieee80211_mgmt *mgmt = (void *)rx->skb->data;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3185  	const struct element *ie;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3186  	size_t baselen;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3187  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3188  	if (!wiphy_ext_feature_isset(rx->local->hw.wiphy,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3189  				     NL80211_EXT_FEATURE_BSS_COLOR))
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3190  		return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3191  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3192  	if (wiphy_ext_feature_isset(rx->local->hw.wiphy,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3193  				    NL80211_EXT_FEATURE_HW_COLOR_COLLISION))
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3194  		return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3195  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3196  	baselen = mgmt->u.beacon.variable - rx->skb->data;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3197  	if (baselen > rx->skb->len)
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3198  		return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3199  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3200  	ie = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_OPERATION,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3201  				    mgmt->u.beacon.variable,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3202  				    rx->skb->len - baselen);
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3203  	if (ie && ie->datalen >= sizeof(struct ieee80211_he_operation) &&
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3204  	    ie->datalen >= ieee80211_he_oper_size(ie->data + 1)) {
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3205  		struct ieee80211_bss_conf *bss_conf = &rx->sdata->vif.bss_conf;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3206  		const struct ieee80211_he_operation *he_oper;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3207  		u8 color;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3208  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3209  		he_oper = (void *)(ie->data + 1);
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3210  		if (le32_get_bits(he_oper->he_oper_params,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3211  				  IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED))
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3212  			return;
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3213  
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3214  		color = le32_get_bits(he_oper->he_oper_params,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3215  				      IEEE80211_HE_OPERATION_BSS_COLOR_MASK);
> 
> IEEE80211_HE_OPERATION_BSS_COLOR_MASK gives us 63
> 
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3216  		if (color == bss_conf->he_bss_color.color)
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3217  			ieeee80211_obss_color_collision_notify(&rx->sdata->vif,
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21 @3218  							       BIT(color));
> 
> So this should be BIT_ULL()

ack, I will fix it in v2.

Regards,
Lorenzo

> 
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3219  	}
> 964596b43c17b4 Lorenzo Bianconi 2022-03-21  3220  }
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://01.org/lkp 
> _______________________________________________
> kbuild mailing list -- kbuild(a)lists.01.org
> To unsubscribe send an email to kbuild-leave(a)lists.01.org
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-22  9:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 10:33 [PATCH wireless-next] mac80211: introduce BSS color collision detection Lorenzo Bianconi
2022-03-21 21:22 ` kernel test robot
2022-03-22  6:14   ` [kbuild] " Dan Carpenter
2022-03-22  6:14   ` Dan Carpenter
2022-03-22  9:43   ` Lorenzo Bianconi
2022-03-22  9:43     ` Lorenzo Bianconi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.