developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 1 | From cc4db7ad22853f72f43128f96e5d4edcb7c245a1 Mon Sep 17 00:00:00 2001 |
| 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 3 | Date: Wed, 5 Jul 2023 10:44:15 +0800 |
| 4 | Subject: [PATCH 054/104] mtk: hostapd: Fix background channel overlapping |
| 5 | operating channel issue |
| 6 | |
| 7 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 8 | --- |
| 9 | src/ap/dfs.c | 18 ++++++++++++++++++ |
| 10 | 1 file changed, 18 insertions(+) |
| 11 | |
| 12 | diff --git a/src/ap/dfs.c b/src/ap/dfs.c |
| 13 | index f5794753e..8be953287 100644 |
| 14 | --- a/src/ap/dfs.c |
| 15 | +++ b/src/ap/dfs.c |
| 16 | @@ -814,6 +814,20 @@ static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq, |
| 17 | } |
| 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 | { |
| 37 | @@ -1141,6 +1155,8 @@ static void hostapd_dfs_update_background_chain(struct hostapd_iface *iface) |
| 38 | &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, |
| 46 | @@ -1375,6 +1391,7 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) |
| 47 | 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; |
| 54 | @@ -1502,6 +1519,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) |
| 55 | 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 | -- |
| 63 | 2.39.2 |
| 64 | |