]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: get designated link to replace link instance 0
authorZong-Zhe Yang <kevin_yang@realtek.com>
Fri, 23 Jan 2026 01:39:55 +0000 (09:39 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Wed, 28 Jan 2026 03:20:29 +0000 (11:20 +0800)
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
drivers/net/wireless/realtek/rtw89/chan.c
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/mac80211.c

index c0af6199222609dbce7a62db191e5c773f91088b..9b2f6f0a00fd2fa86c8d873a88b34a74630359ff 100644 (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++) {
index 9e88fd6d735a53ce32ca5cea903d5363f7b35ebd..f84726f046695db6b7eb4e774874a249a166169f 100644 (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){
index ba71709a9bc9ac07c78ecbe3af467c69222c082f..315bb0d0759ff360aa6081347cb365643dc6aeff 100644 (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;
        }