summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimanshu Agarwal <himanaga@codeaurora.org>2018-02-13 14:40:56 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-02-22 22:55:02 -0800
commita5405cf94bfe3f94b460bb6248702eb392993663 (patch)
tree670b24b2303619e2486a0d85285a4b0d6bd07015
parent9b73c0fab08ba3c6b9d05578770ad82001227c55 (diff)
qcacld-3.0: Avoid 2.4Ghz channel in 40Mhz for SAP start
When the channel list provided from hostapd contains both 2.4Ghz and 5Ghz channels and channel width is 40Mhz, scan happens on all the 2.4Ghz and 5Ghz channels and ACS algo runs on all the channels to find the best channel for starting SAP in 40Mhz. If a 2.4Ghz is selected, an OBSS scan happens on all the 2.4Ghz channels to check if there is any legacy BSS present on any overlapping channel. If any BSS is found, channel width fallbacks to 20Mhz and SAP gets started in 20Mhz bw instead of 40Mhz. This is generally the case with 2.4Ghz whereas there is no such issue in 5Ghz channels. Avoid 2.4Ghz channels for starting SAP in 40Mhz bw by assigning max weight to all the 2.4Ghz channels if 5Ghz channels are also present in the channel list provided from hostapd. Change-Id: I079d20b912282c9db5c9b51b1ed4b85a4aa9c5df CRs-Fixed: 2186658
-rw-r--r--core/sap/src/sap_ch_select.c74
-rw-r--r--core/sap/src/sap_fsm.c28
2 files changed, 94 insertions, 8 deletions
diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c
index b0f5cc470006..0b082e1daea1 100644
--- a/core/sap/src/sap_ch_select.c
+++ b/core/sap/src/sap_ch_select.c
@@ -2155,6 +2155,56 @@ static void sap_sort_chl_weight_vht160(tSapChSelSpectInfo *pSpectInfoParams)
}
/**
+ * sap_allocate_max_weight_ht40_24_g() - allocate max weight for 40Mhz
+ * to all 2.4Ghz channels
+ * @spect_info_params: Pointer to the tSapChSelSpectInfo structure
+ *
+ * Return: none
+ */
+static void sap_allocate_max_weight_ht40_24_g(
+ tSapChSelSpectInfo *spect_info_params)
+{
+ tSapSpectChInfo *spect_info;
+ uint8_t j;
+
+ /*
+ * Assign max weight for 40Mhz (SAP_ACS_WEIGHT_MAX * 2) to all
+ * 2.4 Ghz channels
+ */
+ spect_info = spect_info_params->pSpectCh;
+ for (j = 0; j < spect_info_params->numSpectChans; j++) {
+ if ((spect_info[j].chNum >= CDS_CHANNEL_NUM(CHAN_ENUM_1) &&
+ spect_info[j].chNum <= CDS_CHANNEL_NUM(CHAN_ENUM_14)))
+ spect_info[j].weight = SAP_ACS_WEIGHT_MAX * 2;
+ }
+}
+
+/**
+ * sap_allocate_max_weight_ht40_5_g() - allocate max weight for 40Mhz
+ * to all 5Ghz channels
+ * @spect_info_params: Pointer to the tSapChSelSpectInfo structure
+ *
+ * Return: none
+ */
+static void sap_allocate_max_weight_ht40_5_g(
+ tSapChSelSpectInfo *spect_info_params)
+{
+ tSapSpectChInfo *spect_info;
+ uint8_t j;
+
+ /*
+ * Assign max weight for 40Mhz (SAP_ACS_WEIGHT_MAX * 2) to all
+ * 5 Ghz channels
+ */
+ spect_info = spect_info_params->pSpectCh;
+ for (j = 0; j < spect_info_params->numSpectChans; j++) {
+ if ((spect_info[j].chNum >= CDS_CHANNEL_NUM(CHAN_ENUM_36) &&
+ spect_info[j].chNum <= CDS_CHANNEL_NUM(CHAN_ENUM_165)))
+ spect_info[j].weight = SAP_ACS_WEIGHT_MAX * 2;
+ }
+}
+
+/**
* sap_sort_chl_weight_ht40_24_g() - to sort channel with the least weight
* @pSpectInfoParams: Pointer to the tSapChSelSpectInfo structure
*
@@ -2278,6 +2328,16 @@ static void sap_sort_chl_weight_ht40_24_g(tSapChSelSpectInfo *pSpectInfoParams)
pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 2;
}
}
+
+ pSpectInfo = pSpectInfoParams->pSpectCh;
+ for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
+ QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
+ "In %s, Channel=%d Weight= %d rssi=%d bssCount=%d",
+ __func__, pSpectInfo->chNum, pSpectInfo->weight,
+ pSpectInfo->rssiAgr, pSpectInfo->bssCount);
+ pSpectInfo++;
+ }
+
sap_sort_chl_weight(pSpectInfoParams);
}
@@ -2413,12 +2473,16 @@ static void sap_sort_chl_weight_all(ptSapContext pSapCtx,
switch (pSapCtx->acs_cfg->ch_width) {
case CH_WIDTH_40MHZ:
- if (eCSR_DOT11_MODE_11g == operatingBand)
- sap_sort_chl_weight_ht40_24_g(pSpectInfoParams);
- else if (eCSR_DOT11_MODE_11a == operatingBand)
- sap_sort_chl_weight_ht40_5_g(pSpectInfoParams);
- else {
+ /*
+ * Assign max weight to all 5Ghz channels when operating band
+ * is 11g and to all 2.4Ghz channels when operating band is 11a
+ * or 11abg to avoid selection in ACS algorithm for starting SAP
+ */
+ if (eCSR_DOT11_MODE_11g == operatingBand) {
sap_sort_chl_weight_ht40_24_g(pSpectInfoParams);
+ sap_allocate_max_weight_ht40_5_g(pSpectInfoParams);
+ } else {
+ sap_allocate_max_weight_ht40_24_g(pSpectInfoParams);
sap_sort_chl_weight_ht40_5_g(pSpectInfoParams);
}
break;
diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c
index 630549b77bfd..aac4987b5d8e 100644
--- a/core/sap/src/sap_fsm.c
+++ b/core/sap/src/sap_fsm.c
@@ -4871,6 +4871,7 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx,
#endif
tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
tSapChSelSpectInfo spect_info_obj = { NULL, 0 };
+ uint16_t ch_width;
if (NULL == hal) {
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
@@ -4882,10 +4883,11 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx,
start_ch_num = sap_ctx->acs_cfg->start_ch;
end_ch_num = sap_ctx->acs_cfg->end_ch;
+ ch_width = sap_ctx->acs_cfg->ch_width;
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
- FL("startChannel %d, EndChannel %d, HW:%d"),
- start_ch_num, end_ch_num,
- sap_ctx->acs_cfg->hw_mode);
+ FL("startChannel %d, EndChannel %d, ch_width %d, HW:%d"),
+ start_ch_num, end_ch_num, ch_width,
+ sap_ctx->acs_cfg->hw_mode);
wlansap_extend_to_acs_range(&start_ch_num, &end_ch_num,
&band_start_ch, &band_end_ch);
@@ -4948,6 +4950,26 @@ static QDF_STATUS sap_get_channel_list(ptSapContext sap_ctx,
sap_ctx, &spect_info_obj))
continue;
+ /*
+ * If we have any 5Ghz channel in the channel list
+ * and bw is 40/80/160 Mhz then we don't want SAP to
+ * come up in 2.4Ghz as for 40Mhz, 2.4Ghz channel is
+ * not preferred and 80/160Mhz is not allowed for 2.4Ghz
+ * band. So, don't even scan on 2.4Ghz channels if bw is
+ * 40/80/160Mhz and channel list has any 5Ghz channel.
+ */
+ if (end_ch_num >= CDS_CHANNEL_NUM(CHAN_ENUM_36) &&
+ ((ch_width == CH_WIDTH_40MHZ) ||
+ (ch_width == CH_WIDTH_80MHZ) ||
+ (ch_width == CH_WIDTH_80P80MHZ) ||
+ (ch_width == CH_WIDTH_160MHZ))) {
+ if (CDS_CHANNEL_NUM(loop_count) >=
+ CDS_CHANNEL_NUM(CHAN_ENUM_1) &&
+ CDS_CHANNEL_NUM(loop_count) <=
+ CDS_CHANNEL_NUM(CHAN_ENUM_14))
+ continue;
+ }
+
#ifdef FEATURE_WLAN_CH_AVOID
for (i = 0; i < NUM_CHANNELS; i++) {
if (safe_channels[i].channelNumber ==