Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Paul Zhang | c3fc0a8 | 2018-01-09 16:38:20 +0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /**========================================================================= |
| 20 | |
| 21 | \brief implementation for PE 11r VoWiFi FT Protocol |
| 22 | |
| 23 | ========================================================================*/ |
| 24 | |
| 25 | /* $Header$ */ |
| 26 | |
| 27 | /*-------------------------------------------------------------------------- |
| 28 | Include Files |
| 29 | ------------------------------------------------------------------------*/ |
| 30 | #include <lim_send_messages.h> |
| 31 | #include <lim_types.h> |
| 32 | #include <lim_ft.h> |
| 33 | #include <lim_ft_defs.h> |
| 34 | #include <lim_utils.h> |
| 35 | #include <lim_prop_exts_utils.h> |
| 36 | #include <lim_assoc_utils.h> |
| 37 | #include <lim_session.h> |
| 38 | #include <lim_admit_control.h> |
| 39 | #include "wmm_apsd.h" |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 40 | #include "wma.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 41 | |
| 42 | extern void lim_send_set_sta_key_req(tpAniSirGlobal pMac, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 43 | tLimMlmSetKeysReq * pMlmSetKeysReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 44 | uint16_t staIdx, |
| 45 | uint8_t defWEPIdx, |
| 46 | tpPESession sessionEntry, bool sendRsp); |
| 47 | |
| 48 | /*-------------------------------------------------------------------------- |
| 49 | Initialize the FT variables. |
| 50 | ------------------------------------------------------------------------*/ |
| 51 | void lim_ft_open(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 52 | { |
| 53 | if (psessionEntry) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 54 | qdf_mem_set(&psessionEntry->ftPEContext, sizeof(tftPEContext), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 55 | 0); |
| 56 | } |
| 57 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | void lim_ft_cleanup_all_ft_sessions(tpAniSirGlobal pMac) |
| 59 | { |
| 60 | /* Wrapper function to cleanup all FT sessions */ |
| 61 | int i; |
| 62 | |
| 63 | for (i = 0; i < pMac->lim.maxBssId; i++) { |
| 64 | if (true == pMac->lim.gpSession[i].valid) { |
| 65 | /* The session is valid, may have FT data */ |
| 66 | lim_ft_cleanup(pMac, &pMac->lim.gpSession[i]); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | void lim_ft_cleanup(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 72 | { |
| 73 | if (NULL == psessionEntry) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 74 | pe_err("psessionEntry is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 75 | return; |
| 76 | } |
| 77 | |
| 78 | /* Nothing to be done if the session is not in STA mode */ |
| 79 | if (!LIM_IS_STA_ROLE(psessionEntry)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 80 | pe_err("psessionEntry is not in STA mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 81 | return; |
| 82 | } |
| 83 | |
| 84 | if (NULL != psessionEntry->ftPEContext.pFTPreAuthReq) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 85 | pe_debug("Freeing pFTPreAuthReq: %pK", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 86 | psessionEntry->ftPEContext.pFTPreAuthReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 87 | if (NULL != |
| 88 | psessionEntry->ftPEContext.pFTPreAuthReq-> |
| 89 | pbssDescription) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 90 | qdf_mem_free(psessionEntry->ftPEContext.pFTPreAuthReq-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 91 | pbssDescription); |
| 92 | psessionEntry->ftPEContext.pFTPreAuthReq-> |
| 93 | pbssDescription = NULL; |
| 94 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 95 | qdf_mem_free(psessionEntry->ftPEContext.pFTPreAuthReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 96 | psessionEntry->ftPEContext.pFTPreAuthReq = NULL; |
| 97 | } |
| 98 | |
| 99 | if (psessionEntry->ftPEContext.pAddBssReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 100 | qdf_mem_free(psessionEntry->ftPEContext.pAddBssReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 101 | psessionEntry->ftPEContext.pAddBssReq = NULL; |
| 102 | } |
| 103 | |
| 104 | if (psessionEntry->ftPEContext.pAddStaReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 105 | qdf_mem_free(psessionEntry->ftPEContext.pAddStaReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 106 | psessionEntry->ftPEContext.pAddStaReq = NULL; |
| 107 | } |
| 108 | |
| 109 | /* The session is being deleted, cleanup the contents */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 110 | qdf_mem_set(&psessionEntry->ftPEContext, sizeof(tftPEContext), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 111 | } |
| 112 | |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 113 | #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 114 | /*------------------------------------------------------------------ |
| 115 | * |
| 116 | * Create the new Add Bss Req to the new AP. |
| 117 | * This will be used when we are ready to FT to the new AP. |
| 118 | * The newly created ft Session entry is passed to this function |
| 119 | * |
| 120 | *------------------------------------------------------------------*/ |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 121 | void lim_ft_prepare_add_bss_req(tpAniSirGlobal pMac, |
| 122 | uint8_t updateEntry, tpPESession pftSessionEntry, |
| 123 | tpSirBssDescription bssDescription) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 124 | { |
| 125 | tpAddBssParams pAddBssParams = NULL; |
| 126 | tAddStaParams *sta_ctx; |
| 127 | uint8_t chanWidthSupp = 0; |
| 128 | tSchBeaconStruct *pBeaconStruct; |
| 129 | |
| 130 | /* Nothing to be done if the session is not in STA mode */ |
| 131 | if (!LIM_IS_STA_ROLE(pftSessionEntry)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 132 | pe_err("psessionEntry is not in STA mode"); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 133 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 134 | } |
| 135 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 136 | pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 137 | if (NULL == pBeaconStruct) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 138 | pe_err("Unable to allocate memory for creating ADD_BSS"); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 139 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | } |
| 141 | /* Package SIR_HAL_ADD_BSS_REQ message parameters */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 142 | pAddBssParams = qdf_mem_malloc(sizeof(tAddBssParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 143 | if (NULL == pAddBssParams) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 144 | qdf_mem_free(pBeaconStruct); |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 145 | pe_err("Unable to allocate memory for creating ADD_BSS"); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 146 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 147 | } |
| 148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | lim_extract_ap_capabilities(pMac, (uint8_t *) bssDescription->ieFields, |
| 150 | lim_get_ielen_from_bss_description(bssDescription), |
| 151 | pBeaconStruct); |
| 152 | |
| 153 | if (pMac->lim.gLimProtectionControl != |
| 154 | WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 155 | lim_decide_sta_protection_on_assoc(pMac, pBeaconStruct, |
| 156 | pftSessionEntry); |
| 157 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 158 | qdf_mem_copy(pAddBssParams->bssId, bssDescription->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | sizeof(tSirMacAddr)); |
| 160 | |
| 161 | /* Fill in tAddBssParams selfMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 162 | qdf_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 163 | sizeof(tSirMacAddr)); |
| 164 | |
| 165 | pAddBssParams->bssType = pftSessionEntry->bssType; |
| 166 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA; |
| 167 | |
| 168 | pAddBssParams->beaconInterval = bssDescription->beaconInterval; |
| 169 | |
| 170 | pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod; |
| 171 | pAddBssParams->updateBss = updateEntry; |
| 172 | |
| 173 | pAddBssParams->reassocReq = true; |
| 174 | |
| 175 | pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount; |
| 176 | pAddBssParams->cfParamSet.cfpPeriod = |
| 177 | pBeaconStruct->cfParamSet.cfpPeriod; |
| 178 | pAddBssParams->cfParamSet.cfpMaxDuration = |
| 179 | pBeaconStruct->cfParamSet.cfpMaxDuration; |
| 180 | pAddBssParams->cfParamSet.cfpDurRemaining = |
| 181 | pBeaconStruct->cfParamSet.cfpDurRemaining; |
| 182 | |
| 183 | pAddBssParams->rateSet.numRates = |
| 184 | pBeaconStruct->supportedRates.numRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 185 | qdf_mem_copy(pAddBssParams->rateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 186 | pBeaconStruct->supportedRates.rate, |
| 187 | pBeaconStruct->supportedRates.numRates); |
| 188 | |
| 189 | pAddBssParams->nwType = bssDescription->nwType; |
| 190 | |
| 191 | pAddBssParams->shortSlotTimeSupported = |
| 192 | (uint8_t) pBeaconStruct->capabilityInfo.shortSlotTime; |
| 193 | pAddBssParams->llaCoexist = |
| 194 | (uint8_t) pftSessionEntry->beaconParams.llaCoexist; |
| 195 | pAddBssParams->llbCoexist = |
| 196 | (uint8_t) pftSessionEntry->beaconParams.llbCoexist; |
| 197 | pAddBssParams->llgCoexist = |
| 198 | (uint8_t) pftSessionEntry->beaconParams.llgCoexist; |
| 199 | pAddBssParams->ht20Coexist = |
| 200 | (uint8_t) pftSessionEntry->beaconParams.ht20Coexist; |
| 201 | #ifdef WLAN_FEATURE_11W |
| 202 | pAddBssParams->rmfEnabled = pftSessionEntry->limRmfEnabled; |
| 203 | #endif |
| 204 | |
| 205 | /* Use the advertised capabilities from the received beacon/PR */ |
| 206 | if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && |
| 207 | (pBeaconStruct->HTCaps.present)) { |
| 208 | pAddBssParams->htCapable = pBeaconStruct->HTCaps.present; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 209 | qdf_mem_copy(&pAddBssParams->staContext.capab_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 210 | &pBeaconStruct->capabilityInfo, |
| 211 | sizeof(pAddBssParams->staContext.capab_info)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 212 | qdf_mem_copy(&pAddBssParams->staContext.ht_caps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 213 | (uint8_t *) &pBeaconStruct->HTCaps + |
| 214 | sizeof(uint8_t), |
| 215 | sizeof(pAddBssParams->staContext.ht_caps)); |
| 216 | |
| 217 | if (pBeaconStruct->HTInfo.present) { |
| 218 | pAddBssParams->htOperMode = |
| 219 | (tSirMacHTOperatingMode) pBeaconStruct->HTInfo. |
| 220 | opMode; |
| 221 | pAddBssParams->dualCTSProtection = |
| 222 | (uint8_t) pBeaconStruct->HTInfo.dualCTSProtection; |
| 223 | |
| 224 | chanWidthSupp = lim_get_ht_capability(pMac, |
| 225 | eHT_SUPPORTED_CHANNEL_WIDTH_SET, |
| 226 | pftSessionEntry); |
| 227 | if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && |
| 228 | (chanWidthSupp)) { |
| 229 | pAddBssParams->ch_width = (uint8_t) |
| 230 | pBeaconStruct->HTInfo.recommendedTxWidthSet; |
| 231 | if (pBeaconStruct->HTInfo.secondaryChannelOffset == |
| 232 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 233 | pAddBssParams->ch_center_freq_seg0 = |
| 234 | bssDescription->channelId + 2; |
| 235 | else if (pBeaconStruct->HTInfo.secondaryChannelOffset == |
| 236 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 237 | pAddBssParams->ch_center_freq_seg0 = |
| 238 | bssDescription->channelId - 2; |
| 239 | } else { |
| 240 | pAddBssParams->ch_width = CH_WIDTH_20MHZ; |
| 241 | pAddBssParams->ch_center_freq_seg0 = 0; |
| 242 | } |
| 243 | pAddBssParams->llnNonGFCoexist = |
| 244 | (uint8_t) pBeaconStruct->HTInfo.nonGFDevicesPresent; |
| 245 | pAddBssParams->fLsigTXOPProtectionFullSupport = |
| 246 | (uint8_t) pBeaconStruct->HTInfo. |
| 247 | lsigTXOPProtectionFullSupport; |
| 248 | pAddBssParams->fRIFSMode = |
| 249 | pBeaconStruct->HTInfo.rifsMode; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | pAddBssParams->currentOperChannel = bssDescription->channelId; |
| 254 | pftSessionEntry->htSecondaryChannelOffset = |
| 255 | pBeaconStruct->HTInfo.secondaryChannelOffset; |
| 256 | sta_ctx = &pAddBssParams->staContext; |
| 257 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | if (pftSessionEntry->vhtCapability && |
| 259 | pftSessionEntry->vhtCapabilityPresentInBeacon) { |
| 260 | pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present; |
| 261 | if (pBeaconStruct->VHTOperation.chanWidth && chanWidthSupp) { |
| 262 | pAddBssParams->ch_width = |
| 263 | pBeaconStruct->VHTOperation.chanWidth + 1; |
| 264 | pAddBssParams->ch_center_freq_seg0 = |
| 265 | pBeaconStruct->VHTOperation.chanCenterFreqSeg1; |
| 266 | pAddBssParams->ch_center_freq_seg1 = |
| 267 | pBeaconStruct->VHTOperation.chanCenterFreqSeg2; |
| 268 | } |
| 269 | pAddBssParams->staContext.vht_caps = |
| 270 | ((pBeaconStruct->VHTCaps.maxMPDULen << |
| 271 | SIR_MAC_VHT_CAP_MAX_MPDU_LEN) | |
| 272 | (pBeaconStruct->VHTCaps.supportedChannelWidthSet << |
| 273 | SIR_MAC_VHT_CAP_SUPP_CH_WIDTH_SET) | |
| 274 | (pBeaconStruct->VHTCaps.ldpcCodingCap << |
| 275 | SIR_MAC_VHT_CAP_LDPC_CODING_CAP) | |
| 276 | (pBeaconStruct->VHTCaps.shortGI80MHz << |
| 277 | SIR_MAC_VHT_CAP_SHORTGI_80MHZ) | |
| 278 | (pBeaconStruct->VHTCaps.shortGI160and80plus80MHz << |
| 279 | SIR_MAC_VHT_CAP_SHORTGI_160_80_80MHZ) | |
| 280 | (pBeaconStruct->VHTCaps.txSTBC << |
| 281 | SIR_MAC_VHT_CAP_TXSTBC) | |
| 282 | (pBeaconStruct->VHTCaps.rxSTBC << |
| 283 | SIR_MAC_VHT_CAP_RXSTBC) | |
| 284 | (pBeaconStruct->VHTCaps.suBeamFormerCap << |
| 285 | SIR_MAC_VHT_CAP_SU_BEAMFORMER_CAP) | |
| 286 | (pBeaconStruct->VHTCaps.suBeamformeeCap << |
| 287 | SIR_MAC_VHT_CAP_SU_BEAMFORMEE_CAP) | |
| 288 | (pBeaconStruct->VHTCaps.csnofBeamformerAntSup << |
| 289 | SIR_MAC_VHT_CAP_CSN_BEAMORMER_ANT_SUP) | |
| 290 | (pBeaconStruct->VHTCaps.numSoundingDim << |
| 291 | SIR_MAC_VHT_CAP_NUM_SOUNDING_DIM) | |
| 292 | (pBeaconStruct->VHTCaps.muBeamformerCap << |
| 293 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMER_CAP) | |
| 294 | (pBeaconStruct->VHTCaps.muBeamformeeCap << |
| 295 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMEE_CAP) | |
| 296 | (pBeaconStruct->VHTCaps.vhtTXOPPS << |
| 297 | SIR_MAC_VHT_CAP_TXOPPS) | |
| 298 | (pBeaconStruct->VHTCaps.htcVHTCap << |
| 299 | SIR_MAC_VHT_CAP_HTC_CAP) | |
| 300 | (pBeaconStruct->VHTCaps.maxAMPDULenExp << |
| 301 | SIR_MAC_VHT_CAP_MAX_AMDU_LEN_EXPO) | |
| 302 | (pBeaconStruct->VHTCaps.vhtLinkAdaptCap << |
| 303 | SIR_MAC_VHT_CAP_LINK_ADAPT_CAP) | |
| 304 | (pBeaconStruct->VHTCaps.rxAntPattern << |
| 305 | SIR_MAC_VHT_CAP_RX_ANTENNA_PATTERN) | |
| 306 | (pBeaconStruct->VHTCaps.txAntPattern << |
| 307 | SIR_MAC_VHT_CAP_TX_ANTENNA_PATTERN) | |
| 308 | (pBeaconStruct->VHTCaps.reserved1 << |
| 309 | SIR_MAC_VHT_CAP_RESERVED2)); |
| 310 | } else { |
| 311 | pAddBssParams->vhtCapable = 0; |
| 312 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 314 | pe_debug("SIR_HAL_ADD_BSS_REQ with channel: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 315 | pAddBssParams->currentOperChannel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 316 | |
| 317 | /* Populate the STA-related parameters here */ |
| 318 | /* Note that the STA here refers to the AP */ |
| 319 | { |
| 320 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; |
| 321 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 322 | qdf_mem_copy(pAddBssParams->staContext.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | bssDescription->bssId, sizeof(tSirMacAddr)); |
| 324 | pAddBssParams->staContext.listenInterval = |
| 325 | bssDescription->beaconInterval; |
| 326 | |
| 327 | pAddBssParams->staContext.assocId = 0; |
| 328 | pAddBssParams->staContext.uAPSD = 0; |
| 329 | pAddBssParams->staContext.maxSPLen = 0; |
| 330 | pAddBssParams->staContext.shortPreambleSupported = |
| 331 | (uint8_t) pBeaconStruct->capabilityInfo.shortPreamble; |
| 332 | pAddBssParams->staContext.updateSta = updateEntry; |
| 333 | pAddBssParams->staContext.encryptType = |
| 334 | pftSessionEntry->encryptType; |
| 335 | #ifdef WLAN_FEATURE_11W |
| 336 | pAddBssParams->staContext.rmfEnabled = |
| 337 | pftSessionEntry->limRmfEnabled; |
| 338 | #endif |
| 339 | |
| 340 | if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && |
| 341 | (pBeaconStruct->HTCaps.present)) { |
| 342 | pAddBssParams->staContext.us32MaxAmpduDuration = 0; |
| 343 | pAddBssParams->staContext.htCapable = 1; |
| 344 | pAddBssParams->staContext.greenFieldCapable = |
| 345 | (uint8_t) pBeaconStruct->HTCaps.greenField; |
| 346 | pAddBssParams->staContext.lsigTxopProtection = |
| 347 | (uint8_t) pBeaconStruct->HTCaps.lsigTXOPProtection; |
| 348 | if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && |
| 349 | (chanWidthSupp)) { |
| 350 | pAddBssParams->staContext.ch_width = (uint8_t) |
| 351 | pBeaconStruct->HTInfo.recommendedTxWidthSet; |
| 352 | } else { |
| 353 | pAddBssParams->staContext.ch_width = |
| 354 | CH_WIDTH_20MHZ; |
| 355 | } |
| 356 | if (pftSessionEntry->vhtCapability && |
| 357 | IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)) { |
| 358 | pAddBssParams->staContext.vhtCapable = 1; |
| 359 | if ((pBeaconStruct->VHTCaps.suBeamFormerCap || |
| 360 | pBeaconStruct->VHTCaps.muBeamformerCap) && |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 361 | pftSessionEntry->vht_config.su_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | sta_ctx->vhtTxBFCapable |
| 363 | = 1; |
| 364 | if (pBeaconStruct->VHTCaps.suBeamformeeCap && |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 365 | pftSessionEntry->vht_config.su_beam_former) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 366 | sta_ctx->enable_su_tx_bformer = 1; |
| 367 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 368 | if (lim_is_session_he_capable(pftSessionEntry) && |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 369 | pBeaconStruct->he_cap.present) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 370 | lim_intersect_ap_he_caps(pftSessionEntry, |
| 371 | pAddBssParams, pBeaconStruct, NULL); |
| 372 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 373 | if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && |
| 374 | (chanWidthSupp)) { |
| 375 | sta_ctx->ch_width = (uint8_t) |
| 376 | pBeaconStruct->HTInfo.recommendedTxWidthSet; |
| 377 | if (pAddBssParams->staContext.vhtCapable && |
| 378 | pBeaconStruct->VHTOperation.chanWidth) |
| 379 | sta_ctx->ch_width = |
| 380 | pBeaconStruct->VHTOperation.chanWidth |
| 381 | + 1; |
| 382 | } else { |
| 383 | pAddBssParams->staContext.ch_width = |
| 384 | CH_WIDTH_20MHZ; |
| 385 | } |
| 386 | pAddBssParams->staContext.mimoPS = |
| 387 | (tSirMacHTMIMOPowerSaveState) pBeaconStruct->HTCaps. |
| 388 | mimoPowerSave; |
| 389 | pAddBssParams->staContext.maxAmsduSize = |
| 390 | (uint8_t) pBeaconStruct->HTCaps.maximalAMSDUsize; |
| 391 | pAddBssParams->staContext.maxAmpduDensity = |
| 392 | pBeaconStruct->HTCaps.mpduDensity; |
| 393 | pAddBssParams->staContext.fDsssCckMode40Mhz = |
| 394 | (uint8_t) pBeaconStruct->HTCaps.dsssCckMode40MHz; |
| 395 | pAddBssParams->staContext.fShortGI20Mhz = |
| 396 | (uint8_t) pBeaconStruct->HTCaps.shortGI20MHz; |
| 397 | pAddBssParams->staContext.fShortGI40Mhz = |
| 398 | (uint8_t) pBeaconStruct->HTCaps.shortGI40MHz; |
| 399 | pAddBssParams->staContext.maxAmpduSize = |
| 400 | pBeaconStruct->HTCaps.maxRxAMPDUFactor; |
| 401 | |
| 402 | if (pBeaconStruct->HTInfo.present) |
| 403 | pAddBssParams->staContext.rifsMode = |
| 404 | pBeaconStruct->HTInfo.rifsMode; |
| 405 | } |
| 406 | |
| 407 | if ((pftSessionEntry->limWmeEnabled |
| 408 | && pBeaconStruct->wmeEdcaPresent) |
| 409 | || (pftSessionEntry->limQosEnabled |
| 410 | && pBeaconStruct->edcaPresent)) |
| 411 | pAddBssParams->staContext.wmmEnabled = 1; |
| 412 | else |
| 413 | pAddBssParams->staContext.wmmEnabled = 0; |
| 414 | |
| 415 | pAddBssParams->staContext.wpa_rsn = pBeaconStruct->rsnPresent; |
| 416 | /* For OSEN Connection AP does not advertise RSN or WPA IE |
| 417 | * so from the IEs we get from supplicant we get this info |
| 418 | * so for FW to transmit EAPOL message 4 we shall set |
| 419 | * wpa_rsn |
| 420 | */ |
| 421 | pAddBssParams->staContext.wpa_rsn |= |
| 422 | (pBeaconStruct->wpaPresent << 1); |
| 423 | if ((!pAddBssParams->staContext.wpa_rsn) |
| 424 | && (pftSessionEntry->isOSENConnection)) |
| 425 | pAddBssParams->staContext.wpa_rsn = 1; |
| 426 | /* Update the rates */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | lim_populate_peer_rate_set(pMac, |
| 428 | &pAddBssParams->staContext. |
| 429 | supportedRates, |
| 430 | pBeaconStruct->HTCaps.supportedMCSSet, |
| 431 | false, pftSessionEntry, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 432 | &pBeaconStruct->VHTCaps, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 433 | &pBeaconStruct->he_cap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 434 | } |
| 435 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 436 | pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 437 | |
| 438 | #ifdef WLAN_FEATURE_11W |
| 439 | if (pftSessionEntry->limRmfEnabled) { |
| 440 | pAddBssParams->rmfEnabled = 1; |
| 441 | pAddBssParams->staContext.rmfEnabled = 1; |
| 442 | } |
| 443 | #endif |
| 444 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 445 | pAddBssParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 446 | pAddBssParams->respReqd = true; |
| 447 | |
| 448 | pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId; |
| 449 | pAddBssParams->staContext.smesessionId = pftSessionEntry->smeSessionId; |
| 450 | pAddBssParams->sessionId = pftSessionEntry->peSessionId; |
| 451 | |
| 452 | /* Set a new state for MLME */ |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 453 | if (!lim_is_roam_synch_in_progress(pftSessionEntry)) { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 454 | pftSessionEntry->limMlmState = |
| 455 | eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE; |
| 456 | MTRACE(mac_trace |
| 457 | (pMac, TRACE_CODE_MLM_STATE, |
| 458 | pftSessionEntry->peSessionId, |
| 459 | eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE)); |
| 460 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 461 | pAddBssParams->halPersona = (uint8_t) pftSessionEntry->pePersona; |
| 462 | |
| 463 | pftSessionEntry->ftPEContext.pAddBssReq = pAddBssParams; |
| 464 | |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 465 | pe_debug("Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 466 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 467 | qdf_mem_free(pBeaconStruct); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 468 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 469 | } |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 470 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 471 | |
Paul Zhang | c3fc0a8 | 2018-01-09 16:38:20 +0800 | [diff] [blame] | 472 | #if defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Krunal Soni | 4bfecf6 | 2017-06-05 15:26:35 -0700 | [diff] [blame] | 473 | /** |
| 474 | * lim_fill_dot11mode() - to fill 802.11 mode in FT session |
| 475 | * @mac_ctx: pointer to mac ctx |
| 476 | * @pftSessionEntry: FT session |
| 477 | * @psessionEntry: PE session |
| 478 | * |
| 479 | * This API fills FT session's dot11mode either from pe session or |
| 480 | * from CFG depending on the condition. |
| 481 | * |
| 482 | * Return: none |
| 483 | */ |
| 484 | static void lim_fill_dot11mode(tpAniSirGlobal mac_ctx, |
| 485 | tpPESession pftSessionEntry, tpPESession psessionEntry) |
| 486 | { |
| 487 | uint32_t self_dot11_mode; |
| 488 | |
| 489 | if (psessionEntry->ftPEContext.pFTPreAuthReq && |
| 490 | !mac_ctx->roam.configParam.isRoamOffloadEnabled) { |
| 491 | pftSessionEntry->dot11mode = |
| 492 | psessionEntry->ftPEContext.pFTPreAuthReq->dot11mode; |
| 493 | } else { |
| 494 | wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &self_dot11_mode); |
| 495 | pe_debug("selfDot11Mode: %d", self_dot11_mode); |
| 496 | pftSessionEntry->dot11mode = self_dot11_mode; |
| 497 | } |
| 498 | } |
Paul Zhang | c3fc0a8 | 2018-01-09 16:38:20 +0800 | [diff] [blame] | 499 | #elif defined(WLAN_FEATURE_HOST_ROAM) |
Krunal Soni | 4bfecf6 | 2017-06-05 15:26:35 -0700 | [diff] [blame] | 500 | /** |
| 501 | * lim_fill_dot11mode() - to fill 802.11 mode in FT session |
| 502 | * @mac_ctx: pointer to mac ctx |
| 503 | * @pftSessionEntry: FT session |
| 504 | * @psessionEntry: PE session |
| 505 | * |
| 506 | * This API fills FT session's dot11mode either from pe session. |
| 507 | * |
| 508 | * Return: none |
| 509 | */ |
| 510 | static void lim_fill_dot11mode(tpAniSirGlobal mac_ctx, |
| 511 | tpPESession pftSessionEntry, tpPESession psessionEntry) |
| 512 | { |
| 513 | pftSessionEntry->dot11mode = |
| 514 | psessionEntry->ftPEContext.pFTPreAuthReq->dot11mode; |
| 515 | } |
| 516 | #endif |
| 517 | |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 518 | #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 519 | /*------------------------------------------------------------------ |
| 520 | * |
| 521 | * Setup the new session for the pre-auth AP. |
| 522 | * Return the newly created session entry. |
| 523 | * |
| 524 | *------------------------------------------------------------------*/ |
| 525 | void lim_fill_ft_session(tpAniSirGlobal pMac, |
| 526 | tpSirBssDescription pbssDescription, |
| 527 | tpPESession pftSessionEntry, tpPESession psessionEntry) |
| 528 | { |
| 529 | uint8_t currentBssUapsd; |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 530 | int8_t localPowerConstraint; |
| 531 | int8_t regMax; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 532 | tSchBeaconStruct *pBeaconStruct; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 533 | ePhyChanBondState cbEnabledMode; |
| 534 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 535 | pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 536 | if (NULL == pBeaconStruct) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 537 | pe_err("No memory for creating lim_fill_ft_session"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 538 | return; |
| 539 | } |
| 540 | |
Deepak Dhamdhere | 26bda45 | 2016-01-09 22:54:48 -0800 | [diff] [blame] | 541 | /* Retrieve the session that was already created and update the entry */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 542 | pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled; |
| 543 | pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled; |
| 544 | pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled; |
| 545 | pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable; |
| 546 | pftSessionEntry->isOSENConnection = psessionEntry->isOSENConnection; |
| 547 | |
| 548 | /* Fields to be filled later */ |
| 549 | pftSessionEntry->pLimJoinReq = NULL; |
| 550 | pftSessionEntry->smeSessionId = psessionEntry->smeSessionId; |
| 551 | pftSessionEntry->transactionId = 0; |
| 552 | |
| 553 | lim_extract_ap_capabilities(pMac, (uint8_t *) pbssDescription->ieFields, |
| 554 | lim_get_ielen_from_bss_description(pbssDescription), |
| 555 | pBeaconStruct); |
| 556 | |
| 557 | pftSessionEntry->rateSet.numRates = |
| 558 | pBeaconStruct->supportedRates.numRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 559 | qdf_mem_copy(pftSessionEntry->rateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 560 | pBeaconStruct->supportedRates.rate, |
| 561 | pBeaconStruct->supportedRates.numRates); |
| 562 | |
| 563 | pftSessionEntry->extRateSet.numRates = |
| 564 | pBeaconStruct->extendedRates.numRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 565 | qdf_mem_copy(pftSessionEntry->extRateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 566 | pBeaconStruct->extendedRates.rate, |
| 567 | pftSessionEntry->extRateSet.numRates); |
| 568 | |
| 569 | pftSessionEntry->ssId.length = pBeaconStruct->ssId.length; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 570 | qdf_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 571 | pftSessionEntry->ssId.length); |
Krunal Soni | 4bfecf6 | 2017-06-05 15:26:35 -0700 | [diff] [blame] | 572 | lim_fill_dot11mode(pMac, pftSessionEntry, psessionEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 573 | |
Padma, Santhosh Kumar | 19f5765 | 2017-05-26 18:03:45 +0530 | [diff] [blame] | 574 | pe_debug("dot11mode: %d", pftSessionEntry->dot11mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 575 | pftSessionEntry->vhtCapability = |
| 576 | (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode) |
| 577 | && IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)); |
| 578 | pftSessionEntry->htCapability = |
| 579 | (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) |
| 580 | && pBeaconStruct->HTCaps.present); |
| 581 | |
| 582 | /* Copy The channel Id to the session Table */ |
| 583 | pftSessionEntry->limReassocChannelId = pbssDescription->channelId; |
| 584 | pftSessionEntry->currentOperChannel = pbssDescription->channelId; |
| 585 | |
| 586 | pftSessionEntry->limRFBand = lim_get_rf_band( |
| 587 | pftSessionEntry->currentOperChannel); |
| 588 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 589 | if (pftSessionEntry->limRFBand == BAND_2G) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 590 | cbEnabledMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 591 | } else { |
| 592 | cbEnabledMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 593 | } |
| 594 | pftSessionEntry->htSupportedChannelWidthSet = |
| 595 | (pBeaconStruct->HTInfo.present) ? |
| 596 | (cbEnabledMode && pBeaconStruct->HTInfo.recommendedTxWidthSet) : 0; |
| 597 | pftSessionEntry->htRecommendedTxWidthSet = |
| 598 | pftSessionEntry->htSupportedChannelWidthSet; |
| 599 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 600 | if (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps) && |
| 601 | pBeaconStruct->VHTOperation.present && |
| 602 | pftSessionEntry->vhtCapability) { |
| 603 | pftSessionEntry->vhtCapabilityPresentInBeacon = 1; |
| 604 | } else { |
| 605 | pftSessionEntry->vhtCapabilityPresentInBeacon = 0; |
| 606 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 607 | if (pftSessionEntry->htRecommendedTxWidthSet) { |
| 608 | pftSessionEntry->ch_width = CH_WIDTH_40MHZ; |
| 609 | if (pftSessionEntry->vhtCapabilityPresentInBeacon && |
| 610 | pBeaconStruct->VHTOperation.chanWidth) { |
| 611 | pftSessionEntry->ch_width = |
| 612 | pBeaconStruct->VHTOperation.chanWidth + 1; |
| 613 | pftSessionEntry->ch_center_freq_seg0 = |
| 614 | pBeaconStruct->VHTOperation.chanCenterFreqSeg1; |
| 615 | pftSessionEntry->ch_center_freq_seg1 = |
| 616 | pBeaconStruct->VHTOperation.chanCenterFreqSeg2; |
| 617 | } else { |
| 618 | if (pBeaconStruct->HTInfo.secondaryChannelOffset == |
| 619 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 620 | pftSessionEntry->ch_center_freq_seg0 = |
| 621 | pbssDescription->channelId + 2; |
| 622 | else if (pBeaconStruct->HTInfo.secondaryChannelOffset == |
| 623 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 624 | pftSessionEntry->ch_center_freq_seg0 = |
| 625 | pbssDescription->channelId - 2; |
| 626 | else |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 627 | pe_warn("Invalid sec ch offset"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 628 | } |
| 629 | } else { |
| 630 | pftSessionEntry->ch_width = CH_WIDTH_20MHZ; |
| 631 | pftSessionEntry->ch_center_freq_seg0 = 0; |
| 632 | pftSessionEntry->ch_center_freq_seg1 = 0; |
| 633 | } |
| 634 | |
| 635 | sir_copy_mac_addr(pftSessionEntry->selfMacAddr, |
| 636 | psessionEntry->selfMacAddr); |
| 637 | sir_copy_mac_addr(pftSessionEntry->limReAssocbssId, |
| 638 | pbssDescription->bssId); |
| 639 | sir_copy_mac_addr(pftSessionEntry->prev_ap_bssid, psessionEntry->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 640 | |
| 641 | /* Store beaconInterval */ |
| 642 | pftSessionEntry->beaconParams.beaconInterval = |
| 643 | pbssDescription->beaconInterval; |
| 644 | pftSessionEntry->bssType = psessionEntry->bssType; |
| 645 | |
| 646 | pftSessionEntry->statypeForBss = STA_ENTRY_PEER; |
| 647 | pftSessionEntry->nwType = pbssDescription->nwType; |
| 648 | |
| 649 | |
| 650 | if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) { |
| 651 | pftSessionEntry->limSystemRole = eLIM_STA_ROLE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 652 | } else { |
Rajeev Kumar | 005895d | 2016-04-15 14:17:47 -0700 | [diff] [blame] | 653 | /* Throw an error & return & make sure to delete the session */ |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 654 | pe_warn("Invalid bss type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo; |
| 658 | pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo; |
| 659 | if (pMac->roam.configParam.shortSlotTime && |
| 660 | SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps)) { |
| 661 | pftSessionEntry->shortSlotTimeSupported = true; |
| 662 | } |
| 663 | |
| 664 | regMax = cfg_get_regulatory_max_transmit_power(pMac, |
| 665 | pftSessionEntry-> |
| 666 | currentOperChannel); |
| 667 | localPowerConstraint = regMax; |
| 668 | lim_extract_ap_capability(pMac, (uint8_t *) pbssDescription->ieFields, |
| 669 | lim_get_ielen_from_bss_description(pbssDescription), |
| 670 | &pftSessionEntry->limCurrentBssQosCaps, |
| 671 | &pftSessionEntry->limCurrentBssPropCap, ¤tBssUapsd, |
| 672 | &localPowerConstraint, pftSessionEntry); |
| 673 | |
| 674 | pftSessionEntry->limReassocBssQosCaps = |
| 675 | pftSessionEntry->limCurrentBssQosCaps; |
| 676 | pftSessionEntry->limReassocBssPropCap = |
| 677 | pftSessionEntry->limCurrentBssPropCap; |
| 678 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 679 | pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 680 | #ifdef FEATURE_WLAN_ESE |
| 681 | pftSessionEntry->isESEconnection = psessionEntry->isESEconnection; |
| 682 | pftSessionEntry->is_ese_version_ie_present = |
| 683 | pBeaconStruct->is_ese_ver_ie_present; |
| 684 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 685 | pftSessionEntry->isFastTransitionEnabled = |
| 686 | psessionEntry->isFastTransitionEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 687 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 688 | pftSessionEntry->isFastRoamIniFeatureEnabled = |
| 689 | psessionEntry->isFastRoamIniFeatureEnabled; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 690 | |
| 691 | #ifdef FEATURE_WLAN_ESE |
| 692 | pftSessionEntry->maxTxPower = |
| 693 | lim_get_max_tx_power(regMax, localPowerConstraint, |
| 694 | pMac->roam.configParam.nTxPowerCap); |
| 695 | #else |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 696 | pftSessionEntry->maxTxPower = QDF_MIN(regMax, (localPowerConstraint)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 697 | #endif |
| 698 | |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 699 | pe_debug("Reg max: %d local pwr: %d, ini tx pwr: %d max tx pwr: %d", |
Deepak Dhamdhere | 26bda45 | 2016-01-09 22:54:48 -0800 | [diff] [blame] | 700 | regMax, localPowerConstraint, |
| 701 | pMac->roam.configParam.nTxPowerCap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 702 | pftSessionEntry->maxTxPower); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 703 | if (!lim_is_roam_synch_in_progress(psessionEntry)) { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 704 | pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState; |
| 705 | pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE; |
| 706 | MTRACE(mac_trace(pMac, |
| 707 | TRACE_CODE_SME_STATE, |
| 708 | pftSessionEntry->peSessionId, |
| 709 | pftSessionEntry->limSmeState)); |
| 710 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 711 | pftSessionEntry->encryptType = psessionEntry->encryptType; |
| 712 | #ifdef WLAN_FEATURE_11W |
| 713 | pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled; |
| 714 | #endif |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 715 | if ((pftSessionEntry->limRFBand == BAND_2G) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 716 | (pftSessionEntry->htSupportedChannelWidthSet == |
| 717 | eHT_CHANNEL_WIDTH_40MHZ)) |
| 718 | lim_init_obss_params(pMac, pftSessionEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 719 | |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 720 | pftSessionEntry->enableHtSmps = psessionEntry->enableHtSmps; |
Archana Ramachandran | b66fc73 | 2016-03-30 16:26:38 -0700 | [diff] [blame] | 721 | pftSessionEntry->htSmpsvalue = psessionEntry->htSmpsvalue; |
Archana Ramachandran | 5482d6a | 2016-03-29 17:09:22 -0700 | [diff] [blame] | 722 | /* |
| 723 | * By default supported NSS 1x1 is set to true |
| 724 | * and later on updated while determining session |
| 725 | * supported rates which is the intersection of |
| 726 | * self and peer rates |
| 727 | */ |
| 728 | pftSessionEntry->supported_nss_1x1 = true; |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 729 | pe_debug("FT enable smps: %d mode: %d supported nss 1x1: %d", |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 730 | pftSessionEntry->enableHtSmps, |
Archana Ramachandran | b66fc73 | 2016-03-30 16:26:38 -0700 | [diff] [blame] | 731 | pftSessionEntry->htSmpsvalue, |
Archana Ramachandran | 5482d6a | 2016-03-29 17:09:22 -0700 | [diff] [blame] | 732 | pftSessionEntry->supported_nss_1x1); |
| 733 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 734 | qdf_mem_free(pBeaconStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 735 | } |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 736 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 737 | |
| 738 | /*------------------------------------------------------------------ |
| 739 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 740 | * This function is called to process the update key request from SME |
| 741 | * |
| 742 | *------------------------------------------------------------------*/ |
| 743 | bool lim_process_ft_update_key(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 744 | { |
| 745 | tAddBssParams *pAddBssParams; |
| 746 | tSirFTUpdateKeyInfo *pKeyInfo; |
| 747 | uint32_t val = 0; |
| 748 | tpPESession psessionEntry; |
| 749 | uint8_t sessionId; |
| 750 | |
| 751 | /* Sanity Check */ |
| 752 | if (pMac == NULL || pMsgBuf == NULL) { |
| 753 | return false; |
| 754 | } |
| 755 | |
| 756 | pKeyInfo = (tSirFTUpdateKeyInfo *) pMsgBuf; |
| 757 | |
Srinivas Girigowda | f9d9dd4 | 2015-12-04 13:53:58 -0800 | [diff] [blame] | 758 | psessionEntry = pe_find_session_by_bssid(pMac, pKeyInfo->bssid.bytes, |
| 759 | &sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 760 | if (NULL == psessionEntry) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 761 | pe_err("%s: Unable to find session for the following bssid", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 762 | __func__); |
Srinivas Girigowda | f9d9dd4 | 2015-12-04 13:53:58 -0800 | [diff] [blame] | 763 | lim_print_mac_addr(pMac, pKeyInfo->bssid.bytes, LOGE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 764 | return false; |
| 765 | } |
| 766 | |
| 767 | /* Nothing to be done if the session is not in STA mode */ |
| 768 | if (!LIM_IS_STA_ROLE(psessionEntry)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 769 | pe_err("psessionEntry is not in STA mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 770 | return false; |
| 771 | } |
| 772 | |
| 773 | if (NULL == psessionEntry->ftPEContext.pAddBssReq) { |
| 774 | /* AddBss Req is NULL, save the keys to configure them later. */ |
| 775 | tpLimMlmSetKeysReq pMlmSetKeysReq = |
| 776 | &psessionEntry->ftPEContext.PreAuthKeyInfo. |
| 777 | extSetStaKeyParam; |
| 778 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 779 | qdf_mem_zero(pMlmSetKeysReq, sizeof(tLimMlmSetKeysReq)); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 780 | qdf_copy_macaddr(&pMlmSetKeysReq->peer_macaddr, |
Srinivas Girigowda | f9d9dd4 | 2015-12-04 13:53:58 -0800 | [diff] [blame] | 781 | &pKeyInfo->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 782 | pMlmSetKeysReq->sessionId = psessionEntry->peSessionId; |
| 783 | pMlmSetKeysReq->smesessionId = psessionEntry->smeSessionId; |
| 784 | pMlmSetKeysReq->edType = pKeyInfo->keyMaterial.edType; |
| 785 | pMlmSetKeysReq->numKeys = pKeyInfo->keyMaterial.numKeys; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 786 | qdf_mem_copy((uint8_t *) &pMlmSetKeysReq->key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 787 | (uint8_t *) &pKeyInfo->keyMaterial.key, |
| 788 | sizeof(tSirKeys)); |
| 789 | |
| 790 | psessionEntry->ftPEContext.PreAuthKeyInfo. |
| 791 | extSetStaKeyParamValid = true; |
| 792 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 793 | if (psessionEntry->ftPEContext.pAddStaReq == NULL) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 794 | pe_err("pAddStaReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | lim_send_set_sta_key_req(pMac, pMlmSetKeysReq, 0, 0, |
| 796 | psessionEntry, false); |
| 797 | psessionEntry->ftPEContext.PreAuthKeyInfo. |
| 798 | extSetStaKeyParamValid = false; |
| 799 | } |
| 800 | } else { |
| 801 | pAddBssParams = psessionEntry->ftPEContext.pAddBssReq; |
| 802 | |
| 803 | /* Store the key information in the ADD BSS parameters */ |
| 804 | pAddBssParams->extSetStaKeyParamValid = 1; |
| 805 | pAddBssParams->extSetStaKeyParam.encType = |
| 806 | pKeyInfo->keyMaterial.edType; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 807 | qdf_mem_copy((uint8_t *) &pAddBssParams->extSetStaKeyParam.key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 808 | (uint8_t *) &pKeyInfo->keyMaterial.key, |
| 809 | sizeof(tSirKeys)); |
| 810 | if (eSIR_SUCCESS != |
| 811 | wlan_cfg_get_int(pMac, WNI_CFG_SINGLE_TID_RC, &val)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 812 | pe_warn("Unable to read WNI_CFG_SINGLE_TID_RC"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 813 | } |
| 814 | |
| 815 | pAddBssParams->extSetStaKeyParam.singleTidRc = val; |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 816 | pe_debug("Key valid: %d keyLength: %d", |
Nishank Aggarwal | abfd70b | 2017-03-11 16:48:25 +0530 | [diff] [blame] | 817 | pAddBssParams->extSetStaKeyParamValid, |
| 818 | pAddBssParams->extSetStaKeyParam.key[0].keyLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 819 | |
| 820 | pAddBssParams->extSetStaKeyParam.staIdx = 0; |
| 821 | |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 822 | pe_debug("BSSID: " MAC_ADDRESS_STR, |
Nishank Aggarwal | abfd70b | 2017-03-11 16:48:25 +0530 | [diff] [blame] | 823 | MAC_ADDR_ARRAY(pKeyInfo->bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 824 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 825 | qdf_copy_macaddr(&pAddBssParams->extSetStaKeyParam.peer_macaddr, |
Srinivas Girigowda | f9d9dd4 | 2015-12-04 13:53:58 -0800 | [diff] [blame] | 826 | &pKeyInfo->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 827 | |
| 828 | pAddBssParams->extSetStaKeyParam.sendRsp = false; |
| 829 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 830 | } |
| 831 | return true; |
| 832 | } |
| 833 | |
Jeff Johnson | 4f9d4a2 | 2016-10-06 18:45:15 -0700 | [diff] [blame] | 834 | static void |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 835 | lim_ft_send_aggr_qos_rsp(tpAniSirGlobal pMac, uint8_t rspReqd, |
| 836 | tpAggrAddTsParams aggrQosRsp, uint8_t smesessionId) |
| 837 | { |
| 838 | tpSirAggrQosRsp rsp; |
| 839 | int i = 0; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 840 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | if (!rspReqd) { |
| 842 | return; |
| 843 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 844 | rsp = qdf_mem_malloc(sizeof(tSirAggrQosRsp)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 845 | if (NULL == rsp) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 846 | pe_err("AllocateMemory failed for tSirAggrQosRsp"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 847 | return; |
| 848 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 849 | rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP; |
| 850 | rsp->sessionId = smesessionId; |
| 851 | rsp->length = sizeof(*rsp); |
| 852 | rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx; |
| 853 | for (i = 0; i < SIR_QOS_NUM_AC_MAX; i++) { |
| 854 | if ((1 << i) & aggrQosRsp->tspecIdx) { |
Naveen Rawat | 25735af | 2017-07-05 15:24:28 -0700 | [diff] [blame] | 855 | if (QDF_IS_STATUS_SUCCESS(aggrQosRsp->status[i])) |
| 856 | rsp->aggrInfo.aggrRsp[i].status = |
| 857 | eSIR_MAC_SUCCESS_STATUS; |
| 858 | else |
| 859 | rsp->aggrInfo.aggrRsp[i].status = |
| 860 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 861 | rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i]; |
| 862 | } |
| 863 | } |
| 864 | lim_send_sme_aggr_qos_rsp(pMac, rsp, smesessionId); |
| 865 | return; |
| 866 | } |
Varun Reddy Yeturu | dbbb991 | 2016-02-10 14:32:50 -0800 | [diff] [blame] | 867 | |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 868 | void lim_process_ft_aggr_qo_s_rsp(tpAniSirGlobal pMac, |
| 869 | struct scheduler_msg *limMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 870 | { |
| 871 | tpAggrAddTsParams pAggrQosRspMsg = NULL; |
| 872 | tAddTsParams addTsParam = { 0 }; |
| 873 | tpDphHashNode pSta = NULL; |
| 874 | uint16_t assocId = 0; |
| 875 | tSirMacAddr peerMacAddr; |
| 876 | uint8_t rspReqd = 1; |
| 877 | tpPESession psessionEntry = NULL; |
| 878 | int i = 0; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 879 | |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 880 | pe_debug(" Received AGGR_QOS_RSP from HAL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 881 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 882 | pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr); |
| 883 | if (NULL == pAggrQosRspMsg) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 884 | pe_err("NULL pAggrQosRspMsg"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 885 | return; |
| 886 | } |
| 887 | psessionEntry = |
| 888 | pe_find_session_by_session_id(pMac, pAggrQosRspMsg->sessionId); |
| 889 | if (NULL == psessionEntry) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 890 | pe_err("Cant find session entry for %s", __func__); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 891 | if (pAggrQosRspMsg != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 892 | qdf_mem_free(pAggrQosRspMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 893 | } |
| 894 | return; |
| 895 | } |
| 896 | if (!LIM_IS_STA_ROLE(psessionEntry)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 897 | pe_err("psessionEntry is not in STA mode"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 898 | return; |
| 899 | } |
| 900 | for (i = 0; i < HAL_QOS_NUM_AC_MAX; i++) { |
| 901 | if ((((1 << i) & pAggrQosRspMsg->tspecIdx)) && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 902 | (pAggrQosRspMsg->status[i] != QDF_STATUS_SUCCESS)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 903 | sir_copy_mac_addr(peerMacAddr, psessionEntry->bssId); |
| 904 | addTsParam.staIdx = pAggrQosRspMsg->staIdx; |
| 905 | addTsParam.sessionId = pAggrQosRspMsg->sessionId; |
| 906 | addTsParam.tspec = pAggrQosRspMsg->tspec[i]; |
| 907 | addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx; |
| 908 | lim_send_delts_req_action_frame(pMac, peerMacAddr, rspReqd, |
| 909 | &addTsParam.tspec.tsinfo, |
| 910 | &addTsParam.tspec, |
| 911 | psessionEntry); |
| 912 | pSta = |
| 913 | dph_lookup_assoc_id(pMac, addTsParam.staIdx, &assocId, |
| 914 | &psessionEntry->dph.dphHashTable); |
| 915 | if (pSta != NULL) { |
| 916 | lim_admit_control_delete_ts(pMac, assocId, |
| 917 | &addTsParam.tspec. |
| 918 | tsinfo, NULL, |
| 919 | (uint8_t *) & |
| 920 | addTsParam.tspecIdx); |
| 921 | } |
| 922 | } |
| 923 | } |
| 924 | lim_ft_send_aggr_qos_rsp(pMac, rspReqd, pAggrQosRspMsg, |
| 925 | psessionEntry->smeSessionId); |
| 926 | if (pAggrQosRspMsg != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 927 | qdf_mem_free(pAggrQosRspMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 928 | } |
| 929 | return; |
| 930 | } |
Varun Reddy Yeturu | dbbb991 | 2016-02-10 14:32:50 -0800 | [diff] [blame] | 931 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | tSirRetStatus lim_process_ft_aggr_qos_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 933 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 934 | struct scheduler_msg msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | tSirAggrQosReq *aggrQosReq = (tSirAggrQosReq *) pMsgBuf; |
| 936 | tpAggrAddTsParams pAggrAddTsParam; |
| 937 | tpPESession psessionEntry = NULL; |
| 938 | tpLimTspecInfo tspecInfo; |
| 939 | uint8_t ac; |
| 940 | tpDphHashNode pSta; |
| 941 | uint16_t aid; |
| 942 | uint8_t sessionId; |
| 943 | int i; |
| 944 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 945 | pAggrAddTsParam = qdf_mem_malloc(sizeof(tAggrAddTsParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 946 | if (NULL == pAggrAddTsParam) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 947 | pe_err("AllocateMemory() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 948 | return eSIR_MEM_ALLOC_FAILED; |
| 949 | } |
| 950 | |
Srinivas Girigowda | 99faf48 | 2015-12-03 19:06:15 -0800 | [diff] [blame] | 951 | psessionEntry = pe_find_session_by_bssid(pMac, aggrQosReq->bssid.bytes, |
| 952 | &sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | |
| 954 | if (psessionEntry == NULL) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 955 | pe_err("psession Entry Null for sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 956 | aggrQosReq->sessionId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 957 | qdf_mem_free(pAggrAddTsParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 958 | return eSIR_FAILURE; |
| 959 | } |
| 960 | |
| 961 | /* Nothing to be done if the session is not in STA mode */ |
| 962 | if (!LIM_IS_STA_ROLE(psessionEntry)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 963 | pe_err("psessionEntry is not in STA mode"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 964 | qdf_mem_free(pAggrAddTsParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | return eSIR_FAILURE; |
| 966 | } |
| 967 | |
Srinivas Girigowda | 99faf48 | 2015-12-03 19:06:15 -0800 | [diff] [blame] | 968 | pSta = dph_lookup_hash_entry(pMac, aggrQosReq->bssid.bytes, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 969 | &psessionEntry->dph.dphHashTable); |
| 970 | if (pSta == NULL) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 971 | pe_err("Station context not found - ignoring AddTsRsp"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 972 | qdf_mem_free(pAggrAddTsParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | return eSIR_FAILURE; |
| 974 | } |
| 975 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 976 | pAggrAddTsParam->staIdx = psessionEntry->staId; |
| 977 | /* Fill in the sessionId specific to PE */ |
| 978 | pAggrAddTsParam->sessionId = sessionId; |
| 979 | pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx; |
| 980 | |
| 981 | for (i = 0; i < HAL_QOS_NUM_AC_MAX; i++) { |
| 982 | if (aggrQosReq->aggrInfo.tspecIdx & (1 << i)) { |
| 983 | tSirMacTspecIE *pTspec = |
| 984 | &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec; |
| 985 | /* Since AddTS response was successful, check for the PSB flag |
| 986 | * and directional flag inside the TS Info field. |
| 987 | * An AC is trigger enabled AC if the PSB subfield is set to 1 |
| 988 | * in the uplink direction. |
| 989 | * An AC is delivery enabled AC if the PSB subfield is set to 1 |
| 990 | * in the downlink direction. |
| 991 | * An AC is trigger and delivery enabled AC if the PSB subfield |
| 992 | * is set to 1 in the bi-direction field. |
| 993 | */ |
| 994 | if (pTspec->tsinfo.traffic.psb == 1) { |
| 995 | lim_set_tspec_uapsd_mask_per_session(pMac, |
| 996 | psessionEntry, |
| 997 | &pTspec-> |
| 998 | tsinfo, |
| 999 | SET_UAPSD_MASK); |
| 1000 | } else { |
| 1001 | lim_set_tspec_uapsd_mask_per_session(pMac, |
| 1002 | psessionEntry, |
| 1003 | &pTspec-> |
| 1004 | tsinfo, |
| 1005 | CLEAR_UAPSD_MASK); |
| 1006 | } |
| 1007 | /* |
| 1008 | * ADDTS success, so AC is now admitted. |
| 1009 | * We shall now use the default |
| 1010 | * EDCA parameters as advertised by AP and |
| 1011 | * send the updated EDCA params |
| 1012 | * to HAL. |
| 1013 | */ |
| 1014 | ac = upToAc(pTspec->tsinfo.traffic.userPrio); |
| 1015 | if (pTspec->tsinfo.traffic.direction == |
| 1016 | SIR_MAC_DIRECTION_UPLINK) { |
| 1017 | psessionEntry-> |
| 1018 | gAcAdmitMask |
| 1019 | [SIR_MAC_DIRECTION_UPLINK] |= |
| 1020 | (1 << ac); |
| 1021 | } else if (pTspec->tsinfo.traffic.direction == |
| 1022 | SIR_MAC_DIRECTION_DNLINK) { |
| 1023 | psessionEntry-> |
| 1024 | gAcAdmitMask |
| 1025 | [SIR_MAC_DIRECTION_DNLINK] |= |
| 1026 | (1 << ac); |
| 1027 | } else if (pTspec->tsinfo.traffic.direction == |
| 1028 | SIR_MAC_DIRECTION_BIDIR) { |
| 1029 | psessionEntry-> |
| 1030 | gAcAdmitMask |
| 1031 | [SIR_MAC_DIRECTION_UPLINK] |= |
| 1032 | (1 << ac); |
| 1033 | psessionEntry-> |
| 1034 | gAcAdmitMask |
| 1035 | [SIR_MAC_DIRECTION_DNLINK] |= |
| 1036 | (1 << ac); |
| 1037 | } |
| 1038 | lim_set_active_edca_params(pMac, |
| 1039 | psessionEntry->gLimEdcaParams, |
| 1040 | psessionEntry); |
| 1041 | |
| 1042 | lim_send_edca_params(pMac, |
| 1043 | psessionEntry->gLimEdcaParamsActive, |
Kiran Kumar Lokere | 27026ae | 2018-03-09 11:38:19 -0800 | [diff] [blame] | 1044 | pSta->bssId, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1045 | |
| 1046 | if (eSIR_SUCCESS != |
| 1047 | lim_tspec_add(pMac, pSta->staAddr, pSta->assocId, |
| 1048 | pTspec, 0, &tspecInfo)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 1049 | pe_err("Adding entry in lim Tspec Table failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1050 | pMac->lim.gLimAddtsSent = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1051 | qdf_mem_free(pAggrAddTsParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1052 | return eSIR_FAILURE; |
| 1053 | } |
| 1054 | |
| 1055 | pAggrAddTsParam->tspec[i] = |
| 1056 | aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec; |
| 1057 | } |
| 1058 | } |
| 1059 | |
| 1060 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1061 | if (!pMac->roam.configParam.isRoamOffloadEnabled || |
| 1062 | (pMac->roam.configParam.isRoamOffloadEnabled && |
| 1063 | !psessionEntry->is11Rconnection)) |
| 1064 | #endif |
| 1065 | { |
| 1066 | msg.type = WMA_AGGR_QOS_REQ; |
| 1067 | msg.bodyptr = pAggrAddTsParam; |
| 1068 | msg.bodyval = 0; |
| 1069 | |
| 1070 | /* We need to defer any incoming messages until we get a |
| 1071 | * WMA_AGGR_QOS_RSP from HAL. |
| 1072 | */ |
| 1073 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 1074 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msg.type)); |
| 1075 | |
| 1076 | if (eSIR_SUCCESS != wma_post_ctrl_msg(pMac, &msg)) { |
Nishank Aggarwal | 8b805bb | 2017-03-23 14:50:18 +0530 | [diff] [blame] | 1077 | pe_warn("wma_post_ctrl_msg() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1078 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1079 | qdf_mem_free(pAggrAddTsParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | return eSIR_FAILURE; |
| 1081 | } |
| 1082 | } |
| 1083 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1084 | else { |
| 1085 | /* Implies it is a LFR3.0 based 11r connection |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame^] | 1086 | * so donot send add ts request to firmware since it |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1087 | * already has the RIC IEs */ |
| 1088 | |
| 1089 | /* Send the Aggr QoS response to SME */ |
| 1090 | lim_ft_send_aggr_qos_rsp(pMac, true, pAggrAddTsParam, |
| 1091 | psessionEntry->smeSessionId); |
| 1092 | if (pAggrAddTsParam != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1093 | qdf_mem_free(pAggrAddTsParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1094 | } |
| 1095 | } |
| 1096 | #endif |
| 1097 | |
| 1098 | return eSIR_SUCCESS; |
| 1099 | } |