qcacld-3.0: Convert primary, secondary channel for acs cfg to freq

Convert primary, secondary channel for acs cfg to freq as part
of ACS 6Ghz changes.

Change-Id: I4f6220b39dae91df070b0764fa8b048cdc6ad00f
CRs-Fixed: 2555988
This commit is contained in:
gaurank kathpalia
2019-10-30 17:21:48 +05:30
committed by nshrivas
parent 648adbafb9
commit 92b81ceb99
6 changed files with 89 additions and 79 deletions

View File

@@ -450,8 +450,8 @@ struct sap_acs_cfg {
uint8_t is_ht_enabled;
uint8_t is_vht_enabled;
/* ACS Algo Output */
uint8_t pri_ch;
uint8_t ht_sec_ch;
uint32_t pri_ch_freq;
uint32_t ht_sec_ch_freq;
uint8_t vht_seg0_center_ch;
uint8_t vht_seg1_center_ch;
uint32_t band;
@@ -1249,7 +1249,7 @@ void wlan_sap_set_sap_ctx_acs_cfg(struct sap_context *sap_ctx,
void sap_config_acs_result(mac_handle_t mac_handle,
struct sap_context *sap_ctx,
uint32_t sec_ch);
uint32_t sec_ch_freq);
QDF_STATUS wlansap_update_sap_config_add_ie(struct sap_config *config,
const uint8_t *pAdditionIEBuffer,

View File

@@ -95,12 +95,14 @@
void sap_config_acs_result(mac_handle_t mac_handle,
struct sap_context *sap_ctx,
uint32_t sec_ch)
uint32_t sec_ch_freq)
{
uint32_t channel = sap_ctx->acs_cfg->pri_ch;
uint32_t channel = wlan_freq_to_chan(sap_ctx->acs_cfg->pri_ch_freq);
struct ch_params ch_params = {0};
struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
uint8_t sec_ch;
sec_ch = wlan_freq_to_chan(sec_ch_freq);
ch_params.ch_width = sap_ctx->acs_cfg->ch_width;
wlan_reg_set_channel_params(mac_ctx->pdev, channel, sec_ch,
&ch_params);
@@ -118,11 +120,13 @@ void sap_config_acs_result(mac_handle_t mac_handle,
sap_ctx->acs_cfg->vht_seg1_center_ch = 0;
if (ch_params.sec_ch_offset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
sap_ctx->acs_cfg->ht_sec_ch = sap_ctx->acs_cfg->pri_ch - 4;
sap_ctx->acs_cfg->ht_sec_ch_freq =
sap_ctx->acs_cfg->pri_ch_freq - 20;
else if (ch_params.sec_ch_offset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY)
sap_ctx->acs_cfg->ht_sec_ch = sap_ctx->acs_cfg->pri_ch + 4;
sap_ctx->acs_cfg->ht_sec_ch_freq =
sap_ctx->acs_cfg->pri_ch_freq + 20;
else
sap_ctx->acs_cfg->ht_sec_ch = 0;
sap_ctx->acs_cfg->ht_sec_ch_freq = 0;
}
/**
@@ -289,7 +293,7 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
if (!sap_ctx->acs_cfg->ch_list_count) {
sap_err("No channel left for SAP operation, hotspot fail");
sap_ctx->chan_freq = SAP_CHANNEL_NOT_SELECTED;
sap_ctx->acs_cfg->pri_ch = SAP_CHANNEL_NOT_SELECTED;
sap_ctx->acs_cfg->pri_ch_freq = SAP_CHANNEL_NOT_SELECTED;
sap_config_acs_result(mac_handle, sap_ctx, 0);
sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED;
sap_ctx->sap_status = eSAP_START_BSS_CHANNEL_NOT_SELECTED;
@@ -303,10 +307,9 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
oper_channel =
sap_select_default_oper_chan(sap_ctx->acs_cfg);
sap_ctx->chan_freq = oper_channel;
sap_ctx->acs_cfg->pri_ch =
wlan_reg_freq_to_chan(mac_ctx->pdev, oper_channel);
sap_ctx->acs_cfg->pri_ch_freq = oper_channel;
sap_config_acs_result(mac_handle, sap_ctx,
sap_ctx->acs_cfg->ht_sec_ch);
sap_ctx->acs_cfg->ht_sec_ch_freq);
sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED;
sap_ctx->sap_status = eSAP_STATUS_SUCCESS;
goto close_session;
@@ -324,9 +327,9 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
}
sap_ctx->chan_freq = oper_channel;
sap_ctx->acs_cfg->pri_ch = wlan_reg_freq_to_chan(mac_ctx->pdev,
oper_channel);
sap_config_acs_result(mac_handle, sap_ctx, sap_ctx->acs_cfg->ht_sec_ch);
sap_ctx->acs_cfg->pri_ch_freq = oper_channel;
sap_config_acs_result(mac_handle, sap_ctx,
sap_ctx->acs_cfg->ht_sec_ch_freq);
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("Channel freq selected = %d"), sap_ctx->chan_freq);

View File

@@ -2537,7 +2537,8 @@ uint32_t sap_select_channel(mac_handle_t mac_handle,
break;
}
sap_ctx->acs_cfg->pri_ch = best_ch_num;
sap_ctx->acs_cfg->pri_ch_freq =
wlan_reg_chan_to_freq(mac_ctx->pdev, best_ch_num);
/* determine secondary channel for 2.4G channel 5, 6, 7 in HT40 */
if ((operating_band != eCSR_DOT11_MODE_11g) ||
(sap_ctx->acs_cfg->ch_width != CH_WIDTH_40MHZ))
@@ -2561,21 +2562,22 @@ uint32_t sap_select_channel(mac_handle_t mac_handle,
}
if (weight_below < weight_above)
sap_ctx->acs_cfg->ht_sec_ch =
sap_ctx->acs_cfg->pri_ch - 4;
sap_ctx->acs_cfg->ht_sec_ch_freq =
sap_ctx->acs_cfg->pri_ch_freq - 20;
else
sap_ctx->acs_cfg->ht_sec_ch =
sap_ctx->acs_cfg->pri_ch + 4;
sap_ctx->acs_cfg->ht_sec_ch_freq =
sap_ctx->acs_cfg->pri_ch_freq + 20;
} else if (best_ch_num >= 1 && best_ch_num <= 4) {
sap_ctx->acs_cfg->ht_sec_ch = sap_ctx->acs_cfg->pri_ch + 4;
sap_ctx->acs_cfg->ht_sec_ch_freq =
sap_ctx->acs_cfg->pri_ch_freq + 20;
} else if (best_ch_num >= ht40plus2gendch && best_ch_num <=
HT40MINUS_2G_CH_END) {
sap_ctx->acs_cfg->ht_sec_ch = sap_ctx->acs_cfg->pri_ch - 4;
sap_ctx->acs_cfg->ht_sec_ch_freq =
sap_ctx->acs_cfg->pri_ch_freq - 20;
} else if (best_ch_num == 14) {
sap_ctx->acs_cfg->ht_sec_ch = 0;
sap_ctx->acs_cfg->ht_sec_ch_freq = 0;
}
sap_ctx->sec_ch_freq = wlan_reg_chan_to_freq(
mac_ctx->pdev, sap_ctx->acs_cfg->ht_sec_ch);
sap_ctx->sec_ch_freq = sap_ctx->acs_cfg->ht_sec_ch_freq;
sap_ch_sel_end:
/* Free all the allocated memory */

View File

@@ -810,7 +810,7 @@ validation_done:
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
FL("for configured channel, Ch_freq = %d"),
sap_context->chan_freq);
sap_ch = wlan_reg_freq_to_chan(mac_ctx->pdev, sap_context->chan_freq);
if (check_for_connection_update) {
/* This wait happens in the hostapd context. The event
* is set in the MC thread context.
@@ -826,9 +826,9 @@ validation_done:
if (pre_start_bss) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
FL("ACS end due to Ch override. Sel Ch = %d"),
sap_ch);
sap_context->acs_cfg->pri_ch = sap_ch;
FL("ACS end due to Ch override. Sel Ch freq = %d"),
sap_context->chan_freq);
sap_context->acs_cfg->pri_ch_freq = sap_context->chan_freq;
sap_context->acs_cfg->ch_width =
sap_context->ch_width_orig;
sap_config_acs_result(mac_handle, sap_context, 0);
@@ -1500,10 +1500,10 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx,
sap_ap_event.sapHddEventCode = sap_hddevent;
acs_selected = &sap_ap_event.sapevt.sap_ch_selected;
if (eSAP_STATUS_SUCCESS == (eSapStatus)context) {
acs_selected->pri_ch_freq = wlan_reg_chan_to_freq(
mac_ctx->pdev, sap_ctx->acs_cfg->pri_ch);
acs_selected->ht_sec_ch_freq = wlan_reg_chan_to_freq(
mac_ctx->pdev, sap_ctx->acs_cfg->ht_sec_ch);
acs_selected->pri_ch_freq =
sap_ctx->acs_cfg->pri_ch_freq;
acs_selected->ht_sec_ch_freq =
sap_ctx->acs_cfg->ht_sec_ch_freq;
acs_selected->ch_width = sap_ctx->acs_cfg->ch_width;
acs_selected->vht_seg0_center_ch =
sap_ctx->acs_cfg->vht_seg0_center_ch;
@@ -1737,13 +1737,11 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx,
* Reconfig ACS result info. For DFS AP-AP Mode Sec AP ACS
* follows pri AP
*/
sap_ctx->acs_cfg->pri_ch = wlan_reg_freq_to_chan(mac_ctx->pdev,
sap_ctx->chan_freq);
sap_ctx->acs_cfg->pri_ch_freq = sap_ctx->chan_freq;
sap_ctx->acs_cfg->ch_width =
sap_ctx->csr_roamProfile.ch_params.ch_width;
sap_config_acs_result(MAC_HANDLE(mac_ctx), sap_ctx,
wlan_reg_freq_to_chan(mac_ctx->pdev,
sap_ctx->sec_ch_freq));
sap_ctx->sec_ch_freq);
sap_ap_event.sapHddEventCode = eSAP_CHANNEL_CHANGE_EVENT;