qca-cld2.0: Add secondary channel info for channel bonding
For 2.4G HT40 case, secondary channel information is needed
when setting the channel bonding mode. Add secondary channel
when invoking sme_SelectCBMode function.
Change-Id: Ic252cfea67e69cb8510697c143408a6f35f84c28
CRs-fixed: 872309
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index 00748e7..27982f0 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -2074,6 +2074,7 @@
sme_SelectCBMode(WLAN_HDD_GET_HAL_CTX(sap_adapter),
hdd_ap_ctx->sapConfig.SapHw_mode,
hdd_ap_ctx->operatingChannel,
+ hdd_ap_ctx->sapConfig.sec_ch,
&hdd_ap_ctx->sapConfig.vht_channel_width,
hdd_ap_ctx->sapConfig.ch_width_orig);
/*
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 7d6bc5b..762ad64 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -10669,6 +10669,7 @@
else
smeConfig.csrConfig.channelBondingMode5GHz =
eCSR_INI_SINGLE_CHANNEL_CENTERED;
+ sap_config->sec_ch = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) && !defined(WITH_BACKPORTS)
sap_config->ch_width_orig = eHT_CHANNEL_WIDTH_20MHZ;
@@ -11336,6 +11337,7 @@
pConfig->vht_channel_width = pConfig->ch_width_orig;
sme_SelectCBMode(hHal, pConfig->SapHw_mode, pConfig->channel,
+ pConfig->sec_ch,
&pConfig->vht_channel_width, pConfig->ch_width_orig);
// ht_capab is not what the name conveys,this is used for protection bitmap
pConfig->ht_capab = iniConfig->apProtection;
@@ -15004,7 +15006,7 @@
/* This call decides required channel bonding mode */
sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal),
hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode),
- operationChannel,
+ operationChannel, 0,
&vht_channel_width,
vht_channel_width);
}
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index f9815f4..127e40b 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -14061,6 +14061,7 @@
sme_SelectCBMode(hHal,
pHddApCtx->sapConfig.SapHw_mode,
pHddApCtx->sapConfig.channel,
+ pHddApCtx->sapConfig.sec_ch,
&vht_channel_width, pHddApCtx->sapConfig.ch_width_orig);
#ifdef WLAN_FEATURE_MBSSID
wlan_sap_set_vht_ch_width(pHddApCtx->sapContext, vht_channel_width);
diff --git a/CORE/SAP/src/sapApiLinkCntl.c b/CORE/SAP/src/sapApiLinkCntl.c
index cb668f0..6ca4e7b 100644
--- a/CORE/SAP/src/sapApiLinkCntl.c
+++ b/CORE/SAP/src/sapApiLinkCntl.c
@@ -236,7 +236,8 @@
sme_SelectCBMode(halHandle,
psapContext->csrRoamProfile.phyMode,
- psapContext->channel, &psapContext->vht_channel_width,
+ psapContext->channel, psapContext->secondary_ch,
+ &psapContext->vht_channel_width,
psapContext->ch_width_orig);
#ifdef SOFTAP_CHANNEL_RANGE
if(psapContext->channelList != NULL)
@@ -283,16 +284,10 @@
sap_ctx->acs_cfg->ht_sec_ch = 0;
cb_mode = sme_SelectCBMode(hal, sap_ctx->csrRoamProfile.phyMode,
- channel, &sap_ctx->acs_cfg->ch_width,
+ channel, sec_ch,
+ &sap_ctx->acs_cfg->ch_width,
sap_ctx->acs_cfg->ch_width);
- if (channel >= 5 && channel <= 7 && sec_ch != 0) {
- if (sec_ch > sap_ctx->acs_cfg->pri_ch)
- cb_mode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
- else
- cb_mode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
- }
-
if (cb_mode == eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY) {
sap_ctx->acs_cfg->ht_sec_ch = sap_ctx->acs_cfg->pri_ch + 4;
} else if (cb_mode == eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY) {
@@ -1135,7 +1130,7 @@
{
sme_SelectCBMode(hHal, phyMode,
pMac->sap.SapDfsInfo.target_channel,
- &sapContext->vht_channel_width,
+ 0, &sapContext->vht_channel_width,
sapContext->ch_width_orig);
}
diff --git a/CORE/SAP/src/sapChSelect.c b/CORE/SAP/src/sapChSelect.c
index 0e833aa..95c37b5 100644
--- a/CORE/SAP/src/sapChSelect.c
+++ b/CORE/SAP/src/sapChSelect.c
@@ -2626,6 +2626,7 @@
else if (bestChNum ==14)
pSapCtx->acs_cfg->ht_sec_ch = 0;
}
+ pSapCtx->secondary_ch = pSapCtx->acs_cfg->ht_sec_ch;
}
// Free all the allocated memory
diff --git a/CORE/SAP/src/sapFsm.c b/CORE/SAP/src/sapFsm.c
index 7eddfb1..d1cacd8 100644
--- a/CORE/SAP/src/sapFsm.c
+++ b/CORE/SAP/src/sapFsm.c
@@ -1376,6 +1376,7 @@
pMac->sap.SapDfsInfo.orig_cbMode = sme_SelectCBMode(hHal,
sapContext->csrRoamProfile.phyMode,
sapContext->channel,
+ sapContext->secondary_ch,
&sapContext->vht_channel_width,
sapContext->ch_width_orig);
pMac->sap.SapDfsInfo.orig_cbMode = csrConvertCBIniValueToPhyCBState(
@@ -2154,7 +2155,7 @@
Else take whatever comes from configuartion*/
sapContext->channel = con_ch;
sme_SelectCBMode(hHal, sapContext->csrRoamProfile.phyMode,
- con_ch, &sapContext->vht_channel_width,
+ con_ch, 0, &sapContext->vht_channel_width,
sapContext->ch_width_orig);
}
#endif
@@ -3465,6 +3466,7 @@
cbMode = sme_SelectCBMode(hHal,
sapContext->csrRoamProfile.phyMode,
sapContext->channel,
+ sapContext->secondary_ch,
&sapContext->vht_channel_width,
sapContext->ch_width_orig);
@@ -3505,6 +3507,7 @@
sapContext->channel = ch;
sme_SelectCBMode(hHal, sapContext->csrRoamProfile.phyMode,
sapContext->channel,
+ sapContext->secondary_ch,
&sapContext->vht_channel_width,
sapContext->ch_width_orig);
}
@@ -3600,7 +3603,7 @@
{
sme_SelectCBMode(hHal, phyMode,
pMac->sap.SapDfsInfo.target_channel,
- &sapContext->vht_channel_width,
+ 0, &sapContext->vht_channel_width,
sapContext->ch_width_orig);
}
diff --git a/CORE/SAP/src/sapModule.c b/CORE/SAP/src/sapModule.c
index 4186d69..d746f6a 100644
--- a/CORE/SAP/src/sapModule.c
+++ b/CORE/SAP/src/sapModule.c
@@ -834,6 +834,7 @@
pSapCtx->pUsrContext = pUsrContext;
pSapCtx->enableOverLapCh = pConfig->enOverLapCh;
pSapCtx->acs_cfg = &pConfig->acs_cfg;
+ pSapCtx->secondary_ch = pConfig->sec_ch;
//Set the BSSID to your "self MAC Addr" read the mac address from Configuation ITEM received from HDD
pSapCtx->csrRoamProfile.BSSIDs.numOfBSSIDs = 1;
@@ -2839,7 +2840,7 @@
*/
cbMode = pMac->sap.SapDfsInfo.new_cbMode;
vhtChannelWidth = pMac->sap.SapDfsInfo.new_chanWidth;
- sme_SelectCBMode(hHal, phyMode, tArgetChannel, &vhtChannelWidth,
+ sme_SelectCBMode(hHal, phyMode, tArgetChannel, 0, &vhtChannelWidth,
pMac->sap.SapDfsInfo.new_chanWidth);
sapContext->csrRoamProfile.vht_channel_width = vhtChannelWidth;
sapContext->vht_channel_width = vhtChannelWidth;
@@ -2977,7 +2978,7 @@
vht_ch_width = pMac->sap.SapDfsInfo.new_chanWidth;
cbmode = sme_SelectCBMode(hHal,
sapContext->csrRoamProfile.phyMode,
- pMac->sap.SapDfsInfo.target_channel,
+ pMac->sap.SapDfsInfo.target_channel, 0,
&vht_ch_width, sapContext->ch_width_orig);
if (pMac->sap.SapDfsInfo.target_channel <= 14 ||
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
index 45c8256..5071805 100644
--- a/CORE/SME/inc/sme_Api.h
+++ b/CORE/SME/inc/sme_Api.h
@@ -3509,7 +3509,8 @@
* SME API to determine the channel bonding mode
*/
eIniChanBondState sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode,
- uint8_t channel, uint16_t *vht_channel_width,
+ uint8_t channel, uint8_t ht_sec_dh,
+ uint16_t *vht_channel_width,
uint16_t ch_width_orig);
#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index e5837c6..de0d174 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -12048,7 +12048,8 @@
* SME API to determine the channel bonding mode
*/
eIniChanBondState sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode,
- uint8_t channel, uint16_t *vht_channel_width,
+ uint8_t channel, uint8_t ht_sec_ch,
+ uint16_t *vht_channel_width,
uint16_t ch_width_orig)
{
tSmeConfigParams smeConfig;
@@ -12088,11 +12089,21 @@
smeConfig.csrConfig.channelBondingMode5GHz =
eCSR_INI_SINGLE_CHANNEL_CENTERED;
*vht_channel_width = eHT_CHANNEL_WIDTH_20MHZ;
- } else if (channel >= 1 && channel <= 5) {
+ } else if (channel >= 1 && channel < 5) {
smeConfig.csrConfig.channelBondingMode24GHz =
eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
*vht_channel_width = eHT_CHANNEL_WIDTH_40MHZ;
- } else if (channel >= 6 && channel <= 13) {
+ } else if (channel >= 5 && channel <= 9) {
+ if (0 != ht_sec_ch) {
+ if (ht_sec_ch > channel)
+ smeConfig.csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+ else
+ smeConfig.csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ }
+ *vht_channel_width = eHT_CHANNEL_WIDTH_40MHZ;
+ } else if (channel > 9 && channel <= 13) {
smeConfig.csrConfig.channelBondingMode24GHz =
eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
*vht_channel_width = eHT_CHANNEL_WIDTH_40MHZ;
@@ -12122,10 +12133,17 @@
smeConfig.csrConfig.channelBondingMode5GHz =
eCSR_INI_SINGLE_CHANNEL_CENTERED;
*vht_channel_width = eHT_CHANNEL_WIDTH_20MHZ;
- } else if (channel >= 1 && channel <= 5) {
+ } else if (channel >= 1 && channel < 5) {
smeConfig.csrConfig.channelBondingMode24GHz =
eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
- } else if (channel >= 6 && channel <= 13) {
+ } else if (channel >= 5 && channel <= 9) {
+ if (ht_sec_ch > channel)
+ smeConfig.csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
+ else
+ smeConfig.csrConfig.channelBondingMode24GHz =
+ eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
+ } else if (channel > 9 && channel <= 13) {
smeConfig.csrConfig.channelBondingMode24GHz =
eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
} else if (channel ==14) {