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 --- 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)