Linux wireless drivers development
 help / color / mirror / Atom feed
From: Lachlan Hodges <lachlan.hodges@morsemicro.com>
To: lachlan.hodges@morsemicro.com, dan.callaghan@morsemicro.com
Cc: linux-wireless@vger.kernel.org, arien.judge@morsemicro.com
Subject: [PATCH wireless-next 7/8] wifi: mm81x: clamp tx width to stas max supported width
Date: Thu, 27 Aug 2026 15:49:16 +1000	[thread overview]
Message-ID: <20260827054917.255584-8-lachlan.hodges@morsemicro.com> (raw)
In-Reply-To: <20260827054917.255584-1-lachlan.hodges@morsemicro.com>

max_bw_mhz is not populated with the stas maximum supported width
during association. This means data frames are sent at the operating
width, regardless of whether the sta can support the operating width.
For example a STA that supports up to 4MHz receiving frames from an AP
running on an 8MHz operating channel will be sent frames at 8MHz which
it cannot receive.

Make sure we initialise the stas maximum support bandwidth and while
we are here rename it to max_rx_bw_mhz to indicate its the maximum
bandwidth the sta can receive frames from.

Note: This should be conveyed via ieee80211_link_sta::bandwidth, but
the ieee80211_sta_rx_bandwidth enum does not support S1G widths as of
now and will require some non-trivial work to support in the future.

Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com>
---
 drivers/net/wireless/morsemicro/mm81x/core.h |  7 ++++++-
 drivers/net/wireless/morsemicro/mm81x/mac.c  | 11 +++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/morsemicro/mm81x/core.h b/drivers/net/wireless/morsemicro/mm81x/core.h
index 2fd4b4786e77..75e998e8e324 100644
--- a/drivers/net/wireless/morsemicro/mm81x/core.h
+++ b/drivers/net/wireless/morsemicro/mm81x/core.h
@@ -192,7 +192,12 @@ struct mm81x_sta {
 	bool tid_tx[IEEE80211_NUM_TIDS];
 	bool tid_start_tx[IEEE80211_NUM_TIDS];
 	u8 tid_params[IEEE80211_NUM_TIDS];
-	int max_bw_mhz;
+
+	/*
+	 * We really should be using link_sta::bandwidth but
+	 * that requires non-trivial work.
+	 */
+	int max_rx_bw_mhz;
 	struct mm81x_rc_sta rc;
 	struct mmrc_rate last_sta_tx_rate;
 	s16 avg_rssi;
diff --git a/drivers/net/wireless/morsemicro/mm81x/mac.c b/drivers/net/wireless/morsemicro/mm81x/mac.c
index fa3b0cfccffe..d77df6e9af85 100644
--- a/drivers/net/wireless/morsemicro/mm81x/mac.c
+++ b/drivers/net/wireless/morsemicro/mm81x/mac.c
@@ -325,7 +325,7 @@ static int mm81x_mac_ops_start(struct ieee80211_hw *hw)
 	return 0;
 }
 
-static int mm81x_tx_h_get_max_bw(struct mm81x *mors)
+static int mm81x_tx_h_get_max_tx_bw(struct mm81x *mors)
 {
 	return MM81X_FW_SUPP(&mors->fw_caps, 8MHZ) ? 8 :
 	       MM81X_FW_SUPP(&mors->fw_caps, 4MHZ) ? 4 :
@@ -1260,10 +1260,10 @@ static int mm81x_tx_h_get_bw(struct mm81x *mors, struct ieee80211_sta *sta,
 	if (sta)
 		mors_sta = (struct mm81x_sta *)sta->drv_priv;
 
-	tx_bw_mhz = min(mm81x_tx_h_get_max_bw(mors),
+	tx_bw_mhz = min(mm81x_tx_h_get_max_tx_bw(mors),
 			cfg80211_chandef_get_width(&mors->chandef));
-	if (mors_sta && mors_sta->max_bw_mhz)
-		tx_bw_mhz = min(tx_bw_mhz, mors_sta->max_bw_mhz);
+	if (mors_sta && mors_sta->max_rx_bw_mhz)
+		tx_bw_mhz = min(tx_bw_mhz, mors_sta->max_rx_bw_mhz);
 
 	return tx_bw_mhz;
 }
@@ -1718,6 +1718,9 @@ static int mm81x_mac_ops_sta_state(struct ieee80211_hw *hw,
 			mors_vif->u.ap.num_stas++;
 		else if (vif->type == NL80211_IFTYPE_STATION)
 			mors_vif->u.sta.is_assoc = true;
+
+		mors_sta->max_rx_bw_mhz =
+			S1G_SUPP_CH_WIDTH_MAX(sta->deflink.s1g_cap.cap);
 	}
 
 	if (new_state < old_state && new_state == IEEE80211_STA_NONE) {
-- 
2.43.0


  parent reply	other threads:[~2026-08-27  5:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  5:49 [PATCH wireless-next 0/8] wifi: mm81x: mcast and tx bw improvements Lachlan Hodges
2026-08-27  5:49 ` [PATCH wireless-next 1/8] wifi: mm81x: move beacon work and init below the tx op Lachlan Hodges
2026-08-27  5:49 ` [PATCH wireless-next 2/8] wifi: mm81x: release buffered broadcast frames after DTIM Lachlan Hodges
2026-08-27  5:49 ` [PATCH wireless-next 3/8] wifi: mm81x: do not drop PS filtered frames in AP mode Lachlan Hodges
2026-08-27  5:49 ` [PATCH wireless-next 4/8] wifi: mm81x: implement .tx_frames_pending() mac op Lachlan Hodges
2026-08-27  5:49 ` [PATCH wireless-next 5/8] wifi: mm81x: factor out tx width selection Lachlan Hodges
2026-08-27  5:49 ` [PATCH wireless-next 6/8] wifi: mm81x: tx EAPOLs at primary width Lachlan Hodges
2026-08-27  5:49 ` Lachlan Hodges [this message]
2026-08-27  5:49 ` [PATCH wireless-next 8/8] wifi: mm81x: tx multicast frames from AP " Lachlan Hodges

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=20260827054917.255584-8-lachlan.hodges@morsemicro.com \
    --to=lachlan.hodges@morsemicro.com \
    --cc=arien.judge@morsemicro.com \
    --cc=dan.callaghan@morsemicro.com \
    --cc=linux-wireless@vger.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