diff mbox series

[v2] wireless: add check of field VHT Extended NSS BW Capable for 160/80+80 MHz setting

Message ID 20210521021809.23986-1-wgong@codeaurora.org
State Superseded
Headers show
Series [v2] wireless: add check of field VHT Extended NSS BW Capable for 160/80+80 MHz setting | expand

Commit Message

Wen Gong May 21, 2021, 2:18 a.m. UTC
Table 9-251—Supported VHT-MCS and NSS Set subfields, it has subfield VHT Extended
NSS BW Capable, its definition is:
Indicates whether the STA is capable of interpreting the Extended NSS BW
Support subfield of the VHT Capabilities Information field.

This patch is to add check for the subfield.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
---
v2: change code style
 net/wireless/chan.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Wen Gong May 31, 2021, 3:04 a.m. UTC | #1
On 2021-05-23 02:36, kernel test robot wrote:
> Hi Wen,

> 

> Thank you for the patch! Perhaps something to improve:

> 

> [auto build test WARNING on mac80211-next/master]

> [also build test WARNING on mac80211/master v5.13-rc2 next-20210521]

> [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/Wen-Gong/wireless-add-check-of-field-VHT-Extended-NSS-BW-Capable-for-160-80-80-MHz-setting/20210522-224810

> base:

> https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git

> master

> config: i386-randconfig-s001-20210522 (attached as .config)

> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

> reproduce:

>         # apt-get install sparse

>         # sparse version: v0.6.3-341-g8af24329-dirty

>         #

> https://github.com/0day-ci/linux/commit/ed41c78effa1b66bb3d00e368b92940e5ffadb57

>         git remote add linux-review https://github.com/0day-ci/linux

>         git fetch --no-tags linux-review

> Wen-Gong/wireless-add-check-of-field-VHT-Extended-NSS-BW-Capable-for-160-80-80-MHz-setting/20210522-224810

>         git checkout ed41c78effa1b66bb3d00e368b92940e5ffadb57

>         # save the attached .config to linux build tree

>         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 

> ARCH=i386

> 

> If you fix the issue, kindly add following tag as appropriate

> Reported-by: kernel test robot <lkp@intel.com>

> 

> 

> sparse warnings: (new ones prefixed by >>)

>>> net/wireless/chan.c:953:39: sparse: sparse: restricted __le16 

>>> degrades to integer

> 


please use new patch: "[PATCH v3] wireless: add check of field VHT 
Extended NSS BW Capable for 160/80+80 MHz setting"

...
diff mbox series

Patch

diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 285b8076054b..e29562659ae5 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -942,7 +942,7 @@  bool cfg80211_chandef_usable(struct wiphy *wiphy,
 	struct ieee80211_sta_vht_cap *vht_cap;
 	struct ieee80211_edmg *edmg_cap;
 	u32 width, control_freq, cap;
-	bool support_80_80 = false;
+	bool ext_nss_cap, support_80_80 = false;
 
 	if (WARN_ON(!cfg80211_chandef_valid(chandef)))
 		return false;
@@ -950,6 +950,7 @@  bool cfg80211_chandef_usable(struct wiphy *wiphy,
 	ht_cap = &wiphy->bands[chandef->chan->band]->ht_cap;
 	vht_cap = &wiphy->bands[chandef->chan->band]->vht_cap;
 	edmg_cap = &wiphy->bands[chandef->chan->band]->edmg_cap;
+	ext_nss_cap = vht_cap->vht_mcs.tx_highest & IEEE80211_VHT_EXT_NSS_BW_CAPABLE;
 
 	if (edmg_cap->channels &&
 	    !cfg80211_edmg_usable(wiphy,
@@ -1015,7 +1016,8 @@  bool cfg80211_chandef_usable(struct wiphy *wiphy,
 			(cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) ||
 			(cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
 			 cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) ||
-			u32_get_bits(cap, IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) > 1;
+			(ext_nss_cap &&
+			 u32_get_bits(cap, IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) > 1);
 		if (chandef->chan->band != NL80211_BAND_6GHZ && !support_80_80)
 			return false;
 		fallthrough;
@@ -1037,7 +1039,7 @@  bool cfg80211_chandef_usable(struct wiphy *wiphy,
 		cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
 		if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
 		    cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ &&
-		    !(vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK))
+		    !(ext_nss_cap && (vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK)))
 			return false;
 		break;
 	default: