wifi: rtw89: get designated link to replace link instance 0

Clean up some places where still to get link instance 0 directly.
Since now MLSR switch is supported, it's not guaranteed to always
run on link instance 0. So, prefer to get designated link in most
cases.

For now, the only exception is MCC (multi-channel concurrency) case.
How to fill content of its H2C command depends on how to choose link
instance, so cannot simply change it as above. Will handle MCC case
separately afterwards.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260123013957.16418-10-pkshih@realtek.com
This commit is contained in:
Zong-Zhe Yang 2026-01-23 09:39:55 +08:00 committed by Ping-Ke Shih
parent 3b85a8948f
commit 986aa89b76
3 changed files with 8 additions and 11 deletions

View File

@ -372,8 +372,8 @@ static void rtw89_normalize_link_chanctx(struct rtw89_dev *rtwdev,
if (unlikely(!rtwvif_link->chanctx_assigned))
return;
cur = rtw89_vif_get_link_inst(rtwvif, 0);
if (!cur || !cur->chanctx_assigned)
cur = rtw89_get_designated_link(rtwvif);
if (unlikely(!cur) || !cur->chanctx_assigned)
return;
if (cur == rtwvif_link)
@ -522,8 +522,8 @@ static void rtw89_entity_recalc_mgnt_roles(struct rtw89_dev *rtwdev)
}
/* To be consistent with legacy behavior, expect the first active role
* which uses RTW89_CHANCTX_0 to put at position 0, and make its first
* link instance take RTW89_CHANCTX_0. (normalizing)
* which uses RTW89_CHANCTX_0 to put at position 0 and its designated
* link take RTW89_CHANCTX_0. (normalizing)
*/
list_for_each_entry(role, &mgnt->active_list, mgnt_entry) {
for (i = 0; i < role->links_inst_valid_num; i++) {

View File

@ -9027,12 +9027,9 @@ static void rtw89_hw_scan_set_extra_op_info(struct rtw89_dev *rtwdev,
if (tmp == scan_rtwvif)
continue;
tmp_link = rtw89_vif_get_link_inst(tmp, 0);
if (unlikely(!tmp_link)) {
rtw89_debug(rtwdev, RTW89_DBG_HW_SCAN,
"hw scan: no HW-0 link for extra op\n");
tmp_link = rtw89_get_designated_link(tmp);
if (unlikely(!tmp_link))
continue;
}
tmp_chan = rtw89_chan_get(rtwdev, tmp_link->chanctx_idx);
*ext = (struct rtw89_hw_scan_extra_op){

View File

@ -1438,9 +1438,9 @@ static void rtw89_ops_channel_switch_beacon(struct ieee80211_hw *hw,
BUILD_BUG_ON(RTW89_MLD_NON_STA_LINK_NUM != 1);
rtwvif_link = rtw89_vif_get_link_inst(rtwvif, 0);
rtwvif_link = rtw89_get_designated_link(rtwvif);
if (unlikely(!rtwvif_link)) {
rtw89_err(rtwdev, "chsw bcn: find no link on HW-0\n");
rtw89_err(rtwdev, "chsw bcn: find no designated link\n");
return;
}