blob: 6a98b5d7523fa7bc7af336a7963ee83630551a0b [file] [log] [blame]
From 163efaffce1344a6c2611a2a75d863eb88b17137 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 5 Jul 2023 10:44:15 +0800
Subject: [PATCH 27/54] mtk: hostapd: Fix background channel overlapping
operating channel issue
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
src/ap/dfs.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 3b1df6dc6..6f7635436 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -812,6 +812,20 @@ static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq,
}
+static void dfs_check_background_overlapped(struct hostapd_iface *iface)
+{
+ int width = hostapd_get_oper_chwidth(iface->conf);
+
+ if (!dfs_use_radar_background(iface))
+ return;
+
+ if (dfs_are_channels_overlapped(iface, iface->radar_background.freq,
+ width, iface->radar_background.centr_freq_seg0_idx,
+ iface->radar_background.centr_freq_seg1_idx))
+ iface->radar_background.channel = -1;
+}
+
+
static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,
int start_chan_idx, int n_chans)
{
@@ -1132,6 +1146,8 @@ static void hostpad_dfs_update_background_chain(struct hostapd_iface *iface)
&oper_centr_freq_seg1_idx,
&channel_type);
if (!channel ||
+ channel->chan == iface->conf->channel ||
+ channel->chan == iface->radar_background.channel ||
hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
channel->freq, channel->chan,
iface->conf->ieee80211n,
@@ -1366,6 +1382,7 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
oper_centr_freq_seg1_idx);
err = 0;
+ dfs_check_background_overlapped(iface);
hostapd_setup_interface_complete(iface, err);
return err;
@@ -1493,6 +1510,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
hostapd_set_oper_centr_freq_seg1_idx(
iface->conf, oper_centr_freq_seg1_idx);
+ dfs_check_background_overlapped(iface);
hostapd_disable_iface(iface);
hostapd_enable_iface(iface);
return 0;
--
2.18.0