qcacmn: Modularize finding radar affected sub channel function

The radar affected sub channel are determined by the bangradar type,
whether sub-channel marking is enabled or not, the center frequency
of the band on which the radar was detected. This block of code is present
in processing radar indication function and can be modularized.

Move the logic to find radar affected sub-channels into a single function.

Change-Id: Ic0a37fdfa97cbc1bcd2b9a23fd6642f22b43a733
CRs-Fixed: 2737120
This commit is contained in:
Vignesh U 2020-07-06 00:07:28 +05:30 • committed by snandini
commit 55d2f9474a

View file

@ -1058,6 +1058,48 @@ dfs_radar_action_for_hw_mode_switch(struct wlan_dfs *dfs,
}
#ifdef CONFIG_CHAN_FREQ_API
/**
* dfs_find_radar_affected_channels()- Find the radar affected 20MHz channels.
* @dfs: Pointer to wlan_dfs structure.
* @radar_found: Pointer to radar found structure.
* @freq_list: List of 20MHz frequencies on which radar has been detected.
* @freq_center: Frequency center of the band on which the radar was detected.
*
* Return: number of radar affected channels.
*/
static uint8_t
dfs_find_radar_affected_channels(struct wlan_dfs *dfs,
struct radar_found_info *radar_found,
uint16_t *freq_list,
uint32_t freq_center)
{
uint8_t num_channels;
if (dfs->dfs_bangradar_type == DFS_BANGRADAR_FOR_ALL_SUBCHANS)
num_channels =
dfs_get_bonding_channel_without_seg_info_for_freq
(dfs->dfs_curchan, freq_list);
/* BW reduction is dependent on subchannel marking */
else if ((dfs->dfs_use_nol_subchannel_marking) &&
(!(dfs->dfs_bangradar_type) ||
(dfs->dfs_bangradar_type ==
DFS_BANGRADAR_FOR_SPECIFIC_SUBCHANS)))
num_channels =
dfs_find_radar_affected_subchans_for_freq(dfs,
radar_found,
freq_list,
freq_center);
else
num_channels = dfs_get_bonding_channels_for_freq
(dfs,
dfs->dfs_curchan,
radar_found->segment_id,
radar_found->detector_id,
freq_list);
return num_channels;
}
QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs,
struct radar_found_info *radar_found)
{
@ -1138,25 +1180,10 @@ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs,
status = QDF_STATUS_SUCCESS;
goto exit;
}
if (dfs->dfs_bangradar_type == DFS_BANGRADAR_FOR_ALL_SUBCHANS)
num_channels =
dfs_get_bonding_channel_without_seg_info_for_freq
(dfs_curchan, freq_list);
/* BW reduction is dependent on subchannel marking */
else if ((dfs->dfs_use_nol_subchannel_marking) &&
(!(dfs->dfs_bangradar_type) ||
(dfs->dfs_bangradar_type ==
DFS_BANGRADAR_FOR_SPECIFIC_SUBCHANS)))
num_channels =
dfs_find_radar_affected_subchans_for_freq(dfs,
radar_found,
freq_list,
freq_center);
else
num_channels = dfs_get_bonding_channels_for_freq
(dfs, dfs_curchan, radar_found->segment_id,
radar_found->detector_id, freq_list);
num_channels = dfs_find_radar_affected_channels(dfs,
radar_found,
freq_list,
freq_center);
dfs_reset_bangradar(dfs);