wifi: rtw89: mcc: fix NoA start time when GO is auxiliary
authorZong-Zhe Yang <kevin_yang@realtek.com>
Thu, 21 Sep 2023 00:35:56 +0000 (08:35 +0800)
committerKalle Valo <kvalo@kernel.org>
Thu, 28 Sep 2023 16:25:04 +0000 (19:25 +0300)
Under TDMA-based MCC (multi-channel concurrency), there are two roles,
reference and auxiliary. We arrange MCC timeline based on time domain
of reference role. Then, we calculate NoA start time according to MCC
timeline.

Besides, when MCC runs GO+STA mode, we plan an offset between GO time
domain and STA time domain to make their TBTTs have a time gap.

However, if GO is auxiliary role instead of reference role, NoA start
time is described by STA time domain instead of GO time domain. To fix
this, we apply the offset mentioned above to NoA start time to convert
time domain from STA to GO.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230921003559.11588-2-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/chan.c

index 85c25213bf02ba46e2a9420a9aba85f9e06bf293..e03c84953fb81c3eebc74f4e9c0c9deb9274ba27 100644 (file)
@@ -1445,6 +1445,7 @@ static void rtw89_mcc_handle_beacon_noa(struct rtw89_dev *rtwdev, bool enable)
        struct rtw89_mcc_role *aux = &mcc->role_aux;
        struct rtw89_mcc_config *config = &mcc->config;
        struct rtw89_mcc_pattern *pattern = &config->pattern;
+       struct rtw89_mcc_sync *sync = &config->sync;
        struct ieee80211_p2p_noa_desc noa_desc = {};
        u64 start_time = config->start_tsf;
        u32 interval = config->mcc_interval;
@@ -1464,6 +1465,9 @@ static void rtw89_mcc_handle_beacon_noa(struct rtw89_dev *rtwdev, bool enable)
                              ieee80211_tu_to_usec(config->beacon_offset) +
                              ieee80211_tu_to_usec(pattern->toa_aux);
                duration = config->mcc_interval - aux->duration;
+
+               /* convert time domain from sta(ref) to GO(aux) */
+               start_time += ieee80211_tu_to_usec(sync->offset);
        } else {
                rtw89_debug(rtwdev, RTW89_DBG_CHAN,
                            "MCC find no GO: skip updating beacon NoA\n");