diff --git a/umac/dfs/core/src/misc/dfs_random_chan_sel.c b/umac/dfs/core/src/misc/dfs_random_chan_sel.c index 030490e5c193..4fff87549c8f 100644 --- a/umac/dfs/core/src/misc/dfs_random_chan_sel.c +++ b/umac/dfs/core/src/misc/dfs_random_chan_sel.c @@ -2236,6 +2236,21 @@ uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs, leakage_adjusted_lst, random_chan_cnt); + /* Since notion of 80+80 is not present in the regulatory + * channel the function may return invalid 80+80 channels for + * some devices (e.g. Pine). Therefore, check if we need to + * correct it by checking the following condition. + */ + if ((*chan_wd == DFS_CH_WIDTH_80P80MHZ) && + (flags & DFS_RANDOM_CH_FLAG_RESTRICTED_80P80_ENABLED) && + !(CHAN_WITHIN_RESTRICTED_80P80(target_freq, + *dfs_cfreq_seg2))) { + *chan_wd = DFS_CH_WIDTH_160MHZ; + target_freq = dfs_find_ch_with_fallback_for_freq( + dfs, chan_wd, dfs_cfreq_seg2, + leakage_adjusted_lst, random_chan_cnt); + } + /* * When flag_no_weather is set, avoid usage of Adjacent * weather radar channel in HT40 mode as extension channel diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h b/umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h index 8fc2931f3844..1ec4e97c9c2d 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h @@ -57,6 +57,18 @@ #define DFS_ALLOW_HW_PULSES 28 #define DFS_SET_PRI_MULTIPILER 29 +#define RESTRICTED_80P80_START_CHAN 132 +#define RESTRICTED_80P80_END_CHAN 161 + +/* Check if the given channels are within restricted 80P80 start chan(132) and + * end chan (161). + */ +#define CHAN_WITHIN_RESTRICTED_80P80(chan, cfreq_seg2) \ + ((((chan) >= RESTRICTED_80P80_START_CHAN) && \ + ((chan) <= RESTRICTED_80P80_END_CHAN) && \ + ((cfreq_seg2) >= RESTRICTED_80P80_START_CHAN) && \ + ((cfreq_seg2) <= RESTRICTED_80P80_END_CHAN)) ? true : false) + /* * Spectral IOCTLs use DFS_LAST_IOCTL as the base. * This must always be the last IOCTL in DFS and have @@ -193,6 +205,10 @@ struct dfs_bangradar_params { /* Flag to exclude Japan W53 channnels */ #define DFS_RANDOM_CH_FLAG_NO_JAPAN_W53_CH 0x0100 /* 0000 0001 0000 0000 */ +/* Restricted 80P80 MHz is enabled */ +#define DFS_RANDOM_CH_FLAG_RESTRICTED_80P80_ENABLED 0x0200 + /* 0000 0010 0000 0000 */ + /** * struct wlan_dfs_caps - DFS capability structure. * @wlan_dfs_ext_chan_ok: Can radar be detected on the extension chan?