wifi: rtw89: mcc: drop queued chanctx changes when stopping
authorZong-Zhe Yang <kevin_yang@realtek.com>
Sun, 11 May 2025 03:52:13 +0000 (11:52 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Fri, 16 May 2025 00:43:12 +0000 (08:43 +0800)
When MCC is about to stop, there may be some chanctx changes which are
queued for work but have not yet been run. To avoid these changes from
being processed in a wrong state (e.g. next new MCC instance), cancel
the queued work and drop queued changes.

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

index ff476bde39abfc819a182bafa0fb6b3a4b16e430..e733564abc7af85502b1862823ea02b231b23148 100644 (file)
@@ -2150,6 +2150,7 @@ static int rtw89_mcc_stop_sel_iterator(struct rtw89_dev *rtwdev,
 static void rtw89_mcc_stop(struct rtw89_dev *rtwdev,
                           const struct rtw89_chanctx_pause_parm *pause)
 {
+       struct rtw89_hal *hal = &rtwdev->hal;
        struct rtw89_mcc_info *mcc = &rtwdev->mcc;
        struct rtw89_mcc_role *ref = &mcc->role_ref;
        struct rtw89_mcc_stop_sel sel = {
@@ -2157,6 +2158,11 @@ static void rtw89_mcc_stop(struct rtw89_dev *rtwdev,
        };
        int ret;
 
+       if (!pause) {
+               wiphy_delayed_work_cancel(rtwdev->hw->wiphy, &rtwdev->chanctx_work);
+               bitmap_zero(hal->changes, NUM_OF_RTW89_CHANCTX_CHANGES);
+       }
+
        /* by default, stop at ref */
        rtw89_iterate_mcc_roles(rtwdev, rtw89_mcc_stop_sel_iterator, &sel);
        if (!sel.filled)