Linux wireless drivers development
 help / color / mirror / Atom feed
From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH rtw-next] wifi: rtw89: fix 6 GHz peer rate lookup
Date: Sun, 29 Nov 2026 09:44:40 +0100	[thread overview]
Message-ID: <20261129084440.57834-1-pepe.schlehofer@gmail.com> (raw)

supp_rates[] is indexed by enum nl80211_band, not enum rtw89_band.
On 6 GHz, RTW89_BAND_6G is 2 (60 GHz in nl80211), so the lookup in
rtw89_core_get_data_rate() reads the 60 GHz entry instead of the 6 GHz
one.

Convert the band before indexing supp_rates[].

Fixes: e5307c9cd7ee ("wifi: rtw89: set data lowest rate according to AP supported rate")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
Tested on an RTL8922AU as a 6 GHz AP with a phone as the client. The
phone supports 6 Mbps, so the chosen rate does not change with it.

 drivers/net/wireless/realtek/rtw89/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 3a80ac8dbbd..38f5ec19257 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -1144,6 +1144,7 @@ static u16 rtw89_core_get_data_rate(struct rtw89_dev *rtwdev,
 	enum rtw89_chanctx_idx idx = rtwvif_link->chanctx_idx;
 	const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, idx);
 	struct ieee80211_link_sta *link_sta;
+	enum nl80211_band band;
 	u16 lowest_rate;
 	u16 rate;
 
@@ -1163,12 +1164,13 @@ static u16 rtw89_core_get_data_rate(struct rtw89_dev *rtwdev,
 	rcu_read_lock();
 
 	link_sta = rtw89_sta_rcu_dereference_link(rtwsta_link, false);
-	if (!link_sta->supp_rates[chan->band_type]) {
+	band = rtw89_hw_to_nl80211_band(chan->band_type);
+	if (!link_sta->supp_rates[band]) {
 		rate = lowest_rate;
 		goto out;
 	}
 
-	rate = __ffs(link_sta->supp_rates[chan->band_type]) + lowest_rate;
+	rate = __ffs(link_sta->supp_rates[band]) + lowest_rate;
 
 out:
 	rcu_read_unlock();
-- 
2.54.0 (Apple Git-157)


             reply	other threads:[~2026-11-29  8:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  8:44 Josef Schlehofer [this message]
2026-11-30  3:55 ` [PATCH rtw-next] wifi: rtw89: fix 6 GHz peer rate lookup Ping-Ke Shih

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=20261129084440.57834-1-pepe.schlehofer@gmail.com \
    --to=pepe.schlehofer@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /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