qcacld-3.0: Keep only selected band's channels for ACS
Currently, PCL may not have the weights for the channels
from the selected band.
Keep only the channels of the selected band and remove
the channels of other band from ACS channel list
and PCL.
CRs-Fixed: 2053468
Change-Id: Ie71febe9068493e2c356f0590a86e3c15494b2e1
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index b5fe350..30e7c20 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -1434,77 +1434,26 @@
tsap_Config_t *sap_config)
{
int i, j;
- bool found;
-
- if (HDD_EXTERNAL_ACS_PCL_MANDATORY ==
- hdd_ctx->config->external_acs_policy) {
- /*
- * In preferred channels mandatory case, PCL shall
- * contain only the preferred channels from the
- * application. If those channels are not present
- * in the driver PCL, then set the weight to zero
- */
- for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) {
- acs_chan_params->vendor_pcl_list[i] =
- sap_config->acs_cfg.ch_list[i];
- acs_chan_params->vendor_weight_list[i] = 0;
- for (j = 0; j < sap_config->acs_cfg.pcl_ch_count; j++) {
- if (sap_config->acs_cfg.ch_list[i] ==
- sap_config->acs_cfg.pcl_channels[j]) {
- acs_chan_params->vendor_weight_list[i] =
- sap_config->
- acs_cfg.pcl_channels_weight_list[j];
- break;
- }
- }
- }
- acs_chan_params->pcl_count = sap_config->acs_cfg.ch_list_count;
- } else {
- /*
- * In preferred channels not mandatory case update the
- * PCL weight to zero for those channels which are not
- * present in the application's preferred channel list for
- * ACS
- */
- for (i = 0; i < sap_config->acs_cfg.pcl_ch_count; i++) {
- found = false;
- for (j = 0; j < sap_config->acs_cfg.ch_list_count;
- j++) {
- if (sap_config->acs_cfg.pcl_channels[i] ==
- sap_config->acs_cfg.ch_list[j]) {
- acs_chan_params->vendor_pcl_list[i] =
- sap_config->
- acs_cfg.pcl_channels[i];
- acs_chan_params->
- vendor_weight_list[i] =
- sap_config->acs_cfg.
- pcl_channels_weight_list[i];
- found = true;
- break;
- }
- }
- if (!found) {
- acs_chan_params->vendor_pcl_list[i] =
- sap_config->acs_cfg.pcl_channels[i];
- acs_chan_params->vendor_weight_list[i] = 0;
- }
- }
-
- acs_chan_params->pcl_count = sap_config->acs_cfg.pcl_ch_count;
-
- if (hdd_ctx->unsafe_channel_count == 0)
- return;
- /* Update unsafe channel weight as zero */
- for (i = 0; i < acs_chan_params->pcl_count; i++) {
- for (j = 0; j < hdd_ctx->unsafe_channel_count; j++) {
- if (acs_chan_params->vendor_pcl_list[i] ==
- hdd_ctx->unsafe_channel_list[j]) {
- acs_chan_params->
- vendor_weight_list[i] = 0;
- }
+ /*
+ * PCL shall contain only the preferred channels from the
+ * application. If those channels are not present in the
+ * driver PCL, then set the weight to zero
+ */
+ for (i = 0; i < sap_config->acs_cfg.ch_list_count; i++) {
+ acs_chan_params->vendor_pcl_list[i] =
+ sap_config->acs_cfg.ch_list[i];
+ acs_chan_params->vendor_weight_list[i] = 0;
+ for (j = 0; j < sap_config->acs_cfg.pcl_ch_count; j++) {
+ if (sap_config->acs_cfg.ch_list[i] ==
+ sap_config->acs_cfg.pcl_channels[j]) {
+ acs_chan_params->vendor_weight_list[i] =
+ sap_config->
+ acs_cfg.pcl_channels_weight_list[j];
+ break;
}
}
}
+ acs_chan_params->pcl_count = sap_config->acs_cfg.ch_list_count;
}
/**
@@ -1731,6 +1680,8 @@
tsap_Config_t *sap_config,
eCsrBand *band)
{
+ int i, temp_count = 0;
+ int acs_list_count = sap_config->acs_cfg.ch_list_count;
/* Get scan band */
if ((sap_config->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211B) ||
(sap_config->acs_cfg.hw_mode == QCA_ACS_MODE_IEEE80211G)) {
@@ -1748,6 +1699,26 @@
*band = eCSR_BAND_24;
else
*band = eCSR_BAND_5G;
+ for (i = 0; i < acs_list_count; i++) {
+ if (eCSR_BAND_24 == *band) {
+ if (WLAN_REG_IS_24GHZ_CH(
+ sap_config->acs_cfg.ch_list[i])) {
+ sap_config->acs_cfg.ch_list[
+ temp_count] =
+ sap_config->acs_cfg.ch_list[i];
+ temp_count++;
+ }
+ } else if (eCSR_BAND_5G == *band) {
+ if (WLAN_REG_IS_5GHZ_CH(
+ sap_config->acs_cfg.ch_list[i])) {
+ sap_config->acs_cfg.ch_list[
+ temp_count] =
+ sap_config->acs_cfg.ch_list[i];
+ temp_count++;
+ }
+ }
+ }
+ sap_config->acs_cfg.ch_list_count = temp_count;
}
}