linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Chen <chunfan.chen@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, francesco@dolcini.it,
	linux-mmc@vger.kernel.org, Ulf Hansson <ulfh@kernel.org>,
	Jeff Chen <jeff.chen_1@nxp.com>
Subject: [PATCH wireless-next 4/4] wifi: nxpwifi: Limit channel width based on firmware capability
Date: Tue,  8 Sep 2026 17:37:58 +0800	[thread overview]
Message-ID: <20260908093758.596444-5-chunfan.chen@gmail.com> (raw)
In-Reply-To: <20260908093758.596444-1-chunfan.chen@gmail.com>

From: Jeff Chen <jeff.chen_1@nxp.com>

nxpwifi_cmd_append_11n_tlv() derived the channel width solely from
the AP's advertised operating bandwidth and could request 40/80 MHz
operation even when the firmware did not support it.

On 20 MHz-only devices such as IW610, this may cause the firmware to
be configured with an unsupported channel width.

Check firmware bandwidth capabilities before selecting the channel
width:
- Allow 80 MHz only when ISSUPP_NO_80MHZ() is false.
- Allow 40 MHz only when ISSUPP_40MHZ_ENABLED() is true.
- Otherwise fall back to 20 MHz operation.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
---
 drivers/net/wireless/nxp/nxpwifi/11n.c | 4 +++-
 drivers/net/wireless/nxp/nxpwifi/fw.h  | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/nxp/nxpwifi/11n.c b/drivers/net/wireless/nxp/nxpwifi/11n.c
index c2a54d781b42..a83e29ecc466 100644
--- a/drivers/net/wireless/nxp/nxpwifi/11n.c
+++ b/drivers/net/wireless/nxp/nxpwifi/11n.c
@@ -349,6 +349,7 @@ nxpwifi_cmd_append_11n_tlv(struct nxpwifi_private *priv,
 			nxpwifi_band_to_radio_type((u8)bss_desc->bss_band);
 
 		if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info) &&
+		    !ISSUPP_NO_80MHZ(priv->adapter->fw_cap_ext) &&
 		    bss_desc->bcn_vht_oper &&
 		    bss_desc->bcn_vht_oper->chan_width ==
 		    IEEE80211_VHT_CHANWIDTH_80MHZ) {
@@ -359,7 +360,8 @@ nxpwifi_cmd_append_11n_tlv(struct nxpwifi_private *priv,
 				((CHAN_BW_80MHZ <<
 				  BAND_CFG_CHAN_WIDTH_SHIFT_BIT) &
 				 BAND_CFG_CHAN_WIDTH_MASK);
-		} else if (sband->ht_cap.cap &
+		} else if (ISSUPP_40MHZ_ENABLED(priv->adapter->fw_cap_ext) &&
+			   sband->ht_cap.cap &
 			   IEEE80211_HT_CAP_SUP_WIDTH_20_40 &&
 			   bss_desc->bcn_ht_oper->ht_param &
 			   IEEE80211_HT_PARAM_CHAN_WIDTH_ANY) {
diff --git a/drivers/net/wireless/nxp/nxpwifi/fw.h b/drivers/net/wireless/nxp/nxpwifi/fw.h
index 188110b020cf..124728a72442 100644
--- a/drivers/net/wireless/nxp/nxpwifi/fw.h
+++ b/drivers/net/wireless/nxp/nxpwifi/fw.h
@@ -334,6 +334,8 @@ enum NXPWIFI_802_11_PRIVACY_FILTER {
 #define DFS_CHAN_MOVE_TIME      10000
 
 #define ISSUPP_11AXENABLED(fw_cap_ext) ((fw_cap_ext) & BIT(7))
+#define ISSUPP_NO_80MHZ(fw_cap_ext)      ((fw_cap_ext) & BIT(8))
+#define ISSUPP_40MHZ_ENABLED(fw_cap_ext) ((fw_cap_ext) & BIT(15))
 
 #define HOST_CMD_GET_HW_SPEC                       0x0003
 #define HOST_CMD_802_11_SCAN                       0x0006
-- 
2.34.1


      parent reply	other threads:[~2026-09-08  9:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  9:37 [PATCH wireless-next 0/4] wifi: nxpwifi: add support for SDIO IW610 Jeff Chen
2026-09-08  9:37 ` [PATCH wireless-next 1/4] mmc: sdio: add NXP IW610 device ID Jeff Chen
2026-09-11 15:28   ` Ulf Hansson
2026-09-08  9:37 ` [PATCH wireless-next 2/4] mmc: core: add NXP IW610 base ID and block size quirk Jeff Chen
2026-09-11 15:28   ` Ulf Hansson
2026-09-08  9:37 ` [PATCH wireless-next 3/4] wifi: nxpwifi: Add support for SDIO-based IW610 Jeff Chen
2026-09-08  9:37 ` Jeff Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260908093758.596444-5-chunfan.chen@gmail.com \
    --to=chunfan.chen@gmail.com \
    --cc=francesco@dolcini.it \
    --cc=jeff.chen_1@nxp.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).