qcacmn: Use chan freq for restricted 80+80 MHz boundary check

Instead of channel number, use channel frequency for restricted 80+80MHz
boundary  check.

Change-Id: I2fa65c3b1d102acd6b64b4c6e1583d2bc29484d1
CRs-Fixed: 2645155
This commit is contained in:
Shashikala Prabhu
2020-03-26 10:37:40 +05:30
committed by nshrivas
parent cd6291c3a0
commit ee42cb1f26
4 changed files with 34 additions and 41 deletions

View File

@@ -289,8 +289,7 @@ uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs,
struct dfs_channel *ch_list, struct dfs_channel *ch_list,
uint32_t chan_count, uint32_t chan_count,
uint32_t flags, uint32_t flags,
uint8_t *chan_wd, struct ch_params *chan_params,
struct dfs_channel *cur_chan,
uint8_t dfs_region, uint8_t dfs_region,
struct dfs_acs_info *acs_info); struct dfs_acs_info *acs_info);
#endif #endif

View File

@@ -1554,7 +1554,7 @@ static uint8_t dfs_find_ch_with_fallback(
#ifdef CONFIG_CHAN_FREQ_API #ifdef CONFIG_CHAN_FREQ_API
static uint16_t dfs_find_ch_with_fallback_for_freq(struct wlan_dfs *dfs, static uint16_t dfs_find_ch_with_fallback_for_freq(struct wlan_dfs *dfs,
uint8_t *chan_wd, uint8_t *chan_wd,
uint16_t *center_freq_seg1, qdf_freq_t *center_freq_seg1,
uint16_t *freq_lst, uint16_t *freq_lst,
uint32_t num_chan) uint32_t num_chan)
{ {
@@ -2151,8 +2151,7 @@ uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs,
struct dfs_channel *chan_list, struct dfs_channel *chan_list,
uint32_t chan_cnt, uint32_t chan_cnt,
uint32_t flags, uint32_t flags,
uint8_t *chan_wd, struct ch_params *chan_params,
struct dfs_channel *cur_chan,
uint8_t dfs_region, uint8_t dfs_region,
struct dfs_acs_info *acs_info) struct dfs_acs_info *acs_info)
{ {
@@ -2164,7 +2163,7 @@ uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs,
uint16_t flag_no_weather = 0; uint16_t flag_no_weather = 0;
uint16_t *leakage_adjusted_lst; uint16_t *leakage_adjusted_lst;
uint16_t final_lst[NUM_CHANNELS] = {0}; uint16_t final_lst[NUM_CHANNELS] = {0};
uint16_t *dfs_cfreq_seg2 = NULL; uint8_t *chan_wd = (uint8_t *)&chan_params->ch_width;
if (!chan_list || !chan_cnt) { if (!chan_list || !chan_cnt) {
dfs_info(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN, dfs_info(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
@@ -2231,12 +2230,9 @@ uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs,
final_cnt); final_cnt);
break; break;
} }
dfs_cfreq_seg2 = &cur_chan->dfs_ch_mhz_freq_seg2; target_freq = dfs_find_ch_with_fallback_for_freq(
target_freq = dfs, chan_wd, &chan_params->mhz_freq_seg1,
dfs_find_ch_with_fallback_for_freq(dfs, chan_wd, leakage_adjusted_lst, random_chan_cnt);
dfs_cfreq_seg2,
leakage_adjusted_lst,
random_chan_cnt);
/* Since notion of 80+80 is not present in the regulatory /* Since notion of 80+80 is not present in the regulatory
* channel the function may return invalid 80+80 channels for * channel the function may return invalid 80+80 channels for
@@ -2245,12 +2241,21 @@ uint16_t dfs_prepare_random_channel_for_freq(struct wlan_dfs *dfs,
*/ */
if ((*chan_wd == DFS_CH_WIDTH_80P80MHZ) && if ((*chan_wd == DFS_CH_WIDTH_80P80MHZ) &&
(flags & DFS_RANDOM_CH_FLAG_RESTRICTED_80P80_ENABLED) && (flags & DFS_RANDOM_CH_FLAG_RESTRICTED_80P80_ENABLED) &&
!(CHAN_WITHIN_RESTRICTED_80P80(target_freq, target_freq) {
*dfs_cfreq_seg2))) { wlan_reg_set_channel_params_for_freq(dfs->dfs_pdev_obj,
*chan_wd = DFS_CH_WIDTH_160MHZ; target_freq,
target_freq = dfs_find_ch_with_fallback_for_freq( 0, chan_params);
dfs, chan_wd, dfs_cfreq_seg2, if (!(CHAN_WITHIN_RESTRICTED_80P80(
leakage_adjusted_lst, random_chan_cnt); chan_params->mhz_freq_seg0,
chan_params->mhz_freq_seg1))) {
*chan_wd = DFS_CH_WIDTH_160MHZ;
target_freq =
dfs_find_ch_with_fallback_for_freq(
dfs, chan_wd,
&chan_params->mhz_freq_seg1,
leakage_adjusted_lst,
random_chan_cnt);
}
} }
/* /*

View File

@@ -57,17 +57,17 @@
#define DFS_ALLOW_HW_PULSES 28 #define DFS_ALLOW_HW_PULSES 28
#define DFS_SET_PRI_MULTIPILER 29 #define DFS_SET_PRI_MULTIPILER 29
#define RESTRICTED_80P80_START_CHAN 132 #define RESTRICTED_80P80_START_FREQ 5660
#define RESTRICTED_80P80_END_CHAN 161 #define RESTRICTED_80P80_END_FREQ 5805
/* Check if the given channels are within restricted 80P80 start chan(132) and /* Check if the given frequencies are within restricted 80P80 start freq(5660)
* end chan (161). * and end freq (5805).
*/ */
#define CHAN_WITHIN_RESTRICTED_80P80(chan, cfreq_seg2) \ #define CHAN_WITHIN_RESTRICTED_80P80(cfreq1, cfreq2) \
((((chan) >= RESTRICTED_80P80_START_CHAN) && \ ((((cfreq1) >= RESTRICTED_80P80_START_FREQ) && \
((chan) <= RESTRICTED_80P80_END_CHAN) && \ ((cfreq1) <= RESTRICTED_80P80_END_FREQ) && \
((cfreq_seg2) >= RESTRICTED_80P80_START_CHAN) && \ ((cfreq2) >= RESTRICTED_80P80_START_FREQ) && \
((cfreq_seg2) <= RESTRICTED_80P80_END_CHAN)) ? true : false) ((cfreq2) <= RESTRICTED_80P80_END_FREQ)) ? true : false)
/* /*
* Spectral IOCTLs use DFS_LAST_IOCTL as the base. * Spectral IOCTLs use DFS_LAST_IOCTL as the base.

View File

@@ -1059,7 +1059,6 @@ QDF_STATUS utils_dfs_get_vdev_random_channel_for_freq(
struct wlan_dfs *dfs = NULL; struct wlan_dfs *dfs = NULL;
struct wlan_objmgr_psoc *psoc; struct wlan_objmgr_psoc *psoc;
struct dfs_channel *chan_list = NULL; struct dfs_channel *chan_list = NULL;
struct dfs_channel cur_chan;
QDF_STATUS status = QDF_STATUS_E_FAILURE; QDF_STATUS status = QDF_STATUS_E_FAILURE;
*target_chan_freq = 0; *target_chan_freq = 0;
@@ -1086,23 +1085,13 @@ QDF_STATUS utils_dfs_get_vdev_random_channel_for_freq(
goto random_chan_error; goto random_chan_error;
} }
cur_chan.dfs_ch_vhtop_ch_freq_seg1 = chan_params->center_freq_seg0;
cur_chan.dfs_ch_vhtop_ch_freq_seg2 = chan_params->center_freq_seg1;
cur_chan.dfs_ch_mhz_freq_seg1 = chan_params->mhz_freq_seg0;
cur_chan.dfs_ch_mhz_freq_seg2 = chan_params->mhz_freq_seg1;
if (!chan_params->ch_width) if (!chan_params->ch_width)
utils_dfs_get_max_sup_width(pdev, utils_dfs_get_max_sup_width(pdev,
(uint8_t *)&chan_params->ch_width); (uint8_t *)&chan_params->ch_width);
*target_chan_freq = dfs_prepare_random_channel_for_freq(dfs, chan_list, *target_chan_freq = dfs_prepare_random_channel_for_freq(
num_chan, flags, (uint8_t *)&chan_params->ch_width, dfs, chan_list, num_chan, flags, chan_params,
&cur_chan, (uint8_t)dfs_reg, acs_info); (uint8_t)dfs_reg, acs_info);
chan_params->center_freq_seg0 = cur_chan.dfs_ch_vhtop_ch_freq_seg1;
chan_params->center_freq_seg1 = cur_chan.dfs_ch_vhtop_ch_freq_seg2;
chan_params->mhz_freq_seg0 = cur_chan.dfs_ch_mhz_freq_seg1;
chan_params->mhz_freq_seg1 = cur_chan.dfs_ch_mhz_freq_seg2;
dfs_info(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN, dfs_info(dfs, WLAN_DEBUG_DFS_RANDOM_CHAN,
"input width=%d", chan_params->ch_width); "input width=%d", chan_params->ch_width);