wifi: rtw89: fix 6 GHz peer rate lookup
PATCH 1/1 wifi: rtw89: fix 6 GHz peer rate lookup
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[].
---
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(-)
drivers/net/wireless/realtek/rtw89/core.c +4 -2
@@ -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 ();
Signature · 1 line
2.54.0 (Apple Git-157)
Quoted 9 lines · Josef Schlehofer
supp_rates[] is indexed by enum
nl80211_band, not enumrtw89_band. On 6 GHz,RTW89_BAND_6Gis 2 (60 GHz in nl80211), so the lookup inrtw89_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 <[email protected]>
Ping-Ke Shih
maintainerQuoted 10 lines · Josef Schlehofer
supp_rates[] is indexed by enum
nl80211_band, not enumrtw89_band. On 6 GHz,RTW89_BAND_6Gis 2 (60 GHz in nl80211), so the lookup inrtw89_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 <[email protected]>Acked-by Ping-Ke Shih <[email protected]>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
b64d6b5ae79c wifi: rtw89: fix 6 GHz peer rate lookup