Skip to content

Commit 182c7ff

Browse files
Chih-Kang ChangPing-Ke Shih
authored andcommitted
wifi: rtw89: mcc: stop TX during MCC prepare
Stop TX during the MCC configuration period to prevent packet leakage. The stop time is defined as 'start_tsf - tsf', which means the duration from when MCC configuration begins until MCC starts. Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250610130034.14692-6-pkshih@realtek.com
1 parent 95ee746 commit 182c7ff

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

drivers/net/wireless/realtek/rtw89/chan.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,35 @@ static bool rtw89_mcc_duration_decision_on_bt(struct rtw89_dev *rtwdev)
16021602
return false;
16031603
}
16041604

1605+
void rtw89_mcc_prepare_done_work(struct wiphy *wiphy, struct wiphy_work *work)
1606+
{
1607+
struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
1608+
mcc_prepare_done_work.work);
1609+
1610+
lockdep_assert_wiphy(wiphy);
1611+
1612+
ieee80211_wake_queues(rtwdev->hw);
1613+
}
1614+
1615+
static void rtw89_mcc_prepare(struct rtw89_dev *rtwdev, bool start)
1616+
{
1617+
struct rtw89_mcc_info *mcc = &rtwdev->mcc;
1618+
struct rtw89_mcc_config *config = &mcc->config;
1619+
1620+
if (start) {
1621+
ieee80211_stop_queues(rtwdev->hw);
1622+
1623+
wiphy_delayed_work_queue(rtwdev->hw->wiphy,
1624+
&rtwdev->mcc_prepare_done_work,
1625+
usecs_to_jiffies(config->prepare_delay));
1626+
} else {
1627+
wiphy_delayed_work_queue(rtwdev->hw->wiphy,
1628+
&rtwdev->mcc_prepare_done_work, 0);
1629+
wiphy_delayed_work_flush(rtwdev->hw->wiphy,
1630+
&rtwdev->mcc_prepare_done_work);
1631+
}
1632+
}
1633+
16051634
static int rtw89_mcc_fill_start_tsf(struct rtw89_dev *rtwdev)
16061635
{
16071636
struct rtw89_mcc_info *mcc = &rtwdev->mcc;
@@ -1637,6 +1666,8 @@ static int rtw89_mcc_fill_start_tsf(struct rtw89_dev *rtwdev)
16371666

16381667
config->start_tsf = start_tsf;
16391668
config->start_tsf_in_aux_domain = tsf_aux + start_tsf - tsf;
1669+
config->prepare_delay = start_tsf - tsf;
1670+
16401671
return 0;
16411672
}
16421673

@@ -2247,6 +2278,8 @@ static int rtw89_mcc_start(struct rtw89_dev *rtwdev)
22472278
rtw89_chanctx_notify(rtwdev, RTW89_CHANCTX_STATE_MCC_START);
22482279

22492280
rtw89_mcc_start_beacon_noa(rtwdev);
2281+
2282+
rtw89_mcc_prepare(rtwdev, true);
22502283
return 0;
22512284
}
22522285

@@ -2335,6 +2368,8 @@ static void rtw89_mcc_stop(struct rtw89_dev *rtwdev,
23352368
rtw89_chanctx_notify(rtwdev, RTW89_CHANCTX_STATE_MCC_STOP);
23362369

23372370
rtw89_mcc_stop_beacon_noa(rtwdev);
2371+
2372+
rtw89_mcc_prepare(rtwdev, false);
23382373
}
23392374

23402375
static int rtw89_mcc_update(struct rtw89_dev *rtwdev)

drivers/net/wireless/realtek/rtw89/chan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ const struct rtw89_chan *__rtw89_mgnt_chan_get(struct rtw89_dev *rtwdev,
133133
#define rtw89_mgnt_chan_get(rtwdev, link_index) \
134134
__rtw89_mgnt_chan_get(rtwdev, __func__, link_index)
135135

136+
void rtw89_mcc_prepare_done_work(struct wiphy *wiphy, struct wiphy_work *work);
137+
136138
int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
137139
struct ieee80211_chanctx_conf *ctx);
138140
void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev,

drivers/net/wireless/realtek/rtw89/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4884,6 +4884,7 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev)
48844884
wiphy_delayed_work_cancel(wiphy, &rtwdev->coex_bt_devinfo_work);
48854885
wiphy_delayed_work_cancel(wiphy, &rtwdev->coex_rfk_chk_work);
48864886
wiphy_delayed_work_cancel(wiphy, &rtwdev->cfo_track_work);
4887+
wiphy_delayed_work_cancel(wiphy, &rtwdev->mcc_prepare_done_work);
48874888
cancel_delayed_work_sync(&rtwdev->forbid_ba_work);
48884889
wiphy_delayed_work_cancel(wiphy, &rtwdev->antdiv_work);
48894890

@@ -5110,6 +5111,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
51105111
wiphy_delayed_work_init(&rtwdev->coex_bt_devinfo_work, rtw89_coex_bt_devinfo_work);
51115112
wiphy_delayed_work_init(&rtwdev->coex_rfk_chk_work, rtw89_coex_rfk_chk_work);
51125113
wiphy_delayed_work_init(&rtwdev->cfo_track_work, rtw89_phy_cfo_track_work);
5114+
wiphy_delayed_work_init(&rtwdev->mcc_prepare_done_work, rtw89_mcc_prepare_done_work);
51135115
INIT_DELAYED_WORK(&rtwdev->forbid_ba_work, rtw89_forbid_ba_work);
51145116
wiphy_delayed_work_init(&rtwdev->antdiv_work, rtw89_phy_antdiv_work);
51155117
rtwdev->txq_wq = alloc_workqueue("rtw89_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0);

drivers/net/wireless/realtek/rtw89/core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5742,6 +5742,7 @@ struct rtw89_mcc_config {
57425742
struct rtw89_mcc_sync sync;
57435743
u64 start_tsf;
57445744
u64 start_tsf_in_aux_domain;
5745+
u64 prepare_delay;
57455746
u16 mcc_interval; /* TU */
57465747
u16 beacon_offset; /* TU */
57475748
};
@@ -5872,6 +5873,7 @@ struct rtw89_dev {
58725873
struct wiphy_delayed_work coex_bt_devinfo_work;
58735874
struct wiphy_delayed_work coex_rfk_chk_work;
58745875
struct wiphy_delayed_work cfo_track_work;
5876+
struct wiphy_delayed_work mcc_prepare_done_work;
58755877
struct delayed_work forbid_ba_work;
58765878
struct wiphy_delayed_work antdiv_work;
58775879
struct rtw89_ppdu_sts_info ppdu_sts;

0 commit comments

Comments
 (0)