blob: a74101d1824f077262c64da1f37d11e9b046504e [file] [log] [blame]
From 08661908d4c2fb5f8d7ca00e0e7e6b33a6ae6e31 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 27 Dec 2023 14:26:22 +0800
Subject: [PATCH] mac80211: mtk: send deauth frame if CAC is required during
CSA
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
net/mac80211/cfg.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 3e6e903..eb73834 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3361,6 +3361,31 @@ static int ieee80211_start_radar_detection_post_csa(struct wiphy *wiphy,
return 1;
}
+static void ieee80211_csa_send_deauth(struct ieee80211_sub_if_data *sdata)
+{
+ struct ieee80211_local *local = sdata->local;
+ u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
+ u8 broadcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ bool send_deauth;
+
+ send_deauth = !cfg80211_chandef_identical(&sdata->vif.bss_conf.chandef,
+ &sdata->csa_chandef) &&
+ !cfg80211_reg_can_beacon_relax(local->hw.wiphy,
+ &sdata->csa_chandef,
+ sdata->wdev.iftype);
+ /* broadcast deauth frame if CAC is required */
+ if (!send_deauth)
+ return;
+
+ ieee80211_wake_vif_queues(local, sdata, IEEE80211_QUEUE_STOP_REASON_CSA);
+ ieee80211_send_deauth_disassoc(sdata, broadcast,
+ sdata->vif.bss_conf.bssid,
+ IEEE80211_STYPE_DEAUTH,
+ WLAN_REASON_DEAUTH_LEAVING,
+ send_deauth, frame_buf);
+ ieee80211_stop_vif_queues(local, sdata, IEEE80211_QUEUE_STOP_REASON_CSA);
+}
+
static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
@@ -3371,6 +3396,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
lockdep_assert_held(&local->mtx);
lockdep_assert_held(&local->chanctx_mtx);
+ ieee80211_csa_send_deauth(sdata);
+
/*
* using reservation isn't immediate as it may be deferred until later
* with multi-vif. once reservation is complete it will re-schedule the
--
2.18.0