blob: 1134253649fd33f226abf8b24fed4b9d0298234b [file] [log] [blame]
developer3e11ee32023-09-27 12:24:47 +08001From b79b625e3790f0d9152f736629fbc0dcd826bf62 Mon Sep 17 00:00:00 2001
developerf0fd7052023-08-14 20:23:42 +08002From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Wed, 5 Jul 2023 10:44:15 +0800
developer3e11ee32023-09-27 12:24:47 +08004Subject: [PATCH 27/40] hostapd: mtk: Fix background channel overlapping
developerbddc9db2023-09-11 13:34:36 +08005 operating channel issue
developerf0fd7052023-08-14 20:23:42 +08006
7Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
8---
9 src/ap/dfs.c | 18 ++++++++++++++++++
10 1 file changed, 18 insertions(+)
11
12diff --git a/src/ap/dfs.c b/src/ap/dfs.c
developer3e11ee32023-09-27 12:24:47 +080013index 2f5c86e..c9a9c6c 100644
developerf0fd7052023-08-14 20:23:42 +080014--- a/src/ap/dfs.c
15+++ b/src/ap/dfs.c
developer3e11ee32023-09-27 12:24:47 +080016@@ -807,6 +807,20 @@ static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq,
developerf0fd7052023-08-14 20:23:42 +080017 }
18
19
20+static void dfs_check_background_overlapped(struct hostapd_iface *iface)
21+{
22+ int width = hostapd_get_oper_chwidth(iface->conf);
23+
24+ if (!dfs_use_radar_background(iface))
25+ return;
26+
27+ if (dfs_are_channels_overlapped(iface, iface->radar_background.freq,
28+ width, iface->radar_background.centr_freq_seg0_idx,
29+ iface->radar_background.centr_freq_seg1_idx))
30+ iface->radar_background.channel = -1;
31+}
32+
33+
34 static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,
35 int start_chan_idx, int n_chans)
36 {
developer3e11ee32023-09-27 12:24:47 +080037@@ -1127,6 +1141,8 @@ static void hostpad_dfs_update_background_chain(struct hostapd_iface *iface)
developerf0fd7052023-08-14 20:23:42 +080038 &oper_centr_freq_seg1_idx,
39 &channel_type);
40 if (!channel ||
41+ channel->chan == iface->conf->channel ||
42+ channel->chan == iface->radar_background.channel ||
43 hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
44 channel->freq, channel->chan,
45 iface->conf->ieee80211n,
developer3e11ee32023-09-27 12:24:47 +080046@@ -1361,6 +1377,7 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
developerf0fd7052023-08-14 20:23:42 +080047 hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
48 oper_centr_freq_seg1_idx);
49 err = 0;
50+ dfs_check_background_overlapped(iface);
51
52 hostapd_setup_interface_complete(iface, err);
53 return err;
developer3e11ee32023-09-27 12:24:47 +080054@@ -1488,6 +1505,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
developerf0fd7052023-08-14 20:23:42 +080055 hostapd_set_oper_centr_freq_seg1_idx(
56 iface->conf, oper_centr_freq_seg1_idx);
57
58+ dfs_check_background_overlapped(iface);
59 hostapd_disable_iface(iface);
60 hostapd_enable_iface(iface);
61 return 0;
62--
632.18.0
64