Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * This file lim_assoc_utils.cc contains the utility functions |
| 30 | * LIM uses while processing (Re) Association messages. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 02/13/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | * 05/26/10 js WPA handling in (Re)Assoc frames |
| 37 | * |
| 38 | */ |
| 39 | |
| 40 | #include "cds_api.h" |
| 41 | #include "ani_global.h" |
| 42 | #include "wni_api.h" |
| 43 | #include "sir_common.h" |
| 44 | |
| 45 | #include "wni_cfg.h" |
| 46 | #include "cfg_api.h" |
| 47 | |
| 48 | #include "sch_api.h" |
| 49 | #include "utils_api.h" |
| 50 | #include "lim_utils.h" |
| 51 | #include "lim_assoc_utils.h" |
| 52 | #include "lim_security_utils.h" |
| 53 | #include "lim_ser_des_utils.h" |
| 54 | #include "lim_sta_hash_api.h" |
| 55 | #include "lim_admit_control.h" |
| 56 | #include "lim_send_messages.h" |
| 57 | #include "lim_ibss_peer_mgmt.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 59 | #include "lim_session.h" |
| 60 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 61 | #include "qdf_types.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 62 | #include "wma_types.h" |
| 63 | #include "lim_types.h" |
| 64 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | /** |
Srinivas Girigowda | cba7473 | 2016-01-14 17:35:25 -0800 | [diff] [blame] | 66 | * lim_cmp_ssid() - utility function to compare SSIDs |
| 67 | * @rx_ssid: Received SSID |
| 68 | * @session_entry: Session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | * This function is called in various places within LIM code |
Srinivas Girigowda | cba7473 | 2016-01-14 17:35:25 -0800 | [diff] [blame] | 71 | * to determine whether received SSID is same as SSID in use. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 72 | * |
Ankit Gupta | d66a881 | 2016-09-15 11:00:16 -0700 | [diff] [blame] | 73 | * Return: zero if SSID matched, non-zero otherwise. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 74 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 75 | uint32_t lim_cmp_ssid(tSirMacSSid *rx_ssid, tpPESession session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 76 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 77 | return qdf_mem_cmp(rx_ssid, &session_entry->ssId, |
Srinivas Girigowda | cba7473 | 2016-01-14 17:35:25 -0800 | [diff] [blame] | 78 | session_entry->ssId.length); |
| 79 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * lim_compare_capabilities() |
| 83 | * |
| 84 | ***FUNCTION: |
| 85 | * This function is called during Association/Reassociation |
| 86 | * frame handling to determine whether received capabilities |
| 87 | * match with local capabilities or not. |
| 88 | * |
| 89 | ***LOGIC: |
| 90 | * |
| 91 | ***ASSUMPTIONS: |
| 92 | * NA |
| 93 | * |
| 94 | ***NOTE: |
| 95 | * NA |
| 96 | * |
| 97 | * @param pMac - Pointer to Global MAC structure |
| 98 | * @param pAssocReq - Pointer to received Assoc Req frame |
| 99 | * @param pLocalCapabs - Pointer to local capabilities |
| 100 | * |
| 101 | * @return status - true for Capabilitity match else false. |
| 102 | */ |
| 103 | |
| 104 | uint8_t |
| 105 | lim_compare_capabilities(tpAniSirGlobal pMac, |
| 106 | tSirAssocReq *pAssocReq, |
| 107 | tSirMacCapabilityInfo *pLocalCapabs, |
| 108 | tpPESession psessionEntry) |
| 109 | { |
| 110 | uint32_t val; |
| 111 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 112 | if (LIM_IS_AP_ROLE(psessionEntry) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 113 | (pAssocReq->capabilityInfo.ibss)) { |
| 114 | /* Requesting STA asserting IBSS capability. */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 115 | pe_debug("Requesting STA asserting IBSS capability"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 116 | return false; |
| 117 | } |
| 118 | /* Compare CF capabilities */ |
| 119 | if (pAssocReq->capabilityInfo.cfPollable || |
| 120 | pAssocReq->capabilityInfo.cfPollReq) { |
| 121 | /* AP does not support PCF functionality */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 122 | pe_debug(" AP does not support PCF functionality"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 123 | return false; |
| 124 | } |
| 125 | /* Compare short preamble capability */ |
| 126 | if (pAssocReq->capabilityInfo.shortPreamble && |
| 127 | (pAssocReq->capabilityInfo.shortPreamble != |
| 128 | pLocalCapabs->shortPreamble)) { |
| 129 | /* Allowing a STA requesting short preamble while */ |
| 130 | /* AP does not support it */ |
| 131 | } |
| 132 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 133 | pe_debug("QoS in AssocReq: %d, local capabs qos: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 134 | pAssocReq->capabilityInfo.qos, pLocalCapabs->qos); |
| 135 | |
| 136 | /* Compare QoS capability */ |
| 137 | if (pAssocReq->capabilityInfo.qos && |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 138 | (pAssocReq->capabilityInfo.qos != pLocalCapabs->qos)) |
| 139 | pe_debug("Received unmatched QOS but cfg to suppress - continuing"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | |
| 141 | /* |
| 142 | * If AP supports shortSlot and if apple user has |
| 143 | * enforced association only from shortSlot station, |
| 144 | * then AP must reject any station that does not support |
| 145 | * shortSlot |
| 146 | */ |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 147 | if (LIM_IS_AP_ROLE(psessionEntry) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 148 | (pLocalCapabs->shortSlotTime == 1)) { |
| 149 | if (wlan_cfg_get_int |
| 150 | (pMac, WNI_CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY, |
| 151 | &val) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 152 | pe_err("error getting WNI_CFG_FORCE_SHORT_SLOT_ASSOC_ONLY"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 153 | return false; |
| 154 | } |
| 155 | if (val) { |
| 156 | if (pAssocReq->capabilityInfo.shortSlotTime != |
| 157 | pLocalCapabs->shortSlotTime) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 158 | pe_err("AP rejects association as station doesnt support shortslot time"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | return false; |
| 160 | } |
| 161 | return false; |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | return true; |
| 166 | } /****** end lim_compare_capabilities() ******/ |
| 167 | |
| 168 | /** |
| 169 | * lim_check_rx_basic_rates() |
| 170 | * |
| 171 | ***FUNCTION: |
| 172 | * This function is called during Association/Reassociation |
| 173 | * frame handling to determine whether received rates in |
| 174 | * Assoc/Reassoc request frames include all BSS basic rates |
| 175 | * or not. |
| 176 | * |
| 177 | ***LOGIC: |
| 178 | * |
| 179 | ***ASSUMPTIONS: |
| 180 | * NA |
| 181 | * |
| 182 | ***NOTE: |
| 183 | * NA |
| 184 | * |
| 185 | * @param rxRateSet - pointer to SSID structure |
| 186 | * |
| 187 | * @return status - true if ALL BSS basic rates are present in the |
| 188 | * received rateset else false. |
| 189 | */ |
| 190 | |
| 191 | uint8_t |
| 192 | lim_check_rx_basic_rates(tpAniSirGlobal pMac, tSirMacRateSet rxRateSet, |
| 193 | tpPESession psessionEntry) |
| 194 | { |
| 195 | tSirMacRateSet *pRateSet, basicRate; |
| 196 | uint8_t i, j, k, match; |
| 197 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 198 | pRateSet = qdf_mem_malloc(sizeof(tSirMacRateSet)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | if (NULL == pRateSet) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 200 | pe_err("call to AllocateMemory failed for RATESET"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 201 | return false; |
| 202 | } |
| 203 | |
| 204 | /* Copy operational rate set from session Entry */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 205 | qdf_mem_copy(pRateSet->rate, (psessionEntry->rateSet.rate), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 206 | psessionEntry->rateSet.numRates); |
| 207 | |
| 208 | pRateSet->numRates = psessionEntry->rateSet.numRates; |
| 209 | |
| 210 | /* Extract BSS basic rateset from operational rateset */ |
| 211 | for (i = 0, j = 0; |
| 212 | ((i < pRateSet->numRates) && (i < SIR_MAC_RATESET_EID_MAX)); i++) { |
| 213 | if ((pRateSet->rate[i] & 0x80) == 0x80) { |
| 214 | /* msb is set, so this is a basic rate */ |
| 215 | basicRate.rate[j++] = pRateSet->rate[i]; |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | /* |
| 220 | * For each BSS basic rate, find if it is present in the |
| 221 | * received rateset. |
| 222 | */ |
| 223 | for (k = 0; k < j; k++) { |
| 224 | match = 0; |
| 225 | for (i = 0; |
| 226 | ((i < rxRateSet.numRates) |
| 227 | && (i < SIR_MAC_RATESET_EID_MAX)); i++) { |
| 228 | if ((rxRateSet.rate[i] | 0x80) == basicRate.rate[k]) |
| 229 | match = 1; |
| 230 | } |
| 231 | |
| 232 | if (!match) { |
| 233 | /* Free up memory allocated for rateset */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 234 | qdf_mem_free((uint8_t *) pRateSet); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 235 | |
| 236 | return false; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | /* Free up memory allocated for rateset */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 241 | qdf_mem_free((uint8_t *) pRateSet); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 242 | |
| 243 | return true; |
| 244 | } /****** end lim_check_rx_basic_rates() ******/ |
| 245 | |
| 246 | /** |
| 247 | * lim_check_mcs_set() |
| 248 | * |
| 249 | ***FUNCTION: |
| 250 | * This function is called during Association/Reassociation |
| 251 | * frame handling to determine whether received MCS rates in |
| 252 | * Assoc/Reassoc request frames includes all Basic MCS Rate Set or not. |
| 253 | * |
| 254 | ***LOGIC: |
| 255 | * |
| 256 | ***ASSUMPTIONS: |
| 257 | * NA |
| 258 | * |
| 259 | ***NOTE: |
| 260 | * NA |
| 261 | * |
| 262 | * @param supportedMCSSet - pointer to Supported MCS Rate Set |
| 263 | * |
| 264 | * @return status - true if ALL MCS Basic Rate Set rates are present in the |
| 265 | * received rateset else false. |
| 266 | */ |
| 267 | |
| 268 | uint8_t lim_check_mcs_set(tpAniSirGlobal pMac, uint8_t *supportedMCSSet) |
| 269 | { |
| 270 | uint8_t basicMCSSet[SIZE_OF_BASIC_MCS_SET] = { 0 }; |
| 271 | uint32_t cfgLen = 0; |
| 272 | uint8_t i; |
| 273 | uint8_t validBytes; |
| 274 | uint8_t lastByteMCSMask = 0x1f; |
| 275 | |
| 276 | cfgLen = WNI_CFG_BASIC_MCS_SET_LEN; |
| 277 | if (wlan_cfg_get_str(pMac, WNI_CFG_BASIC_MCS_SET, |
| 278 | (uint8_t *) basicMCSSet, |
| 279 | (uint32_t *) &cfgLen) != eSIR_SUCCESS) { |
| 280 | /* / Could not get Basic MCS rateset from CFG. Log error. */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 281 | pe_err("could not retrieve Basic MCS rateset"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 282 | return false; |
| 283 | } |
| 284 | |
| 285 | validBytes = VALID_MCS_SIZE / 8; |
| 286 | |
| 287 | /* check if all the Basic MCS Bits are set in supported MCS bitmap */ |
| 288 | for (i = 0; i < validBytes; i++) { |
| 289 | if ((basicMCSSet[i] & supportedMCSSet[i]) != basicMCSSet[i]) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 290 | pe_warn("One of Basic MCS Set Rates is not supported by the Station"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 291 | return false; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | /* check the last 5 bits of the valid MCS bitmap */ |
| 296 | if (((basicMCSSet[i] & lastByteMCSMask) & |
| 297 | (supportedMCSSet[i] & lastByteMCSMask)) != |
| 298 | (basicMCSSet[i] & lastByteMCSMask)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 299 | pe_warn("One of Basic MCS Set Rates is not supported by the Station"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | return false; |
| 301 | } |
| 302 | |
| 303 | return true; |
| 304 | } |
| 305 | |
| 306 | #define SECURITY_SUITE_TYPE_MASK 0xFF |
| 307 | #define SECURITY_SUITE_TYPE_WEP40 0x1 |
| 308 | #define SECURITY_SUITE_TYPE_TKIP 0x2 |
| 309 | #define SECURITY_SUITE_TYPE_CCMP 0x4 |
| 310 | #define SECURITY_SUITE_TYPE_WEP104 0x4 |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 311 | #define SECURITY_SUITE_TYPE_GCMP 0x8 |
| 312 | #define SECURITY_SUITE_TYPE_GCMP_256 0x9 |
| 313 | |
| 314 | /** |
| 315 | * is_non_rsn_cipher()- API to check whether cipher suit is rsn or not |
| 316 | * @cipher_suite: cipher suit |
| 317 | * |
| 318 | * Return: True in case non ht cipher else false |
| 319 | */ |
| 320 | static inline bool is_non_rsn_cipher(uint8_t cipher_suite) |
| 321 | { |
| 322 | uint8_t cipher_mask; |
| 323 | |
| 324 | cipher_mask = cipher_suite & SECURITY_SUITE_TYPE_MASK; |
| 325 | if ((cipher_mask == SECURITY_SUITE_TYPE_CCMP) || |
| 326 | (cipher_mask == SECURITY_SUITE_TYPE_GCMP) || |
| 327 | (cipher_mask == SECURITY_SUITE_TYPE_GCMP_256)) |
| 328 | return false; |
| 329 | |
| 330 | return true; |
| 331 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 332 | |
| 333 | /** |
| 334 | * lim_check_rx_rsn_ie_match()- validate received rsn ie with supported cipher |
| 335 | * suites. |
| 336 | * @mac_ctx: pointer to global mac structure |
| 337 | * @rx_rsn_ie: received rsn IE |
| 338 | * @session_entry: pe session entry |
| 339 | * @sta_is_ht: peer station HT capability |
| 340 | * @pmf_connection: set to true if this is pmf connection |
| 341 | * |
| 342 | * This function is called during Association/Reassociation |
| 343 | * frame handling to determine whether received RSN in |
| 344 | * Assoc/Reassoc request frames include supported cipher suites or not. |
| 345 | * |
| 346 | * Return: eSIR_SUCCESS if ALL BSS basic rates are present in the |
| 347 | * received rateset else failure status. |
| 348 | */ |
| 349 | |
| 350 | uint8_t |
| 351 | lim_check_rx_rsn_ie_match(tpAniSirGlobal mac_ctx, tDot11fIERSN rx_rsn_ie, |
| 352 | tpPESession session_entry, uint8_t sta_is_ht, |
| 353 | bool *pmf_connection) |
| 354 | { |
| 355 | tDot11fIERSN *rsn_ie; |
| 356 | uint8_t i, j, match, only_non_ht_cipher = 1; |
| 357 | #ifdef WLAN_FEATURE_11W |
| 358 | bool we_are_pmf_capable; |
| 359 | bool we_require_pmf; |
| 360 | bool they_are_pmf_capable; |
| 361 | bool they_require_pmf; |
| 362 | #endif |
| 363 | |
| 364 | /* RSN IE should be received from PE */ |
| 365 | rsn_ie = &session_entry->gStartBssRSNIe; |
| 366 | |
| 367 | /* Check groupwise cipher suite */ |
| 368 | for (i = 0; i < sizeof(rx_rsn_ie.gp_cipher_suite); i++) |
| 369 | if (rsn_ie->gp_cipher_suite[i] != |
| 370 | rx_rsn_ie.gp_cipher_suite[i]) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 371 | pe_debug("Invalid groupwise cipher suite"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 372 | return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS; |
| 373 | } |
| 374 | |
| 375 | /* |
| 376 | * For each Pairwise cipher suite check whether we support |
| 377 | * received pairwise |
| 378 | */ |
| 379 | match = 0; |
| 380 | for (i = 0; i < rx_rsn_ie.pwise_cipher_suite_count; i++) { |
| 381 | for (j = 0; j < rsn_ie->pwise_cipher_suite_count; j++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 382 | if (!qdf_mem_cmp(&rx_rsn_ie.pwise_cipher_suites[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 383 | &rsn_ie->pwise_cipher_suites[j], |
| 384 | sizeof(rsn_ie->pwise_cipher_suites[j]))) { |
| 385 | match = 1; |
| 386 | break; |
| 387 | } |
| 388 | } |
| 389 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 390 | if (sta_is_ht) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 391 | #ifdef ANI_LITTLE_BYTE_ENDIAN |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 392 | only_non_ht_cipher = is_non_rsn_cipher( |
| 393 | rx_rsn_ie.pwise_cipher_suites[i][3]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 394 | #else |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 395 | only_non_ht_cipher = is_non_rsn_cipher( |
| 396 | rx_rsn_ie.pwise_cipher_suites[i][0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 397 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | if ((!match) || ((sta_is_ht) && only_non_ht_cipher)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 401 | pe_debug("Invalid pairwise cipher suite"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 402 | return eSIR_MAC_INVALID_PAIRWISE_CIPHER_STATUS; |
| 403 | } |
| 404 | /* |
| 405 | * Check RSN capabilities |
| 406 | * Bit 0 of First Byte - PreAuthentication Capability |
| 407 | */ |
| 408 | if (((rx_rsn_ie.RSN_Cap[0] >> 0) & 0x1) == true) { |
| 409 | /* this is supported by AP only */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 410 | pe_debug("Invalid RSN information element capabilities"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 411 | return eSIR_MAC_INVALID_RSN_IE_CAPABILITIES_STATUS; |
| 412 | } |
| 413 | |
| 414 | *pmf_connection = false; |
| 415 | |
| 416 | #ifdef WLAN_FEATURE_11W |
| 417 | we_are_pmf_capable = session_entry->pLimStartBssReq->pmfCapable; |
| 418 | we_require_pmf = session_entry->pLimStartBssReq->pmfRequired; |
| 419 | they_are_pmf_capable = (rx_rsn_ie.RSN_Cap[0] >> 7) & 0x1; |
| 420 | they_require_pmf = (rx_rsn_ie.RSN_Cap[0] >> 6) & 0x1; |
| 421 | |
| 422 | if ((they_require_pmf && they_are_pmf_capable && !we_are_pmf_capable) || |
| 423 | (we_require_pmf && !they_are_pmf_capable)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 424 | pe_debug("Association fail, robust management frames policy" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 425 | " violation they_require_pmf =%d" |
| 426 | " theyArePMFCapable %d weArePMFCapable %d" |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 427 | " weRequirePMF %d theyArePMFCapable %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 428 | they_require_pmf, they_are_pmf_capable, |
| 429 | we_are_pmf_capable, we_require_pmf, |
| 430 | they_are_pmf_capable); |
| 431 | return eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION; |
| 432 | } |
| 433 | |
| 434 | if (they_are_pmf_capable && we_are_pmf_capable) |
| 435 | *pmf_connection = true; |
| 436 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 437 | pe_debug("weAreCapable %d, weRequire %d, theyAreCapable %d," |
| 438 | " theyRequire %d, PMFconnection %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 439 | we_are_pmf_capable, we_require_pmf, they_are_pmf_capable, |
| 440 | they_require_pmf, *pmf_connection); |
| 441 | #endif |
| 442 | |
| 443 | return eSIR_SUCCESS; |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * lim_check_rx_wpa_ie_match() - to check supported cipher suites |
| 448 | * |
| 449 | * @mac: pointer to global mac structure |
| 450 | * @rx_wpaie: Received WPA IE in (Re)Assco req |
| 451 | * @session_entry: pointer to PE session |
| 452 | * @sta_is_ht: peer station is HT |
| 453 | * |
| 454 | * This function is called during Association/Reassociation |
| 455 | * frame handling to determine whether received RSN in |
| 456 | * Assoc/Reassoc request frames include supported cipher suites or not. |
| 457 | * |
| 458 | * Return: Success if ALL BSS basic rates are present in the |
| 459 | * received rateset else failure status. |
| 460 | */ |
| 461 | |
| 462 | uint8_t |
| 463 | lim_check_rx_wpa_ie_match(tpAniSirGlobal mac, tDot11fIEWPA rx_wpaie, |
| 464 | tpPESession session_entry, uint8_t sta_is_ht) |
| 465 | { |
| 466 | tDot11fIEWPA *wpa_ie; |
| 467 | uint8_t i, j, match, only_non_ht_cipher = 1; |
| 468 | |
| 469 | /* WPA IE should be received from PE */ |
| 470 | wpa_ie = &session_entry->gStartBssWPAIe; |
| 471 | |
| 472 | /* Check groupwise cipher suite */ |
| 473 | for (i = 0; i < 4; i++) { |
| 474 | if (wpa_ie->multicast_cipher[i] != rx_wpaie.multicast_cipher[i]) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 475 | pe_debug("Invalid groupwise cipher suite"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 476 | return eSIR_MAC_INVALID_GROUP_CIPHER_STATUS; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | /* |
| 481 | * For each Pairwise cipher suite check whether we support |
| 482 | * received pairwise |
| 483 | */ |
| 484 | match = 0; |
| 485 | for (i = 0; i < rx_wpaie.unicast_cipher_count; i++) { |
| 486 | for (j = 0; j < wpa_ie->unicast_cipher_count; j++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 487 | if (!qdf_mem_cmp(rx_wpaie.unicast_ciphers[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 488 | wpa_ie->unicast_ciphers[j], 4)) { |
| 489 | match = 1; |
| 490 | break; |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | if ((sta_is_ht) |
| 495 | #ifdef ANI_LITTLE_BYTE_ENDIAN |
| 496 | && |
| 497 | ((rx_wpaie. |
| 498 | unicast_ciphers[i][3] & SECURITY_SUITE_TYPE_MASK) == |
| 499 | SECURITY_SUITE_TYPE_CCMP)) |
| 500 | #else |
| 501 | && |
| 502 | ((rx_wpaie. |
| 503 | unicast_ciphers[i][0] & SECURITY_SUITE_TYPE_MASK) == |
| 504 | SECURITY_SUITE_TYPE_CCMP)) |
| 505 | #endif |
| 506 | { |
| 507 | only_non_ht_cipher = 0; |
| 508 | } |
| 509 | |
| 510 | } |
| 511 | |
| 512 | if ((!match) || ((sta_is_ht) && only_non_ht_cipher)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 513 | pe_debug("Invalid pairwise cipher suite"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 514 | return eSIR_MAC_CIPHER_SUITE_REJECTED_STATUS; |
| 515 | } |
| 516 | |
| 517 | return eSIR_SUCCESS; |
| 518 | } |
| 519 | |
| 520 | /** |
| 521 | * lim_cleanup_rx_path() |
| 522 | * |
| 523 | ***FUNCTION: |
| 524 | * This function is called to cleanup STA state at SP & RFP. |
| 525 | * |
| 526 | ***LOGIC: |
| 527 | * To circumvent RFP's handling of dummy packet when it does not |
| 528 | * have an incomplete packet for the STA to be deleted, a packet |
| 529 | * with 'more framgents' bit set will be queued to RFP's WQ before |
| 530 | * queuing 'dummy packet'. |
| 531 | * A 'dummy' BD is pushed into RFP's WQ with type=00, subtype=1010 |
| 532 | * (Disassociation frame) and routing flags in BD set to eCPU's |
| 533 | * Low Priority WQ. |
| 534 | * RFP cleans up its local context for the STA id mentioned in the |
| 535 | * BD and then pushes BD to eCPU's low priority WQ. |
| 536 | * |
| 537 | ***ASSUMPTIONS: |
| 538 | * NA |
| 539 | * |
| 540 | ***NOTE: |
| 541 | * NA |
| 542 | * |
| 543 | * @param pMac Pointer to Global MAC structure |
| 544 | * @param pStaDs Pointer to the per STA data structure |
| 545 | * initialized by LIM and maintained at DPH |
| 546 | * |
| 547 | * @return None |
| 548 | */ |
| 549 | |
| 550 | tSirRetStatus |
| 551 | lim_cleanup_rx_path(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 552 | tpPESession psessionEntry) |
| 553 | { |
| 554 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 555 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 556 | pe_debug("Cleanup Rx Path for AID: %d" |
| 557 | "psessionEntry->limSmeState: %d, mlmState: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 558 | pStaDs->assocId, psessionEntry->limSmeState, |
| 559 | pStaDs->mlmStaContext.mlmState); |
| 560 | |
| 561 | psessionEntry->isCiscoVendorAP = false; |
| 562 | |
| 563 | if (pMac->lim.gLimAddtsSent) { |
| 564 | MTRACE(mac_trace |
| 565 | (pMac, TRACE_CODE_TIMER_DEACTIVATE, |
| 566 | psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER)); |
| 567 | tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 568 | pe_debug("Reset gLimAddtsSent flag and send addts timeout to SME"); |
Sreelakshmi Konamki | f76b407 | 2017-03-01 10:41:05 +0530 | [diff] [blame] | 569 | lim_process_sme_addts_rsp_timeout(pMac, |
| 570 | pMac->lim.gLimAddtsRspTimerCount); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | if (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE) { |
| 574 | lim_deactivate_and_change_per_sta_id_timer(pMac, eLIM_CNF_WAIT_TIMER, |
| 575 | pStaDs->assocId); |
| 576 | |
| 577 | if (!pStaDs->mlmStaContext.updateContext) { |
| 578 | /** |
| 579 | * There is no context at Polaris to delete. |
| 580 | * Release our assigned AID back to the free pool |
| 581 | */ |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 582 | if (LIM_IS_AP_ROLE(psessionEntry)) { |
Kai Liu | ffd2bb7 | 2016-09-29 00:08:55 +0800 | [diff] [blame] | 583 | lim_del_sta(pMac, pStaDs, false, psessionEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 584 | lim_release_peer_idx(pMac, pStaDs->assocId, |
| 585 | psessionEntry); |
| 586 | } |
| 587 | lim_delete_dph_hash_entry(pMac, pStaDs->staAddr, |
| 588 | pStaDs->assocId, psessionEntry); |
| 589 | |
| 590 | return retCode; |
| 591 | } |
| 592 | } |
| 593 | /* delete all tspecs associated with this sta. */ |
| 594 | lim_admit_control_delete_sta(pMac, pStaDs->assocId); |
| 595 | |
| 596 | /** |
| 597 | * Make STA hash entry invalid at eCPU so that DPH |
| 598 | * does not process any more data packets and |
| 599 | * releases those BDs |
| 600 | */ |
| 601 | pStaDs->valid = 0; |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 602 | lim_send_sme_tsm_ie_ind(pMac, psessionEntry, 0, 0, 0); |
| 603 | /* Any roaming related changes should be above this line */ |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 604 | if (lim_is_roam_synch_in_progress(psessionEntry)) |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 605 | return eSIR_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 606 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 607 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 608 | if (LIM_IS_STA_ROLE(psessionEntry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 609 | MTRACE(mac_trace |
| 610 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 611 | eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
| 612 | psessionEntry->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 613 | /* Deactivating probe after heart beat timer */ |
| 614 | lim_deactivate_and_change_timer(pMac, eLIM_PROBE_AFTER_HB_TIMER); |
| 615 | lim_deactivate_and_change_timer(pMac, eLIM_JOIN_FAIL_TIMER); |
| 616 | pMac->lim.gLastBeaconDtimCount = 0; |
| 617 | pMac->lim.gLastBeaconDtimPeriod = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 618 | } |
| 619 | #ifdef WLAN_DEBUG |
| 620 | /* increment a debug count */ |
| 621 | pMac->lim.gLimNumRxCleanup++; |
| 622 | #endif |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 623 | /* Do DEL BSS or DEL STA only if ADD BSS was success */ |
| 624 | if (!psessionEntry->add_bss_failed) { |
| 625 | if (psessionEntry->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) { |
| 626 | retCode = |
| 627 | lim_del_bss(pMac, pStaDs, psessionEntry->bssIdx, |
| 628 | psessionEntry); |
| 629 | } else |
| 630 | retCode = lim_del_sta(pMac, |
| 631 | pStaDs, true, psessionEntry); |
| 632 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 633 | |
| 634 | return retCode; |
| 635 | |
| 636 | } /*** end lim_cleanup_rx_path() ***/ |
| 637 | |
| 638 | /** |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 639 | * lim_send_del_sta_cnf() - Send Del sta confirmation |
| 640 | * @pMac: Pointer to Global MAC structure |
| 641 | * @sta_dsaddr: sta ds address |
| 642 | * @staDsAssocId: sta ds association id |
| 643 | * @mlmStaContext: MLM station context |
| 644 | * @statusCode: Status code |
| 645 | * @psessionEntry: Session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 646 | * |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 647 | * This function is called to send appropriate CNF message to SME. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 648 | * |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 649 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 650 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 651 | void |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 652 | lim_send_del_sta_cnf(tpAniSirGlobal pMac, struct qdf_mac_addr sta_dsaddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 653 | uint16_t staDsAssocId, tLimMlmStaContext mlmStaContext, |
| 654 | tSirResultCodes statusCode, tpPESession psessionEntry) |
| 655 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 656 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 657 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 658 | tLimMlmPurgeStaInd mlmPurgeStaInd; |
| 659 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 660 | pe_debug("Sessionid: %d staDsAssocId: %d Trigger: %d statusCode: %d sta_dsaddr: "MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 661 | psessionEntry->peSessionId, staDsAssocId, |
| 662 | mlmStaContext.cleanupTrigger, statusCode, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 663 | MAC_ADDR_ARRAY(sta_dsaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 664 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 665 | if (LIM_IS_STA_ROLE(psessionEntry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 666 | /* Set BSSID at CFG to null */ |
| 667 | tSirMacAddr nullAddr = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 668 | |
| 669 | sir_copy_mac_addr(nullAddr, psessionEntry->bssId); |
| 670 | |
| 671 | /* Free up buffer allocated for JoinReq held by */ |
| 672 | /* MLM state machine */ |
| 673 | if (psessionEntry->pLimMlmJoinReq) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 674 | qdf_mem_free(psessionEntry->pLimMlmJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 675 | psessionEntry->pLimMlmJoinReq = NULL; |
| 676 | } |
| 677 | |
| 678 | psessionEntry->limAID = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | if ((mlmStaContext.cleanupTrigger == |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 682 | eLIM_HOST_DISASSOC) || |
| 683 | (mlmStaContext.cleanupTrigger == |
| 684 | eLIM_LINK_MONITORING_DISASSOC) || |
| 685 | (mlmStaContext.cleanupTrigger == |
| 686 | eLIM_PROMISCUOUS_MODE_DISASSOC)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 687 | /** |
| 688 | * Host or LMM driven Disassociation. |
| 689 | * Issue Disassoc Confirm to SME. |
| 690 | */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 691 | pe_debug("Lim Posting DISASSOC_CNF to Sme. Trigger: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 692 | mlmStaContext.cleanupTrigger); |
| 693 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 694 | qdf_mem_copy((uint8_t *) &mlmDisassocCnf.peerMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 695 | (uint8_t *) sta_dsaddr.bytes, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 696 | mlmDisassocCnf.resultCode = statusCode; |
| 697 | mlmDisassocCnf.disassocTrigger = mlmStaContext.cleanupTrigger; |
| 698 | /* Update PE session Id */ |
| 699 | mlmDisassocCnf.sessionId = psessionEntry->peSessionId; |
| 700 | |
| 701 | lim_post_sme_message(pMac, |
| 702 | LIM_MLM_DISASSOC_CNF, |
| 703 | (uint32_t *) &mlmDisassocCnf); |
| 704 | } else if ((mlmStaContext.cleanupTrigger == |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 705 | eLIM_HOST_DEAUTH) || |
| 706 | (mlmStaContext.cleanupTrigger == |
| 707 | eLIM_LINK_MONITORING_DEAUTH)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 708 | /** |
| 709 | * Host or LMM driven Deauthentication. |
| 710 | * Issue Deauth Confirm to SME. |
| 711 | */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 712 | pe_debug("Lim Posting DEAUTH_CNF to Sme. Trigger: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 713 | mlmStaContext.cleanupTrigger); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 714 | qdf_copy_macaddr(&mlmDeauthCnf.peer_macaddr, &sta_dsaddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 715 | mlmDeauthCnf.resultCode = statusCode; |
| 716 | mlmDeauthCnf.deauthTrigger = mlmStaContext.cleanupTrigger; |
| 717 | /* PE session Id */ |
| 718 | mlmDeauthCnf.sessionId = psessionEntry->peSessionId; |
| 719 | |
| 720 | lim_post_sme_message(pMac, |
| 721 | LIM_MLM_DEAUTH_CNF, |
| 722 | (uint32_t *) &mlmDeauthCnf); |
| 723 | } else if ((mlmStaContext.cleanupTrigger == |
| 724 | eLIM_PEER_ENTITY_DISASSOC) || |
| 725 | (mlmStaContext.cleanupTrigger == eLIM_PEER_ENTITY_DEAUTH)) { |
| 726 | /** |
| 727 | * Received Disassociation/Deauthentication from peer. |
| 728 | * Issue Purge Ind to SME. |
| 729 | */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 730 | pe_debug("Lim Posting PURGE_STA_IND to Sme. Trigger: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 731 | mlmStaContext.cleanupTrigger); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 732 | qdf_mem_copy((uint8_t *) &mlmPurgeStaInd.peerMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 733 | (uint8_t *) sta_dsaddr.bytes, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 734 | mlmPurgeStaInd.reasonCode = |
| 735 | (uint8_t) mlmStaContext.disassocReason; |
| 736 | mlmPurgeStaInd.aid = staDsAssocId; |
| 737 | mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger; |
| 738 | mlmPurgeStaInd.sessionId = psessionEntry->peSessionId; |
| 739 | |
| 740 | lim_post_sme_message(pMac, |
| 741 | LIM_MLM_PURGE_STA_IND, |
| 742 | (uint32_t *) &mlmPurgeStaInd); |
| 743 | } else if (mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE) { |
| 744 | /* PE setup the peer entry in HW upfront, right after join is completed. */ |
| 745 | /* If there is a failure during rest of the assoc sequence, this context needs to be cleaned up. */ |
| 746 | uint8_t smesessionId; |
| 747 | uint16_t smetransactionId; |
| 748 | |
| 749 | smesessionId = psessionEntry->smeSessionId; |
| 750 | smetransactionId = psessionEntry->transactionId; |
| 751 | |
| 752 | psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
| 753 | MTRACE(mac_trace |
| 754 | (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, |
| 755 | psessionEntry->limSmeState)); |
| 756 | |
| 757 | /* if it is a reassoc failure to join new AP */ |
| 758 | if ((mlmStaContext.resultCode == |
| 759 | eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) |
| 760 | || (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE) |
| 761 | || (mlmStaContext.resultCode == |
| 762 | eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 763 | pe_debug("Lim Posting eWNI_SME_REASSOC_RSP to SME" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 764 | "resultCode: %d, statusCode: %d," |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 765 | "sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 766 | mlmStaContext.resultCode, |
| 767 | mlmStaContext.protStatusCode, |
| 768 | psessionEntry->peSessionId); |
| 769 | |
| 770 | if (mlmStaContext.resultCode != eSIR_SME_SUCCESS) { |
| 771 | pe_delete_session(pMac, psessionEntry); |
| 772 | psessionEntry = NULL; |
| 773 | } |
| 774 | |
| 775 | lim_send_sme_join_reassoc_rsp(pMac, eWNI_SME_REASSOC_RSP, |
| 776 | mlmStaContext.resultCode, |
| 777 | mlmStaContext.protStatusCode, |
| 778 | psessionEntry, smesessionId, |
| 779 | smetransactionId); |
| 780 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 781 | qdf_mem_free(psessionEntry->pLimJoinReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 782 | psessionEntry->pLimJoinReq = NULL; |
| 783 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 784 | pe_debug("Lim Posting eWNI_SME_JOIN_RSP to SME." |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 785 | "resultCode: %d,statusCode: %d," |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 786 | "sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 787 | mlmStaContext.resultCode, |
| 788 | mlmStaContext.protStatusCode, |
| 789 | psessionEntry->peSessionId); |
| 790 | |
| 791 | if (mlmStaContext.resultCode != eSIR_SME_SUCCESS) { |
| 792 | pe_delete_session(pMac, psessionEntry); |
| 793 | psessionEntry = NULL; |
| 794 | } |
| 795 | |
| 796 | lim_send_sme_join_reassoc_rsp(pMac, eWNI_SME_JOIN_RSP, |
| 797 | mlmStaContext.resultCode, |
| 798 | mlmStaContext.protStatusCode, |
| 799 | psessionEntry, smesessionId, |
| 800 | smetransactionId); |
| 801 | } |
| 802 | |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 803 | } else if (mlmStaContext.cleanupTrigger == eLIM_DUPLICATE_ENTRY) { |
| 804 | /** |
| 805 | * LIM driven Disassociation. |
| 806 | * Issue Disassoc Confirm to SME. |
| 807 | */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 808 | pe_debug("Lim Posting DISASSOC_CNF to Sme. Trigger: %d", |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 809 | mlmStaContext.cleanupTrigger); |
| 810 | |
| 811 | qdf_mem_copy((uint8_t *) &mlmDisassocCnf.peerMacAddr, |
| 812 | (uint8_t *) sta_dsaddr.bytes, QDF_MAC_ADDR_SIZE); |
| 813 | mlmDisassocCnf.resultCode = statusCode; |
| 814 | mlmDisassocCnf.disassocTrigger = eLIM_DUPLICATE_ENTRY; |
| 815 | /* Update PE session Id */ |
| 816 | mlmDisassocCnf.sessionId = psessionEntry->peSessionId; |
| 817 | |
| 818 | lim_post_sme_message(pMac, |
| 819 | LIM_MLM_DISASSOC_CNF, |
| 820 | (uint32_t *) &mlmDisassocCnf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 821 | } |
| 822 | |
| 823 | if (NULL != psessionEntry && !LIM_IS_AP_ROLE(psessionEntry)) { |
| 824 | pe_delete_session(pMac, psessionEntry); |
| 825 | psessionEntry = NULL; |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | /** |
| 830 | * lim_reject_association() - function to reject Re/Association Request |
| 831 | * |
| 832 | * @mac_ctx: pointer to global mac structure |
| 833 | * @peer_addr: mac address of the peer |
| 834 | * @sub_type: Indicates whether it is Association Request (=0) or |
| 835 | * Reassociation Request (=1) frame |
| 836 | * @add_pre_auth_context:Indicates whether pre-auth context |
| 837 | * to be added for this STA |
| 838 | * @auth_type: Indicates auth type to be added |
| 839 | * @sta_id: Indicates staId of the STA being rejected |
| 840 | * association |
| 841 | * @delete_sta: Indicates whether to delete STA context |
| 842 | * at Polaris |
| 843 | * @result_code: Indicates what reasonCode to be sent in |
| 844 | * Re/Assoc response to STA |
| 845 | * @session_entry: pointer to PE session |
| 846 | * |
| 847 | * This function is called whenever Re/Association Request need |
| 848 | * to be rejected due to failure in assigning an AID or failure |
| 849 | * in adding STA context at Polaris or reject by applications. |
| 850 | * Resources allocated if any are freedup and (Re) Association |
| 851 | * Response frame is sent to requesting STA. Pre-Auth context |
| 852 | * will be added for this STA if it does not exist already |
| 853 | * |
| 854 | * Return: none |
| 855 | */ |
| 856 | |
| 857 | void |
| 858 | lim_reject_association(tpAniSirGlobal mac_ctx, tSirMacAddr peer_addr, |
| 859 | uint8_t sub_type, uint8_t add_pre_auth_context, |
| 860 | tAniAuthType auth_type, uint16_t sta_id, |
| 861 | uint8_t delete_sta, tSirResultCodes result_code, |
| 862 | tpPESession session_entry) |
| 863 | { |
| 864 | tpDphHashNode sta_ds; |
| 865 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 866 | pe_debug("Sessionid: %d auth_type: %d sub_type: %d add_pre_auth_context: %d sta_id: %d delete_sta: %d result_code : %d peer_addr: " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 867 | session_entry->peSessionId, auth_type, sub_type, |
| 868 | add_pre_auth_context, sta_id, delete_sta, result_code, |
| 869 | MAC_ADDR_ARRAY(peer_addr)); |
| 870 | |
| 871 | if (add_pre_auth_context) { |
| 872 | /* Create entry for this STA in pre-auth list */ |
| 873 | struct tLimPreAuthNode *auth_node; |
| 874 | |
| 875 | auth_node = lim_acquire_free_pre_auth_node(mac_ctx, |
| 876 | &mac_ctx->lim.gLimPreAuthTimerTable); |
| 877 | |
| 878 | if (auth_node) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 879 | qdf_mem_copy((uint8_t *) auth_node->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 880 | peer_addr, sizeof(tSirMacAddr)); |
| 881 | auth_node->fTimerStarted = 0; |
| 882 | auth_node->mlmState = eLIM_MLM_AUTHENTICATED_STATE; |
| 883 | auth_node->authType = (tAniAuthType) auth_type; |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 884 | auth_node->timestamp = qdf_mc_timer_get_system_ticks(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 885 | lim_add_pre_auth_node(mac_ctx, auth_node); |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | if (delete_sta == false) { |
| 890 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, |
| 891 | eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS, |
| 892 | 1, peer_addr, sub_type, 0, session_entry); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 893 | pe_warn("received Re/Assoc req when max associated STAs reached from"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 894 | lim_print_mac_addr(mac_ctx, peer_addr, LOGW); |
| 895 | lim_send_sme_max_assoc_exceeded_ntf(mac_ctx, peer_addr, |
| 896 | session_entry->smeSessionId); |
| 897 | return; |
| 898 | } |
| 899 | |
| 900 | sta_ds = dph_get_hash_entry(mac_ctx, sta_id, |
| 901 | &session_entry->dph.dphHashTable); |
| 902 | |
| 903 | if (sta_ds == NULL) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 904 | pe_err("No STA context, yet rejecting Association"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 905 | return; |
| 906 | } |
| 907 | |
| 908 | /* |
| 909 | * Polaris has state for this STA. |
| 910 | * Trigger cleanup. |
| 911 | */ |
| 912 | sta_ds->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT; |
| 913 | |
| 914 | /* Receive path cleanup */ |
| 915 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
| 916 | |
| 917 | /* |
| 918 | * Send Re/Association Response with |
| 919 | * status code to requesting STA. |
| 920 | */ |
| 921 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, result_code, 0, peer_addr, |
| 922 | sub_type, 0, session_entry); |
| 923 | |
| 924 | if (session_entry->parsedAssocReq[sta_ds->assocId] != NULL) { |
| 925 | uint8_t *assoc_req_frame; |
| 926 | |
| 927 | assoc_req_frame = (uint8_t *)((tpSirAssocReq) (session_entry-> |
| 928 | parsedAssocReq[sta_ds->assocId]))->assocReqFrame; |
| 929 | /* |
| 930 | *Assoction confirmation is complete, |
| 931 | *free the copy of association request frame. |
| 932 | */ |
| 933 | if (assoc_req_frame) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 934 | qdf_mem_free(assoc_req_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | assoc_req_frame = NULL; |
| 936 | } |
| 937 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 938 | qdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 939 | session_entry->parsedAssocReq[sta_ds->assocId] = NULL; |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | /** |
| 944 | * lim_decide_ap_protection_on_ht20_delete() - function to update protection |
| 945 | * parameters. |
| 946 | * @mac_ctx: pointer to global mac structure |
| 947 | * @sta_ds: station node |
| 948 | * @beacon_params: ap beacon parameters |
| 949 | * @session_entry: pe session entry |
| 950 | * |
| 951 | * protection related function while HT20 station is getting deleted. |
| 952 | * |
| 953 | * Return: none |
| 954 | */ |
| 955 | static void |
| 956 | lim_decide_ap_protection_on_ht20_delete(tpAniSirGlobal mac_ctx, |
| 957 | tpDphHashNode sta_ds, |
| 958 | tpUpdateBeaconParams beacon_params, |
| 959 | tpPESession session_entry) |
| 960 | { |
| 961 | uint32_t i = 0; |
| 962 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 963 | pe_debug("(%d) A HT 20 STA is disassociated. Addr is %pM", |
| 964 | session_entry->gLimHt20Params.numSta, sta_ds->staAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | |
| 966 | if (session_entry->gLimHt20Params.numSta > 0) { |
| 967 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 968 | if (!session_entry->protStaCache[i].active) |
| 969 | continue; |
| 970 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 971 | if (!qdf_mem_cmp(session_entry->protStaCache[i].addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 972 | sta_ds->staAddr, sizeof(tSirMacAddr))) { |
| 973 | session_entry->gLimHt20Params.numSta--; |
| 974 | session_entry->protStaCache[i].active = |
| 975 | false; |
| 976 | break; |
| 977 | } |
| 978 | } |
| 979 | } |
| 980 | |
| 981 | if (session_entry->gLimHt20Params.numSta == 0) { |
| 982 | /* disable protection */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 983 | pe_debug("No 11B STA exists, PESessionID %d", |
| 984 | session_entry->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 985 | lim_enable_ht20_protection(mac_ctx, false, false, beacon_params, |
| 986 | session_entry); |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | /** |
| 991 | * lim_decide_ap_protection_on_delete() - update SAP protection on station |
| 992 | * deletion. |
| 993 | * @mac_ctx: pointer to global mac structure |
| 994 | * @sta_ds: station node |
| 995 | * @beacon_params: ap beacon parameters |
| 996 | * @session_entry: pe session entry |
| 997 | * |
| 998 | * Decides about protection related settings when a station is getting deleted. |
| 999 | * |
| 1000 | * Return: none |
| 1001 | */ |
| 1002 | void |
| 1003 | lim_decide_ap_protection_on_delete(tpAniSirGlobal mac_ctx, |
| 1004 | tpDphHashNode sta_ds, |
| 1005 | tpUpdateBeaconParams beacon_params, |
| 1006 | tpPESession session_entry) |
| 1007 | { |
| 1008 | uint32_t phy_mode; |
| 1009 | tHalBitVal erp_enabled = eHAL_CLEAR; |
| 1010 | tSirRFBand rf_band = SIR_BAND_UNKNOWN; |
| 1011 | uint32_t i; |
| 1012 | |
| 1013 | if (NULL == sta_ds) |
| 1014 | return; |
| 1015 | |
| 1016 | lim_get_rf_band_new(mac_ctx, &rf_band, session_entry); |
| 1017 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 1018 | erp_enabled = sta_ds->erpEnabled; |
| 1019 | |
| 1020 | if ((SIR_BAND_5_GHZ == rf_band) && |
| 1021 | (true == session_entry->htCapability) && |
| 1022 | (session_entry->beaconParams.llaCoexist) && |
| 1023 | (false == sta_ds->mlmStaContext.htCapability)) { |
| 1024 | /* |
| 1025 | * we are HT. if we are 11A, then protection is not required or |
| 1026 | * we are HT and 11A station is leaving. |
| 1027 | * protection consideration required. |
| 1028 | * HT station leaving ==> this case is commonly handled |
| 1029 | * between both the bands below. |
| 1030 | */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1031 | pe_debug("(%d) A 11A STA is disassociated. Addr is %pM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1032 | session_entry->gLim11aParams.numSta, sta_ds->staAddr); |
| 1033 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1034 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1035 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1036 | session_entry->protStaCache[i].addr, |
| 1037 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1038 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | session_entry->protStaCache[i].active = false; |
| 1040 | break; |
| 1041 | } |
| 1042 | } |
| 1043 | |
| 1044 | if (session_entry->gLim11aParams.numSta == 0) { |
| 1045 | /* disable protection */ |
| 1046 | lim_update_11a_protection(mac_ctx, false, false, |
| 1047 | beacon_params, session_entry); |
| 1048 | } |
| 1049 | } |
| 1050 | |
| 1051 | /* we are HT or 11G and 11B station is getting deleted */ |
| 1052 | if ((SIR_BAND_2_4_GHZ == rf_band) && |
| 1053 | (phy_mode == WNI_CFG_PHY_MODE_11G || |
| 1054 | session_entry->htCapability) && |
| 1055 | (erp_enabled == eHAL_CLEAR)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1056 | pe_debug("(%d) A legacy STA is disassociated. Addr is %pM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1057 | session_entry->gLim11bParams.numSta, sta_ds->staAddr); |
| 1058 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1059 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1060 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1061 | session_entry->protStaCache[i].addr, |
| 1062 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1063 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1064 | session_entry->gLim11bParams.numSta--; |
| 1065 | session_entry->protStaCache[i].active = |
| 1066 | false; |
| 1067 | break; |
| 1068 | } |
| 1069 | } |
| 1070 | |
| 1071 | if (session_entry->gLim11bParams.numSta == 0) { |
| 1072 | /* disable protection */ |
| 1073 | lim_enable11g_protection(mac_ctx, false, false, |
| 1074 | beacon_params, session_entry); |
| 1075 | } |
| 1076 | } |
| 1077 | |
| 1078 | /* |
| 1079 | * we are HT AP and non-11B station is leaving. |
| 1080 | * 11g station is leaving |
| 1081 | */ |
| 1082 | if ((SIR_BAND_2_4_GHZ == rf_band) && |
| 1083 | session_entry->htCapability && |
| 1084 | !sta_ds->mlmStaContext.htCapability) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1085 | pe_debug("(%d) A 11g STA is disassociated. Addr is %pM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1086 | session_entry->gLim11bParams.numSta, sta_ds->staAddr); |
| 1087 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1088 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1089 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | session_entry->protStaCache[i].addr, |
| 1091 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1092 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1093 | session_entry->gLim11gParams.numSta--; |
| 1094 | session_entry->protStaCache[i].active = false; |
| 1095 | break; |
| 1096 | } |
| 1097 | } |
| 1098 | |
| 1099 | if (session_entry->gLim11gParams.numSta == 0) { |
| 1100 | /* disable protection */ |
| 1101 | lim_enable_ht_protection_from11g(mac_ctx, false, false, |
| 1102 | beacon_params, |
| 1103 | session_entry); |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | if (!((true == session_entry->htCapability) && |
| 1108 | (true == sta_ds->mlmStaContext.htCapability))) |
| 1109 | return; |
| 1110 | |
| 1111 | /* |
| 1112 | * Applies to 2.4 as well as 5 GHZ. |
| 1113 | * HT non-GF leaving |
| 1114 | */ |
| 1115 | if (!sta_ds->htGreenfield) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1116 | pe_debug("(%d) A non-GF STA is disassociated. Addr is %pM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1117 | session_entry->gLimNonGfParams.numSta, sta_ds->staAddr); |
| 1118 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1119 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1120 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1121 | session_entry->protStaCache[i].addr, |
| 1122 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1123 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1124 | session_entry->protStaCache[i].active = false; |
| 1125 | break; |
| 1126 | } |
| 1127 | } |
| 1128 | |
| 1129 | if (session_entry->gLimNonGfParams.numSta == 0) { |
| 1130 | /* disable protection */ |
| 1131 | lim_enable_ht_non_gf_protection(mac_ctx, false, false, |
| 1132 | beacon_params, session_entry); |
| 1133 | } |
| 1134 | } |
| 1135 | |
| 1136 | /* |
| 1137 | * Applies to 2.4 as well as 5 GHZ. |
| 1138 | * HT 20Mhz station leaving |
| 1139 | */ |
| 1140 | if (session_entry->beaconParams.ht20Coexist && |
| 1141 | (eHT_CHANNEL_WIDTH_20MHZ == |
| 1142 | sta_ds->htSupportedChannelWidthSet)) { |
| 1143 | lim_decide_ap_protection_on_ht20_delete(mac_ctx, sta_ds, |
| 1144 | beacon_params, session_entry); |
| 1145 | } |
| 1146 | |
| 1147 | /* |
| 1148 | * Applies to 2.4 as well as 5 GHZ. |
| 1149 | * LSIG TXOP not supporting staiton leaving |
| 1150 | */ |
| 1151 | if ((false == session_entry->beaconParams. |
| 1152 | fLsigTXOPProtectionFullSupport) && |
| 1153 | (false == sta_ds->htLsigTXOPProtection)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1154 | pe_debug("(%d) A HT LSIG not supporting STA is disassociated. Addr is %pM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1155 | session_entry->gLimLsigTxopParams.numSta, |
| 1156 | sta_ds->staAddr); |
| 1157 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1158 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1159 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1160 | session_entry->protStaCache[i].addr, |
| 1161 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1162 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1163 | session_entry->protStaCache[i].active = false; |
| 1164 | break; |
| 1165 | } |
| 1166 | } |
| 1167 | |
| 1168 | if (session_entry->gLimLsigTxopParams.numSta == 0) { |
| 1169 | /* disable protection */ |
| 1170 | lim_enable_ht_lsig_txop_protection(mac_ctx, true, |
| 1171 | false, beacon_params, session_entry); |
| 1172 | } |
| 1173 | } |
| 1174 | } |
| 1175 | |
| 1176 | /** |
| 1177 | * lim_decide_short_preamble() - update short preamble parameters |
| 1178 | * @mac_ctx: pointer to global mac structure |
| 1179 | * @sta_ds: station node |
| 1180 | * @beacon_params: ap beacon parameters |
| 1181 | * @session_entry: pe session entry |
| 1182 | * |
| 1183 | * Decides about any short preamble related change because of new station |
| 1184 | * joining. |
| 1185 | * |
| 1186 | * Return: None |
| 1187 | */ |
Jeff Johnson | 72c8e7c | 2016-10-06 18:43:52 -0700 | [diff] [blame] | 1188 | static void lim_decide_short_preamble(tpAniSirGlobal mac_ctx, |
| 1189 | tpDphHashNode sta_ds, |
| 1190 | tpUpdateBeaconParams beacon_params, |
| 1191 | tpPESession session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1192 | { |
| 1193 | uint32_t i; |
| 1194 | |
| 1195 | if (sta_ds->shortPreambleEnabled == eHAL_CLEAR) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1196 | pe_debug("(%d) A non-short preamble STA is disassociated. Addr is %pM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1197 | session_entry->gLimNoShortParams.numNonShortPreambleSta, |
| 1198 | sta_ds->staAddr); |
| 1199 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1200 | if (session_entry->gLimNoShortParams. |
| 1201 | staNoShortCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1202 | (!qdf_mem_cmp(session_entry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1203 | gLimNoShortParams. |
| 1204 | staNoShortCache[i].addr, |
| 1205 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1206 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1207 | session_entry->gLimNoShortParams. |
| 1208 | numNonShortPreambleSta--; |
| 1209 | session_entry->gLimNoShortParams. |
| 1210 | staNoShortCache[i].active = false; |
| 1211 | break; |
| 1212 | } |
| 1213 | } |
| 1214 | |
| 1215 | if (session_entry->gLimNoShortParams.numNonShortPreambleSta) |
| 1216 | return; |
| 1217 | |
| 1218 | /* |
| 1219 | * enable short preamble |
| 1220 | * reset the cache |
| 1221 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1222 | qdf_mem_set((uint8_t *) &session_entry->gLimNoShortParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1223 | sizeof(tLimNoShortParams), 0); |
| 1224 | if (lim_enable_short_preamble(mac_ctx, true, |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1225 | beacon_params, session_entry) != eSIR_SUCCESS) |
| 1226 | pe_err("Cannot enable short preamble"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1227 | } |
| 1228 | } |
| 1229 | |
| 1230 | /** |
| 1231 | * lim_decide_short_slot() - update short slot time related parameters |
| 1232 | * @mac_ctx: pointer to global mac structure |
| 1233 | * @sta_ds: station node |
| 1234 | * @beacon_params: ap beacon parameters |
| 1235 | * @session_entry: pe session entry |
| 1236 | * |
| 1237 | * Decides about any short slot time related change because of station leaving |
| 1238 | * the BSS. |
| 1239 | * Return: None |
| 1240 | */ |
Jeff Johnson | 72c8e7c | 2016-10-06 18:43:52 -0700 | [diff] [blame] | 1241 | static void |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1242 | lim_decide_short_slot(tpAniSirGlobal mac_ctx, tpDphHashNode sta_ds, |
| 1243 | tpUpdateBeaconParams beacon_params, |
| 1244 | tpPESession session_entry) |
| 1245 | { |
| 1246 | uint32_t i, val, non_short_slot_sta_count; |
| 1247 | |
| 1248 | if (sta_ds->shortSlotTimeEnabled != eHAL_CLEAR) |
| 1249 | return; |
| 1250 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1251 | pe_debug("(%d) A non-short slottime STA is disassociated. Addr is %pM", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1252 | mac_ctx->lim.gLimNoShortSlotParams.numNonShortSlotSta, |
| 1253 | sta_ds->staAddr); |
| 1254 | |
| 1255 | wlan_cfg_get_int(mac_ctx, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, |
| 1256 | &val); |
| 1257 | |
| 1258 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 1259 | non_short_slot_sta_count = |
| 1260 | session_entry->gLimNoShortSlotParams.numNonShortSlotSta; |
| 1261 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1262 | if (session_entry->gLimNoShortSlotParams. |
| 1263 | staNoShortSlotCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1264 | (!qdf_mem_cmp(session_entry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1265 | gLimNoShortSlotParams. |
| 1266 | staNoShortSlotCache[i].addr, |
| 1267 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1268 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1269 | non_short_slot_sta_count--; |
| 1270 | session_entry->gLimNoShortSlotParams. |
| 1271 | staNoShortSlotCache[i].active = false; |
| 1272 | break; |
| 1273 | } |
| 1274 | } |
| 1275 | |
| 1276 | if (non_short_slot_sta_count == 0 && val) { |
| 1277 | /* |
| 1278 | * enable short slot time |
| 1279 | * reset the cache |
| 1280 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1281 | qdf_mem_set((uint8_t *) &session_entry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1282 | gLimNoShortSlotParams, |
| 1283 | sizeof(tLimNoShortSlotParams), 0); |
| 1284 | beacon_params->fShortSlotTime = true; |
| 1285 | beacon_params->paramChangeBitmap |= |
| 1286 | PARAM_SHORT_SLOT_TIME_CHANGED; |
| 1287 | session_entry->shortSlotTimeSupported = true; |
| 1288 | } |
| 1289 | session_entry->gLimNoShortSlotParams.numNonShortSlotSta = |
| 1290 | non_short_slot_sta_count; |
| 1291 | } else { |
| 1292 | non_short_slot_sta_count = |
| 1293 | mac_ctx->lim.gLimNoShortSlotParams.numNonShortSlotSta; |
| 1294 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1295 | if (mac_ctx->lim.gLimNoShortSlotParams. |
| 1296 | staNoShortSlotCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1297 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1298 | mac_ctx->lim.gLimNoShortSlotParams. |
| 1299 | staNoShortSlotCache[i].addr, |
| 1300 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1301 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1302 | non_short_slot_sta_count--; |
| 1303 | mac_ctx->lim.gLimNoShortSlotParams. |
| 1304 | staNoShortSlotCache[i].active = false; |
| 1305 | break; |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | if (val && !non_short_slot_sta_count) { |
| 1310 | /* |
| 1311 | * enable short slot time |
| 1312 | * reset the cache |
| 1313 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1314 | qdf_mem_set( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | (uint8_t *) &mac_ctx->lim.gLimNoShortSlotParams, |
| 1316 | sizeof(tLimNoShortSlotParams), 0); |
| 1317 | /*in case of AP set SHORT_SLOT_TIME to enable*/ |
| 1318 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 1319 | beacon_params->fShortSlotTime = true; |
| 1320 | beacon_params->paramChangeBitmap |= |
| 1321 | PARAM_SHORT_SLOT_TIME_CHANGED; |
| 1322 | session_entry->shortSlotTimeSupported = true; |
| 1323 | } |
| 1324 | } |
| 1325 | mac_ctx->lim.gLimNoShortSlotParams.numNonShortSlotSta = |
| 1326 | non_short_slot_sta_count; |
| 1327 | } |
| 1328 | } |
| 1329 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1330 | /** |
| 1331 | * lim_populate_vht_mcs_set - function to populate vht mcs rate set |
| 1332 | * @mac_ctx: pointer to global mac structure |
| 1333 | * @rates: pointer to supported rate set |
| 1334 | * @peer_vht_caps: pointer to peer vht capabilities |
| 1335 | * @session_entry: pe session entry |
| 1336 | * |
| 1337 | * Populates vht mcs rate set based on peer and self capabilities |
| 1338 | * |
| 1339 | * Return: eSIR_SUCCESS on success else eSIR_FAILURE |
| 1340 | */ |
| 1341 | tSirRetStatus lim_populate_vht_mcs_set(tpAniSirGlobal mac_ctx, |
| 1342 | tpSirSupportedRates rates, |
| 1343 | tDot11fIEVHTCaps *peer_vht_caps, |
Kiran Kumar Lokere | 6671abd | 2016-05-02 19:36:19 -0700 | [diff] [blame] | 1344 | tpPESession session_entry, |
| 1345 | uint8_t nss) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1346 | { |
| 1347 | uint32_t val; |
| 1348 | uint32_t self_sta_dot11mode = 0; |
| 1349 | uint16_t mcs_map_mask = MCSMAPMASK1x1; |
| 1350 | uint16_t mcs_map_mask2x2 = 0; |
| 1351 | |
| 1352 | wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &self_sta_dot11mode); |
| 1353 | |
| 1354 | if (!IS_DOT11_MODE_VHT(self_sta_dot11mode)) |
| 1355 | return eSIR_SUCCESS; |
| 1356 | |
| 1357 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_RX_MCS_MAP, &val) != |
| 1358 | eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1359 | pe_err("could not retrieve VHT RX MCS MAP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1360 | goto error; |
| 1361 | } |
| 1362 | rates->vhtRxMCSMap = (uint16_t) val; |
| 1363 | |
| 1364 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_VHT_TX_MCS_MAP, &val) != |
| 1365 | eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1366 | pe_err("could not retrieve VHT TX MCS MAP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1367 | goto error; |
| 1368 | } |
| 1369 | rates->vhtTxMCSMap = (uint16_t) val; |
| 1370 | |
| 1371 | if (wlan_cfg_get_int(mac_ctx, |
| 1372 | WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE, |
| 1373 | &val) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1374 | pe_err("couldn't retrieve VHT RX Supported data rate MAP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1375 | goto error; |
| 1376 | } |
| 1377 | rates->vhtRxHighestDataRate = (uint16_t) val; |
| 1378 | |
| 1379 | if (wlan_cfg_get_int(mac_ctx, |
| 1380 | WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE, |
| 1381 | &val) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1382 | pe_err("couldn't retrieve VHT RX Supported data rate MAP"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1383 | goto error; |
| 1384 | } |
| 1385 | rates->vhtTxHighestDataRate = (uint16_t) val; |
| 1386 | |
Kiran Kumar Lokere | 6671abd | 2016-05-02 19:36:19 -0700 | [diff] [blame] | 1387 | if (NSS_1x1_MODE == nss) { |
| 1388 | rates->vhtRxMCSMap |= VHT_MCS_1x1; |
| 1389 | rates->vhtTxMCSMap |= VHT_MCS_1x1; |
| 1390 | rates->vhtTxHighestDataRate = |
| 1391 | VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_1_1; |
| 1392 | rates->vhtRxHighestDataRate = |
| 1393 | VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_1_1; |
| 1394 | } |
| 1395 | |
Archana Ramachandran | 5482d6a | 2016-03-29 17:09:22 -0700 | [diff] [blame] | 1396 | if ((peer_vht_caps == NULL) || (!peer_vht_caps->present)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1397 | return eSIR_SUCCESS; |
| 1398 | |
| 1399 | rates->vhtTxHighestDataRate = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1400 | QDF_MIN(rates->vhtTxHighestDataRate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1401 | peer_vht_caps->txSupDataRate); |
| 1402 | rates->vhtRxHighestDataRate = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1403 | QDF_MIN(rates->vhtRxHighestDataRate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | peer_vht_caps->rxHighSupDataRate); |
| 1405 | |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 1406 | if (session_entry && session_entry->nss == NSS_2x2_MODE) { |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 1407 | if (mac_ctx->lteCoexAntShare && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1408 | IS_24G_CH(session_entry->currentOperChannel)) { |
| 1409 | if (IS_2X2_CHAIN(session_entry->chainMask)) |
| 1410 | mcs_map_mask2x2 = MCSMAPMASK2x2; |
| 1411 | else |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1412 | pe_err("2x2 not enabled %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1413 | session_entry->chainMask); |
| 1414 | } else { |
| 1415 | mcs_map_mask2x2 = MCSMAPMASK2x2; |
| 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | if ((peer_vht_caps->txMCSMap & mcs_map_mask) < |
| 1420 | (rates->vhtRxMCSMap & mcs_map_mask)) { |
| 1421 | rates->vhtRxMCSMap &= ~(mcs_map_mask); |
| 1422 | rates->vhtRxMCSMap |= |
| 1423 | (peer_vht_caps->txMCSMap & mcs_map_mask); |
| 1424 | } |
| 1425 | if ((peer_vht_caps->rxMCSMap & mcs_map_mask) < |
| 1426 | (rates->vhtTxMCSMap & mcs_map_mask)) { |
| 1427 | rates->vhtTxMCSMap &= ~(mcs_map_mask); |
| 1428 | rates->vhtTxMCSMap |= |
| 1429 | (peer_vht_caps->rxMCSMap & mcs_map_mask); |
| 1430 | } |
| 1431 | |
| 1432 | if (mcs_map_mask2x2) { |
| 1433 | |
| 1434 | uint16_t peer_mcs_map, self_mcs_map; |
| 1435 | |
| 1436 | peer_mcs_map = |
| 1437 | peer_vht_caps->txMCSMap & mcs_map_mask2x2; |
| 1438 | self_mcs_map = |
| 1439 | rates->vhtRxMCSMap & mcs_map_mask2x2; |
| 1440 | |
| 1441 | if ((self_mcs_map != mcs_map_mask2x2) && |
| 1442 | ((peer_mcs_map == mcs_map_mask2x2) || |
| 1443 | (peer_mcs_map < self_mcs_map))) { |
| 1444 | rates->vhtRxMCSMap &= ~mcs_map_mask2x2; |
| 1445 | rates->vhtRxMCSMap |= peer_mcs_map; |
| 1446 | } |
| 1447 | |
| 1448 | peer_mcs_map = |
| 1449 | (peer_vht_caps->rxMCSMap & mcs_map_mask2x2); |
| 1450 | self_mcs_map = |
| 1451 | (rates->vhtTxMCSMap & mcs_map_mask2x2); |
| 1452 | |
| 1453 | if ((self_mcs_map != mcs_map_mask2x2) && |
| 1454 | ((peer_mcs_map == mcs_map_mask2x2) || |
| 1455 | (peer_mcs_map < self_mcs_map))) { |
| 1456 | rates->vhtTxMCSMap &= ~mcs_map_mask2x2; |
| 1457 | rates->vhtTxMCSMap |= peer_mcs_map; |
| 1458 | } |
| 1459 | } |
| 1460 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1461 | pe_debug("enable2x2 - %d nss %d vhtRxMCSMap - %x vhtTxMCSMap - %x", |
Kiran Kumar Lokere | 6671abd | 2016-05-02 19:36:19 -0700 | [diff] [blame] | 1462 | mac_ctx->roam.configParam.enable2x2, nss, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1463 | rates->vhtRxMCSMap, rates->vhtTxMCSMap); |
| 1464 | |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 1465 | if (NULL != session_entry) { |
| 1466 | session_entry->supported_nss_1x1 = |
| 1467 | ((rates->vhtTxMCSMap & VHT_MCS_1x1) == |
| 1468 | VHT_MCS_1x1) ? true : false; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1469 | pe_debug("VHT supported nss 1x1: %d", |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 1470 | session_entry->supported_nss_1x1); |
| 1471 | } |
| 1472 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1473 | return eSIR_SUCCESS; |
| 1474 | error: |
| 1475 | |
| 1476 | return eSIR_FAILURE; |
| 1477 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1478 | |
| 1479 | /** |
| 1480 | * lim_populate_own_rate_set() - comprises the basic and extended rates read |
| 1481 | * from CFG |
| 1482 | * @mac_ctx: pointer to global mac structure |
| 1483 | * @rates: pointer to supported rates |
| 1484 | * @supported_mcs_set: pointer to supported mcs rates |
| 1485 | * @basic_only: update only basic rates if set true |
| 1486 | * @session_entry: pe session entry |
| 1487 | * @vht_caps: pointer to vht capability |
| 1488 | * |
| 1489 | * This function is called by limProcessAssocRsp() or |
| 1490 | * lim_add_staInIBSS() |
| 1491 | * - It creates a combined rate set of 12 rates max which |
| 1492 | * comprises the basic and extended rates read from CFG |
| 1493 | * - It sorts the combined rate Set and copy it in the |
| 1494 | * rate array of the pSTA descriptor |
| 1495 | * - It sets the erpEnabled bit of the STA descriptor |
| 1496 | * ERP bit is set iff the dph PHY mode is 11G and there is at least |
| 1497 | * an A rate in the supported or extended rate sets |
| 1498 | * |
| 1499 | * Return: eSIR_SUCCESS or eSIR_FAILURE. |
| 1500 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1501 | tSirRetStatus |
| 1502 | lim_populate_own_rate_set(tpAniSirGlobal mac_ctx, |
| 1503 | tpSirSupportedRates rates, uint8_t *supported_mcs_set, |
| 1504 | uint8_t basic_only, tpPESession session_entry, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1505 | struct sDot11fIEVHTCaps *vht_caps, |
| 1506 | struct sDot11fIEvendor_he_cap *he_caps) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1507 | { |
| 1508 | tSirMacRateSet temp_rate_set; |
| 1509 | tSirMacRateSet temp_rate_set2; |
| 1510 | uint32_t i, j, val, min, is_arate; |
| 1511 | uint32_t phy_mode = 0; |
| 1512 | uint32_t self_sta_dot11mode = 0; |
| 1513 | uint8_t a_rate_index = 0; |
| 1514 | uint8_t b_rate_index = 0; |
| 1515 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1516 | is_arate = 0; |
| 1517 | |
| 1518 | wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &self_sta_dot11mode); |
| 1519 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 1520 | |
| 1521 | /* |
| 1522 | * Include 11b rates only when the device configured in |
| 1523 | * auto, 11a/b/g or 11b_only |
| 1524 | */ |
| 1525 | if ((self_sta_dot11mode == WNI_CFG_DOT11_MODE_ALL) || |
| 1526 | (self_sta_dot11mode == WNI_CFG_DOT11_MODE_11A) || |
| 1527 | (self_sta_dot11mode == WNI_CFG_DOT11_MODE_11AC) || |
| 1528 | (self_sta_dot11mode == WNI_CFG_DOT11_MODE_11N) || |
| 1529 | (self_sta_dot11mode == WNI_CFG_DOT11_MODE_11G) || |
| 1530 | (self_sta_dot11mode == WNI_CFG_DOT11_MODE_11B)) { |
| 1531 | val = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 1532 | wlan_cfg_get_str(mac_ctx, WNI_CFG_SUPPORTED_RATES_11B, |
| 1533 | (uint8_t *) &temp_rate_set.rate, &val); |
| 1534 | temp_rate_set.numRates = (uint8_t) val; |
| 1535 | } else { |
| 1536 | temp_rate_set.numRates = 0; |
| 1537 | } |
| 1538 | |
| 1539 | /* Include 11a rates when the device configured in non-11b mode */ |
| 1540 | if (!IS_DOT11_MODE_11B(self_sta_dot11mode)) { |
| 1541 | val = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 1542 | wlan_cfg_get_str(mac_ctx, WNI_CFG_SUPPORTED_RATES_11A, |
| 1543 | (uint8_t *) &temp_rate_set2.rate, &val); |
| 1544 | temp_rate_set2.numRates = (uint8_t) val; |
| 1545 | } else { |
| 1546 | temp_rate_set2.numRates = 0; |
| 1547 | } |
| 1548 | |
| 1549 | if ((temp_rate_set.numRates + temp_rate_set2.numRates) > 12) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1550 | pe_err("more than 12 rates in CFG"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1551 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1552 | } |
| 1553 | /* copy all rates in temp_rate_set, there are 12 rates max */ |
| 1554 | for (i = 0; i < temp_rate_set2.numRates; i++) |
| 1555 | temp_rate_set.rate[i + temp_rate_set.numRates] = |
| 1556 | temp_rate_set2.rate[i]; |
| 1557 | |
| 1558 | temp_rate_set.numRates += temp_rate_set2.numRates; |
| 1559 | |
| 1560 | /** |
| 1561 | * Sort rates in temp_rate_set (they are likely to be already sorted) |
| 1562 | * put the result in pSupportedRates |
| 1563 | */ |
| 1564 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1565 | qdf_mem_set((uint8_t *) rates, sizeof(tSirSupportedRates), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1566 | for (i = 0; i < temp_rate_set.numRates; i++) { |
| 1567 | min = 0; |
| 1568 | val = 0xff; |
| 1569 | is_arate = 0; |
| 1570 | |
| 1571 | for (j = 0; (j < temp_rate_set.numRates) && |
| 1572 | (j < SIR_MAC_RATESET_EID_MAX); j++) { |
| 1573 | if ((uint32_t) (temp_rate_set.rate[j] & 0x7f) < |
| 1574 | val) { |
| 1575 | val = temp_rate_set.rate[j] & 0x7f; |
| 1576 | min = j; |
| 1577 | } |
| 1578 | } |
| 1579 | |
| 1580 | if (sirIsArate(temp_rate_set.rate[min] & 0x7f)) |
| 1581 | is_arate = 1; |
| 1582 | |
| 1583 | /* |
| 1584 | * HAL needs to know whether the rate is basic rate or |
| 1585 | * not, as it needs to update the response rate table |
| 1586 | * accordingly. e.g. if one of the 11a rates is |
| 1587 | * basic rate, then that rate can be used for sending |
| 1588 | * control frames. |
| 1589 | * HAL updates the response rate table whenever basic |
| 1590 | * rate set is changed. |
| 1591 | */ |
| 1592 | if (basic_only && temp_rate_set.rate[min] & 0x80) { |
| 1593 | if (is_arate) |
| 1594 | rates->llaRates[a_rate_index++] = |
| 1595 | temp_rate_set.rate[min]; |
| 1596 | else |
| 1597 | rates->llbRates[b_rate_index++] = |
| 1598 | temp_rate_set.rate[min]; |
| 1599 | } else { |
| 1600 | if (is_arate) |
| 1601 | rates->llaRates[a_rate_index++] = |
| 1602 | temp_rate_set.rate[min]; |
| 1603 | else |
| 1604 | rates->llbRates[b_rate_index++] = |
| 1605 | temp_rate_set.rate[min]; |
| 1606 | } |
| 1607 | temp_rate_set.rate[min] = 0xff; |
| 1608 | } |
| 1609 | |
| 1610 | if (IS_DOT11_MODE_HT(self_sta_dot11mode)) { |
| 1611 | val = SIZE_OF_SUPPORTED_MCS_SET; |
| 1612 | if (wlan_cfg_get_str(mac_ctx, WNI_CFG_SUPPORTED_MCS_SET, |
| 1613 | rates->supportedMCSSet, |
| 1614 | &val) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1615 | pe_err("could not retrieve supportedMCSSet"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1616 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1617 | } |
| 1618 | |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 1619 | if (session_entry->nss == NSS_1x1_MODE) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 1620 | rates->supportedMCSSet[1] = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1621 | /* |
| 1622 | * if supported MCS Set of the peer is passed in, |
| 1623 | * then do the intersection |
| 1624 | * else use the MCS set from local CFG. |
| 1625 | */ |
| 1626 | |
| 1627 | if (supported_mcs_set != NULL) { |
| 1628 | for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 1629 | rates->supportedMCSSet[i] &= |
| 1630 | supported_mcs_set[i]; |
| 1631 | } |
| 1632 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1633 | pe_debug("MCS Rate Set Bitmap: "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1635 | pe_debug("%x ", rates->supportedMCSSet[i]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1636 | } |
Kiran Kumar Lokere | 6671abd | 2016-05-02 19:36:19 -0700 | [diff] [blame] | 1637 | lim_populate_vht_mcs_set(mac_ctx, rates, vht_caps, |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 1638 | session_entry, session_entry->nss); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1639 | lim_populate_he_mcs_set(mac_ctx, rates, he_caps, |
| 1640 | session_entry, session_entry->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1641 | |
| 1642 | return eSIR_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | } |
| 1644 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1645 | tSirRetStatus |
| 1646 | lim_populate_peer_rate_set(tpAniSirGlobal pMac, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1647 | tpSirSupportedRates pRates, uint8_t *pSupportedMCSSet, |
| 1648 | uint8_t basicOnly, tpPESession psessionEntry, |
| 1649 | tDot11fIEVHTCaps *pVHTCaps, tDot11fIEvendor_he_cap *he_caps) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1650 | { |
| 1651 | tSirMacRateSet tempRateSet; |
| 1652 | tSirMacRateSet tempRateSet2; |
| 1653 | uint32_t i, j, val, min, isArate; |
| 1654 | isArate = 0; |
| 1655 | |
| 1656 | /* copy operational rate set from psessionEntry */ |
| 1657 | if (psessionEntry->rateSet.numRates <= SIR_MAC_RATESET_EID_MAX) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1658 | qdf_mem_copy((uint8_t *) tempRateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | (uint8_t *) (psessionEntry->rateSet.rate), |
| 1660 | psessionEntry->rateSet.numRates); |
| 1661 | tempRateSet.numRates = psessionEntry->rateSet.numRates; |
| 1662 | } else { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1663 | pe_err("more than SIR_MAC_RATESET_EID_MAX rates"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1664 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1665 | } |
| 1666 | if ((psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G) || |
| 1667 | (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11A) || |
| 1668 | (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11AC) || |
| 1669 | (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N)) { |
| 1670 | if (psessionEntry->extRateSet.numRates <= |
| 1671 | SIR_MAC_RATESET_EID_MAX) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1672 | qdf_mem_copy((uint8_t *) tempRateSet2.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1673 | (uint8_t *) (psessionEntry->extRateSet. |
| 1674 | rate), |
| 1675 | psessionEntry->extRateSet.numRates); |
| 1676 | tempRateSet2.numRates = |
| 1677 | psessionEntry->extRateSet.numRates; |
| 1678 | } else { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1679 | pe_err("psessionEntry->extRateSet.numRates more than SIR_MAC_RATESET_EID_MAX rates"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1680 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1681 | } |
| 1682 | } else |
| 1683 | tempRateSet2.numRates = 0; |
| 1684 | if ((tempRateSet.numRates + tempRateSet2.numRates) > |
| 1685 | SIR_MAC_RATESET_EID_MAX) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1686 | pe_err("more than 12 rates in CFG"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1687 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | } |
| 1689 | |
| 1690 | /* copy all rates in tempRateSet, there are 12 rates max */ |
| 1691 | for (i = 0; i < tempRateSet2.numRates; i++) |
| 1692 | tempRateSet.rate[i + tempRateSet.numRates] = |
| 1693 | tempRateSet2.rate[i]; |
| 1694 | tempRateSet.numRates += tempRateSet2.numRates; |
| 1695 | /** |
| 1696 | * Sort rates in tempRateSet (they are likely to be already sorted) |
| 1697 | * put the result in pSupportedRates |
| 1698 | */ |
| 1699 | { |
| 1700 | uint8_t aRateIndex = 0; |
| 1701 | uint8_t bRateIndex = 0; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1702 | qdf_mem_set((uint8_t *) pRates, sizeof(tSirSupportedRates), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1703 | for (i = 0; i < tempRateSet.numRates; i++) { |
| 1704 | min = 0; |
| 1705 | val = 0xff; |
| 1706 | isArate = 0; |
| 1707 | for (j = 0; |
| 1708 | (j < tempRateSet.numRates) |
| 1709 | && (j < SIR_MAC_RATESET_EID_MAX); j++) { |
| 1710 | if ((uint32_t) (tempRateSet.rate[j] & 0x7f) < |
| 1711 | val) { |
| 1712 | val = tempRateSet.rate[j] & 0x7f; |
| 1713 | min = j; |
| 1714 | } |
| 1715 | } |
| 1716 | if (sirIsArate(tempRateSet.rate[min] & 0x7f)) |
| 1717 | isArate = 1; |
| 1718 | /* |
| 1719 | * HAL needs to know whether the rate is basic rate or not, as it needs to |
| 1720 | * update the response rate table accordingly. e.g. if one of the 11a rates is |
| 1721 | * basic rate, then that rate can be used for sending control frames. |
| 1722 | * HAL updates the response rate table whenever basic rate set is changed. |
| 1723 | */ |
| 1724 | if (basicOnly) { |
| 1725 | if (tempRateSet.rate[min] & 0x80) { |
| 1726 | if (isArate) |
| 1727 | pRates->llaRates[aRateIndex++] = |
| 1728 | tempRateSet.rate[min]; |
| 1729 | else |
| 1730 | pRates->llbRates[bRateIndex++] = |
| 1731 | tempRateSet.rate[min]; |
| 1732 | } |
| 1733 | } else { |
| 1734 | if (isArate) |
| 1735 | pRates->llaRates[aRateIndex++] = |
| 1736 | tempRateSet.rate[min]; |
| 1737 | else |
| 1738 | pRates->llbRates[bRateIndex++] = |
| 1739 | tempRateSet.rate[min]; |
| 1740 | } |
| 1741 | tempRateSet.rate[min] = 0xff; |
| 1742 | } |
| 1743 | } |
| 1744 | |
| 1745 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode)) { |
| 1746 | val = SIZE_OF_SUPPORTED_MCS_SET; |
| 1747 | if (wlan_cfg_get_str(pMac, WNI_CFG_SUPPORTED_MCS_SET, |
| 1748 | pRates->supportedMCSSet, |
| 1749 | &val) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1750 | pe_err("could not retrieve supportedMCSSet"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1751 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1752 | } |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 1753 | if (psessionEntry->nss == NSS_1x1_MODE) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 1754 | pRates->supportedMCSSet[1] = 0; |
| 1755 | |
| 1756 | /* if supported MCS Set of the peer is passed in, then do the |
| 1757 | * intersection, else use the MCS set from local CFG. |
| 1758 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1759 | if (pSupportedMCSSet != NULL) { |
| 1760 | for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 1761 | pRates->supportedMCSSet[i] &= |
| 1762 | pSupportedMCSSet[i]; |
| 1763 | } |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1764 | pe_debug("MCS Rate Set Bitmap: "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1765 | for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1766 | pe_debug("%x ", pRates->supportedMCSSet[i]); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 1767 | |
Naveen Rawat | 6417668 | 2017-06-14 14:28:37 -0700 | [diff] [blame] | 1768 | if (pRates->supportedMCSSet[0] == 0) { |
| 1769 | pe_debug("Incorrect MCS 0 - 7. They must be supported"); |
| 1770 | pRates->supportedMCSSet[0] = 0xFF; |
| 1771 | } |
| 1772 | |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 1773 | psessionEntry->supported_nss_1x1 = |
| 1774 | ((pRates->supportedMCSSet[1] != 0) ? false : true); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1775 | pe_debug("HT supported nss 1x1: %d", |
Archana Ramachandran | ef777d4 | 2016-03-29 16:27:42 -0700 | [diff] [blame] | 1776 | psessionEntry->supported_nss_1x1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1777 | } |
Kiran Kumar Lokere | 6671abd | 2016-05-02 19:36:19 -0700 | [diff] [blame] | 1778 | lim_populate_vht_mcs_set(pMac, pRates, pVHTCaps, |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 1779 | psessionEntry, psessionEntry->nss); |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1780 | |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1781 | lim_populate_he_mcs_set(pMac, pRates, he_caps, |
| 1782 | psessionEntry, psessionEntry->nss); |
| 1783 | |
Varun Reddy Yeturu | 5109486 | 2017-08-25 14:27:15 -0700 | [diff] [blame^] | 1784 | if (IS_DOT11_MODE_HE(psessionEntry->dot11mode) && he_caps) { |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1785 | psessionEntry->nss = he_caps->nss_supported; |
| 1786 | } else if (IS_DOT11_MODE_VHT(psessionEntry->dot11mode)) { |
| 1787 | if ((pRates->vhtRxMCSMap & MCSMAPMASK2x2) == MCSMAPMASK2x2) |
| 1788 | psessionEntry->nss = NSS_1x1_MODE; |
| 1789 | } else if (pRates->supportedMCSSet[1] == 0) { |
| 1790 | psessionEntry->nss = NSS_1x1_MODE; |
| 1791 | } |
Varun Reddy Yeturu | 5109486 | 2017-08-25 14:27:15 -0700 | [diff] [blame^] | 1792 | pe_debug("nss: %d", psessionEntry->nss); |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1793 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1794 | return eSIR_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1795 | } /*** lim_populate_peer_rate_set() ***/ |
| 1796 | |
| 1797 | /** |
| 1798 | * lim_populate_matching_rate_set() -process the CFG rate sets and |
| 1799 | * the rate sets received in the Assoc request on AP. |
| 1800 | * @mac_ctx: pointer to global mac structure |
| 1801 | * @sta_ds: station node |
| 1802 | * @oper_rate_set: pointer to operating rate set |
| 1803 | * @ext_rate_set: pointer to extended rate set |
| 1804 | * @supported_mcs_set: pointer to supported rate set |
| 1805 | * @session_entry: pointer to pe session entry |
| 1806 | * @vht_caps: pointer to vht capabilities |
| 1807 | * |
| 1808 | * This is called at the time of Association Request |
| 1809 | * processing on AP and while adding peer's context |
| 1810 | * in IBSS role to process the CFG rate sets and |
| 1811 | * the rate sets received in the Assoc request on AP |
| 1812 | * or Beacon/Probe Response from peer in IBSS. |
| 1813 | * |
| 1814 | * 1. It makes the intersection between our own rate Sat |
| 1815 | * and extemcded rate set and the ones received in the |
| 1816 | * association request. |
| 1817 | * 2. It creates a combined rate set of 12 rates max which |
| 1818 | * comprised the basic and extended rates |
| 1819 | * 3. It sorts the combined rate Set and copy it in the |
| 1820 | * rate array of the pSTA descriptor |
| 1821 | * |
| 1822 | * The parser has already ensured unicity of the rates in the |
| 1823 | * association request structure |
| 1824 | * |
| 1825 | * Return: eSIR_SUCCESS on success else eSIR_FAILURE |
| 1826 | */ |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1827 | tSirRetStatus lim_populate_matching_rate_set(tpAniSirGlobal mac_ctx, |
| 1828 | tpDphHashNode sta_ds, |
| 1829 | tSirMacRateSet *oper_rate_set, |
| 1830 | tSirMacRateSet *ext_rate_set, |
| 1831 | uint8_t *supported_mcs_set, |
| 1832 | tpPESession session_entry, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1833 | tDot11fIEVHTCaps *vht_caps, |
| 1834 | tDot11fIEvendor_he_cap *he_caps) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1835 | { |
| 1836 | tSirMacRateSet temp_rate_set; |
| 1837 | tSirMacRateSet temp_rate_set2; |
| 1838 | uint32_t i, j, val, min, is_arate; |
| 1839 | uint32_t phy_mode; |
| 1840 | uint8_t mcs_set[SIZE_OF_SUPPORTED_MCS_SET]; |
| 1841 | tpSirSupportedRates rates; |
| 1842 | uint8_t a_rate_index = 0; |
| 1843 | uint8_t b_rate_index = 0; |
| 1844 | |
| 1845 | is_arate = 0; |
| 1846 | |
| 1847 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 1848 | |
| 1849 | /* copy operational rate set from session_entry */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1850 | qdf_mem_copy((temp_rate_set.rate), (session_entry->rateSet.rate), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1851 | session_entry->rateSet.numRates); |
| 1852 | temp_rate_set.numRates = (uint8_t) session_entry->rateSet.numRates; |
| 1853 | |
| 1854 | if (phy_mode == WNI_CFG_PHY_MODE_11G) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1855 | qdf_mem_copy((temp_rate_set2.rate), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | (session_entry->extRateSet.rate), |
| 1857 | session_entry->extRateSet.numRates); |
| 1858 | temp_rate_set2.numRates = |
| 1859 | (uint8_t) session_entry->extRateSet.numRates; |
| 1860 | } else { |
| 1861 | temp_rate_set2.numRates = 0; |
| 1862 | } |
| 1863 | |
Naveen Rawat | 24c1691 | 2016-11-17 11:28:40 -0800 | [diff] [blame] | 1864 | /* |
| 1865 | * absolute sum of both num_rates should be less than 12. following |
| 1866 | * 16-bit sum avoids false codition where 8-bit arthematic overflow |
| 1867 | * might have caused total sum to be less than 12 |
| 1868 | */ |
| 1869 | if (((uint16_t)temp_rate_set.numRates + |
| 1870 | (uint16_t)temp_rate_set2.numRates) > 12) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1871 | pe_err("more than 12 rates in CFG"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1872 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1873 | } |
| 1874 | |
| 1875 | /* |
| 1876 | * Handling of the rate set IEs is the following: |
| 1877 | * - keep only rates that we support and that the station supports |
| 1878 | * - sort and the rates into the pSta->rate array |
| 1879 | */ |
| 1880 | |
| 1881 | /* Copy all rates in temp_rate_set, there are 12 rates max */ |
| 1882 | for (i = 0; i < temp_rate_set2.numRates; i++) |
| 1883 | temp_rate_set.rate[i + temp_rate_set.numRates] = |
| 1884 | temp_rate_set2.rate[i]; |
| 1885 | |
| 1886 | temp_rate_set.numRates += temp_rate_set2.numRates; |
| 1887 | |
| 1888 | /* |
| 1889 | * Sort rates in temp_rate_set (they are likely to be already sorted) |
| 1890 | * put the result in temp_rate_set2 |
| 1891 | */ |
| 1892 | temp_rate_set2.numRates = 0; |
| 1893 | |
| 1894 | for (i = 0; i < temp_rate_set.numRates; i++) { |
| 1895 | min = 0; |
| 1896 | val = 0xff; |
| 1897 | |
| 1898 | for (j = 0; j < temp_rate_set.numRates; j++) |
| 1899 | if ((uint32_t) (temp_rate_set.rate[j] & 0x7f) < val) { |
| 1900 | val = temp_rate_set.rate[j] & 0x7f; |
| 1901 | min = j; |
| 1902 | } |
| 1903 | |
| 1904 | temp_rate_set2.rate[temp_rate_set2.numRates++] = |
| 1905 | temp_rate_set.rate[min]; |
| 1906 | temp_rate_set.rate[min] = 0xff; |
| 1907 | } |
| 1908 | |
| 1909 | /* |
| 1910 | * Copy received rates in temp_rate_set, the parser has ensured |
| 1911 | * unicity of the rates so there cannot be more than 12 |
| 1912 | */ |
| 1913 | for (i = 0; (i < oper_rate_set->numRates && |
| 1914 | i < SIR_MAC_RATESET_EID_MAX); i++) |
| 1915 | temp_rate_set.rate[i] = oper_rate_set->rate[i]; |
| 1916 | |
| 1917 | temp_rate_set.numRates = oper_rate_set->numRates; |
| 1918 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1919 | pe_debug("Sum of SUPPORTED and EXTENDED Rate Set (%1d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1920 | temp_rate_set.numRates + ext_rate_set->numRates); |
| 1921 | |
| 1922 | if (ext_rate_set->numRates && |
| 1923 | ((temp_rate_set.numRates + ext_rate_set->numRates) > 12) && |
| 1924 | temp_rate_set.numRates < 12) { |
| 1925 | int found = 0; |
| 1926 | int tail = temp_rate_set.numRates; |
| 1927 | |
| 1928 | for (i = 0; (i < ext_rate_set->numRates && |
| 1929 | i < SIR_MAC_RATESET_EID_MAX); i++) { |
| 1930 | found = 0; |
| 1931 | for (j = 0; j < (uint32_t) tail; j++) { |
| 1932 | if ((temp_rate_set.rate[j] & 0x7F) == |
| 1933 | (ext_rate_set->rate[i] & 0x7F)) { |
| 1934 | found = 1; |
| 1935 | break; |
| 1936 | } |
| 1937 | } |
| 1938 | |
| 1939 | if (!found) { |
| 1940 | temp_rate_set.rate[temp_rate_set.numRates++] = |
| 1941 | ext_rate_set->rate[i]; |
| 1942 | if (temp_rate_set.numRates >= 12) |
| 1943 | break; |
| 1944 | } |
| 1945 | } |
| 1946 | } else if (ext_rate_set->numRates && |
| 1947 | ((temp_rate_set.numRates + ext_rate_set->numRates) <= 12)) { |
| 1948 | for (j = 0; ((j < ext_rate_set->numRates) && |
| 1949 | (j < SIR_MAC_RATESET_EID_MAX) && |
| 1950 | ((i + j) < SIR_MAC_RATESET_EID_MAX)); j++) |
| 1951 | temp_rate_set.rate[i + j] = ext_rate_set->rate[j]; |
| 1952 | |
| 1953 | temp_rate_set.numRates += ext_rate_set->numRates; |
| 1954 | } else if (ext_rate_set->numRates) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1955 | pe_debug("Relying only on the SUPPORTED Rate Set IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1956 | } |
| 1957 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1958 | rates = &sta_ds->supportedRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1959 | qdf_mem_set((uint8_t *) rates, sizeof(tSirSupportedRates), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1960 | for (i = 0; (i < temp_rate_set2.numRates && |
| 1961 | i < SIR_MAC_RATESET_EID_MAX); i++) { |
| 1962 | for (j = 0; (j < temp_rate_set.numRates && |
| 1963 | j < SIR_MAC_RATESET_EID_MAX); j++) { |
| 1964 | if ((temp_rate_set2.rate[i] & 0x7F) != |
| 1965 | (temp_rate_set.rate[j] & 0x7F)) |
| 1966 | continue; |
| 1967 | |
| 1968 | if (sirIsArate(temp_rate_set2.rate[i] & 0x7f) && |
| 1969 | a_rate_index < SIR_NUM_11A_RATES) { |
| 1970 | is_arate = 1; |
| 1971 | rates->llaRates[a_rate_index++] = |
| 1972 | temp_rate_set2.rate[i]; |
| 1973 | } else if ((b_rate_index < SIR_NUM_11B_RATES) && |
| 1974 | !(sirIsArate(temp_rate_set2.rate[i] & 0x7f))) { |
| 1975 | rates->llbRates[b_rate_index++] = |
| 1976 | temp_rate_set2.rate[i]; |
| 1977 | } |
| 1978 | break; |
| 1979 | } |
| 1980 | } |
| 1981 | |
| 1982 | /* |
| 1983 | * Now add the Polaris rates only when Proprietary rates are enabled. |
| 1984 | * compute the matching MCS rate set, if peer is 11n capable and self |
| 1985 | * mode is 11n |
| 1986 | */ |
| 1987 | #ifdef FEATURE_WLAN_TDLS |
| 1988 | if (sta_ds->mlmStaContext.htCapability) |
| 1989 | #else |
| 1990 | if (IS_DOT11_MODE_HT(session_entry->dot11mode) && |
| 1991 | (sta_ds->mlmStaContext.htCapability)) |
| 1992 | #endif |
| 1993 | { |
| 1994 | val = SIZE_OF_SUPPORTED_MCS_SET; |
| 1995 | if (wlan_cfg_get_str(mac_ctx, WNI_CFG_SUPPORTED_MCS_SET, |
| 1996 | mcs_set, &val) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1997 | pe_err("could not retrieve supportedMCSet"); |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 1998 | return eSIR_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1999 | } |
| 2000 | |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 2001 | if (session_entry->nss == NSS_1x1_MODE) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 2002 | mcs_set[1] = 0; |
| 2003 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2004 | for (i = 0; i < val; i++) |
| 2005 | sta_ds->supportedRates.supportedMCSSet[i] = |
| 2006 | mcs_set[i] & supported_mcs_set[i]; |
| 2007 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2008 | pe_debug("lim_populate_matching_rate_set: MCS Rate Set Bitmap" |
| 2009 | " from CFG and DPH : "); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2011 | pe_debug("%x %x ", mcs_set[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2012 | sta_ds->supportedRates.supportedMCSSet[i]); |
| 2013 | } |
| 2014 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2015 | lim_populate_vht_mcs_set(mac_ctx, &sta_ds->supportedRates, vht_caps, |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 2016 | session_entry, session_entry->nss); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 2017 | lim_populate_he_mcs_set(mac_ctx, &sta_ds->supportedRates, he_caps, |
| 2018 | session_entry, session_entry->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2019 | /* |
| 2020 | * Set the erpEnabled bit if the phy is in G mode and at least |
| 2021 | * one A rate is supported |
| 2022 | */ |
| 2023 | if ((phy_mode == WNI_CFG_PHY_MODE_11G) && is_arate) |
| 2024 | sta_ds->erpEnabled = eHAL_SET; |
| 2025 | |
| 2026 | return eSIR_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2027 | } |
| 2028 | |
| 2029 | /** |
| 2030 | * lim_populate_vht_caps() - populates vht capabilities based on input |
| 2031 | * capabilities |
| 2032 | * @input_caps: input capabilities based on which we format the vht |
| 2033 | * capabilities |
| 2034 | * |
| 2035 | * function to populate the supported vht capabilities. |
| 2036 | * |
| 2037 | * Return: vht capabilities derived based on input parameters. |
| 2038 | */ |
| 2039 | static uint32_t lim_populate_vht_caps(tDot11fIEVHTCaps input_caps) |
| 2040 | { |
| 2041 | uint32_t vht_caps; |
| 2042 | |
| 2043 | vht_caps = ((input_caps.maxMPDULen << SIR_MAC_VHT_CAP_MAX_MPDU_LEN) | |
| 2044 | (input_caps.supportedChannelWidthSet << |
| 2045 | SIR_MAC_VHT_CAP_SUPP_CH_WIDTH_SET) | |
| 2046 | (input_caps.ldpcCodingCap << |
| 2047 | SIR_MAC_VHT_CAP_LDPC_CODING_CAP) | |
| 2048 | (input_caps.shortGI80MHz << |
| 2049 | SIR_MAC_VHT_CAP_SHORTGI_80MHZ) | |
| 2050 | (input_caps.shortGI160and80plus80MHz << |
| 2051 | SIR_MAC_VHT_CAP_SHORTGI_160_80_80MHZ) | |
| 2052 | (input_caps.txSTBC << SIR_MAC_VHT_CAP_TXSTBC) | |
| 2053 | (input_caps.rxSTBC << SIR_MAC_VHT_CAP_RXSTBC) | |
| 2054 | (input_caps.suBeamFormerCap << |
| 2055 | SIR_MAC_VHT_CAP_SU_BEAMFORMER_CAP) | |
| 2056 | (input_caps.suBeamformeeCap << |
| 2057 | SIR_MAC_VHT_CAP_SU_BEAMFORMEE_CAP) | |
| 2058 | (input_caps.csnofBeamformerAntSup << |
| 2059 | SIR_MAC_VHT_CAP_CSN_BEAMORMER_ANT_SUP) | |
| 2060 | (input_caps.numSoundingDim << |
| 2061 | SIR_MAC_VHT_CAP_NUM_SOUNDING_DIM) | |
| 2062 | (input_caps.muBeamformerCap << |
| 2063 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMER_CAP) | |
| 2064 | (input_caps.muBeamformeeCap << |
| 2065 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMEE_CAP) | |
| 2066 | (input_caps.vhtTXOPPS << |
| 2067 | SIR_MAC_VHT_CAP_TXOPPS) | |
| 2068 | (input_caps.htcVHTCap << |
| 2069 | SIR_MAC_VHT_CAP_HTC_CAP) | |
| 2070 | (input_caps.maxAMPDULenExp << |
| 2071 | SIR_MAC_VHT_CAP_MAX_AMDU_LEN_EXPO) | |
| 2072 | (input_caps.vhtLinkAdaptCap << |
| 2073 | SIR_MAC_VHT_CAP_LINK_ADAPT_CAP) | |
| 2074 | (input_caps.rxAntPattern << |
| 2075 | SIR_MAC_VHT_CAP_RX_ANTENNA_PATTERN) | |
| 2076 | (input_caps.txAntPattern << |
| 2077 | SIR_MAC_VHT_CAP_TX_ANTENNA_PATTERN) | |
| 2078 | (input_caps.reserved1 << |
| 2079 | SIR_MAC_VHT_CAP_RESERVED2)); |
| 2080 | |
| 2081 | return vht_caps; |
| 2082 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2083 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2084 | /** |
| 2085 | * lim_add_sta()- called to add an STA context at hardware |
| 2086 | * @mac_ctx: pointer to global mac structure |
| 2087 | * @sta_ds: station node |
| 2088 | * @update_entry: set to true for updating the entry |
| 2089 | * @session_entry: pe session entry |
| 2090 | * |
| 2091 | * This function is called to add an STA context at hardware |
| 2092 | * whenever a STA is (Re) Associated. |
| 2093 | * |
| 2094 | * Return: eSIR_SUCCESS on success else eSirRetStatus failure codes |
| 2095 | */ |
| 2096 | |
| 2097 | tSirRetStatus |
| 2098 | lim_add_sta(tpAniSirGlobal mac_ctx, |
| 2099 | tpDphHashNode sta_ds, uint8_t update_entry, tpPESession session_entry) |
| 2100 | { |
| 2101 | tpAddStaParams add_sta_params = NULL; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2102 | struct scheduler_msg msg_q = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | tSirRetStatus ret_code = eSIR_SUCCESS; |
| 2104 | tSirMacAddr sta_mac, *sta_Addr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2105 | tpSirAssocReq assoc_req; |
Kiran Kumar Lokere | 80d3e1a | 2017-05-26 15:15:13 -0700 | [diff] [blame] | 2106 | uint8_t i, nw_type_11b = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2107 | tLimIbssPeerNode *peer_node; /* for IBSS mode */ |
| 2108 | uint8_t *p2p_ie = NULL; |
| 2109 | |
| 2110 | sir_copy_mac_addr(sta_mac, session_entry->selfMacAddr); |
| 2111 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2112 | pe_debug("sessionid: %d update_entry = %d limsystemrole = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2113 | session_entry->smeSessionId, update_entry, |
| 2114 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 2115 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2116 | add_sta_params = qdf_mem_malloc(sizeof(tAddStaParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2117 | if (NULL == add_sta_params) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2118 | pe_err("Unable to allocate memory during ADD_STA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2119 | return eSIR_MEM_ALLOC_FAILED; |
| 2120 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2121 | |
Naveen Rawat | cb186cf | 2016-07-11 13:47:19 -0700 | [diff] [blame] | 2122 | if (LIM_IS_AP_ROLE(session_entry) || LIM_IS_IBSS_ROLE(session_entry) || |
| 2123 | LIM_IS_NDI_ROLE(session_entry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2124 | sta_Addr = &sta_ds->staAddr; |
| 2125 | #ifdef FEATURE_WLAN_TDLS |
| 2126 | /* SystemRole shouldn't be matter if staType is TDLS peer */ |
| 2127 | else if (STA_ENTRY_TDLS_PEER == sta_ds->staType) |
| 2128 | sta_Addr = &sta_ds->staAddr; |
| 2129 | #endif |
| 2130 | else |
| 2131 | sta_Addr = &sta_mac; |
| 2132 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2133 | pe_debug(MAC_ADDRESS_STR ": Subtype(Assoc/Reassoc): %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2134 | MAC_ADDR_ARRAY(*sta_Addr), sta_ds->mlmStaContext.subType); |
| 2135 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2136 | qdf_mem_copy((uint8_t *) add_sta_params->staMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2137 | (uint8_t *) *sta_Addr, sizeof(tSirMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2138 | qdf_mem_copy((uint8_t *) add_sta_params->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2139 | session_entry->bssId, sizeof(tSirMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2140 | qdf_mem_copy(&add_sta_params->capab_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | &sta_ds->mlmStaContext.capabilityInfo, |
| 2142 | sizeof(add_sta_params->capab_info)); |
| 2143 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2144 | /* Copy legacy rates */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2145 | qdf_mem_copy((uint8_t *) &add_sta_params->supportedRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2146 | (uint8_t *) &sta_ds->supportedRates, |
| 2147 | sizeof(tSirSupportedRates)); |
| 2148 | |
| 2149 | add_sta_params->assocId = sta_ds->assocId; |
| 2150 | |
| 2151 | add_sta_params->wmmEnabled = sta_ds->qosMode; |
| 2152 | add_sta_params->listenInterval = sta_ds->mlmStaContext.listenInterval; |
| 2153 | add_sta_params->shortPreambleSupported = sta_ds->shortPreambleEnabled; |
| 2154 | if (LIM_IS_AP_ROLE(session_entry) && |
| 2155 | (sta_ds->mlmStaContext.subType == LIM_REASSOC)) { |
| 2156 | /* |
| 2157 | * TBD - need to remove this REASSOC check |
| 2158 | * after fixinf rmmod issue |
| 2159 | */ |
| 2160 | add_sta_params->updateSta = sta_ds->mlmStaContext.updateContext; |
| 2161 | } |
| 2162 | sta_ds->valid = 0; |
| 2163 | sta_ds->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; |
| 2164 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2165 | pe_debug("Assoc ID: %d wmmEnabled: %d listenInterval: %d" |
| 2166 | " shortPreambleSupported: %d", add_sta_params->assocId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2167 | add_sta_params->wmmEnabled, add_sta_params->listenInterval, |
| 2168 | add_sta_params->shortPreambleSupported); |
| 2169 | /* This will indicate HAL to "allocate" a new STA index */ |
| 2170 | #ifdef FEATURE_WLAN_TDLS |
| 2171 | /* |
| 2172 | * As there is corner case in-between add_sta and change_sta,if del_sta |
| 2173 | * for other staIdx happened, firmware return wrong staIdx |
| 2174 | * (recently removed staIdx). Until we get a confirmation from the |
| 2175 | * firmware team it is now return correct staIdx for same sta_mac_addr |
| 2176 | * for update case, we want to get around it by passing valid staIdx |
| 2177 | * given by add_sta time. |
| 2178 | */ |
| 2179 | if ((STA_ENTRY_TDLS_PEER == sta_ds->staType) && (true == update_entry)) |
| 2180 | add_sta_params->staIdx = sta_ds->staIndex; |
| 2181 | else |
| 2182 | #endif |
| 2183 | add_sta_params->staIdx = STA_INVALID_IDX; |
| 2184 | add_sta_params->staType = sta_ds->staType; |
| 2185 | |
| 2186 | add_sta_params->updateSta = update_entry; |
| 2187 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2188 | add_sta_params->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2189 | add_sta_params->respReqd = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2190 | |
Abhishek Singh | a91d619 | 2017-08-16 17:24:17 +0530 | [diff] [blame] | 2191 | /* Update VHT/HT Capability */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2192 | if (LIM_IS_AP_ROLE(session_entry) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2193 | LIM_IS_IBSS_ROLE(session_entry)) { |
| 2194 | add_sta_params->htCapable = sta_ds->mlmStaContext.htCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2195 | add_sta_params->vhtCapable = |
| 2196 | sta_ds->mlmStaContext.vhtCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2197 | } |
Abhishek Singh | a91d619 | 2017-08-16 17:24:17 +0530 | [diff] [blame] | 2198 | #ifdef FEATURE_WLAN_TDLS |
| 2199 | /* SystemRole shouldn't be matter if staType is TDLS peer */ |
| 2200 | else if (STA_ENTRY_TDLS_PEER == sta_ds->staType) { |
| 2201 | add_sta_params->htCapable = sta_ds->mlmStaContext.htCapability; |
| 2202 | add_sta_params->vhtCapable = |
| 2203 | sta_ds->mlmStaContext.vhtCapability; |
| 2204 | } |
| 2205 | #endif |
| 2206 | else { |
| 2207 | add_sta_params->htCapable = session_entry->htCapability; |
| 2208 | add_sta_params->vhtCapable = session_entry->vhtCapability; |
| 2209 | } |
| 2210 | |
| 2211 | pe_debug("StaIdx: %d updateSta: %d htcapable: %d vhtCapable: %d", |
| 2212 | add_sta_params->staIdx, add_sta_params->updateSta, |
| 2213 | add_sta_params->htCapable, add_sta_params->vhtCapable); |
| 2214 | |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2215 | /* |
| 2216 | * 2G-AS platform: SAP associates with HT (11n)clients as 2x1 in 2G and |
| 2217 | * 2X2 in 5G |
| 2218 | * Non-2G-AS platform: SAP associates with HT (11n) clients as 2X2 in 2G |
| 2219 | * and 5G; and disable async dbs scan when HT client connects |
| 2220 | * 5G-AS: Don't care |
| 2221 | */ |
| 2222 | if (!policy_mgr_is_hw_dbs_2x2_capable(mac_ctx->psoc) && |
| 2223 | LIM_IS_AP_ROLE(session_entry) && |
| 2224 | (STA_ENTRY_PEER == sta_ds->staType) && |
| 2225 | !add_sta_params->vhtCapable && |
| 2226 | (session_entry->nss == 2)) { |
| 2227 | session_entry->ht_client_cnt++; |
| 2228 | if ((session_entry->ht_client_cnt == 1) && |
| 2229 | !(mac_ctx->lteCoexAntShare && |
| 2230 | IS_24G_CH(session_entry->currentOperChannel))) { |
| 2231 | pe_debug("setting SMPS intolrent vdev_param"); |
| 2232 | wma_cli_set_command(session_entry->smeSessionId, |
| 2233 | (int)WMI_VDEV_PARAM_SMPS_INTOLERANT, |
| 2234 | 1, VDEV_CMD); |
| 2235 | } |
| 2236 | } |
| 2237 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2238 | lim_update_sta_he_capable(mac_ctx, add_sta_params, sta_ds, |
| 2239 | session_entry); |
| 2240 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2241 | add_sta_params->greenFieldCapable = sta_ds->htGreenfield; |
| 2242 | add_sta_params->maxAmpduDensity = sta_ds->htAMpduDensity; |
| 2243 | add_sta_params->maxAmpduSize = sta_ds->htMaxRxAMpduFactor; |
| 2244 | add_sta_params->fDsssCckMode40Mhz = sta_ds->htDsssCckRate40MHzSupport; |
| 2245 | add_sta_params->fShortGI20Mhz = sta_ds->htShortGI20Mhz; |
| 2246 | add_sta_params->fShortGI40Mhz = sta_ds->htShortGI40Mhz; |
| 2247 | add_sta_params->lsigTxopProtection = sta_ds->htLsigTXOPProtection; |
| 2248 | add_sta_params->maxAmsduSize = sta_ds->htMaxAmsduLength; |
| 2249 | add_sta_params->ch_width = sta_ds->htSupportedChannelWidthSet; |
| 2250 | add_sta_params->mimoPS = sta_ds->htMIMOPSState; |
| 2251 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2252 | pe_debug("greenFieldCapable: %d maxAmpduDensity: %d maxAmpduDensity: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2253 | add_sta_params->greenFieldCapable, |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2254 | add_sta_params->maxAmpduDensity, add_sta_params->maxAmpduSize); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2255 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2256 | pe_debug("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d fShortGI40Mhz: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2257 | add_sta_params->fDsssCckMode40Mhz, |
| 2258 | add_sta_params->fShortGI20Mhz, add_sta_params->fShortGI40Mhz); |
| 2259 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2260 | pe_debug("lsigTxopProtection: %d maxAmsduSize: %d txChannelWidth: %d mimoPS: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2261 | add_sta_params->lsigTxopProtection, |
| 2262 | add_sta_params->maxAmsduSize, add_sta_params->ch_width, |
| 2263 | add_sta_params->mimoPS); |
| 2264 | |
| 2265 | if (add_sta_params->vhtCapable) { |
| 2266 | if (sta_ds->vhtSupportedChannelWidthSet) |
| 2267 | add_sta_params->ch_width = |
| 2268 | sta_ds->vhtSupportedChannelWidthSet + 1; |
| 2269 | |
| 2270 | add_sta_params->vhtSupportedRxNss = sta_ds->vhtSupportedRxNss; |
Kiran Kumar Lokere | f1f5e99 | 2016-06-20 16:48:50 -0700 | [diff] [blame] | 2271 | if (LIM_IS_AP_ROLE(session_entry) || |
| 2272 | LIM_IS_P2P_DEVICE_GO(session_entry)) |
| 2273 | add_sta_params->vhtSupportedRxNss = QDF_MIN( |
| 2274 | add_sta_params->vhtSupportedRxNss, |
| 2275 | session_entry->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2276 | add_sta_params->vhtTxBFCapable = |
| 2277 | #ifdef FEATURE_WLAN_TDLS |
| 2278 | ((STA_ENTRY_PEER == sta_ds->staType) |
| 2279 | || (STA_ENTRY_TDLS_PEER == sta_ds->staType)) ? |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2280 | sta_ds->vhtBeamFormerCapable : |
| 2281 | session_entry->vht_config.su_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2282 | #else |
| 2283 | (STA_ENTRY_PEER == sta_ds->staType) ? |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2284 | sta_ds->vhtBeamFormerCapable : |
| 2285 | session_entry->vht_config.su_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2286 | #endif |
| 2287 | add_sta_params->enable_su_tx_bformer = |
| 2288 | sta_ds->vht_su_bfee_capable; |
| 2289 | } |
| 2290 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2291 | pe_debug("TxChWidth %d vhtTxBFCap %d, su_bfer %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2292 | add_sta_params->ch_width, add_sta_params->vhtTxBFCapable, |
| 2293 | add_sta_params->enable_su_tx_bformer); |
| 2294 | #ifdef FEATURE_WLAN_TDLS |
| 2295 | if ((STA_ENTRY_PEER == sta_ds->staType) || |
| 2296 | (STA_ENTRY_TDLS_PEER == sta_ds->staType)) |
| 2297 | #else |
| 2298 | if (STA_ENTRY_PEER == sta_ds->staType) |
| 2299 | #endif |
| 2300 | { |
| 2301 | /* |
| 2302 | * peer STA get the LDPC capability from sta_ds, |
| 2303 | * which populated from |
| 2304 | * HT/VHT capability |
| 2305 | */ |
| 2306 | if (add_sta_params->vhtTxBFCapable |
| 2307 | && mac_ctx->lim.disableLDPCWithTxbfAP) { |
| 2308 | add_sta_params->htLdpcCapable = 0; |
| 2309 | add_sta_params->vhtLdpcCapable = 0; |
| 2310 | } else { |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 2311 | if (session_entry->txLdpcIniFeatureEnabled & 0x1) |
| 2312 | add_sta_params->htLdpcCapable = |
| 2313 | sta_ds->htLdpcCapable; |
| 2314 | else |
| 2315 | add_sta_params->htLdpcCapable = 0; |
| 2316 | |
| 2317 | if (session_entry->txLdpcIniFeatureEnabled & 0x2) |
| 2318 | add_sta_params->vhtLdpcCapable = |
| 2319 | sta_ds->vhtLdpcCapable; |
| 2320 | else |
| 2321 | add_sta_params->vhtLdpcCapable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2322 | } |
| 2323 | } else if (STA_ENTRY_SELF == sta_ds->staType) { |
| 2324 | /* For Self STA get the LDPC capability from config.ini */ |
| 2325 | add_sta_params->htLdpcCapable = |
| 2326 | (session_entry->txLdpcIniFeatureEnabled & 0x01); |
| 2327 | add_sta_params->vhtLdpcCapable = |
| 2328 | ((session_entry->txLdpcIniFeatureEnabled >> 1) & 0x01); |
| 2329 | } |
| 2330 | |
| 2331 | /* Update PE session ID */ |
| 2332 | add_sta_params->sessionId = session_entry->peSessionId; |
| 2333 | |
| 2334 | /* Update SME session ID */ |
| 2335 | add_sta_params->smesessionId = session_entry->smeSessionId; |
| 2336 | |
| 2337 | add_sta_params->maxTxPower = session_entry->maxTxPower; |
| 2338 | |
| 2339 | if (session_entry->parsedAssocReq != NULL) { |
| 2340 | uint16_t aid = sta_ds->assocId; |
| 2341 | /* Get a copy of the already parsed Assoc Request */ |
| 2342 | assoc_req = |
| 2343 | (tpSirAssocReq) session_entry->parsedAssocReq[aid]; |
| 2344 | if (assoc_req && assoc_req->addIEPresent |
| 2345 | && assoc_req->addIE.length) { |
| 2346 | p2p_ie = limGetP2pIEPtr(mac_ctx, |
| 2347 | assoc_req->addIE.addIEdata, |
| 2348 | assoc_req->addIE.length); |
| 2349 | } |
| 2350 | |
| 2351 | add_sta_params->p2pCapableSta = (p2p_ie != NULL); |
| 2352 | if (assoc_req && add_sta_params->htCapable) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2353 | qdf_mem_copy(&add_sta_params->ht_caps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2354 | ((uint8_t *) &assoc_req->HTCaps) + 1, |
| 2355 | sizeof(add_sta_params->ht_caps)); |
| 2356 | } |
| 2357 | |
| 2358 | if (assoc_req && add_sta_params->vhtCapable) |
| 2359 | add_sta_params->vht_caps = |
| 2360 | lim_populate_vht_caps(assoc_req->VHTCaps); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2361 | |
| 2362 | lim_add_he_cap(add_sta_params, assoc_req); |
| 2363 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2364 | } else if (LIM_IS_IBSS_ROLE(session_entry)) { |
| 2365 | |
| 2366 | /* |
| 2367 | * in IBSS mode, use peer node as the source of ht_caps |
| 2368 | * and vht_caps |
| 2369 | */ |
| 2370 | peer_node = lim_ibss_peer_find(mac_ctx, *sta_Addr); |
| 2371 | if (!peer_node) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2372 | pe_err("Can't find IBSS peer node for ADD_STA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2373 | return eSIR_HAL_STA_DOES_NOT_EXIST; |
| 2374 | } |
| 2375 | |
| 2376 | if (peer_node->atimIePresent) { |
| 2377 | add_sta_params->atimIePresent = |
| 2378 | peer_node->atimIePresent; |
| 2379 | add_sta_params->peerAtimWindowLength = |
| 2380 | peer_node->peerAtimWindowLength; |
| 2381 | } |
| 2382 | |
| 2383 | add_sta_params->ht_caps = |
| 2384 | (peer_node->htSupportedChannelWidthSet << |
| 2385 | SIR_MAC_HT_CAP_CHWIDTH40_S) | |
| 2386 | (peer_node->htGreenfield << |
| 2387 | SIR_MAC_HT_CAP_GREENFIELD_S) | |
| 2388 | (peer_node->htShortGI20Mhz << |
| 2389 | SIR_MAC_HT_CAP_SHORTGI20MHZ_S) | |
| 2390 | (peer_node->htShortGI40Mhz << |
| 2391 | SIR_MAC_HT_CAP_SHORTGI40MHZ_S) | |
| 2392 | (SIR_MAC_TXSTBC << |
| 2393 | SIR_MAC_HT_CAP_TXSTBC_S) | |
| 2394 | (SIR_MAC_RXSTBC << |
| 2395 | SIR_MAC_HT_CAP_RXSTBC_S) | |
| 2396 | (peer_node->htMaxAmsduLength << |
| 2397 | SIR_MAC_HT_CAP_MAXAMSDUSIZE_S) | |
| 2398 | (peer_node->htDsssCckRate40MHzSupport << |
| 2399 | SIR_MAC_HT_CAP_DSSSCCK40_S); |
| 2400 | |
| 2401 | add_sta_params->vht_caps = |
| 2402 | lim_populate_vht_caps(peer_node->VHTCaps); |
| 2403 | } |
| 2404 | #ifdef FEATURE_WLAN_TDLS |
| 2405 | if (STA_ENTRY_TDLS_PEER == sta_ds->staType) { |
| 2406 | add_sta_params->ht_caps = sta_ds->ht_caps; |
| 2407 | add_sta_params->vht_caps = sta_ds->vht_caps; |
| 2408 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2409 | pe_debug("Sta type is TDLS_PEER, ht_caps: 0x%x, vht_caps: 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2410 | add_sta_params->ht_caps, |
| 2411 | add_sta_params->vht_caps); |
| 2412 | } |
| 2413 | #endif |
| 2414 | |
| 2415 | #ifdef FEATURE_WLAN_TDLS |
| 2416 | if (sta_ds->wmeEnabled && |
| 2417 | (LIM_IS_AP_ROLE(session_entry) || |
| 2418 | (STA_ENTRY_TDLS_PEER == sta_ds->staType))) |
| 2419 | #else |
| 2420 | if (sta_ds->wmeEnabled && LIM_IS_AP_ROLE(session_entry)) |
| 2421 | #endif |
| 2422 | { |
| 2423 | add_sta_params->uAPSD = 0; |
| 2424 | /* |
| 2425 | * update UAPSD and send it to LIM to add STA |
| 2426 | * bitmap MSB <- LSB MSB 4 bits are for |
| 2427 | * trigger enabled AC setting and LSB 4 bits |
| 2428 | * are for delivery enabled AC setting |
| 2429 | * 7 6 5 4 3 2 1 0 |
| 2430 | * BE BK VI VO BE BK VI VO |
| 2431 | */ |
| 2432 | add_sta_params->uAPSD |= |
| 2433 | sta_ds->qos.capability.qosInfo.acvo_uapsd; |
| 2434 | add_sta_params->uAPSD |= |
| 2435 | (sta_ds->qos.capability.qosInfo.acvi_uapsd << 1); |
| 2436 | add_sta_params->uAPSD |= |
| 2437 | (sta_ds->qos.capability.qosInfo.acbk_uapsd << 2); |
| 2438 | add_sta_params->uAPSD |= |
| 2439 | (sta_ds->qos.capability.qosInfo.acbe_uapsd << 3); |
| 2440 | /* |
| 2441 | * making delivery enabled and |
| 2442 | * trigger enabled setting the same. |
| 2443 | */ |
| 2444 | add_sta_params->uAPSD |= add_sta_params->uAPSD << 4; |
| 2445 | |
| 2446 | add_sta_params->maxSPLen = |
| 2447 | sta_ds->qos.capability.qosInfo.maxSpLen; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2448 | pe_debug("uAPSD = 0x%x, maxSpLen = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2449 | add_sta_params->uAPSD, add_sta_params->maxSPLen); |
| 2450 | } |
| 2451 | #ifdef WLAN_FEATURE_11W |
| 2452 | add_sta_params->rmfEnabled = sta_ds->rmfEnabled; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2453 | pe_debug("PMF enabled %d", add_sta_params->rmfEnabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2454 | #endif |
| 2455 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2456 | pe_debug("htLdpcCapable: %d vhtLdpcCapable: %d " |
| 2457 | "p2pCapableSta: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2458 | add_sta_params->htLdpcCapable, add_sta_params->vhtLdpcCapable, |
| 2459 | add_sta_params->p2pCapableSta); |
| 2460 | |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 2461 | if (!add_sta_params->htLdpcCapable) |
| 2462 | add_sta_params->ht_caps &= ~(1 << SIR_MAC_HT_CAP_ADVCODING_S); |
| 2463 | if (!add_sta_params->vhtLdpcCapable) |
| 2464 | add_sta_params->vht_caps &= |
| 2465 | ~(1 << SIR_MAC_VHT_CAP_LDPC_CODING_CAP); |
| 2466 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2467 | /* |
| 2468 | * we need to defer the message until we get the |
| 2469 | * response back from HAL. |
| 2470 | */ |
| 2471 | if (add_sta_params->respReqd) |
| 2472 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, false); |
| 2473 | |
yeshwanth sriram guntuka | 47f26e6 | 2017-03-07 12:43:02 +0530 | [diff] [blame] | 2474 | add_sta_params->nwType = session_entry->nwType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2475 | |
Kiran Kumar Lokere | 80d3e1a | 2017-05-26 15:15:13 -0700 | [diff] [blame] | 2476 | if (!(add_sta_params->htCapable || add_sta_params->vhtCapable)) { |
| 2477 | nw_type_11b = 1; |
| 2478 | for (i = 0; i < SIR_NUM_11A_RATES; i++) { |
| 2479 | if (sirIsArate(sta_ds->supportedRates.llaRates[i] & |
| 2480 | 0x7F)) { |
| 2481 | nw_type_11b = 0; |
| 2482 | break; |
| 2483 | } |
| 2484 | } |
| 2485 | if (nw_type_11b) |
| 2486 | add_sta_params->nwType = eSIR_11B_NW_TYPE; |
| 2487 | } |
| 2488 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2489 | msg_q.type = WMA_ADD_STA_REQ; |
| 2490 | |
| 2491 | msg_q.reserved = 0; |
| 2492 | msg_q.bodyptr = add_sta_params; |
| 2493 | msg_q.bodyval = 0; |
| 2494 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2495 | pe_debug("Sending WMA_ADD_STA_REQ for assocId %d", sta_ds->assocId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2496 | MTRACE(mac_trace_msg_tx(mac_ctx, session_entry->peSessionId, |
| 2497 | msg_q.type)); |
| 2498 | |
| 2499 | ret_code = wma_post_ctrl_msg(mac_ctx, &msg_q); |
| 2500 | if (eSIR_SUCCESS != ret_code) { |
| 2501 | if (add_sta_params->respReqd) |
| 2502 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2503 | pe_err("ADD_STA_REQ for aId %d failed (reason %X)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2504 | sta_ds->assocId, ret_code); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2505 | qdf_mem_free(add_sta_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2506 | } |
| 2507 | |
| 2508 | return ret_code; |
| 2509 | } |
| 2510 | |
| 2511 | /** |
| 2512 | * lim_del_sta() |
| 2513 | * |
| 2514 | ***FUNCTION: |
| 2515 | * This function is called to delete an STA context at hardware |
| 2516 | * whenever a STA is disassociated |
| 2517 | * |
| 2518 | ***LOGIC: |
| 2519 | * |
| 2520 | ***ASSUMPTIONS: |
| 2521 | * NA |
| 2522 | * |
| 2523 | ***NOTE: |
| 2524 | * NA |
| 2525 | * |
| 2526 | * @param pMac - Pointer to Global MAC structure |
| 2527 | * @param pStaDs - Pointer to the STA datastructure created by |
| 2528 | * LIM and maintained by DPH |
| 2529 | * @param fRespReqd - flag to indicate whether the delete is synchronous (true) |
| 2530 | * or not (false) |
| 2531 | * @return retCode - Indicates success or failure return code |
| 2532 | */ |
| 2533 | |
| 2534 | tSirRetStatus |
| 2535 | lim_del_sta(tpAniSirGlobal pMac, |
| 2536 | tpDphHashNode pStaDs, bool fRespReqd, tpPESession psessionEntry) |
| 2537 | { |
| 2538 | tpDeleteStaParams pDelStaParams = NULL; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2539 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2540 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 2541 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2542 | pDelStaParams = qdf_mem_malloc(sizeof(tDeleteStaParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | if (NULL == pDelStaParams) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2544 | pe_err("Unable to allocate memory during ADD_STA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2545 | return eSIR_MEM_ALLOC_FAILED; |
| 2546 | } |
| 2547 | |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2548 | /* |
| 2549 | * 2G-AS platform: SAP associates with HT (11n)clients as 2x1 in 2G and |
| 2550 | * 2X2 in 5G |
| 2551 | * Non-2G-AS platform: SAP associates with HT (11n) clients as 2X2 in 2G |
| 2552 | * and 5G; and enable async dbs scan when all HT clients are gone |
| 2553 | * 5G-AS: Don't care |
| 2554 | */ |
| 2555 | if (!policy_mgr_is_hw_dbs_2x2_capable(pMac->psoc) && |
| 2556 | LIM_IS_AP_ROLE(psessionEntry) && |
| 2557 | (pStaDs->staType == STA_ENTRY_PEER) && |
| 2558 | !pStaDs->mlmStaContext.vhtCapability && |
| 2559 | (psessionEntry->nss == 2)) { |
| 2560 | psessionEntry->ht_client_cnt--; |
| 2561 | if (psessionEntry->ht_client_cnt == 0) { |
| 2562 | pe_debug("clearing SMPS intolrent vdev_param"); |
| 2563 | wma_cli_set_command(psessionEntry->smeSessionId, |
| 2564 | (int)WMI_VDEV_PARAM_SMPS_INTOLERANT, |
| 2565 | 0, VDEV_CMD); |
| 2566 | } |
| 2567 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | /* */ |
| 2569 | /* DPH contains the STA index only for "peer" STA entries. */ |
| 2570 | /* LIM global contains "self" STA index */ |
| 2571 | /* Thus, */ |
| 2572 | /* if( STA role ) */ |
| 2573 | /* get STA index from LIM global */ |
| 2574 | /* else */ |
| 2575 | /* get STA index from DPH */ |
| 2576 | /* */ |
| 2577 | |
| 2578 | #ifdef FEATURE_WLAN_TDLS |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 2579 | if (LIM_IS_STA_ROLE(psessionEntry) && |
| 2580 | (pStaDs->staType != STA_ENTRY_TDLS_PEER)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2581 | #else |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 2582 | if (LIM_IS_STA_ROLE(psessionEntry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2583 | #endif |
| 2584 | pDelStaParams->staIdx = psessionEntry->staId; |
| 2585 | |
| 2586 | else |
| 2587 | pDelStaParams->staIdx = pStaDs->staIndex; |
| 2588 | |
| 2589 | pDelStaParams->assocId = pStaDs->assocId; |
| 2590 | pStaDs->valid = 0; |
| 2591 | |
| 2592 | if (!fRespReqd) |
| 2593 | pDelStaParams->respReqd = 0; |
| 2594 | else { |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2595 | if (pStaDs->staType != STA_ENTRY_TDLS_PEER) { |
| 2596 | /* when lim_del_sta is called from processSmeAssocCnf |
| 2597 | * then mlmState is already set properly. */ |
| 2598 | if (eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != |
| 2599 | GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs)) { |
| 2600 | MTRACE(mac_trace |
| 2601 | (pMac, TRACE_CODE_MLM_STATE, |
| 2602 | psessionEntry->peSessionId, |
| 2603 | eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
| 2604 | SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, |
| 2605 | eLIM_MLM_WT_DEL_STA_RSP_STATE); |
| 2606 | } |
| 2607 | if (LIM_IS_STA_ROLE(psessionEntry)) { |
| 2608 | MTRACE(mac_trace |
| 2609 | (pMac, TRACE_CODE_MLM_STATE, |
| 2610 | psessionEntry->peSessionId, |
| 2611 | eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2612 | |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2613 | psessionEntry->limMlmState = |
| 2614 | eLIM_MLM_WT_DEL_STA_RSP_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2615 | |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2616 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2617 | } |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2618 | |
| 2619 | /* we need to defer the message until we get the |
| 2620 | * response back from HAL. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2621 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2622 | |
| 2623 | pDelStaParams->respReqd = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2624 | } |
| 2625 | |
| 2626 | /* Update PE session ID */ |
| 2627 | pDelStaParams->sessionId = psessionEntry->peSessionId; |
| 2628 | pDelStaParams->smesessionId = psessionEntry->smeSessionId; |
| 2629 | |
| 2630 | pDelStaParams->staType = pStaDs->staType; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2631 | qdf_mem_copy((uint8_t *) pDelStaParams->staMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2632 | (uint8_t *) pStaDs->staAddr, sizeof(tSirMacAddr)); |
| 2633 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2634 | pDelStaParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2635 | msgQ.type = WMA_DELETE_STA_REQ; |
| 2636 | msgQ.reserved = 0; |
| 2637 | msgQ.bodyptr = pDelStaParams; |
| 2638 | msgQ.bodyval = 0; |
| 2639 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2640 | pe_debug("Sessionid %d :Sending SIR_HAL_DELETE_STA_REQ " |
| 2641 | "for STAID: %X and AssocID: %d MAC : " |
| 2642 | MAC_ADDRESS_STR, pDelStaParams->sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2643 | pDelStaParams->staIdx, pDelStaParams->assocId, |
| 2644 | MAC_ADDR_ARRAY(pStaDs->staAddr)); |
| 2645 | |
| 2646 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 2647 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 2648 | if (eSIR_SUCCESS != retCode) { |
| 2649 | if (fRespReqd) |
| 2650 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2651 | pe_err("Posting DELETE_STA_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2652 | retCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2653 | qdf_mem_free(pDelStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2654 | } |
| 2655 | |
| 2656 | return retCode; |
| 2657 | } |
| 2658 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2659 | |
| 2660 | /** |
| 2661 | * lim_add_sta_self() |
| 2662 | * |
| 2663 | ***FUNCTION: |
| 2664 | * This function is called to add an STA context at hardware |
| 2665 | * whenever a STA is (Re) Associated. |
| 2666 | * |
| 2667 | ***LOGIC: |
| 2668 | * |
| 2669 | ***ASSUMPTIONS: |
| 2670 | * NA |
| 2671 | * |
| 2672 | ***NOTE: |
| 2673 | * NA |
| 2674 | * |
| 2675 | * @param pMac - Pointer to Global MAC structure |
| 2676 | * @param pStaDs - Pointer to the STA datastructure created by |
| 2677 | * LIM and maintained by DPH |
| 2678 | * @return retCode - Indicates success or failure return code |
| 2679 | */ |
| 2680 | |
| 2681 | tSirRetStatus |
| 2682 | lim_add_sta_self(tpAniSirGlobal pMac, uint16_t staIdx, uint8_t updateSta, |
| 2683 | tpPESession psessionEntry) |
| 2684 | { |
| 2685 | tpAddStaParams pAddStaParams = NULL; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2686 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2687 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 2688 | tSirMacAddr staMac; |
| 2689 | uint32_t listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2690 | uint32_t ampduLenExponent = 0; |
| 2691 | /*This self Sta dot 11 mode comes from the cfg and the expectation here is |
| 2692 | * that cfg carries the systemwide capability that device under |
| 2693 | * consideration can support. This capability gets plumbed into the cfg |
| 2694 | * cache at system initialization time via the .dat and .ini file override |
| 2695 | * mechanisms and will not change. If it does change, it is the |
| 2696 | * responsibility of SME to evict the selfSta and reissue a new AddStaSelf |
| 2697 | * command.*/ |
| 2698 | uint32_t selfStaDot11Mode = 0, selfTxWidth = 0; |
| 2699 | uint32_t val; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2700 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2701 | wlan_cfg_get_int(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2702 | wlan_cfg_get_int(pMac, WNI_CFG_HT_CAP_INFO_SUPPORTED_CHAN_WIDTH_SET, |
| 2703 | &selfTxWidth); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2704 | pe_debug("cfgDot11Mode: %d selfTxWidth: %d", |
| 2705 | (int)selfStaDot11Mode, (int)selfTxWidth); |
| 2706 | pe_debug("Roam Channel Bonding Mode %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2707 | (int)pMac->roam.configParam.uCfgDot11Mode); |
| 2708 | |
| 2709 | sir_copy_mac_addr(staMac, psessionEntry->selfMacAddr); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2710 | pe_debug(MAC_ADDRESS_STR ": ", MAC_ADDR_ARRAY(staMac)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2711 | pAddStaParams = qdf_mem_malloc(sizeof(tAddStaParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2712 | if (NULL == pAddStaParams) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2713 | pe_err("Unable to allocate memory during ADD_STA"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2714 | return eSIR_MEM_ALLOC_FAILED; |
| 2715 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2716 | |
| 2717 | /* / Add STA context at MAC HW (BMU, RHP & TFP) */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2718 | qdf_mem_copy((uint8_t *) pAddStaParams->staMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2719 | (uint8_t *) staMac, sizeof(tSirMacAddr)); |
| 2720 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2721 | qdf_mem_copy((uint8_t *) pAddStaParams->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2722 | psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 2723 | |
| 2724 | pAddStaParams->assocId = psessionEntry->limAID; |
| 2725 | pAddStaParams->staType = STA_ENTRY_SELF; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2726 | pAddStaParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2727 | pAddStaParams->respReqd = 1; |
| 2728 | |
| 2729 | /* Update PE session ID */ |
| 2730 | pAddStaParams->sessionId = psessionEntry->peSessionId; |
| 2731 | |
| 2732 | /* Update SME session ID */ |
| 2733 | pAddStaParams->smesessionId = psessionEntry->smeSessionId; |
| 2734 | |
| 2735 | pAddStaParams->maxTxPower = psessionEntry->maxTxPower; |
| 2736 | |
| 2737 | /* This will indicate HAL to "allocate" a new STA index */ |
| 2738 | pAddStaParams->staIdx = staIdx; |
| 2739 | pAddStaParams->updateSta = updateSta; |
| 2740 | |
| 2741 | if (wlan_cfg_get_int(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != |
| 2742 | eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2743 | pe_err("Couldn't get SHORT_PREAMBLE, set default"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | pAddStaParams->shortPreambleSupported = 1; |
| 2745 | } else { |
| 2746 | pAddStaParams->shortPreambleSupported = val; |
| 2747 | } |
| 2748 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2749 | lim_populate_own_rate_set(pMac, &pAddStaParams->supportedRates, NULL, false, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 2750 | psessionEntry, NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2751 | if (IS_DOT11_MODE_HT(selfStaDot11Mode)) { |
| 2752 | pAddStaParams->htCapable = true; |
| 2753 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2754 | if ((psessionEntry->pLimJoinReq != NULL) |
| 2755 | && (!psessionEntry->pLimJoinReq->bssDescription. |
| 2756 | aniIndicator)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2757 | pe_err("Turning off Greenfield, when adding self entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2758 | pAddStaParams->greenFieldCapable = |
| 2759 | WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
| 2760 | } else |
| 2761 | #endif |
| 2762 | { |
| 2763 | pAddStaParams->greenFieldCapable = |
| 2764 | lim_get_ht_capability(pMac, eHT_GREENFIELD, |
| 2765 | psessionEntry); |
| 2766 | pAddStaParams->ch_width = |
| 2767 | pMac->roam.configParam.channelBondingMode5GHz; |
| 2768 | pAddStaParams->mimoPS = |
| 2769 | lim_get_ht_capability(pMac, eHT_MIMO_POWER_SAVE, |
| 2770 | psessionEntry); |
| 2771 | pAddStaParams->rifsMode = |
| 2772 | lim_get_ht_capability(pMac, eHT_RIFS_MODE, |
| 2773 | psessionEntry); |
| 2774 | pAddStaParams->lsigTxopProtection = |
| 2775 | lim_get_ht_capability(pMac, eHT_LSIG_TXOP_PROTECTION, |
| 2776 | psessionEntry); |
| 2777 | pAddStaParams->maxAmpduDensity = |
| 2778 | lim_get_ht_capability(pMac, eHT_MPDU_DENSITY, |
| 2779 | psessionEntry); |
| 2780 | pAddStaParams->maxAmpduSize = |
| 2781 | lim_get_ht_capability(pMac, eHT_MAX_RX_AMPDU_FACTOR, |
| 2782 | psessionEntry); |
| 2783 | pAddStaParams->maxAmsduSize = |
| 2784 | lim_get_ht_capability(pMac, eHT_MAX_AMSDU_LENGTH, |
| 2785 | psessionEntry); |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 2786 | pAddStaParams->max_amsdu_num = |
| 2787 | lim_get_ht_capability(pMac, eHT_MAX_AMSDU_NUM, |
| 2788 | psessionEntry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2789 | pAddStaParams->fDsssCckMode40Mhz = |
| 2790 | lim_get_ht_capability(pMac, eHT_DSSS_CCK_MODE_40MHZ, |
| 2791 | psessionEntry); |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 2792 | pAddStaParams->fShortGI20Mhz = |
| 2793 | psessionEntry->htConfig.ht_sgi20; |
| 2794 | pAddStaParams->fShortGI40Mhz = |
| 2795 | psessionEntry->htConfig.ht_sgi40; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2796 | pe_debug("greenFieldCapable: %d maxAmpduDensity: %d " |
| 2797 | "maxAmpduSize: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2798 | pAddStaParams->greenFieldCapable, |
| 2799 | pAddStaParams->maxAmpduDensity, |
| 2800 | pAddStaParams->maxAmpduSize); |
| 2801 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2802 | pe_debug("fDsssCckMode40Mhz: %d fShortGI20Mhz: %d " |
| 2803 | "fShortGI40Mhz: %d lsigTxopProtection: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2804 | pAddStaParams->fDsssCckMode40Mhz, |
| 2805 | pAddStaParams->fShortGI20Mhz, |
| 2806 | pAddStaParams->fShortGI40Mhz, |
| 2807 | pAddStaParams->lsigTxopProtection); |
| 2808 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2809 | pe_debug("maxAmsduSize: %d txChannelWidth: %d mimoPS: %d rifsMode %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2810 | pAddStaParams->maxAmsduSize, |
| 2811 | pAddStaParams->ch_width, |
| 2812 | pAddStaParams->mimoPS, pAddStaParams->rifsMode); |
| 2813 | } |
| 2814 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2815 | pAddStaParams->vhtCapable = IS_DOT11_MODE_VHT(selfStaDot11Mode); |
| 2816 | if (pAddStaParams->vhtCapable) { |
| 2817 | pAddStaParams->ch_width = |
| 2818 | psessionEntry->ch_width; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2819 | pe_debug("VHT WIDTH SET %d", pAddStaParams->ch_width); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2820 | } |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2821 | pAddStaParams->vhtTxBFCapable = |
| 2822 | psessionEntry->vht_config.su_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2823 | pAddStaParams->enable_su_tx_bformer = |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2824 | psessionEntry->vht_config.su_beam_former; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2825 | pe_debug("vhtCapable: %d vhtTxBFCapable %d, su_bfer %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2826 | pAddStaParams->vhtCapable, pAddStaParams->vhtTxBFCapable, |
| 2827 | pAddStaParams->enable_su_tx_bformer); |
| 2828 | |
| 2829 | /* In 11ac mode, the hardware is capable of supporting 128K AMPDU size */ |
| 2830 | if (IS_DOT11_MODE_VHT(selfStaDot11Mode)) { |
| 2831 | if (wlan_cfg_get_int |
| 2832 | (pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, &duLenExponent) |
| 2833 | != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2834 | pe_err("Couldn't get WNI_CFG_VHT_AMPDU_LEN_EXPONENT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2835 | } |
| 2836 | pAddStaParams->maxAmpduSize = (uint8_t) ampduLenExponent; |
| 2837 | } |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2838 | pAddStaParams->vhtTxMUBformeeCapable = |
| 2839 | psessionEntry->vht_config.mu_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2840 | pAddStaParams->enableVhtpAid = psessionEntry->enableVhtpAid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2841 | pAddStaParams->enableAmpduPs = psessionEntry->enableAmpduPs; |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 2842 | pAddStaParams->enableHtSmps = (psessionEntry->enableHtSmps && |
| 2843 | (!psessionEntry->supported_nss_1x1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2844 | pAddStaParams->htSmpsconfig = psessionEntry->htSmpsvalue; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 2845 | pAddStaParams->send_smps_action = |
| 2846 | psessionEntry->send_smps_action; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2847 | |
| 2848 | /* For Self STA get the LDPC capability from session i.e config.ini */ |
| 2849 | pAddStaParams->htLdpcCapable = |
| 2850 | (psessionEntry->txLdpcIniFeatureEnabled & 0x01); |
| 2851 | pAddStaParams->vhtLdpcCapable = |
| 2852 | ((psessionEntry->txLdpcIniFeatureEnabled >> 1) & 0x01); |
| 2853 | |
| 2854 | if (wlan_cfg_get_int(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != |
| 2855 | eSIR_SUCCESS) |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2856 | pe_err("Couldn't get LISTEN_INTERVAL"); |
| 2857 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2858 | pAddStaParams->listenInterval = (uint16_t) listenInterval; |
| 2859 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2860 | if (QDF_P2P_CLIENT_MODE == psessionEntry->pePersona) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2861 | pAddStaParams->p2pCapableSta = 1; |
| 2862 | } |
| 2863 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2864 | pe_debug(" StaIdx: %d updateSta = %d htcapable = %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2865 | pAddStaParams->staIdx, pAddStaParams->updateSta, |
| 2866 | pAddStaParams->htCapable); |
| 2867 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2868 | pe_debug("htLdpcCapable: %d vhtLdpcCapable: %d " |
| 2869 | "p2pCapableSta: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2870 | pAddStaParams->htLdpcCapable, pAddStaParams->vhtLdpcCapable, |
| 2871 | pAddStaParams->p2pCapableSta); |
| 2872 | |
| 2873 | if (psessionEntry->isNonRoamReassoc) { |
| 2874 | pAddStaParams->nonRoamReassoc = 1; |
| 2875 | psessionEntry->isNonRoamReassoc = 0; |
| 2876 | } |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2877 | pe_debug("sessionid: %d Assoc ID: %d listenInterval = %d " |
| 2878 | "shortPreambleSupported: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2879 | psessionEntry->smeSessionId, pAddStaParams->assocId, |
| 2880 | pAddStaParams->listenInterval, |
| 2881 | pAddStaParams->shortPreambleSupported); |
| 2882 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2883 | if (IS_DOT11_MODE_HE(selfStaDot11Mode)) |
| 2884 | lim_add_self_he_cap(pAddStaParams, psessionEntry); |
| 2885 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2886 | msgQ.type = WMA_ADD_STA_REQ; |
| 2887 | msgQ.reserved = 0; |
| 2888 | msgQ.bodyptr = pAddStaParams; |
| 2889 | msgQ.bodyval = 0; |
| 2890 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2891 | pe_debug(MAC_ADDRESS_STR ":Sessionid %d : " |
| 2892 | "Sending WMA_ADD_STA_REQ. (aid %d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2893 | MAC_ADDR_ARRAY(pAddStaParams->staMac), |
| 2894 | pAddStaParams->sessionId, pAddStaParams->assocId); |
| 2895 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 2896 | |
| 2897 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 2898 | if (eSIR_SUCCESS != retCode) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2899 | pe_err("Posting WMA_ADD_STA_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2900 | retCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2901 | qdf_mem_free(pAddStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2902 | } |
| 2903 | return retCode; |
| 2904 | } |
| 2905 | |
| 2906 | /** |
| 2907 | * limTeardownInfraBSS() |
| 2908 | * |
| 2909 | ***FUNCTION: |
| 2910 | * This function is called by various LIM functions to teardown |
| 2911 | * an established Infrastructure BSS |
| 2912 | * |
| 2913 | ***LOGIC: |
| 2914 | * |
| 2915 | ***ASSUMPTIONS: |
| 2916 | * |
| 2917 | ***NOTE: |
| 2918 | * |
| 2919 | * @param pMac - Pointer to Global MAC structure |
| 2920 | * @return None |
| 2921 | */ |
| 2922 | |
| 2923 | void lim_teardown_infra_bss(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 2924 | { |
| 2925 | tSirMacAddr bcAddr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
| 2926 | |
| 2927 | /** |
| 2928 | * Send Broadcast Disassociate frame with |
| 2929 | * 'leaving BSS' reason. |
| 2930 | */ |
| 2931 | lim_send_disassoc_mgmt_frame(pMac, |
| 2932 | eSIR_MAC_DISASSOC_LEAVING_BSS_REASON, |
| 2933 | bcAddr, psessionEntry, false); |
| 2934 | } /*** end lim_teardown_infra_bss() ***/ |
| 2935 | |
| 2936 | /** |
| 2937 | * lim_handle_cnf_wait_timeout() |
| 2938 | * |
| 2939 | ***FUNCTION: |
| 2940 | * This function is called by limProcessMessageQueue to handle |
| 2941 | * various confirmation failure cases. |
| 2942 | * |
| 2943 | ***LOGIC: |
| 2944 | * |
| 2945 | ***ASSUMPTIONS: |
| 2946 | * |
| 2947 | ***NOTE: |
| 2948 | * |
| 2949 | * @param pMac - Pointer to Global MAC structure |
| 2950 | * @param pStaDs - Pointer to a sta descriptor |
| 2951 | * @return None |
| 2952 | */ |
| 2953 | |
| 2954 | void lim_handle_cnf_wait_timeout(tpAniSirGlobal pMac, uint16_t staId) |
| 2955 | { |
| 2956 | tpDphHashNode pStaDs; |
| 2957 | tpPESession psessionEntry = NULL; |
| 2958 | |
| 2959 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 2960 | pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId); |
| 2961 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2962 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2963 | return; |
| 2964 | } |
| 2965 | pStaDs = dph_get_hash_entry(pMac, staId, &psessionEntry->dph.dphHashTable); |
| 2966 | |
| 2967 | if (pStaDs == NULL) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2968 | pe_err("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2969 | return; |
| 2970 | } |
| 2971 | |
| 2972 | switch (pStaDs->mlmStaContext.mlmState) { |
| 2973 | case eLIM_MLM_WT_ASSOC_CNF_STATE: |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2974 | pe_debug("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d", |
| 2975 | pStaDs->assocId); |
Srinivas Girigowda | f936d82 | 2017-03-19 23:23:59 -0700 | [diff] [blame] | 2976 | lim_print_mac_addr(pMac, pStaDs->staAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2977 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 2978 | if (LIM_IS_AP_ROLE(psessionEntry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2979 | lim_reject_association(pMac, pStaDs->staAddr, |
| 2980 | pStaDs->mlmStaContext.subType, |
| 2981 | true, |
| 2982 | pStaDs->mlmStaContext.authType, |
| 2983 | pStaDs->assocId, true, |
| 2984 | (tSirResultCodes) |
| 2985 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2986 | psessionEntry); |
| 2987 | } |
| 2988 | break; |
| 2989 | |
| 2990 | default: |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2991 | pe_warn("Received CNF_WAIT_TIMEOUT in state %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2992 | pStaDs->mlmStaContext.mlmState); |
| 2993 | } |
| 2994 | } |
| 2995 | |
| 2996 | /** |
| 2997 | * lim_delete_dph_hash_entry()- function to delete dph hash entry |
| 2998 | * @mac_ctx: pointer to global mac structure |
| 2999 | * @sta_addr: peer station address |
| 3000 | * @sta_id: id assigned to peer station |
| 3001 | * @session_entry: pe session entry |
| 3002 | * |
| 3003 | * This function is called whenever we need to delete |
| 3004 | * the dph hash entry |
| 3005 | * |
| 3006 | * Return: none |
| 3007 | */ |
| 3008 | |
| 3009 | void |
| 3010 | lim_delete_dph_hash_entry(tpAniSirGlobal mac_ctx, tSirMacAddr sta_addr, |
| 3011 | uint16_t sta_id, tpPESession session_entry) |
| 3012 | { |
| 3013 | uint16_t aid; |
| 3014 | tpDphHashNode sta_ds; |
| 3015 | tUpdateBeaconParams beacon_params; |
| 3016 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3017 | qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3018 | beacon_params.paramChangeBitmap = 0; |
| 3019 | lim_deactivate_and_change_per_sta_id_timer(mac_ctx, eLIM_CNF_WAIT_TIMER, |
| 3020 | sta_id); |
| 3021 | if (NULL == session_entry) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3022 | pe_err("NULL session_entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3023 | return; |
| 3024 | } |
| 3025 | |
| 3026 | beacon_params.bssIdx = session_entry->bssIdx; |
| 3027 | sta_ds = dph_lookup_hash_entry(mac_ctx, sta_addr, &aid, |
| 3028 | &session_entry->dph.dphHashTable); |
| 3029 | |
| 3030 | if (sta_ds == NULL) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3031 | pe_err("sta_ds is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3032 | return; |
| 3033 | } |
| 3034 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3035 | pe_debug("Deleting DPH Hash entry for STAID: %X", sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3036 | /* |
| 3037 | * update the station count and perform associated actions |
| 3038 | * do this before deleting the dph hash entry |
| 3039 | */ |
| 3040 | lim_util_count_sta_del(mac_ctx, sta_ds, session_entry); |
| 3041 | |
| 3042 | if (LIM_IS_AP_ROLE(session_entry) || LIM_IS_IBSS_ROLE(session_entry)) { |
| 3043 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 3044 | if (session_entry->gLimProtectionControl != |
| 3045 | WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 3046 | lim_decide_ap_protection_on_delete(mac_ctx, |
| 3047 | sta_ds, &beacon_params, session_entry); |
| 3048 | } |
| 3049 | |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 3050 | if (sta_ds->non_ecsa_capable) { |
| 3051 | if (session_entry->lim_non_ecsa_cap_num == 0) { |
| 3052 | pe_debug("NonECSA sta 0, id %d is ecsa", |
| 3053 | sta_id); |
| 3054 | } else { |
| 3055 | session_entry->lim_non_ecsa_cap_num--; |
| 3056 | pe_debug("reducing the non ECSA num to %d", |
| 3057 | session_entry->lim_non_ecsa_cap_num); |
| 3058 | } |
| 3059 | } |
| 3060 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3061 | if (LIM_IS_IBSS_ROLE(session_entry)) |
| 3062 | lim_ibss_decide_protection_on_delete(mac_ctx, sta_ds, |
| 3063 | &beacon_params, session_entry); |
| 3064 | |
| 3065 | lim_decide_short_preamble(mac_ctx, sta_ds, &beacon_params, |
| 3066 | session_entry); |
| 3067 | lim_decide_short_slot(mac_ctx, sta_ds, &beacon_params, |
| 3068 | session_entry); |
| 3069 | |
| 3070 | /* Send message to HAL about beacon parameter change. */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3071 | pe_debug("param bitmap: %d", beacon_params.paramChangeBitmap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | if (beacon_params.paramChangeBitmap && |
| 3073 | (false == |
| 3074 | mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
| 3075 | sch_set_fixed_beacon_fields(mac_ctx, session_entry); |
| 3076 | lim_send_beacon_params(mac_ctx, &beacon_params, |
| 3077 | session_entry); |
| 3078 | } |
| 3079 | #ifdef WLAN_FEATURE_11W |
| 3080 | tx_timer_delete(&sta_ds->pmfSaQueryTimer); |
| 3081 | #endif |
| 3082 | } |
| 3083 | |
| 3084 | if (dph_delete_hash_entry(mac_ctx, sta_addr, sta_id, |
| 3085 | &session_entry->dph.dphHashTable) != eSIR_SUCCESS) |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3086 | pe_err("error deleting hash entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3087 | } |
| 3088 | |
| 3089 | /** |
| 3090 | * lim_check_and_announce_join_success()- function to check if the received |
| 3091 | * Beacon/Probe Response is from the BSS that we're attempting to join. |
| 3092 | * @mac: pointer to global mac structure |
| 3093 | * @beacon_probe_rsp: pointer to reveived beacon/probe response frame |
| 3094 | * @header: pointer to received management frame header |
| 3095 | * @session_entry: pe session entry |
| 3096 | * |
| 3097 | * This function is called upon receiving Beacon/Probe Response |
| 3098 | * frame in WT_JOIN_BEACON_STATE to check if the received |
| 3099 | * Beacon/Probe Response is from the BSS that we're attempting |
| 3100 | * to join. |
| 3101 | * If the Beacon/Probe Response is indeed from the BSS we're |
| 3102 | * attempting to join, join success is sent to SME. |
| 3103 | * |
| 3104 | * Return: none |
| 3105 | */ |
| 3106 | |
| 3107 | void |
| 3108 | lim_check_and_announce_join_success(tpAniSirGlobal mac_ctx, |
| 3109 | tSirProbeRespBeacon *beacon_probe_rsp, tpSirMacMgmtHdr header, |
| 3110 | tpPESession session_entry) |
| 3111 | { |
| 3112 | tSirMacSSid current_ssid; |
| 3113 | tLimMlmJoinCnf mlm_join_cnf; |
| 3114 | uint32_t val = 0; |
| 3115 | uint32_t *noa_duration_from_beacon = NULL; |
| 3116 | uint32_t *noa2_duration_from_beacon = NULL; |
| 3117 | uint32_t noa; |
| 3118 | uint32_t total_num_noa_desc = 0; |
| 3119 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3120 | qdf_mem_copy(current_ssid.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3121 | session_entry->ssId.ssId, session_entry->ssId.length); |
| 3122 | |
| 3123 | current_ssid.length = (uint8_t) session_entry->ssId.length; |
| 3124 | |
| 3125 | /* |
| 3126 | * Check for SSID only in probe response. Beacons may not carry |
| 3127 | * SSID information in hidden SSID case |
| 3128 | */ |
| 3129 | if (((SIR_MAC_MGMT_FRAME == header->fc.type) && |
| 3130 | (SIR_MAC_MGMT_PROBE_RSP == header->fc.subType)) && |
| 3131 | current_ssid.length && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3132 | (qdf_mem_cmp((uint8_t *) &beacon_probe_rsp->ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3133 | (uint8_t *) ¤t_ssid, |
| 3134 | (uint8_t) (1 + current_ssid.length)))) { |
| 3135 | /* |
| 3136 | * Received SSID does not match with the one we've. |
| 3137 | * Ignore received Beacon frame |
| 3138 | */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3139 | pe_debug("SSID received in Beacon does not match"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3140 | #ifdef WLAN_DEBUG |
| 3141 | mac_ctx->lim.gLimBcnSSIDMismatchCnt++; |
| 3142 | #endif |
| 3143 | return; |
| 3144 | } |
| 3145 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 3146 | if (!LIM_IS_STA_ROLE(session_entry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | return; |
| 3148 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3149 | pe_debug("Received Beacon/PR with matching BSSID:%pM PESessionID %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3150 | session_entry->bssId, session_entry->peSessionId); |
| 3151 | |
| 3152 | /* Deactivate Join Failure timer */ |
| 3153 | lim_deactivate_and_change_timer(mac_ctx, eLIM_JOIN_FAIL_TIMER); |
| 3154 | /* Deactivate Periodic Join timer */ |
| 3155 | lim_deactivate_and_change_timer(mac_ctx, |
| 3156 | eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
| 3157 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3158 | if (QDF_P2P_CLIENT_MODE == session_entry->pePersona && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3159 | beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.present) { |
| 3160 | |
| 3161 | noa_duration_from_beacon = (uint32_t *) |
| 3162 | (beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.NoADesc + 1); |
| 3163 | |
| 3164 | if (beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.num_NoADesc) |
| 3165 | total_num_noa_desc = |
| 3166 | beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence. |
| 3167 | num_NoADesc / SIZE_OF_NOA_DESCRIPTOR; |
| 3168 | |
| 3169 | noa = *noa_duration_from_beacon; |
| 3170 | |
| 3171 | if (total_num_noa_desc > 1) { |
| 3172 | noa2_duration_from_beacon = (uint32_t *) |
| 3173 | (beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.NoADesc + |
| 3174 | SIZE_OF_NOA_DESCRIPTOR + 1); |
| 3175 | noa += *noa2_duration_from_beacon; |
| 3176 | } |
| 3177 | |
| 3178 | /* |
| 3179 | * If MAX Noa exceeds 3 secs we will consider only 3 secs to |
| 3180 | * avoid arbitary values in noa duration field |
| 3181 | */ |
| 3182 | noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? |
| 3183 | MAX_NOA_PERIOD_IN_MICROSECS : noa; |
| 3184 | noa = noa / 1000; /* Convert to ms */ |
| 3185 | |
| 3186 | if (wlan_cfg_get_int(mac_ctx, |
| 3187 | WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, &val) == |
| 3188 | eSIR_SUCCESS) { |
| 3189 | session_entry->defaultAuthFailureTimeout = val; |
| 3190 | cfg_set_int(mac_ctx, |
| 3191 | WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, |
| 3192 | val + noa); |
| 3193 | } |
| 3194 | } else { |
| 3195 | session_entry->defaultAuthFailureTimeout = 0; |
| 3196 | } |
| 3197 | |
Selvaraj, Sridhar | ac4fcf3 | 2016-09-28 12:57:32 +0530 | [diff] [blame] | 3198 | |
| 3199 | /* |
| 3200 | * Check if MBO Association disallowed subattr is present and post |
| 3201 | * failure status to LIM if present |
| 3202 | */ |
| 3203 | if (!session_entry->ignore_assoc_disallowed && |
| 3204 | beacon_probe_rsp->assoc_disallowed) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3205 | pe_err("Connection fails due to assoc disallowed reason(%d):%pM PESessionID %d", |
Selvaraj, Sridhar | ac4fcf3 | 2016-09-28 12:57:32 +0530 | [diff] [blame] | 3206 | beacon_probe_rsp->assoc_disallowed_reason, |
| 3207 | session_entry->bssId, |
| 3208 | session_entry->peSessionId); |
| 3209 | mlm_join_cnf.resultCode = eSIR_SME_ASSOC_REFUSED; |
| 3210 | mlm_join_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3211 | session_entry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 3212 | mlm_join_cnf.sessionId = session_entry->peSessionId; |
| 3213 | if (session_entry->pLimMlmJoinReq) { |
| 3214 | qdf_mem_free(session_entry->pLimMlmJoinReq); |
| 3215 | session_entry->pLimMlmJoinReq = NULL; |
| 3216 | } |
| 3217 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, |
| 3218 | (uint32_t *) &mlm_join_cnf); |
| 3219 | return; |
| 3220 | } |
| 3221 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3222 | /* Update Beacon Interval at CFG database */ |
| 3223 | |
| 3224 | if (beacon_probe_rsp->HTCaps.present) |
| 3225 | lim_update_sta_run_time_ht_capability(mac_ctx, |
| 3226 | &beacon_probe_rsp->HTCaps); |
| 3227 | if (beacon_probe_rsp->HTInfo.present) |
| 3228 | lim_update_sta_run_time_ht_info(mac_ctx, |
| 3229 | &beacon_probe_rsp->HTInfo, session_entry); |
| 3230 | session_entry->limMlmState = eLIM_MLM_JOINED_STATE; |
| 3231 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 3232 | session_entry->peSessionId, eLIM_MLM_JOINED_STATE)); |
| 3233 | |
| 3234 | /* |
| 3235 | * update the capability info based on recently received beacon/probe |
| 3236 | * response frame |
| 3237 | */ |
| 3238 | session_entry->limCurrentBssCaps = |
| 3239 | lim_get_u16((uint8_t *)&beacon_probe_rsp->capabilityInfo); |
| 3240 | |
| 3241 | /* |
| 3242 | * Announce join success by sending |
| 3243 | * Join confirm to SME. |
| 3244 | */ |
| 3245 | mlm_join_cnf.resultCode = eSIR_SME_SUCCESS; |
| 3246 | mlm_join_cnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS; |
| 3247 | /* Update PE sessionId */ |
| 3248 | mlm_join_cnf.sessionId = session_entry->peSessionId; |
| 3249 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, |
| 3250 | (uint32_t *) &mlm_join_cnf); |
| 3251 | |
Kiran Kumar Lokere | dda6077 | 2017-05-24 18:45:26 -0700 | [diff] [blame] | 3252 | if ((IS_DOT11_MODE_VHT(session_entry->dot11mode)) && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3253 | beacon_probe_rsp->vendor_vht_ie.VHTCaps.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3254 | session_entry->is_vendor_specific_vhtcaps = true; |
| 3255 | session_entry->vendor_specific_vht_ie_type = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3256 | beacon_probe_rsp->vendor_vht_ie.type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3257 | session_entry->vendor_specific_vht_ie_sub_type = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3258 | beacon_probe_rsp->vendor_vht_ie.sub_type; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3259 | pe_debug("VHT caps are present in vendor specific IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3260 | } |
Nitesh Shah | 0ddd4f6 | 2016-05-27 10:07:32 +0530 | [diff] [blame] | 3261 | |
| 3262 | /* Update HS 2.0 Information Element */ |
| 3263 | if (beacon_probe_rsp->hs20vendor_ie.present) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3264 | pe_debug("HS20 Indication Element Present, rel#:%u, id:%u", |
Nitesh Shah | 0ddd4f6 | 2016-05-27 10:07:32 +0530 | [diff] [blame] | 3265 | beacon_probe_rsp->hs20vendor_ie.release_num, |
| 3266 | beacon_probe_rsp->hs20vendor_ie.hs_id_present); |
| 3267 | qdf_mem_copy(&session_entry->hs20vendor_ie, |
| 3268 | &beacon_probe_rsp->hs20vendor_ie, |
| 3269 | sizeof(tDot11fIEhs20vendor_ie) - |
| 3270 | sizeof(beacon_probe_rsp->hs20vendor_ie.hs_id)); |
| 3271 | if (beacon_probe_rsp->hs20vendor_ie.hs_id_present) |
| 3272 | qdf_mem_copy(&session_entry->hs20vendor_ie.hs_id, |
| 3273 | &beacon_probe_rsp->hs20vendor_ie.hs_id, |
| 3274 | sizeof(beacon_probe_rsp->hs20vendor_ie.hs_id)); |
| 3275 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3276 | } |
| 3277 | |
| 3278 | /** |
| 3279 | * lim_extract_ap_capabilities() |
| 3280 | * |
| 3281 | ***FUNCTION: |
| 3282 | * This function is called to extract all of the AP's capabilities |
| 3283 | * from the IEs received from it in Beacon/Probe Response frames |
| 3284 | * |
| 3285 | ***LOGIC: |
| 3286 | * This routine mimics the lim_extract_ap_capability() API. The difference here |
| 3287 | * is that this API returns the entire tSirProbeRespBeacon info as is. It is |
| 3288 | * left to the caller of this API to use this info as required |
| 3289 | * |
| 3290 | ***ASSUMPTIONS: |
| 3291 | * NA |
| 3292 | * |
| 3293 | ***NOTE: |
| 3294 | * |
| 3295 | * @param pMac Pointer to Global MAC structure |
| 3296 | * @param pIE Pointer to starting IE in Beacon/Probe Response |
| 3297 | * @param ieLen Length of all IEs combined |
| 3298 | * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be |
| 3299 | * populated |
| 3300 | * @return status A status reporting eSIR_SUCCESS or eSIR_FAILURE |
| 3301 | */ |
| 3302 | tSirRetStatus lim_extract_ap_capabilities(tpAniSirGlobal pMac, |
| 3303 | uint8_t *pIE, |
| 3304 | uint16_t ieLen, |
| 3305 | tpSirProbeRespBeacon beaconStruct) |
| 3306 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3307 | qdf_mem_set((uint8_t *) beaconStruct, sizeof(tSirProbeRespBeacon), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3309 | pe_debug("lim_extract_ap_capabilities: The IE's being received are:"); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 3310 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 3311 | pIE, ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3312 | /* Parse the Beacon IE's, Don't try to parse if we dont have anything in IE */ |
| 3313 | if (ieLen > 0) { |
| 3314 | if (eSIR_SUCCESS != |
| 3315 | sir_parse_beacon_ie(pMac, beaconStruct, pIE, |
| 3316 | (uint32_t) ieLen)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3317 | pe_err("APCapExtract: Beacon parsing error!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3318 | return eSIR_FAILURE; |
| 3319 | } |
| 3320 | } |
| 3321 | |
| 3322 | return eSIR_SUCCESS; |
| 3323 | } |
| 3324 | |
| 3325 | /** |
| 3326 | * lim_del_bss() |
| 3327 | * |
| 3328 | ***FUNCTION: |
| 3329 | * This function is called to delete BSS context at hardware |
| 3330 | * whenever a STA is disassociated |
| 3331 | * |
| 3332 | ***LOGIC: |
| 3333 | * |
| 3334 | ***ASSUMPTIONS: |
| 3335 | * NA |
| 3336 | * |
| 3337 | ***NOTE: |
| 3338 | * NA |
| 3339 | * |
| 3340 | * @param pMac - Pointer to Global MAC structure |
| 3341 | * @param pStaDs - Pointer to the STA datastructure created by |
| 3342 | * LIM and maintained by DPH |
| 3343 | * @return retCode - Indicates success or failure return code |
| 3344 | */ |
| 3345 | |
| 3346 | tSirRetStatus |
| 3347 | lim_del_bss(tpAniSirGlobal pMac, tpDphHashNode pStaDs, uint16_t bssIdx, |
| 3348 | tpPESession psessionEntry) |
| 3349 | { |
| 3350 | tpDeleteBssParams pDelBssParams = NULL; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 3351 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3352 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 3353 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3354 | pDelBssParams = qdf_mem_malloc(sizeof(tDeleteBssParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3355 | if (NULL == pDelBssParams) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3356 | pe_err("Unable to allocate memory during ADD_BSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3357 | return eSIR_MEM_ALLOC_FAILED; |
| 3358 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3359 | |
| 3360 | pDelBssParams->sessionId = psessionEntry->peSessionId; /* update PE session Id */ |
| 3361 | |
| 3362 | /* DPH was storing the AssocID in staID field, */ |
| 3363 | /* staID is actually assigned by HAL when AddSTA message is sent. */ |
| 3364 | if (pStaDs != NULL) { |
| 3365 | pDelBssParams->bssIdx = pStaDs->bssId; |
| 3366 | pStaDs->valid = 0; |
| 3367 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE; |
| 3368 | } else |
| 3369 | pDelBssParams->bssIdx = bssIdx; |
| 3370 | psessionEntry->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE; |
| 3371 | MTRACE(mac_trace |
| 3372 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 3373 | eLIM_MLM_WT_DEL_BSS_RSP_STATE)); |
| 3374 | |
| 3375 | if ((psessionEntry->peSessionId == |
| 3376 | pMac->lim.limTimers.gLimJoinFailureTimer.sessionId) |
| 3377 | && (true == |
| 3378 | tx_timer_running(&pMac->lim.limTimers.gLimJoinFailureTimer))) { |
| 3379 | lim_deactivate_and_change_timer(pMac, eLIM_JOIN_FAIL_TIMER); |
| 3380 | } |
| 3381 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3382 | pDelBssParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | pDelBssParams->respReqd = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3384 | qdf_mem_copy(pDelBssParams->bssid, psessionEntry->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3385 | sizeof(tSirMacAddr)); |
| 3386 | pDelBssParams->smesessionId = psessionEntry->smeSessionId; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3387 | pe_debug("Sessionid %d : Sending HAL_DELETE_BSS_REQ " |
| 3388 | "for bss idx: %X BSSID:" MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3389 | pDelBssParams->sessionId, pDelBssParams->bssIdx, |
| 3390 | MAC_ADDR_ARRAY(psessionEntry->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3391 | /* we need to defer the message until we get the response back from HAL. */ |
| 3392 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 3393 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3394 | pe_debug("process_ho_fail = %d", psessionEntry->process_ho_fail); |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 3395 | if (psessionEntry->process_ho_fail) |
| 3396 | msgQ.type = WMA_DELETE_BSS_HO_FAIL_REQ; |
| 3397 | else |
| 3398 | msgQ.type = WMA_DELETE_BSS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | msgQ.reserved = 0; |
| 3400 | msgQ.bodyptr = pDelBssParams; |
| 3401 | msgQ.bodyval = 0; |
| 3402 | |
| 3403 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 3404 | |
| 3405 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 3406 | if (eSIR_SUCCESS != retCode) { |
| 3407 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3408 | pe_err("Posting DELETE_BSS_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | retCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3410 | qdf_mem_free(pDelBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | } |
| 3412 | |
| 3413 | return retCode; |
| 3414 | } |
| 3415 | |
| 3416 | /** |
| 3417 | * lim_update_vhtcaps_assoc_resp : Update VHT caps in assoc response. |
| 3418 | * @mac_ctx Pointer to Global MAC structure |
| 3419 | * @pAddBssParams: parameters required for add bss params. |
| 3420 | * @vht_caps: VHT capabilities. |
| 3421 | * @psessionEntry : session entry. |
| 3422 | * |
| 3423 | * Return : void |
| 3424 | */ |
Jeff Johnson | 72c8e7c | 2016-10-06 18:43:52 -0700 | [diff] [blame] | 3425 | static void lim_update_vhtcaps_assoc_resp(tpAniSirGlobal mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3426 | tpAddBssParams pAddBssParams, |
| 3427 | tDot11fIEVHTCaps *vht_caps, tpPESession psessionEntry) |
| 3428 | { |
| 3429 | pAddBssParams->staContext.vht_caps = |
| 3430 | ((vht_caps->maxMPDULen << |
| 3431 | SIR_MAC_VHT_CAP_MAX_MPDU_LEN) | |
| 3432 | (vht_caps->supportedChannelWidthSet << |
| 3433 | SIR_MAC_VHT_CAP_SUPP_CH_WIDTH_SET) | |
| 3434 | (vht_caps->ldpcCodingCap << |
| 3435 | SIR_MAC_VHT_CAP_LDPC_CODING_CAP) | |
| 3436 | (vht_caps->shortGI80MHz << |
| 3437 | SIR_MAC_VHT_CAP_SHORTGI_80MHZ) | |
| 3438 | (vht_caps->shortGI160and80plus80MHz << |
| 3439 | SIR_MAC_VHT_CAP_SHORTGI_160_80_80MHZ) | |
| 3440 | (vht_caps->txSTBC << |
| 3441 | SIR_MAC_VHT_CAP_TXSTBC) | |
| 3442 | (vht_caps->rxSTBC << |
| 3443 | SIR_MAC_VHT_CAP_RXSTBC) | |
| 3444 | (vht_caps->suBeamFormerCap << |
| 3445 | SIR_MAC_VHT_CAP_SU_BEAMFORMER_CAP) | |
| 3446 | (vht_caps->suBeamformeeCap << |
| 3447 | SIR_MAC_VHT_CAP_SU_BEAMFORMEE_CAP) | |
| 3448 | (vht_caps->csnofBeamformerAntSup << |
| 3449 | SIR_MAC_VHT_CAP_CSN_BEAMORMER_ANT_SUP) | |
| 3450 | (vht_caps->numSoundingDim << |
| 3451 | SIR_MAC_VHT_CAP_NUM_SOUNDING_DIM) | |
| 3452 | (vht_caps->muBeamformerCap << |
| 3453 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMER_CAP) | |
| 3454 | (vht_caps->muBeamformeeCap << |
| 3455 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMEE_CAP) | |
| 3456 | (vht_caps->vhtTXOPPS << |
| 3457 | SIR_MAC_VHT_CAP_TXOPPS) | |
| 3458 | (vht_caps->htcVHTCap << |
| 3459 | SIR_MAC_VHT_CAP_HTC_CAP) | |
| 3460 | (vht_caps->maxAMPDULenExp << |
| 3461 | SIR_MAC_VHT_CAP_MAX_AMDU_LEN_EXPO) | |
| 3462 | (vht_caps->vhtLinkAdaptCap << |
| 3463 | SIR_MAC_VHT_CAP_LINK_ADAPT_CAP) | |
| 3464 | (vht_caps->rxAntPattern << |
| 3465 | SIR_MAC_VHT_CAP_RX_ANTENNA_PATTERN) | |
| 3466 | (vht_caps->txAntPattern << |
| 3467 | SIR_MAC_VHT_CAP_TX_ANTENNA_PATTERN) | |
| 3468 | (vht_caps->reserved1 << |
| 3469 | SIR_MAC_VHT_CAP_RESERVED2)); |
| 3470 | |
| 3471 | pAddBssParams->staContext.maxAmpduSize = |
| 3472 | SIR_MAC_GET_VHT_MAX_AMPDU_EXPO( |
| 3473 | pAddBssParams->staContext.vht_caps); |
| 3474 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3475 | pe_debug("Updating VHT caps in assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3476 | } |
| 3477 | |
| 3478 | /** |
| 3479 | * lim_update_vht_oper_assoc_resp : Update VHT Operations in assoc response. |
| 3480 | * @mac_ctx Pointer to Global MAC structure |
| 3481 | * @pAddBssParams: parameters required for add bss params. |
| 3482 | * @vht_oper: VHT Operations to update. |
| 3483 | * @psessionEntry : session entry. |
| 3484 | * |
| 3485 | * Return : void |
| 3486 | */ |
Jeff Johnson | 72c8e7c | 2016-10-06 18:43:52 -0700 | [diff] [blame] | 3487 | static void lim_update_vht_oper_assoc_resp(tpAniSirGlobal mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3488 | tpAddBssParams pAddBssParams, |
| 3489 | tDot11fIEVHTOperation *vht_oper, tpPESession psessionEntry) |
| 3490 | { |
| 3491 | if (vht_oper->chanWidth && |
| 3492 | psessionEntry->ch_width) { |
| 3493 | pAddBssParams->ch_width = vht_oper->chanWidth + 1; |
| 3494 | |
| 3495 | pAddBssParams->ch_center_freq_seg0 = |
| 3496 | vht_oper->chanCenterFreqSeg1; |
| 3497 | |
| 3498 | pAddBssParams->ch_center_freq_seg1 = |
| 3499 | vht_oper->chanCenterFreqSeg2; |
| 3500 | } |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3501 | pe_debug("Updating VHT Operation in assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3502 | } |
| 3503 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3504 | /** |
| 3505 | * limSendAddBss() |
| 3506 | * |
| 3507 | ***FUNCTION: |
| 3508 | * |
| 3509 | ***LOGIC: |
| 3510 | * 1) LIM receives eWNI_SME_JOIN_REQ |
| 3511 | * 2) For a valid eWNI_SME_JOIN_REQ, LIM sends |
| 3512 | * SIR_HAL_ADD_BSS_REQ to HAL |
| 3513 | * |
| 3514 | ***ASSUMPTIONS: |
| 3515 | * JOIN REQ parameters are saved in pMac->lim.gLimMlmJoinReq |
| 3516 | * ADD BSS parameters can be obtained from two sources: |
| 3517 | * 1) pMac->lim.gLimMlmJoinReq |
| 3518 | * 2) beaconStruct, passed as paramter |
| 3519 | * So, if a reqd parameter is found in bssDescriptions |
| 3520 | * then it is given preference over beaconStruct |
| 3521 | * |
| 3522 | ***NOTE: |
| 3523 | * |
| 3524 | * @param pMac Pointer to Global MAC structure |
| 3525 | * pAssocRsp contains the structured assoc/reassoc Response got from AP |
| 3526 | * beaconstruct Has the ProbeRsp/Beacon structured details |
| 3527 | * bssDescription bssDescription passed to PE from the SME |
| 3528 | * @return None |
| 3529 | */ |
| 3530 | |
| 3531 | tSirRetStatus lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, |
| 3532 | tpSchBeaconStruct pBeaconStruct, |
| 3533 | tpSirBssDescription bssDescription, |
| 3534 | uint8_t updateEntry, tpPESession psessionEntry) |
| 3535 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 3536 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3537 | tpAddBssParams pAddBssParams = NULL; |
| 3538 | uint32_t retCode; |
| 3539 | tpDphHashNode pStaDs = NULL; |
| 3540 | uint8_t chanWidthSupp = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | uint32_t enableTxBF20MHz; |
| 3542 | tDot11fIEVHTCaps *vht_caps = NULL; |
| 3543 | tDot11fIEVHTOperation *vht_oper = NULL; |
| 3544 | tAddStaParams *sta_context; |
Krunal Soni | b3f4542 | 2017-07-24 18:59:45 -0700 | [diff] [blame] | 3545 | uint32_t listen_interval = WNI_CFG_LISTEN_INTERVAL_STADEF; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3546 | |
| 3547 | /* Package SIR_HAL_ADD_BSS_REQ message parameters */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3548 | pAddBssParams = qdf_mem_malloc(sizeof(tAddBssParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3549 | if (NULL == pAddBssParams) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3550 | pe_err("Unable to allocate memory during ADD_BSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3551 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 3552 | goto returnFailure; |
Selvaraj, Sridhar | 6a8dcdf | 2016-10-19 15:53:58 +0530 | [diff] [blame] | 3553 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3554 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3555 | qdf_mem_copy(pAddBssParams->bssId, bssDescription->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3556 | sizeof(tSirMacAddr)); |
| 3557 | /* Fill in tAddBssParams selfMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3558 | qdf_mem_copy(pAddBssParams->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3559 | psessionEntry->selfMacAddr, sizeof(tSirMacAddr)); |
| 3560 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3561 | pe_debug("sessionid: %d updateEntry: %d limsystemrole: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3562 | psessionEntry->smeSessionId, updateEntry, |
| 3563 | GET_LIM_SYSTEM_ROLE(psessionEntry)); |
| 3564 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3565 | pe_debug("BSSID: " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pAddBssParams->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3566 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 3567 | pAddBssParams->bssType = eSIR_INFRASTRUCTURE_MODE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3568 | |
| 3569 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA; |
| 3570 | |
| 3571 | /* Update PE session ID */ |
| 3572 | pAddBssParams->sessionId = psessionEntry->peSessionId; |
| 3573 | |
| 3574 | pAddBssParams->beaconInterval = bssDescription->beaconInterval; |
| 3575 | |
| 3576 | pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod; |
| 3577 | pAddBssParams->updateBss = updateEntry; |
| 3578 | |
| 3579 | pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount; |
| 3580 | pAddBssParams->cfParamSet.cfpPeriod = |
| 3581 | pBeaconStruct->cfParamSet.cfpPeriod; |
| 3582 | pAddBssParams->cfParamSet.cfpMaxDuration = |
| 3583 | pBeaconStruct->cfParamSet.cfpMaxDuration; |
| 3584 | pAddBssParams->cfParamSet.cfpDurRemaining = |
| 3585 | pBeaconStruct->cfParamSet.cfpDurRemaining; |
| 3586 | |
| 3587 | pAddBssParams->rateSet.numRates = pAssocRsp->supportedRates.numRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3588 | qdf_mem_copy(pAddBssParams->rateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | pAssocRsp->supportedRates.rate, |
| 3590 | pAssocRsp->supportedRates.numRates); |
| 3591 | |
| 3592 | if (IS_DOT11_MODE_11B(psessionEntry->dot11mode) && |
| 3593 | bssDescription->nwType != eSIR_11B_NW_TYPE) { |
| 3594 | pAddBssParams->nwType = eSIR_11B_NW_TYPE; |
| 3595 | } else { |
| 3596 | pAddBssParams->nwType = bssDescription->nwType; |
| 3597 | } |
| 3598 | |
| 3599 | pAddBssParams->shortSlotTimeSupported = |
| 3600 | (uint8_t) pAssocRsp->capabilityInfo.shortSlotTime; |
| 3601 | pAddBssParams->llaCoexist = |
| 3602 | (uint8_t) psessionEntry->beaconParams.llaCoexist; |
| 3603 | pAddBssParams->llbCoexist = |
| 3604 | (uint8_t) psessionEntry->beaconParams.llbCoexist; |
| 3605 | pAddBssParams->llgCoexist = |
| 3606 | (uint8_t) psessionEntry->beaconParams.llgCoexist; |
| 3607 | pAddBssParams->ht20Coexist = |
| 3608 | (uint8_t) psessionEntry->beaconParams.ht20Coexist; |
| 3609 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3610 | pe_debug("BSS Type %d Beacon Interval: %d dtimPeriod: %d " |
| 3611 | "cfpCount: %d", pAddBssParams->bssType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3612 | pAddBssParams->beaconInterval, pAddBssParams->dtimPeriod, |
| 3613 | pAddBssParams->cfParamSet.cfpCount); |
| 3614 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3615 | pe_debug("cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining: %d " |
| 3616 | "numRates: %d", pAddBssParams->cfParamSet.cfpPeriod, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3617 | pAddBssParams->cfParamSet.cfpMaxDuration, |
| 3618 | pAddBssParams->cfParamSet.cfpDurRemaining, |
| 3619 | pAddBssParams->rateSet.numRates); |
| 3620 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3621 | pe_debug("nwType:%d shortSlotTimeSupported: %d llaCoexist: %d " |
| 3622 | "llbCoexist: %d llgCoexist: %d ht20Coexist: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3623 | pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported, |
| 3624 | pAddBssParams->llaCoexist, pAddBssParams->llbCoexist, |
| 3625 | pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist); |
| 3626 | |
| 3627 | pAddBssParams->dot11_mode = psessionEntry->dot11mode; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3628 | pe_debug("dot11_mode: %d", pAddBssParams->dot11_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3629 | |
| 3630 | /* Use the advertised capabilities from the received beacon/PR */ |
| 3631 | |
| 3632 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) |
| 3633 | && (pAssocRsp->HTCaps.present)) { |
| 3634 | pAddBssParams->htCapable = pAssocRsp->HTCaps.present; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3635 | pe_debug("htCapable: %d", pAddBssParams->htCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3636 | if (pBeaconStruct->HTInfo.present) { |
| 3637 | pAddBssParams->htOperMode = |
| 3638 | (tSirMacHTOperatingMode) pAssocRsp->HTInfo.opMode; |
| 3639 | pAddBssParams->dualCTSProtection = |
| 3640 | (uint8_t) pAssocRsp->HTInfo.dualCTSProtection; |
| 3641 | chanWidthSupp = |
| 3642 | lim_get_ht_capability(pMac, |
| 3643 | eHT_SUPPORTED_CHANNEL_WIDTH_SET, |
| 3644 | psessionEntry); |
| 3645 | if ((pAssocRsp->HTCaps.supportedChannelWidthSet) |
| 3646 | && (chanWidthSupp)) { |
| 3647 | pAddBssParams->ch_width = (uint8_t) |
| 3648 | pAssocRsp->HTInfo.recommendedTxWidthSet; |
| 3649 | if (pAssocRsp->HTInfo.secondaryChannelOffset == |
| 3650 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 3651 | pAddBssParams->ch_center_freq_seg0 = |
| 3652 | bssDescription->channelId + 2; |
| 3653 | else if (pAssocRsp->HTInfo.secondaryChannelOffset == |
| 3654 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 3655 | pAddBssParams->ch_center_freq_seg0 = |
| 3656 | bssDescription->channelId - 2; |
| 3657 | } else { |
| 3658 | pAddBssParams->ch_width = CH_WIDTH_20MHZ; |
| 3659 | pAddBssParams->ch_center_freq_seg0 = 0; |
| 3660 | } |
| 3661 | pAddBssParams->llnNonGFCoexist = |
| 3662 | (uint8_t) pAssocRsp->HTInfo.nonGFDevicesPresent; |
| 3663 | pAddBssParams->fLsigTXOPProtectionFullSupport = |
| 3664 | (uint8_t) pAssocRsp->HTInfo. |
| 3665 | lsigTXOPProtectionFullSupport; |
| 3666 | pAddBssParams->fRIFSMode = pAssocRsp->HTInfo.rifsMode; |
| 3667 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3668 | pe_debug("htOperMode: %d dualCTSProtection: %d txChannelWidth: %d center_freq_0: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3669 | pAddBssParams->htOperMode, |
| 3670 | pAddBssParams->dualCTSProtection, |
| 3671 | pAddBssParams->ch_width, |
| 3672 | pAddBssParams->ch_center_freq_seg0); |
| 3673 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3674 | pe_debug("llnNonGFCoexist: %d " |
| 3675 | "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3676 | pAddBssParams->llnNonGFCoexist, |
| 3677 | pAddBssParams->fLsigTXOPProtectionFullSupport, |
| 3678 | pAddBssParams->fRIFSMode); |
| 3679 | } |
| 3680 | } |
| 3681 | |
| 3682 | pAddBssParams->currentOperChannel = bssDescription->channelId; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3683 | pe_debug("currentOperChannel %d", pAddBssParams->currentOperChannel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | if (psessionEntry->vhtCapability && (pAssocRsp->VHTCaps.present)) { |
| 3685 | pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present; |
| 3686 | vht_caps = &pAssocRsp->VHTCaps; |
| 3687 | vht_oper = &pAssocRsp->VHTOperation; |
| 3688 | } else if (psessionEntry->vhtCapability && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3689 | pAssocRsp->vendor_vht_ie.VHTCaps.present){ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3690 | pAddBssParams->vhtCapable = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3691 | pAssocRsp->vendor_vht_ie.VHTCaps.present; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3692 | pe_debug("VHT Caps and Operation are present in vendor Specfic IE"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3693 | vht_caps = &pAssocRsp->vendor_vht_ie.VHTCaps; |
| 3694 | vht_oper = &pAssocRsp->vendor_vht_ie.VHTOperation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3695 | } else { |
| 3696 | pAddBssParams->vhtCapable = 0; |
| 3697 | } |
| 3698 | if (pAddBssParams->vhtCapable) { |
| 3699 | if (vht_oper != NULL) |
| 3700 | lim_update_vht_oper_assoc_resp(pMac, pAddBssParams, |
| 3701 | vht_oper, psessionEntry); |
| 3702 | if (vht_caps != NULL) |
| 3703 | lim_update_vhtcaps_assoc_resp(pMac, pAddBssParams, |
| 3704 | vht_caps, psessionEntry); |
| 3705 | } |
| 3706 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3707 | pe_debug("vhtCapable %d TxChannelWidth %d center_freq_0 %d center_freq_1 %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3708 | pAddBssParams->vhtCapable, pAddBssParams->ch_width, |
| 3709 | pAddBssParams->ch_center_freq_seg0, |
| 3710 | pAddBssParams->ch_center_freq_seg1); |
| 3711 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 3712 | if (lim_is_session_he_capable(psessionEntry) && |
Manikandan Mohan | 39accff | 2017-05-02 16:09:00 -0700 | [diff] [blame] | 3713 | (pAssocRsp->vendor_he_cap.present)) { |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 3714 | lim_add_bss_he_cap(pAddBssParams, pAssocRsp); |
Manikandan Mohan | 39accff | 2017-05-02 16:09:00 -0700 | [diff] [blame] | 3715 | lim_add_bss_he_cfg(pAddBssParams, psessionEntry); |
| 3716 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3717 | /* |
| 3718 | * Populate the STA-related parameters here |
| 3719 | * Note that the STA here refers to the AP |
| 3720 | * staType = PEER |
| 3721 | */ |
| 3722 | sta_context = &pAddBssParams->staContext; |
| 3723 | /* Identifying AP as an STA */ |
| 3724 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; |
| 3725 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3726 | qdf_mem_copy(pAddBssParams->staContext.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3727 | bssDescription->bssId, sizeof(tSirMacAddr)); |
Krunal Soni | b3f4542 | 2017-07-24 18:59:45 -0700 | [diff] [blame] | 3728 | if (wlan_cfg_get_int(pMac, WNI_CFG_LISTEN_INTERVAL, &listen_interval) != |
| 3729 | eSIR_SUCCESS) |
| 3730 | pe_err("Couldn't get LISTEN_INTERVAL"); |
| 3731 | pAddBssParams->staContext.listenInterval = listen_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3732 | |
| 3733 | /* Fill Assoc id from the dph table */ |
| 3734 | pStaDs = dph_lookup_hash_entry(pMac, pAddBssParams->staContext.bssId, |
| 3735 | &pAddBssParams->staContext.assocId, |
| 3736 | &psessionEntry->dph.dphHashTable); |
| 3737 | if (pStaDs == NULL) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3738 | pe_err("Couldn't get assoc id for " "MAC ADDR: " |
| 3739 | MAC_ADDRESS_STR, |
| 3740 | MAC_ADDR_ARRAY( |
| 3741 | pAddBssParams->staContext.staMac)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3742 | return eSIR_FAILURE; |
| 3743 | } |
| 3744 | |
| 3745 | pAddBssParams->staContext.uAPSD = |
| 3746 | psessionEntry->gUapsdPerAcBitmask; |
| 3747 | |
| 3748 | pAddBssParams->staContext.maxSPLen = 0; |
| 3749 | pAddBssParams->staContext.shortPreambleSupported = |
| 3750 | (uint8_t) pAssocRsp->capabilityInfo.shortPreamble; |
| 3751 | pAddBssParams->staContext.updateSta = updateEntry; |
| 3752 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3753 | pe_debug("StaContext: " MAC_ADDRESS_STR |
| 3754 | " shortPreambleSupported: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac), |
| 3756 | pAddBssParams->staContext.shortPreambleSupported); |
| 3757 | |
| 3758 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) |
| 3759 | && pBeaconStruct->HTCaps.present) { |
| 3760 | pAddBssParams->staContext.us32MaxAmpduDuration = 0; |
| 3761 | pAddBssParams->staContext.htCapable = 1; |
| 3762 | pAddBssParams->staContext.greenFieldCapable = |
| 3763 | (uint8_t) pAssocRsp->HTCaps.greenField; |
| 3764 | pAddBssParams->staContext.lsigTxopProtection = |
| 3765 | (uint8_t) pAssocRsp->HTCaps.lsigTXOPProtection; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3766 | pe_debug("StaCtx: htCap %d GFcap %d lsigTxopProtn %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3767 | pAddBssParams->staContext.htCapable, |
| 3768 | pAddBssParams->staContext.greenFieldCapable, |
| 3769 | pAddBssParams->staContext.lsigTxopProtection); |
| 3770 | if (psessionEntry->vhtCapability && |
| 3771 | (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps) || |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3772 | IS_BSS_VHT_CAPABLE(pBeaconStruct-> |
| 3773 | vendor_vht_ie.VHTCaps))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3774 | pAddBssParams->staContext.vhtCapable = 1; |
| 3775 | pAddBssParams->staContext.vhtSupportedRxNss = |
| 3776 | pStaDs->vhtSupportedRxNss; |
| 3777 | if (pAssocRsp->VHTCaps.present) |
| 3778 | vht_caps = &pAssocRsp->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3779 | else if (pAssocRsp->vendor_vht_ie.VHTCaps.present) { |
| 3780 | vht_caps = &pAssocRsp->vendor_vht_ie.VHTCaps; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3781 | pe_debug("VHT Caps are in vendor Specfic IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3782 | } |
| 3783 | |
| 3784 | if ((vht_caps != NULL) && (vht_caps->suBeamFormerCap || |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3785 | vht_caps->muBeamformerCap) && |
| 3786 | psessionEntry->vht_config.su_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3787 | sta_context->vhtTxBFCapable = 1; |
| 3788 | |
| 3789 | if ((vht_caps != NULL) && vht_caps->muBeamformerCap && |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3790 | psessionEntry->vht_config.mu_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3791 | sta_context->vhtTxMUBformeeCapable = 1; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3792 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3793 | if ((vht_caps != NULL) && vht_caps->suBeamformeeCap && |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3794 | psessionEntry->vht_config.su_beam_former) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3795 | sta_context->enable_su_tx_bformer = 1; |
| 3796 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 3797 | if (lim_is_session_he_capable(psessionEntry) && |
| 3798 | pAssocRsp->vendor_he_cap.present) |
| 3799 | lim_intersect_ap_he_caps(psessionEntry, pAddBssParams, |
| 3800 | NULL, pAssocRsp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3801 | |
| 3802 | if ((pAssocRsp->HTCaps.supportedChannelWidthSet) && |
| 3803 | (chanWidthSupp)) { |
| 3804 | pAddBssParams->staContext.ch_width = (uint8_t) |
| 3805 | pAssocRsp->HTInfo.recommendedTxWidthSet; |
| 3806 | if (pAssocRsp->VHTCaps.present) |
| 3807 | vht_oper = &pAssocRsp->VHTOperation; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3808 | else if (pAssocRsp->vendor_vht_ie.VHTCaps.present) { |
| 3809 | vht_oper = &pAssocRsp-> |
| 3810 | vendor_vht_ie.VHTOperation; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3811 | pe_debug("VHT Op IE is in vendor Specfic IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3812 | } |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 3813 | /* |
| 3814 | * in limExtractApCapability function intersection of FW |
| 3815 | * advertised channel width and AP advertised channel |
| 3816 | * width has been taken into account for calculating |
| 3817 | * psessionEntry->ch_width |
| 3818 | */ |
| 3819 | pAddBssParams->staContext.ch_width = |
| 3820 | psessionEntry->ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3821 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3822 | pe_debug("StaCtx: vhtCap %d ChBW %d TxBF %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3823 | pAddBssParams->staContext.vhtCapable, |
| 3824 | pAddBssParams->staContext.ch_width, |
| 3825 | sta_context->vhtTxBFCapable); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3826 | pe_debug("StaContext su_tx_bfer %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3827 | sta_context->enable_su_tx_bformer); |
| 3828 | } else { |
| 3829 | sta_context->ch_width = CH_WIDTH_20MHZ; |
| 3830 | if ((IS_SIR_STATUS_SUCCESS( |
| 3831 | wlan_cfg_get_int(pMac, |
| 3832 | WNI_CFG_VHT_ENABLE_TXBF_20MHZ, |
| 3833 | &enableTxBF20MHz))) && |
| 3834 | (false == enableTxBF20MHz)) |
| 3835 | sta_context->vhtTxBFCapable = 0; |
| 3836 | } |
| 3837 | pAddBssParams->staContext.mimoPS = |
| 3838 | (tSirMacHTMIMOPowerSaveState) |
| 3839 | pAssocRsp->HTCaps.mimoPowerSave; |
| 3840 | pAddBssParams->staContext.maxAmsduSize = |
| 3841 | (uint8_t) pAssocRsp->HTCaps.maximalAMSDUsize; |
| 3842 | pAddBssParams->staContext.maxAmpduDensity = |
| 3843 | pAssocRsp->HTCaps.mpduDensity; |
| 3844 | pAddBssParams->staContext.fDsssCckMode40Mhz = |
| 3845 | (uint8_t) pAssocRsp->HTCaps.dsssCckMode40MHz; |
| 3846 | /* |
| 3847 | * We will check gShortGI20Mhz and gShortGI40Mhz from |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3848 | * session entry if they are set then we will use what ever |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3849 | * Assoc response coming from AP supports. If these |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3850 | * values are set as 0 in session entry then we will |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3851 | * hardcode this values to 0. |
| 3852 | */ |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3853 | if (psessionEntry->htConfig.ht_sgi20) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3854 | pAddBssParams->staContext.fShortGI20Mhz = |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3855 | (uint8_t)pAssocRsp->HTCaps.shortGI20MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | } else { |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3857 | pAddBssParams->staContext.fShortGI20Mhz = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3858 | } |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3859 | |
| 3860 | if (psessionEntry->htConfig.ht_sgi40) { |
| 3861 | pAddBssParams->staContext.fShortGI40Mhz = |
| 3862 | (uint8_t) pAssocRsp->HTCaps.shortGI40MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3863 | } else { |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3864 | pAddBssParams->staContext.fShortGI40Mhz = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3865 | } |
| 3866 | |
| 3867 | if (!pAddBssParams->staContext.vhtCapable) |
| 3868 | /* Use max ampd factor advertised in |
| 3869 | * HTCAP for non-vht connection */ |
| 3870 | { |
| 3871 | pAddBssParams->staContext.maxAmpduSize = |
| 3872 | pAssocRsp->HTCaps.maxRxAMPDUFactor; |
| 3873 | } else if (pAddBssParams->staContext.maxAmpduSize < |
| 3874 | pAssocRsp->HTCaps.maxRxAMPDUFactor) { |
| 3875 | pAddBssParams->staContext.maxAmpduSize = |
| 3876 | pAssocRsp->HTCaps.maxRxAMPDUFactor; |
| 3877 | } |
| 3878 | if (pAddBssParams->staContext.vhtTxBFCapable |
| 3879 | && pMac->lim.disableLDPCWithTxbfAP) { |
| 3880 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3881 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
| 3882 | } else { |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3883 | if (psessionEntry->txLdpcIniFeatureEnabled & 0x1) |
| 3884 | pAddBssParams->staContext.htLdpcCapable = |
| 3885 | (uint8_t) pAssocRsp->HTCaps.advCodingCap; |
| 3886 | else |
| 3887 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3888 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3889 | if (pAssocRsp->VHTCaps.present) |
| 3890 | vht_caps = &pAssocRsp->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3891 | else if (pAssocRsp->vendor_vht_ie.VHTCaps.present) { |
| 3892 | vht_caps = &pAssocRsp->vendor_vht_ie.VHTCaps; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3893 | pe_debug("VHT Caps is in vendor Specfic IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3894 | } |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3895 | if (vht_caps != NULL && |
| 3896 | (psessionEntry->txLdpcIniFeatureEnabled & 0x2)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3897 | pAddBssParams->staContext.vhtLdpcCapable = |
| 3898 | (uint8_t) vht_caps->ldpcCodingCap; |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3899 | else |
| 3900 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3901 | } |
| 3902 | |
| 3903 | if (pBeaconStruct->HTInfo.present) |
| 3904 | pAddBssParams->staContext.rifsMode = |
| 3905 | pAssocRsp->HTInfo.rifsMode; |
| 3906 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3907 | pe_debug("StaCtx: ChBW %d mimoPS %d maxAmsduSize %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3908 | pAddBssParams->staContext.ch_width, |
| 3909 | pAddBssParams->staContext.mimoPS, |
| 3910 | pAddBssParams->staContext.maxAmsduSize); |
| 3911 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3912 | pe_debug("maxAmpduDens %d CckMode40Mhz %d SGI20Mhz %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3913 | pAddBssParams->staContext.maxAmpduDensity, |
| 3914 | pAddBssParams->staContext.fDsssCckMode40Mhz, |
| 3915 | pAddBssParams->staContext.fShortGI20Mhz); |
| 3916 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3917 | pe_debug("SGI40M %d maxAmpdu %d htLdpc %d vhtLdpc %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3918 | pAddBssParams->staContext.fShortGI40Mhz, |
| 3919 | pAddBssParams->staContext.maxAmpduSize, |
| 3920 | pAddBssParams->staContext.htLdpcCapable, |
| 3921 | pAddBssParams->staContext.vhtLdpcCapable); |
| 3922 | } |
| 3923 | pAddBssParams->staContext.smesessionId = |
| 3924 | psessionEntry->smeSessionId; |
| 3925 | pAddBssParams->staContext.wpa_rsn = pBeaconStruct->rsnPresent; |
| 3926 | pAddBssParams->staContext.wpa_rsn |= |
| 3927 | (pBeaconStruct->wpaPresent << 1); |
| 3928 | /* For OSEN Connection AP does not advertise RSN or WPA IE |
| 3929 | * so from the IEs we get from supplicant we get this info |
| 3930 | * so for FW to transmit EAPOL message 4 we shall set |
| 3931 | * wpa_rsn |
| 3932 | */ |
| 3933 | if ((!pAddBssParams->staContext.wpa_rsn) |
| 3934 | && (psessionEntry->isOSENConnection)) |
| 3935 | pAddBssParams->staContext.wpa_rsn = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3936 | qdf_mem_copy(&pAddBssParams->staContext.capab_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3937 | &pAssocRsp->capabilityInfo, |
| 3938 | sizeof(pAddBssParams->staContext.capab_info)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3939 | qdf_mem_copy(&pAddBssParams->staContext.ht_caps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3940 | (uint8_t *) &pAssocRsp->HTCaps + sizeof(uint8_t), |
| 3941 | sizeof(pAddBssParams->staContext.ht_caps)); |
| 3942 | |
| 3943 | /* If WMM IE or 802.11E IE is present then enable WMM */ |
| 3944 | if ((psessionEntry->limWmeEnabled && pAssocRsp->wmeEdcaPresent) || |
| 3945 | (psessionEntry->limQosEnabled && pAssocRsp->edcaPresent)) |
| 3946 | pAddBssParams->staContext.wmmEnabled = 1; |
| 3947 | else |
| 3948 | pAddBssParams->staContext.wmmEnabled = 0; |
| 3949 | |
| 3950 | /* Update the rates */ |
| 3951 | pStaDs = dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER, |
| 3952 | &psessionEntry->dph.dphHashTable); |
| 3953 | if (pStaDs != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3954 | qdf_mem_copy((uint8_t *) &pAddBssParams->staContext. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3955 | supportedRates, |
Kiran Kumar Lokere | 5899f43 | 2016-02-18 12:53:42 -0800 | [diff] [blame] | 3956 | (uint8_t *)&pStaDs->supportedRates, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3957 | sizeof(tSirSupportedRates)); |
| 3958 | } else |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3959 | pe_err("could not Update the supported rates"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3960 | pAddBssParams->staContext.encryptType = psessionEntry->encryptType; |
| 3961 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3962 | pAddBssParams->maxTxPower = psessionEntry->maxTxPower; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3963 | pe_debug("maxTxPower: %d", pAddBssParams->maxTxPower); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3964 | /* FIXME_GEN4 - Any other value that can be used for initialization? */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3965 | pAddBssParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3966 | pAddBssParams->respReqd = true; |
| 3967 | /* update persona */ |
| 3968 | pAddBssParams->halPersona = (uint8_t) psessionEntry->pePersona; |
| 3969 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3970 | if (QDF_P2P_CLIENT_MODE == psessionEntry->pePersona) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3971 | pAddBssParams->staContext.p2pCapableSta = 1; |
| 3972 | |
| 3973 | pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled; |
| 3974 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3975 | pAddBssParams->extSetStaKeyParamValid = 0; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3976 | pe_debug("extSetStaKeyParamValid: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3977 | pAddBssParams->extSetStaKeyParamValid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3978 | |
| 3979 | #ifdef WLAN_FEATURE_11W |
| 3980 | if (psessionEntry->limRmfEnabled) { |
| 3981 | pAddBssParams->rmfEnabled = 1; |
| 3982 | pAddBssParams->staContext.rmfEnabled = 1; |
| 3983 | } |
| 3984 | #endif |
| 3985 | |
| 3986 | /* Set a new state for MLME */ |
| 3987 | if (eLIM_MLM_WT_ASSOC_RSP_STATE == psessionEntry->limMlmState) |
| 3988 | psessionEntry->limMlmState = |
| 3989 | eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE; |
| 3990 | else |
| 3991 | psessionEntry->limMlmState = |
| 3992 | eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE; |
| 3993 | MTRACE(mac_trace |
| 3994 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 3995 | psessionEntry->limMlmState)); |
| 3996 | |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3997 | if (!pAddBssParams->staContext.htLdpcCapable) |
| 3998 | pAddBssParams->staContext.ht_caps &= |
| 3999 | ~(1 << SIR_MAC_HT_CAP_ADVCODING_S); |
| 4000 | if (!pAddBssParams->staContext.vhtLdpcCapable) |
| 4001 | pAddBssParams->staContext.vht_caps &= |
| 4002 | ~(1 << SIR_MAC_VHT_CAP_LDPC_CODING_CAP); |
| 4003 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4004 | pe_debug("staContext wmmEnabled: %d encryptType: %d " |
| 4005 | "p2pCapableSta: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4006 | pAddBssParams->staContext.wmmEnabled, |
| 4007 | pAddBssParams->staContext.encryptType, |
| 4008 | pAddBssParams->staContext.p2pCapableSta); |
| 4009 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4010 | pe_debug("bSpectrumMgtEnabled: %d halPersona: %d setting " |
| 4011 | "LimMlm state to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4012 | pAddBssParams->bSpectrumMgtEnabled, pAddBssParams->halPersona, |
| 4013 | psessionEntry->limMlmState); |
| 4014 | if (psessionEntry->isNonRoamReassoc) |
| 4015 | pAddBssParams->nonRoamReassoc = 1; |
| 4016 | pAddBssParams->nss = psessionEntry->nss; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4017 | pe_debug("nss value: %d", pAddBssParams->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4018 | |
| 4019 | /* we need to defer the message until we get the response back from HAL. */ |
| 4020 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 4021 | |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 4022 | if (cds_is_5_mhz_enabled()) { |
| 4023 | pAddBssParams->ch_width = CH_WIDTH_5MHZ; |
| 4024 | pAddBssParams->staContext.ch_width = CH_WIDTH_5MHZ; |
| 4025 | } else if (cds_is_10_mhz_enabled()) { |
| 4026 | pAddBssParams->ch_width = CH_WIDTH_10MHZ; |
| 4027 | pAddBssParams->staContext.ch_width = CH_WIDTH_10MHZ; |
| 4028 | } |
| 4029 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4030 | msgQ.type = WMA_ADD_BSS_REQ; |
| 4031 | /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/ |
| 4032 | msgQ.reserved = 0; |
| 4033 | msgQ.bodyptr = pAddBssParams; |
| 4034 | msgQ.bodyval = 0; |
| 4035 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4036 | pe_debug("SessionId: %d Sending WMA_ADD_BSS_REQ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4037 | psessionEntry->peSessionId); |
| 4038 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 4039 | |
| 4040 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 4041 | if (eSIR_SUCCESS != retCode) { |
| 4042 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4043 | qdf_mem_free(pAddBssParams); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4044 | pe_err("Posting ADD_BSS_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | retCode); |
| 4046 | goto returnFailure; |
| 4047 | |
| 4048 | } else |
| 4049 | return retCode; |
| 4050 | |
| 4051 | returnFailure: |
| 4052 | /* Clean-up will be done by the caller... */ |
| 4053 | return retCode; |
| 4054 | } |
| 4055 | |
| 4056 | tSirRetStatus lim_sta_send_add_bss_pre_assoc(tpAniSirGlobal pMac, uint8_t updateEntry, |
| 4057 | tpPESession psessionEntry) |
| 4058 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4059 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4060 | tpAddBssParams pAddBssParams = NULL; |
| 4061 | uint32_t retCode; |
| 4062 | tSchBeaconStruct *pBeaconStruct; |
| 4063 | uint8_t chanWidthSupp = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4064 | tDot11fIEVHTOperation *vht_oper = NULL; |
| 4065 | tDot11fIEVHTCaps *vht_caps = NULL; |
Krunal Soni | b3f4542 | 2017-07-24 18:59:45 -0700 | [diff] [blame] | 4066 | uint32_t listen_interval = WNI_CFG_LISTEN_INTERVAL_STADEF; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4067 | |
| 4068 | tpSirBssDescription bssDescription = |
| 4069 | &psessionEntry->pLimJoinReq->bssDescription; |
| 4070 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4071 | pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4072 | if (NULL == pBeaconStruct) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4073 | pe_err("Unable to allocate memory during ADD_BSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4074 | return eSIR_MEM_ALLOC_FAILED; |
| 4075 | } |
| 4076 | |
| 4077 | /* Package SIR_HAL_ADD_BSS_REQ message parameters */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4078 | pAddBssParams = qdf_mem_malloc(sizeof(tAddBssParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4079 | if (NULL == pAddBssParams) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4080 | pe_err("Unable to allocate memory during ADD_BSS"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4081 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 4082 | goto returnFailure; |
| 4083 | } |
| 4084 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4085 | lim_extract_ap_capabilities(pMac, (uint8_t *) bssDescription->ieFields, |
| 4086 | lim_get_ielen_from_bss_description(bssDescription), |
| 4087 | pBeaconStruct); |
| 4088 | |
| 4089 | if (pMac->lim.gLimProtectionControl != |
| 4090 | WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 4091 | lim_decide_sta_protection_on_assoc(pMac, pBeaconStruct, |
| 4092 | psessionEntry); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4093 | qdf_mem_copy(pAddBssParams->bssId, bssDescription->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4094 | sizeof(tSirMacAddr)); |
| 4095 | |
| 4096 | /* Fill in tAddBssParams selfMacAddr */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4097 | qdf_mem_copy(pAddBssParams->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4098 | psessionEntry->selfMacAddr, sizeof(tSirMacAddr)); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4099 | pe_debug("sessionid: %d updateEntry = %d limsystemrole = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4100 | psessionEntry->smeSessionId, updateEntry, |
| 4101 | GET_LIM_SYSTEM_ROLE(psessionEntry)); |
| 4102 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4103 | pe_debug("BSSID: " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4104 | MAC_ADDR_ARRAY(pAddBssParams->bssId)); |
| 4105 | /* Incorrect BSS Type which caused UMA Descriptor to be overwritten on |
| 4106 | * top of an already established Infra link. This lead to issues in |
| 4107 | * concurrent data transfer. |
| 4108 | */ |
| 4109 | |
| 4110 | pAddBssParams->bssType = psessionEntry->bssType; /* eSIR_INFRASTRUCTURE_MODE; */ |
| 4111 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA; |
| 4112 | |
| 4113 | pAddBssParams->beaconInterval = bssDescription->beaconInterval; |
| 4114 | |
| 4115 | pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod; |
| 4116 | pAddBssParams->updateBss = updateEntry; |
| 4117 | |
| 4118 | pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount; |
| 4119 | pAddBssParams->cfParamSet.cfpPeriod = |
| 4120 | pBeaconStruct->cfParamSet.cfpPeriod; |
| 4121 | pAddBssParams->cfParamSet.cfpMaxDuration = |
| 4122 | pBeaconStruct->cfParamSet.cfpMaxDuration; |
| 4123 | pAddBssParams->cfParamSet.cfpDurRemaining = |
| 4124 | pBeaconStruct->cfParamSet.cfpDurRemaining; |
| 4125 | |
| 4126 | pAddBssParams->rateSet.numRates = |
| 4127 | pBeaconStruct->supportedRates.numRates; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4128 | qdf_mem_copy(pAddBssParams->rateSet.rate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | pBeaconStruct->supportedRates.rate, |
| 4130 | pBeaconStruct->supportedRates.numRates); |
| 4131 | |
| 4132 | pAddBssParams->nwType = bssDescription->nwType; |
| 4133 | |
| 4134 | pAddBssParams->shortSlotTimeSupported = |
| 4135 | (uint8_t) pBeaconStruct->capabilityInfo.shortSlotTime; |
| 4136 | pAddBssParams->llaCoexist = |
| 4137 | (uint8_t) psessionEntry->beaconParams.llaCoexist; |
| 4138 | pAddBssParams->llbCoexist = |
| 4139 | (uint8_t) psessionEntry->beaconParams.llbCoexist; |
| 4140 | pAddBssParams->llgCoexist = |
| 4141 | (uint8_t) psessionEntry->beaconParams.llgCoexist; |
| 4142 | pAddBssParams->ht20Coexist = |
| 4143 | (uint8_t) psessionEntry->beaconParams.ht20Coexist; |
| 4144 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4145 | pe_debug("BSS Type %d Beacon Interval: %d dtimPeriod: %d " |
| 4146 | "cfpCount: %d", pAddBssParams->bssType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4147 | pAddBssParams->beaconInterval, pAddBssParams->dtimPeriod, |
| 4148 | pAddBssParams->cfParamSet.cfpCount); |
| 4149 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4150 | pe_debug("cfpPeriod: %d cfpMaxDuration: %d cfpDurRemaining: %d" |
| 4151 | " numRates: %d", pAddBssParams->cfParamSet.cfpPeriod, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4152 | pAddBssParams->cfParamSet.cfpMaxDuration, |
| 4153 | pAddBssParams->cfParamSet.cfpDurRemaining, |
| 4154 | pAddBssParams->rateSet.numRates); |
| 4155 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4156 | pe_debug("nwType:%d shortSlotTimeSupported: %d" |
| 4157 | "llaCoexist: %d llbCoexist: %d llgCoexist: %d ht20Coexist: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4158 | pAddBssParams->nwType, pAddBssParams->shortSlotTimeSupported, |
| 4159 | pAddBssParams->llaCoexist, pAddBssParams->llbCoexist, |
| 4160 | pAddBssParams->llgCoexist, pAddBssParams->ht20Coexist); |
| 4161 | /* Use the advertised capabilities from the received beacon/PR */ |
| 4162 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) |
| 4163 | && (pBeaconStruct->HTCaps.present)) { |
| 4164 | pAddBssParams->htCapable = pBeaconStruct->HTCaps.present; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4165 | pe_debug("htCapable: %d", pAddBssParams->htCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4166 | if (pBeaconStruct->HTInfo.present) { |
| 4167 | pAddBssParams->htOperMode = |
| 4168 | (tSirMacHTOperatingMode) pBeaconStruct->HTInfo. |
| 4169 | opMode; |
| 4170 | pAddBssParams->dualCTSProtection = |
| 4171 | (uint8_t) pBeaconStruct->HTInfo.dualCTSProtection; |
| 4172 | |
| 4173 | chanWidthSupp = |
| 4174 | lim_get_ht_capability(pMac, |
| 4175 | eHT_SUPPORTED_CHANNEL_WIDTH_SET, |
| 4176 | psessionEntry); |
| 4177 | if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) |
| 4178 | && (chanWidthSupp)) { |
| 4179 | pAddBssParams->ch_width = |
| 4180 | (uint8_t) pBeaconStruct->HTInfo. |
| 4181 | recommendedTxWidthSet; |
| 4182 | if (pBeaconStruct->HTInfo.secondaryChannelOffset == |
| 4183 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 4184 | pAddBssParams->ch_center_freq_seg0 = |
| 4185 | bssDescription->channelId + 2; |
| 4186 | |
| 4187 | if (pBeaconStruct->HTInfo.secondaryChannelOffset == |
| 4188 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 4189 | pAddBssParams->ch_center_freq_seg0 = |
| 4190 | bssDescription->channelId - 2; |
| 4191 | } else { |
| 4192 | pAddBssParams->ch_width = CH_WIDTH_20MHZ; |
| 4193 | pAddBssParams->ch_center_freq_seg0 = 0; |
| 4194 | } |
| 4195 | pAddBssParams->llnNonGFCoexist = |
| 4196 | (uint8_t) pBeaconStruct->HTInfo.nonGFDevicesPresent; |
| 4197 | pAddBssParams->fLsigTXOPProtectionFullSupport = |
| 4198 | (uint8_t) pBeaconStruct->HTInfo. |
| 4199 | lsigTXOPProtectionFullSupport; |
| 4200 | pAddBssParams->fRIFSMode = |
| 4201 | pBeaconStruct->HTInfo.rifsMode; |
| 4202 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4203 | pe_debug("htOperMode: %d dualCTSProtection: %d txChannelWidthSet: %d center_freq_seg0: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4204 | pAddBssParams->htOperMode, |
| 4205 | pAddBssParams->dualCTSProtection, |
| 4206 | pAddBssParams->txChannelWidthSet, |
| 4207 | pAddBssParams->ch_center_freq_seg0); |
| 4208 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4209 | pe_debug("llnNonGFCoexist: %d " |
| 4210 | "fLsigTXOPProtectionFullSupport: %d fRIFSMode %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4211 | pAddBssParams->llnNonGFCoexist, |
| 4212 | pAddBssParams->fLsigTXOPProtectionFullSupport, |
| 4213 | pAddBssParams->fRIFSMode); |
| 4214 | } |
| 4215 | } |
| 4216 | |
| 4217 | pAddBssParams->currentOperChannel = bssDescription->channelId; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4218 | pe_debug("currentOperChannel %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4219 | pAddBssParams->currentOperChannel); |
Kiran Kumar Lokere | dda6077 | 2017-05-24 18:45:26 -0700 | [diff] [blame] | 4220 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4221 | if (psessionEntry->vhtCapability && |
| 4222 | (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps) || |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 4223 | IS_BSS_VHT_CAPABLE(pBeaconStruct->vendor_vht_ie.VHTCaps))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4224 | |
| 4225 | pAddBssParams->vhtCapable = 1; |
| 4226 | if (pBeaconStruct->VHTOperation.present) |
| 4227 | vht_oper = &pBeaconStruct->VHTOperation; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 4228 | else if (pBeaconStruct->vendor_vht_ie.VHTOperation.present) { |
| 4229 | vht_oper = &pBeaconStruct->vendor_vht_ie.VHTOperation; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4230 | pe_debug("VHT Operation is present in vendor Specfic IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4231 | } |
| 4232 | |
| 4233 | |
| 4234 | if ((vht_oper != NULL) && |
| 4235 | vht_oper->chanWidth && |
| 4236 | chanWidthSupp) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4237 | pAddBssParams->ch_center_freq_seg0 = |
| 4238 | vht_oper->chanCenterFreqSeg1; |
| 4239 | pAddBssParams->ch_center_freq_seg1 = |
| 4240 | vht_oper->chanCenterFreqSeg2; |
| 4241 | } |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 4242 | /* |
| 4243 | * in limExtractApCapability function intersection of FW |
| 4244 | * advertised channel width and AP advertised channel width has |
| 4245 | * been taken into account for calculating |
| 4246 | * psessionEntry->ch_width |
| 4247 | */ |
| 4248 | pAddBssParams->ch_width = |
| 4249 | psessionEntry->ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4250 | pAddBssParams->staContext.maxAmpduSize = |
| 4251 | SIR_MAC_GET_VHT_MAX_AMPDU_EXPO( |
| 4252 | pAddBssParams->staContext.vht_caps); |
| 4253 | } else { |
| 4254 | pAddBssParams->vhtCapable = 0; |
| 4255 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 4256 | |
| 4257 | if (lim_is_session_he_capable(psessionEntry) && |
Manikandan Mohan | 39accff | 2017-05-02 16:09:00 -0700 | [diff] [blame] | 4258 | pBeaconStruct->vendor_he_cap.present) { |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 4259 | lim_update_bss_he_capable(pMac, pAddBssParams); |
Manikandan Mohan | 39accff | 2017-05-02 16:09:00 -0700 | [diff] [blame] | 4260 | lim_add_bss_he_cfg(pAddBssParams, psessionEntry); |
| 4261 | } |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4262 | pe_debug("vhtCapable %d vhtTxChannelWidthSet %d center_freq_seg0 - %d, center_freq_seg1 - %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4263 | pAddBssParams->vhtCapable, pAddBssParams->ch_width, |
| 4264 | pAddBssParams->ch_center_freq_seg0, |
| 4265 | pAddBssParams->ch_center_freq_seg1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4266 | /* |
| 4267 | * Populate the STA-related parameters here |
| 4268 | * Note that the STA here refers to the AP |
| 4269 | */ |
| 4270 | /* Identifying AP as an STA */ |
| 4271 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; |
| 4272 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4273 | qdf_mem_copy(pAddBssParams->staContext.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4274 | bssDescription->bssId, sizeof(tSirMacAddr)); |
Krunal Soni | b3f4542 | 2017-07-24 18:59:45 -0700 | [diff] [blame] | 4275 | if (wlan_cfg_get_int(pMac, WNI_CFG_LISTEN_INTERVAL, &listen_interval) != |
| 4276 | eSIR_SUCCESS) |
| 4277 | pe_err("Couldn't get LISTEN_INTERVAL"); |
| 4278 | pAddBssParams->staContext.listenInterval = listen_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4279 | pAddBssParams->staContext.assocId = 0; |
| 4280 | pAddBssParams->staContext.uAPSD = 0; |
| 4281 | pAddBssParams->staContext.maxSPLen = 0; |
| 4282 | pAddBssParams->staContext.shortPreambleSupported = |
| 4283 | (uint8_t) pBeaconStruct->capabilityInfo.shortPreamble; |
| 4284 | pAddBssParams->staContext.updateSta = updateEntry; |
| 4285 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4286 | pe_debug("StaCtx: " MAC_ADDRESS_STR " shortPreamble: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4287 | MAC_ADDR_ARRAY(pAddBssParams->staContext.staMac), |
| 4288 | pAddBssParams->staContext.shortPreambleSupported); |
| 4289 | |
| 4290 | pAddBssParams->dot11_mode = psessionEntry->dot11mode; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4291 | pe_debug("dot11_mode:%d", pAddBssParams->dot11_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | |
| 4293 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) |
| 4294 | && (pBeaconStruct->HTCaps.present)) { |
| 4295 | pAddBssParams->staContext.us32MaxAmpduDuration = 0; |
| 4296 | pAddBssParams->staContext.htCapable = 1; |
| 4297 | pAddBssParams->staContext.greenFieldCapable = |
| 4298 | (uint8_t) pBeaconStruct->HTCaps.greenField; |
| 4299 | pAddBssParams->staContext.lsigTxopProtection = |
| 4300 | (uint8_t) pBeaconStruct->HTCaps.lsigTXOPProtection; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4301 | pe_debug("StaCtx: htCap %d GFCap %d lsigTxopProtn %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4302 | pAddBssParams->staContext.htCapable, |
| 4303 | pAddBssParams->staContext.greenFieldCapable, |
| 4304 | pAddBssParams->staContext.lsigTxopProtection); |
| 4305 | if (psessionEntry->vhtCapability && |
| 4306 | (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps) || |
| 4307 | IS_BSS_VHT_CAPABLE( |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 4308 | pBeaconStruct->vendor_vht_ie.VHTCaps))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4309 | pAddBssParams->staContext.vhtCapable = 1; |
| 4310 | if (pBeaconStruct->VHTCaps.present) |
| 4311 | vht_caps = &pBeaconStruct->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 4312 | else if (pBeaconStruct->vendor_vht_ie.VHTCaps.present) |
| 4313 | vht_caps = &pBeaconStruct-> |
| 4314 | vendor_vht_ie.VHTCaps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4315 | |
| 4316 | if ((vht_caps != NULL) && (vht_caps->suBeamFormerCap || |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 4317 | vht_caps->muBeamformerCap) && |
| 4318 | psessionEntry->vht_config.su_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4319 | pAddBssParams->staContext.vhtTxBFCapable = 1; |
| 4320 | |
| 4321 | if ((vht_caps != NULL) && vht_caps->muBeamformerCap && |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 4322 | psessionEntry->vht_config.mu_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4323 | pAddBssParams->staContext.vhtTxMUBformeeCapable |
| 4324 | = 1; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 4325 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4326 | if ((vht_caps != NULL) && vht_caps->suBeamformeeCap && |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 4327 | psessionEntry->vht_config.su_beam_former) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4328 | pAddBssParams->staContext.enable_su_tx_bformer |
| 4329 | = 1; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 4330 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4331 | pe_debug("StaContext: su_tx_bfer %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4332 | pAddBssParams->staContext.enable_su_tx_bformer); |
| 4333 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 4334 | if (lim_is_session_he_capable(psessionEntry) && |
| 4335 | pBeaconStruct->vendor_he_cap.present) |
| 4336 | lim_intersect_ap_he_caps(psessionEntry, pAddBssParams, |
| 4337 | pBeaconStruct, NULL); |
| 4338 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4339 | if ((pBeaconStruct->HTCaps.supportedChannelWidthSet) && |
| 4340 | (chanWidthSupp)) { |
| 4341 | pAddBssParams->staContext.ch_width = |
| 4342 | (uint8_t) pBeaconStruct->HTInfo. |
| 4343 | recommendedTxWidthSet; |
| 4344 | if ((vht_oper != NULL) && |
| 4345 | pAddBssParams->staContext.vhtCapable && |
| 4346 | vht_oper->chanWidth) |
| 4347 | pAddBssParams->staContext.ch_width = |
| 4348 | vht_oper->chanWidth + 1; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4349 | pe_debug("StaCtx: vhtCap %d ch_bw %d TxBF %d", |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 4350 | pAddBssParams->staContext.vhtCapable, |
| 4351 | pAddBssParams->staContext.ch_width, |
| 4352 | pAddBssParams->staContext.vhtTxBFCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4353 | } else { |
| 4354 | pAddBssParams->staContext.ch_width = |
| 4355 | CH_WIDTH_20MHZ; |
| 4356 | } |
| 4357 | pAddBssParams->staContext.mimoPS = |
| 4358 | (tSirMacHTMIMOPowerSaveState) pBeaconStruct->HTCaps. |
| 4359 | mimoPowerSave; |
| 4360 | pAddBssParams->staContext.maxAmsduSize = |
| 4361 | (uint8_t) pBeaconStruct->HTCaps.maximalAMSDUsize; |
| 4362 | pAddBssParams->staContext.maxAmpduDensity = |
| 4363 | pBeaconStruct->HTCaps.mpduDensity; |
| 4364 | pAddBssParams->staContext.fDsssCckMode40Mhz = |
| 4365 | (uint8_t) pBeaconStruct->HTCaps.dsssCckMode40MHz; |
| 4366 | /* |
| 4367 | * We will check gShortGI20Mhz and gShortGI40Mhz from ini file. |
| 4368 | * if they are set then we will use what ever Beacon coming |
| 4369 | * from AP supports. If these values are set as 0 in ini file |
| 4370 | * then we will hardcode this values to 0. |
| 4371 | */ |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 4372 | if (true == psessionEntry->htConfig.ht_sgi20) |
| 4373 | pAddBssParams->staContext.fShortGI20Mhz = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4374 | (uint8_t)pBeaconStruct->HTCaps.shortGI20MHz; |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 4375 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4376 | pAddBssParams->staContext.fShortGI20Mhz = |
| 4377 | false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4378 | |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 4379 | if (true == psessionEntry->htConfig.ht_sgi40) |
| 4380 | pAddBssParams->staContext.fShortGI40Mhz = |
| 4381 | (uint8_t) pBeaconStruct->HTCaps.shortGI40MHz; |
| 4382 | else |
| 4383 | pAddBssParams->staContext.fShortGI40Mhz = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4384 | |
| 4385 | pAddBssParams->staContext.maxAmpduSize = |
| 4386 | pBeaconStruct->HTCaps.maxRxAMPDUFactor; |
| 4387 | if (pAddBssParams->staContext.vhtTxBFCapable |
| 4388 | && pMac->lim.disableLDPCWithTxbfAP) { |
| 4389 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 4390 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
| 4391 | } else { |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 4392 | if (psessionEntry->txLdpcIniFeatureEnabled & 0x1) |
| 4393 | pAddBssParams->staContext.htLdpcCapable = |
| 4394 | (uint8_t) pBeaconStruct->HTCaps. |
| 4395 | advCodingCap; |
| 4396 | else |
| 4397 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 4398 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4399 | if (pBeaconStruct->VHTCaps.present) |
| 4400 | vht_caps = &pBeaconStruct->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 4401 | else if (pBeaconStruct->vendor_vht_ie.VHTCaps.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4402 | vht_caps = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 4403 | &pBeaconStruct->vendor_vht_ie.VHTCaps; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4404 | pe_debug("VHT Caps are in vendor Specfic IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4405 | } |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 4406 | if (vht_caps != NULL && |
| 4407 | (psessionEntry->txLdpcIniFeatureEnabled & 0x2)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4408 | pAddBssParams->staContext.vhtLdpcCapable = |
| 4409 | (uint8_t) vht_caps->ldpcCodingCap; |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 4410 | else |
| 4411 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4412 | } |
| 4413 | |
| 4414 | if (pBeaconStruct->HTInfo.present) |
| 4415 | pAddBssParams->staContext.rifsMode = |
| 4416 | pBeaconStruct->HTInfo.rifsMode; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4417 | pe_debug("StaContext ChannelWidth: %d mimoPS: %d maxAmsduSize: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4418 | pAddBssParams->staContext.ch_width, |
| 4419 | pAddBssParams->staContext.mimoPS, |
| 4420 | pAddBssParams->staContext.maxAmsduSize); |
| 4421 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4422 | pe_debug("maxAmpduDensity %d Cck40Mhz %d SGI20Mhz %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4423 | pAddBssParams->staContext.maxAmpduDensity, |
| 4424 | pAddBssParams->staContext.fDsssCckMode40Mhz, |
| 4425 | pAddBssParams->staContext.fShortGI20Mhz); |
| 4426 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4427 | pe_debug("SGI40M %d maxAmpdu %d htLdpc %d vhtLdpc %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4428 | pAddBssParams->staContext.fShortGI40Mhz, |
| 4429 | pAddBssParams->staContext.maxAmpduSize, |
| 4430 | pAddBssParams->staContext.htLdpcCapable, |
| 4431 | pAddBssParams->staContext.vhtLdpcCapable); |
| 4432 | } |
| 4433 | /* |
| 4434 | * If WMM IE or 802.11E IE is not present |
| 4435 | * and AP is HT AP then enable WMM |
| 4436 | */ |
| 4437 | if ((psessionEntry->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || |
| 4438 | pAddBssParams->staContext.htCapable)) || |
| 4439 | (psessionEntry->limQosEnabled && |
| 4440 | (pBeaconStruct->edcaPresent || |
| 4441 | pAddBssParams->staContext.htCapable))) |
| 4442 | pAddBssParams->staContext.wmmEnabled = 1; |
| 4443 | else |
| 4444 | pAddBssParams->staContext.wmmEnabled = 0; |
| 4445 | |
| 4446 | /* Update the rates */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4447 | lim_populate_peer_rate_set(pMac, |
| 4448 | &pAddBssParams->staContext. |
| 4449 | supportedRates, |
| 4450 | pBeaconStruct->HTCaps.supportedMCSSet, |
| 4451 | false, psessionEntry, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 4452 | &pBeaconStruct->VHTCaps, |
| 4453 | &pBeaconStruct->vendor_he_cap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4454 | |
| 4455 | pAddBssParams->staContext.encryptType = psessionEntry->encryptType; |
| 4456 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4457 | pAddBssParams->maxTxPower = psessionEntry->maxTxPower; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4458 | pe_debug("maxTxPower: %d", pAddBssParams->maxTxPower); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4459 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4460 | pAddBssParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4461 | pAddBssParams->respReqd = true; |
| 4462 | |
| 4463 | pAddBssParams->staContext.smesessionId = psessionEntry->smeSessionId; |
| 4464 | pAddBssParams->staContext.sessionId = psessionEntry->peSessionId; |
| 4465 | pAddBssParams->sessionId = psessionEntry->peSessionId; |
| 4466 | |
| 4467 | pAddBssParams->halPersona = (uint8_t) psessionEntry->pePersona; /* update persona */ |
| 4468 | |
| 4469 | pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled; |
| 4470 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4471 | pAddBssParams->extSetStaKeyParamValid = 0; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4472 | pe_debug("extSetStaKeyParamValid: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4473 | pAddBssParams->extSetStaKeyParamValid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4474 | |
| 4475 | #ifdef WLAN_FEATURE_11W |
| 4476 | if (psessionEntry->limRmfEnabled) { |
| 4477 | pAddBssParams->rmfEnabled = 1; |
| 4478 | pAddBssParams->staContext.rmfEnabled = 1; |
| 4479 | } |
| 4480 | #endif |
| 4481 | |
| 4482 | pAddBssParams->nss = psessionEntry->nss; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4483 | pe_debug("nss value: %d", pAddBssParams->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4484 | |
| 4485 | /* Set a new state for MLME */ |
| 4486 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE; |
| 4487 | |
| 4488 | MTRACE(mac_trace |
| 4489 | (pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, |
| 4490 | psessionEntry->limMlmState)); |
| 4491 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4492 | pe_debug("staContext wmmEnabled: %d encryptType: %d " |
| 4493 | "p2pCapableSta: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4494 | pAddBssParams->staContext.wmmEnabled, |
| 4495 | pAddBssParams->staContext.encryptType, |
| 4496 | pAddBssParams->staContext.p2pCapableSta); |
| 4497 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4498 | pe_debug("bSpectrumMgtEnabled: %d halPersona: %d setting " |
| 4499 | "LimMlm state to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4500 | pAddBssParams->bSpectrumMgtEnabled, pAddBssParams->halPersona, |
| 4501 | psessionEntry->limMlmState); |
| 4502 | |
| 4503 | /* we need to defer the message until we get the response back from HAL. */ |
| 4504 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 4505 | |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 4506 | if (cds_is_5_mhz_enabled()) { |
| 4507 | pAddBssParams->ch_width = CH_WIDTH_5MHZ; |
| 4508 | pAddBssParams->staContext.ch_width = CH_WIDTH_5MHZ; |
| 4509 | } else if (cds_is_10_mhz_enabled()) { |
| 4510 | pAddBssParams->ch_width = CH_WIDTH_10MHZ; |
| 4511 | pAddBssParams->staContext.ch_width = CH_WIDTH_10MHZ; |
| 4512 | } |
| 4513 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4514 | msgQ.type = WMA_ADD_BSS_REQ; |
| 4515 | /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/ |
| 4516 | msgQ.reserved = 0; |
| 4517 | msgQ.bodyptr = pAddBssParams; |
| 4518 | msgQ.bodyval = 0; |
| 4519 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4520 | pe_debug("SessionId:%d Sending WMA_ADD_BSS_REQ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4521 | psessionEntry->peSessionId); |
| 4522 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 4523 | |
| 4524 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 4525 | if (eSIR_SUCCESS != retCode) { |
| 4526 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4527 | qdf_mem_free(pAddBssParams); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4528 | pe_err("Posting ADD_BSS_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4529 | retCode); |
| 4530 | goto returnFailure; |
| 4531 | |
| 4532 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4533 | qdf_mem_free(pBeaconStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4534 | return retCode; |
| 4535 | } |
| 4536 | |
| 4537 | returnFailure: |
| 4538 | /* Clean-up will be done by the caller... */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4539 | qdf_mem_free(pBeaconStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4540 | return retCode; |
| 4541 | } |
| 4542 | |
| 4543 | /** |
| 4544 | * lim_prepare_and_send_del_sta_cnf() - prepares and send del sta cnf |
| 4545 | * |
| 4546 | * @pMac: mac global context |
| 4547 | * @pStaDs: sta dph node |
| 4548 | * @statusCode: status code |
| 4549 | * @psessionEntry: session context |
| 4550 | * |
| 4551 | * deletes DPH entry, changes the MLM mode for station, calls |
| 4552 | * lim_send_del_sta_cnf |
| 4553 | * |
| 4554 | * Return: void |
| 4555 | */ |
| 4556 | void |
| 4557 | lim_prepare_and_send_del_sta_cnf(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 4558 | tSirResultCodes statusCode, |
| 4559 | tpPESession psessionEntry) |
| 4560 | { |
| 4561 | uint16_t staDsAssocId = 0; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4562 | struct qdf_mac_addr sta_dsaddr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4563 | tLimMlmStaContext mlmStaContext; |
| 4564 | |
| 4565 | if (pStaDs == NULL) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4566 | pe_err("pStaDs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4567 | return; |
| 4568 | } |
| 4569 | staDsAssocId = pStaDs->assocId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4570 | qdf_mem_copy((uint8_t *) sta_dsaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4571 | pStaDs->staAddr, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4572 | |
| 4573 | mlmStaContext = pStaDs->mlmStaContext; |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 4574 | if (LIM_IS_AP_ROLE(psessionEntry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4575 | lim_release_peer_idx(pMac, pStaDs->assocId, psessionEntry); |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 4576 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4577 | lim_delete_dph_hash_entry(pMac, pStaDs->staAddr, pStaDs->assocId, |
| 4578 | psessionEntry); |
| 4579 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 4580 | if (LIM_IS_STA_ROLE(psessionEntry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4581 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 4582 | MTRACE(mac_trace(pMac, TRACE_CODE_MLM_STATE, |
| 4583 | psessionEntry->peSessionId, |
| 4584 | psessionEntry->limMlmState)); |
| 4585 | } |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 4586 | lim_send_del_sta_cnf(pMac, sta_dsaddr, staDsAssocId, mlmStaContext, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4587 | statusCode, psessionEntry); |
| 4588 | } |
| 4589 | |
| 4590 | /** ------------------------------------------------------------- |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4591 | \fn lim_init_pre_auth_timer_table |
| 4592 | \brief Initialize the Pre Auth Tanle and creates the timer for |
| 4593 | each node for the timeout value got from cfg. |
| 4594 | \param tpAniSirGlobal pMac |
| 4595 | \param tpLimPreAuthTable pPreAuthTimerTable |
| 4596 | \return none |
| 4597 | -------------------------------------------------------------*/ |
| 4598 | void lim_init_pre_auth_timer_table(tpAniSirGlobal pMac, |
| 4599 | tpLimPreAuthTable pPreAuthTimerTable) |
| 4600 | { |
| 4601 | uint32_t cfgValue; |
| 4602 | uint32_t authNodeIdx; |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4603 | tLimPreAuthNode **pAuthNode = pPreAuthTimerTable->pTable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4604 | |
| 4605 | /* Get AUTH_RSP Timers value */ |
| 4606 | |
| 4607 | if (wlan_cfg_get_int(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, |
| 4608 | &cfgValue) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4609 | pe_err("could not retrieve AUTH_RSP timeout value"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4610 | return; |
| 4611 | } |
| 4612 | |
| 4613 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 4614 | for (authNodeIdx = 0; authNodeIdx < pPreAuthTimerTable->numEntry; |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4615 | authNodeIdx++) { |
| 4616 | if (tx_timer_create(pMac, &(pAuthNode[authNodeIdx]->timer), |
Naveen Rawat | 22b1a93 | 2015-08-26 12:13:18 -0700 | [diff] [blame] | 4617 | "AUTH RESPONSE TIMEOUT", |
| 4618 | lim_auth_response_timer_handler, authNodeIdx, |
| 4619 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4620 | pe_err("Cannot create Auth Rsp timer of Index: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4621 | authNodeIdx); |
| 4622 | return; |
| 4623 | } |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4624 | pAuthNode[authNodeIdx]->authNodeIdx = (uint8_t) authNodeIdx; |
| 4625 | pAuthNode[authNodeIdx]->fFree = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4626 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4627 | } |
| 4628 | |
| 4629 | /** ------------------------------------------------------------- |
| 4630 | \fn lim_acquire_free_pre_auth_node |
| 4631 | \brief Retrives a free Pre Auth node from Pre Auth Table. |
| 4632 | \param tpAniSirGlobal pMac |
| 4633 | \param tpLimPreAuthTable pPreAuthTimerTable |
| 4634 | \return none |
| 4635 | -------------------------------------------------------------*/ |
| 4636 | tLimPreAuthNode *lim_acquire_free_pre_auth_node(tpAniSirGlobal pMac, |
| 4637 | tpLimPreAuthTable pPreAuthTimerTable) |
| 4638 | { |
| 4639 | uint32_t i; |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4640 | tLimPreAuthNode **pTempNode = pPreAuthTimerTable->pTable; |
| 4641 | for (i = 0; i < pPreAuthTimerTable->numEntry; i++) { |
| 4642 | if (pTempNode[i]->fFree == 1) { |
| 4643 | pTempNode[i]->fFree = 0; |
| 4644 | return pTempNode[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4645 | } |
| 4646 | } |
| 4647 | |
| 4648 | return NULL; |
| 4649 | } |
| 4650 | |
| 4651 | /** ------------------------------------------------------------- |
| 4652 | \fn lim_get_pre_auth_node_from_index |
| 4653 | \brief Depending on the Index this retrives the pre auth node. |
| 4654 | \param tpAniSirGlobal pMac |
| 4655 | \param tpLimPreAuthTable pAuthTable |
| 4656 | \param uint32_t authNodeIdx |
| 4657 | \return none |
| 4658 | -------------------------------------------------------------*/ |
| 4659 | tLimPreAuthNode *lim_get_pre_auth_node_from_index(tpAniSirGlobal pMac, |
| 4660 | tpLimPreAuthTable pAuthTable, |
| 4661 | uint32_t authNodeIdx) |
| 4662 | { |
| 4663 | if ((authNodeIdx >= pAuthTable->numEntry) |
| 4664 | || (pAuthTable->pTable == NULL)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4665 | pe_err("Invalid Auth Timer Index: %d NumEntry: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4666 | authNodeIdx, pAuthTable->numEntry); |
| 4667 | return NULL; |
| 4668 | } |
| 4669 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4670 | return pAuthTable->pTable[authNodeIdx]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4671 | } |
| 4672 | |
| 4673 | /* Util API to check if the channels supported by STA is within range */ |
| 4674 | tSirRetStatus lim_is_dot11h_supported_channels_valid(tpAniSirGlobal pMac, |
| 4675 | tSirAssocReq *assoc) |
| 4676 | { |
| 4677 | /* |
| 4678 | * Allow all the stations to join with us. |
| 4679 | * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs |
| 4680 | * as an input into an algorithm used to select a new channel for the BSS. |
| 4681 | * The specification of the algorithm is beyond the scope of this amendment. |
| 4682 | */ |
| 4683 | |
| 4684 | return eSIR_SUCCESS; |
| 4685 | } |
| 4686 | |
| 4687 | /* Util API to check if the txpower supported by STA is within range */ |
| 4688 | tSirRetStatus lim_is_dot11h_power_capabilities_in_range(tpAniSirGlobal pMac, |
| 4689 | tSirAssocReq *assoc, |
| 4690 | tpPESession psessionEntry) |
| 4691 | { |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 4692 | int8_t localMaxTxPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4693 | uint32_t localPwrConstraint; |
| 4694 | |
| 4695 | localMaxTxPower = |
| 4696 | cfg_get_regulatory_max_transmit_power(pMac, |
| 4697 | psessionEntry->currentOperChannel); |
| 4698 | |
| 4699 | if (wlan_cfg_get_int |
| 4700 | (pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, |
| 4701 | &localPwrConstraint) != eSIR_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4702 | pe_err("Unable to get Local Power Constraint from cfg"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | return eSIR_FAILURE; |
| 4704 | } |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 4705 | localMaxTxPower -= (int8_t) localPwrConstraint; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4706 | |
| 4707 | /** |
| 4708 | * The min Tx Power of the associating station should not be greater than (regulatory |
| 4709 | * max tx power - local power constraint configured on AP). |
| 4710 | */ |
| 4711 | if (assoc->powerCapability.minTxPower > localMaxTxPower) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4712 | pe_warn("minTxPower (STA): %d, localMaxTxPower (AP): %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4713 | assoc->powerCapability.minTxPower, localMaxTxPower); |
| 4714 | return eSIR_FAILURE; |
| 4715 | } |
| 4716 | |
| 4717 | return eSIR_SUCCESS; |
| 4718 | } |
| 4719 | |
| 4720 | /** ------------------------------------------------------------- |
| 4721 | \fn lim_fill_rx_highest_supported_rate |
| 4722 | \brief Fills in the Rx Highest Supported Data Rate field from |
| 4723 | \ the 'supported MCS set' field in HT capability element. |
| 4724 | \param tpAniSirGlobal pMac |
| 4725 | \param tpSirSupportedRates pRates |
| 4726 | \param uint8_t* pSupportedMCSSet |
| 4727 | \return none |
| 4728 | -------------------------------------------------------------*/ |
| 4729 | void lim_fill_rx_highest_supported_rate(tpAniSirGlobal pMac, |
| 4730 | uint16_t *rxHighestRate, |
| 4731 | uint8_t *pSupportedMCSSet) |
| 4732 | { |
| 4733 | tSirMacRxHighestSupportRate *pRxHighestRate; |
| 4734 | uint8_t *pBuf; |
| 4735 | uint16_t rate = 0; |
| 4736 | |
| 4737 | pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET; |
| 4738 | rate = lim_get_u16(pBuf); |
| 4739 | |
| 4740 | pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate; |
| 4741 | *rxHighestRate = pRxHighestRate->rate; |
| 4742 | |
| 4743 | return; |
| 4744 | } |
| 4745 | |
| 4746 | #ifdef WLAN_FEATURE_11W |
| 4747 | /** ------------------------------------------------------------- |
| 4748 | \fn lim_send_sme_unprotected_mgmt_frame_ind |
| 4749 | \brief Forwards the unprotected management frame to SME. |
| 4750 | \param tpAniSirGlobal pMac |
| 4751 | \param frameType - 802.11 frame type |
| 4752 | \param frame - frame buffer |
| 4753 | \param sessionId - id for the current session |
| 4754 | \param psessionEntry - PE session context |
| 4755 | \return none |
| 4756 | -------------------------------------------------------------*/ |
| 4757 | void lim_send_sme_unprotected_mgmt_frame_ind(tpAniSirGlobal pMac, uint8_t frameType, |
| 4758 | uint8_t *frame, uint32_t frameLen, |
| 4759 | uint16_t sessionId, |
| 4760 | tpPESession psessionEntry) |
| 4761 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4762 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4763 | tSirSmeUnprotMgmtFrameInd *pSirSmeMgmtFrame = NULL; |
| 4764 | uint16_t length; |
| 4765 | |
| 4766 | length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen; |
| 4767 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4768 | pSirSmeMgmtFrame = qdf_mem_malloc(length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4769 | if (NULL == pSirSmeMgmtFrame) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4770 | pe_err("Memory allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4771 | return; |
| 4772 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4773 | |
| 4774 | pSirSmeMgmtFrame->sessionId = sessionId; |
| 4775 | pSirSmeMgmtFrame->frameType = frameType; |
| 4776 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4777 | qdf_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4778 | pSirSmeMgmtFrame->frameLen = frameLen; |
| 4779 | |
| 4780 | mmhMsg.type = eWNI_SME_UNPROT_MGMT_FRM_IND; |
| 4781 | mmhMsg.bodyptr = pSirSmeMgmtFrame; |
| 4782 | mmhMsg.bodyval = 0; |
| 4783 | |
| 4784 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 4785 | return; |
| 4786 | } |
| 4787 | #endif |
| 4788 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4789 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4790 | /** ------------------------------------------------------------- |
| 4791 | \fn lim_send_sme_tsm_ie_ind |
| 4792 | \brief Forwards the TSM IE information to SME. |
| 4793 | \param tpAniSirGlobal pMac |
| 4794 | \param psessionEntry - PE session context |
| 4795 | \param tid - traffic id |
| 4796 | \param state - tsm state (enabled/disabled) |
| 4797 | \param measurementInterval - measurement interval |
| 4798 | \return none |
| 4799 | -------------------------------------------------------------*/ |
| 4800 | void lim_send_sme_tsm_ie_ind(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 4801 | uint8_t tid, uint8_t state, uint16_t measInterval) |
| 4802 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4803 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4804 | tpSirSmeTsmIEInd pSirSmeTsmIeInd = NULL; |
| 4805 | |
| 4806 | if (!pMac || !psessionEntry) |
| 4807 | return; |
| 4808 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4809 | pSirSmeTsmIeInd = qdf_mem_malloc(sizeof(tSirSmeTsmIEInd)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4810 | if (NULL == pSirSmeTsmIeInd) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4811 | pe_err("AllocateMemory failed for tSirSmeTsmIEInd"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4812 | return; |
| 4813 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4814 | |
| 4815 | pSirSmeTsmIeInd->sessionId = psessionEntry->smeSessionId; |
| 4816 | pSirSmeTsmIeInd->tsmIe.tsid = tid; |
| 4817 | pSirSmeTsmIeInd->tsmIe.state = state; |
| 4818 | pSirSmeTsmIeInd->tsmIe.msmt_interval = measInterval; |
| 4819 | |
| 4820 | mmhMsg.type = eWNI_SME_TSM_IE_IND; |
| 4821 | mmhMsg.bodyptr = pSirSmeTsmIeInd; |
| 4822 | mmhMsg.bodyval = 0; |
| 4823 | |
| 4824 | lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); |
| 4825 | return; |
| 4826 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4827 | #endif /* FEATURE_WLAN_ESE */ |