From e808bb0cce068af599effaf03876a471f8ea3ea4 Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Tue, 7 Apr 2020 17:02:02 +0530 Subject: [PATCH] qcacmn: Add 6G support for DFS Random channel selection Add 6G support for DFS Random channel selection to move to a 6G target channel in the event of a radar on a radio that supports both 5G and 6G channels. Change-Id: I1ad65b36feba65b6bbc3affc243aae1beb12960c CRs-Fixed: 2727958 --- umac/dfs/core/src/dfs_random_chan_sel.h | 5 +++ umac/dfs/core/src/misc/dfs_random_chan_sel.c | 38 ++++++++++++++++++++ umac/dfs/dispatcher/src/wlan_dfs_utils_api.c | 10 ++++-- 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/umac/dfs/core/src/dfs_random_chan_sel.h b/umac/dfs/core/src/dfs_random_chan_sel.h index 560650696e43..5a80926f9626 100644 --- a/umac/dfs/core/src/dfs_random_chan_sel.h +++ b/umac/dfs/core/src/dfs_random_chan_sel.h @@ -87,8 +87,13 @@ /* Frequency difference between 80+80 MHz */ #define DFS_80P80M_FREQ_DIFF 40 +#ifdef CONFIG_BAND_6GHZ +/* Number of 80MHz channels in 5GHz and 6GHz band */ +#define DFS_MAX_80MHZ_BANDS (6 + 14) +#else /* Number of 80MHz channels in 5GHz band */ #define DFS_MAX_80MHZ_BANDS 6 +#endif /* Start channel and center channel diff in 80Mhz */ #define DFS_80MHZ_START_CENTER_CH_DIFF 6 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 568eaee5fbf1..46af64674ad0 100644 --- a/umac/dfs/core/src/misc/dfs_random_chan_sel.c +++ b/umac/dfs/core/src/misc/dfs_random_chan_sel.c @@ -910,7 +910,13 @@ dfs_mark_leaking_ch(struct wlan_dfs *dfs, #endif #ifdef CONFIG_CHAN_FREQ_API + +#ifdef CONFIG_BAND_6GHZ +#define END_CHAN_INDEX CHAN_ENUM_7115 +#else #define END_CHAN_INDEX CHAN_ENUM_5720 +#endif + #define START_CHAN_INDEX CHAN_ENUM_5180 QDF_STATUS dfs_mark_leaking_chan_for_freq(struct wlan_dfs *dfs, @@ -1538,6 +1544,37 @@ static uint8_t dfs_find_ch_with_fallback( } #endif +#ifdef CONFIG_BAND_6GHZ +/** + * dfs_assign_6g_channels()- Assign the center frequency of the first 20 MHZ + * channel in every 80MHz channel, present in the 6G band. + * @ch_map: Pointer to ch_map. + * + * Return: Void + */ +static void dfs_assign_6g_channels(struct chan_bonding_bitmap *ch_map) +{ + ch_map->chan_bonding_set[6].start_chan_freq = 5955; + ch_map->chan_bonding_set[7].start_chan_freq = 6035; + ch_map->chan_bonding_set[8].start_chan_freq = 6115; + ch_map->chan_bonding_set[9].start_chan_freq = 6195; + ch_map->chan_bonding_set[10].start_chan_freq = 6275; + ch_map->chan_bonding_set[11].start_chan_freq = 6355; + ch_map->chan_bonding_set[12].start_chan_freq = 6435; + ch_map->chan_bonding_set[13].start_chan_freq = 6515; + ch_map->chan_bonding_set[14].start_chan_freq = 6595; + ch_map->chan_bonding_set[15].start_chan_freq = 6675; + ch_map->chan_bonding_set[16].start_chan_freq = 6755; + ch_map->chan_bonding_set[17].start_chan_freq = 6835; + ch_map->chan_bonding_set[18].start_chan_freq = 6915; + ch_map->chan_bonding_set[19].start_chan_freq = 6995; +} +#else +static inline void dfs_assign_6g_channels(struct chan_bonding_bitmap *ch_map) +{ +} +#endif + /** * dfs_find_ch_with_fallback_for_freq()- find random channel * @dfs: Pointer to DFS structure. @@ -1574,6 +1611,7 @@ static uint16_t dfs_find_ch_with_fallback_for_freq(struct wlan_dfs *dfs, ch_map.chan_bonding_set[4].start_chan_freq = 5660; ch_map.chan_bonding_set[5].start_chan_freq = 5745; + dfs_assign_6g_channels(&ch_map); for (i = 0; i < num_chan; i++) { dfs_debug(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN, "channel = %d added to bitmap", freq_lst[i]); diff --git a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c index 85b95407c08f..209a6dac3da9 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_utils_api.c @@ -771,11 +771,12 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev, { struct dfs_channel *tmp_chan_list = NULL; struct wlan_dfs *dfs; + bool is_curchan_6g; bool is_curchan_5g; bool is_curchan_24g; bool is_curchan_49g; - uint32_t chan_num; - uint32_t center_freq; + uint8_t chan_num; + uint16_t center_freq; uint16_t flagext; int i, j = 0; @@ -793,6 +794,7 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev, chan_num = dfs->dfs_curchan->dfs_ch_ieee; center_freq = dfs->dfs_curchan->dfs_ch_freq; + is_curchan_6g = WLAN_REG_IS_6GHZ_CHAN_FREQ(center_freq); is_curchan_5g = WLAN_REG_IS_5GHZ_CH_FREQ(center_freq); is_curchan_24g = WLAN_REG_IS_24GHZ_CH_FREQ(center_freq); is_curchan_49g = WLAN_REG_IS_49GHZ_FREQ(center_freq); @@ -805,7 +807,9 @@ static void utils_dfs_get_channel_list(struct wlan_objmgr_pdev *pdev, if (!dfs_mlme_check_allowed_prim_chanlist(pdev, center_freq)) continue; - if ((is_curchan_5g) && WLAN_REG_IS_5GHZ_CH_FREQ(center_freq)) { + if (((is_curchan_5g) || is_curchan_6g) && + (WLAN_REG_IS_5GHZ_CH_FREQ(center_freq) || + WLAN_REG_IS_6GHZ_CHAN_FREQ(center_freq))) { chan_list[j].dfs_ch_ieee = chan_num; chan_list[j].dfs_ch_freq = center_freq; chan_list[j].dfs_ch_flagext = flagext;