developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 1 | From 163efaffce1344a6c2611a2a75d863eb88b17137 Mon Sep 17 00:00:00 2001 |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 3 | Date: Wed, 5 Jul 2023 10:44:15 +0800 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 4 | Subject: [PATCH 27/54] mtk: hostapd: Fix background channel overlapping |
developer | bddc9db | 2023-09-11 13:34:36 +0800 | [diff] [blame] | 5 | operating channel issue |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 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 |
developer | 1a17367 | 2023-12-21 14:49:33 +0800 | [diff] [blame] | 13 | index 3b1df6dc6..6f7635436 100644 |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 14 | --- a/src/ap/dfs.c |
| 15 | +++ b/src/ap/dfs.c |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 16 | @@ -812,6 +812,20 @@ static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq, |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 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 | { |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 37 | @@ -1132,6 +1146,8 @@ static void hostpad_dfs_update_background_chain(struct hostapd_iface *iface) |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 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, |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 46 | @@ -1366,6 +1382,7 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 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; |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 54 | @@ -1493,6 +1510,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) |
developer | f0fd705 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 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.18.0 |
| 64 | |