]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rtw89: mcc: enlarge GO NoA duration to cover channel switching time
authorChih-Kang Chang <gary.chang@realtek.com>
Thu, 10 Jul 2025 04:24:12 +0000 (12:24 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 15 Jul 2025 01:26:16 +0000 (09:26 +0800)
MCC require time to switch channel when changing timeslot. If GC TX
nulldata 0 while GO is switching channel, GO can't receive it. Therefore,
enlarge the GO NoA duration to cover the channel switching time.

However, the enlarged NoA duration might cause GC's timeslot less than
minimum of RX beacon time. Therefore, adjust strict and anchor pattern
condition to avoid it.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250710042423.73617-4-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/chan.c
drivers/net/wireless/realtek/rtw89/chan.h

index 1277b1af2a4c13e9237a1245ba8f034f628a837b..e5ef4f6ab5ca12cd743ee79bbfb33dbf0f1d22d7 100644 (file)
@@ -1116,7 +1116,7 @@ static int __rtw89_mcc_calc_pattern_strict(struct rtw89_dev *rtwdev,
        struct rtw89_mcc_role *ref = &mcc->role_ref;
        struct rtw89_mcc_role *aux = &mcc->role_aux;
        struct rtw89_mcc_config *config = &mcc->config;
-       u16 min_tob = RTW89_MCC_EARLY_RX_BCN_TIME;
+       u16 min_tob = RTW89_MCC_EARLY_RX_BCN_TIME + RTW89_MCC_SWITCH_CH_TIME;
        u16 min_toa = RTW89_MCC_MIN_RX_BCN_TIME;
        u16 bcn_ofst = config->beacon_offset;
        s16 upper_toa_ref, lower_toa_ref;
@@ -1272,11 +1272,11 @@ static int __rtw89_mcc_calc_pattern_anchor(struct rtw89_dev *rtwdev,
        u16 bcn_ofst = config->beacon_offset;
        bool small_bcn_ofst;
 
-       if (bcn_ofst < RTW89_MCC_MIN_RX_BCN_TIME)
+       if (bcn_ofst < RTW89_MCC_MIN_RX_BCN_WITH_SWITCH_CH_TIME)
                small_bcn_ofst = true;
        else if (bcn_ofst < aux->duration - aux->limit.max_toa)
                small_bcn_ofst = true;
-       else if (mcc_intvl - bcn_ofst < RTW89_MCC_MIN_RX_BCN_TIME)
+       else if (mcc_intvl - bcn_ofst < RTW89_MCC_MIN_RX_BCN_WITH_SWITCH_CH_TIME)
                small_bcn_ofst = false;
        else
                return -EPERM;
@@ -2171,6 +2171,7 @@ static void rtw89_mcc_handle_beacon_noa(struct rtw89_dev *rtwdev, bool enable)
        rtw89_p2p_noa_renew(rtwvif_go);
 
        if (enable) {
+               duration += RTW89_MCC_SWITCH_CH_TIME;
                noa_desc.start_time = cpu_to_le32(start_time);
                noa_desc.interval = cpu_to_le32(ieee80211_tu_to_usec(interval));
                noa_desc.duration = cpu_to_le32(ieee80211_tu_to_usec(duration));
index 0e2ffb92045559ff36c530ec0a82952d25287242..9a62b7c98b83d9db3e4576585ecd8d8fe4558d9a 100644 (file)
@@ -18,6 +18,7 @@
 #define RTW89_MCC_EARLY_RX_BCN_TIME 5
 #define RTW89_MCC_MIN_RX_BCN_TIME 10
 #define RTW89_MCC_DFLT_BCN_OFST_TIME 40
+#define RTW89_MCC_SWITCH_CH_TIME 3
 
 #define RTW89_MCC_PROBE_TIMEOUT 100
 #define RTW89_MCC_PROBE_MAX_TRIES 3
@@ -28,6 +29,9 @@
 #define RTW89_MCC_MIN_STA_DURATION \
        (RTW89_MCC_EARLY_RX_BCN_TIME + RTW89_MCC_MIN_RX_BCN_TIME)
 
+#define RTW89_MCC_MIN_RX_BCN_WITH_SWITCH_CH_TIME \
+       (RTW89_MCC_MIN_RX_BCN_TIME + RTW89_MCC_SWITCH_CH_TIME)
+
 #define RTW89_MCC_DFLT_GROUP 0
 #define RTW89_MCC_NEXT_GROUP(cur) (((cur) + 1) % 4)