wireless: add check of field VHT Extended NSS BW Capable for 160/80+80 MHz setting
PATCH 1/1 wireless: add check of field VHT Extended NSS BW Capable for 160/80+80 MHz setting
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.
--- net/wireless/chan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/wireless/chan.c +5 -3
@@ -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 :
Signature · 1 line
2.31.1
Quoted 6 lines · Wen Gong
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.
Almost looks good to me, but...
Quoted 9 lines
Signed-off-by Wen Gong <[email protected]>--- net/wireless/chan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)net/wireless/chan.c +0
-0
[...]
net/wireless/chan.c bool cfg80211_chandef_usable(struct wiphy *wiphy, · line 1042
Quoted 6 lines
net/wireless/chan.c +1
-1@@ -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 ))
you should not mix logical and binary operators so add braces around the binary operation here.
Regards,
Arend
Quoted 4 lines
net/wireless/chan.c +0
-0return false;break ;default :
Quoted 22 lines · Arend van Spriel
Quoted 6 lines · Wen Gong
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.
Almost looks good to me, but...
Quoted 9 lines
Signed-off-by Wen Gong <[email protected]>--- net/wireless/chan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)net/wireless/chan.c +0
-0[...]
Quoted 11 lines
net/wireless/chan.c bool cfg80211_chandef_usable(struct wiphy · line 1044
Quoted 8 lines
net/wireless/chan.c +1
-1@@ -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 ))you should not mix logical and binary operators so add braces around the binary operation here.
priority of & is higher than &&, so it not need to add braces here. however, i have sent patch v2 which added the braces.
https://lore.kernel.org/linux-wireless/[email protected]/T/#u
Quoted 8 lines
Regards,
ArendQuoted 4 lines
net/wireless/chan.c +0
-0return false;break;
default: