qcacmn: Add acs range support in random channel selection

Add support to conside auto-channel selection range in random channel
selection algorithm.

If acs is enabled, random channel is selected from acs channel range.

Change-Id: I6ccf9ae58aa2d9b63133de3f98030078bf13cf49
CRs-Fixed: 2017481
This commit is contained in:
Arif Hussain
2017-04-22 13:17:41 -07:00
committed by snandini
부모 c9a13a52c8
커밋 cc21cb2e15
5개의 변경된 파일41개의 추가작업 그리고 8개의 파일을 삭제

파일 보기

@@ -168,6 +168,7 @@ struct chan_bonding_bitmap {
* @ch_wd: input channel width, used same variable to return new ch width.
* @cur_chan: current channel.
* @dfs_region: DFS region.
* @acs_info: acs channel range information.
*
* Function used to find random channel selection from a given list.
* First this function removes channels based on flags and then uses final
@@ -182,4 +183,5 @@ int dfs_prepare_random_channel(struct wlan_dfs *dfs,
uint32_t flags,
uint8_t *ch_wd,
struct dfs_ieee80211_channel *cur_chan,
uint8_t dfs_region);
uint8_t dfs_region,
struct dfs_acs_info *acs_info);

파일 보기

@@ -395,6 +395,7 @@ static bool dfs_freq_is_in_nol(struct wlan_dfs *dfs, uint32_t freq)
* @ch_list: input channel list
* @ch_cnt: input channel count
* @dfs_region: dfs region
* @acs_info: acs channel range information
*
* prepare channel list based on flags
*
@@ -406,7 +407,8 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
uint32_t *random_chan_cnt,
struct dfs_ieee80211_channel *ch_list,
uint32_t ch_cnt,
uint8_t dfs_region)
uint8_t dfs_region,
struct dfs_acs_info *acs_info)
{
struct dfs_ieee80211_channel *chan;
uint16_t flag_no_wheather = 0;
@@ -431,7 +433,6 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
flag_no_2g_chan = flags & DFS_RANDOM_CH_FLAG_NO_2GHZ_CH;
flag_no_5g_chan = flags & DFS_RANDOM_CH_FLAG_NO_5GHZ_CH;
for (i = 0; i < ch_cnt; i++) {
chan = &ch_list[i];
@@ -440,16 +441,29 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
__func__, chan->ic_ieee);
continue;
}
if (acs_info && (acs_info->acs_mode == 1) &&
((chan->ic_ieee < acs_info->start_ch) ||
(chan->ic_ieee > acs_info->end_ch))) {
DFS_PRINTK("%s: skip ch %d not in acs range (%d-%d)\n",
__func__, chan->ic_ieee, acs_info->start_ch,
acs_info->end_ch);
continue;
}
if (flag_no_2g_chan && chan->ic_ieee <= DFS_MAX_24GHZ_CHANNEL) {
DFS_PRINTK("%s: skip 2.4 GHz channel=%d\n",
__func__, chan->ic_ieee);
continue;
}
if (flag_no_5g_chan && chan->ic_ieee > DFS_MAX_24GHZ_CHANNEL) {
DFS_PRINTK("%s: skip 5 GHz channel=%d\n",
__func__, chan->ic_ieee);
continue;
}
if (flag_no_wheather) {
/*
* We should also avoid this channel in HT40 mode as
@@ -470,6 +484,7 @@ static void dfs_apply_rules(struct wlan_dfs *dfs,
continue;
}
}
if (flag_no_lower_5g &&
DFS_IS_CHAN_JAPAN_INDOOR(chan->ic_freq)) {
DFS_PRINTK("%s: skip indoor channel=%d\n",
@@ -508,7 +523,8 @@ int dfs_prepare_random_channel(struct wlan_dfs *dfs,
uint32_t flags,
uint8_t *ch_wd,
struct dfs_ieee80211_channel *cur_chan,
uint8_t dfs_region)
uint8_t dfs_region,
struct dfs_acs_info *acs_info)
{
uint8_t target_ch = 0;
uint8_t *random_chan_list = NULL;
@@ -535,7 +551,7 @@ int dfs_prepare_random_channel(struct wlan_dfs *dfs,
dfs_remove_cur_ch_from_list(ch_list, &ch_cnt, ch_wd, cur_chan);
dfs_apply_rules(dfs, flags, random_chan_list, &random_chan_cnt,
ch_list, ch_cnt, dfs_region);
ch_list, ch_cnt, dfs_region, acs_info);
do {
if (*ch_wd == DFS_CH_WIDTH_20MHZ) {

파일 보기

@@ -45,4 +45,16 @@ struct radar_found_info {
uint32_t timestamp;
uint32_t is_chirp;
};
/**
* struct dfs_acs_info - acs info, ch range
* @acs_mode: to enable/disable acs 1/0.
* @start_ch: start channel number, ignore all channels before.
* @end_ch: end channel number, ignore all channels after.
*/
struct dfs_acs_info {
uint8_t acs_mode;
uint8_t start_ch;
uint8_t end_ch;
};
#endif

파일 보기

@@ -310,6 +310,7 @@ QDF_STATUS utils_dfs_get_nol_chfreq_and_chwidth(struct wlan_objmgr_pdev *pdev,
* @ch_params: current channel params.
* @hw_mode: current operating mode.
* @target_chan: Pointer to target_chan.
* @acs_info: acs range info.
*
* wrapper function for get_random_chan(). this
* function called from outside of dfs component.
@@ -318,7 +319,8 @@ QDF_STATUS utils_dfs_get_nol_chfreq_and_chwidth(struct wlan_objmgr_pdev *pdev,
*/
QDF_STATUS dfs_get_random_channel(struct wlan_objmgr_pdev *pdev,
uint16_t flags, struct ch_params *ch_params,
uint32_t *hw_mode, int *target_chan);
uint32_t *hw_mode, int *target_chan,
struct dfs_acs_info *acs_info);
/**
* dfs_init_nol() - Initialize nol from platform driver.

파일 보기

@@ -478,7 +478,8 @@ QDF_STATUS dfs_get_random_channel(
uint16_t flags,
struct ch_params *ch_params,
uint32_t *hw_mode,
int *target_chan)
int *target_chan,
struct dfs_acs_info *acs_info)
{
uint32_t dfs_reg;
uint32_t num_chan = NUM_CHANNELS;
@@ -525,7 +526,7 @@ QDF_STATUS dfs_get_random_channel(
*target_chan = dfs_prepare_random_channel(dfs, chan_list,
num_chan, flags, (uint8_t *)&ch_params->ch_width,
&cur_chan, (uint8_t)dfs_reg);
&cur_chan, (uint8_t)dfs_reg, acs_info);
ch_params->center_freq_seg0 = cur_chan.ic_vhtop_ch_freq_seg1;
ch_params->center_freq_seg1 = cur_chan.ic_vhtop_ch_freq_seg2;