]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw89: chan: re-config default chandef only when none is registered
authorZong-Zhe Yang <kevin_yang@realtek.com>
Thu, 5 Jun 2025 11:42:04 +0000 (19:42 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 10 Jun 2025 01:45:40 +0000 (09:45 +0800)
Previously, default chandef is configured if no chanctx is active, i.e. no
chanctx is assigned to some vif. For normal cases, it's fine. However, for
impending CSA support, need to consider that one chanctx may be added, or
called registered, ahead without being assigned immediately. Then, it will
keep inactive, and might be covered by the default one when re-calculating
chanctxs happens in certain sequences. So now, don't re-config the default
chandef unless no chanctx is registered.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250605114207.12381-3-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/chan.c
drivers/net/wireless/realtek/rtw89/chan.h

index 5e7f3c3bf1a6634389dd8877410cd5c79a11d029..31e15f472740a62f449197deae6ab4a925b4da1d 100644 (file)
@@ -269,6 +269,8 @@ static void rtw89_entity_calculate_weight(struct rtw89_dev *rtwdev,
        struct rtw89_vif *rtwvif;
        int idx;
 
+       w->registered_chanctxs = bitmap_weight(hal->entity_map, NUM_OF_RTW89_CHANCTX);
+
        for_each_set_bit(idx, hal->entity_map, NUM_OF_RTW89_CHANCTX) {
                cfg = hal->chanctx[idx].cfg;
                if (!cfg) {
@@ -477,7 +479,8 @@ enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev)
                bitmap_zero(recalc_map, NUM_OF_RTW89_CHANCTX);
                fallthrough;
        case 0:
-               rtw89_config_default_chandef(rtwdev);
+               if (!w.registered_chanctxs)
+                       rtw89_config_default_chandef(rtwdev);
                set_bit(RTW89_CHANCTX_0, recalc_map);
                fallthrough;
        case 1:
index 2a25563593af93ccbafb1ce3fcf922831fa16b43..c75260eca71d1bfd31a0ac19f5905bf032e4d7ae 100644 (file)
@@ -58,6 +58,7 @@ struct rtw89_chanctx_cb_parm {
 };
 
 struct rtw89_entity_weight {
+       unsigned int registered_chanctxs;
        unsigned int active_chanctxs;
        unsigned int active_roles;
 };