blob: a74101d1824f077262c64da1f37d11e9b046504e [file] [log] [blame]
developereb155692024-01-11 14:08:37 +08001From 08661908d4c2fb5f8d7ca00e0e7e6b33a6ae6e31 Mon Sep 17 00:00:00 2001
2From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Wed, 27 Dec 2023 14:26:22 +0800
4Subject: [PATCH] mac80211: mtk: send deauth frame if CAC is required during
5 CSA
6
7Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
8---
9 net/mac80211/cfg.c | 27 +++++++++++++++++++++++++++
10 1 file changed, 27 insertions(+)
11
12diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
13index 3e6e903..eb73834 100644
14--- a/net/mac80211/cfg.c
15+++ b/net/mac80211/cfg.c
16@@ -3361,6 +3361,31 @@ static int ieee80211_start_radar_detection_post_csa(struct wiphy *wiphy,
17 return 1;
18 }
19
20+static void ieee80211_csa_send_deauth(struct ieee80211_sub_if_data *sdata)
21+{
22+ struct ieee80211_local *local = sdata->local;
23+ u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
24+ u8 broadcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
25+ bool send_deauth;
26+
27+ send_deauth = !cfg80211_chandef_identical(&sdata->vif.bss_conf.chandef,
28+ &sdata->csa_chandef) &&
29+ !cfg80211_reg_can_beacon_relax(local->hw.wiphy,
30+ &sdata->csa_chandef,
31+ sdata->wdev.iftype);
32+ /* broadcast deauth frame if CAC is required */
33+ if (!send_deauth)
34+ return;
35+
36+ ieee80211_wake_vif_queues(local, sdata, IEEE80211_QUEUE_STOP_REASON_CSA);
37+ ieee80211_send_deauth_disassoc(sdata, broadcast,
38+ sdata->vif.bss_conf.bssid,
39+ IEEE80211_STYPE_DEAUTH,
40+ WLAN_REASON_DEAUTH_LEAVING,
41+ send_deauth, frame_buf);
42+ ieee80211_stop_vif_queues(local, sdata, IEEE80211_QUEUE_STOP_REASON_CSA);
43+}
44+
45 static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
46 {
47 struct ieee80211_local *local = sdata->local;
48@@ -3371,6 +3396,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
49 lockdep_assert_held(&local->mtx);
50 lockdep_assert_held(&local->chanctx_mtx);
51
52+ ieee80211_csa_send_deauth(sdata);
53+
54 /*
55 * using reservation isn't immediate as it may be deferred until later
56 * with multi-vif. once reservation is complete it will re-schedule the
57--
582.18.0
59