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