diff mbox

[2/3] mwifiex: fix incorrect ht capability problem

Message ID 1520619326-14888-3-git-send-email-gbhat@marvell.com (mailing list archive)
State Accepted
Commit 77423fa739274a4c7b0e7ad90ca52ef22bdbe84e
Delegated to: Kalle Valo
Headers show

Commit Message

Ganapathi Bhat March 9, 2018, 6:15 p.m. UTC
IEEE80211_CHAN_NO_HT40PLUS and IEEE80211_CHAN_NO_HT40PLUS channel
flags tell if HT40 operation is allowed on a channel or not.

This patch ensures ht_capability information is modified
accordingly so that we don't end up creating a HT40 connection
when it's not allowed for current regulatory domain.

Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/11n.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Kalle Valo March 14, 2018, 9:51 a.m. UTC | #1
Ganapathi Bhat <gbhat@marvell.com> writes:

> IEEE80211_CHAN_NO_HT40PLUS and IEEE80211_CHAN_NO_HT40PLUS channel
> flags tell if HT40 operation is allowed on a channel or not.
>
> This patch ensures ht_capability information is modified
> accordingly so that we don't end up creating a HT40 connection
> when it's not allowed for current regulatory domain.
>
> Signed-off-by: Cathy Luo <cluo@marvell.com>
> Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>

kbuild bot reported sparse warnings from this patch:

drivers/net/wireless/marvell/mwifiex/11n.c:358:65: sparse: invalid assignment: &=
drivers/net/wireless/marvell/mwifiex/11n.c:358:65:    left side has type restricted __le16
drivers/net/wireless/marvell/mwifiex/11n.c:358:65:    right side has type int
drivers/net/wireless/marvell/mwifiex/11n.c:360:65: sparse: invalid assignment: &=
drivers/net/wireless/marvell/mwifiex/11n.c:360:65:    left side has type restricted __le16
drivers/net/wireless/marvell/mwifiex/11n.c:360:65:    right side has type int
drivers/net/wireless/marvell/mwifiex/11n.c:366:65: sparse: invalid assignment: &=
drivers/net/wireless/marvell/mwifiex/11n.c:366:65:    left side has type restricted __le16
drivers/net/wireless/marvell/mwifiex/11n.c:366:65:    right side has type int
drivers/net/wireless/marvell/mwifiex/11n.c:368:65: sparse: invalid assignment: &=
drivers/net/wireless/marvell/mwifiex/11n.c:368:65:    left side has type restricted __le16
drivers/net/wireless/marvell/mwifiex/11n.c:368:65:    right side has type int

Please submit a followup patch to fix those.
Ganapathi Bhat March 15, 2018, 7:33 a.m. UTC | #2
Hi Kalle,

> Ganapathi Bhat <gbhat@marvell.com> writes:
>
> > IEEE80211_CHAN_NO_HT40PLUS and IEEE80211_CHAN_NO_HT40PLUS
> channel
> > flags tell if HT40 operation is allowed on a channel or not.
> >
> > This patch ensures ht_capability information is modified accordingly
> > so that we don't end up creating a HT40 connection when it's not
> > allowed for current regulatory domain.
> >
> > Signed-off-by: Cathy Luo <cluo@marvell.com>
> > Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
>
> kbuild bot reported sparse warnings from this patch:
>
> drivers/net/wireless/marvell/mwifiex/11n.c:358:65: sparse: invalid
> assignment: &=
> drivers/net/wireless/marvell/mwifiex/11n.c:358:65:    left side has type
> restricted __le16
> drivers/net/wireless/marvell/mwifiex/11n.c:358:65:    right side has type int
> drivers/net/wireless/marvell/mwifiex/11n.c:360:65: sparse: invalid
> assignment: &=
> drivers/net/wireless/marvell/mwifiex/11n.c:360:65:    left side has type
> restricted __le16
> drivers/net/wireless/marvell/mwifiex/11n.c:360:65:    right side has type int
> drivers/net/wireless/marvell/mwifiex/11n.c:366:65: sparse: invalid
> assignment: &=
> drivers/net/wireless/marvell/mwifiex/11n.c:366:65:    left side has type
> restricted __le16
> drivers/net/wireless/marvell/mwifiex/11n.c:366:65:    right side has type int
> drivers/net/wireless/marvell/mwifiex/11n.c:368:65: sparse: invalid
> assignment: &=
> drivers/net/wireless/marvell/mwifiex/11n.c:368:65:    left side has type
> restricted __le16
> drivers/net/wireless/marvell/mwifiex/11n.c:368:65:    right side has type int
>
> Please submit a followup patch to fix those.
Sorry for the errors. Yes we have submitted a follow up fix.
>
> --
> Kalle Valo

Regards,
Ganapathi
diff mbox

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/11n.c b/drivers/net/wireless/marvell/mwifiex/11n.c
index 8772e39..feebfdc 100644
--- a/drivers/net/wireless/marvell/mwifiex/11n.c
+++ b/drivers/net/wireless/marvell/mwifiex/11n.c
@@ -341,6 +341,36 @@  int mwifiex_cmd_11n_cfg(struct mwifiex_private *priv,
 		       le16_to_cpu(ht_cap->header.len));
 
 		mwifiex_fill_cap_info(priv, radio_type, &ht_cap->ht_cap);
+		/* Update HT40 capability from current channel information */
+		if (bss_desc->bcn_ht_oper) {
+			u8 ht_param = bss_desc->bcn_ht_oper->ht_param;
+			u8 radio =
+			mwifiex_band_to_radio_type(bss_desc->bss_band);
+			int freq =
+			ieee80211_channel_to_frequency(bss_desc->channel,
+						       radio);
+			struct ieee80211_channel *chan =
+			ieee80211_get_channel(priv->adapter->wiphy, freq);
+
+			switch (ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
+			case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
+				if (chan->flags & IEEE80211_CHAN_NO_HT40PLUS) {
+					ht_cap->ht_cap.cap_info &=
+					~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+					ht_cap->ht_cap.cap_info &=
+					~IEEE80211_HT_CAP_SGI_40;
+				}
+				break;
+			case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
+				if (chan->flags & IEEE80211_CHAN_NO_HT40MINUS) {
+					ht_cap->ht_cap.cap_info &=
+					~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+					ht_cap->ht_cap.cap_info &=
+					~IEEE80211_HT_CAP_SGI_40;
+				}
+				break;
+			}
+		}
 
 		*buffer += sizeof(struct mwifiex_ie_types_htcap);
 		ret_len += sizeof(struct mwifiex_ie_types_htcap);