From 92610600619fd3afb2639c780a3faed5f7ec5ac1 Mon Sep 17 00:00:00 2001 From: Krishna Kumaar Natarajan Date: Wed, 21 Jan 2015 15:22:16 -0800 Subject: qcacld: Encode all the supported rates in TDLS frames Currently STA advertise supported rates based on the session capability. If STA is 11n capable, but if it is connected to 11b AP then it advertises only 11b rates. This change set fixes the issue by advertising all the rates supported by the STA. Change-Id: I14238984674bb856539a97aa4985132c7b397016 CRs-Fixed: 785539 --- CORE/MAC/inc/sirApi.h | 3 + CORE/MAC/src/include/parserApi.h | 4 ++ CORE/MAC/src/pe/lim/limProcessTdls.c | 32 ++++------ CORE/SYS/legacy/src/utils/src/parserApi.c | 98 +++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+), 21 deletions(-) diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h index 85e774223702..a721b6addf11 100644 --- a/CORE/MAC/inc/sirApi.h +++ b/CORE/MAC/inc/sirApi.h @@ -5653,4 +5653,7 @@ typedef struct sir_ocb_set_sched_request ocb_callback_t callback; } sir_ocb_set_sched_request_t; +/* Max number of rates allowed in Supported Rates IE */ +#define MAX_NUM_SUPPORTED_RATES (8) + #endif /* __SIR_API_H */ diff --git a/CORE/MAC/src/include/parserApi.h b/CORE/MAC/src/include/parserApi.h index 80d81fdcdf1e..bb1c729196ec 100644 --- a/CORE/MAC/src/include/parserApi.h +++ b/CORE/MAC/src/include/parserApi.h @@ -774,6 +774,10 @@ PopulateDot11fSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum, tDot11fIESuppRates *pDot11f,tpPESession); +tSirRetStatus +populate_dot11f_rates_tdls(tpAniSirGlobal p_mac, + tDot11fIESuppRates *p_supp_rates, + tDot11fIEExtSuppRates *p_ext_supp_rates); tSirRetStatus PopulateDot11fTPCReport(tpAniSirGlobal pMac, tDot11fIETPCReport *pDot11f, diff --git a/CORE/MAC/src/pe/lim/limProcessTdls.c b/CORE/MAC/src/pe/lim/limProcessTdls.c index 9e7da8240b6b..50c820692fc3 100644 --- a/CORE/MAC/src/pe/lim/limProcessTdls.c +++ b/CORE/MAC/src/pe/lim/limProcessTdls.c @@ -655,15 +655,13 @@ static tSirRetStatus limSendTdlsDisRspFrame(tpAniSirGlobal pMac, } swapBitField16(caps, ( tANI_U16* )&tdlsDisRsp.Capabilities ); - /* populate supported rate IE */ - PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, - &tdlsDisRsp.SuppRates, psessionEntry ); + /* populate supported rate and ext supported rate IE */ + if (eSIR_FAILURE == populate_dot11f_rates_tdls(pMac, &tdlsDisRsp.SuppRates, + &tdlsDisRsp.ExtSuppRates)) + limLog(pMac, LOGE, FL("could not populate supported data rates")); - /* Populate extended supported rates */ - PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, - &tdlsDisRsp.ExtSuppRates, psessionEntry ); - /* Populate extended supported rates */ + /* Populate extended capability IE */ PopulateDot11fTdlsExtCapability(pMac, psessionEntry, &tdlsDisRsp.ExtCap); wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfDot11Mode); @@ -909,13 +907,9 @@ tSirRetStatus limSendTdlsLinkSetupReqFrame(tpAniSirGlobal pMac, } swapBitField16(caps, ( tANI_U16* )&tdlsSetupReq.Capabilities ); - /* populate supported rate IE */ - PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, - &tdlsSetupReq.SuppRates, psessionEntry ); - - /* Populate extended supported rates */ - PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, - &tdlsSetupReq.ExtSuppRates, psessionEntry ); + /* populate supported rate and ext supported rate IE */ + populate_dot11f_rates_tdls(pMac, &tdlsSetupReq.SuppRates, + &tdlsSetupReq.ExtSuppRates); /* Populate extended supported rates */ PopulateDot11fTdlsExtCapability(pMac, psessionEntry, &tdlsSetupReq.ExtCap); @@ -1390,13 +1384,9 @@ static tSirRetStatus limSendTdlsSetupRspFrame(tpAniSirGlobal pMac, } swapBitField16(caps, ( tANI_U16* )&tdlsSetupRsp.Capabilities ); - /* ipopulate supported rate IE */ - PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, - &tdlsSetupRsp.SuppRates, psessionEntry ); - - /* Populate extended supported rates */ - PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, - &tdlsSetupRsp.ExtSuppRates, psessionEntry ); + /* populate supported rate and ext supported rate IE */ + populate_dot11f_rates_tdls(pMac, &tdlsSetupRsp.SuppRates, + &tdlsSetupRsp.ExtSuppRates); /* Populate extended supported rates */ PopulateDot11fTdlsExtCapability(pMac, psessionEntry, &tdlsSetupRsp.ExtCap); diff --git a/CORE/SYS/legacy/src/utils/src/parserApi.c b/CORE/SYS/legacy/src/utils/src/parserApi.c index bd2beb7f3d0f..aa32af0750b4 100644 --- a/CORE/SYS/legacy/src/utils/src/parserApi.c +++ b/CORE/SYS/legacy/src/utils/src/parserApi.c @@ -1631,6 +1631,104 @@ PopulateDot11fSuppRates(tpAniSirGlobal pMac, } // End PopulateDot11fSuppRates. +/** + * populate_dot11f_rates_tdls() - populate supported rates and + * extended supported rates IE. + * @p_mac gloabl - header. + * @p_supp_rates - pointer to supported rates IE + * @p_ext_supp_rates - pointer to extended supported rates IE + * + * This function populates the supported rates and extended supported + * rates IE based in the STA capability. If the number of rates + * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates + * IE is populated. + * + * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE + * on failure. + */ + +tSirRetStatus +populate_dot11f_rates_tdls(tpAniSirGlobal p_mac, + tDot11fIESuppRates *p_supp_rates, + tDot11fIEExtSuppRates *p_ext_supp_rates) +{ + tSirMacRateSet temp_rateset; + tSirMacRateSet temp_rateset2; + uint32_t val, i; + uint32_t self_dot11mode = 0; + + wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode); + + /** + * Include 11b rates only when the device configured in + * auto, 11a/b/g or 11b_only + */ + if ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) || + (self_dot11mode == WNI_CFG_DOT11_MODE_11A) || + (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) || + (self_dot11mode == WNI_CFG_DOT11_MODE_11N) || + (self_dot11mode == WNI_CFG_DOT11_MODE_11G) || + (self_dot11mode == WNI_CFG_DOT11_MODE_11B) ) { + val = WNI_CFG_SUPPORTED_RATES_11B_LEN; + wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B, + (tANI_U8 *)&temp_rateset.rate, &val); + temp_rateset.numRates = (tANI_U8) val; + } + else { + temp_rateset.numRates = 0; + } + + /* Include 11a rates when the device configured in non-11b mode */ + if (!IS_DOT11_MODE_11B(self_dot11mode)) { + val = WNI_CFG_SUPPORTED_RATES_11A_LEN; + wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A, + (tANI_U8 *)&temp_rateset2.rate, &val); + temp_rateset2.numRates = (tANI_U8) val; + } else { + temp_rateset2.numRates = 0; + } + + if ((temp_rateset.numRates + temp_rateset2.numRates) > + SIR_MAC_MAX_NUMBER_OF_RATES) { + limLog(p_mac, LOGP, FL("more than %d rates in CFG"), + SIR_MAC_MAX_NUMBER_OF_RATES); + return eSIR_FAILURE; + } + + /** + * copy all rates in temp_rateset, + * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max + */ + for (i = 0; i < temp_rateset2.numRates; i++) + temp_rateset.rate[i + temp_rateset.numRates] = + temp_rateset2.rate[i]; + + temp_rateset.numRates += temp_rateset2.numRates; + + if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES) { + p_supp_rates->num_rates = temp_rateset.numRates; + vos_mem_copy(p_supp_rates->rates, temp_rateset.rate, + p_supp_rates->num_rates); + p_supp_rates->present = 1; + } else { /* Populate extended capability as well */ + p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES; + vos_mem_copy(p_supp_rates->rates, temp_rateset.rate, + p_supp_rates->num_rates); + p_supp_rates->present = 1; + + p_ext_supp_rates->num_rates = temp_rateset.numRates - + MAX_NUM_SUPPORTED_RATES; + vos_mem_copy(p_ext_supp_rates->rates, + (tANI_U8 *)temp_rateset.rate + + MAX_NUM_SUPPORTED_RATES, + p_ext_supp_rates->num_rates); + p_ext_supp_rates->present = 1; + } + + return eSIR_SUCCESS; + +} /* End populate_dot11f_rates_tdls */ + tSirRetStatus PopulateDot11fTPCReport(tpAniSirGlobal pMac, tDot11fIETPCReport *pDot11f, -- cgit v1.2.3