qcacld-3.0: Replace dfs utils call

Replace with dfs utils call utils_dfs_get_vdev_random_channel with
utils_dfs_get_vdev_random_channel_for_freq. We are replacing
channel numbers with frequency.

Change-Id: I0244512f83f45ef7974e39016832784b804286b7
CRs-Fixed: 2753219
This commit is contained in:
Amar Singhal
2020-08-11 14:24:24 -07:00
committed by snandini
parent 747bc9c58f
commit f8517e79e7
3 changed files with 27 additions and 25 deletions

View File

@@ -1025,7 +1025,8 @@ QDF_STATUS wlansap_roam_callback(void *ctx,
sap_signal_hdd_event(sap_ctx, NULL, eSAP_DFS_RADAR_DETECT, sap_signal_hdd_event(sap_ctx, NULL, eSAP_DFS_RADAR_DETECT,
(void *) eSAP_STATUS_SUCCESS); (void *) eSAP_STATUS_SUCCESS);
mac_ctx->sap.SapDfsInfo.target_chan_freq = mac_ctx->sap.SapDfsInfo.target_chan_freq =
wlan_reg_chan_to_freq(mac_ctx->pdev, sap_indicate_radar(sap_ctx)); sap_indicate_radar(sap_ctx);
/* if there is an assigned next channel hopping */ /* if there is an assigned next channel hopping */
if (0 < mac_ctx->sap.SapDfsInfo.user_provided_target_chan_freq) { if (0 < mac_ctx->sap.SapDfsInfo.user_provided_target_chan_freq) {
mac_ctx->sap.SapDfsInfo.target_chan_freq = mac_ctx->sap.SapDfsInfo.target_chan_freq =

View File

@@ -182,11 +182,11 @@ static uint8_t *sap_hdd_event_to_string(eSapHddEvent event)
* This function first eliminates invalid channel, then selects random channel * This function first eliminates invalid channel, then selects random channel
* using following algorithm: * using following algorithm:
* *
* Return: channel number picked * Return: channel frequency picked
*/ */
static uint8_t sap_random_channel_sel(struct sap_context *sap_ctx) static qdf_freq_t sap_random_channel_sel(struct sap_context *sap_ctx)
{ {
uint8_t ch; uint16_t chan_freq;
uint8_t ch_wd; uint8_t ch_wd;
struct wlan_objmgr_pdev *pdev = NULL; struct wlan_objmgr_pdev *pdev = NULL;
struct ch_params *ch_params; struct ch_params *ch_params;
@@ -236,14 +236,15 @@ static uint8_t sap_random_channel_sel(struct sap_context *sap_ctx)
sap_operating_chan_preferred_location == 2) sap_operating_chan_preferred_location == 2)
flag |= DFS_RANDOM_CH_FLAG_NO_LOWER_5G_CH; flag |= DFS_RANDOM_CH_FLAG_NO_LOWER_5G_CH;
if (QDF_IS_STATUS_ERROR(utils_dfs_get_vdev_random_channel( if (QDF_IS_STATUS_ERROR(utils_dfs_get_vdev_random_channel_for_freq(
pdev, sap_ctx->vdev, flag, ch_params, &hw_mode, &ch, &acs_info))) { pdev, sap_ctx->vdev, flag, ch_params,
&hw_mode, &chan_freq, &acs_info))) {
/* No available channel found */ /* No available channel found */
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
FL("No available channel found!!!")); FL("No available channel found!!!"));
sap_signal_hdd_event(sap_ctx, NULL, sap_signal_hdd_event(sap_ctx, NULL,
eSAP_DFS_NO_AVAILABLE_CHANNEL, eSAP_DFS_NO_AVAILABLE_CHANNEL,
(void *)eSAP_STATUS_SUCCESS); (void *)eSAP_STATUS_SUCCESS);
return 0; return 0;
} }
mac_ctx->sap.SapDfsInfo.new_chanWidth = ch_params->ch_width; mac_ctx->sap.SapDfsInfo.new_chanWidth = ch_params->ch_width;
@@ -251,7 +252,7 @@ static uint8_t sap_random_channel_sel(struct sap_context *sap_ctx)
sap_ctx->ch_params.sec_ch_offset = ch_params->sec_ch_offset; sap_ctx->ch_params.sec_ch_offset = ch_params->sec_ch_offset;
sap_ctx->ch_params.center_freq_seg0 = ch_params->center_freq_seg0; sap_ctx->ch_params.center_freq_seg0 = ch_params->center_freq_seg0;
sap_ctx->ch_params.center_freq_seg1 = ch_params->center_freq_seg1; sap_ctx->ch_params.center_freq_seg1 = ch_params->center_freq_seg1;
return ch; return chan_freq;
} }
#else #else
static uint8_t sap_random_channel_sel(struct sap_context *sap_ctx) static uint8_t sap_random_channel_sel(struct sap_context *sap_ctx)
@@ -2145,11 +2146,11 @@ static QDF_STATUS sap_validate_dfs_nol(struct sap_context *sap_ctx,
if (sap_dfs_is_channel_in_nol_list(sap_ctx, sap_chan, if (sap_dfs_is_channel_in_nol_list(sap_ctx, sap_chan,
PHY_CHANNEL_BONDING_STATE_MAX) || PHY_CHANNEL_BONDING_STATE_MAX) ||
b_leak_chan) { b_leak_chan) {
uint8_t ch; qdf_freq_t chan_freq;
/* find a new available channel */ /* find a new available channel */
ch = sap_random_channel_sel(sap_ctx); chan_freq = sap_random_channel_sel(sap_ctx);
if (!ch) { if (!chan_freq) {
/* No available channel found */ /* No available channel found */
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE(QDF_MODULE_ID_SAP,
QDF_TRACE_LEVEL_ERROR, QDF_TRACE_LEVEL_ERROR,
@@ -2161,10 +2162,10 @@ static QDF_STATUS sap_validate_dfs_nol(struct sap_context *sap_ctx,
} }
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("ch_freq %d is in NOL, Start Bss on new chan %d"), FL("ch_freq %d is in NOL, start bss on new freq %d"),
sap_ctx->chan_freq, ch); sap_ctx->chan_freq, chan_freq);
sap_ctx->chan_freq = wlan_reg_chan_to_freq(mac_ctx->pdev, ch); sap_ctx->chan_freq = chan_freq;
wlan_reg_set_channel_params_for_freq(mac_ctx->pdev, wlan_reg_set_channel_params_for_freq(mac_ctx->pdev,
sap_ctx->chan_freq, sap_ctx->chan_freq,
sap_ctx->sec_ch_freq, sap_ctx->sec_ch_freq,
@@ -3607,9 +3608,9 @@ static QDF_STATUS sap_get_freq_list(struct sap_context *sap_ctx,
#endif #endif
#ifdef DFS_COMPONENT_ENABLE #ifdef DFS_COMPONENT_ENABLE
uint8_t sap_indicate_radar(struct sap_context *sap_ctx) qdf_freq_t sap_indicate_radar(struct sap_context *sap_ctx)
{ {
uint8_t target_channel = 0; qdf_freq_t chan_freq = 0;
struct mac_context *mac; struct mac_context *mac;
if (!sap_ctx) { if (!sap_ctx) {
@@ -3649,16 +3650,16 @@ uint8_t sap_indicate_radar(struct sap_context *sap_ctx)
(void *) eSAP_STATUS_SUCCESS))) (void *) eSAP_STATUS_SUCCESS)))
return 0; return 0;
target_channel = sap_random_channel_sel(sap_ctx); chan_freq = sap_random_channel_sel(sap_ctx);
if (!target_channel) if (!chan_freq)
sap_signal_hdd_event(sap_ctx, NULL, sap_signal_hdd_event(sap_ctx, NULL,
eSAP_DFS_NO_AVAILABLE_CHANNEL, (void *) eSAP_STATUS_SUCCESS); eSAP_DFS_NO_AVAILABLE_CHANNEL, (void *) eSAP_STATUS_SUCCESS);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_WARN, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_WARN,
FL("sapdfs: New selected target channel is [%d]"), FL("sapdfs: New selected target freq is [%d]"),
target_channel); chan_freq);
return target_channel; return chan_freq;
} }
#endif #endif

View File

@@ -440,11 +440,11 @@ void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev,
* *
* process radar indication. * process radar indication.
* *
* Return: channel to which sap wishes to switch. * Return: frequency to which sap wishes to switch.
*/ */
uint8_t sap_indicate_radar(struct sap_context *sap_ctx); qdf_freq_t sap_indicate_radar(struct sap_context *sap_ctx);
#else #else
static inline uint8_t sap_indicate_radar(struct sap_context *sap_ctx) static inline qdf_freq_t sap_indicate_radar(struct sap_context *sap_ctx)
{ {
return 0; return 0;
} }