From 52ee85cf6fe58983c92235a4df6e4fe627dced54 Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Wed, 13 Nov 2019 16:56:31 +0530 Subject: [PATCH] qcacmn: Add support to choose 160MHz random channel for Pine Pine supports restricted 80+80 MHz only on cfreq=5690 and cfreq=5775. If AP detects RADAR in this channel, it chooses new 80+80 MHz random channel which is not supported by Pine because, notion of 80+80 is not present in current channel in regulatory component. Hence, as a temporary fix we change the invalid 80+80 MHz channel to 160 MHz or lower. Change-Id: I749607236a1dd7b9c7aa93ff889b65adcbb4191c CRs-Fixed: 2570057 --- umac/dfs/core/src/misc/dfs_random_chan_sel.c | 15 +++++++++++++++ umac/dfs/dispatcher/inc/wlan_dfs_ioctl.h | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) 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?