summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Singh <absingh@codeaurora.org>2018-08-28 13:54:29 +0530
committernshrivas <nshrivas@codeaurora.org>2018-08-30 00:08:12 -0700
commit6818b6f43532cddb36853e1dbd842ca05f1ce2cd (patch)
treefde34336ea9fdf9fddb505854a911dcfb6e54f13
parenta70a99674e85554b2b8c0528348923d2e48526b8 (diff)
qcacld-3.0: Validate cbmode and bw provided by AP in HTinfo IE
Driver checks if 40 Mhz is supported for the channel but doesn't validate if the cbmode provided by AP is valid. Invalid cb mode provided by AP can lead to failure. Add check to validate cbmode and bandwidth from AP in htinfo IE. Change-Id: I3d2da7a8e3045594baf201732dd80a82bd88e16c CRs-Fixed: 2303267
-rw-r--r--core/sme/inc/csr_api.h2
-rw-r--r--core/sme/src/csr/csr_api_roam.c30
2 files changed, 18 insertions, 14 deletions
diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h
index f1439dc7f3ad..af07c4bc6871 100644
--- a/core/sme/inc/csr_api.h
+++ b/core/sme/inc/csr_api.h
@@ -779,6 +779,8 @@ typedef enum {
*/
#define CSR_CB_CHANNEL_GAP 4
#define CSR_CB_CENTER_CHANNEL_OFFSET 2
+#define CSR_SEC_CHANNEL_OFFSET 4
+
/* WEP keysize (in bits) */
typedef enum {
diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c
index 3888513458a0..c80a4bf1f88f 100644
--- a/core/sme/src/csr/csr_api_roam.c
+++ b/core/sme/src/csr/csr_api_roam.c
@@ -13641,15 +13641,15 @@ bool csr_roam_is_channel_valid(tpAniSirGlobal pMac, uint8_t channel)
/* This function check and validate whether the NIC can do CB (40MHz) */
static ePhyChanBondState csr_get_cb_mode_from_ies(tpAniSirGlobal pMac,
- uint8_t primaryChn,
+ uint8_t chan,
tDot11fBeaconIEs *pIes)
{
ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED;
- uint8_t centerChn;
+ uint8_t sec_ch = 0;
uint32_t ChannelBondingMode;
struct ch_params_s ch_params = {0};
- if (CDS_IS_CHANNEL_24GHZ(primaryChn)) {
+ if (CDS_IS_CHANNEL_24GHZ(chan)) {
ChannelBondingMode =
pMac->roam.configParam.channelBondingMode24GHz;
} else {
@@ -13689,7 +13689,7 @@ static ePhyChanBondState csr_get_cb_mode_from_ies(tpAniSirGlobal pMac,
* value of supported channel width and recommended tx width as per
* standard
*/
- sme_debug("scws %u rtws %u sco %u",
+ sme_debug("chan %d scws %u rtws %u sco %u", chan,
pIes->HTCaps.supportedChannelWidthSet,
pIes->HTInfo.recommendedTxWidthSet,
pIes->HTInfo.secondaryChannelOffset);
@@ -13701,26 +13701,28 @@ static ePhyChanBondState csr_get_cb_mode_from_ies(tpAniSirGlobal pMac,
switch (eRet) {
case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
- centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET;
+ sec_ch = chan + CSR_SEC_CHANNEL_OFFSET;
break;
case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
- centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET;
+ sec_ch = chan - CSR_SEC_CHANNEL_OFFSET;
break;
- case PHY_SINGLE_CHANNEL_CENTERED:
default:
- centerChn = primaryChn;
break;
}
- if (PHY_SINGLE_CHANNEL_CENTERED != eRet) {
- ch_params.ch_width = CH_WIDTH_MAX;
- cds_set_channel_params(primaryChn, 0, &ch_params);
- if (ch_params.ch_width == CH_WIDTH_20MHZ) {
- sme_err("40Mhz not supported for channel %d, continue with 20Mhz",
- primaryChn);
+ if (eRet != PHY_SINGLE_CHANNEL_CENTERED) {
+ ch_params.ch_width = CH_WIDTH_40MHZ;
+ cds_set_channel_params(chan, sec_ch, &ch_params);
+ if (ch_params.ch_width == CH_WIDTH_20MHZ ||
+ ch_params.sec_ch_offset != eRet) {
+ sme_err("chan %d :: Supported HT BW %d and cbmode %d, APs HT BW %d and cbmode %d, so switch to 20Mhz",
+ chan, ch_params.ch_width,
+ ch_params.sec_ch_offset,
+ pIes->HTInfo.recommendedTxWidthSet, eRet);
eRet = PHY_SINGLE_CHANNEL_CENTERED;
}
}
+
return eRet;
}