All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting
@ 2020-02-09 15:28 Shay Bar
  2020-02-10 12:38 ` Shay Bar
  2020-02-10 13:07 ` Shay Bar
  0 siblings, 2 replies; 4+ messages in thread
From: Shay Bar @ 2020-02-09 15:28 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, shay.bar, aviad.brikman

Before this patch, STA's would set new width of 160/80+80 Mhz based on AP capability only.
This is wrong because STA may not support > 80Mhz BW.
Fix is to verify STA has 160/80+80 Mhz capability before increasing its width to > 80Mhz.

Signed-off-by: Aviad Brikman <aviad.brikman@celeno.com>
Signed-off-by: Shay Bar <shay.bar@celeno.com>
---
 net/mac80211/util.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 32a7a53833c0..950fa4741d98 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2987,10 +2987,22 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
 	int cf0, cf1;
 	int ccfs0, ccfs1, ccfs2;
 	int ccf0, ccf1;
+	u32 vht_cap;
+	bool support_80_80 = false;
+	bool support_160 = false;
 
 	if (!oper || !htop)
 		return false;
 
+	vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap;
+	support_160 = (vht_cap & (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK |
+				  IEEE80211_VHT_CAP_EXT_NSS_BW_MASK));
+	support_80_80 = ((vht_cap &
+			 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) ||
+			(vht_cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
+			 vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) ||
+			((vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) >>
+				    IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT > 1));
 	ccfs0 = oper->center_freq_seg0_idx;
 	ccfs1 = oper->center_freq_seg1_idx;
 	ccfs2 = (le16_to_cpu(htop->operation_mode) &
@@ -3018,10 +3030,10 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
 			unsigned int diff;
 
 			diff = abs(ccf1 - ccf0);
-			if (diff == 8) {
+			if ((diff == 8) && support_160) {
 				new.width = NL80211_CHAN_WIDTH_160;
 				new.center_freq1 = cf1;
-			} else if (diff > 8) {
+			} else if ((diff > 8) && support_80_80) {
 				new.width = NL80211_CHAN_WIDTH_80P80;
 				new.center_freq2 = cf1;
 			}
-- 
2.17.1


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

* RE: [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting
  2020-02-09 15:28 [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting Shay Bar
@ 2020-02-10 12:38 ` Shay Bar
  2020-02-10 13:07 ` Shay Bar
  1 sibling, 0 replies; 4+ messages in thread
From: Shay Bar @ 2020-02-10 12:38 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Aviad Brikman

The "support_80_80" and "support_160" setting is based on:
"Table 9-272-Setting of the Supported Channel Width Set subfield and Extended NSS BW
Support subfield at a STA transmitting the VHT Capabilities Information field"
From "Draft P802.11REVmd_D3.0.pdf"

-----Original Message-----
From: Shay Bar <shay.bar@celeno.com>
Sent: Sunday, 9 February 2020 17:28
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org; Shay Bar <Shay.Bar@celeno.com>; Aviad Brikman <Aviad.Brikman@celeno.com>
Subject: [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting

External Email


Before this patch, STA's would set new width of 160/80+80 Mhz based on AP capability only.
This is wrong because STA may not support > 80Mhz BW.
Fix is to verify STA has 160/80+80 Mhz capability before increasing its width to > 80Mhz.

Signed-off-by: Aviad Brikman <aviad.brikman@celeno.com>
Signed-off-by: Shay Bar <shay.bar@celeno.com>
---
 net/mac80211/util.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 32a7a53833c0..950fa4741d98 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2987,10 +2987,22 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
        int cf0, cf1;
        int ccfs0, ccfs1, ccfs2;
        int ccf0, ccf1;
+       u32 vht_cap;
+       bool support_80_80 = false;
+       bool support_160 = false;

        if (!oper || !htop)
                return false;

+       vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap;
+       support_160 = (vht_cap & (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK |
+                                 IEEE80211_VHT_CAP_EXT_NSS_BW_MASK));
+       support_80_80 = ((vht_cap &
+                        IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) ||
+                       (vht_cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
+                        vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) ||
+                       ((vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) >>
+                                   IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT > 1));
        ccfs0 = oper->center_freq_seg0_idx;
        ccfs1 = oper->center_freq_seg1_idx;
        ccfs2 = (le16_to_cpu(htop->operation_mode) &
@@ -3018,10 +3030,10 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
                        unsigned int diff;

                        diff = abs(ccf1 - ccf0);
-                       if (diff == 8) {
+                       if ((diff == 8) && support_160) {
                                new.width = NL80211_CHAN_WIDTH_160;
                                new.center_freq1 = cf1;
-                       } else if (diff > 8) {
+                       } else if ((diff > 8) && support_80_80) {
                                new.width = NL80211_CHAN_WIDTH_80P80;
                                new.center_freq2 = cf1;
                        }
--
2.17.1

________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any retransmission, dissemination, copying or other use of, or taking of any action in reliance upon this information is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Nothing contained herein shall be deemed as a representation, warranty or a commitment by Celeno. No warranties are expressed or implied, including, but not limited to, any implied warranties of non-infringement, merchantability and fitness for a particular purpose.
________________________________


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

* [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting
  2020-02-09 15:28 [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting Shay Bar
  2020-02-10 12:38 ` Shay Bar
@ 2020-02-10 13:07 ` Shay Bar
  2020-02-14  8:53   ` Johannes Berg
  1 sibling, 1 reply; 4+ messages in thread
From: Shay Bar @ 2020-02-10 13:07 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, shay.bar, aviad.brikman

Before this patch, STA's would set new width of 160/80+80 Mhz based on AP capability only.
This is wrong because STA may not support > 80Mhz BW.
Fix is to verify STA has 160/80+80 Mhz capability before increasing its width to > 80Mhz.

The "support_80_80" and "support_160" setting is based on:
"Table 9-272 — Setting of the Supported Channel Width Set subfield and Extended NSS BW
Support subfield at a STA transmitting the VHT Capabilities Information field"
From "Draft P802.11REVmd_D3.0.pdf"

Signed-off-by: Aviad Brikman <aviad.brikman@celeno.com>
Signed-off-by: Shay Bar <shay.bar@celeno.com>
---
 net/mac80211/util.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 32a7a53833c0..950fa4741d98 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2987,10 +2987,22 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
 	int cf0, cf1;
 	int ccfs0, ccfs1, ccfs2;
 	int ccf0, ccf1;
+	u32 vht_cap;
+	bool support_80_80 = false;
+	bool support_160 = false;
 
 	if (!oper || !htop)
 		return false;
 
+	vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap;
+	support_160 = (vht_cap & (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK |
+				  IEEE80211_VHT_CAP_EXT_NSS_BW_MASK));
+	support_80_80 = ((vht_cap &
+			 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) ||
+			(vht_cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ &&
+			 vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) ||
+			((vht_cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) >>
+				    IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT > 1));
 	ccfs0 = oper->center_freq_seg0_idx;
 	ccfs1 = oper->center_freq_seg1_idx;
 	ccfs2 = (le16_to_cpu(htop->operation_mode) &
@@ -3018,10 +3030,10 @@ bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw,
 			unsigned int diff;
 
 			diff = abs(ccf1 - ccf0);
-			if (diff == 8) {
+			if ((diff == 8) && support_160) {
 				new.width = NL80211_CHAN_WIDTH_160;
 				new.center_freq1 = cf1;
-			} else if (diff > 8) {
+			} else if ((diff > 8) && support_80_80) {
 				new.width = NL80211_CHAN_WIDTH_80P80;
 				new.center_freq2 = cf1;
 			}
-- 
2.17.1


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

* Re: [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting
  2020-02-10 13:07 ` Shay Bar
@ 2020-02-14  8:53   ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2020-02-14  8:53 UTC (permalink / raw)
  To: Shay Bar; +Cc: linux-wireless, aviad.brikman

Hi,

On Mon, 2020-02-10 at 15:07 +0200, Shay Bar wrote:
> Before this patch, STA's would set new width of 160/80+80 Mhz based on AP capability only.
> This is wrong because STA may not support > 80Mhz BW.
> Fix is to verify STA has 160/80+80 Mhz capability before increasing its width to > 80Mhz.

Oh, good catch.

> +	vht_cap = hw->wiphy->bands[chandef->chan->band]->vht_cap.cap;

But I think this is possibly wrong, we might have VHT capa overrides?

Anyway, I've applied this as a fix now - we can fix it more later.

johannes


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

end of thread, other threads:[~2020-02-14  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-09 15:28 [PATCH] [PATCH] mac80211: fix wrong 160/80+80 Mhz setting Shay Bar
2020-02-10 12:38 ` Shay Bar
2020-02-10 13:07 ` Shay Bar
2020-02-14  8:53   ` Johannes Berg

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.