Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
| 29 | * This file lim_process_sme_req_messages.cc contains the code |
| 30 | * for processing SME request messages. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 02/11/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | * |
| 37 | */ |
| 38 | |
| 39 | #include "cds_api.h" |
| 40 | #include "wni_api.h" |
| 41 | #include "wni_cfg.h" |
| 42 | #include "cfg_api.h" |
| 43 | #include "sir_api.h" |
| 44 | #include "sch_api.h" |
| 45 | #include "utils_api.h" |
| 46 | #include "lim_types.h" |
| 47 | #include "lim_utils.h" |
| 48 | #include "lim_assoc_utils.h" |
| 49 | #include "lim_security_utils.h" |
| 50 | #include "lim_ser_des_utils.h" |
| 51 | #include "lim_sme_req_utils.h" |
| 52 | #include "lim_ibss_peer_mgmt.h" |
| 53 | #include "lim_admit_control.h" |
| 54 | #include "dph_hash_table.h" |
| 55 | #include "lim_send_messages.h" |
| 56 | #include "lim_api.h" |
| 57 | #include "wmm_apsd.h" |
| 58 | #include "sir_mac_prot_def.h" |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 59 | #include "rrm_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | |
| 61 | #include "sap_api.h" |
| 62 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 63 | |
| 64 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 65 | #include <lim_ft.h> |
| 66 | #endif |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 67 | #include "cds_regdomain_common.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | |
| 69 | /* |
| 70 | * This overhead is time for sending NOA start to host in case of GO/sending |
| 71 | * NULL data & receiving ACK in case of P2P Client and starting actual scanning |
| 72 | * with init scan req/rsp plus in case of concurrency, taking care of sending |
| 73 | * null data and receiving ACK to/from AP/Also SetChannel with calibration |
| 74 | * is taking around 7ms . |
| 75 | */ |
| 76 | #define SCAN_MESSAGING_OVERHEAD 20 /* in msecs */ |
| 77 | #define JOIN_NOA_DURATION 2000 /* in msecs */ |
| 78 | #define OEM_DATA_NOA_DURATION 60 /* in msecs */ |
| 79 | #define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 /* in msecs */ |
| 80 | |
| 81 | #define CONV_MS_TO_US 1024 /* conversion factor from ms to us */ |
| 82 | |
| 83 | /* SME REQ processing function templates */ |
| 84 | static bool __lim_process_sme_sys_ready_ind(tpAniSirGlobal, uint32_t *); |
| 85 | static bool __lim_process_sme_start_bss_req(tpAniSirGlobal, tpSirMsgQ pMsg); |
| 86 | static void __lim_process_sme_scan_req(tpAniSirGlobal, uint32_t *); |
| 87 | static void __lim_process_sme_join_req(tpAniSirGlobal, uint32_t *); |
| 88 | static void __lim_process_sme_reassoc_req(tpAniSirGlobal, uint32_t *); |
| 89 | static void __lim_process_sme_disassoc_req(tpAniSirGlobal, uint32_t *); |
| 90 | static void __lim_process_sme_disassoc_cnf(tpAniSirGlobal, uint32_t *); |
| 91 | static void __lim_process_sme_deauth_req(tpAniSirGlobal, uint32_t *); |
| 92 | static void __lim_process_sme_set_context_req(tpAniSirGlobal, uint32_t *); |
| 93 | static bool __lim_process_sme_stop_bss_req(tpAniSirGlobal, tpSirMsgQ pMsg); |
| 94 | static void lim_process_sme_channel_change_request(tpAniSirGlobal pMac, |
| 95 | uint32_t *pMsg); |
| 96 | static void lim_process_sme_start_beacon_req(tpAniSirGlobal pMac, uint32_t *pMsg); |
| 97 | static void lim_process_sme_dfs_csa_ie_request(tpAniSirGlobal pMac, uint32_t *pMsg); |
| 98 | static void lim_process_nss_update_request(tpAniSirGlobal pMac, uint32_t *pMsg); |
| 99 | static void lim_process_set_ie_req(tpAniSirGlobal pMac, uint32_t *pMsg); |
| 100 | |
| 101 | static void lim_start_bss_update_add_ie_buffer(tpAniSirGlobal pMac, |
| 102 | uint8_t **pDstData_buff, |
| 103 | uint16_t *pDstDataLen, |
| 104 | uint8_t *pSrcData_buff, |
| 105 | uint16_t srcDataLen); |
| 106 | |
| 107 | static void lim_update_add_ie_buffer(tpAniSirGlobal pMac, |
| 108 | uint8_t **pDstData_buff, |
| 109 | uint16_t *pDstDataLen, |
| 110 | uint8_t *pSrcData_buff, uint16_t srcDataLen); |
| 111 | |
| 112 | static void lim_process_modify_add_ies(tpAniSirGlobal pMac, uint32_t *pMsg); |
| 113 | |
| 114 | static void lim_process_update_add_ies(tpAniSirGlobal pMac, uint32_t *pMsg); |
| 115 | |
| 116 | extern void pe_register_wma_handle(tpAniSirGlobal pMac); |
| 117 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 118 | static void lim_process_ext_change_channel(tpAniSirGlobal mac_ctx, |
| 119 | uint32_t *msg); |
| 120 | |
| 121 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 122 | /** |
| 123 | * lim_process_set_hw_mode() - Send set HW mode command to WMA |
| 124 | * @mac: Globacl MAC pointer |
| 125 | * @msg: Message containing the hw mode index |
| 126 | * |
| 127 | * Send the set HW mode command to WMA |
| 128 | * |
| 129 | * Return: CDF_STATUS_SUCCESS if message posting is successful |
| 130 | */ |
| 131 | static CDF_STATUS lim_process_set_hw_mode(tpAniSirGlobal mac, uint32_t *msg) |
| 132 | { |
| 133 | CDF_STATUS status = CDF_STATUS_SUCCESS; |
| 134 | cds_msg_t cds_message; |
| 135 | struct sir_hw_mode *req_msg; |
| 136 | uint32_t len; |
| 137 | struct s_sir_set_hw_mode *buf; |
| 138 | tSirMsgQ resp_msg; |
| 139 | struct sir_set_hw_mode_resp *param; |
| 140 | |
| 141 | buf = (struct s_sir_set_hw_mode *) msg; |
| 142 | if (!buf) { |
| 143 | lim_log(mac, LOGE, FL("Set HW mode param is NULL")); |
| 144 | /* To free the active command list */ |
| 145 | goto fail; |
| 146 | } |
| 147 | |
| 148 | len = sizeof(*req_msg); |
| 149 | |
| 150 | req_msg = cdf_mem_malloc(len); |
| 151 | if (!req_msg) { |
| 152 | lim_log(mac, LOGE, FL("cdf_mem_malloc failed")); |
| 153 | /* Free the active command list |
| 154 | * Probably the malloc is going to fail there as well?! |
| 155 | */ |
| 156 | return CDF_STATUS_E_NOMEM; |
| 157 | } |
| 158 | |
| 159 | cdf_mem_zero(req_msg, len); |
| 160 | |
| 161 | req_msg->hw_mode_index = buf->set_hw.hw_mode_index; |
Chandrasekaran, Manishekar | ef70c0d | 2015-10-20 19:54:55 +0530 | [diff] [blame] | 162 | req_msg->reason = buf->set_hw.reason; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 163 | /* Other parameters are not needed for WMA */ |
| 164 | |
| 165 | cds_message.bodyptr = req_msg; |
| 166 | cds_message.type = SIR_HAL_SOC_SET_HW_MODE; |
| 167 | |
| 168 | lim_log(mac, LOG1, FL("Posting SIR_HAL_SOC_SET_HW_MOD to WMA")); |
| 169 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 170 | if (!CDF_IS_STATUS_SUCCESS(status)) { |
| 171 | lim_log(mac, LOGE, |
| 172 | FL("vos_mq_post_message failed!(err=%d)"), |
| 173 | status); |
| 174 | cdf_mem_free(req_msg); |
| 175 | goto fail; |
| 176 | } |
| 177 | return status; |
| 178 | fail: |
| 179 | param = cdf_mem_malloc(sizeof(*param)); |
| 180 | if (!param) { |
| 181 | lim_log(mac, LOGE, FL("HW mode resp failed")); |
| 182 | return CDF_STATUS_E_FAILURE; |
| 183 | } |
| 184 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 185 | param->cfgd_hw_mode_index = 0; |
| 186 | param->num_vdev_mac_entries = 0; |
| 187 | resp_msg.type = eWNI_SME_SET_HW_MODE_RESP; |
| 188 | resp_msg.bodyptr = param; |
| 189 | resp_msg.bodyval = 0; |
| 190 | lim_sys_process_mmh_msg_api(mac, &resp_msg, ePROT); |
| 191 | return CDF_STATUS_SUCCESS; |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * lim_process_set_dual_mac_cfg_req() - Set dual mac config command to WMA |
| 196 | * @mac: Global MAC pointer |
| 197 | * @msg: Message containing the dual mac config parameter |
| 198 | * |
| 199 | * Send the set dual mac config command to WMA |
| 200 | * |
| 201 | * Return: CDF_STATUS_SUCCESS if message posting is successful |
| 202 | */ |
| 203 | static CDF_STATUS lim_process_set_dual_mac_cfg_req(tpAniSirGlobal mac, |
| 204 | uint32_t *msg) |
| 205 | { |
| 206 | CDF_STATUS status = CDF_STATUS_SUCCESS; |
| 207 | cds_msg_t cds_message; |
| 208 | struct sir_dual_mac_config *req_msg; |
| 209 | uint32_t len; |
| 210 | struct sir_set_dual_mac_cfg *buf; |
| 211 | tSirMsgQ resp_msg; |
| 212 | struct sir_dual_mac_config_resp *param; |
| 213 | |
| 214 | buf = (struct sir_set_dual_mac_cfg *) msg; |
| 215 | if (!buf) { |
| 216 | lim_log(mac, LOGE, FL("Set Dual mac config is NULL")); |
| 217 | /* To free the active command list */ |
| 218 | goto fail; |
| 219 | } |
| 220 | |
| 221 | len = sizeof(*req_msg); |
| 222 | |
| 223 | req_msg = cdf_mem_malloc(len); |
| 224 | if (!req_msg) { |
| 225 | lim_log(mac, LOGE, FL("vos_mem_malloc failed")); |
| 226 | /* Free the active command list |
| 227 | * Probably the malloc is going to fail there as well?! |
| 228 | */ |
| 229 | return CDF_STATUS_E_NOMEM; |
| 230 | } |
| 231 | |
| 232 | cdf_mem_zero(req_msg, len); |
| 233 | |
| 234 | req_msg->scan_config = buf->set_dual_mac.scan_config; |
| 235 | req_msg->fw_mode_config = buf->set_dual_mac.fw_mode_config; |
| 236 | /* Other parameters are not needed for WMA */ |
| 237 | |
| 238 | cds_message.bodyptr = req_msg; |
| 239 | cds_message.type = SIR_HAL_SOC_DUAL_MAC_CFG_REQ; |
| 240 | |
| 241 | lim_log(mac, LOG1, |
| 242 | FL("Post SIR_HAL_SOC_DUAL_MAC_CFG_REQ to WMA: %x %x"), |
| 243 | req_msg->scan_config, req_msg->fw_mode_config); |
| 244 | status = cds_mq_post_message(CDS_MQ_ID_WMA, &cds_message); |
| 245 | if (!CDF_IS_STATUS_SUCCESS(status)) { |
| 246 | lim_log(mac, LOGE, |
| 247 | FL("vos_mq_post_message failed!(err=%d)"), |
| 248 | status); |
| 249 | cdf_mem_free(req_msg); |
| 250 | goto fail; |
| 251 | } |
| 252 | return status; |
| 253 | fail: |
| 254 | param = cdf_mem_malloc(sizeof(*param)); |
| 255 | if (!param) { |
| 256 | lim_log(mac, LOGE, FL("Dual mac config resp failed")); |
| 257 | return CDF_STATUS_E_FAILURE; |
| 258 | } |
| 259 | param->status = SET_HW_MODE_STATUS_ECANCELED; |
| 260 | resp_msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP; |
| 261 | resp_msg.bodyptr = param; |
| 262 | resp_msg.bodyval = 0; |
| 263 | lim_sys_process_mmh_msg_api(mac, &resp_msg, ePROT); |
| 264 | return CDF_STATUS_SUCCESS; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * __lim_fresh_scan_reqd() - determine if a fresh scan request must be issued. |
| 269 | * @mac_ctx: Pointer to Global MAC structure |
| 270 | * @return_fresh_results: Trigger fresh scan. |
| 271 | * |
| 272 | * PE will do fresh scan, if all of the active sessions are in |
| 273 | * good state (Link Est or BSS Started). If one of the sessions |
| 274 | * is not in one of the above states, then PE does not do fresh |
| 275 | * scan. If no session exists (scanning very first time), |
| 276 | * then PE will always do fresh scan if SME asks it to do that. |
| 277 | * |
| 278 | * Return: true for fresh scan results, false if in invalid state. |
| 279 | */ |
| 280 | static uint8_t |
| 281 | __lim_fresh_scan_reqd(tpAniSirGlobal mac_ctx, uint8_t return_fresh_results) |
| 282 | { |
| 283 | uint8_t valid_state = true; |
| 284 | int i; |
| 285 | |
| 286 | lim_log(mac_ctx, LOG1, FL("gLimSmeState: %d, returnFreshResults 0x%x"), |
| 287 | mac_ctx->lim.gLimSmeState, return_fresh_results); |
| 288 | |
| 289 | if (mac_ctx->lim.gLimSmeState != eLIM_SME_IDLE_STATE) { |
| 290 | lim_log(mac_ctx, LOG1, FL("return FALSE")); |
| 291 | return false; |
| 292 | } |
| 293 | |
| 294 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 295 | lim_log(mac_ctx, LOG1, |
| 296 | FL("session %d, bsstype %d, limSystemRole %d, limSmeState %d"), |
| 297 | i, mac_ctx->lim.gpSession[i].bssType, |
| 298 | mac_ctx->lim.gpSession[i].limSystemRole, |
| 299 | mac_ctx->lim.gpSession[i].limSmeState); |
| 300 | if (mac_ctx->lim.gpSession[i].valid == true) { |
| 301 | if (!((((mac_ctx->lim.gpSession[i].bssType == |
| 302 | eSIR_INFRASTRUCTURE_MODE) || |
| 303 | (mac_ctx->lim.gpSession[i].limSystemRole == |
| 304 | eLIM_BT_AMP_STA_ROLE)) && |
| 305 | (mac_ctx->lim.gpSession[i].limSmeState == |
| 306 | eLIM_SME_LINK_EST_STATE)) || |
| 307 | (((mac_ctx->lim.gpSession[i].bssType == |
| 308 | eSIR_IBSS_MODE) || |
| 309 | (mac_ctx->lim.gpSession[i].limSystemRole == |
| 310 | eLIM_BT_AMP_AP_ROLE) || |
| 311 | (mac_ctx->lim.gpSession[i].limSystemRole == |
| 312 | eLIM_BT_AMP_STA_ROLE)) && |
| 313 | (mac_ctx->lim.gpSession[i].limSmeState == |
| 314 | eLIM_SME_NORMAL_STATE)) || |
| 315 | ((((mac_ctx->lim.gpSession[i].bssType == |
| 316 | eSIR_INFRA_AP_MODE) && |
| 317 | (mac_ctx->lim.gpSession[i].pePersona == |
| 318 | CDF_P2P_GO_MODE)) || |
| 319 | (mac_ctx->lim.gpSession[i].limSystemRole == |
| 320 | eLIM_AP_ROLE)) && |
| 321 | (mac_ctx->lim.gpSession[i].limSmeState == |
| 322 | eLIM_SME_NORMAL_STATE)))) { |
| 323 | valid_state = false; |
| 324 | break; |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | lim_log(mac_ctx, LOG1, FL("valid_state: %d"), valid_state); |
| 330 | |
| 331 | if ((valid_state) && |
| 332 | (return_fresh_results & SIR_BG_SCAN_RETURN_FRESH_RESULTS)) |
| 333 | return true; |
| 334 | else |
| 335 | return false; |
| 336 | } |
| 337 | |
| 338 | /** |
| 339 | * __lim_is_sme_assoc_cnf_valid() |
| 340 | * |
| 341 | ***FUNCTION: |
| 342 | * This function is called by __lim_process_sme_assoc_cnf_new() upon |
| 343 | * receiving SME_ASSOC_CNF. |
| 344 | * |
| 345 | ***LOGIC: |
| 346 | * Message validity checks are performed in this function |
| 347 | * |
| 348 | ***ASSUMPTIONS: |
| 349 | * |
| 350 | ***NOTE: |
| 351 | * |
| 352 | * @param pMeasReq Pointer to Received ASSOC_CNF message |
| 353 | * @return true When received SME_ASSOC_CNF is formatted |
| 354 | * correctly |
| 355 | * false otherwise |
| 356 | */ |
| 357 | |
| 358 | static inline uint8_t __lim_is_sme_assoc_cnf_valid(tpSirSmeAssocCnf pAssocCnf) |
| 359 | { |
| 360 | if (lim_is_group_addr(pAssocCnf->peerMacAddr)) |
| 361 | return false; |
| 362 | else |
| 363 | return true; |
| 364 | } /*** end __lim_is_sme_assoc_cnf_valid() ***/ |
| 365 | |
| 366 | /** |
| 367 | * __lim_get_sme_join_req_size_for_alloc() |
| 368 | * |
| 369 | ***FUNCTION: |
| 370 | * This function is called in various places to get IE length |
| 371 | * from tSirBssDescription structure |
| 372 | * number being scanned. |
| 373 | * |
| 374 | ***PARAMS: |
| 375 | * |
| 376 | ***LOGIC: |
| 377 | * |
| 378 | ***ASSUMPTIONS: |
| 379 | * NA |
| 380 | * |
| 381 | ***NOTE: |
| 382 | * NA |
| 383 | * |
| 384 | * @param pBssDescr |
| 385 | * @return Total IE length |
| 386 | */ |
| 387 | |
| 388 | static uint16_t __lim_get_sme_join_req_size_for_alloc(uint8_t *pBuf) |
| 389 | { |
| 390 | uint16_t len = 0; |
| 391 | |
| 392 | if (!pBuf) |
| 393 | return len; |
| 394 | |
| 395 | pBuf += sizeof(uint16_t); |
| 396 | len = lim_get_u16(pBuf); |
| 397 | return len + sizeof(uint16_t); |
| 398 | } |
| 399 | |
| 400 | /** |
| 401 | * __lim_is_defered_msg_for_learn() - message handling in SME learn state |
| 402 | * @pMac: Global MAC context |
| 403 | * @pMsg: Pointer to message posted from SME to LIM. |
| 404 | * |
| 405 | * Has role only if 11h is enabled. Not used on STA side. |
| 406 | * Defers the message if SME is in learn state and brings |
| 407 | * the LIM back to normal mode. |
| 408 | * |
| 409 | * Return: true - If defered false - Otherwise |
| 410 | */ |
| 411 | |
| 412 | static bool __lim_is_defered_msg_for_learn(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 413 | { |
| 414 | if (lim_is_system_in_scan_state(pMac)) { |
| 415 | if (lim_defer_msg(pMac, pMsg) != TX_SUCCESS) { |
| 416 | lim_log(pMac, LOGE, FL("Could not defer Msg = %d"), |
| 417 | pMsg->type); |
| 418 | return false; |
| 419 | } |
| 420 | lim_log(pMac, LOG1, |
| 421 | FL("Defer the message, in learn mode type = %d"), |
| 422 | pMsg->type); |
| 423 | return true; |
| 424 | } |
| 425 | return false; |
| 426 | } |
| 427 | |
| 428 | /** |
| 429 | * __lim_is_defered_msg_for_radar() - Defers the message if radar is detected |
| 430 | * @mac_ctx: Pointer to Global MAC structure |
| 431 | * @message: Pointer to message posted from SME to LIM. |
| 432 | * |
| 433 | * Has role only if 11h is enabled. Not used on STA side. |
| 434 | * Defers the message if radar is detected. |
| 435 | * |
| 436 | * Return: true, if defered otherwise return false. |
| 437 | */ |
| 438 | static bool |
| 439 | __lim_is_defered_msg_for_radar(tpAniSirGlobal mac_ctx, tpSirMsgQ message) |
| 440 | { |
| 441 | /* |
| 442 | * fRadarDetCurOperChan will be set only if we |
| 443 | * detect radar in current operating channel and |
| 444 | * System Role == AP ROLE |
| 445 | * |
| 446 | * TODO: Need to take care radar detection. |
| 447 | * |
| 448 | * if (LIM_IS_RADAR_DETECTED(mac_ctx)) |
| 449 | */ |
| 450 | if (0) { |
| 451 | if (lim_defer_msg(mac_ctx, message) != TX_SUCCESS) { |
| 452 | lim_log(mac_ctx, LOGE, FL("Could not defer Msg = %d"), |
| 453 | message->type); |
| 454 | return false; |
| 455 | } |
| 456 | lim_log(mac_ctx, LOG1, |
| 457 | FL("Defer the message, in learn mode type = %d"), |
| 458 | message->type); |
| 459 | return true; |
| 460 | } |
| 461 | return false; |
| 462 | } |
| 463 | |
| 464 | /** |
| 465 | * __lim_process_sme_sys_ready_ind () - Process ready indication from WMA |
| 466 | * @pMac: Global MAC context |
| 467 | * @pMsgBuf: Message from WMA |
| 468 | * |
| 469 | * handles the notification from HDD. PE just forwards this message to HAL. |
| 470 | * |
| 471 | * Return: true-Posting to HAL failed, so PE will consume the buffer. |
| 472 | * false-Posting to HAL successful, so HAL will consume the buffer. |
| 473 | */ |
| 474 | |
| 475 | static bool __lim_process_sme_sys_ready_ind(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 476 | { |
| 477 | tSirMsgQ msg; |
| 478 | tSirSmeReadyReq *ready_req = (tSirSmeReadyReq *) pMsgBuf; |
| 479 | |
| 480 | msg.type = WMA_SYS_READY_IND; |
| 481 | msg.reserved = 0; |
| 482 | msg.bodyptr = pMsgBuf; |
| 483 | msg.bodyval = 0; |
| 484 | |
| 485 | if (ANI_DRIVER_TYPE(pMac) != eDRIVER_TYPE_MFG) { |
| 486 | pe_register_wma_handle(pMac); |
| 487 | pMac->lim.add_bssdescr_callback = ready_req->add_bssdescr_cb; |
| 488 | } |
| 489 | PELOGW(lim_log(pMac, LOGW, FL("sending WMA_SYS_READY_IND msg to HAL"));) |
| 490 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msg.type)); |
| 491 | |
| 492 | if (eSIR_SUCCESS != wma_post_ctrl_msg(pMac, &msg)) { |
| 493 | lim_log(pMac, LOGP, FL("wma_post_ctrl_msg failed")); |
| 494 | return true; |
| 495 | } |
| 496 | return false; |
| 497 | } |
| 498 | |
| 499 | #ifdef WLAN_FEATURE_11AC |
| 500 | |
| 501 | uint32_t lim_get_center_channel(tpAniSirGlobal pMac, uint8_t primarychanNum, |
| 502 | ePhyChanBondState secondaryChanOffset, |
| 503 | uint8_t chanWidth) |
| 504 | { |
| 505 | if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) { |
| 506 | switch (secondaryChanOffset) { |
| 507 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 508 | return primarychanNum; |
| 509 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 510 | return primarychanNum + 2; |
| 511 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 512 | return primarychanNum - 2; |
| 513 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 514 | return primarychanNum + 6; |
| 515 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 516 | return primarychanNum + 2; |
| 517 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 518 | return primarychanNum - 2; |
| 519 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 520 | return primarychanNum - 6; |
| 521 | default: |
| 522 | return eSIR_CFG_INVALID_ID; |
| 523 | } |
| 524 | } else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ) { |
| 525 | switch (secondaryChanOffset) { |
| 526 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 527 | return primarychanNum + 2; |
| 528 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 529 | return primarychanNum - 2; |
| 530 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 531 | return primarychanNum; |
| 532 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 533 | return primarychanNum + 2; |
| 534 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 535 | return primarychanNum - 2; |
| 536 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 537 | return primarychanNum + 2; |
| 538 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 539 | return primarychanNum - 2; |
| 540 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 541 | return primarychanNum + 2; |
| 542 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 543 | return primarychanNum - 2; |
| 544 | default: |
| 545 | return eSIR_CFG_INVALID_ID; |
| 546 | } |
| 547 | } |
| 548 | return primarychanNum; |
| 549 | } |
| 550 | |
| 551 | #endif |
| 552 | |
| 553 | /** |
| 554 | *lim_configure_ap_start_bss_session() - Configure the AP Start BSS in session. |
| 555 | *@mac_ctx: Pointer to Global MAC structure |
| 556 | *@session: A pointer to session entry |
| 557 | *@sme_start_bss_req: Start BSS Request from upper layers. |
| 558 | * |
| 559 | * This function is used to configure the start bss parameters |
| 560 | * in to the session. |
| 561 | * |
| 562 | * Return: None. |
| 563 | */ |
| 564 | static void |
| 565 | lim_configure_ap_start_bss_session(tpAniSirGlobal mac_ctx, tpPESession session, |
| 566 | tpSirSmeStartBssReq sme_start_bss_req) |
| 567 | { |
| 568 | session->limSystemRole = eLIM_AP_ROLE; |
| 569 | session->privacy = sme_start_bss_req->privacy; |
| 570 | session->fwdWPSPBCProbeReq = sme_start_bss_req->fwdWPSPBCProbeReq; |
| 571 | session->authType = sme_start_bss_req->authType; |
| 572 | /* Store the DTIM period */ |
| 573 | session->dtimPeriod = (uint8_t) sme_start_bss_req->dtimPeriod; |
| 574 | /* Enable/disable UAPSD */ |
| 575 | session->apUapsdEnable = sme_start_bss_req->apUapsdEnable; |
| 576 | if (session->pePersona == CDF_P2P_GO_MODE) { |
| 577 | session->proxyProbeRspEn = 0; |
| 578 | } else { |
| 579 | /* |
| 580 | * To detect PBC overlap in SAP WPS mode, |
| 581 | * Host handles Probe Requests. |
| 582 | */ |
| 583 | if (SAP_WPS_DISABLED == sme_start_bss_req->wps_state) |
| 584 | session->proxyProbeRspEn = 1; |
| 585 | else |
| 586 | session->proxyProbeRspEn = 0; |
| 587 | } |
| 588 | session->ssidHidden = sme_start_bss_req->ssidHidden; |
| 589 | session->wps_state = sme_start_bss_req->wps_state; |
| 590 | session->sap_dot11mc = sme_start_bss_req->sap_dot11mc; |
| 591 | lim_get_short_slot_from_phy_mode(mac_ctx, session, session->gLimPhyMode, |
| 592 | &session->shortSlotTimeSupported); |
| 593 | session->isCoalesingInIBSSAllowed = |
| 594 | sme_start_bss_req->isCoalesingInIBSSAllowed; |
| 595 | |
| 596 | } |
| 597 | |
| 598 | /** |
| 599 | * __lim_handle_sme_start_bss_request() - process SME_START_BSS_REQ message |
| 600 | *@mac_ctx: Pointer to Global MAC structure |
| 601 | *@msg_buf: A pointer to the SME message buffer |
| 602 | * |
| 603 | * This function is called to process SME_START_BSS_REQ message |
| 604 | * from HDD or upper layer application. |
| 605 | * |
| 606 | * Return: None |
| 607 | */ |
| 608 | static void |
| 609 | __lim_handle_sme_start_bss_request(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) |
| 610 | { |
| 611 | uint16_t size; |
| 612 | uint32_t val = 0; |
| 613 | tSirRetStatus ret_status; |
| 614 | tSirMacChanNum channel_number; |
| 615 | tLimMlmStartReq *mlm_start_req = NULL; |
| 616 | tpSirSmeStartBssReq sme_start_bss_req = NULL; |
| 617 | tSirResultCodes ret_code = eSIR_SME_SUCCESS; |
| 618 | /* Flag Used in case of IBSS to Auto generate BSSID. */ |
| 619 | uint32_t auto_gen_bssid = false; |
| 620 | uint8_t session_id; |
| 621 | tpPESession session = NULL; |
| 622 | uint8_t sme_session_id = 0; |
| 623 | uint16_t sme_transaction_id = 0; |
| 624 | uint32_t chanwidth; |
| 625 | tSirRetStatus cfg_get_wmi_dfs_master_param = eSIR_SUCCESS; |
| 626 | |
| 627 | /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 628 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 629 | /* |
| 630 | * Since the session is not created yet, sending NULL. |
| 631 | * The response should have the correct state. |
| 632 | */ |
| 633 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_START_BSS_REQ_EVENT, |
| 634 | NULL, 0, 0); |
| 635 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 636 | |
| 637 | lim_log(mac_ctx, LOG1, FL("Received START_BSS_REQ")); |
| 638 | |
| 639 | /* |
| 640 | * Global Sme state and mlm states are not defined yet, |
| 641 | * for BT-AMP Suppoprt . TO BE DONE |
| 642 | */ |
| 643 | if ((mac_ctx->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) || |
| 644 | (mac_ctx->lim.gLimSmeState == eLIM_SME_IDLE_STATE)) { |
| 645 | size = sizeof(tSirSmeStartBssReq); |
| 646 | |
| 647 | sme_start_bss_req = cdf_mem_malloc(size); |
| 648 | if (NULL == sme_start_bss_req) { |
| 649 | lim_log(mac_ctx, LOGE, |
| 650 | FL("Allocate Memory fail for LimStartBssReq")); |
| 651 | /* Send failure response to host */ |
| 652 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 653 | goto end; |
| 654 | } |
| 655 | |
| 656 | cdf_mem_set((void *)sme_start_bss_req, size, 0); |
| 657 | cdf_mem_copy(sme_start_bss_req, msg_buf, |
| 658 | sizeof(tSirSmeStartBssReq)); |
| 659 | if (!lim_is_sme_start_bss_req_valid(mac_ctx, |
| 660 | sme_start_bss_req)) { |
| 661 | lim_log(mac_ctx, LOGW, |
| 662 | FL("Received invalid eWNI_SME_START_BSS_REQ")); |
| 663 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 664 | goto free; |
| 665 | } |
| 666 | |
| 667 | /* |
| 668 | * This is the place where PE is going to create a session. |
| 669 | * If session is not existed, then create a new session |
| 670 | */ |
| 671 | session = pe_find_session_by_bssid(mac_ctx, |
Srinivas Girigowda | d8af4a6 | 2015-11-18 16:51:16 -0800 | [diff] [blame] | 672 | sme_start_bss_req->bssid.bytes, &session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 673 | if (session != NULL) { |
| 674 | lim_log(mac_ctx, LOGW, |
| 675 | FL("Session Already exists for given BSSID")); |
| 676 | ret_code = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 677 | session = NULL; |
| 678 | goto free; |
| 679 | } else { |
| 680 | session = pe_create_session(mac_ctx, |
Srinivas Girigowda | d8af4a6 | 2015-11-18 16:51:16 -0800 | [diff] [blame] | 681 | sme_start_bss_req->bssid.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 682 | &session_id, mac_ctx->lim.maxStation, |
| 683 | sme_start_bss_req->bssType); |
| 684 | if (session == NULL) { |
| 685 | lim_log(mac_ctx, LOGW, |
| 686 | FL("Session Can not be created ")); |
| 687 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 688 | goto free; |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | /* Probe resp add ie */ |
| 693 | lim_start_bss_update_add_ie_buffer(mac_ctx, |
| 694 | &session->addIeParams.probeRespData_buff, |
| 695 | &session->addIeParams.probeRespDataLen, |
| 696 | sme_start_bss_req->addIeParams.probeRespData_buff, |
| 697 | sme_start_bss_req->addIeParams.probeRespDataLen); |
| 698 | |
| 699 | /* Probe Beacon add ie */ |
| 700 | lim_start_bss_update_add_ie_buffer(mac_ctx, |
| 701 | &session->addIeParams.probeRespBCNData_buff, |
| 702 | &session->addIeParams.probeRespBCNDataLen, |
| 703 | sme_start_bss_req->addIeParams.probeRespBCNData_buff, |
| 704 | sme_start_bss_req->addIeParams.probeRespBCNDataLen); |
| 705 | |
| 706 | /* Assoc resp IE */ |
| 707 | lim_start_bss_update_add_ie_buffer(mac_ctx, |
| 708 | &session->addIeParams.assocRespData_buff, |
| 709 | &session->addIeParams.assocRespDataLen, |
| 710 | sme_start_bss_req->addIeParams.assocRespData_buff, |
| 711 | sme_start_bss_req->addIeParams.assocRespDataLen); |
| 712 | |
| 713 | /* Store the session related params in newly created session */ |
| 714 | session->pLimStartBssReq = sme_start_bss_req; |
| 715 | |
| 716 | /* Store PE session_id in session Table */ |
| 717 | session->peSessionId = session_id; |
| 718 | |
| 719 | /* Store SME session Id in sessionTable */ |
| 720 | session->smeSessionId = sme_start_bss_req->sessionId; |
| 721 | |
| 722 | session->transactionId = sme_start_bss_req->transactionId; |
| 723 | |
| 724 | cdf_mem_copy(&(session->htConfig), |
| 725 | &(sme_start_bss_req->htConfig), |
| 726 | sizeof(session->htConfig)); |
| 727 | |
| 728 | sir_copy_mac_addr(session->selfMacAddr, |
Srinivas Girigowda | d8af4a6 | 2015-11-18 16:51:16 -0800 | [diff] [blame] | 729 | sme_start_bss_req->self_macaddr.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 730 | |
| 731 | /* Copy SSID to session table */ |
| 732 | cdf_mem_copy((uint8_t *) &session->ssId, |
| 733 | (uint8_t *) &sme_start_bss_req->ssId, |
| 734 | (sme_start_bss_req->ssId.length + 1)); |
| 735 | |
| 736 | session->bssType = sme_start_bss_req->bssType; |
| 737 | |
| 738 | session->nwType = sme_start_bss_req->nwType; |
| 739 | |
| 740 | session->beaconParams.beaconInterval = |
| 741 | sme_start_bss_req->beaconInterval; |
| 742 | |
| 743 | /* Store the channel number in session Table */ |
| 744 | session->currentOperChannel = |
| 745 | sme_start_bss_req->channelId; |
| 746 | |
| 747 | /* Store Persona */ |
| 748 | session->pePersona = sme_start_bss_req->bssPersona; |
| 749 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 750 | FL("PE PERSONA=%d"), session->pePersona); |
| 751 | |
| 752 | /* Update the phymode */ |
| 753 | session->gLimPhyMode = sme_start_bss_req->nwType; |
| 754 | |
| 755 | session->maxTxPower = |
| 756 | cfg_get_regulatory_max_transmit_power(mac_ctx, |
| 757 | session->currentOperChannel); |
| 758 | /* Store the dot 11 mode in to the session Table */ |
| 759 | session->dot11mode = sme_start_bss_req->dot11mode; |
| 760 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 761 | session->cc_switch_mode = |
| 762 | sme_start_bss_req->cc_switch_mode; |
| 763 | #endif |
| 764 | session->htCapability = |
| 765 | IS_DOT11_MODE_HT(session->dot11mode); |
| 766 | session->vhtCapability = |
| 767 | IS_DOT11_MODE_VHT(session->dot11mode); |
| 768 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 769 | FL("*****session->vhtCapability = %d"), |
| 770 | session->vhtCapability); |
| 771 | session->txLdpcIniFeatureEnabled = |
| 772 | sme_start_bss_req->txLdpcIniFeatureEnabled; |
| 773 | |
| 774 | if (mac_ctx->roam.configParam.enable2x2) |
| 775 | session->nss = 2; |
| 776 | else |
| 777 | session->nss = 1; |
| 778 | #ifdef WLAN_FEATURE_11W |
| 779 | session->limRmfEnabled = |
| 780 | sme_start_bss_req->pmfCapable ? 1 : 0; |
| 781 | lim_log(mac_ctx, LOG1, FL("Session RMF enabled: %d"), |
| 782 | session->limRmfEnabled); |
| 783 | #endif |
| 784 | |
| 785 | cdf_mem_copy((void *)&session->rateSet, |
| 786 | (void *)&sme_start_bss_req->operationalRateSet, |
| 787 | sizeof(tSirMacRateSet)); |
| 788 | cdf_mem_copy((void *)&session->extRateSet, |
| 789 | (void *)&sme_start_bss_req->extendedRateSet, |
| 790 | sizeof(tSirMacRateSet)); |
| 791 | |
| 792 | switch (sme_start_bss_req->bssType) { |
| 793 | case eSIR_INFRA_AP_MODE: |
| 794 | lim_configure_ap_start_bss_session(mac_ctx, session, |
| 795 | sme_start_bss_req); |
| 796 | break; |
| 797 | case eSIR_IBSS_MODE: |
| 798 | session->limSystemRole = eLIM_STA_IN_IBSS_ROLE; |
| 799 | lim_get_short_slot_from_phy_mode(mac_ctx, session, |
| 800 | session->gLimPhyMode, |
| 801 | &session->shortSlotTimeSupported); |
| 802 | |
| 803 | /* |
| 804 | * initialize to "OPEN". |
| 805 | * will be updated upon key installation |
| 806 | */ |
| 807 | session->encryptType = eSIR_ED_NONE; |
| 808 | |
| 809 | break; |
| 810 | |
| 811 | case eSIR_BTAMP_AP_MODE: |
| 812 | session->limSystemRole = eLIM_BT_AMP_AP_ROLE; |
| 813 | break; |
| 814 | |
| 815 | case eSIR_BTAMP_STA_MODE: |
| 816 | session->limSystemRole = eLIM_BT_AMP_STA_ROLE; |
| 817 | break; |
| 818 | |
| 819 | /* |
| 820 | * There is one more mode called auto mode. |
| 821 | * which is used no where |
| 822 | */ |
| 823 | |
| 824 | /* FORBUILD -TEMPFIX.. HOW TO use AUTO MODE????? */ |
| 825 | |
| 826 | default: |
| 827 | /* not used anywhere...used in scan function */ |
| 828 | break; |
| 829 | } |
| 830 | |
| 831 | /* |
| 832 | * BT-AMP: Allocate memory for the array of |
| 833 | * parsed (Re)Assoc request structure |
| 834 | */ |
| 835 | if ((sme_start_bss_req->bssType == eSIR_BTAMP_AP_MODE) || |
| 836 | (sme_start_bss_req->bssType == eSIR_INFRA_AP_MODE)) { |
| 837 | session->parsedAssocReq = |
| 838 | cdf_mem_malloc(session->dph.dphHashTable. |
| 839 | size * sizeof(tpSirAssocReq)); |
| 840 | if (NULL == session->parsedAssocReq) { |
| 841 | lim_log(mac_ctx, LOGW, |
| 842 | FL("AllocateMemory() failed")); |
| 843 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 844 | goto free; |
| 845 | } |
| 846 | cdf_mem_set(session->parsedAssocReq, |
| 847 | (session->dph.dphHashTable.size * |
| 848 | sizeof(tpSirAssocReq)), 0); |
| 849 | } |
| 850 | |
| 851 | if (!sme_start_bss_req->channelId) { |
| 852 | lim_log(mac_ctx, LOGE, |
| 853 | FL("Received invalid eWNI_SME_START_BSS_REQ")); |
| 854 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 855 | goto free; |
| 856 | } |
| 857 | channel_number = sme_start_bss_req->channelId; |
| 858 | #ifdef QCA_HT_2040_COEX |
| 859 | if (sme_start_bss_req->obssEnabled) |
| 860 | session->htSupportedChannelWidthSet = |
| 861 | session->htCapability; |
| 862 | else |
| 863 | #endif |
| 864 | session->htSupportedChannelWidthSet = |
| 865 | (sme_start_bss_req->sec_ch_offset) ? 1 : 0; |
| 866 | session->htSecondaryChannelOffset = |
| 867 | sme_start_bss_req->sec_ch_offset; |
| 868 | session->htRecommendedTxWidthSet = |
| 869 | (session->htSecondaryChannelOffset) ? 1 : 0; |
| 870 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 871 | FL("cbMode %u"), sme_start_bss_req->cbMode); |
| 872 | if (session->vhtCapability || session->htCapability) { |
| 873 | chanwidth = sme_start_bss_req->vht_channel_width; |
| 874 | lim_log(mac_ctx, LOG1, FL("vht_channel_width %u"), |
| 875 | sme_start_bss_req->vht_channel_width); |
| 876 | if (channel_number <= RF_CHAN_14 && |
| 877 | chanwidth != eHT_CHANNEL_WIDTH_20MHZ) { |
| 878 | chanwidth = CH_WIDTH_20MHZ; |
| 879 | session->htSupportedChannelWidthSet = 0; |
| 880 | lim_log(mac_ctx, LOG1, |
| 881 | FL("Set chanwidth to 20Mhz, chan %d"), |
| 882 | channel_number); |
| 883 | } |
| 884 | session->ch_width = chanwidth; |
| 885 | if (session->htSupportedChannelWidthSet) { |
| 886 | session->ch_center_freq_seg0 = |
| 887 | sme_start_bss_req->center_freq_seg0; |
| 888 | session->ch_center_freq_seg1 = |
| 889 | sme_start_bss_req->center_freq_seg1; |
| 890 | } else { |
| 891 | session->ch_center_freq_seg0 = 0; |
| 892 | session->ch_center_freq_seg1 = 0; |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | if (session->vhtCapability && |
| 897 | (CH_WIDTH_160MHZ > session->ch_width)) { |
| 898 | if (wlan_cfg_get_int(mac_ctx, |
| 899 | WNI_CFG_VHT_SU_BEAMFORMER_CAP, &val) != |
| 900 | eSIR_SUCCESS) |
| 901 | lim_log(mac_ctx, LOGE, FL( |
| 902 | "cfg get vht su bformer failed")); |
| 903 | |
| 904 | session->enable_su_tx_bformer = val; |
| 905 | } else { |
| 906 | session->nss = 1; |
| 907 | } |
| 908 | lim_log(mac_ctx, LOG1, FL("vht su tx bformer %d"), val); |
| 909 | |
| 910 | /* Delete pre-auth list if any */ |
| 911 | lim_delete_pre_auth_list(mac_ctx); |
| 912 | |
| 913 | /* |
| 914 | * keep the RSN/WPA IE information in PE Session Entry |
| 915 | * later will be using this to check when received (Re)Assoc req |
| 916 | */ |
| 917 | lim_set_rs_nie_wp_aiefrom_sme_start_bss_req_message(mac_ctx, |
| 918 | &sme_start_bss_req->rsnIE, session); |
| 919 | |
| 920 | if (LIM_IS_AP_ROLE(session) || LIM_IS_IBSS_ROLE(session)) { |
| 921 | session->gLimProtectionControl = |
| 922 | sme_start_bss_req->protEnabled; |
| 923 | /* |
| 924 | * each byte will have the following info |
| 925 | * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 |
| 926 | * reserved reserved RIFS Lsig n-GF ht20 11g 11b |
| 927 | */ |
| 928 | cdf_mem_copy((void *)&session->cfgProtection, |
| 929 | (void *)&sme_start_bss_req->ht_capab, |
| 930 | sizeof(uint16_t)); |
| 931 | /* Initialize WPS PBC session link list */ |
| 932 | session->pAPWPSPBCSession = NULL; |
| 933 | } |
| 934 | /* Prepare and Issue LIM_MLM_START_REQ to MLM */ |
| 935 | mlm_start_req = cdf_mem_malloc(sizeof(tLimMlmStartReq)); |
| 936 | if (NULL == mlm_start_req) { |
| 937 | lim_log(mac_ctx, LOGP, |
| 938 | FL("Allocate Memory failed for mlmStartReq")); |
| 939 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 940 | goto free; |
| 941 | } |
| 942 | |
| 943 | cdf_mem_set((void *)mlm_start_req, sizeof(tLimMlmStartReq), 0); |
| 944 | |
| 945 | /* Copy SSID to the MLM start structure */ |
| 946 | cdf_mem_copy((uint8_t *) &mlm_start_req->ssId, |
| 947 | (uint8_t *) &sme_start_bss_req->ssId, |
| 948 | sme_start_bss_req->ssId.length + 1); |
| 949 | mlm_start_req->ssidHidden = sme_start_bss_req->ssidHidden; |
| 950 | mlm_start_req->obssProtEnabled = |
| 951 | sme_start_bss_req->obssProtEnabled; |
| 952 | |
| 953 | mlm_start_req->bssType = session->bssType; |
| 954 | |
| 955 | /* Fill PE session Id from the session Table */ |
| 956 | mlm_start_req->sessionId = session->peSessionId; |
| 957 | |
| 958 | if ((mlm_start_req->bssType == eSIR_BTAMP_STA_MODE) || |
| 959 | (mlm_start_req->bssType == eSIR_BTAMP_AP_MODE) || |
| 960 | (mlm_start_req->bssType == eSIR_INFRA_AP_MODE)) { |
| 961 | /* |
| 962 | * Copy the BSSId from sessionTable to |
| 963 | * mlmStartReq struct |
| 964 | */ |
| 965 | sir_copy_mac_addr(mlm_start_req->bssId, session->bssId); |
| 966 | } else { |
| 967 | /* ibss mode */ |
| 968 | mac_ctx->lim.gLimIbssCoalescingHappened = false; |
| 969 | |
| 970 | ret_status = wlan_cfg_get_int(mac_ctx, |
| 971 | WNI_CFG_IBSS_AUTO_BSSID, |
| 972 | &auto_gen_bssid); |
| 973 | if (ret_status != eSIR_SUCCESS) { |
| 974 | lim_log(mac_ctx, LOGP, |
| 975 | FL("Get Auto Gen BSSID fail,Status=%d"), |
| 976 | ret_status); |
| 977 | ret_code = eSIR_LOGP_EXCEPTION; |
| 978 | goto free; |
| 979 | } |
| 980 | |
| 981 | if (!auto_gen_bssid) { |
| 982 | /* |
| 983 | * We're not auto generating BSSID. |
| 984 | * Instead, get it from session entry |
| 985 | */ |
| 986 | sir_copy_mac_addr(mlm_start_req->bssId, |
| 987 | session->bssId); |
| 988 | /* |
| 989 | * Start IBSS group BSSID |
| 990 | * Auto Generating BSSID. |
| 991 | */ |
| 992 | auto_gen_bssid = ((mlm_start_req->bssId[0] & |
| 993 | 0x01) ? true : false); |
| 994 | } |
| 995 | |
| 996 | if (auto_gen_bssid) { |
| 997 | /* |
| 998 | * if BSSID is not any uc id. |
| 999 | * then use locally generated BSSID. |
| 1000 | * Autogenerate the BSSID |
| 1001 | */ |
| 1002 | lim_get_random_bssid(mac_ctx, |
| 1003 | mlm_start_req->bssId); |
| 1004 | mlm_start_req->bssId[0] = 0x02; |
| 1005 | |
| 1006 | /* |
| 1007 | * Copy randomly generated BSSID |
| 1008 | * to the session Table |
| 1009 | */ |
| 1010 | sir_copy_mac_addr(session->bssId, |
| 1011 | mlm_start_req->bssId); |
| 1012 | } |
| 1013 | } |
| 1014 | /* store the channel num in mlmstart req structure */ |
| 1015 | mlm_start_req->channelNumber = session->currentOperChannel; |
| 1016 | mlm_start_req->cbMode = sme_start_bss_req->cbMode; |
| 1017 | mlm_start_req->beaconPeriod = |
| 1018 | session->beaconParams.beaconInterval; |
| 1019 | |
| 1020 | if (LIM_IS_AP_ROLE(session)) { |
| 1021 | mlm_start_req->dtimPeriod = session->dtimPeriod; |
| 1022 | mlm_start_req->wps_state = session->wps_state; |
| 1023 | |
| 1024 | } else { |
| 1025 | if (wlan_cfg_get_int(mac_ctx, |
| 1026 | WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS) |
| 1027 | lim_log(mac_ctx, LOGP, |
| 1028 | FL("could not retrieve DTIM Period")); |
| 1029 | mlm_start_req->dtimPeriod = (uint8_t) val; |
| 1030 | } |
| 1031 | |
| 1032 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_CFP_PERIOD, &val) != |
| 1033 | eSIR_SUCCESS) |
| 1034 | lim_log(mac_ctx, LOGP, |
| 1035 | FL("could not retrieve Beacon interval")); |
| 1036 | mlm_start_req->cfParamSet.cfpPeriod = (uint8_t) val; |
| 1037 | |
| 1038 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_CFP_MAX_DURATION, &val) != |
| 1039 | eSIR_SUCCESS) |
| 1040 | lim_log(mac_ctx, LOGP, |
| 1041 | FL("could not retrieve CFPMaxDuration")); |
| 1042 | mlm_start_req->cfParamSet.cfpMaxDuration = (uint16_t) val; |
| 1043 | |
| 1044 | /* |
| 1045 | * this may not be needed anymore now, |
| 1046 | * as rateSet is now included in the |
| 1047 | * session entry and MLM has session context. |
| 1048 | */ |
| 1049 | cdf_mem_copy((void *)&mlm_start_req->rateSet, |
| 1050 | (void *)&session->rateSet, |
| 1051 | sizeof(tSirMacRateSet)); |
| 1052 | |
| 1053 | /* Now populate the 11n related parameters */ |
| 1054 | mlm_start_req->nwType = session->nwType; |
| 1055 | mlm_start_req->htCapable = session->htCapability; |
| 1056 | |
| 1057 | mlm_start_req->htOperMode = mac_ctx->lim.gHTOperMode; |
| 1058 | /* Unused */ |
| 1059 | mlm_start_req->dualCTSProtection = |
| 1060 | mac_ctx->lim.gHTDualCTSProtection; |
| 1061 | mlm_start_req->txChannelWidthSet = |
| 1062 | session->htRecommendedTxWidthSet; |
| 1063 | |
| 1064 | session->limRFBand = lim_get_rf_band(channel_number); |
| 1065 | |
| 1066 | /* Initialize 11h Enable Flag */ |
| 1067 | session->lim11hEnable = 0; |
| 1068 | if ((mlm_start_req->bssType != eSIR_IBSS_MODE) && |
| 1069 | (SIR_BAND_5_GHZ == session->limRFBand)) { |
| 1070 | if (wlan_cfg_get_int(mac_ctx, |
| 1071 | WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS) |
| 1072 | lim_log(mac_ctx, LOGP, |
| 1073 | FL("Fail to get WNI_CFG_11H_ENABLED ")); |
| 1074 | else |
| 1075 | session->lim11hEnable = val; |
| 1076 | |
| 1077 | if (session->lim11hEnable && |
| 1078 | (eSIR_INFRA_AP_MODE == |
| 1079 | mlm_start_req->bssType)) { |
| 1080 | cfg_get_wmi_dfs_master_param = |
| 1081 | wlan_cfg_get_int(mac_ctx, |
| 1082 | WNI_CFG_DFS_MASTER_ENABLED, |
| 1083 | &val); |
| 1084 | session->lim11hEnable = val; |
| 1085 | } |
| 1086 | if (cfg_get_wmi_dfs_master_param != eSIR_SUCCESS) |
| 1087 | /* Failed get CFG WNI_CFG_DFS_MASTER_ENABLED */ |
| 1088 | lim_log(mac_ctx, LOGE, |
| 1089 | FL("Get Fail, CFG DFS ENABLE")); |
| 1090 | } |
| 1091 | |
| 1092 | if (!session->lim11hEnable) { |
| 1093 | if (cfg_set_int(mac_ctx, |
| 1094 | WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != |
| 1095 | eSIR_SUCCESS) |
| 1096 | /* |
| 1097 | * Failed to set the CFG param |
| 1098 | * WNI_CFG_LOCAL_POWER_CONSTRAINT |
| 1099 | */ |
| 1100 | lim_log(mac_ctx, LOGE, |
| 1101 | FL("Set LOCAL_POWER_CONSTRAINT failed")); |
| 1102 | } |
| 1103 | |
| 1104 | session->limPrevSmeState = session->limSmeState; |
| 1105 | session->limSmeState = eLIM_SME_WT_START_BSS_STATE; |
| 1106 | MTRACE(mac_trace |
| 1107 | (mac_ctx, TRACE_CODE_SME_STATE, |
| 1108 | session->peSessionId, |
| 1109 | session->limSmeState)); |
| 1110 | |
| 1111 | lim_post_mlm_message(mac_ctx, LIM_MLM_START_REQ, |
| 1112 | (uint32_t *) mlm_start_req); |
| 1113 | return; |
| 1114 | } else { |
| 1115 | |
| 1116 | lim_log(mac_ctx, LOGE, |
| 1117 | FL("Received unexpected START_BSS_REQ, in state %X"), |
| 1118 | mac_ctx->lim.gLimSmeState); |
| 1119 | ret_code = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 1120 | goto end; |
| 1121 | } /* if (mac_ctx->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) */ |
| 1122 | |
| 1123 | free: |
| 1124 | if ((session != NULL) && |
| 1125 | (session->pLimStartBssReq == sme_start_bss_req)) { |
| 1126 | session->pLimStartBssReq = NULL; |
| 1127 | } |
| 1128 | cdf_mem_free(sme_start_bss_req); |
| 1129 | cdf_mem_free(mlm_start_req); |
| 1130 | |
| 1131 | end: |
| 1132 | if (sme_start_bss_req != NULL) { |
| 1133 | sme_session_id = sme_start_bss_req->sessionId; |
| 1134 | sme_transaction_id = sme_start_bss_req->transactionId; |
| 1135 | } |
| 1136 | if (NULL != session) { |
| 1137 | pe_delete_session(mac_ctx, session); |
| 1138 | session = NULL; |
| 1139 | } |
| 1140 | lim_send_sme_start_bss_rsp(mac_ctx, eWNI_SME_START_BSS_RSP, ret_code, |
| 1141 | session, sme_session_id, sme_transaction_id); |
| 1142 | } |
| 1143 | |
| 1144 | /** |
| 1145 | * __lim_process_sme_start_bss_req() - Call handler to start BSS |
| 1146 | * |
| 1147 | * @pMac: Global MAC context |
| 1148 | * @pMsg: Message pointer |
| 1149 | * |
| 1150 | * Wrapper for the function __lim_handle_sme_start_bss_request |
| 1151 | * This message will be defered until softmac come out of |
| 1152 | * scan mode or if we have detected radar on the current |
| 1153 | * operating channel. |
| 1154 | * |
| 1155 | * return true - If we consumed the buffer |
| 1156 | * false - If have defered the message. |
| 1157 | */ |
| 1158 | static bool __lim_process_sme_start_bss_req(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 1159 | { |
| 1160 | if (__lim_is_defered_msg_for_learn(pMac, pMsg) || |
| 1161 | __lim_is_defered_msg_for_radar(pMac, pMsg)) { |
| 1162 | /** |
| 1163 | * If message defered, buffer is not consumed yet. |
| 1164 | * So return false |
| 1165 | */ |
| 1166 | return false; |
| 1167 | } |
| 1168 | |
| 1169 | __lim_handle_sme_start_bss_request(pMac, (uint32_t *) pMsg->bodyptr); |
| 1170 | return true; |
| 1171 | } |
| 1172 | |
| 1173 | /** |
| 1174 | * lim_get_random_bssid() |
| 1175 | * |
| 1176 | * FUNCTION:This function is called to process generate the random number for bssid |
| 1177 | * This function is called to process SME_SCAN_REQ message |
| 1178 | * from HDD or upper layer application. |
| 1179 | * |
| 1180 | * LOGIC: |
| 1181 | * |
| 1182 | * ASSUMPTIONS: |
| 1183 | * |
| 1184 | * NOTE: |
| 1185 | * 1. geneartes the unique random number for bssid in ibss |
| 1186 | * |
| 1187 | * @param pMac Pointer to Global MAC structure |
| 1188 | * @param *data Pointer to bssid buffer |
| 1189 | * @return None |
| 1190 | */ |
| 1191 | void lim_get_random_bssid(tpAniSirGlobal pMac, uint8_t *data) |
| 1192 | { |
| 1193 | uint32_t random[2]; |
| 1194 | random[0] = tx_time_get(); |
| 1195 | random[0] |= (random[0] << 15); |
| 1196 | random[1] = random[0] >> 1; |
| 1197 | cdf_mem_copy(data, (uint8_t *) random, sizeof(tSirMacAddr)); |
| 1198 | } |
| 1199 | |
| 1200 | static CDF_STATUS lim_send_hal_start_scan_offload_req(tpAniSirGlobal pMac, |
| 1201 | tpSirSmeScanReq pScanReq) |
| 1202 | { |
| 1203 | tSirScanOffloadReq *pScanOffloadReq; |
| 1204 | uint8_t *p; |
| 1205 | uint8_t *ht_cap_ie; |
| 1206 | tSirMsgQ msg; |
| 1207 | uint16_t i, len; |
| 1208 | uint16_t ht_cap_len = 0, addn_ie_len = 0; |
| 1209 | #ifdef WLAN_FEATURE_11AC |
| 1210 | uint8_t *vht_cap_ie; |
| 1211 | uint16_t vht_cap_len = 0; |
| 1212 | #endif /* WLAN_FEATURE_11AC */ |
| 1213 | tSirRetStatus status, rc = eSIR_SUCCESS; |
| 1214 | tDot11fIEExtCap extracted_extcap = {0}; |
| 1215 | bool extcap_present = true; |
| 1216 | |
| 1217 | if (pScanReq->uIEFieldLen) { |
| 1218 | status = lim_strip_extcap_update_struct(pMac, |
| 1219 | (uint8_t *) pScanReq + pScanReq->uIEFieldOffset, |
| 1220 | &pScanReq->uIEFieldLen, &extracted_extcap); |
| 1221 | |
| 1222 | if (eSIR_SUCCESS != status) { |
| 1223 | extcap_present = false; |
| 1224 | lim_log(pMac, LOG1, |
| 1225 | FL("Unable to Strip ExtCap IE from Scan Req")); |
| 1226 | } |
| 1227 | |
| 1228 | if (extcap_present) { |
| 1229 | lim_log(pMac, LOG1, |
| 1230 | FL("Extcap was part of SCAN IE - Updating FW")); |
| 1231 | lim_send_ext_cap_ie(pMac, pScanReq->sessionId, |
| 1232 | &extracted_extcap, true); |
| 1233 | } |
| 1234 | } else { |
| 1235 | lim_log(pMac, LOG1, |
| 1236 | FL("No IEs in the scan request from supplicant")); |
| 1237 | } |
| 1238 | |
| 1239 | /** |
| 1240 | * The tSirScanOffloadReq will reserve the space for first channel, |
| 1241 | * so allocate the memory for (numChannels - 1) and uIEFieldLen |
| 1242 | */ |
| 1243 | len = sizeof(tSirScanOffloadReq) + |
| 1244 | (pScanReq->channelList.numChannels - 1) + pScanReq->uIEFieldLen; |
| 1245 | |
| 1246 | if (IS_DOT11_MODE_HT(pScanReq->dot11mode)) { |
| 1247 | lim_log(pMac, LOG1, |
| 1248 | FL("Adding HT Caps IE since dot11mode=%d"), |
| 1249 | pScanReq->dot11mode); |
| 1250 | /* 2 bytes for EID and Length */ |
| 1251 | ht_cap_len = 2 + sizeof(tHtCaps); |
| 1252 | len += ht_cap_len; |
| 1253 | addn_ie_len += ht_cap_len; |
| 1254 | } |
| 1255 | |
| 1256 | #ifdef WLAN_FEATURE_11AC |
| 1257 | if (IS_DOT11_MODE_VHT(pScanReq->dot11mode)) { |
| 1258 | lim_log(pMac, LOG1, |
| 1259 | FL("Adding VHT Caps IE since dot11mode=%d"), |
| 1260 | pScanReq->dot11mode); |
| 1261 | /* 2 bytes for EID and Length */ |
| 1262 | vht_cap_len = 2 + sizeof(tSirMacVHTCapabilityInfo) + |
| 1263 | sizeof(tSirVhtMcsInfo); |
| 1264 | len += vht_cap_len; |
| 1265 | addn_ie_len += vht_cap_len; |
| 1266 | } |
| 1267 | #endif /* WLAN_FEATURE_11AC */ |
| 1268 | |
| 1269 | pScanOffloadReq = cdf_mem_malloc(len); |
| 1270 | if (NULL == pScanOffloadReq) { |
| 1271 | lim_log(pMac, LOGE, |
| 1272 | FL("AllocateMemory failed for pScanOffloadReq")); |
| 1273 | return CDF_STATUS_E_NOMEM; |
| 1274 | } |
| 1275 | |
| 1276 | cdf_mem_set((uint8_t *) pScanOffloadReq, len, 0); |
| 1277 | |
| 1278 | msg.type = WMA_START_SCAN_OFFLOAD_REQ; |
| 1279 | msg.bodyptr = pScanOffloadReq; |
| 1280 | msg.bodyval = 0; |
| 1281 | |
Srinivas Girigowda | 2c6bf00 | 2015-09-24 11:43:31 -0700 | [diff] [blame] | 1282 | cdf_copy_macaddr(&pScanOffloadReq->bssId, &pScanReq->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1283 | |
| 1284 | if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID) { |
| 1285 | lim_log(pMac, LOGE, |
| 1286 | FL("Invalid value (%d) for numSsid"), |
| 1287 | SIR_SCAN_MAX_NUM_SSID); |
| 1288 | cdf_mem_free(pScanOffloadReq); |
| 1289 | return CDF_STATUS_E_FAILURE; |
| 1290 | } |
| 1291 | |
| 1292 | pScanOffloadReq->numSsid = pScanReq->numSsid; |
| 1293 | for (i = 0; i < pScanOffloadReq->numSsid; i++) { |
| 1294 | pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length; |
| 1295 | cdf_mem_copy((uint8_t *) pScanOffloadReq->ssId[i].ssId, |
| 1296 | (uint8_t *) pScanReq->ssId[i].ssId, |
| 1297 | pScanOffloadReq->ssId[i].length); |
| 1298 | } |
| 1299 | |
| 1300 | pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid; |
Srinivas Girigowda | 2c6bf00 | 2015-09-24 11:43:31 -0700 | [diff] [blame] | 1301 | cdf_copy_macaddr(&pScanOffloadReq->selfMacAddr, &pScanReq->selfMacAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1302 | pScanOffloadReq->bssType = pScanReq->bssType; |
| 1303 | pScanOffloadReq->dot11mode = pScanReq->dot11mode; |
| 1304 | pScanOffloadReq->scanType = pScanReq->scanType; |
| 1305 | pScanOffloadReq->minChannelTime = pScanReq->minChannelTime; |
| 1306 | pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime; |
| 1307 | pScanOffloadReq->restTime = pScanReq->restTime; |
| 1308 | |
| 1309 | /* for normal scan, the value for p2pScanType should be 0 |
| 1310 | always */ |
| 1311 | if (pScanReq->p2pSearch) |
| 1312 | pScanOffloadReq->p2pScanType = P2P_SCAN_TYPE_SEARCH; |
| 1313 | |
| 1314 | pScanOffloadReq->sessionId = pScanReq->sessionId; |
| 1315 | pScanOffloadReq->scan_id = pScanReq->scan_id; |
| 1316 | |
| 1317 | if (pScanOffloadReq->sessionId >= pMac->lim.maxBssId) |
| 1318 | lim_log(pMac, LOGE, FL("Invalid pe sessionID : %d"), |
| 1319 | pScanOffloadReq->sessionId); |
| 1320 | |
| 1321 | pScanOffloadReq->channelList.numChannels = |
| 1322 | pScanReq->channelList.numChannels; |
| 1323 | p = &(pScanOffloadReq->channelList.channelNumber[0]); |
| 1324 | for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++) |
| 1325 | p[i] = pScanReq->channelList.channelNumber[i]; |
| 1326 | |
| 1327 | pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen; |
| 1328 | pScanOffloadReq->uIEFieldOffset = len - addn_ie_len - |
| 1329 | pScanOffloadReq->uIEFieldLen; |
| 1330 | cdf_mem_copy((uint8_t *) pScanOffloadReq + |
| 1331 | pScanOffloadReq->uIEFieldOffset, |
| 1332 | (uint8_t *) pScanReq + pScanReq->uIEFieldOffset, |
| 1333 | pScanReq->uIEFieldLen); |
| 1334 | |
| 1335 | /* Copy HT Capability info if dot11mode is HT */ |
| 1336 | if (IS_DOT11_MODE_HT(pScanReq->dot11mode)) { |
| 1337 | /* Populate EID and Length field here */ |
| 1338 | ht_cap_ie = (uint8_t *) pScanOffloadReq + |
| 1339 | pScanOffloadReq->uIEFieldOffset + |
| 1340 | pScanOffloadReq->uIEFieldLen; |
| 1341 | cdf_mem_set(ht_cap_ie, ht_cap_len, 0); |
| 1342 | *ht_cap_ie = SIR_MAC_HT_CAPABILITIES_EID; |
| 1343 | *(ht_cap_ie + 1) = ht_cap_len - 2; |
| 1344 | lim_set_ht_caps(pMac, NULL, ht_cap_ie, ht_cap_len); |
| 1345 | pScanOffloadReq->uIEFieldLen += ht_cap_len; |
| 1346 | } |
| 1347 | |
| 1348 | #ifdef WLAN_FEATURE_11AC |
| 1349 | /* Copy VHT Capability info if dot11mode is VHT Capable */ |
| 1350 | if (IS_DOT11_MODE_VHT(pScanReq->dot11mode)) { |
| 1351 | /* Populate EID and Length field here */ |
| 1352 | vht_cap_ie = (uint8_t *) pScanOffloadReq + |
| 1353 | pScanOffloadReq->uIEFieldOffset + |
| 1354 | pScanOffloadReq->uIEFieldLen; |
| 1355 | cdf_mem_set(vht_cap_ie, vht_cap_len, 0); |
| 1356 | *vht_cap_ie = SIR_MAC_VHT_CAPABILITIES_EID; |
| 1357 | *(vht_cap_ie + 1) = vht_cap_len - 2; |
| 1358 | lim_set_vht_caps(pMac, NULL, vht_cap_ie, vht_cap_len); |
| 1359 | pScanOffloadReq->uIEFieldLen += vht_cap_len; |
| 1360 | } |
| 1361 | #endif /* WLAN_FEATURE_11AC */ |
| 1362 | |
| 1363 | rc = wma_post_ctrl_msg(pMac, &msg); |
| 1364 | if (rc != eSIR_SUCCESS) { |
| 1365 | lim_log(pMac, LOGE, FL("wma_post_ctrl_msg() return failure")); |
| 1366 | cdf_mem_free(pScanOffloadReq); |
| 1367 | return CDF_STATUS_E_FAILURE; |
| 1368 | } |
| 1369 | |
| 1370 | lim_log(pMac, LOG1, FL("Processed Offload Scan Request Successfully")); |
| 1371 | |
| 1372 | return CDF_STATUS_SUCCESS; |
| 1373 | } |
| 1374 | |
| 1375 | /** |
| 1376 | * __lim_process_sme_scan_req() - Process the SME Scan Request |
| 1377 | * @mac_ctx: Global MAC Context |
| 1378 | * @msg_buf: Buffer which contains the request and pertinent parameters |
| 1379 | * |
| 1380 | * This function is called to process SME_SCAN_REQ message |
| 1381 | * from HDD or upper layer application. |
| 1382 | * |
| 1383 | * Return: None |
| 1384 | */ |
| 1385 | |
| 1386 | static void __lim_process_sme_scan_req(tpAniSirGlobal mac_ctx, |
| 1387 | uint32_t *msg_buf) |
| 1388 | { |
| 1389 | tpSirSmeScanReq scan_req; |
| 1390 | uint8_t valid_req = 0; |
| 1391 | |
| 1392 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1393 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, |
| 1394 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 1395 | #endif |
| 1396 | |
| 1397 | scan_req = (tpSirSmeScanReq) msg_buf; |
| 1398 | lim_log(mac_ctx, LOG1, |
| 1399 | FL("SME SCAN REQ id %d numChan %d min %d max %d IELen %d first %d fresh %d unique %d type %d rsp %d"), |
| 1400 | scan_req->scan_id, scan_req->channelList.numChannels, |
| 1401 | scan_req->minChannelTime, scan_req->maxChannelTime, |
| 1402 | scan_req->uIEFieldLen, scan_req->returnAfterFirstMatch, |
| 1403 | scan_req->returnFreshResults, scan_req->returnUniqueResults, |
| 1404 | scan_req->scanType, mac_ctx->lim.gLimRspReqd ? 1 : 0); |
| 1405 | /* |
| 1406 | * Since scan req always requires a response, we will overwrite response |
| 1407 | * required here. This is added esp to take care of the condition where |
| 1408 | * in p2p go case, we hold the scan req and insert single NOA. We send |
| 1409 | * the held scan request to FW later on getting start NOA ind from FW so |
| 1410 | * we lose state of the gLimRspReqd flag for the scan req if any other |
| 1411 | * request comes by then. e.g. While unit testing, we found when insert |
| 1412 | * single NOA is done, we see a get stats request which turns the flag |
| 1413 | * gLimRspReqd to false; now when we actually start the saved scan req |
| 1414 | * for init scan after getting NOA started, the gLimRspReqd being a |
| 1415 | * global flag is showing false instead of true value for this saved |
| 1416 | * scan req. Since all scan reqs coming to lim require a response, |
| 1417 | * there is no harm in setting the global flag gLimRspReqd to true here. |
| 1418 | */ |
| 1419 | mac_ctx->lim.gLimRspReqd = true; |
| 1420 | |
| 1421 | /* |
| 1422 | * copy the Self MAC address from SmeReq to the globalplace, |
| 1423 | * used for sending probe req |
| 1424 | */ |
Srinivas Girigowda | 2c6bf00 | 2015-09-24 11:43:31 -0700 | [diff] [blame] | 1425 | sir_copy_mac_addr(mac_ctx->lim.gSelfMacAddr, |
| 1426 | scan_req->selfMacAddr.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1427 | valid_req = lim_is_sme_scan_req_valid(mac_ctx, scan_req); |
| 1428 | |
| 1429 | if (!valid_req || mac_ctx->lim.scan_disabled) { |
| 1430 | lim_log(mac_ctx, LOGE, |
| 1431 | FL("Scan disabled %d, Valid Scan Req %d"), |
| 1432 | mac_ctx->lim.scan_disabled, valid_req); |
| 1433 | |
| 1434 | if (mac_ctx->lim.gLimRspReqd) { |
| 1435 | mac_ctx->lim.gLimRspReqd = false; |
| 1436 | |
| 1437 | lim_send_sme_scan_rsp(mac_ctx, |
| 1438 | eSIR_SME_INVALID_PARAMETERS, |
| 1439 | scan_req->sessionId, |
| 1440 | scan_req->transactionId, |
| 1441 | scan_req->scan_id); |
| 1442 | } |
| 1443 | return; |
| 1444 | } |
| 1445 | |
| 1446 | /* |
| 1447 | * If scan request is received in idle, joinFailed |
| 1448 | * states or in link established state (in STA role) |
| 1449 | * or in normal state (in STA-in-IBSS/AP role) with |
| 1450 | * 'return fresh scan results' request from HDD or |
| 1451 | * it is periodic background scanning request, |
| 1452 | * trigger fresh scan request to MLM |
| 1453 | */ |
| 1454 | if (__lim_fresh_scan_reqd(mac_ctx, scan_req->returnFreshResults)) { |
| 1455 | |
| 1456 | mac_ctx->lim.gLim24Band11dScanDone = 0; |
| 1457 | mac_ctx->lim.gLim50Band11dScanDone = 0; |
| 1458 | mac_ctx->lim.gLimReturnAfterFirstMatch = |
| 1459 | scan_req->returnAfterFirstMatch; |
| 1460 | mac_ctx->lim.gLimReturnUniqueResults = |
| 1461 | ((scan_req->returnUniqueResults) > 0 ? true : false); |
| 1462 | |
| 1463 | if (CDF_STATUS_SUCCESS != |
| 1464 | lim_send_hal_start_scan_offload_req(mac_ctx, |
| 1465 | scan_req)) { |
| 1466 | lim_log(mac_ctx, LOGE, FL( |
| 1467 | "Couldn't send Offload scan request")); |
| 1468 | lim_send_sme_scan_rsp(mac_ctx, |
| 1469 | eSIR_SME_INVALID_PARAMETERS, |
| 1470 | scan_req->sessionId, |
| 1471 | scan_req->transactionId, |
| 1472 | scan_req->scan_id); |
| 1473 | return; |
| 1474 | } |
| 1475 | } |
| 1476 | else { |
| 1477 | /* In all other cases return 'cached' scan results */ |
| 1478 | if (mac_ctx->lim.gLimRspReqd) { |
| 1479 | mac_ctx->lim.gLimRspReqd = false; |
| 1480 | lim_send_sme_scan_rsp(mac_ctx, eSIR_SME_SUCCESS, |
| 1481 | scan_req->sessionId, |
| 1482 | scan_req->transactionId, scan_req->scan_id); |
| 1483 | } |
| 1484 | } |
| 1485 | } |
| 1486 | |
| 1487 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1488 | |
| 1489 | static void __lim_process_sme_oem_data_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 1490 | { |
| 1491 | tpSirOemDataReq pOemDataReq; |
| 1492 | tLimMlmOemDataReq *pMlmOemDataReq; |
| 1493 | |
| 1494 | pOemDataReq = (tpSirOemDataReq) pMsgBuf; |
| 1495 | |
| 1496 | /* post the lim mlm message now */ |
| 1497 | pMlmOemDataReq = cdf_mem_malloc(sizeof(tLimMlmOemDataReq)); |
| 1498 | if (NULL == pMlmOemDataReq) { |
| 1499 | lim_log(pMac, LOGP, |
| 1500 | FL("AllocateMemory failed for mlmOemDataReq")); |
| 1501 | return; |
| 1502 | } |
| 1503 | /* Initialize this buffer */ |
| 1504 | cdf_mem_set(pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0); |
| 1505 | |
Srinivas Girigowda | 0ee6686 | 2015-09-24 14:03:29 -0700 | [diff] [blame] | 1506 | cdf_copy_macaddr(&pMlmOemDataReq->selfMacAddr, |
| 1507 | &pOemDataReq->selfMacAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1508 | cdf_mem_copy(pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq, |
| 1509 | OEM_DATA_REQ_SIZE); |
| 1510 | |
| 1511 | /* Issue LIM_MLM_OEM_DATA_REQ to MLM */ |
| 1512 | lim_post_mlm_message(pMac, LIM_MLM_OEM_DATA_REQ, |
| 1513 | (uint32_t *) pMlmOemDataReq); |
| 1514 | |
| 1515 | return; |
| 1516 | |
| 1517 | } /*** end __lim_process_sme_oem_data_req() ***/ |
| 1518 | |
| 1519 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
| 1520 | |
| 1521 | /** |
| 1522 | * __lim_process_clear_dfs_channel_list() |
| 1523 | * |
| 1524 | ***FUNCTION: |
| 1525 | ***Clear DFS channel list when country is changed/aquired. |
| 1526 | .*This message is sent from SME. |
| 1527 | * |
| 1528 | ***LOGIC: |
| 1529 | * |
| 1530 | ***ASSUMPTIONS: |
| 1531 | * |
| 1532 | ***NOTE: |
| 1533 | * |
| 1534 | * @param pMac Pointer to Global MAC structure |
| 1535 | * @param *pMsgBuf A pointer to the SME message buffer |
| 1536 | * @return None |
| 1537 | */ |
| 1538 | static void __lim_process_clear_dfs_channel_list(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 1539 | { |
| 1540 | cdf_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0); |
| 1541 | } |
| 1542 | |
| 1543 | /** |
| 1544 | * __lim_process_sme_join_req() - process SME_JOIN_REQ message |
| 1545 | * @mac_ctx: Pointer to Global MAC structure |
| 1546 | * @msg_buf: A pointer to the SME message buffer |
| 1547 | * |
| 1548 | * This function is called to process SME_JOIN_REQ message |
| 1549 | * from HDD or upper layer application. |
| 1550 | * |
| 1551 | * Return: None |
| 1552 | */ |
| 1553 | static void |
| 1554 | __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) |
| 1555 | { |
| 1556 | tpSirSmeJoinReq sme_join_req = NULL; |
| 1557 | tLimMlmJoinReq *mlm_join_req; |
| 1558 | tSirResultCodes ret_code = eSIR_SME_SUCCESS; |
| 1559 | uint32_t val = 0; |
| 1560 | uint16_t n_size; |
| 1561 | uint8_t session_id; |
| 1562 | tpPESession session = NULL; |
| 1563 | uint8_t sme_session_id; |
| 1564 | uint16_t sme_transaction_id; |
| 1565 | tPowerdBm local_power_constraint = 0, reg_max = 0; |
| 1566 | uint16_t ie_len; |
| 1567 | uint8_t *vendor_ie; |
| 1568 | tSirBssDescription bss_desc; |
| 1569 | |
| 1570 | /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1571 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 1572 | /* |
| 1573 | * Not sending any session, since it is not created yet. |
| 1574 | * The response whould have correct state. |
| 1575 | */ |
| 1576 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0); |
| 1577 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 1578 | |
| 1579 | lim_log(mac_ctx, LOG1, FL("Received SME_JOIN_REQ")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1580 | |
| 1581 | /* |
| 1582 | * Expect Join request in idle state. |
| 1583 | * Reassociate request is expected in link established state. |
| 1584 | */ |
| 1585 | |
| 1586 | /* Global SME and LIM states are not defined yet for BT-AMP Support */ |
| 1587 | if (mac_ctx->lim.gLimSmeState == eLIM_SME_IDLE_STATE) { |
| 1588 | n_size = __lim_get_sme_join_req_size_for_alloc((uint8_t *) |
| 1589 | msg_buf); |
| 1590 | |
| 1591 | sme_join_req = cdf_mem_malloc(n_size); |
| 1592 | if (NULL == sme_join_req) { |
| 1593 | lim_log(mac_ctx, LOGP, |
| 1594 | FL("AllocateMemory failed for sme_join_req")); |
| 1595 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1596 | return; |
| 1597 | } |
| 1598 | (void)cdf_mem_set((void *)sme_join_req, n_size, 0); |
| 1599 | (void)cdf_mem_copy((void *)sme_join_req, (void *)msg_buf, |
| 1600 | n_size); |
| 1601 | |
| 1602 | if (!lim_is_sme_join_req_valid(mac_ctx, sme_join_req)) { |
| 1603 | /* Received invalid eWNI_SME_JOIN_REQ */ |
| 1604 | /* Log the event */ |
| 1605 | lim_log(mac_ctx, LOGW, |
| 1606 | FL("SessionId:%d JOIN REQ with invalid data"), |
| 1607 | sme_join_req->sessionId); |
| 1608 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 1609 | goto end; |
| 1610 | } |
| 1611 | |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 1612 | /* |
| 1613 | * Update the capability here itself as this is used in |
| 1614 | * lim_extract_ap_capability() below. If not updated issues |
| 1615 | * like not honoring power constraint on 1st association after |
| 1616 | * driver loading might occur. |
| 1617 | */ |
| 1618 | lim_update_rrm_capability(mac_ctx, sme_join_req); |
| 1619 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1620 | bss_desc = sme_join_req->bssDescription; |
| 1621 | /* check for the existence of start BSS session */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | session = pe_find_session_by_bssid(mac_ctx, bss_desc.bssId, |
| 1623 | &session_id); |
| 1624 | |
| 1625 | if (session != NULL) { |
| 1626 | lim_log(mac_ctx, LOGE, |
| 1627 | FL("Session(%d) Already exists for BSSID: " |
| 1628 | MAC_ADDRESS_STR " in limSmeState = %X"), |
| 1629 | session_id, |
| 1630 | MAC_ADDR_ARRAY(bss_desc.bssId), |
| 1631 | session->limSmeState); |
| 1632 | |
| 1633 | if (session->limSmeState == eLIM_SME_LINK_EST_STATE && |
| 1634 | session->smeSessionId == sme_join_req->sessionId) { |
| 1635 | /* |
| 1636 | * Received eWNI_SME_JOIN_REQ for same |
| 1637 | * BSS as currently associated. |
| 1638 | * Log the event and send success |
| 1639 | */ |
| 1640 | lim_log(mac_ctx, LOGW, |
| 1641 | FL("SessionId: %d"), session_id); |
| 1642 | lim_log(mac_ctx, LOGW, |
| 1643 | FL("JOIN_REQ for current joined BSS")); |
| 1644 | /* Send Join success response to host */ |
| 1645 | ret_code = eSIR_SME_ALREADY_JOINED_A_BSS; |
| 1646 | session = NULL; |
| 1647 | goto end; |
| 1648 | } else { |
| 1649 | lim_log(mac_ctx, LOGE, |
| 1650 | FL("JOIN_REQ not for current joined BSS")); |
| 1651 | ret_code = eSIR_SME_REFUSED; |
| 1652 | session = NULL; |
| 1653 | goto end; |
| 1654 | } |
| 1655 | } else { |
| 1656 | /* |
| 1657 | * Session Entry does not exist for given BSSId |
| 1658 | * Try to Create a new session |
| 1659 | */ |
| 1660 | session = pe_create_session(mac_ctx, bss_desc.bssId, |
| 1661 | &session_id, mac_ctx->lim.maxStation, |
| 1662 | eSIR_INFRASTRUCTURE_MODE); |
| 1663 | if (session == NULL) { |
| 1664 | lim_log(mac_ctx, LOGE, |
| 1665 | FL("Session Can not be created ")); |
| 1666 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 1667 | goto end; |
| 1668 | } else |
| 1669 | lim_log(mac_ctx, LOG1, |
| 1670 | FL("SessionId:%d New session created"), |
| 1671 | session_id); |
| 1672 | } |
| 1673 | session->isAmsduSupportInAMPDU = |
| 1674 | sme_join_req->isAmsduSupportInAMPDU; |
| 1675 | |
| 1676 | /* |
| 1677 | * Store Session related parameters |
| 1678 | * Store PE session Id in session Table |
| 1679 | */ |
| 1680 | session->peSessionId = session_id; |
| 1681 | |
| 1682 | /* store the smejoin req handle in session table */ |
| 1683 | session->pLimJoinReq = sme_join_req; |
| 1684 | |
| 1685 | /* Store SME session Id in sessionTable */ |
| 1686 | session->smeSessionId = sme_join_req->sessionId; |
| 1687 | |
| 1688 | /* Store SME transaction Id in session Table */ |
| 1689 | session->transactionId = sme_join_req->transactionId; |
| 1690 | |
| 1691 | /* Store beaconInterval */ |
| 1692 | session->beaconParams.beaconInterval = |
| 1693 | bss_desc.beaconInterval; |
| 1694 | |
| 1695 | cdf_mem_copy(&(session->htConfig), &(sme_join_req->htConfig), |
| 1696 | sizeof(session->htConfig)); |
| 1697 | |
| 1698 | /* Copying of bssId is already done, while creating session */ |
| 1699 | sir_copy_mac_addr(session->selfMacAddr, |
| 1700 | sme_join_req->selfMacAddr); |
| 1701 | session->bssType = sme_join_req->bsstype; |
| 1702 | |
| 1703 | session->statypeForBss = STA_ENTRY_PEER; |
| 1704 | session->limWmeEnabled = sme_join_req->isWMEenabled; |
| 1705 | session->limQosEnabled = sme_join_req->isQosEnabled; |
| 1706 | |
| 1707 | /* Store vendor specfic IE for CISCO AP */ |
| 1708 | ie_len = (bss_desc.length + sizeof(bss_desc.length) - |
| 1709 | GET_FIELD_OFFSET(tSirBssDescription, ieFields)); |
| 1710 | |
| 1711 | vendor_ie = cfg_get_vendor_ie_ptr_from_oui(mac_ctx, |
| 1712 | SIR_MAC_CISCO_OUI, SIR_MAC_CISCO_OUI_SIZE, |
| 1713 | ((uint8_t *)&bss_desc.ieFields), ie_len); |
| 1714 | |
| 1715 | if (NULL != vendor_ie) { |
Srinivas Girigowda | f2599dd | 2015-11-16 18:20:46 -0800 | [diff] [blame] | 1716 | lim_log(mac_ctx, LOG1, FL("Cisco vendor OUI present")); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1717 | session->isCiscoVendorAP = true; |
| 1718 | } else { |
| 1719 | session->isCiscoVendorAP = false; |
| 1720 | } |
| 1721 | |
| 1722 | /* Copy the dot 11 mode in to the session table */ |
| 1723 | |
| 1724 | session->dot11mode = sme_join_req->dot11mode; |
| 1725 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 1726 | session->cc_switch_mode = sme_join_req->cc_switch_mode; |
| 1727 | #endif |
| 1728 | session->nwType = bss_desc.nwType; |
| 1729 | session->enableAmpduPs = sme_join_req->enableAmpduPs; |
| 1730 | session->enableHtSmps = sme_join_req->enableHtSmps; |
| 1731 | session->htSmpsvalue = sme_join_req->htSmps; |
| 1732 | |
| 1733 | /*Store Persona */ |
| 1734 | session->pePersona = sme_join_req->staPersona; |
| 1735 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 1736 | FL("PE PERSONA=%d cbMode %u"), |
| 1737 | session->pePersona, sme_join_req->cbMode); |
| 1738 | if (mac_ctx->roam.configParam.enable2x2) |
| 1739 | session->nss = 2; |
| 1740 | else |
| 1741 | session->nss = 1; |
| 1742 | #ifdef WLAN_FEATURE_11AC |
| 1743 | session->vhtCapability = |
| 1744 | IS_DOT11_MODE_VHT(session->dot11mode); |
| 1745 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO_MED, |
| 1746 | "***__lim_process_sme_join_req: vhtCapability=%d****", |
| 1747 | session->vhtCapability); |
| 1748 | if (session->vhtCapability) { |
| 1749 | if (session->pePersona == CDF_STA_MODE) { |
| 1750 | session->txBFIniFeatureEnabled = |
| 1751 | sme_join_req->txBFIniFeatureEnabled; |
| 1752 | } else { |
| 1753 | session->txBFIniFeatureEnabled = 0; |
| 1754 | } |
| 1755 | session->txMuBformee = sme_join_req->txMuBformee; |
| 1756 | session->enableVhtpAid = |
| 1757 | sme_join_req->enableVhtpAid; |
| 1758 | session->enableVhtGid = |
| 1759 | sme_join_req->enableVhtGid; |
| 1760 | |
| 1761 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO_MED, |
| 1762 | FL("***txBFIniFeatureEnabled=%d***"), |
| 1763 | session->txBFIniFeatureEnabled); |
| 1764 | if (wlan_cfg_get_int(mac_ctx, |
| 1765 | WNI_CFG_VHT_SU_BEAMFORMER_CAP, &val) != |
| 1766 | eSIR_SUCCESS) |
| 1767 | lim_log(mac_ctx, LOGE, FL( |
| 1768 | "cfg get vht su bformer failed")); |
| 1769 | |
| 1770 | session->enable_su_tx_bformer = val; |
| 1771 | lim_log(mac_ctx, LOGE, FL("vht su tx bformer %d"), val); |
| 1772 | } |
| 1773 | if (session->vhtCapability && session->txBFIniFeatureEnabled) { |
| 1774 | if (cfg_set_int(mac_ctx, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, |
| 1775 | session->txBFIniFeatureEnabled) != |
| 1776 | eSIR_SUCCESS) { |
| 1777 | /* |
| 1778 | * Set failed for |
| 1779 | * CFG_VHT_SU_BEAMFORMEE_CAP |
| 1780 | */ |
| 1781 | lim_log(mac_ctx, LOGP, |
| 1782 | FL("Failed CFG_VHT_SU_BEAMFORMEE_CAP")); |
| 1783 | ret_code = eSIR_LOGP_EXCEPTION; |
| 1784 | goto end; |
| 1785 | } |
| 1786 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO_MED, |
| 1787 | "%s: txBFCsnValue=%d", __func__, |
| 1788 | sme_join_req->txBFCsnValue); |
| 1789 | if (cfg_set_int(mac_ctx, |
| 1790 | WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, |
| 1791 | sme_join_req->txBFCsnValue) != eSIR_SUCCESS) { |
| 1792 | /* |
| 1793 | * Set Failed for CFG |
| 1794 | * CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED |
| 1795 | */ |
| 1796 | lim_log(mac_ctx, LOGP, FL("Set Fail CFG")); |
| 1797 | ret_code = eSIR_LOGP_EXCEPTION; |
| 1798 | goto end; |
| 1799 | } |
| 1800 | } |
| 1801 | #endif |
| 1802 | |
| 1803 | /*Phy mode */ |
| 1804 | session->gLimPhyMode = bss_desc.nwType; |
| 1805 | handle_ht_capabilityand_ht_info(mac_ctx, session); |
| 1806 | /* Copy The channel Id to the session Table */ |
| 1807 | session->currentOperChannel = bss_desc.channelId; |
| 1808 | /* cbMode is already merged value of peer and self - |
| 1809 | * done by csr in csr_get_cb_mode_from_ies */ |
| 1810 | session->htSupportedChannelWidthSet = |
| 1811 | (sme_join_req->cbMode) ? 1 : 0; |
| 1812 | session->htRecommendedTxWidthSet = |
| 1813 | session->htSupportedChannelWidthSet; |
| 1814 | session->htSecondaryChannelOffset = sme_join_req->cbMode; |
| 1815 | |
| 1816 | if (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == sme_join_req->cbMode) { |
| 1817 | session->ch_center_freq_seg0 = |
| 1818 | session->currentOperChannel - 2; |
| 1819 | session->ch_width = CH_WIDTH_40MHZ; |
| 1820 | } else if (PHY_DOUBLE_CHANNEL_LOW_PRIMARY == |
| 1821 | sme_join_req->cbMode) { |
| 1822 | session->ch_center_freq_seg0 = |
| 1823 | session->currentOperChannel + 2; |
| 1824 | session->ch_width = CH_WIDTH_40MHZ; |
| 1825 | } else { |
| 1826 | session->ch_center_freq_seg0 = 0; |
| 1827 | session->ch_width = CH_WIDTH_20MHZ; |
| 1828 | } |
| 1829 | |
| 1830 | /* Record if management frames need to be protected */ |
| 1831 | #ifdef WLAN_FEATURE_11W |
| 1832 | if (eSIR_ED_AES_128_CMAC == sme_join_req->MgmtEncryptionType) { |
| 1833 | CDF_STATUS cdf_status; |
| 1834 | session->limRmfEnabled = 1; |
| 1835 | session->pmfComebackTimerInfo.pMac = mac_ctx; |
| 1836 | session->pmfComebackTimerInfo.sessionID = |
| 1837 | session_id; |
| 1838 | cdf_status = cdf_mc_timer_init( |
| 1839 | &session->pmfComebackTimer, |
| 1840 | CDF_TIMER_TYPE_SW, |
| 1841 | lim_pmf_comeback_timer_callback, |
| 1842 | (void *)&session->pmfComebackTimerInfo); |
| 1843 | if (CDF_STATUS_SUCCESS != cdf_status) { |
| 1844 | lim_log(mac_ctx, LOGP, |
| 1845 | FL("cannot init pmf comeback timer.")); |
| 1846 | ret_code = eSIR_LOGP_EXCEPTION; |
| 1847 | goto end; |
| 1848 | } |
| 1849 | } else { |
| 1850 | session->limRmfEnabled = 0; |
| 1851 | } |
| 1852 | #endif |
| 1853 | |
| 1854 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 1855 | session->rssi = bss_desc.rssi; |
| 1856 | #endif |
| 1857 | |
| 1858 | /* Copy the SSID from smejoinreq to session entry */ |
| 1859 | session->ssId.length = sme_join_req->ssId.length; |
| 1860 | cdf_mem_copy(session->ssId.ssId, sme_join_req->ssId.ssId, |
| 1861 | session->ssId.length); |
| 1862 | |
| 1863 | /* |
| 1864 | * Determin 11r or ESE connection based on input from SME |
| 1865 | * which inturn is dependent on the profile the user wants |
| 1866 | * to connect to, So input is coming from supplicant |
| 1867 | */ |
| 1868 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1869 | session->is11Rconnection = sme_join_req->is11Rconnection; |
| 1870 | #endif |
| 1871 | #ifdef FEATURE_WLAN_ESE |
| 1872 | session->isESEconnection = sme_join_req->isESEconnection; |
| 1873 | #endif |
| 1874 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
| 1875 | session->isFastTransitionEnabled = |
| 1876 | sme_join_req->isFastTransitionEnabled; |
| 1877 | #endif |
| 1878 | |
| 1879 | #ifdef FEATURE_WLAN_LFR |
| 1880 | session->isFastRoamIniFeatureEnabled = |
| 1881 | sme_join_req->isFastRoamIniFeatureEnabled; |
| 1882 | #endif |
| 1883 | session->txLdpcIniFeatureEnabled = |
| 1884 | sme_join_req->txLdpcIniFeatureEnabled; |
| 1885 | |
| 1886 | if (session->bssType == eSIR_INFRASTRUCTURE_MODE) { |
| 1887 | session->limSystemRole = eLIM_STA_ROLE; |
| 1888 | } else if (session->bssType == eSIR_BTAMP_AP_MODE) { |
| 1889 | session->limSystemRole = eLIM_BT_AMP_STA_ROLE; |
| 1890 | } else { |
| 1891 | /* |
| 1892 | * Throw an error and return and make |
| 1893 | * sure to delete the session. |
| 1894 | */ |
| 1895 | lim_log(mac_ctx, LOGE, |
| 1896 | FL("recvd JOIN_REQ with invalid bss type %d"), |
| 1897 | session->bssType); |
| 1898 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 1899 | goto end; |
| 1900 | } |
| 1901 | |
| 1902 | if (sme_join_req->addIEScan.length) |
| 1903 | cdf_mem_copy(&session->pLimJoinReq->addIEScan, |
| 1904 | &sme_join_req->addIEScan, sizeof(tSirAddie)); |
| 1905 | |
| 1906 | if (sme_join_req->addIEAssoc.length) |
| 1907 | cdf_mem_copy(&session->pLimJoinReq->addIEAssoc, |
| 1908 | &sme_join_req->addIEAssoc, sizeof(tSirAddie)); |
| 1909 | |
| 1910 | val = sizeof(tLimMlmJoinReq) + |
| 1911 | session->pLimJoinReq->bssDescription.length + 2; |
| 1912 | mlm_join_req = cdf_mem_malloc(val); |
| 1913 | if (NULL == mlm_join_req) { |
| 1914 | lim_log(mac_ctx, LOGP, |
| 1915 | FL("AllocateMemory failed for mlmJoinReq")); |
| 1916 | return; |
| 1917 | } |
| 1918 | (void)cdf_mem_set((void *)mlm_join_req, val, 0); |
| 1919 | |
| 1920 | /* PE SessionId is stored as a part of JoinReq */ |
| 1921 | mlm_join_req->sessionId = session->peSessionId; |
| 1922 | |
| 1923 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_JOIN_FAILURE_TIMEOUT, |
| 1924 | (uint32_t *) &mlm_join_req->joinFailureTimeout) != |
| 1925 | eSIR_SUCCESS) { |
| 1926 | lim_log(mac_ctx, LOGP, |
| 1927 | FL("couldn't retrieve JoinFailureTimer value" |
| 1928 | " setting to default value")); |
| 1929 | mlm_join_req->joinFailureTimeout = |
| 1930 | WNI_CFG_JOIN_FAILURE_TIMEOUT_STADEF; |
| 1931 | } |
| 1932 | |
| 1933 | /* copy operational rate from session */ |
| 1934 | cdf_mem_copy((void *)&session->rateSet, |
| 1935 | (void *)&sme_join_req->operationalRateSet, |
| 1936 | sizeof(tSirMacRateSet)); |
| 1937 | cdf_mem_copy((void *)&session->extRateSet, |
| 1938 | (void *)&sme_join_req->extendedRateSet, |
| 1939 | sizeof(tSirMacRateSet)); |
| 1940 | /* |
| 1941 | * this may not be needed anymore now, as rateSet is now |
| 1942 | * included in the session entry and MLM has session context. |
| 1943 | */ |
| 1944 | cdf_mem_copy((void *)&mlm_join_req->operationalRateSet, |
| 1945 | (void *)&session->rateSet, |
| 1946 | sizeof(tSirMacRateSet)); |
| 1947 | |
| 1948 | session->encryptType = sme_join_req->UCEncryptionType; |
| 1949 | |
| 1950 | mlm_join_req->bssDescription.length = |
| 1951 | session->pLimJoinReq->bssDescription.length; |
| 1952 | |
| 1953 | cdf_mem_copy((uint8_t *) &mlm_join_req->bssDescription.bssId, |
| 1954 | (uint8_t *) |
| 1955 | &session->pLimJoinReq->bssDescription.bssId, |
| 1956 | session->pLimJoinReq->bssDescription.length + 2); |
| 1957 | |
| 1958 | session->limCurrentBssCaps = |
| 1959 | session->pLimJoinReq->bssDescription.capabilityInfo; |
| 1960 | |
| 1961 | reg_max = cfg_get_regulatory_max_transmit_power(mac_ctx, |
| 1962 | session->currentOperChannel); |
| 1963 | local_power_constraint = reg_max; |
| 1964 | |
| 1965 | lim_extract_ap_capability(mac_ctx, |
| 1966 | (uint8_t *) |
| 1967 | session->pLimJoinReq->bssDescription.ieFields, |
| 1968 | lim_get_ielen_from_bss_description( |
| 1969 | &session->pLimJoinReq->bssDescription), |
| 1970 | &session->limCurrentBssQosCaps, |
| 1971 | &session->limCurrentBssPropCap, |
| 1972 | &session->gLimCurrentBssUapsd, |
| 1973 | &local_power_constraint, session); |
| 1974 | |
| 1975 | #ifdef FEATURE_WLAN_ESE |
| 1976 | session->maxTxPower = lim_get_max_tx_power(reg_max, |
| 1977 | local_power_constraint, |
| 1978 | mac_ctx->roam.configParam.nTxPowerCap); |
| 1979 | #else |
| 1980 | session->maxTxPower = |
| 1981 | CDF_MIN(reg_max, (local_power_constraint)); |
| 1982 | #endif |
| 1983 | #if defined WLAN_VOWIFI_DEBUG |
| 1984 | lim_log(mac_ctx, LOGE, |
| 1985 | "Regulatory max = %d, local power constraint = %d" |
| 1986 | reg_max, local_power_constraint); |
| 1987 | lim_log(mac_ctx, LOGE, FL(" max tx = %d"), |
| 1988 | session->maxTxPower); |
| 1989 | #endif |
| 1990 | |
| 1991 | if (session->gLimCurrentBssUapsd) { |
| 1992 | session->gUapsdPerAcBitmask = |
| 1993 | session->pLimJoinReq->uapsdPerAcBitmask; |
| 1994 | lim_log(mac_ctx, LOG1, |
| 1995 | FL("UAPSD flag for all AC - 0x%2x"), |
| 1996 | session->gUapsdPerAcBitmask); |
| 1997 | |
| 1998 | /* resetting the dynamic uapsd mask */ |
| 1999 | session->gUapsdPerAcDeliveryEnableMask = 0; |
| 2000 | session->gUapsdPerAcTriggerEnableMask = 0; |
| 2001 | } |
| 2002 | |
| 2003 | session->limRFBand = |
| 2004 | lim_get_rf_band(session->currentOperChannel); |
| 2005 | |
| 2006 | /* Initialize 11h Enable Flag */ |
| 2007 | if (SIR_BAND_5_GHZ == session->limRFBand) { |
| 2008 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_11H_ENABLED, |
| 2009 | &val) != eSIR_SUCCESS) { |
| 2010 | lim_log(mac_ctx, LOGP, |
| 2011 | FL("Fail to get WNI_CFG_11H_ENABLED ")); |
| 2012 | session->lim11hEnable = |
| 2013 | WNI_CFG_11H_ENABLED_STADEF; |
| 2014 | } else { |
| 2015 | session->lim11hEnable = val; |
| 2016 | } |
| 2017 | } else { |
| 2018 | session->lim11hEnable = 0; |
| 2019 | } |
| 2020 | |
| 2021 | /* |
| 2022 | * To care of the scenario when STA transitions from |
| 2023 | * IBSS to Infrastructure mode. |
| 2024 | */ |
| 2025 | mac_ctx->lim.gLimIbssCoalescingHappened = false; |
| 2026 | |
| 2027 | session->limPrevSmeState = session->limSmeState; |
| 2028 | session->limSmeState = eLIM_SME_WT_JOIN_STATE; |
| 2029 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 2030 | session->peSessionId, |
| 2031 | session->limSmeState)); |
| 2032 | |
| 2033 | lim_log(mac_ctx, LOG1, |
| 2034 | FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s Channel %d, BSSID " MAC_ADDRESS_STR), |
| 2035 | mlm_join_req->sessionId, session->ssId.length, |
| 2036 | session->ssId.ssId, session->currentOperChannel, |
| 2037 | MAC_ADDR_ARRAY(session->bssId)); |
| 2038 | |
| 2039 | /* Indicate whether spectrum management is enabled */ |
| 2040 | session->spectrumMgtEnabled = |
| 2041 | sme_join_req->spectrumMgtIndicator; |
| 2042 | |
| 2043 | /* Enable the spectrum management if this is a DFS channel */ |
| 2044 | if (session->country_info_present && |
| 2045 | lim_isconnected_on_dfs_channel( |
| 2046 | session->currentOperChannel)) |
| 2047 | session->spectrumMgtEnabled = true; |
| 2048 | |
| 2049 | session->isOSENConnection = sme_join_req->isOSENConnection; |
| 2050 | |
| 2051 | lim_log(mac_ctx, LOG1, |
| 2052 | FL("SessionId:%d MLM_JOIN_REQ is posted to MLM SM"), |
| 2053 | mlm_join_req->sessionId); |
| 2054 | /* Issue LIM_MLM_JOIN_REQ to MLM */ |
| 2055 | lim_post_mlm_message(mac_ctx, LIM_MLM_JOIN_REQ, |
| 2056 | (uint32_t *) mlm_join_req); |
| 2057 | return; |
| 2058 | |
| 2059 | } else { |
| 2060 | /* Received eWNI_SME_JOIN_REQ un expected state */ |
| 2061 | lim_log(mac_ctx, LOGE, |
| 2062 | FL("received unexpected SME_JOIN_REQ in state %X"), |
| 2063 | mac_ctx->lim.gLimSmeState); |
| 2064 | lim_print_sme_state(mac_ctx, LOGE, mac_ctx->lim.gLimSmeState); |
| 2065 | ret_code = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2066 | session = NULL; |
| 2067 | goto end; |
| 2068 | } |
| 2069 | |
| 2070 | end: |
| 2071 | sme_session_id = sme_join_req->sessionId; |
| 2072 | sme_transaction_id = sme_join_req->transactionId; |
| 2073 | |
| 2074 | if (sme_join_req) { |
| 2075 | cdf_mem_free(sme_join_req); |
| 2076 | sme_join_req = NULL; |
| 2077 | if (NULL != session) |
| 2078 | session->pLimJoinReq = NULL; |
| 2079 | } |
| 2080 | if (ret_code != eSIR_SME_SUCCESS) { |
| 2081 | if (NULL != session) { |
| 2082 | pe_delete_session(mac_ctx, session); |
| 2083 | session = NULL; |
| 2084 | } |
| 2085 | } |
| 2086 | lim_log(mac_ctx, LOG1, |
| 2087 | FL("Send failure status on sessionid: %d with ret_code = %d"), |
| 2088 | sme_session_id, ret_code); |
| 2089 | lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_JOIN_RSP, ret_code, |
| 2090 | eSIR_MAC_UNSPEC_FAILURE_STATUS, session, sme_session_id, |
| 2091 | sme_transaction_id); |
| 2092 | } |
| 2093 | |
| 2094 | #if defined FEATURE_WLAN_ESE || defined WLAN_FEATURE_VOWIFI |
| 2095 | uint8_t lim_get_max_tx_power(tPowerdBm regMax, tPowerdBm apTxPower, |
| 2096 | uint8_t iniTxPower) |
| 2097 | { |
| 2098 | uint8_t maxTxPower = 0; |
| 2099 | uint8_t txPower = CDF_MIN(regMax, (apTxPower)); |
| 2100 | txPower = CDF_MIN(txPower, iniTxPower); |
| 2101 | if ((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP)) |
| 2102 | maxTxPower = txPower; |
| 2103 | else if (txPower < MIN_TX_PWR_CAP) |
| 2104 | maxTxPower = MIN_TX_PWR_CAP; |
| 2105 | else |
| 2106 | maxTxPower = MAX_TX_PWR_CAP; |
| 2107 | |
| 2108 | return maxTxPower; |
| 2109 | } |
| 2110 | #endif |
| 2111 | |
| 2112 | /** |
| 2113 | * __lim_process_sme_reassoc_req() - process reassoc req |
| 2114 | * |
| 2115 | * @mac_ctx: Pointer to Global MAC structure |
| 2116 | * @msg_buf: pointer to the SME message buffer |
| 2117 | * |
| 2118 | * This function is called to process SME_REASSOC_REQ message |
| 2119 | * from HDD or upper layer application. |
| 2120 | * |
| 2121 | * Return: None |
| 2122 | */ |
| 2123 | |
| 2124 | static void __lim_process_sme_reassoc_req(tpAniSirGlobal mac_ctx, |
| 2125 | uint32_t *msg_buf) |
| 2126 | { |
| 2127 | uint16_t caps; |
| 2128 | uint32_t val; |
| 2129 | tpSirSmeJoinReq reassoc_req = NULL; |
| 2130 | tLimMlmReassocReq *mlm_reassoc_req; |
| 2131 | tSirResultCodes ret_code = eSIR_SME_SUCCESS; |
| 2132 | tpPESession session_entry = NULL; |
| 2133 | uint8_t session_id; |
| 2134 | uint8_t sme_session_id; |
| 2135 | uint16_t transaction_id; |
| 2136 | tPowerdBm local_pwr_constraint = 0, reg_max = 0; |
| 2137 | uint32_t tele_bcn_en = 0; |
| 2138 | uint16_t size; |
| 2139 | |
| 2140 | lim_log(mac_ctx, LOG3, FL("Received REASSOC_REQ")); |
| 2141 | |
| 2142 | size = __lim_get_sme_join_req_size_for_alloc((uint8_t *)msg_buf); |
| 2143 | reassoc_req = cdf_mem_malloc(size); |
| 2144 | if (NULL == reassoc_req) { |
| 2145 | lim_log(mac_ctx, LOGP, |
| 2146 | FL("call to AllocateMemory failed for reassoc_req")); |
| 2147 | |
| 2148 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2149 | goto end; |
| 2150 | } |
| 2151 | (void)cdf_mem_set((void *)reassoc_req, size, 0); |
| 2152 | (void)cdf_mem_copy((void *)reassoc_req, (void *)msg_buf, size); |
| 2153 | |
| 2154 | if (!lim_is_sme_join_req_valid(mac_ctx, |
| 2155 | (tpSirSmeJoinReq)reassoc_req)) { |
| 2156 | /* |
| 2157 | * Received invalid eWNI_SME_REASSOC_REQ |
| 2158 | */ |
| 2159 | lim_log(mac_ctx, LOGW, |
| 2160 | FL("received SME_REASSOC_REQ with invalid data")); |
| 2161 | |
| 2162 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 2163 | goto end; |
| 2164 | } |
| 2165 | |
| 2166 | session_entry = pe_find_session_by_bssid(mac_ctx, |
| 2167 | reassoc_req->bssDescription.bssId, |
| 2168 | &session_id); |
| 2169 | if (session_entry == NULL) { |
| 2170 | lim_print_mac_addr(mac_ctx, reassoc_req->bssDescription.bssId, |
| 2171 | LOGE); |
| 2172 | lim_log(mac_ctx, LOGE, |
| 2173 | FL("Session does not exist for given bssId")); |
| 2174 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 2175 | goto end; |
| 2176 | } |
| 2177 | #ifdef FEATURE_WLAN_DIAG_SUPPORT /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2178 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_REASSOC_REQ_EVENT, |
| 2179 | session_entry, eSIR_SUCCESS, eSIR_SUCCESS); |
| 2180 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2181 | /* mac_ctx->lim.gpLimReassocReq = reassoc_req;//TO SUPPORT BT-AMP */ |
| 2182 | |
| 2183 | /* Store the reassoc handle in the session Table */ |
| 2184 | session_entry->pLimReAssocReq = reassoc_req; |
| 2185 | |
| 2186 | session_entry->dot11mode = reassoc_req->dot11mode; |
| 2187 | session_entry->vhtCapability = |
| 2188 | IS_DOT11_MODE_VHT(reassoc_req->dot11mode); |
| 2189 | /* |
| 2190 | * Reassociate request is expected |
| 2191 | * in link established state only. |
| 2192 | */ |
| 2193 | |
| 2194 | if (session_entry->limSmeState != eLIM_SME_LINK_EST_STATE) { |
| 2195 | #if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || \ |
| 2196 | defined(FEATURE_WLAN_LFR) |
| 2197 | if (session_entry->limSmeState == eLIM_SME_WT_REASSOC_STATE) { |
| 2198 | /* |
| 2199 | * May be from 11r FT pre-auth. So lets check it |
| 2200 | * before we bail out |
| 2201 | */ |
| 2202 | lim_log(mac_ctx, LOG1, FL( |
| 2203 | "Session in reassoc state is %d"), |
| 2204 | session_entry->peSessionId); |
| 2205 | |
| 2206 | /* Make sure its our preauth bssid */ |
| 2207 | if (!cdf_mem_compare(reassoc_req->bssDescription.bssId, |
| 2208 | session_entry->limReAssocbssId, |
| 2209 | 6)) { |
| 2210 | lim_print_mac_addr(mac_ctx, |
| 2211 | reassoc_req->bssDescription. |
| 2212 | bssId, LOGE); |
| 2213 | lim_log(mac_ctx, LOGP, |
| 2214 | FL("Unknown bssId in reassoc state")); |
| 2215 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 2216 | goto end; |
| 2217 | } |
| 2218 | |
| 2219 | lim_process_mlm_ft_reassoc_req(mac_ctx, msg_buf, |
| 2220 | session_entry); |
| 2221 | return; |
| 2222 | } |
| 2223 | #endif |
| 2224 | /* |
| 2225 | * Should not have received eWNI_SME_REASSOC_REQ |
| 2226 | */ |
| 2227 | lim_log(mac_ctx, LOGE, |
| 2228 | FL("received unexpected SME_REASSOC_REQ in state %X"), |
| 2229 | session_entry->limSmeState); |
| 2230 | lim_print_sme_state(mac_ctx, LOGE, session_entry->limSmeState); |
| 2231 | |
| 2232 | ret_code = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2233 | goto end; |
| 2234 | } |
| 2235 | |
| 2236 | cdf_mem_copy(session_entry->limReAssocbssId, |
| 2237 | session_entry->pLimReAssocReq->bssDescription.bssId, |
| 2238 | sizeof(tSirMacAddr)); |
| 2239 | |
| 2240 | session_entry->limReassocChannelId = |
| 2241 | session_entry->pLimReAssocReq->bssDescription.channelId; |
| 2242 | |
| 2243 | session_entry->reAssocHtSupportedChannelWidthSet = |
| 2244 | (session_entry->pLimReAssocReq->cbMode) ? 1 : 0; |
| 2245 | session_entry->reAssocHtRecommendedTxWidthSet = |
| 2246 | session_entry->reAssocHtSupportedChannelWidthSet; |
| 2247 | session_entry->reAssocHtSecondaryChannelOffset = |
| 2248 | session_entry->pLimReAssocReq->cbMode; |
| 2249 | |
| 2250 | session_entry->limReassocBssCaps = |
| 2251 | session_entry->pLimReAssocReq->bssDescription.capabilityInfo; |
| 2252 | reg_max = cfg_get_regulatory_max_transmit_power(mac_ctx, |
| 2253 | session_entry->currentOperChannel); |
| 2254 | local_pwr_constraint = reg_max; |
| 2255 | |
| 2256 | lim_extract_ap_capability(mac_ctx, |
| 2257 | (uint8_t *)session_entry->pLimReAssocReq->bssDescription.ieFields, |
| 2258 | lim_get_ielen_from_bss_description( |
| 2259 | &session_entry->pLimReAssocReq->bssDescription), |
| 2260 | &session_entry->limReassocBssQosCaps, |
| 2261 | &session_entry->limReassocBssPropCap, |
| 2262 | &session_entry->gLimCurrentBssUapsd, |
| 2263 | &local_pwr_constraint, session_entry); |
| 2264 | session_entry->maxTxPower = CDF_MIN(reg_max, (local_pwr_constraint)); |
| 2265 | #if defined WLAN_VOWIFI_DEBUG |
| 2266 | lim_log(mac_ctx, LOGE, |
| 2267 | "Regulatory max = %d, local pwr constraint = %d, max tx = %d", |
| 2268 | reg_max, local_pwr_constraint, |
| 2269 | session_entry->maxTxPower); |
| 2270 | #endif |
| 2271 | /* Copy the SSID from session entry to local variable */ |
| 2272 | session_entry->limReassocSSID.length = reassoc_req->ssId.length; |
| 2273 | cdf_mem_copy(session_entry->limReassocSSID.ssId, |
| 2274 | reassoc_req->ssId.ssId, |
| 2275 | session_entry->limReassocSSID.length); |
| 2276 | if (session_entry->gLimCurrentBssUapsd) { |
| 2277 | session_entry->gUapsdPerAcBitmask = |
| 2278 | session_entry->pLimReAssocReq->uapsdPerAcBitmask; |
| 2279 | lim_log(mac_ctx, LOG1, |
| 2280 | FL("UAPSD flag for all AC - 0x%2x"), |
| 2281 | session_entry->gUapsdPerAcBitmask); |
| 2282 | } |
| 2283 | |
| 2284 | mlm_reassoc_req = cdf_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 2285 | if (NULL == mlm_reassoc_req) { |
| 2286 | lim_log(mac_ctx, LOGP, |
| 2287 | FL("call to AllocateMemory failed for mlmReassocReq")); |
| 2288 | |
| 2289 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2290 | goto end; |
| 2291 | } |
| 2292 | |
| 2293 | cdf_mem_copy(mlm_reassoc_req->peerMacAddr, |
| 2294 | session_entry->limReAssocbssId, sizeof(tSirMacAddr)); |
| 2295 | |
| 2296 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT, |
| 2297 | (uint32_t *)&mlm_reassoc_req->reassocFailureTimeout) != |
| 2298 | eSIR_SUCCESS) { |
| 2299 | /* |
| 2300 | * Could not get ReassocFailureTimeout value |
| 2301 | * from CFG. Log error. |
| 2302 | */ |
| 2303 | lim_log(mac_ctx, LOGP, |
| 2304 | FL("could not retrieve ReassocFailureTimeout value")); |
| 2305 | } |
| 2306 | |
| 2307 | if (cfg_get_capability_info(mac_ctx, &caps, session_entry) != |
| 2308 | eSIR_SUCCESS) { |
| 2309 | /* |
| 2310 | * Could not get Capabilities value |
| 2311 | * from CFG. Log error. |
| 2312 | */ |
| 2313 | lim_log(mac_ctx, LOGP, FL( |
| 2314 | "could not retrieve Capabilities value")); |
| 2315 | } |
| 2316 | mlm_reassoc_req->capabilityInfo = caps; |
| 2317 | |
| 2318 | /* Update PE session_id */ |
| 2319 | mlm_reassoc_req->sessionId = session_id; |
| 2320 | |
| 2321 | /* |
| 2322 | * If telescopic beaconing is enabled, set listen interval to |
| 2323 | * WNI_CFG_TELE_BCN_MAX_LI |
| 2324 | */ |
| 2325 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_TELE_BCN_WAKEUP_EN, |
| 2326 | &tele_bcn_en) != eSIR_SUCCESS) |
| 2327 | lim_log(mac_ctx, LOGP, |
| 2328 | FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN")); |
| 2329 | |
| 2330 | val = WNI_CFG_LISTEN_INTERVAL_STADEF; |
| 2331 | |
| 2332 | if (tele_bcn_en) { |
| 2333 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_TELE_BCN_MAX_LI, &val) != |
| 2334 | eSIR_SUCCESS) |
| 2335 | /* |
| 2336 | * Could not get ListenInterval value |
| 2337 | * from CFG. Log error. |
| 2338 | */ |
| 2339 | lim_log(mac_ctx, LOGP, |
| 2340 | FL("could not retrieve ListenInterval")); |
| 2341 | } else { |
| 2342 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_LISTEN_INTERVAL, &val) != |
| 2343 | eSIR_SUCCESS) |
| 2344 | /* |
| 2345 | * Could not get ListenInterval value |
| 2346 | * from CFG. Log error. |
| 2347 | */ |
| 2348 | lim_log(mac_ctx, LOGP, |
| 2349 | FL("could not retrieve ListenInterval")); |
| 2350 | } |
| 2351 | |
| 2352 | mlm_reassoc_req->listenInterval = (uint16_t) val; |
| 2353 | |
| 2354 | /* Indicate whether spectrum management is enabled */ |
| 2355 | session_entry->spectrumMgtEnabled = reassoc_req->spectrumMgtIndicator; |
| 2356 | |
| 2357 | /* Enable the spectrum management if this is a DFS channel */ |
| 2358 | if (session_entry->country_info_present && |
| 2359 | lim_isconnected_on_dfs_channel( |
| 2360 | session_entry->currentOperChannel)) |
| 2361 | session_entry->spectrumMgtEnabled = true; |
| 2362 | |
| 2363 | session_entry->limPrevSmeState = session_entry->limSmeState; |
| 2364 | session_entry->limSmeState = eLIM_SME_WT_REASSOC_STATE; |
| 2365 | |
| 2366 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 2367 | session_entry->peSessionId, |
| 2368 | session_entry->limSmeState)); |
| 2369 | |
| 2370 | lim_post_mlm_message(mac_ctx, |
| 2371 | LIM_MLM_REASSOC_REQ, (uint32_t *)mlm_reassoc_req); |
| 2372 | return; |
| 2373 | end: |
| 2374 | if (reassoc_req) { |
| 2375 | cdf_mem_free(reassoc_req); |
| 2376 | if (session_entry) |
| 2377 | session_entry->pLimReAssocReq = NULL; |
| 2378 | } |
| 2379 | |
| 2380 | if (session_entry) { |
| 2381 | /* |
| 2382 | * error occurred after we determined the session so extract |
| 2383 | * session and transaction info from there |
| 2384 | */ |
| 2385 | sme_session_id = session_entry->smeSessionId; |
| 2386 | transaction_id = session_entry->transactionId; |
| 2387 | } else |
| 2388 | /* |
| 2389 | * error occurred before or during the time we determined |
| 2390 | * the session so extract the session and transaction info |
| 2391 | * from the message |
| 2392 | */ |
| 2393 | lim_get_session_info(mac_ctx, (uint8_t *) msg_buf, |
| 2394 | &sme_session_id, &transaction_id); |
| 2395 | |
| 2396 | /* |
| 2397 | * Send Reassoc failure response to host |
| 2398 | * (note session_entry may be NULL, but that's OK) |
| 2399 | */ |
| 2400 | lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_REASSOC_RSP, |
| 2401 | ret_code, eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 2402 | session_entry, sme_session_id, |
| 2403 | transaction_id); |
| 2404 | } |
| 2405 | |
| 2406 | bool send_disassoc_frame = 1; |
| 2407 | /** |
| 2408 | * __lim_process_sme_disassoc_req() |
| 2409 | * |
| 2410 | ***FUNCTION: |
| 2411 | * This function is called to process SME_DISASSOC_REQ message |
| 2412 | * from HDD or upper layer application. |
| 2413 | * |
| 2414 | ***LOGIC: |
| 2415 | * |
| 2416 | ***ASSUMPTIONS: |
| 2417 | * |
| 2418 | ***NOTE: |
| 2419 | * |
| 2420 | * @param pMac Pointer to Global MAC structure |
| 2421 | * @param *pMsgBuf A pointer to the SME message buffer |
| 2422 | * @return None |
| 2423 | */ |
| 2424 | |
| 2425 | static void __lim_process_sme_disassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 2426 | { |
| 2427 | uint16_t disassocTrigger, reasonCode; |
| 2428 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 2429 | tSirResultCodes retCode = eSIR_SME_SUCCESS; |
| 2430 | tSirSmeDisassocReq smeDisassocReq; |
| 2431 | tpPESession psessionEntry = NULL; |
| 2432 | uint8_t sessionId; |
| 2433 | uint8_t smesessionId; |
| 2434 | uint16_t smetransactionId; |
| 2435 | |
| 2436 | if (pMsgBuf == NULL) { |
| 2437 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 2438 | return; |
| 2439 | } |
| 2440 | |
| 2441 | cdf_mem_copy(&smeDisassocReq, pMsgBuf, sizeof(tSirSmeDisassocReq)); |
| 2442 | smesessionId = smeDisassocReq.sessionId; |
| 2443 | smetransactionId = smeDisassocReq.transactionId; |
| 2444 | if (!lim_is_sme_disassoc_req_valid(pMac, |
| 2445 | &smeDisassocReq, |
| 2446 | psessionEntry)) { |
| 2447 | PELOGE(lim_log(pMac, LOGE, |
| 2448 | FL("received invalid SME_DISASSOC_REQ message"));) |
| 2449 | if (pMac->lim.gLimRspReqd) { |
| 2450 | pMac->lim.gLimRspReqd = false; |
| 2451 | |
| 2452 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2453 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2454 | goto sendDisassoc; |
| 2455 | } |
| 2456 | |
| 2457 | return; |
| 2458 | } |
| 2459 | |
| 2460 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 2461 | smeDisassocReq.bssId, |
| 2462 | &sessionId); |
| 2463 | if (psessionEntry == NULL) { |
| 2464 | lim_log(pMac, LOGE, |
| 2465 | FL("session does not exist for given bssId " |
| 2466 | MAC_ADDRESS_STR), |
| 2467 | MAC_ADDR_ARRAY(smeDisassocReq.bssId)); |
| 2468 | retCode = eSIR_SME_INVALID_PARAMETERS; |
| 2469 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2470 | goto sendDisassoc; |
| 2471 | } |
| 2472 | lim_log(pMac, LOG1, |
| 2473 | FL("received DISASSOC_REQ message on sessionid %d Systemrole %d Reason: %u SmeState: %d from: " |
| 2474 | MAC_ADDRESS_STR), smesessionId, |
| 2475 | GET_LIM_SYSTEM_ROLE(psessionEntry), smeDisassocReq.reasonCode, |
| 2476 | pMac->lim.gLimSmeState, |
| 2477 | MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr)); |
| 2478 | |
| 2479 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2480 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, |
| 2481 | 0, smeDisassocReq.reasonCode); |
| 2482 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2483 | |
| 2484 | /* Update SME session Id and SME transaction ID */ |
| 2485 | |
| 2486 | psessionEntry->smeSessionId = smesessionId; |
| 2487 | psessionEntry->transactionId = smetransactionId; |
| 2488 | |
| 2489 | switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) { |
| 2490 | case eLIM_STA_ROLE: |
| 2491 | case eLIM_BT_AMP_STA_ROLE: |
| 2492 | switch (psessionEntry->limSmeState) { |
| 2493 | case eLIM_SME_ASSOCIATED_STATE: |
| 2494 | case eLIM_SME_LINK_EST_STATE: |
| 2495 | psessionEntry->limPrevSmeState = |
| 2496 | psessionEntry->limSmeState; |
| 2497 | psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE; |
| 2498 | #ifdef FEATURE_WLAN_TDLS |
| 2499 | /* Delete all TDLS peers connected before leaving BSS */ |
| 2500 | lim_delete_tdls_peers(pMac, psessionEntry); |
| 2501 | #endif |
| 2502 | MTRACE(mac_trace |
| 2503 | (pMac, TRACE_CODE_SME_STATE, |
| 2504 | psessionEntry->peSessionId, |
| 2505 | psessionEntry->limSmeState)); |
| 2506 | lim_log(pMac, LOG1, |
| 2507 | FL("Rcvd SME_DISASSOC_REQ while in limSmeState: %d "), |
| 2508 | psessionEntry->limSmeState); |
| 2509 | break; |
| 2510 | |
| 2511 | case eLIM_SME_WT_DEAUTH_STATE: |
| 2512 | /* PE shall still process the DISASSOC_REQ and proceed with |
| 2513 | * link tear down even if it had already sent a DEAUTH_IND to |
| 2514 | * to SME. pMac->lim.gLimPrevSmeState shall remain the same as |
| 2515 | * its been set when PE entered WT_DEAUTH_STATE. |
| 2516 | */ |
| 2517 | psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE; |
| 2518 | MTRACE(mac_trace |
| 2519 | (pMac, TRACE_CODE_SME_STATE, |
| 2520 | psessionEntry->peSessionId, |
| 2521 | psessionEntry->limSmeState)); |
| 2522 | lim_log(pMac, LOG1, |
| 2523 | FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. ")); |
| 2524 | break; |
| 2525 | |
| 2526 | case eLIM_SME_WT_DISASSOC_STATE: |
| 2527 | /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it |
| 2528 | * received DISASSOC_REQ. Which means host is also trying to disconnect. |
| 2529 | * PE can continue processing DISASSOC_REQ and send the response instead |
| 2530 | * of failing the request. SME will anyway ignore DEAUTH_IND that was sent |
| 2531 | * for disassoc frame. |
| 2532 | * |
| 2533 | * It will send a disassoc, which is ok. However, we can use the global flag |
| 2534 | * sendDisassoc to not send disassoc frame. |
| 2535 | */ |
| 2536 | lim_log(pMac, LOG1, |
| 2537 | FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DISASSOC_STATE. ")); |
| 2538 | break; |
| 2539 | |
| 2540 | case eLIM_SME_JOIN_FAILURE_STATE: { |
| 2541 | /* Already in Disconnected State, return success */ |
| 2542 | lim_log(pMac, LOG1, |
| 2543 | FL("Rcvd SME_DISASSOC_REQ while in eLIM_SME_JOIN_FAILURE_STATE. ")); |
| 2544 | if (pMac->lim.gLimRspReqd) { |
| 2545 | retCode = eSIR_SME_SUCCESS; |
| 2546 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2547 | goto sendDisassoc; |
| 2548 | } |
| 2549 | } |
| 2550 | break; |
| 2551 | default: |
| 2552 | /** |
| 2553 | * STA is not currently associated. |
| 2554 | * Log error and send response to host |
| 2555 | */ |
| 2556 | lim_log(pMac, LOGE, |
| 2557 | FL("received unexpected SME_DISASSOC_REQ in state %X"), |
| 2558 | psessionEntry->limSmeState); |
| 2559 | lim_print_sme_state(pMac, LOGE, |
| 2560 | psessionEntry->limSmeState); |
| 2561 | |
| 2562 | if (pMac->lim.gLimRspReqd) { |
| 2563 | if (psessionEntry->limSmeState != |
| 2564 | eLIM_SME_WT_ASSOC_STATE) |
| 2565 | pMac->lim.gLimRspReqd = false; |
| 2566 | |
| 2567 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2568 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2569 | goto sendDisassoc; |
| 2570 | } |
| 2571 | |
| 2572 | return; |
| 2573 | } |
| 2574 | |
| 2575 | break; |
| 2576 | |
| 2577 | case eLIM_AP_ROLE: |
| 2578 | case eLIM_BT_AMP_AP_ROLE: |
| 2579 | /* Fall through */ |
| 2580 | break; |
| 2581 | |
| 2582 | case eLIM_STA_IN_IBSS_ROLE: |
| 2583 | default: |
| 2584 | /* eLIM_UNKNOWN_ROLE */ |
| 2585 | lim_log(pMac, LOGE, |
| 2586 | FL("received unexpected SME_DISASSOC_REQ for role %d"), |
| 2587 | GET_LIM_SYSTEM_ROLE(psessionEntry)); |
| 2588 | |
| 2589 | retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE; |
| 2590 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2591 | goto sendDisassoc; |
| 2592 | } /* end switch (pMac->lim.gLimSystemRole) */ |
| 2593 | |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 2594 | disassocTrigger = eLIM_HOST_DISASSOC; |
| 2595 | reasonCode = smeDisassocReq.reasonCode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2596 | |
| 2597 | if (smeDisassocReq.doNotSendOverTheAir) { |
| 2598 | lim_log(pMac, LOG1, FL("do not send dissoc over the air")); |
| 2599 | send_disassoc_frame = 0; |
| 2600 | } |
| 2601 | /* Trigger Disassociation frame to peer MAC entity */ |
| 2602 | lim_log(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger" |
| 2603 | " : %d, reasonCode : %d"), |
| 2604 | disassocTrigger, reasonCode); |
| 2605 | |
| 2606 | pMlmDisassocReq = cdf_mem_malloc(sizeof(tLimMlmDisassocReq)); |
| 2607 | if (NULL == pMlmDisassocReq) { |
| 2608 | /* Log error */ |
| 2609 | lim_log(pMac, LOGP, |
| 2610 | FL("call to AllocateMemory failed for mlmDisassocReq")); |
| 2611 | |
| 2612 | return; |
| 2613 | } |
| 2614 | |
| 2615 | cdf_mem_copy((uint8_t *) &pMlmDisassocReq->peerMacAddr, |
| 2616 | (uint8_t *) &smeDisassocReq.peerMacAddr, |
| 2617 | sizeof(tSirMacAddr)); |
| 2618 | |
| 2619 | pMlmDisassocReq->reasonCode = reasonCode; |
| 2620 | pMlmDisassocReq->disassocTrigger = disassocTrigger; |
| 2621 | |
| 2622 | /* Update PE session ID */ |
| 2623 | pMlmDisassocReq->sessionId = sessionId; |
| 2624 | |
| 2625 | lim_post_mlm_message(pMac, |
| 2626 | LIM_MLM_DISASSOC_REQ, (uint32_t *) pMlmDisassocReq); |
| 2627 | return; |
| 2628 | |
| 2629 | sendDisassoc: |
| 2630 | if (psessionEntry) |
| 2631 | lim_send_sme_disassoc_ntf(pMac, smeDisassocReq.peerMacAddr, |
| 2632 | retCode, |
| 2633 | disassocTrigger, |
| 2634 | 1, smesessionId, smetransactionId, |
| 2635 | psessionEntry); |
| 2636 | else |
| 2637 | lim_send_sme_disassoc_ntf(pMac, smeDisassocReq.peerMacAddr, |
| 2638 | retCode, |
| 2639 | disassocTrigger, |
| 2640 | 1, smesessionId, smetransactionId, NULL); |
| 2641 | |
| 2642 | } /*** end __lim_process_sme_disassoc_req() ***/ |
| 2643 | |
| 2644 | /** ----------------------------------------------------------------- |
| 2645 | \brief __lim_process_sme_disassoc_cnf() - Process SME_DISASSOC_CNF |
| 2646 | |
| 2647 | This function is called to process SME_DISASSOC_CNF message |
| 2648 | from HDD or upper layer application. |
| 2649 | |
| 2650 | \param pMac - global mac structure |
| 2651 | \param pStaDs - station dph hash node |
| 2652 | \return none |
| 2653 | \sa |
| 2654 | ----------------------------------------------------------------- */ |
| 2655 | static void __lim_process_sme_disassoc_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 2656 | { |
| 2657 | tSirSmeDisassocCnf smeDisassocCnf; |
| 2658 | uint16_t aid; |
| 2659 | tpDphHashNode pStaDs; |
| 2660 | tpPESession psessionEntry; |
| 2661 | uint8_t sessionId; |
| 2662 | |
| 2663 | PELOG1(lim_log(pMac, LOG1, FL("received DISASSOC_CNF message"));) |
| 2664 | |
| 2665 | cdf_mem_copy(&smeDisassocCnf, pMsgBuf, |
| 2666 | sizeof(struct sSirSmeDisassocCnf)); |
| 2667 | |
| 2668 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 2669 | smeDisassocCnf.bssId, |
| 2670 | &sessionId); |
| 2671 | if (psessionEntry == NULL) { |
| 2672 | lim_log(pMac, LOGE, |
| 2673 | FL("session does not exist for given bssId")); |
| 2674 | return; |
| 2675 | } |
| 2676 | |
| 2677 | if (!lim_is_sme_disassoc_cnf_valid(pMac, &smeDisassocCnf, psessionEntry)) { |
| 2678 | lim_log(pMac, LOGE, |
| 2679 | FL("received invalid SME_DISASSOC_CNF message")); |
| 2680 | return; |
| 2681 | } |
| 2682 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2683 | if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF) |
| 2684 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, |
| 2685 | psessionEntry, |
| 2686 | (uint16_t) smeDisassocCnf.statusCode, 0); |
| 2687 | else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF) |
| 2688 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, |
| 2689 | psessionEntry, |
| 2690 | (uint16_t) smeDisassocCnf.statusCode, 0); |
| 2691 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2692 | |
| 2693 | switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) { |
| 2694 | case eLIM_STA_ROLE: |
| 2695 | case eLIM_BT_AMP_STA_ROLE: /* To test reconn */ |
| 2696 | if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) && |
| 2697 | (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) |
| 2698 | && (psessionEntry->limSmeState != |
| 2699 | eLIM_SME_WT_DEAUTH_STATE)) { |
| 2700 | lim_log(pMac, LOGE, |
| 2701 | FL |
| 2702 | ("received unexp SME_DISASSOC_CNF in state %X"), |
| 2703 | psessionEntry->limSmeState); |
| 2704 | lim_print_sme_state(pMac, LOGE, |
| 2705 | psessionEntry->limSmeState); |
| 2706 | return; |
| 2707 | } |
| 2708 | break; |
| 2709 | |
| 2710 | case eLIM_AP_ROLE: |
| 2711 | /* Fall through */ |
| 2712 | break; |
| 2713 | |
| 2714 | case eLIM_STA_IN_IBSS_ROLE: |
| 2715 | default: /* eLIM_UNKNOWN_ROLE */ |
| 2716 | lim_log(pMac, LOGE, |
| 2717 | FL("received unexpected SME_DISASSOC_CNF role %d"), |
| 2718 | GET_LIM_SYSTEM_ROLE(psessionEntry)); |
| 2719 | |
| 2720 | return; |
| 2721 | } |
| 2722 | |
| 2723 | if ((psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) || |
| 2724 | (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE) || |
| 2725 | LIM_IS_AP_ROLE(psessionEntry)) { |
| 2726 | pStaDs = dph_lookup_hash_entry(pMac, |
| 2727 | smeDisassocCnf.peerMacAddr, &aid, |
| 2728 | &psessionEntry->dph.dphHashTable); |
| 2729 | if (pStaDs == NULL) { |
| 2730 | lim_log(pMac, LOGE, |
| 2731 | FL("DISASSOC_CNF for a STA with no context, addr= " |
| 2732 | MAC_ADDRESS_STR), |
| 2733 | MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr)); |
| 2734 | return; |
| 2735 | } |
Masti, Narayanraddi | 21bde25 | 2015-10-09 19:39:47 +0530 | [diff] [blame] | 2736 | |
| 2737 | if ((pStaDs->mlmStaContext.mlmState == |
| 2738 | eLIM_MLM_WT_DEL_STA_RSP_STATE) || |
| 2739 | (pStaDs->mlmStaContext.mlmState == |
| 2740 | eLIM_MLM_WT_DEL_STA_RSP_STATE)) { |
| 2741 | lim_log(pMac, LOGE, |
| 2742 | FL("No need of cleanup for addr:" MAC_ADDRESS_STR "as MLM state is %d"), |
| 2743 | MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr), |
| 2744 | pStaDs->mlmStaContext.mlmState); |
| 2745 | return; |
| 2746 | } |
| 2747 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2748 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2749 | /* Delete FT session if there exists one */ |
| 2750 | lim_ft_cleanup_pre_auth_info(pMac, psessionEntry); |
| 2751 | #endif |
| 2752 | lim_cleanup_rx_path(pMac, pStaDs, psessionEntry); |
| 2753 | |
| 2754 | lim_clean_up_disassoc_deauth_req(pMac, |
| 2755 | (char *)&smeDisassocCnf.peerMacAddr, |
| 2756 | 0); |
| 2757 | } |
| 2758 | |
| 2759 | return; |
| 2760 | } |
| 2761 | |
| 2762 | /** |
| 2763 | * __lim_process_sme_deauth_req() - process sme deauth req |
| 2764 | * @mac_ctx: Pointer to Global MAC structure |
| 2765 | * @msg_buf: pointer to the SME message buffer |
| 2766 | * |
| 2767 | * This function is called to process SME_DEAUTH_REQ message |
| 2768 | * from HDD or upper layer application. |
| 2769 | * |
| 2770 | * Return: None |
| 2771 | */ |
| 2772 | |
| 2773 | static void __lim_process_sme_deauth_req(tpAniSirGlobal mac_ctx, |
| 2774 | uint32_t *msg_buf) |
| 2775 | { |
| 2776 | uint16_t deauth_trigger, reason_code; |
| 2777 | tLimMlmDeauthReq *mlm_deauth_req; |
| 2778 | tSirSmeDeauthReq sme_deauth_req; |
| 2779 | tSirResultCodes ret_code = eSIR_SME_SUCCESS; |
| 2780 | tpPESession session_entry; |
| 2781 | uint8_t session_id; /* PE sessionId */ |
| 2782 | uint8_t sme_session_id; |
| 2783 | uint16_t sme_transaction_id; |
| 2784 | |
| 2785 | lim_log(mac_ctx, LOG1, FL("received DEAUTH_REQ message")); |
| 2786 | |
| 2787 | cdf_mem_copy(&sme_deauth_req, msg_buf, sizeof(tSirSmeDeauthReq)); |
| 2788 | sme_session_id = sme_deauth_req.sessionId; |
| 2789 | sme_transaction_id = sme_deauth_req.transactionId; |
| 2790 | |
| 2791 | /* |
| 2792 | * We need to get a session first but we don't even know |
| 2793 | * if the message is correct. |
| 2794 | */ |
| 2795 | session_entry = pe_find_session_by_bssid(mac_ctx, sme_deauth_req.bssId, |
| 2796 | &session_id); |
| 2797 | if (session_entry == NULL) { |
| 2798 | lim_log(mac_ctx, LOGE, |
| 2799 | FL("session does not exist for given bssId")); |
| 2800 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 2801 | deauth_trigger = eLIM_HOST_DEAUTH; |
| 2802 | goto send_deauth; |
| 2803 | } |
| 2804 | |
| 2805 | if (!lim_is_sme_deauth_req_valid(mac_ctx, &sme_deauth_req, |
| 2806 | session_entry)) { |
| 2807 | lim_log(mac_ctx, LOGE, |
| 2808 | FL("received invalid SME_DEAUTH_REQ message")); |
| 2809 | mac_ctx->lim.gLimRspReqd = false; |
| 2810 | |
| 2811 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 2812 | deauth_trigger = eLIM_HOST_DEAUTH; |
| 2813 | goto send_deauth; |
| 2814 | } |
| 2815 | lim_log(mac_ctx, LOG1, |
| 2816 | FL("received DEAUTH_REQ sessionid %d Systemrole %d reasoncode %u limSmestate %d from " |
| 2817 | MAC_ADDRESS_STR), sme_session_id, |
| 2818 | GET_LIM_SYSTEM_ROLE(session_entry), sme_deauth_req.reasonCode, |
| 2819 | session_entry->limSmeState, |
| 2820 | MAC_ADDR_ARRAY(sme_deauth_req.peerMacAddr)); |
| 2821 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2822 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, |
| 2823 | session_entry, 0, sme_deauth_req.reasonCode); |
| 2824 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 2825 | |
| 2826 | /* Update SME session ID and Transaction ID */ |
| 2827 | session_entry->smeSessionId = sme_session_id; |
| 2828 | session_entry->transactionId = sme_transaction_id; |
| 2829 | |
| 2830 | switch (GET_LIM_SYSTEM_ROLE(session_entry)) { |
| 2831 | case eLIM_STA_ROLE: |
| 2832 | case eLIM_BT_AMP_STA_ROLE: |
| 2833 | |
| 2834 | switch (session_entry->limSmeState) { |
| 2835 | case eLIM_SME_ASSOCIATED_STATE: |
| 2836 | case eLIM_SME_LINK_EST_STATE: |
| 2837 | case eLIM_SME_WT_ASSOC_STATE: |
| 2838 | case eLIM_SME_JOIN_FAILURE_STATE: |
| 2839 | case eLIM_SME_IDLE_STATE: |
| 2840 | session_entry->limPrevSmeState = |
| 2841 | session_entry->limSmeState; |
| 2842 | session_entry->limSmeState = eLIM_SME_WT_DEAUTH_STATE; |
| 2843 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE, |
| 2844 | session_entry->peSessionId, |
| 2845 | session_entry->limSmeState)); |
| 2846 | /* Send Deauthentication request to MLM below */ |
| 2847 | break; |
| 2848 | case eLIM_SME_WT_DEAUTH_STATE: |
| 2849 | case eLIM_SME_WT_DISASSOC_STATE: |
| 2850 | /* |
| 2851 | * PE Recieved a Deauth/Disassoc frame. Normally it get |
| 2852 | * DEAUTH_CNF/DISASSOC_CNF but it received DEAUTH_REQ. |
| 2853 | * Which means host is also trying to disconnect. |
| 2854 | * PE can continue processing DEAUTH_REQ and send |
| 2855 | * the response instead of failing the request. |
| 2856 | * SME will anyway ignore DEAUTH_IND/DISASSOC_IND that |
| 2857 | * was sent for deauth/disassoc frame. |
| 2858 | */ |
| 2859 | session_entry->limSmeState = eLIM_SME_WT_DEAUTH_STATE; |
| 2860 | lim_log(mac_ctx, LOG1, FL( |
| 2861 | "Rcvd SME_DEAUTH_REQ while in SME_WT_DEAUTH_STATE")); |
| 2862 | break; |
| 2863 | default: |
| 2864 | /* |
| 2865 | * STA is not in a state to deauthenticate with |
| 2866 | * peer. Log error and send response to host. |
| 2867 | */ |
| 2868 | lim_log(mac_ctx, LOGE, FL( |
| 2869 | "received unexp SME_DEAUTH_REQ in state %X"), |
| 2870 | session_entry->limSmeState); |
| 2871 | lim_print_sme_state(mac_ctx, LOGE, |
| 2872 | session_entry->limSmeState); |
| 2873 | |
| 2874 | if (mac_ctx->lim.gLimRspReqd) { |
| 2875 | mac_ctx->lim.gLimRspReqd = false; |
| 2876 | |
| 2877 | ret_code = eSIR_SME_STA_NOT_AUTHENTICATED; |
| 2878 | deauth_trigger = eLIM_HOST_DEAUTH; |
| 2879 | |
| 2880 | /* |
| 2881 | * here we received deauth request from AP so sme state |
| 2882 | * is eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED |
| 2883 | * delSta then mlm state should be |
| 2884 | * eLIM_MLM_WT_DEL_STA_RSP_STATE and ifwe got delBSS |
| 2885 | * rsp then mlm state should be eLIM_MLM_IDLE_STATE |
| 2886 | * so the below condition captures the state where |
| 2887 | * delSta not done and firmware still in |
| 2888 | * connected state. |
| 2889 | */ |
| 2890 | if (session_entry->limSmeState == |
| 2891 | eLIM_SME_WT_DEAUTH_STATE && |
| 2892 | session_entry->limMlmState != |
| 2893 | eLIM_MLM_IDLE_STATE && |
| 2894 | session_entry->limMlmState != |
| 2895 | eLIM_MLM_WT_DEL_STA_RSP_STATE) |
| 2896 | ret_code = eSIR_SME_DEAUTH_STATUS; |
| 2897 | goto send_deauth; |
| 2898 | } |
| 2899 | return; |
| 2900 | } |
| 2901 | break; |
| 2902 | |
| 2903 | case eLIM_STA_IN_IBSS_ROLE: |
| 2904 | lim_log(mac_ctx, LOGE, FL("Deauth not allowed in IBSS")); |
| 2905 | if (mac_ctx->lim.gLimRspReqd) { |
| 2906 | mac_ctx->lim.gLimRspReqd = false; |
| 2907 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 2908 | deauth_trigger = eLIM_HOST_DEAUTH; |
| 2909 | goto send_deauth; |
| 2910 | } |
| 2911 | return; |
| 2912 | case eLIM_AP_ROLE: |
| 2913 | break; |
| 2914 | default: |
| 2915 | lim_log(mac_ctx, LOGE, |
| 2916 | FL("received unexpected SME_DEAUTH_REQ for role %X"), |
| 2917 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 2918 | if (mac_ctx->lim.gLimRspReqd) { |
| 2919 | mac_ctx->lim.gLimRspReqd = false; |
| 2920 | ret_code = eSIR_SME_INVALID_PARAMETERS; |
| 2921 | deauth_trigger = eLIM_HOST_DEAUTH; |
| 2922 | goto send_deauth; |
| 2923 | } |
| 2924 | return; |
| 2925 | } /* end switch (mac_ctx->lim.gLimSystemRole) */ |
| 2926 | |
| 2927 | if (sme_deauth_req.reasonCode == eLIM_LINK_MONITORING_DEAUTH) { |
| 2928 | /* Deauthentication is triggered by Link Monitoring */ |
| 2929 | lim_log(mac_ctx, LOG1, FL("** Lost link with AP **")); |
| 2930 | deauth_trigger = eLIM_LINK_MONITORING_DEAUTH; |
| 2931 | reason_code = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2932 | } else { |
| 2933 | deauth_trigger = eLIM_HOST_DEAUTH; |
| 2934 | reason_code = sme_deauth_req.reasonCode; |
| 2935 | } |
| 2936 | |
| 2937 | /* Trigger Deauthentication frame to peer MAC entity */ |
| 2938 | mlm_deauth_req = cdf_mem_malloc(sizeof(tLimMlmDeauthReq)); |
| 2939 | if (NULL == mlm_deauth_req) { |
| 2940 | lim_log(mac_ctx, LOGP, |
| 2941 | FL("call to AllocateMemory failed for mlmDeauthReq")); |
| 2942 | if (mac_ctx->lim.gLimRspReqd) { |
| 2943 | mac_ctx->lim.gLimRspReqd = false; |
| 2944 | ret_code = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2945 | deauth_trigger = eLIM_HOST_DEAUTH; |
| 2946 | goto send_deauth; |
| 2947 | } |
| 2948 | return; |
| 2949 | } |
| 2950 | |
| 2951 | cdf_mem_copy((uint8_t *) &mlm_deauth_req->peerMacAddr, |
| 2952 | (uint8_t *) &sme_deauth_req.peerMacAddr, |
| 2953 | sizeof(tSirMacAddr)); |
| 2954 | |
| 2955 | mlm_deauth_req->reasonCode = reason_code; |
| 2956 | mlm_deauth_req->deauthTrigger = deauth_trigger; |
| 2957 | |
| 2958 | /* Update PE session Id */ |
| 2959 | mlm_deauth_req->sessionId = session_id; |
| 2960 | |
| 2961 | lim_post_mlm_message(mac_ctx, LIM_MLM_DEAUTH_REQ, |
| 2962 | (uint32_t *)mlm_deauth_req); |
| 2963 | return; |
| 2964 | |
| 2965 | send_deauth: |
| 2966 | lim_send_sme_deauth_ntf(mac_ctx, sme_deauth_req.peerMacAddr, ret_code, |
| 2967 | deauth_trigger, 1, sme_session_id, sme_transaction_id); |
| 2968 | } |
| 2969 | |
| 2970 | /** |
| 2971 | * __lim_process_sme_set_context_req() |
| 2972 | * |
| 2973 | * @mac_ctx: Pointer to Global MAC structure |
| 2974 | * @msg_buf: pointer to the SME message buffer |
| 2975 | * |
| 2976 | * This function is called to process SME_SETCONTEXT_REQ message |
| 2977 | * from HDD or upper layer application. |
| 2978 | * |
| 2979 | * Return: None |
| 2980 | */ |
| 2981 | |
| 2982 | static void |
| 2983 | __lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) |
| 2984 | { |
| 2985 | tpSirSmeSetContextReq set_context_req; |
| 2986 | tLimMlmSetKeysReq *mlm_set_key_req; |
| 2987 | tpPESession session_entry; |
| 2988 | uint8_t session_id; /* PE sessionID */ |
| 2989 | uint8_t sme_session_id; |
| 2990 | uint16_t sme_transaction_id; |
| 2991 | |
| 2992 | lim_log(mac_ctx, LOG1, FL("received SETCONTEXT_REQ message")); |
| 2993 | |
| 2994 | if (msg_buf == NULL) { |
| 2995 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 2996 | return; |
| 2997 | } |
| 2998 | |
| 2999 | set_context_req = cdf_mem_malloc(sizeof(struct sSirSmeSetContextReq)); |
| 3000 | if (NULL == set_context_req) { |
| 3001 | lim_log(mac_ctx, LOGP, FL( |
| 3002 | "call to AllocateMemory failed for set_context_req")); |
| 3003 | return; |
| 3004 | } |
| 3005 | cdf_mem_copy(set_context_req, msg_buf, |
| 3006 | sizeof(struct sSirSmeSetContextReq)); |
| 3007 | sme_session_id = set_context_req->sessionId; |
| 3008 | sme_transaction_id = set_context_req->transactionId; |
| 3009 | |
| 3010 | if ((!lim_is_sme_set_context_req_valid(mac_ctx, set_context_req))) { |
| 3011 | lim_log(mac_ctx, LOGW, |
| 3012 | FL("received invalid SME_SETCONTEXT_REQ message")); |
| 3013 | goto end; |
| 3014 | } |
| 3015 | |
| 3016 | if (set_context_req->keyMaterial.numKeys > |
| 3017 | SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) { |
| 3018 | lim_log(mac_ctx, LOGE, FL( |
| 3019 | "numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS"), |
| 3020 | set_context_req->keyMaterial.numKeys); |
| 3021 | lim_send_sme_set_context_rsp(mac_ctx, |
| 3022 | set_context_req->peerMacAddr, 1, |
| 3023 | eSIR_SME_INVALID_PARAMETERS, NULL, |
| 3024 | sme_session_id, sme_transaction_id); |
| 3025 | goto end; |
| 3026 | } |
| 3027 | |
| 3028 | session_entry = pe_find_session_by_bssid(mac_ctx, |
| 3029 | set_context_req->bssId, &session_id); |
| 3030 | if (session_entry == NULL) { |
| 3031 | lim_log(mac_ctx, LOGW, |
| 3032 | FL("Session does not exist for given BSSID")); |
| 3033 | lim_send_sme_set_context_rsp(mac_ctx, |
| 3034 | set_context_req->peerMacAddr, 1, |
| 3035 | eSIR_SME_INVALID_PARAMETERS, NULL, |
| 3036 | sme_session_id, sme_transaction_id); |
| 3037 | goto end; |
| 3038 | } |
| 3039 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3040 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, |
| 3041 | session_entry, 0, 0); |
| 3042 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3043 | |
| 3044 | if (((LIM_IS_STA_ROLE(session_entry) || |
| 3045 | LIM_IS_BT_AMP_STA_ROLE(session_entry)) && |
| 3046 | (session_entry->limSmeState == eLIM_SME_LINK_EST_STATE)) || |
| 3047 | ((LIM_IS_IBSS_ROLE(session_entry) || |
| 3048 | LIM_IS_AP_ROLE(session_entry) || |
| 3049 | LIM_IS_BT_AMP_AP_ROLE(session_entry)) && |
| 3050 | (session_entry->limSmeState == eLIM_SME_NORMAL_STATE))) { |
| 3051 | /* Trigger MLM_SETKEYS_REQ */ |
| 3052 | mlm_set_key_req = cdf_mem_malloc(sizeof(tLimMlmSetKeysReq)); |
| 3053 | if (NULL == mlm_set_key_req) { |
| 3054 | lim_log(mac_ctx, LOGP, FL( |
| 3055 | "mem alloc failed for mlmSetKeysReq")); |
| 3056 | goto end; |
| 3057 | } |
| 3058 | mlm_set_key_req->edType = set_context_req->keyMaterial.edType; |
| 3059 | mlm_set_key_req->numKeys = |
| 3060 | set_context_req->keyMaterial.numKeys; |
| 3061 | if (mlm_set_key_req->numKeys > |
| 3062 | SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) { |
| 3063 | lim_log(mac_ctx, LOGP, FL( |
| 3064 | "no.of keys exceeded max num of default keys limit")); |
| 3065 | goto end; |
| 3066 | } |
| 3067 | cdf_mem_copy((uint8_t *) &mlm_set_key_req->peerMacAddr, |
| 3068 | (uint8_t *) &set_context_req->peerMacAddr, |
| 3069 | sizeof(tSirMacAddr)); |
| 3070 | |
| 3071 | cdf_mem_copy((uint8_t *) &mlm_set_key_req->key, |
| 3072 | (uint8_t *) &set_context_req->keyMaterial.key, |
| 3073 | sizeof(tSirKeys) * |
| 3074 | (mlm_set_key_req->numKeys ? mlm_set_key_req-> |
| 3075 | numKeys : 1)); |
| 3076 | |
| 3077 | mlm_set_key_req->sessionId = session_id; |
| 3078 | mlm_set_key_req->smesessionId = sme_session_id; |
| 3079 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 3080 | lim_log(mac_ctx, LOG1, FL( |
| 3081 | "received SETCONTEXT_REQ message sessionId=%d"), |
| 3082 | mlm_set_key_req->sessionId); |
| 3083 | #endif |
| 3084 | |
| 3085 | if (((set_context_req->keyMaterial.edType == eSIR_ED_WEP40) || |
| 3086 | (set_context_req->keyMaterial.edType == eSIR_ED_WEP104)) && |
| 3087 | LIM_IS_AP_ROLE(session_entry)) { |
| 3088 | if (set_context_req->keyMaterial.key[0].keyLength) { |
| 3089 | uint8_t key_id; |
| 3090 | key_id = |
| 3091 | set_context_req->keyMaterial.key[0].keyId; |
| 3092 | cdf_mem_copy((uint8_t *) |
| 3093 | &session_entry->WEPKeyMaterial[key_id], |
| 3094 | (uint8_t *) &set_context_req->keyMaterial, |
| 3095 | sizeof(tSirKeyMaterial)); |
| 3096 | } else { |
| 3097 | uint32_t i; |
| 3098 | for (i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; |
| 3099 | i++) { |
| 3100 | cdf_mem_copy((uint8_t *) |
| 3101 | &mlm_set_key_req->key[i], |
| 3102 | (uint8_t *)session_entry->WEPKeyMaterial[i].key, |
| 3103 | sizeof(tSirKeys)); |
| 3104 | } |
| 3105 | } |
| 3106 | } |
| 3107 | lim_post_mlm_message(mac_ctx, LIM_MLM_SETKEYS_REQ, |
| 3108 | (uint32_t *) mlm_set_key_req); |
| 3109 | } else { |
| 3110 | lim_log(mac_ctx, LOGE, FL( |
| 3111 | "rcvd unexpected SME_SETCONTEXT_REQ for role %d, state=%X"), |
| 3112 | GET_LIM_SYSTEM_ROLE(session_entry), |
| 3113 | session_entry->limSmeState); |
| 3114 | lim_print_sme_state(mac_ctx, LOGE, session_entry->limSmeState); |
| 3115 | |
| 3116 | lim_send_sme_set_context_rsp(mac_ctx, |
| 3117 | set_context_req->peerMacAddr, 1, |
| 3118 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, |
| 3119 | session_entry, sme_session_id, |
| 3120 | sme_transaction_id); |
| 3121 | } |
| 3122 | end: |
| 3123 | cdf_mem_free(set_context_req); |
| 3124 | return; |
| 3125 | } |
| 3126 | |
| 3127 | /** |
| 3128 | * lim_process_sme_get_assoc_sta_info() - process sme assoc sta req |
| 3129 | * |
| 3130 | * @mac_ctx: Pointer to Global MAC structure |
| 3131 | * @msg_buf: pointer to the SME message buffer |
| 3132 | * |
| 3133 | * This function is called to process SME_GET_ASSOC_STAS_REQ message |
| 3134 | * from HDD or upper layer application. |
| 3135 | * |
| 3136 | * Return: None |
| 3137 | */ |
| 3138 | |
| 3139 | void lim_process_sme_get_assoc_sta_info(tpAniSirGlobal mac_ctx, |
| 3140 | uint32_t *msg_buf) |
| 3141 | { |
| 3142 | tSirSmeGetAssocSTAsReq get_assoc_stas_req; |
| 3143 | tpDphHashNode sta_ds = NULL; |
| 3144 | tpPESession session_entry = NULL; |
| 3145 | tSap_Event sap_event; |
| 3146 | tpWLAN_SAPEventCB sap_event_cb = NULL; |
| 3147 | tpSap_AssocMacAddr assoc_sta_tmp = NULL; |
| 3148 | uint8_t session_id = CSR_SESSION_ID_INVALID; |
| 3149 | uint8_t assoc_id = 0; |
| 3150 | uint8_t sta_cnt = 0; |
| 3151 | |
| 3152 | if (msg_buf == NULL) { |
| 3153 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 3154 | return; |
| 3155 | } |
| 3156 | |
| 3157 | cdf_mem_copy(&get_assoc_stas_req, msg_buf, |
| 3158 | sizeof(struct sSirSmeGetAssocSTAsReq)); |
| 3159 | /* |
| 3160 | * Get Associated stations from PE. |
| 3161 | * Find PE session Entry |
| 3162 | */ |
| 3163 | session_entry = pe_find_session_by_bssid(mac_ctx, |
| 3164 | get_assoc_stas_req.bssId, |
| 3165 | &session_id); |
| 3166 | if (session_entry == NULL) { |
| 3167 | lim_log(mac_ctx, LOGE, |
| 3168 | FL("session does not exist for given bssId")); |
| 3169 | goto lim_assoc_sta_end; |
| 3170 | } |
| 3171 | |
| 3172 | if (!LIM_IS_AP_ROLE(session_entry)) { |
| 3173 | lim_log(mac_ctx, LOGE, FL( |
| 3174 | "Received unexpected message in state %X, in role %X"), |
| 3175 | session_entry->limSmeState, |
| 3176 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 3177 | goto lim_assoc_sta_end; |
| 3178 | } |
| 3179 | /* Retrieve values obtained in the request message */ |
| 3180 | sap_event_cb = (tpWLAN_SAPEventCB)get_assoc_stas_req.pSapEventCallback; |
| 3181 | assoc_sta_tmp = (tpSap_AssocMacAddr)get_assoc_stas_req.pAssocStasArray; |
| 3182 | |
| 3183 | if (NULL == assoc_sta_tmp) |
| 3184 | goto lim_assoc_sta_end; |
| 3185 | for (assoc_id = 0; assoc_id < session_entry->dph.dphHashTable.size; |
| 3186 | assoc_id++) { |
| 3187 | sta_ds = dph_get_hash_entry(mac_ctx, assoc_id, |
| 3188 | &session_entry->dph.dphHashTable); |
| 3189 | if (NULL == sta_ds) |
| 3190 | continue; |
| 3191 | if (sta_ds->valid) { |
| 3192 | cdf_mem_copy((uint8_t *) &assoc_sta_tmp->staMac, |
| 3193 | (uint8_t *) &sta_ds->staAddr, |
| 3194 | CDF_MAC_ADDR_SIZE); |
| 3195 | assoc_sta_tmp->assocId = (uint8_t) sta_ds->assocId; |
| 3196 | assoc_sta_tmp->staId = (uint8_t) sta_ds->staIndex; |
| 3197 | |
| 3198 | cdf_mem_copy((uint8_t *)&assoc_sta_tmp->supportedRates, |
| 3199 | (uint8_t *)&sta_ds->supportedRates, |
| 3200 | sizeof(tSirSupportedRates)); |
| 3201 | assoc_sta_tmp->ShortGI40Mhz = sta_ds->htShortGI40Mhz; |
| 3202 | assoc_sta_tmp->ShortGI20Mhz = sta_ds->htShortGI20Mhz; |
| 3203 | assoc_sta_tmp->Support40Mhz = |
| 3204 | sta_ds->htDsssCckRate40MHzSupport; |
| 3205 | |
| 3206 | lim_log(mac_ctx, LOG1, FL("dph Station Number = %d"), |
| 3207 | sta_cnt + 1); |
| 3208 | lim_log(mac_ctx, LOG1, FL("MAC = " MAC_ADDRESS_STR), |
| 3209 | MAC_ADDR_ARRAY(sta_ds->staAddr)); |
| 3210 | lim_log(mac_ctx, LOG1, FL("Association Id = %d"), |
| 3211 | sta_ds->assocId); |
| 3212 | lim_log(mac_ctx, LOG1, FL("Station Index = %d"), |
| 3213 | sta_ds->staIndex); |
| 3214 | assoc_sta_tmp++; |
| 3215 | sta_cnt++; |
| 3216 | } |
| 3217 | } |
| 3218 | lim_assoc_sta_end: |
| 3219 | /* |
| 3220 | * Call hdd callback with sap event to send the list of |
| 3221 | * associated stations from PE |
| 3222 | */ |
| 3223 | if (sap_event_cb != NULL) { |
| 3224 | sap_event.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT; |
| 3225 | sap_event.sapevt.sapAssocStaListEvent.module = |
| 3226 | CDF_MODULE_ID_PE; |
| 3227 | sap_event.sapevt.sapAssocStaListEvent.noOfAssocSta = sta_cnt; |
| 3228 | sap_event.sapevt.sapAssocStaListEvent.pAssocStas = |
| 3229 | (tpSap_AssocMacAddr)get_assoc_stas_req.pAssocStasArray; |
| 3230 | sap_event_cb(&sap_event, get_assoc_stas_req.pUsrContext); |
| 3231 | } |
| 3232 | } |
| 3233 | |
| 3234 | /** |
| 3235 | * lim_process_sme_get_wpspbc_sessions - process sme get wpspbc req |
| 3236 | * |
| 3237 | * @mac_ctx: Pointer to Global MAC structure |
| 3238 | * @msg_buf: pointer to WPS PBC overlap query message |
| 3239 | * |
| 3240 | * This function parses get WPS PBC overlap information |
| 3241 | * message and call callback to pass WPS PBC overlap |
| 3242 | * information back to hdd. |
| 3243 | * |
| 3244 | * Return: None |
| 3245 | */ |
| 3246 | void lim_process_sme_get_wpspbc_sessions(tpAniSirGlobal mac_ctx, |
| 3247 | uint32_t *msg_buf) |
| 3248 | { |
| 3249 | tSirSmeGetWPSPBCSessionsReq get_wps_pbc_sessions_req; |
| 3250 | tpPESession session_entry = NULL; |
| 3251 | tSap_Event sap_event; |
| 3252 | tpWLAN_SAPEventCB sap_event_cb = NULL; |
| 3253 | uint8_t session_id = CSR_SESSION_ID_INVALID; |
| 3254 | tSirMacAddr zero_mac = { 0, 0, 0, 0, 0, 0 }; |
| 3255 | tSap_GetWPSPBCSessionEvent *sap_get_wpspbc_event; |
| 3256 | |
| 3257 | if (msg_buf == NULL) { |
| 3258 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 3259 | return; |
| 3260 | } |
| 3261 | |
| 3262 | sap_get_wpspbc_event = &sap_event.sapevt.sapGetWPSPBCSessionEvent; |
| 3263 | sap_get_wpspbc_event->status = CDF_STATUS_E_FAULT; |
| 3264 | |
| 3265 | cdf_mem_copy(&get_wps_pbc_sessions_req, msg_buf, |
| 3266 | sizeof(struct sSirSmeGetWPSPBCSessionsReq)); |
| 3267 | /* |
| 3268 | * Get Associated stations from PE |
| 3269 | * Find PE session Entry |
| 3270 | */ |
| 3271 | session_entry = pe_find_session_by_bssid(mac_ctx, |
| 3272 | get_wps_pbc_sessions_req.bssId, &session_id); |
| 3273 | if (session_entry == NULL) { |
| 3274 | lim_log(mac_ctx, LOGE, |
| 3275 | FL("session does not exist for given bssId")); |
| 3276 | goto lim_get_wpspbc_sessions_end; |
| 3277 | } |
| 3278 | |
| 3279 | if (!LIM_IS_AP_ROLE(session_entry)) { |
| 3280 | lim_log(mac_ctx, LOGE, |
| 3281 | FL("Received unexpected message in role %X"), |
| 3282 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 3283 | goto lim_get_wpspbc_sessions_end; |
| 3284 | } |
| 3285 | /* |
| 3286 | * Call hdd callback with sap event to send the |
| 3287 | * WPS PBC overlap information |
| 3288 | */ |
| 3289 | sap_event.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT; |
| 3290 | sap_get_wpspbc_event->module = CDF_MODULE_ID_PE; |
| 3291 | |
| 3292 | if (cdf_mem_compare(zero_mac, get_wps_pbc_sessions_req.pRemoveMac, |
| 3293 | sizeof(tSirMacAddr))) { |
| 3294 | lim_get_wpspbc_sessions(mac_ctx, |
| 3295 | sap_get_wpspbc_event->addr.bytes, |
| 3296 | sap_get_wpspbc_event->UUID_E, |
| 3297 | &sap_get_wpspbc_event->wpsPBCOverlap, |
| 3298 | session_entry); |
| 3299 | } else { |
| 3300 | lim_remove_pbc_sessions(mac_ctx, |
| 3301 | get_wps_pbc_sessions_req.pRemoveMac, |
| 3302 | session_entry); |
| 3303 | /* don't have to inform the HDD/Host */ |
| 3304 | return; |
| 3305 | } |
| 3306 | |
| 3307 | lim_log(mac_ctx, LOGE, FL("wpsPBCOverlap %d"), |
| 3308 | sap_get_wpspbc_event->wpsPBCOverlap); |
| 3309 | lim_print_mac_addr(mac_ctx, |
| 3310 | sap_get_wpspbc_event->addr.bytes, LOG4); |
| 3311 | |
| 3312 | sap_get_wpspbc_event->status = CDF_STATUS_SUCCESS; |
| 3313 | |
| 3314 | lim_get_wpspbc_sessions_end: |
| 3315 | sap_event_cb = |
| 3316 | (tpWLAN_SAPEventCB)get_wps_pbc_sessions_req.pSapEventCallback; |
| 3317 | if (NULL != sap_event_cb) |
| 3318 | sap_event_cb(&sap_event, get_wps_pbc_sessions_req.pUsrContext); |
| 3319 | } |
| 3320 | |
| 3321 | /** |
| 3322 | * __lim_counter_measures() |
| 3323 | * |
| 3324 | * FUNCTION: |
| 3325 | * This function is called to "implement" MIC counter measure |
| 3326 | * and is *temporary* only |
| 3327 | * |
| 3328 | * LOGIC: on AP, disassoc all STA associated thru TKIP, |
| 3329 | * we don't do the proper STA disassoc sequence since the |
| 3330 | * BSS will be stoped anyway |
| 3331 | * |
| 3332 | ***ASSUMPTIONS: |
| 3333 | * |
| 3334 | ***NOTE: |
| 3335 | * |
| 3336 | * @param pMac Pointer to Global MAC structure |
| 3337 | * @return None |
| 3338 | */ |
| 3339 | |
| 3340 | static void __lim_counter_measures(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 3341 | { |
| 3342 | tSirMacAddr mac = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
| 3343 | if (LIM_IS_AP_ROLE(psessionEntry) || |
| 3344 | LIM_IS_BT_AMP_AP_ROLE(psessionEntry) || |
| 3345 | LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) |
| 3346 | lim_send_disassoc_mgmt_frame(pMac, eSIR_MAC_MIC_FAILURE_REASON, |
| 3347 | mac, psessionEntry, false); |
| 3348 | }; |
| 3349 | |
| 3350 | void lim_process_tkip_counter_measures(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 3351 | { |
| 3352 | tSirSmeTkipCntrMeasReq tkipCntrMeasReq; |
| 3353 | tpPESession psessionEntry; |
| 3354 | uint8_t sessionId; /* PE sessionId */ |
| 3355 | |
| 3356 | cdf_mem_copy(&tkipCntrMeasReq, pMsgBuf, |
| 3357 | sizeof(struct sSirSmeTkipCntrMeasReq)); |
| 3358 | |
| 3359 | psessionEntry = pe_find_session_by_bssid(pMac, |
Srinivas Girigowda | c8b79e4 | 2015-09-24 15:57:40 -0700 | [diff] [blame] | 3360 | tkipCntrMeasReq.bssId.bytes, &sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | if (NULL == psessionEntry) { |
| 3362 | lim_log(pMac, LOGE, |
| 3363 | FL("session does not exist for given BSSID ")); |
| 3364 | return; |
| 3365 | } |
| 3366 | |
| 3367 | if (tkipCntrMeasReq.bEnable) |
| 3368 | __lim_counter_measures(pMac, psessionEntry); |
| 3369 | |
| 3370 | psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable; |
| 3371 | } |
| 3372 | |
| 3373 | static void |
| 3374 | __lim_handle_sme_stop_bss_request(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 3375 | { |
| 3376 | tSirSmeStopBssReq stopBssReq; |
| 3377 | tSirRetStatus status; |
| 3378 | tLimSmeStates prevState; |
| 3379 | tpPESession psessionEntry; |
| 3380 | uint8_t smesessionId; |
| 3381 | uint8_t sessionId; |
| 3382 | uint16_t smetransactionId; |
| 3383 | uint8_t i = 0; |
| 3384 | tpDphHashNode pStaDs = NULL; |
| 3385 | |
| 3386 | cdf_mem_copy(&stopBssReq, pMsgBuf, sizeof(tSirSmeStopBssReq)); |
| 3387 | smesessionId = stopBssReq.sessionId; |
| 3388 | smetransactionId = stopBssReq.transactionId; |
| 3389 | |
| 3390 | if (!lim_is_sme_stop_bss_req_valid(pMsgBuf)) { |
| 3391 | PELOGW(lim_log(pMac, LOGW, |
| 3392 | FL("received invalid SME_STOP_BSS_REQ message"));) |
| 3393 | /* Send Stop BSS response to host */ |
| 3394 | lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP, |
| 3395 | eSIR_SME_INVALID_PARAMETERS, smesessionId, |
| 3396 | smetransactionId); |
| 3397 | return; |
| 3398 | } |
| 3399 | |
| 3400 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 3401 | stopBssReq.bssId, |
| 3402 | &sessionId); |
| 3403 | if (psessionEntry == NULL) { |
| 3404 | lim_log(pMac, LOGW, |
| 3405 | FL("session does not exist for given BSSID ")); |
| 3406 | lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP, |
| 3407 | eSIR_SME_INVALID_PARAMETERS, smesessionId, |
| 3408 | smetransactionId); |
| 3409 | return; |
| 3410 | } |
| 3411 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3412 | lim_diag_event_report(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, |
| 3413 | 0, 0); |
| 3414 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3415 | |
| 3416 | if (psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE || /* Added For BT -AMP Support */ |
| 3417 | LIM_IS_STA_ROLE(psessionEntry)) { |
| 3418 | /** |
| 3419 | * Should not have received STOP_BSS_REQ in states |
| 3420 | * other than 'normal' state or on STA in Infrastructure |
| 3421 | * mode. Log error and return response to host. |
| 3422 | */ |
| 3423 | lim_log(pMac, LOGE, |
| 3424 | FL |
| 3425 | ("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"), |
| 3426 | psessionEntry->limSmeState, |
| 3427 | GET_LIM_SYSTEM_ROLE(psessionEntry)); |
| 3428 | lim_print_sme_state(pMac, LOGE, psessionEntry->limSmeState); |
| 3429 | /* / Send Stop BSS response to host */ |
| 3430 | lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP, |
| 3431 | eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, smesessionId, |
| 3432 | smetransactionId); |
| 3433 | return; |
| 3434 | } |
| 3435 | |
| 3436 | if (LIM_IS_AP_ROLE(psessionEntry)) |
| 3437 | lim_wpspbc_close(pMac, psessionEntry); |
| 3438 | |
| 3439 | lim_log(pMac, LOGW, |
| 3440 | FL("RECEIVED STOP_BSS_REQ with reason code=%d"), |
| 3441 | stopBssReq.reasonCode); |
| 3442 | |
| 3443 | prevState = psessionEntry->limSmeState; |
| 3444 | |
| 3445 | psessionEntry->limSmeState = eLIM_SME_IDLE_STATE; |
| 3446 | MTRACE(mac_trace |
| 3447 | (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, |
| 3448 | psessionEntry->limSmeState)); |
| 3449 | |
| 3450 | /* Update SME session Id and Transaction Id */ |
| 3451 | psessionEntry->smeSessionId = smesessionId; |
| 3452 | psessionEntry->transactionId = smetransactionId; |
| 3453 | |
| 3454 | /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */ |
| 3455 | if (!LIM_IS_IBSS_ROLE(psessionEntry) && |
| 3456 | !LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) { |
| 3457 | tSirMacAddr bcAddr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
| 3458 | if (stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES) |
| 3459 | /* Send disassoc all stations associated thru TKIP */ |
| 3460 | __lim_counter_measures(pMac, psessionEntry); |
| 3461 | else |
| 3462 | lim_send_disassoc_mgmt_frame(pMac, |
| 3463 | eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
| 3464 | bcAddr, psessionEntry, false); |
| 3465 | } |
| 3466 | |
| 3467 | /* Free the buffer allocated in START_BSS_REQ */ |
| 3468 | cdf_mem_free(psessionEntry->addIeParams.probeRespData_buff); |
| 3469 | psessionEntry->addIeParams.probeRespDataLen = 0; |
| 3470 | psessionEntry->addIeParams.probeRespData_buff = NULL; |
| 3471 | |
| 3472 | cdf_mem_free(psessionEntry->addIeParams.assocRespData_buff); |
| 3473 | psessionEntry->addIeParams.assocRespDataLen = 0; |
| 3474 | psessionEntry->addIeParams.assocRespData_buff = NULL; |
| 3475 | |
| 3476 | cdf_mem_free(psessionEntry->addIeParams.probeRespBCNData_buff); |
| 3477 | psessionEntry->addIeParams.probeRespBCNDataLen = 0; |
| 3478 | psessionEntry->addIeParams.probeRespBCNData_buff = NULL; |
| 3479 | |
| 3480 | /* lim_del_bss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg. */ |
| 3481 | pMac->lim.gLimIbssCoalescingHappened = false; |
| 3482 | |
| 3483 | for (i = 1; i < pMac->lim.gLimAssocStaLimit; i++) { |
| 3484 | pStaDs = |
| 3485 | dph_get_hash_entry(pMac, i, &psessionEntry->dph.dphHashTable); |
| 3486 | if (NULL == pStaDs) |
| 3487 | continue; |
| 3488 | status = lim_del_sta(pMac, pStaDs, false, psessionEntry); |
| 3489 | if (eSIR_SUCCESS == status) { |
| 3490 | lim_delete_dph_hash_entry(pMac, pStaDs->staAddr, |
| 3491 | pStaDs->assocId, psessionEntry); |
| 3492 | lim_release_peer_idx(pMac, pStaDs->assocId, psessionEntry); |
| 3493 | } else { |
| 3494 | lim_log(pMac, LOGE, |
| 3495 | FL("lim_del_sta failed with Status : %d"), status); |
| 3496 | CDF_ASSERT(0); |
| 3497 | } |
| 3498 | } |
| 3499 | /* send a delBss to HAL and wait for a response */ |
| 3500 | status = lim_del_bss(pMac, NULL, psessionEntry->bssIdx, psessionEntry); |
| 3501 | |
| 3502 | if (status != eSIR_SUCCESS) { |
| 3503 | PELOGE(lim_log |
| 3504 | (pMac, LOGE, FL("delBss failed for bss %d"), |
| 3505 | psessionEntry->bssIdx); |
| 3506 | ) |
| 3507 | psessionEntry->limSmeState = prevState; |
| 3508 | |
| 3509 | MTRACE(mac_trace |
| 3510 | (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, |
| 3511 | psessionEntry->limSmeState)); |
| 3512 | |
| 3513 | lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP, |
| 3514 | eSIR_SME_STOP_BSS_FAILURE, smesessionId, |
| 3515 | smetransactionId); |
| 3516 | } |
| 3517 | } |
| 3518 | |
| 3519 | /** |
| 3520 | * __lim_process_sme_stop_bss_req() - Process STOP_BSS from SME |
| 3521 | * @pMac: Global MAC context |
| 3522 | * @pMsg: Message from SME |
| 3523 | * |
| 3524 | * Wrapper for the function __lim_handle_sme_stop_bss_request |
| 3525 | * This message will be defered until softmac come out of |
| 3526 | * scan mode. Message should be handled even if we have |
| 3527 | * detected radar in the current operating channel. |
| 3528 | * |
| 3529 | * Return: true - If we consumed the buffer |
| 3530 | * false - If have defered the message. |
| 3531 | */ |
| 3532 | |
| 3533 | static bool __lim_process_sme_stop_bss_req(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 3534 | { |
| 3535 | if (__lim_is_defered_msg_for_learn(pMac, pMsg)) { |
| 3536 | /** |
| 3537 | * If message defered, buffer is not consumed yet. |
| 3538 | * So return false |
| 3539 | */ |
| 3540 | return false; |
| 3541 | } |
| 3542 | __lim_handle_sme_stop_bss_request(pMac, (uint32_t *) pMsg->bodyptr); |
| 3543 | return true; |
| 3544 | } /*** end __lim_process_sme_stop_bss_req() ***/ |
| 3545 | |
| 3546 | void lim_process_sme_del_bss_rsp(tpAniSirGlobal pMac, |
| 3547 | uint32_t body, tpPESession psessionEntry) |
| 3548 | { |
| 3549 | |
| 3550 | (void)body; |
| 3551 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 3552 | lim_ibss_delete(pMac, psessionEntry); |
| 3553 | dph_hash_table_class_init(pMac, &psessionEntry->dph.dphHashTable); |
| 3554 | lim_delete_pre_auth_list(pMac); |
| 3555 | lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS, |
| 3556 | psessionEntry->smeSessionId, |
| 3557 | psessionEntry->transactionId); |
| 3558 | return; |
| 3559 | } |
| 3560 | |
| 3561 | /** |
| 3562 | * __lim_process_sme_assoc_cnf_new() - process sme assoc/reassoc cnf |
| 3563 | * |
| 3564 | * @mac_ctx: pointer to mac context |
| 3565 | * @msg_type: message type |
| 3566 | * @msg_buf: pointer to the SME message buffer |
| 3567 | * |
| 3568 | * This function handles SME_ASSOC_CNF/SME_REASSOC_CNF |
| 3569 | * in BTAMP AP. |
| 3570 | * |
| 3571 | * Return: None |
| 3572 | */ |
| 3573 | |
| 3574 | void __lim_process_sme_assoc_cnf_new(tpAniSirGlobal mac_ctx, uint32_t msg_type, |
| 3575 | uint32_t *msg_buf) |
| 3576 | { |
| 3577 | tSirSmeAssocCnf assoc_cnf; |
| 3578 | tpDphHashNode sta_ds = NULL; |
| 3579 | tpPESession session_entry = NULL; |
| 3580 | uint8_t session_id; |
| 3581 | tpSirAssocReq assoc_req; |
| 3582 | |
| 3583 | if (msg_buf == NULL) { |
| 3584 | lim_log(mac_ctx, LOGE, FL("msg_buf is NULL ")); |
| 3585 | goto end; |
| 3586 | } |
| 3587 | |
| 3588 | cdf_mem_copy(&assoc_cnf, msg_buf, sizeof(struct sSirSmeAssocCnf)); |
| 3589 | if (!__lim_is_sme_assoc_cnf_valid(&assoc_cnf)) { |
| 3590 | lim_log(mac_ctx, LOGE, |
| 3591 | FL("Received invalid SME_RE(ASSOC)_CNF message ")); |
| 3592 | goto end; |
| 3593 | } |
| 3594 | |
| 3595 | session_entry = pe_find_session_by_bssid(mac_ctx, assoc_cnf.bssId, |
| 3596 | &session_id); |
| 3597 | if (session_entry == NULL) { |
| 3598 | lim_log(mac_ctx, LOGE, |
| 3599 | FL("session does not exist for given bssId")); |
| 3600 | goto end; |
| 3601 | } |
| 3602 | |
| 3603 | if ((!LIM_IS_AP_ROLE(session_entry) && |
| 3604 | !LIM_IS_BT_AMP_AP_ROLE(session_entry)) || |
| 3605 | ((session_entry->limSmeState != eLIM_SME_NORMAL_STATE) && |
| 3606 | (session_entry->limSmeState != |
| 3607 | eLIM_SME_NORMAL_CHANNEL_SCAN_STATE))) { |
| 3608 | lim_log(mac_ctx, LOGE, FL( |
| 3609 | "Rcvd unexpected msg %X in state %X, in role %X"), |
| 3610 | msg_type, session_entry->limSmeState, |
| 3611 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 3612 | goto end; |
| 3613 | } |
| 3614 | sta_ds = dph_get_hash_entry(mac_ctx, assoc_cnf.aid, |
| 3615 | &session_entry->dph.dphHashTable); |
| 3616 | if (sta_ds == NULL) { |
| 3617 | lim_log(mac_ctx, LOGE, FL( |
| 3618 | "Rcvd invalid msg %X due to no STA ctx, aid %d, peer "), |
| 3619 | msg_type, assoc_cnf.aid); |
| 3620 | lim_print_mac_addr(mac_ctx, assoc_cnf.peerMacAddr, LOG1); |
| 3621 | |
| 3622 | /* |
| 3623 | * send a DISASSOC_IND message to WSM to make sure |
| 3624 | * the state in WSM and LIM is the same |
| 3625 | */ |
| 3626 | lim_send_sme_disassoc_ntf(mac_ctx, assoc_cnf.peerMacAddr, |
| 3627 | eSIR_SME_STA_NOT_ASSOCIATED, |
| 3628 | eLIM_PEER_ENTITY_DISASSOC, assoc_cnf.aid, |
| 3629 | session_entry->smeSessionId, |
| 3630 | session_entry->transactionId, |
| 3631 | session_entry); |
| 3632 | goto end; |
| 3633 | } |
| 3634 | if (!cdf_mem_compare((uint8_t *)sta_ds->staAddr, |
| 3635 | (uint8_t *) assoc_cnf.peerMacAddr, |
| 3636 | sizeof(tSirMacAddr))) { |
| 3637 | lim_log(mac_ctx, LOG1, FL( |
| 3638 | "peerMacAddr mismatched for aid %d, peer "), |
| 3639 | assoc_cnf.aid); |
| 3640 | lim_print_mac_addr(mac_ctx, assoc_cnf.peerMacAddr, LOG1); |
| 3641 | goto end; |
| 3642 | } |
| 3643 | |
| 3644 | if ((sta_ds->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) || |
| 3645 | ((sta_ds->mlmStaContext.subType == LIM_ASSOC) && |
| 3646 | (msg_type != eWNI_SME_ASSOC_CNF)) || |
| 3647 | ((sta_ds->mlmStaContext.subType == LIM_REASSOC) && |
| 3648 | (msg_type != eWNI_SME_ASSOC_CNF))) { |
| 3649 | lim_log(mac_ctx, LOG1, FL( |
| 3650 | "not in MLM_WT_ASSOC_CNF_STATE, for aid %d, peer" |
| 3651 | "StaD mlmState : %d"), |
| 3652 | assoc_cnf.aid, sta_ds->mlmStaContext.mlmState); |
| 3653 | lim_print_mac_addr(mac_ctx, assoc_cnf.peerMacAddr, LOG1); |
| 3654 | goto end; |
| 3655 | } |
| 3656 | /* |
| 3657 | * Deactivate/delet CNF_WAIT timer since ASSOC_CNF |
| 3658 | * has been received |
| 3659 | */ |
| 3660 | lim_log(mac_ctx, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer")); |
| 3661 | lim_deactivate_and_change_per_sta_id_timer(mac_ctx, |
| 3662 | eLIM_CNF_WAIT_TIMER, sta_ds->assocId); |
| 3663 | |
| 3664 | if (assoc_cnf.statusCode == eSIR_SME_SUCCESS) { |
| 3665 | /* |
| 3666 | * In BTAMP-AP, PE already finished the WMA_ADD_STA sequence |
| 3667 | * when it had received Assoc Request frame. Now, PE just needs |
| 3668 | * to send association rsp frame to the requesting BTAMP-STA. |
| 3669 | */ |
| 3670 | sta_ds->mlmStaContext.mlmState = |
| 3671 | eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 3672 | lim_log(mac_ctx, LOG1, |
| 3673 | FL("sending Assoc Rsp frame to STA (assoc id=%d) "), |
| 3674 | sta_ds->assocId); |
| 3675 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_SUCCESS, |
| 3676 | sta_ds->assocId, sta_ds->staAddr, |
| 3677 | sta_ds->mlmStaContext.subType, sta_ds, |
| 3678 | session_entry); |
| 3679 | goto end; |
| 3680 | } else { |
| 3681 | /* |
| 3682 | * SME_ASSOC_CNF status is non-success, so STA is not allowed |
| 3683 | * to be associated since the HAL sta entry is created for |
| 3684 | * denied STA we need to remove this HAL entry. |
| 3685 | * So to do that set updateContext to 1 |
| 3686 | */ |
| 3687 | if (!sta_ds->mlmStaContext.updateContext) |
| 3688 | sta_ds->mlmStaContext.updateContext = 1; |
| 3689 | lim_log(mac_ctx, LOG1, |
| 3690 | FL("Recv Assoc Cnf, status Code : %d(assoc id=%d) "), |
| 3691 | assoc_cnf.statusCode, sta_ds->assocId); |
| 3692 | lim_reject_association(mac_ctx, sta_ds->staAddr, |
| 3693 | sta_ds->mlmStaContext.subType, |
| 3694 | true, sta_ds->mlmStaContext.authType, |
| 3695 | sta_ds->assocId, true, |
| 3696 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
| 3697 | session_entry); |
| 3698 | } |
| 3699 | end: |
| 3700 | if (((session_entry != NULL) && (sta_ds != NULL)) && |
| 3701 | (session_entry->parsedAssocReq[sta_ds->assocId] != NULL)) { |
| 3702 | assoc_req = (tpSirAssocReq) |
| 3703 | session_entry->parsedAssocReq[sta_ds->assocId]; |
| 3704 | if (assoc_req->assocReqFrame) { |
| 3705 | cdf_mem_free(assoc_req->assocReqFrame); |
| 3706 | assoc_req->assocReqFrame = NULL; |
| 3707 | } |
| 3708 | cdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]); |
| 3709 | session_entry->parsedAssocReq[sta_ds->assocId] = NULL; |
| 3710 | } |
| 3711 | } |
| 3712 | |
| 3713 | static void __lim_process_sme_addts_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 3714 | { |
| 3715 | tpDphHashNode pStaDs; |
| 3716 | tSirMacAddr peerMac; |
| 3717 | tpSirAddtsReq pSirAddts; |
| 3718 | uint32_t timeout; |
| 3719 | tpPESession psessionEntry; |
| 3720 | uint8_t sessionId; /* PE sessionId */ |
| 3721 | uint8_t smesessionId; |
| 3722 | uint16_t smetransactionId; |
| 3723 | |
| 3724 | if (pMsgBuf == NULL) { |
| 3725 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 3726 | return; |
| 3727 | } |
| 3728 | |
| 3729 | lim_get_session_info(pMac, (uint8_t *) pMsgBuf, &smesessionId, |
| 3730 | &smetransactionId); |
| 3731 | |
| 3732 | pSirAddts = (tpSirAddtsReq) pMsgBuf; |
| 3733 | |
| 3734 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 3735 | pSirAddts->bssId, |
| 3736 | &sessionId); |
| 3737 | if (psessionEntry == NULL) { |
| 3738 | lim_log(pMac, LOGE, "Session Does not exist for given bssId"); |
| 3739 | return; |
| 3740 | } |
| 3741 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3742 | lim_diag_event_report(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, |
| 3743 | 0); |
| 3744 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3745 | |
| 3746 | /* if sta |
| 3747 | * - verify assoc state |
| 3748 | * - send addts request to ap |
| 3749 | * - wait for addts response from ap |
| 3750 | * if ap, just ignore with error log |
| 3751 | */ |
| 3752 | PELOG1(lim_log(pMac, LOG1, |
| 3753 | FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"), |
| 3754 | pSirAddts->req.tspec.tsinfo.traffic.tsid, |
| 3755 | pSirAddts->req.tspec.tsinfo.traffic.userPrio); |
| 3756 | ) |
| 3757 | |
| 3758 | if (!LIM_IS_STA_ROLE(psessionEntry) && |
| 3759 | !LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) { |
| 3760 | PELOGE(lim_log(pMac, LOGE, "AddTs received on AP - ignoring");) |
| 3761 | lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, |
| 3762 | psessionEntry, pSirAddts->req.tspec, |
| 3763 | smesessionId, smetransactionId); |
| 3764 | return; |
| 3765 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3766 | |
| 3767 | pStaDs = |
| 3768 | dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER, |
| 3769 | &psessionEntry->dph.dphHashTable); |
| 3770 | |
| 3771 | if (pStaDs == NULL) { |
| 3772 | PELOGE(lim_log |
| 3773 | (pMac, LOGE, "Cannot find AP context for addts req"); |
| 3774 | ) |
| 3775 | lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, |
| 3776 | psessionEntry, pSirAddts->req.tspec, |
| 3777 | smesessionId, smetransactionId); |
| 3778 | return; |
| 3779 | } |
| 3780 | |
| 3781 | if ((!pStaDs->valid) || (pStaDs->mlmStaContext.mlmState != |
| 3782 | eLIM_MLM_LINK_ESTABLISHED_STATE)) { |
| 3783 | lim_log(pMac, LOGE, "AddTs received in invalid MLM state"); |
| 3784 | lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, |
| 3785 | psessionEntry, pSirAddts->req.tspec, |
| 3786 | smesessionId, smetransactionId); |
| 3787 | return; |
| 3788 | } |
| 3789 | |
| 3790 | pSirAddts->req.wsmTspecPresent = 0; |
| 3791 | pSirAddts->req.wmeTspecPresent = 0; |
| 3792 | pSirAddts->req.lleTspecPresent = 0; |
| 3793 | |
| 3794 | if ((pStaDs->wsmEnabled) && |
| 3795 | (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != |
| 3796 | SIR_MAC_ACCESSPOLICY_EDCA)) |
| 3797 | pSirAddts->req.wsmTspecPresent = 1; |
| 3798 | else if (pStaDs->wmeEnabled) |
| 3799 | pSirAddts->req.wmeTspecPresent = 1; |
| 3800 | else if (pStaDs->lleEnabled) |
| 3801 | pSirAddts->req.lleTspecPresent = 1; |
| 3802 | else { |
| 3803 | PELOGW(lim_log |
| 3804 | (pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled")); |
| 3805 | ) |
| 3806 | lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, |
| 3807 | psessionEntry, pSirAddts->req.tspec, |
| 3808 | smesessionId, smetransactionId); |
| 3809 | return; |
| 3810 | } |
| 3811 | |
| 3812 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 3813 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) { |
| 3814 | lim_log(pMac, LOGE, |
| 3815 | "AddTs received in invalid LIMsme state (%d)", |
| 3816 | psessionEntry->limSmeState); |
| 3817 | lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, |
| 3818 | psessionEntry, pSirAddts->req.tspec, |
| 3819 | smesessionId, smetransactionId); |
| 3820 | return; |
| 3821 | } |
| 3822 | |
| 3823 | if (pMac->lim.gLimAddtsSent) { |
| 3824 | lim_log(pMac, LOGE, |
| 3825 | "Addts (token %d, tsid %d, up %d) is still pending", |
| 3826 | pMac->lim.gLimAddtsReq.req.dialogToken, |
| 3827 | pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid, |
| 3828 | pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic. |
| 3829 | userPrio); |
| 3830 | lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, |
| 3831 | psessionEntry, pSirAddts->req.tspec, |
| 3832 | smesessionId, smetransactionId); |
| 3833 | return; |
| 3834 | } |
| 3835 | |
| 3836 | sir_copy_mac_addr(peerMac, psessionEntry->bssId); |
| 3837 | |
| 3838 | /* save the addts request */ |
| 3839 | pMac->lim.gLimAddtsSent = true; |
| 3840 | cdf_mem_copy((uint8_t *) &pMac->lim.gLimAddtsReq, |
| 3841 | (uint8_t *) pSirAddts, sizeof(tSirAddtsReq)); |
| 3842 | |
| 3843 | /* ship out the message now */ |
| 3844 | lim_send_addts_req_action_frame(pMac, peerMac, &pSirAddts->req, |
| 3845 | psessionEntry); |
| 3846 | PELOG1(lim_log(pMac, LOG1, "Sent ADDTS request");) |
| 3847 | /* start a timer to wait for the response */ |
| 3848 | if (pSirAddts->timeout) |
| 3849 | timeout = pSirAddts->timeout; |
| 3850 | else if (wlan_cfg_get_int(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != |
| 3851 | eSIR_SUCCESS) { |
| 3852 | lim_log(pMac, LOGP, |
| 3853 | FL("Unable to get Cfg param %d (Addts Rsp Timeout)"), |
| 3854 | WNI_CFG_ADDTS_RSP_TIMEOUT); |
| 3855 | return; |
| 3856 | } |
| 3857 | |
| 3858 | timeout = SYS_MS_TO_TICKS(timeout); |
| 3859 | if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) |
| 3860 | != TX_SUCCESS) { |
| 3861 | lim_log(pMac, LOGP, FL("AddtsRsp timer change failed!")); |
| 3862 | return; |
| 3863 | } |
| 3864 | pMac->lim.gLimAddtsRspTimerCount++; |
| 3865 | if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer, |
| 3866 | pMac->lim.gLimAddtsRspTimerCount) != |
| 3867 | TX_SUCCESS) { |
| 3868 | lim_log(pMac, LOGP, FL("AddtsRsp timer change failed!")); |
| 3869 | return; |
| 3870 | } |
| 3871 | MTRACE(mac_trace |
| 3872 | (pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, |
| 3873 | eLIM_ADDTS_RSP_TIMER)); |
| 3874 | |
| 3875 | /* add the sessionId to the timer object */ |
| 3876 | pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId; |
| 3877 | if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != |
| 3878 | TX_SUCCESS) { |
| 3879 | lim_log(pMac, LOGP, FL("AddtsRsp timer activation failed!")); |
| 3880 | return; |
| 3881 | } |
| 3882 | return; |
| 3883 | } |
| 3884 | |
| 3885 | static void __lim_process_sme_delts_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 3886 | { |
| 3887 | tSirMacAddr peerMacAddr; |
| 3888 | uint8_t ac; |
| 3889 | tSirMacTSInfo *pTsinfo; |
| 3890 | tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf; |
| 3891 | tpDphHashNode pStaDs = NULL; |
| 3892 | tpPESession psessionEntry; |
| 3893 | uint8_t sessionId; |
| 3894 | uint32_t status = eSIR_SUCCESS; |
| 3895 | uint8_t smesessionId; |
| 3896 | uint16_t smetransactionId; |
| 3897 | |
| 3898 | lim_get_session_info(pMac, (uint8_t *) pMsgBuf, &smesessionId, |
| 3899 | &smetransactionId); |
| 3900 | |
| 3901 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 3902 | pDeltsReq->bssId, |
| 3903 | &sessionId); |
| 3904 | if (psessionEntry == NULL) { |
| 3905 | lim_log(pMac, LOGE, "Session Does not exist for given bssId"); |
| 3906 | status = eSIR_FAILURE; |
| 3907 | goto end; |
| 3908 | } |
| 3909 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3910 | lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, |
| 3911 | 0); |
| 3912 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 3913 | |
| 3914 | if (eSIR_SUCCESS != |
| 3915 | lim_validate_delts_req(pMac, pDeltsReq, peerMacAddr, psessionEntry)) { |
| 3916 | PELOGE(lim_log(pMac, LOGE, FL("lim_validate_delts_req failed"));) |
| 3917 | status = eSIR_FAILURE; |
| 3918 | lim_send_sme_delts_rsp(pMac, pDeltsReq, eSIR_FAILURE, psessionEntry, |
| 3919 | smesessionId, smetransactionId); |
| 3920 | return; |
| 3921 | } |
| 3922 | |
| 3923 | lim_log(pMac, LOG1, |
| 3924 | FL("Sent DELTS request to station with assocId = %d MacAddr = " |
| 3925 | MAC_ADDRESS_STR), |
| 3926 | pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr)); |
| 3927 | |
| 3928 | lim_send_delts_req_action_frame(pMac, peerMacAddr, |
| 3929 | pDeltsReq->req.wmeTspecPresent, |
| 3930 | &pDeltsReq->req.tsinfo, |
| 3931 | &pDeltsReq->req.tspec, psessionEntry); |
| 3932 | |
| 3933 | pTsinfo = |
| 3934 | pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec. |
| 3935 | tsinfo : &pDeltsReq->req.tsinfo; |
| 3936 | |
| 3937 | /* We've successfully send DELTS frame to AP. Update the |
| 3938 | * dynamic UAPSD mask. The AC for this TSPEC to be deleted |
| 3939 | * is no longer trigger enabled or delivery enabled |
| 3940 | */ |
| 3941 | lim_set_tspec_uapsd_mask_per_session(pMac, psessionEntry, |
| 3942 | pTsinfo, CLEAR_UAPSD_MASK); |
| 3943 | |
| 3944 | /* We're deleting the TSPEC, so this particular AC is no longer |
| 3945 | * admitted. PE needs to downgrade the EDCA |
| 3946 | * parameters(for the AC for which TS is being deleted) to the |
| 3947 | * next best AC for which ACM is not enabled, and send the |
| 3948 | * updated values to HAL. |
| 3949 | */ |
| 3950 | ac = upToAc(pTsinfo->traffic.userPrio); |
| 3951 | |
| 3952 | if (pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK) { |
| 3953 | psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= |
| 3954 | ~(1 << ac); |
| 3955 | } else if (pTsinfo->traffic.direction == |
| 3956 | SIR_MAC_DIRECTION_DNLINK) { |
| 3957 | psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= |
| 3958 | ~(1 << ac); |
| 3959 | } else if (pTsinfo->traffic.direction == |
| 3960 | SIR_MAC_DIRECTION_BIDIR) { |
| 3961 | psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= |
| 3962 | ~(1 << ac); |
| 3963 | psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= |
| 3964 | ~(1 << ac); |
| 3965 | } |
| 3966 | |
| 3967 | lim_set_active_edca_params(pMac, psessionEntry->gLimEdcaParams, |
| 3968 | psessionEntry); |
| 3969 | |
| 3970 | pStaDs = |
| 3971 | dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER, |
| 3972 | &psessionEntry->dph.dphHashTable); |
| 3973 | if (pStaDs != NULL) { |
| 3974 | lim_send_edca_params(pMac, psessionEntry->gLimEdcaParamsActive, |
| 3975 | pStaDs->bssId); |
| 3976 | status = eSIR_SUCCESS; |
| 3977 | } else { |
| 3978 | lim_log(pMac, LOGE, FL("Self entry missing in Hash Table ")); |
| 3979 | status = eSIR_FAILURE; |
| 3980 | } |
| 3981 | #ifdef FEATURE_WLAN_ESE |
| 3982 | #ifdef FEATURE_WLAN_ESE_UPLOAD |
| 3983 | lim_send_sme_tsm_ie_ind(pMac, psessionEntry, 0, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3984 | #endif /* FEATURE_WLAN_ESE_UPLOAD */ |
| 3985 | #endif |
| 3986 | |
| 3987 | /* send an sme response back */ |
| 3988 | end: |
| 3989 | lim_send_sme_delts_rsp(pMac, pDeltsReq, eSIR_SUCCESS, psessionEntry, |
| 3990 | smesessionId, smetransactionId); |
| 3991 | } |
| 3992 | |
| 3993 | void lim_process_sme_addts_rsp_timeout(tpAniSirGlobal pMac, uint32_t param) |
| 3994 | { |
| 3995 | /* fetch the sessionEntry based on the sessionId */ |
| 3996 | tpPESession psessionEntry; |
| 3997 | psessionEntry = pe_find_session_by_session_id(pMac, |
| 3998 | pMac->lim.limTimers.gLimAddtsRspTimer. |
| 3999 | sessionId); |
| 4000 | if (psessionEntry == NULL) { |
| 4001 | lim_log(pMac, LOGP, |
| 4002 | FL("Session Does not exist for given sessionID")); |
| 4003 | return; |
| 4004 | } |
| 4005 | |
| 4006 | if (!LIM_IS_STA_ROLE(psessionEntry) && |
| 4007 | !LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) { |
| 4008 | lim_log(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", |
| 4009 | GET_LIM_SYSTEM_ROLE(psessionEntry)); |
| 4010 | pMac->lim.gLimAddtsSent = false; |
| 4011 | return; |
| 4012 | } |
| 4013 | |
| 4014 | if (!pMac->lim.gLimAddtsSent) { |
| 4015 | lim_log(pMac, LOGW, "AddtsRspTimeout but no AddtsSent"); |
| 4016 | return; |
| 4017 | } |
| 4018 | |
| 4019 | if (param != pMac->lim.gLimAddtsRspTimerCount) { |
| 4020 | lim_log(pMac, LOGE, |
| 4021 | FL("Invalid AddtsRsp Timer count %d (exp %d)"), param, |
| 4022 | pMac->lim.gLimAddtsRspTimerCount); |
| 4023 | return; |
| 4024 | } |
| 4025 | /* this a real response timeout */ |
| 4026 | pMac->lim.gLimAddtsSent = false; |
| 4027 | pMac->lim.gLimAddtsRspTimerCount++; |
| 4028 | |
| 4029 | lim_send_sme_addts_rsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, |
| 4030 | psessionEntry, pMac->lim.gLimAddtsReq.req.tspec, |
| 4031 | psessionEntry->smeSessionId, |
| 4032 | psessionEntry->transactionId); |
| 4033 | } |
| 4034 | |
| 4035 | /** |
| 4036 | * __lim_process_sme_get_statistics_request() |
| 4037 | * |
| 4038 | ***FUNCTION: |
| 4039 | * |
| 4040 | * |
| 4041 | ***NOTE: |
| 4042 | * |
| 4043 | * @param pMac Pointer to Global MAC structure |
| 4044 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4045 | * @return None |
| 4046 | */ |
| 4047 | static void |
| 4048 | __lim_process_sme_get_statistics_request(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 4049 | { |
| 4050 | tpAniGetPEStatsReq pPEStatsReq; |
| 4051 | tSirMsgQ msgQ; |
| 4052 | |
| 4053 | pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf; |
| 4054 | |
| 4055 | msgQ.type = WMA_GET_STATISTICS_REQ; |
| 4056 | |
| 4057 | msgQ.reserved = 0; |
| 4058 | msgQ.bodyptr = pMsgBuf; |
| 4059 | msgQ.bodyval = 0; |
| 4060 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 4061 | |
| 4062 | if (eSIR_SUCCESS != (wma_post_ctrl_msg(pMac, &msgQ))) { |
| 4063 | cdf_mem_free(pMsgBuf); |
| 4064 | pMsgBuf = NULL; |
| 4065 | lim_log(pMac, LOGP, "Unable to forward request"); |
| 4066 | return; |
| 4067 | } |
| 4068 | |
| 4069 | return; |
| 4070 | } |
| 4071 | |
| 4072 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 4073 | /** |
| 4074 | *FUNCTION: __lim_process_sme_get_tsm_stats_request() |
| 4075 | * |
| 4076 | ***NOTE: |
| 4077 | * |
| 4078 | * @param pMac Pointer to Global MAC structure |
| 4079 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4080 | * @return None |
| 4081 | */ |
| 4082 | static void |
| 4083 | __lim_process_sme_get_tsm_stats_request(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 4084 | { |
| 4085 | tSirMsgQ msgQ; |
| 4086 | |
| 4087 | msgQ.type = WMA_TSM_STATS_REQ; |
| 4088 | msgQ.reserved = 0; |
| 4089 | msgQ.bodyptr = pMsgBuf; |
| 4090 | msgQ.bodyval = 0; |
| 4091 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 4092 | |
| 4093 | if (eSIR_SUCCESS != (wma_post_ctrl_msg(pMac, &msgQ))) { |
| 4094 | cdf_mem_free(pMsgBuf); |
| 4095 | pMsgBuf = NULL; |
| 4096 | lim_log(pMac, LOGP, "Unable to forward request"); |
| 4097 | return; |
| 4098 | } |
| 4099 | } |
| 4100 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
| 4101 | |
| 4102 | static void |
| 4103 | __lim_process_sme_update_apwpsi_es(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 4104 | { |
| 4105 | tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq; |
| 4106 | tpPESession psessionEntry; |
| 4107 | uint8_t sessionId; /* PE sessionID */ |
| 4108 | |
| 4109 | PELOG1(lim_log(pMac, LOG1, FL("received UPDATE_APWPSIEs_REQ message"));); |
| 4110 | |
| 4111 | if (pMsgBuf == NULL) { |
| 4112 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 4113 | return; |
| 4114 | } |
| 4115 | |
| 4116 | pUpdateAPWPSIEsReq = cdf_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq)); |
| 4117 | if (NULL == pUpdateAPWPSIEsReq) { |
| 4118 | lim_log(pMac, LOGP, |
| 4119 | FL |
| 4120 | ("call to AllocateMemory failed for pUpdateAPWPSIEsReq")); |
| 4121 | return; |
| 4122 | } |
| 4123 | cdf_mem_copy(pUpdateAPWPSIEsReq, pMsgBuf, |
| 4124 | sizeof(struct sSirUpdateAPWPSIEsReq)); |
| 4125 | |
| 4126 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 4127 | pUpdateAPWPSIEsReq->bssId, |
| 4128 | &sessionId); |
| 4129 | if (psessionEntry == NULL) { |
| 4130 | lim_log(pMac, LOGW, |
| 4131 | FL("Session does not exist for given BSSID")); |
| 4132 | goto end; |
| 4133 | } |
| 4134 | |
| 4135 | cdf_mem_copy(&psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, |
| 4136 | sizeof(tSirAPWPSIEs)); |
| 4137 | |
| 4138 | sch_set_fixed_beacon_fields(pMac, psessionEntry); |
| 4139 | lim_send_beacon_ind(pMac, psessionEntry); |
| 4140 | |
| 4141 | end: |
| 4142 | cdf_mem_free(pUpdateAPWPSIEsReq); |
| 4143 | return; |
| 4144 | } |
| 4145 | |
| 4146 | void |
| 4147 | lim_send_vdev_restart(tpAniSirGlobal pMac, |
| 4148 | tpPESession psessionEntry, uint8_t sessionId) |
| 4149 | { |
| 4150 | tpHalHiddenSsidVdevRestart pHalHiddenSsidVdevRestart = NULL; |
| 4151 | tSirMsgQ msgQ; |
| 4152 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 4153 | |
| 4154 | if (psessionEntry == NULL) { |
| 4155 | PELOGE(lim_log |
| 4156 | (pMac, LOGE, "%s:%d: Invalid parameters", __func__, |
| 4157 | __LINE__); |
| 4158 | ) |
| 4159 | return; |
| 4160 | } |
| 4161 | |
| 4162 | pHalHiddenSsidVdevRestart = |
| 4163 | cdf_mem_malloc(sizeof(tHalHiddenSsidVdevRestart)); |
| 4164 | if (NULL == pHalHiddenSsidVdevRestart) { |
| 4165 | PELOGE(lim_log |
| 4166 | (pMac, LOGE, "%s:%d: Unable to allocate memory", |
| 4167 | __func__, __LINE__); |
| 4168 | ) |
| 4169 | return; |
| 4170 | } |
| 4171 | |
| 4172 | pHalHiddenSsidVdevRestart->ssidHidden = psessionEntry->ssidHidden; |
| 4173 | pHalHiddenSsidVdevRestart->sessionId = sessionId; |
| 4174 | |
| 4175 | msgQ.type = WMA_HIDDEN_SSID_VDEV_RESTART; |
| 4176 | msgQ.bodyptr = pHalHiddenSsidVdevRestart; |
| 4177 | msgQ.bodyval = 0; |
| 4178 | |
| 4179 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 4180 | if (eSIR_SUCCESS != retCode) { |
| 4181 | PELOGE(lim_log |
| 4182 | (pMac, LOGE, "%s:%d: wma_post_ctrl_msg() failed", __func__, |
| 4183 | __LINE__); |
| 4184 | ) |
| 4185 | cdf_mem_free(pHalHiddenSsidVdevRestart); |
| 4186 | } |
| 4187 | } |
| 4188 | |
| 4189 | static void __lim_process_sme_hide_ssid(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 4190 | { |
| 4191 | tpSirUpdateParams pUpdateParams; |
| 4192 | tpPESession psessionEntry; |
| 4193 | |
| 4194 | PELOG1(lim_log(pMac, LOG1, FL("received HIDE_SSID message"));); |
| 4195 | |
| 4196 | if (pMsgBuf == NULL) { |
| 4197 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 4198 | return; |
| 4199 | } |
| 4200 | |
| 4201 | pUpdateParams = (tpSirUpdateParams) pMsgBuf; |
| 4202 | |
Naveen Rawat | 9e4872a | 2015-11-13 09:43:11 -0800 | [diff] [blame] | 4203 | psessionEntry = pe_find_session_by_sme_session_id(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4204 | pUpdateParams->sessionId); |
| 4205 | if (psessionEntry == NULL) { |
| 4206 | lim_log(pMac, LOGW, |
| 4207 | "Session does not exist for given sessionId %d", |
| 4208 | pUpdateParams->sessionId); |
| 4209 | return; |
| 4210 | } |
| 4211 | |
| 4212 | /* Update the session entry */ |
| 4213 | psessionEntry->ssidHidden = pUpdateParams->ssidHidden; |
| 4214 | |
| 4215 | /* Send vdev restart */ |
| 4216 | lim_send_vdev_restart(pMac, psessionEntry, pUpdateParams->sessionId); |
| 4217 | |
| 4218 | /* Update beacon */ |
| 4219 | sch_set_fixed_beacon_fields(pMac, psessionEntry); |
| 4220 | lim_send_beacon_ind(pMac, psessionEntry); |
| 4221 | |
| 4222 | return; |
| 4223 | } /*** end __lim_process_sme_hide_ssid(tpAniSirGlobal pMac, uint32_t *pMsgBuf) ***/ |
| 4224 | |
| 4225 | static void __lim_process_sme_set_wparsni_es(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 4226 | { |
| 4227 | tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq; |
| 4228 | tpPESession psessionEntry; |
| 4229 | uint8_t sessionId; /* PE sessionID */ |
| 4230 | |
| 4231 | if (pMsgBuf == NULL) { |
| 4232 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 4233 | return; |
| 4234 | } |
| 4235 | |
| 4236 | pUpdateAPWPARSNIEsReq = cdf_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq)); |
| 4237 | if (NULL == pUpdateAPWPARSNIEsReq) { |
| 4238 | lim_log(pMac, LOGP, |
| 4239 | FL |
| 4240 | ("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq")); |
| 4241 | return; |
| 4242 | } |
| 4243 | cdf_mem_copy(pUpdateAPWPARSNIEsReq, pMsgBuf, |
| 4244 | sizeof(struct sSirUpdateAPWPARSNIEsReq)); |
| 4245 | |
| 4246 | psessionEntry = pe_find_session_by_bssid(pMac, |
Srinivas Girigowda | eba9ca5 | 2015-11-24 14:09:39 -0800 | [diff] [blame^] | 4247 | pUpdateAPWPARSNIEsReq->bssid.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4248 | &sessionId); |
| 4249 | if (psessionEntry == NULL) { |
| 4250 | lim_log(pMac, LOGW, |
| 4251 | FL("Session does not exist for given BSSID")); |
| 4252 | goto end; |
| 4253 | } |
| 4254 | |
| 4255 | cdf_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE, |
| 4256 | &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie)); |
| 4257 | |
| 4258 | lim_set_rs_nie_wp_aiefrom_sme_start_bss_req_message(pMac, |
| 4259 | &psessionEntry-> |
| 4260 | pLimStartBssReq->rsnIE, |
| 4261 | psessionEntry); |
| 4262 | |
| 4263 | psessionEntry->pLimStartBssReq->privacy = 1; |
| 4264 | psessionEntry->privacy = 1; |
| 4265 | |
| 4266 | sch_set_fixed_beacon_fields(pMac, psessionEntry); |
| 4267 | lim_send_beacon_ind(pMac, psessionEntry); |
| 4268 | |
| 4269 | end: |
| 4270 | cdf_mem_free(pUpdateAPWPARSNIEsReq); |
| 4271 | return; |
| 4272 | } /*** end __lim_process_sme_set_wparsni_es(tpAniSirGlobal pMac, uint32_t *pMsgBuf) ***/ |
| 4273 | |
| 4274 | /* |
| 4275 | Update the beacon Interval dynamically if beaconInterval is different in MCC |
| 4276 | */ |
| 4277 | static void __lim_process_sme_change_bi(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 4278 | { |
| 4279 | tpSirChangeBIParams pChangeBIParams; |
| 4280 | tpPESession psessionEntry; |
| 4281 | uint8_t sessionId = 0; |
| 4282 | tUpdateBeaconParams beaconParams; |
| 4283 | |
| 4284 | PELOG1(lim_log(pMac, LOG1, |
| 4285 | FL("received Update Beacon Interval message")); |
| 4286 | ); |
| 4287 | |
| 4288 | if (pMsgBuf == NULL) { |
| 4289 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 4290 | return; |
| 4291 | } |
| 4292 | |
| 4293 | cdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams)); |
| 4294 | pChangeBIParams = (tpSirChangeBIParams) pMsgBuf; |
| 4295 | |
| 4296 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 4297 | pChangeBIParams->bssId, |
| 4298 | &sessionId); |
| 4299 | if (psessionEntry == NULL) { |
| 4300 | lim_log(pMac, LOGE, |
| 4301 | FL("Session does not exist for given BSSID")); |
| 4302 | return; |
| 4303 | } |
| 4304 | |
| 4305 | /*Update sessionEntry Beacon Interval */ |
| 4306 | if (psessionEntry->beaconParams.beaconInterval != |
| 4307 | pChangeBIParams->beaconInterval) { |
| 4308 | psessionEntry->beaconParams.beaconInterval = |
| 4309 | pChangeBIParams->beaconInterval; |
| 4310 | } |
| 4311 | |
| 4312 | /*Update sch beaconInterval */ |
| 4313 | if (pMac->sch.schObject.gSchBeaconInterval != |
| 4314 | pChangeBIParams->beaconInterval) { |
| 4315 | pMac->sch.schObject.gSchBeaconInterval = |
| 4316 | pChangeBIParams->beaconInterval; |
| 4317 | |
| 4318 | PELOG1(lim_log(pMac, LOG1, |
| 4319 | FL |
| 4320 | ("LIM send update BeaconInterval Indication : %d"), |
| 4321 | pChangeBIParams->beaconInterval); |
| 4322 | ); |
| 4323 | |
| 4324 | if (false == pMac->sap.SapDfsInfo.is_dfs_cac_timer_running) { |
| 4325 | /* Update beacon */ |
| 4326 | sch_set_fixed_beacon_fields(pMac, psessionEntry); |
| 4327 | |
| 4328 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 4329 | /* Set change in beacon Interval */ |
| 4330 | beaconParams.beaconInterval = |
| 4331 | pChangeBIParams->beaconInterval; |
| 4332 | beaconParams.paramChangeBitmap = |
| 4333 | PARAM_BCN_INTERVAL_CHANGED; |
| 4334 | lim_send_beacon_params(pMac, &beaconParams, psessionEntry); |
| 4335 | } |
| 4336 | } |
| 4337 | |
| 4338 | return; |
| 4339 | } /*** end __lim_process_sme_change_bi(tpAniSirGlobal pMac, uint32_t *pMsgBuf) ***/ |
| 4340 | |
| 4341 | #ifdef QCA_HT_2040_COEX |
| 4342 | static void __lim_process_sme_set_ht2040_mode(tpAniSirGlobal pMac, |
| 4343 | uint32_t *pMsgBuf) |
| 4344 | { |
| 4345 | tpSirSetHT2040Mode pSetHT2040Mode; |
| 4346 | tpPESession psessionEntry; |
| 4347 | uint8_t sessionId = 0; |
| 4348 | cds_msg_t msg; |
| 4349 | tUpdateVHTOpMode *pHtOpMode = NULL; |
| 4350 | uint16_t staId = 0; |
| 4351 | tpDphHashNode pStaDs = NULL; |
| 4352 | |
| 4353 | PELOG1(lim_log(pMac, LOG1, FL("received Set HT 20/40 mode message"));); |
| 4354 | if (pMsgBuf == NULL) { |
| 4355 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 4356 | return; |
| 4357 | } |
| 4358 | |
| 4359 | pSetHT2040Mode = (tpSirSetHT2040Mode) pMsgBuf; |
| 4360 | |
| 4361 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 4362 | pSetHT2040Mode->bssId, |
| 4363 | &sessionId); |
| 4364 | if (psessionEntry == NULL) { |
| 4365 | lim_log(pMac, LOG1, |
| 4366 | FL("Session does not exist for given BSSID ")); |
| 4367 | lim_print_mac_addr(pMac, pSetHT2040Mode->bssId, LOG1); |
| 4368 | return; |
| 4369 | } |
| 4370 | |
| 4371 | lim_log(pMac, LOG1, FL("Update session entry for cbMod=%d"), |
| 4372 | pSetHT2040Mode->cbMode); |
| 4373 | /*Update sessionEntry HT related fields */ |
| 4374 | switch (pSetHT2040Mode->cbMode) { |
| 4375 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 4376 | psessionEntry->htSecondaryChannelOffset = |
| 4377 | PHY_SINGLE_CHANNEL_CENTERED; |
| 4378 | psessionEntry->htRecommendedTxWidthSet = 0; |
| 4379 | if (pSetHT2040Mode->obssEnabled) |
| 4380 | psessionEntry->htSupportedChannelWidthSet |
| 4381 | = eHT_CHANNEL_WIDTH_40MHZ; |
| 4382 | else |
| 4383 | psessionEntry->htSupportedChannelWidthSet |
| 4384 | = eHT_CHANNEL_WIDTH_20MHZ; |
| 4385 | break; |
| 4386 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 4387 | psessionEntry->htSecondaryChannelOffset = |
| 4388 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 4389 | psessionEntry->htRecommendedTxWidthSet = 1; |
| 4390 | break; |
| 4391 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 4392 | psessionEntry->htSecondaryChannelOffset = |
| 4393 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 4394 | psessionEntry->htRecommendedTxWidthSet = 1; |
| 4395 | break; |
| 4396 | default: |
| 4397 | lim_log(pMac, LOGE, FL("Invalid cbMode")); |
| 4398 | return; |
| 4399 | } |
| 4400 | |
| 4401 | /* Update beacon */ |
| 4402 | sch_set_fixed_beacon_fields(pMac, psessionEntry); |
| 4403 | lim_send_beacon_ind(pMac, psessionEntry); |
| 4404 | |
| 4405 | /* update OP Mode for each associated peer */ |
| 4406 | for (staId = 0; staId < psessionEntry->dph.dphHashTable.size; staId++) { |
| 4407 | pStaDs = dph_get_hash_entry(pMac, staId, |
| 4408 | &psessionEntry->dph.dphHashTable); |
| 4409 | if (NULL == pStaDs) |
| 4410 | continue; |
| 4411 | |
| 4412 | if (pStaDs->valid && pStaDs->htSupportedChannelWidthSet) { |
| 4413 | pHtOpMode = cdf_mem_malloc(sizeof(tUpdateVHTOpMode)); |
| 4414 | if (NULL == pHtOpMode) { |
| 4415 | lim_log(pMac, LOGE, |
| 4416 | FL |
| 4417 | ("%s: Not able to allocate memory for setting OP mode"), |
| 4418 | __func__); |
| 4419 | return; |
| 4420 | } |
| 4421 | pHtOpMode->opMode = |
| 4422 | (psessionEntry->htSecondaryChannelOffset == |
| 4423 | PHY_SINGLE_CHANNEL_CENTERED) ? |
| 4424 | eHT_CHANNEL_WIDTH_20MHZ : eHT_CHANNEL_WIDTH_40MHZ; |
| 4425 | pHtOpMode->staId = staId; |
| 4426 | cdf_mem_copy(pHtOpMode->peer_mac, &pStaDs->staAddr, |
| 4427 | sizeof(tSirMacAddr)); |
| 4428 | pHtOpMode->smesessionId = sessionId; |
| 4429 | |
| 4430 | msg.type = WMA_UPDATE_OP_MODE; |
| 4431 | msg.reserved = 0; |
| 4432 | msg.bodyptr = pHtOpMode; |
| 4433 | if (!CDF_IS_STATUS_SUCCESS |
| 4434 | (cds_mq_post_message(CDF_MODULE_ID_WMA, &msg))) { |
| 4435 | lim_log(pMac, LOGE, |
| 4436 | FL |
| 4437 | ("%s: Not able to post WMA_UPDATE_OP_MODE message to WMA"), |
| 4438 | __func__); |
| 4439 | cdf_mem_free(pHtOpMode); |
| 4440 | return; |
| 4441 | } |
| 4442 | lim_log(pMac, LOG1, |
| 4443 | FL |
| 4444 | ("%s: Notifed FW about OP mode: %d for staId=%d"), |
| 4445 | __func__, pHtOpMode->opMode, staId); |
| 4446 | |
| 4447 | } else |
| 4448 | lim_log(pMac, LOG1, |
| 4449 | FL("%s: station %d does not support HT40\n"), |
| 4450 | __func__, staId); |
| 4451 | } |
| 4452 | |
| 4453 | return; |
| 4454 | } |
| 4455 | #endif |
| 4456 | |
| 4457 | /* -------------------------------------------------------------------- */ |
| 4458 | /** |
| 4459 | * __lim_process_report_message |
| 4460 | * |
| 4461 | * FUNCTION: Processes the next received Radio Resource Management message |
| 4462 | * |
| 4463 | * LOGIC: |
| 4464 | * |
| 4465 | * ASSUMPTIONS: |
| 4466 | * |
| 4467 | * NOTE: |
| 4468 | * |
| 4469 | * @param None |
| 4470 | * @return None |
| 4471 | */ |
| 4472 | |
| 4473 | void __lim_process_report_message(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 4474 | { |
| 4475 | #ifdef WLAN_FEATURE_VOWIFI |
| 4476 | switch (pMsg->type) { |
| 4477 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 4478 | rrm_process_neighbor_report_req(pMac, pMsg->bodyptr); |
| 4479 | break; |
| 4480 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | rrm_process_beacon_report_xmit(pMac, pMsg->bodyptr); |
Krishna Kumaar Natarajan | f599c6e | 2015-11-03 11:44:03 -0800 | [diff] [blame] | 4482 | break; |
| 4483 | default: |
| 4484 | lim_log(pMac, LOGE, FL("Invalid msg type:%d"), pMsg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4485 | } |
| 4486 | #endif |
| 4487 | } |
| 4488 | |
| 4489 | #if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI) |
| 4490 | /* -------------------------------------------------------------------- */ |
| 4491 | /** |
| 4492 | * lim_send_set_max_tx_power_req |
| 4493 | * |
| 4494 | * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power. |
| 4495 | * |
| 4496 | * LOGIC: |
| 4497 | * |
| 4498 | * ASSUMPTIONS: |
| 4499 | * |
| 4500 | * NOTE: |
| 4501 | * |
| 4502 | * @param txPower txPower to be set. |
| 4503 | * @param pSessionEntry session entry. |
| 4504 | * @return None |
| 4505 | */ |
| 4506 | tSirRetStatus |
| 4507 | lim_send_set_max_tx_power_req(tpAniSirGlobal pMac, tPowerdBm txPower, |
| 4508 | tpPESession pSessionEntry) |
| 4509 | { |
| 4510 | tpMaxTxPowerParams pMaxTxParams = NULL; |
| 4511 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 4512 | tSirMsgQ msgQ; |
| 4513 | |
| 4514 | if (pSessionEntry == NULL) { |
| 4515 | PELOGE(lim_log |
| 4516 | (pMac, LOGE, "%s:%d: Inavalid parameters", __func__, |
| 4517 | __LINE__); |
| 4518 | ) |
| 4519 | return eSIR_FAILURE; |
| 4520 | } |
| 4521 | |
| 4522 | pMaxTxParams = cdf_mem_malloc(sizeof(tMaxTxPowerParams)); |
| 4523 | if (NULL == pMaxTxParams) { |
| 4524 | lim_log(pMac, LOGP, |
| 4525 | FL("Unable to allocate memory for pMaxTxParams ")); |
| 4526 | return eSIR_MEM_ALLOC_FAILED; |
| 4527 | |
| 4528 | } |
| 4529 | #if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE) |
| 4530 | lim_log(pMac, LOG1, |
| 4531 | FL("pMaxTxParams allocated...will be freed in other module")); |
| 4532 | #endif |
| 4533 | if (pMaxTxParams == NULL) { |
| 4534 | lim_log(pMac, LOGE, FL("pMaxTxParams is NULL")); |
| 4535 | return eSIR_FAILURE; |
| 4536 | } |
| 4537 | pMaxTxParams->power = txPower; |
Srinivas Girigowda | 9721523 | 2015-09-24 12:26:28 -0700 | [diff] [blame] | 4538 | cdf_mem_copy(pMaxTxParams->bssId.bytes, pSessionEntry->bssId, |
| 4539 | CDF_MAC_ADDR_SIZE); |
| 4540 | cdf_mem_copy(pMaxTxParams->selfStaMacAddr.bytes, |
| 4541 | pSessionEntry->selfMacAddr, |
| 4542 | CDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4543 | |
| 4544 | msgQ.type = WMA_SET_MAX_TX_POWER_REQ; |
| 4545 | msgQ.bodyptr = pMaxTxParams; |
| 4546 | msgQ.bodyval = 0; |
| 4547 | PELOG1(lim_log |
| 4548 | (pMac, LOG1, FL("Posting WMA_SET_MAX_TX_POWER_REQ to WMA")); |
| 4549 | ) |
| 4550 | MTRACE(mac_trace_msg_tx(pMac, pSessionEntry->peSessionId, msgQ.type)); |
| 4551 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 4552 | if (eSIR_SUCCESS != retCode) { |
| 4553 | lim_log(pMac, LOGE, FL("wma_post_ctrl_msg() failed")); |
| 4554 | cdf_mem_free(pMaxTxParams); |
| 4555 | } |
| 4556 | return retCode; |
| 4557 | } |
| 4558 | #endif |
| 4559 | |
| 4560 | /** |
| 4561 | * __lim_process_sme_register_mgmt_frame_req() - process sme reg mgmt frame req |
| 4562 | * |
| 4563 | * @mac_ctx: Pointer to Global MAC structure |
| 4564 | * @msg_buf: pointer to the SME message buffer |
| 4565 | * |
| 4566 | * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message |
| 4567 | * from SME. It Register this information within PE. |
| 4568 | * |
| 4569 | * Return: None |
| 4570 | */ |
| 4571 | static void __lim_process_sme_register_mgmt_frame_req(tpAniSirGlobal mac_ctx, |
| 4572 | uint32_t *msg_buf) |
| 4573 | { |
| 4574 | CDF_STATUS cdf_status; |
| 4575 | tpSirRegisterMgmtFrame sme_req = (tpSirRegisterMgmtFrame)msg_buf; |
| 4576 | struct mgmt_frm_reg_info *lim_mgmt_regn = NULL; |
| 4577 | struct mgmt_frm_reg_info *next = NULL; |
| 4578 | bool match = false; |
| 4579 | |
| 4580 | lim_log(mac_ctx, LOG1, FL( |
| 4581 | "registerFrame %d, frameType %d, matchLen %d"), |
| 4582 | sme_req->registerFrame, sme_req->frameType, |
| 4583 | sme_req->matchLen); |
| 4584 | /* First check whether entry exists already */ |
| 4585 | cdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock); |
| 4586 | cdf_list_peek_front(&mac_ctx->lim.gLimMgmtFrameRegistratinQueue, |
| 4587 | (cdf_list_node_t **) &lim_mgmt_regn); |
| 4588 | cdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock); |
| 4589 | |
| 4590 | while (lim_mgmt_regn != NULL) { |
| 4591 | if (lim_mgmt_regn->frameType != sme_req->frameType) |
| 4592 | goto skip_match; |
| 4593 | if (sme_req->matchLen) { |
| 4594 | if ((lim_mgmt_regn->matchLen == sme_req->matchLen) && |
| 4595 | (cdf_mem_compare(lim_mgmt_regn->matchData, |
| 4596 | sme_req->matchData, |
| 4597 | lim_mgmt_regn->matchLen))) { |
| 4598 | /* found match! */ |
| 4599 | match = true; |
| 4600 | break; |
| 4601 | } |
| 4602 | } else { |
| 4603 | /* found match! */ |
| 4604 | match = true; |
| 4605 | break; |
| 4606 | } |
| 4607 | skip_match: |
| 4608 | cdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock); |
| 4609 | cdf_status = cdf_list_peek_next( |
| 4610 | &mac_ctx->lim.gLimMgmtFrameRegistratinQueue, |
| 4611 | (cdf_list_node_t *)lim_mgmt_regn, |
| 4612 | (cdf_list_node_t **)&next); |
| 4613 | cdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock); |
| 4614 | lim_mgmt_regn = next; |
| 4615 | next = NULL; |
| 4616 | } |
| 4617 | if (match) { |
| 4618 | cdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock); |
| 4619 | cdf_list_remove_node( |
| 4620 | &mac_ctx->lim.gLimMgmtFrameRegistratinQueue, |
| 4621 | (cdf_list_node_t *)lim_mgmt_regn); |
| 4622 | cdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock); |
| 4623 | cdf_mem_free(lim_mgmt_regn); |
| 4624 | } |
| 4625 | |
| 4626 | if (sme_req->registerFrame) { |
| 4627 | lim_mgmt_regn = |
| 4628 | cdf_mem_malloc(sizeof(struct mgmt_frm_reg_info) + |
| 4629 | sme_req->matchLen); |
| 4630 | if (lim_mgmt_regn != NULL) { |
| 4631 | cdf_mem_set((void *)lim_mgmt_regn, |
| 4632 | sizeof(struct mgmt_frm_reg_info) + |
| 4633 | sme_req->matchLen, 0); |
| 4634 | lim_mgmt_regn->frameType = sme_req->frameType; |
| 4635 | lim_mgmt_regn->matchLen = sme_req->matchLen; |
| 4636 | lim_mgmt_regn->sessionId = sme_req->sessionId; |
| 4637 | if (sme_req->matchLen) { |
| 4638 | cdf_mem_copy(lim_mgmt_regn->matchData, |
| 4639 | sme_req->matchData, |
| 4640 | sme_req->matchLen); |
| 4641 | } |
| 4642 | cdf_mutex_acquire( |
| 4643 | &mac_ctx->lim.lim_frame_register_lock); |
| 4644 | cdf_list_insert_front(&mac_ctx->lim. |
| 4645 | gLimMgmtFrameRegistratinQueue, |
| 4646 | &lim_mgmt_regn->node); |
| 4647 | cdf_mutex_release( |
| 4648 | &mac_ctx->lim.lim_frame_register_lock); |
| 4649 | } |
| 4650 | } |
| 4651 | return; |
| 4652 | } |
| 4653 | |
| 4654 | static void __lim_deregister_deferred_sme_req_after_noa_start(tpAniSirGlobal pMac) |
| 4655 | { |
| 4656 | lim_log(pMac, LOG1, FL("Dereg msgType %d"), |
| 4657 | pMac->lim.gDeferMsgTypeForNOA); |
| 4658 | pMac->lim.gDeferMsgTypeForNOA = 0; |
| 4659 | if (pMac->lim.gpDefdSmeMsgForNOA != NULL) { |
| 4660 | /* __lim_process_sme_scan_req consumed the buffer. We can free it. */ |
| 4661 | cdf_mem_free(pMac->lim.gpDefdSmeMsgForNOA); |
| 4662 | pMac->lim.gpDefdSmeMsgForNOA = NULL; |
| 4663 | } |
| 4664 | } |
| 4665 | |
| 4666 | /** |
| 4667 | * lim_process_regd_defd_sme_req_after_noa_start() |
| 4668 | * |
| 4669 | * mac_ctx: Pointer to Global MAC structure |
| 4670 | * |
| 4671 | * This function is called to process deferred sme req message |
| 4672 | * after noa start. |
| 4673 | * |
| 4674 | * Return: None |
| 4675 | */ |
| 4676 | void lim_process_regd_defd_sme_req_after_noa_start(tpAniSirGlobal mac_ctx) |
| 4677 | { |
| 4678 | bool buf_consumed = true; |
| 4679 | |
| 4680 | lim_log(mac_ctx, LOG1, FL("Process defd sme req %d"), |
| 4681 | mac_ctx->lim.gDeferMsgTypeForNOA); |
| 4682 | |
| 4683 | if ((mac_ctx->lim.gDeferMsgTypeForNOA == 0) || |
| 4684 | (mac_ctx->lim.gpDefdSmeMsgForNOA == NULL)) { |
| 4685 | lim_log(mac_ctx, LOGW, |
| 4686 | FL("start rcvd from FW when no sme deferred msg pending. Do nothing. ")); |
| 4687 | lim_log(mac_ctx, LOGW, |
| 4688 | FL("It may happen when NOA start ind and timeout happen at the same time")); |
| 4689 | return; |
| 4690 | } |
| 4691 | switch (mac_ctx->lim.gDeferMsgTypeForNOA) { |
| 4692 | case eWNI_SME_SCAN_REQ: |
| 4693 | __lim_process_sme_scan_req(mac_ctx, |
| 4694 | mac_ctx->lim.gpDefdSmeMsgForNOA); |
| 4695 | break; |
| 4696 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 4697 | case eWNI_SME_OEM_DATA_REQ: |
| 4698 | __lim_process_sme_oem_data_req(mac_ctx, |
| 4699 | mac_ctx->lim.gpDefdSmeMsgForNOA); |
| 4700 | break; |
| 4701 | #endif |
| 4702 | case eWNI_SME_REMAIN_ON_CHANNEL_REQ: |
| 4703 | buf_consumed = lim_process_remain_on_chnl_req(mac_ctx, |
| 4704 | mac_ctx->lim.gpDefdSmeMsgForNOA); |
| 4705 | /* |
| 4706 | * lim_process_remain_on_chnl_req doesnt want us to free |
| 4707 | * the buffer since it is freed in lim_remain_on_chn_rsp. |
| 4708 | * this change is to avoid "double free" |
| 4709 | */ |
| 4710 | if (false == buf_consumed) |
| 4711 | mac_ctx->lim.gpDefdSmeMsgForNOA = NULL; |
| 4712 | break; |
| 4713 | case eWNI_SME_JOIN_REQ: |
| 4714 | __lim_process_sme_join_req(mac_ctx, |
| 4715 | mac_ctx->lim.gpDefdSmeMsgForNOA); |
| 4716 | break; |
| 4717 | default: |
| 4718 | lim_log(mac_ctx, LOGE, FL("Unknown deferred msg type %d"), |
| 4719 | mac_ctx->lim.gDeferMsgTypeForNOA); |
| 4720 | break; |
| 4721 | } |
| 4722 | __lim_deregister_deferred_sme_req_after_noa_start(mac_ctx); |
| 4723 | } |
| 4724 | |
| 4725 | static void |
| 4726 | __lim_process_sme_reset_ap_caps_change(tpAniSirGlobal pMac, uint32_t *pMsgBuf) |
| 4727 | { |
| 4728 | tpSirResetAPCapsChange pResetCapsChange; |
| 4729 | tpPESession psessionEntry; |
| 4730 | uint8_t sessionId = 0; |
| 4731 | if (pMsgBuf == NULL) { |
| 4732 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 4733 | return; |
| 4734 | } |
| 4735 | |
| 4736 | pResetCapsChange = (tpSirResetAPCapsChange) pMsgBuf; |
| 4737 | psessionEntry = |
Srinivas Girigowda | 40567b9 | 2015-09-24 15:17:25 -0700 | [diff] [blame] | 4738 | pe_find_session_by_bssid(pMac, pResetCapsChange->bssId.bytes, |
| 4739 | &sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4740 | if (psessionEntry == NULL) { |
| 4741 | lim_log(pMac, LOGE, |
| 4742 | FL("Session does not exist for given BSSID")); |
| 4743 | return; |
| 4744 | } |
| 4745 | |
| 4746 | psessionEntry->limSentCapsChangeNtf = false; |
| 4747 | return; |
| 4748 | } |
| 4749 | |
| 4750 | /** |
| 4751 | * lim_process_sme_req_messages() |
| 4752 | * |
| 4753 | ***FUNCTION: |
| 4754 | * This function is called by limProcessMessageQueue(). This |
| 4755 | * function processes SME request messages from HDD or upper layer |
| 4756 | * application. |
| 4757 | * |
| 4758 | ***LOGIC: |
| 4759 | * |
| 4760 | ***ASSUMPTIONS: |
| 4761 | * |
| 4762 | ***NOTE: |
| 4763 | * |
| 4764 | * @param pMac Pointer to Global MAC structure |
| 4765 | * @param msgType Indicates the SME message type |
| 4766 | * @param *pMsgBuf A pointer to the SME message buffer |
| 4767 | * @return Boolean - true - if pMsgBuf is consumed and can be freed. |
| 4768 | * false - if pMsgBuf is not to be freed. |
| 4769 | */ |
| 4770 | |
| 4771 | bool lim_process_sme_req_messages(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 4772 | { |
| 4773 | bool bufConsumed = true; /* Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed. */ |
| 4774 | uint32_t *pMsgBuf = pMsg->bodyptr; |
| 4775 | tpSirSmeScanReq pScanReq; |
| 4776 | PELOG1(lim_log |
| 4777 | (pMac, LOG1, |
| 4778 | FL |
| 4779 | ("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)"), |
| 4780 | lim_msg_str(pMsg->type), pMsg->type, |
| 4781 | lim_sme_state_str(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState, |
| 4782 | lim_mlm_state_str(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState); |
| 4783 | ) |
| 4784 | |
| 4785 | pScanReq = (tpSirSmeScanReq) pMsgBuf; |
| 4786 | /* If no insert NOA required then execute the code below */ |
| 4787 | |
| 4788 | switch (pMsg->type) { |
| 4789 | case eWNI_SME_SYS_READY_IND: |
| 4790 | bufConsumed = __lim_process_sme_sys_ready_ind(pMac, pMsgBuf); |
| 4791 | break; |
| 4792 | |
| 4793 | case eWNI_SME_START_BSS_REQ: |
| 4794 | bufConsumed = __lim_process_sme_start_bss_req(pMac, pMsg); |
| 4795 | break; |
| 4796 | |
| 4797 | case eWNI_SME_SCAN_REQ: |
| 4798 | __lim_process_sme_scan_req(pMac, pMsgBuf); |
| 4799 | break; |
| 4800 | |
| 4801 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 4802 | case eWNI_SME_OEM_DATA_REQ: |
| 4803 | __lim_process_sme_oem_data_req(pMac, pMsgBuf); |
| 4804 | break; |
| 4805 | #endif |
| 4806 | case eWNI_SME_REMAIN_ON_CHANNEL_REQ: |
| 4807 | bufConsumed = lim_process_remain_on_chnl_req(pMac, pMsgBuf); |
| 4808 | break; |
| 4809 | |
| 4810 | case eWNI_SME_UPDATE_NOA: |
| 4811 | __lim_process_sme_no_a_update(pMac, pMsgBuf); |
| 4812 | break; |
| 4813 | case eWNI_SME_CLEAR_DFS_CHANNEL_LIST: |
| 4814 | __lim_process_clear_dfs_channel_list(pMac, pMsg); |
| 4815 | break; |
| 4816 | case eWNI_SME_JOIN_REQ: |
| 4817 | __lim_process_sme_join_req(pMac, pMsgBuf); |
| 4818 | break; |
| 4819 | |
| 4820 | case eWNI_SME_REASSOC_REQ: |
| 4821 | __lim_process_sme_reassoc_req(pMac, pMsgBuf); |
| 4822 | break; |
| 4823 | |
| 4824 | case eWNI_SME_DISASSOC_REQ: |
| 4825 | __lim_process_sme_disassoc_req(pMac, pMsgBuf); |
| 4826 | break; |
| 4827 | |
| 4828 | case eWNI_SME_DISASSOC_CNF: |
| 4829 | case eWNI_SME_DEAUTH_CNF: |
| 4830 | __lim_process_sme_disassoc_cnf(pMac, pMsgBuf); |
| 4831 | break; |
| 4832 | |
| 4833 | case eWNI_SME_DEAUTH_REQ: |
| 4834 | __lim_process_sme_deauth_req(pMac, pMsgBuf); |
| 4835 | break; |
| 4836 | |
| 4837 | case eWNI_SME_SETCONTEXT_REQ: |
| 4838 | __lim_process_sme_set_context_req(pMac, pMsgBuf); |
| 4839 | break; |
| 4840 | |
| 4841 | case eWNI_SME_STOP_BSS_REQ: |
| 4842 | bufConsumed = __lim_process_sme_stop_bss_req(pMac, pMsg); |
| 4843 | break; |
| 4844 | |
| 4845 | case eWNI_SME_ASSOC_CNF: |
| 4846 | if (pMsg->type == eWNI_SME_ASSOC_CNF) |
| 4847 | PELOG1(lim_log(pMac, |
| 4848 | LOG1, FL("Received ASSOC_CNF message"));) |
| 4849 | __lim_process_sme_assoc_cnf_new(pMac, pMsg->type, |
| 4850 | pMsgBuf); |
| 4851 | break; |
| 4852 | |
| 4853 | case eWNI_SME_ADDTS_REQ: |
| 4854 | PELOG1(lim_log(pMac, LOG1, FL("Received ADDTS_REQ message"));) |
| 4855 | __lim_process_sme_addts_req(pMac, pMsgBuf); |
| 4856 | break; |
| 4857 | |
| 4858 | case eWNI_SME_DELTS_REQ: |
| 4859 | PELOG1(lim_log(pMac, LOG1, FL("Received DELTS_REQ message"));) |
| 4860 | __lim_process_sme_delts_req(pMac, pMsgBuf); |
| 4861 | break; |
| 4862 | |
| 4863 | case SIR_LIM_ADDTS_RSP_TIMEOUT: |
| 4864 | PELOG1(lim_log |
| 4865 | (pMac, LOG1, |
| 4866 | FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message ")); |
| 4867 | ) |
| 4868 | lim_process_sme_addts_rsp_timeout(pMac, pMsg->bodyval); |
| 4869 | break; |
| 4870 | |
| 4871 | case eWNI_SME_GET_STATISTICS_REQ: |
| 4872 | __lim_process_sme_get_statistics_request(pMac, pMsgBuf); |
| 4873 | /* HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false. */ |
| 4874 | bufConsumed = false; |
| 4875 | break; |
| 4876 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 4877 | case eWNI_SME_GET_TSM_STATS_REQ: |
| 4878 | __lim_process_sme_get_tsm_stats_request(pMac, pMsgBuf); |
| 4879 | bufConsumed = false; |
| 4880 | break; |
| 4881 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
| 4882 | case eWNI_SME_GET_ASSOC_STAS_REQ: |
| 4883 | lim_process_sme_get_assoc_sta_info(pMac, pMsgBuf); |
| 4884 | break; |
| 4885 | case eWNI_SME_TKIP_CNTR_MEAS_REQ: |
| 4886 | lim_process_tkip_counter_measures(pMac, pMsgBuf); |
| 4887 | break; |
| 4888 | |
| 4889 | case eWNI_SME_HIDE_SSID_REQ: |
| 4890 | __lim_process_sme_hide_ssid(pMac, pMsgBuf); |
| 4891 | break; |
| 4892 | case eWNI_SME_UPDATE_APWPSIE_REQ: |
| 4893 | __lim_process_sme_update_apwpsi_es(pMac, pMsgBuf); |
| 4894 | break; |
| 4895 | case eWNI_SME_GET_WPSPBC_SESSION_REQ: |
| 4896 | lim_process_sme_get_wpspbc_sessions(pMac, pMsgBuf); |
| 4897 | break; |
| 4898 | |
| 4899 | case eWNI_SME_SET_APWPARSNIEs_REQ: |
| 4900 | __lim_process_sme_set_wparsni_es(pMac, pMsgBuf); |
| 4901 | break; |
| 4902 | |
| 4903 | case eWNI_SME_CHNG_MCC_BEACON_INTERVAL: |
| 4904 | /* Update the beaconInterval */ |
| 4905 | __lim_process_sme_change_bi(pMac, pMsgBuf); |
| 4906 | break; |
| 4907 | |
| 4908 | #ifdef QCA_HT_2040_COEX |
| 4909 | case eWNI_SME_SET_HT_2040_MODE: |
| 4910 | __lim_process_sme_set_ht2040_mode(pMac, pMsgBuf); |
| 4911 | break; |
| 4912 | #endif |
| 4913 | |
| 4914 | #if defined WLAN_FEATURE_VOWIFI |
| 4915 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 4916 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
| 4917 | __lim_process_report_message(pMac, pMsg); |
| 4918 | break; |
| 4919 | #endif |
| 4920 | |
| 4921 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4922 | case eWNI_SME_FT_PRE_AUTH_REQ: |
| 4923 | bufConsumed = (bool) lim_process_ft_pre_auth_req(pMac, pMsg); |
| 4924 | break; |
| 4925 | case eWNI_SME_FT_UPDATE_KEY: |
| 4926 | lim_process_ft_update_key(pMac, pMsgBuf); |
| 4927 | break; |
| 4928 | |
| 4929 | case eWNI_SME_FT_AGGR_QOS_REQ: |
| 4930 | lim_process_ft_aggr_qos_req(pMac, pMsgBuf); |
| 4931 | break; |
| 4932 | #endif |
| 4933 | |
| 4934 | case eWNI_SME_REGISTER_MGMT_FRAME_REQ: |
| 4935 | __lim_process_sme_register_mgmt_frame_req(pMac, pMsgBuf); |
| 4936 | break; |
| 4937 | #ifdef FEATURE_WLAN_TDLS |
| 4938 | case eWNI_SME_TDLS_SEND_MGMT_REQ: |
| 4939 | lim_process_sme_tdls_mgmt_send_req(pMac, pMsgBuf); |
| 4940 | break; |
| 4941 | case eWNI_SME_TDLS_ADD_STA_REQ: |
| 4942 | lim_process_sme_tdls_add_sta_req(pMac, pMsgBuf); |
| 4943 | break; |
| 4944 | case eWNI_SME_TDLS_DEL_STA_REQ: |
| 4945 | lim_process_sme_tdls_del_sta_req(pMac, pMsgBuf); |
| 4946 | break; |
| 4947 | case eWNI_SME_TDLS_LINK_ESTABLISH_REQ: |
| 4948 | lim_process_sme_tdls_link_establish_req(pMac, pMsgBuf); |
| 4949 | break; |
| 4950 | #endif |
| 4951 | case eWNI_SME_RESET_AP_CAPS_CHANGED: |
| 4952 | __lim_process_sme_reset_ap_caps_change(pMac, pMsgBuf); |
| 4953 | break; |
| 4954 | |
| 4955 | case eWNI_SME_CHANNEL_CHANGE_REQ: |
| 4956 | lim_process_sme_channel_change_request(pMac, pMsgBuf); |
| 4957 | break; |
| 4958 | |
| 4959 | case eWNI_SME_START_BEACON_REQ: |
| 4960 | lim_process_sme_start_beacon_req(pMac, pMsgBuf); |
| 4961 | break; |
| 4962 | |
| 4963 | case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ: |
| 4964 | lim_process_sme_dfs_csa_ie_request(pMac, pMsgBuf); |
| 4965 | break; |
| 4966 | |
| 4967 | case eWNI_SME_UPDATE_ADDITIONAL_IES: |
| 4968 | lim_process_update_add_ies(pMac, pMsgBuf); |
| 4969 | break; |
| 4970 | |
| 4971 | case eWNI_SME_MODIFY_ADDITIONAL_IES: |
| 4972 | lim_process_modify_add_ies(pMac, pMsgBuf); |
| 4973 | break; |
| 4974 | case eWNI_SME_SET_HW_MODE_REQ: |
| 4975 | lim_process_set_hw_mode(pMac, pMsgBuf); |
| 4976 | break; |
| 4977 | case eWNI_SME_NSS_UPDATE_REQ: |
| 4978 | lim_process_nss_update_request(pMac, pMsgBuf); |
| 4979 | break; |
| 4980 | case eWNI_SME_SET_DUAL_MAC_CFG_REQ: |
| 4981 | lim_process_set_dual_mac_cfg_req(pMac, pMsgBuf); |
| 4982 | break; |
| 4983 | case eWNI_SME_SET_IE_REQ: |
| 4984 | lim_process_set_ie_req(pMac, pMsgBuf); |
| 4985 | break; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 4986 | case eWNI_SME_EXT_CHANGE_CHANNEL: |
| 4987 | lim_process_ext_change_channel(pMac, pMsgBuf); |
| 4988 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4989 | default: |
| 4990 | cdf_mem_free((void *)pMsg->bodyptr); |
| 4991 | pMsg->bodyptr = NULL; |
| 4992 | break; |
| 4993 | } /* switch (msgType) */ |
| 4994 | |
| 4995 | return bufConsumed; |
| 4996 | } /*** end lim_process_sme_req_messages() ***/ |
| 4997 | |
| 4998 | /** |
| 4999 | * lim_process_sme_start_beacon_req() |
| 5000 | * |
| 5001 | ***FUNCTION: |
| 5002 | * This function is called by limProcessMessageQueue(). This |
| 5003 | * function processes SME request messages from HDD or upper layer |
| 5004 | * application. |
| 5005 | * |
| 5006 | ***LOGIC: |
| 5007 | * |
| 5008 | ***ASSUMPTIONS: |
| 5009 | * |
| 5010 | ***NOTE: |
| 5011 | * |
| 5012 | * @param pMac Pointer to Global MAC structure |
| 5013 | * @param msgType Indicates the SME message type |
| 5014 | * @param *pMsgBuf A pointer to the SME message buffer |
| 5015 | * @return Boolean - true - if pMsgBuf is consumed and can be freed. |
| 5016 | * false - if pMsgBuf is not to be freed. |
| 5017 | */ |
| 5018 | static void lim_process_sme_start_beacon_req(tpAniSirGlobal pMac, uint32_t *pMsg) |
| 5019 | { |
| 5020 | tpSirStartBeaconIndication pBeaconStartInd; |
| 5021 | tpPESession psessionEntry; |
| 5022 | uint8_t sessionId; /* PE sessionID */ |
| 5023 | |
| 5024 | if (pMsg == NULL) { |
| 5025 | lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); |
| 5026 | return; |
| 5027 | } |
| 5028 | |
| 5029 | pBeaconStartInd = (tpSirStartBeaconIndication) pMsg; |
| 5030 | psessionEntry = pe_find_session_by_bssid(pMac, |
| 5031 | pBeaconStartInd->bssid, |
| 5032 | &sessionId); |
| 5033 | if (psessionEntry == NULL) { |
| 5034 | lim_print_mac_addr(pMac, pBeaconStartInd->bssid, LOGE); |
| 5035 | lim_log(pMac, LOGE, |
| 5036 | FL("Session does not exist for given bssId")); |
| 5037 | return; |
| 5038 | } |
| 5039 | |
| 5040 | if (pBeaconStartInd->beaconStartStatus == true) { |
| 5041 | /* |
| 5042 | * Currently this Indication comes from SAP |
| 5043 | * to start Beacon Tx on a DFS channel |
| 5044 | * since beaconing has to be done on DFS |
| 5045 | * channel only after CAC WAIT is completed. |
| 5046 | * On a DFS Channel LIM does not start beacon |
| 5047 | * Tx right after the WMA_ADD_BSS_RSP. |
| 5048 | */ |
| 5049 | lim_apply_configuration(pMac, psessionEntry); |
| 5050 | CDF_TRACE(CDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO, |
| 5051 | FL("Start Beacon with ssid %s Ch %d"), |
| 5052 | psessionEntry->ssId.ssId, |
| 5053 | psessionEntry->currentOperChannel); |
| 5054 | lim_send_beacon_ind(pMac, psessionEntry); |
| 5055 | } else { |
| 5056 | lim_log(pMac, LOGE, FL("Invalid Beacon Start Indication")); |
| 5057 | return; |
| 5058 | } |
| 5059 | } |
| 5060 | |
| 5061 | /** |
| 5062 | * lim_process_sme_channel_change_request() - process sme ch change req |
| 5063 | * |
| 5064 | * @mac_ctx: Pointer to Global MAC structure |
| 5065 | * @msg_buf: pointer to the SME message buffer |
| 5066 | * |
| 5067 | * This function is called to process SME_CHANNEL_CHANGE_REQ message |
| 5068 | * |
| 5069 | * Return: None |
| 5070 | */ |
| 5071 | static void lim_process_sme_channel_change_request(tpAniSirGlobal mac_ctx, |
| 5072 | uint32_t *msg_buf) |
| 5073 | { |
| 5074 | tpSirChanChangeRequest ch_change_req; |
| 5075 | tpPESession session_entry; |
| 5076 | uint8_t session_id; /* PE session_id */ |
| 5077 | tPowerdBm max_tx_pwr; |
| 5078 | uint32_t val = 0; |
| 5079 | |
| 5080 | if (msg_buf == NULL) { |
| 5081 | lim_log(mac_ctx, LOGE, FL("msg_buf is NULL")); |
| 5082 | return; |
| 5083 | } |
| 5084 | ch_change_req = (tpSirChanChangeRequest)msg_buf; |
| 5085 | |
| 5086 | max_tx_pwr = cfg_get_regulatory_max_transmit_power(mac_ctx, |
| 5087 | ch_change_req->targetChannel); |
| 5088 | |
| 5089 | if ((ch_change_req->messageType != eWNI_SME_CHANNEL_CHANGE_REQ) || |
| 5090 | (max_tx_pwr == WMA_MAX_TXPOWER_INVALID)) { |
| 5091 | lim_log(mac_ctx, LOGE, FL("Invalid Request/max_tx_pwr")); |
| 5092 | return; |
| 5093 | } |
| 5094 | |
| 5095 | session_entry = pe_find_session_by_bssid(mac_ctx, |
| 5096 | ch_change_req->bssid, &session_id); |
| 5097 | if (session_entry == NULL) { |
| 5098 | lim_print_mac_addr(mac_ctx, ch_change_req->bssid, LOGE); |
| 5099 | lim_log(mac_ctx, LOGE, FL( |
| 5100 | "Session does not exist for given bssId")); |
| 5101 | return; |
| 5102 | } |
| 5103 | |
| 5104 | if (session_entry->currentOperChannel == |
| 5105 | ch_change_req->targetChannel) { |
| 5106 | lim_log(mac_ctx, LOGE, FL("target CH is same as current CH")); |
| 5107 | return; |
| 5108 | } |
| 5109 | |
| 5110 | if (LIM_IS_AP_ROLE(session_entry)) |
| 5111 | session_entry->channelChangeReasonCode = |
| 5112 | LIM_SWITCH_CHANNEL_SAP_DFS; |
| 5113 | else |
| 5114 | session_entry->channelChangeReasonCode = |
| 5115 | LIM_SWITCH_CHANNEL_OPERATION; |
| 5116 | |
| 5117 | lim_log(mac_ctx, LOGW, FL( |
| 5118 | "switch old chnl %d to new chnl %d, ch_bw %d"), |
| 5119 | session_entry->currentOperChannel, |
| 5120 | ch_change_req->targetChannel, |
| 5121 | ch_change_req->channel_width); |
| 5122 | |
| 5123 | /* Store the New Channel Params in session_entry */ |
| 5124 | session_entry->ch_width = ch_change_req->channel_width; |
| 5125 | session_entry->ch_center_freq_seg0 = |
| 5126 | ch_change_req->center_freq_seg_0; |
| 5127 | session_entry->ch_center_freq_seg1 = |
| 5128 | ch_change_req->center_freq_seg_1; |
| 5129 | session_entry->htSecondaryChannelOffset = ch_change_req->cbMode; |
| 5130 | session_entry->htSupportedChannelWidthSet = |
| 5131 | (ch_change_req->channel_width ? 1 : 0); |
| 5132 | session_entry->htRecommendedTxWidthSet = |
| 5133 | session_entry->htSupportedChannelWidthSet; |
| 5134 | session_entry->currentOperChannel = |
| 5135 | ch_change_req->targetChannel; |
| 5136 | session_entry->limRFBand = |
| 5137 | lim_get_rf_band(session_entry->currentOperChannel); |
| 5138 | /* Initialize 11h Enable Flag */ |
| 5139 | if (SIR_BAND_5_GHZ == session_entry->limRFBand) { |
| 5140 | if (wlan_cfg_get_int(mac_ctx, WNI_CFG_11H_ENABLED, &val) != |
| 5141 | eSIR_SUCCESS) |
| 5142 | lim_log(mac_ctx, LOGP, |
| 5143 | FL("Fail to get WNI_CFG_11H_ENABLED")); |
| 5144 | } |
| 5145 | |
| 5146 | session_entry->lim11hEnable = val; |
| 5147 | session_entry->dot11mode = ch_change_req->dot11mode; |
| 5148 | cdf_mem_copy(&session_entry->rateSet, |
| 5149 | &ch_change_req->operational_rateset, |
| 5150 | sizeof(session_entry->rateSet)); |
| 5151 | cdf_mem_copy(&session_entry->extRateSet, |
| 5152 | &ch_change_req->extended_rateset, |
| 5153 | sizeof(session_entry->extRateSet)); |
| 5154 | lim_set_channel(mac_ctx, ch_change_req->targetChannel, |
| 5155 | session_entry->ch_center_freq_seg0, |
| 5156 | session_entry->ch_center_freq_seg1, |
| 5157 | session_entry->ch_width, |
| 5158 | max_tx_pwr, session_entry->peSessionId); |
| 5159 | } |
| 5160 | |
| 5161 | /****************************************************************************** |
| 5162 | * lim_start_bss_update_add_ie_buffer() |
| 5163 | * |
| 5164 | ***FUNCTION: |
| 5165 | * This function checks the src buffer and its length and then malloc for |
| 5166 | * dst buffer update the same |
| 5167 | * |
| 5168 | ***LOGIC: |
| 5169 | * |
| 5170 | ***ASSUMPTIONS: |
| 5171 | * |
| 5172 | ***NOTE: |
| 5173 | * |
| 5174 | * @param pMac Pointer to Global MAC structure |
| 5175 | * @param **pDstData_buff A pointer to pointer of uint8_t dst buffer |
| 5176 | * @param *pDstDataLen A pointer to pointer of uint16_t dst buffer length |
| 5177 | * @param *pSrcData_buff A pointer of uint8_t src buffer |
| 5178 | * @param srcDataLen src buffer length |
| 5179 | ******************************************************************************/ |
| 5180 | |
| 5181 | static void |
| 5182 | lim_start_bss_update_add_ie_buffer(tpAniSirGlobal pMac, |
| 5183 | uint8_t **pDstData_buff, |
| 5184 | uint16_t *pDstDataLen, |
| 5185 | uint8_t *pSrcData_buff, uint16_t srcDataLen) |
| 5186 | { |
| 5187 | |
| 5188 | if (srcDataLen > 0 && pSrcData_buff != NULL) { |
| 5189 | *pDstDataLen = srcDataLen; |
| 5190 | |
| 5191 | *pDstData_buff = cdf_mem_malloc(*pDstDataLen); |
| 5192 | |
| 5193 | if (NULL == *pDstData_buff) { |
| 5194 | lim_log(pMac, LOGE, |
| 5195 | FL("AllocateMemory failed for pDstData_buff")); |
| 5196 | return; |
| 5197 | } |
| 5198 | cdf_mem_copy(*pDstData_buff, pSrcData_buff, *pDstDataLen); |
| 5199 | } else { |
| 5200 | *pDstData_buff = NULL; |
| 5201 | *pDstDataLen = 0; |
| 5202 | } |
| 5203 | } |
| 5204 | |
| 5205 | /****************************************************************************** |
| 5206 | * lim_update_add_ie_buffer() |
| 5207 | * |
| 5208 | ***FUNCTION: |
| 5209 | * This function checks the src buffer and length if src buffer length more |
| 5210 | * than dst buffer length then free the dst buffer and malloc for the new src |
| 5211 | * length, and update the dst buffer and length. But if dst buffer is bigger |
| 5212 | * than src buffer length then it just update the dst buffer and length |
| 5213 | * |
| 5214 | ***LOGIC: |
| 5215 | * |
| 5216 | ***ASSUMPTIONS: |
| 5217 | * |
| 5218 | ***NOTE: |
| 5219 | * |
| 5220 | * @param pMac Pointer to Global MAC structure |
| 5221 | * @param **pDstData_buff A pointer to pointer of uint8_t dst buffer |
| 5222 | * @param *pDstDataLen A pointer to pointer of uint16_t dst buffer length |
| 5223 | * @param *pSrcData_buff A pointer of uint8_t src buffer |
| 5224 | * @param srcDataLen src buffer length |
| 5225 | ******************************************************************************/ |
| 5226 | |
| 5227 | static void |
| 5228 | lim_update_add_ie_buffer(tpAniSirGlobal pMac, |
| 5229 | uint8_t **pDstData_buff, |
| 5230 | uint16_t *pDstDataLen, |
| 5231 | uint8_t *pSrcData_buff, uint16_t srcDataLen) |
| 5232 | { |
| 5233 | |
| 5234 | if (NULL == pSrcData_buff) { |
| 5235 | lim_log(pMac, LOGE, FL("src buffer is null.")); |
| 5236 | return; |
| 5237 | } |
| 5238 | |
| 5239 | if (srcDataLen > *pDstDataLen) { |
| 5240 | *pDstDataLen = srcDataLen; |
| 5241 | /* free old buffer */ |
| 5242 | cdf_mem_free(*pDstData_buff); |
| 5243 | /* allocate a new */ |
| 5244 | *pDstData_buff = cdf_mem_malloc(*pDstDataLen); |
| 5245 | |
| 5246 | if (NULL == *pDstData_buff) { |
| 5247 | lim_log(pMac, LOGE, FL("Memory allocation failed.")); |
| 5248 | *pDstDataLen = 0; |
| 5249 | return; |
| 5250 | } |
| 5251 | } |
| 5252 | |
| 5253 | /* copy the content of buffer into dst buffer |
| 5254 | */ |
| 5255 | *pDstDataLen = srcDataLen; |
| 5256 | cdf_mem_copy(*pDstData_buff, pSrcData_buff, *pDstDataLen); |
| 5257 | |
| 5258 | } |
| 5259 | |
| 5260 | /* |
| 5261 | * lim_process_modify_add_ies() - process modify additional IE req. |
| 5262 | * |
| 5263 | * @mac_ctx: Pointer to Global MAC structure |
| 5264 | * @msg_buf: pointer to the SME message buffer |
| 5265 | * |
| 5266 | * This function update the PE buffers for additional IEs. |
| 5267 | * |
| 5268 | * Return: None |
| 5269 | */ |
| 5270 | static void lim_process_modify_add_ies(tpAniSirGlobal mac_ctx, |
| 5271 | uint32_t *msg_buf) |
| 5272 | { |
| 5273 | tpSirModifyIEsInd modify_add_ies; |
| 5274 | tpPESession session_entry; |
| 5275 | uint8_t session_id; |
| 5276 | bool ret = false; |
| 5277 | tSirAddIeParams *add_ie_params; |
| 5278 | |
| 5279 | if (msg_buf == NULL) { |
| 5280 | lim_log(mac_ctx, LOGE, FL("msg_buf is NULL")); |
| 5281 | return; |
| 5282 | } |
| 5283 | |
| 5284 | modify_add_ies = (tpSirModifyIEsInd)msg_buf; |
| 5285 | /* Incoming message has smeSession, use BSSID to find PE session */ |
| 5286 | session_entry = pe_find_session_by_bssid(mac_ctx, |
Srinivas Girigowda | 34b634c | 2015-11-18 22:22:01 -0800 | [diff] [blame] | 5287 | modify_add_ies->modifyIE.bssid.bytes, &session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5288 | |
| 5289 | if (NULL == session_entry) { |
| 5290 | lim_log(mac_ctx, LOGE, FL("Session not found for given bssid. " |
| 5291 | MAC_ADDRESS_STR), |
Srinivas Girigowda | 34b634c | 2015-11-18 22:22:01 -0800 | [diff] [blame] | 5292 | MAC_ADDR_ARRAY(modify_add_ies->modifyIE.bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5293 | goto end; |
| 5294 | } |
| 5295 | if ((0 == modify_add_ies->modifyIE.ieBufferlength) || |
| 5296 | (0 == modify_add_ies->modifyIE.ieIDLen) || |
| 5297 | (NULL == modify_add_ies->modifyIE.pIEBuffer)) { |
| 5298 | lim_log(mac_ctx, LOGE, |
| 5299 | FL("Invalid request pIEBuffer %p ieBufferlength %d ieIDLen %d ieID %d. update Type %d"), |
| 5300 | modify_add_ies->modifyIE.pIEBuffer, |
| 5301 | modify_add_ies->modifyIE.ieBufferlength, |
| 5302 | modify_add_ies->modifyIE.ieID, |
| 5303 | modify_add_ies->modifyIE.ieIDLen, |
| 5304 | modify_add_ies->updateType); |
| 5305 | goto end; |
| 5306 | } |
| 5307 | add_ie_params = &session_entry->addIeParams; |
| 5308 | switch (modify_add_ies->updateType) { |
| 5309 | case eUPDATE_IE_PROBE_RESP: |
| 5310 | /* Probe resp */ |
| 5311 | break; |
| 5312 | case eUPDATE_IE_ASSOC_RESP: |
| 5313 | /* assoc resp IE */ |
| 5314 | if (add_ie_params->assocRespDataLen == 0) { |
| 5315 | CDF_TRACE(CDF_MODULE_ID_PE, |
| 5316 | CDF_TRACE_LEVEL_ERROR, FL( |
| 5317 | "assoc resp add ie not present %d"), |
| 5318 | add_ie_params->assocRespDataLen); |
| 5319 | } |
| 5320 | /* search through the buffer and modify the IE */ |
| 5321 | break; |
| 5322 | case eUPDATE_IE_PROBE_BCN: |
| 5323 | /*probe beacon IE */ |
| 5324 | if (ret == true && modify_add_ies->modifyIE.notify) { |
| 5325 | lim_handle_param_update(mac_ctx, |
| 5326 | modify_add_ies->updateType); |
| 5327 | } |
| 5328 | break; |
| 5329 | default: |
| 5330 | lim_log(mac_ctx, LOGE, FL("unhandled buffer type %d"), |
| 5331 | modify_add_ies->updateType); |
| 5332 | break; |
| 5333 | } |
| 5334 | end: |
| 5335 | cdf_mem_free(modify_add_ies->modifyIE.pIEBuffer); |
| 5336 | modify_add_ies->modifyIE.pIEBuffer = NULL; |
| 5337 | } |
| 5338 | |
| 5339 | /* |
| 5340 | * lim_process_update_add_ies() - process additional IE update req |
| 5341 | * |
| 5342 | * @mac_ctx: Pointer to Global MAC structure |
| 5343 | * @msg_buf: pointer to the SME message buffer |
| 5344 | * |
| 5345 | * This function update the PE buffers for additional IEs. |
| 5346 | * |
| 5347 | * Return: None |
| 5348 | */ |
| 5349 | static void lim_process_update_add_ies(tpAniSirGlobal mac_ctx, |
| 5350 | uint32_t *msg_buf) |
| 5351 | { |
| 5352 | tpSirUpdateIEsInd update_add_ies = (tpSirUpdateIEsInd)msg_buf; |
| 5353 | uint8_t session_id; |
| 5354 | tpPESession session_entry; |
| 5355 | tSirAddIeParams *addn_ie; |
| 5356 | uint16_t new_length = 0; |
| 5357 | uint8_t *new_ptr = NULL; |
| 5358 | tSirUpdateIE *update_ie; |
| 5359 | |
| 5360 | if (msg_buf == NULL) { |
| 5361 | lim_log(mac_ctx, LOGE, FL("msg_buf is NULL")); |
| 5362 | return; |
| 5363 | } |
| 5364 | update_ie = &update_add_ies->updateIE; |
| 5365 | /* incoming message has smeSession, use BSSID to find PE session */ |
| 5366 | session_entry = pe_find_session_by_bssid(mac_ctx, |
Srinivas Girigowda | 8b98396 | 2015-11-18 22:14:34 -0800 | [diff] [blame] | 5367 | update_ie->bssid.bytes, &session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5368 | |
| 5369 | if (NULL == session_entry) { |
| 5370 | lim_log(mac_ctx, LOGE, FL("Session not found for given bssid. " |
| 5371 | MAC_ADDRESS_STR), |
Srinivas Girigowda | 8b98396 | 2015-11-18 22:14:34 -0800 | [diff] [blame] | 5372 | MAC_ADDR_ARRAY(update_ie->bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5373 | goto end; |
| 5374 | } |
| 5375 | addn_ie = &session_entry->addIeParams; |
| 5376 | /* if len is 0, upper layer requested freeing of buffer */ |
| 5377 | if (0 == update_ie->ieBufferlength) { |
| 5378 | switch (update_add_ies->updateType) { |
| 5379 | case eUPDATE_IE_PROBE_RESP: |
| 5380 | cdf_mem_free(addn_ie->probeRespData_buff); |
| 5381 | addn_ie->probeRespData_buff = NULL; |
| 5382 | addn_ie->probeRespDataLen = 0; |
| 5383 | break; |
| 5384 | case eUPDATE_IE_ASSOC_RESP: |
| 5385 | cdf_mem_free(addn_ie->assocRespData_buff); |
| 5386 | addn_ie->assocRespData_buff = NULL; |
| 5387 | addn_ie->assocRespDataLen = 0; |
| 5388 | break; |
| 5389 | case eUPDATE_IE_PROBE_BCN: |
| 5390 | cdf_mem_free(addn_ie->probeRespBCNData_buff); |
| 5391 | addn_ie->probeRespBCNData_buff = NULL; |
| 5392 | addn_ie->probeRespBCNDataLen = 0; |
| 5393 | |
| 5394 | if (update_ie->notify) |
| 5395 | lim_handle_param_update(mac_ctx, |
| 5396 | update_add_ies->updateType); |
| 5397 | break; |
| 5398 | default: |
| 5399 | break; |
| 5400 | } |
| 5401 | return; |
| 5402 | } |
| 5403 | switch (update_add_ies->updateType) { |
| 5404 | case eUPDATE_IE_PROBE_RESP: |
| 5405 | if (update_ie->append) { |
| 5406 | /* |
| 5407 | * In case of append, allocate new memory |
| 5408 | * with combined length |
| 5409 | */ |
| 5410 | new_length = update_ie->ieBufferlength + |
| 5411 | addn_ie->probeRespDataLen; |
| 5412 | new_ptr = cdf_mem_malloc(new_length); |
| 5413 | if (NULL == new_ptr) { |
| 5414 | lim_log(mac_ctx, LOGE, FL( |
| 5415 | "Memory allocation failed.")); |
| 5416 | goto end; |
| 5417 | } |
| 5418 | /* append buffer to end of local buffers */ |
| 5419 | cdf_mem_copy(new_ptr, addn_ie->probeRespData_buff, |
| 5420 | addn_ie->probeRespDataLen); |
| 5421 | cdf_mem_copy(&new_ptr[addn_ie->probeRespDataLen], |
| 5422 | update_ie->pAdditionIEBuffer, |
| 5423 | update_ie->ieBufferlength); |
| 5424 | /* free old memory */ |
| 5425 | cdf_mem_free(addn_ie->probeRespData_buff); |
| 5426 | /* adjust length accordingly */ |
| 5427 | addn_ie->probeRespDataLen = new_length; |
| 5428 | /* save refernece of local buffer in PE session */ |
| 5429 | addn_ie->probeRespData_buff = new_ptr; |
| 5430 | goto end; |
| 5431 | } |
| 5432 | lim_update_add_ie_buffer(mac_ctx, &addn_ie->probeRespData_buff, |
| 5433 | &addn_ie->probeRespDataLen, |
| 5434 | update_ie->pAdditionIEBuffer, |
| 5435 | update_ie->ieBufferlength); |
| 5436 | break; |
| 5437 | case eUPDATE_IE_ASSOC_RESP: |
| 5438 | /* assoc resp IE */ |
| 5439 | lim_update_add_ie_buffer(mac_ctx, &addn_ie->assocRespData_buff, |
| 5440 | &addn_ie->assocRespDataLen, |
| 5441 | update_ie->pAdditionIEBuffer, |
| 5442 | update_ie->ieBufferlength); |
| 5443 | break; |
| 5444 | case eUPDATE_IE_PROBE_BCN: |
| 5445 | /* probe resp Bcn IE */ |
| 5446 | lim_update_add_ie_buffer(mac_ctx, |
| 5447 | &addn_ie->probeRespBCNData_buff, |
| 5448 | &addn_ie->probeRespBCNDataLen, |
| 5449 | update_ie->pAdditionIEBuffer, |
| 5450 | update_ie->ieBufferlength); |
| 5451 | if (update_ie->notify) |
| 5452 | lim_handle_param_update(mac_ctx, |
| 5453 | update_add_ies->updateType); |
| 5454 | break; |
| 5455 | default: |
| 5456 | lim_log(mac_ctx, LOGE, FL("unhandled buffer type %d."), |
| 5457 | update_add_ies->updateType); |
| 5458 | break; |
| 5459 | } |
| 5460 | end: |
| 5461 | cdf_mem_free(update_ie->pAdditionIEBuffer); |
| 5462 | update_ie->pAdditionIEBuffer = NULL; |
| 5463 | } |
| 5464 | |
| 5465 | /** |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 5466 | * send_extended_chan_switch_action_frame()- function to send ECSA |
| 5467 | * action frame for each sta connected to SAP/GO and AP in case of |
| 5468 | * STA . |
| 5469 | * @mac_ctx: pointer to global mac structure |
| 5470 | * @new_channel: new channel to switch to. |
| 5471 | * @ch_bandwidth: BW of channel to calculate op_class |
| 5472 | * @session_entry: pe session |
| 5473 | * |
| 5474 | * This function is called to send ECSA frame for STA/CLI and SAP/GO. |
| 5475 | * |
| 5476 | * Return: void |
| 5477 | */ |
| 5478 | |
| 5479 | static void send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, |
| 5480 | uint16_t new_channel, uint8_t ch_bandwidth, |
| 5481 | tpPESession session_entry) |
| 5482 | { |
| 5483 | uint16_t op_class; |
| 5484 | uint8_t switch_mode = 0, i; |
| 5485 | tpDphHashNode psta; |
| 5486 | |
| 5487 | |
| 5488 | op_class = cds_regdm_get_opclass_from_channel( |
| 5489 | mac_ctx->scan.countryCodeCurrent, |
| 5490 | new_channel, |
| 5491 | ch_bandwidth); |
| 5492 | |
| 5493 | if (LIM_IS_AP_ROLE(session_entry) && |
| 5494 | (mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch == false)) |
| 5495 | switch_mode = 1; |
| 5496 | |
| 5497 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 5498 | for (i = 0; i < mac_ctx->lim.maxStation; i++) { |
| 5499 | psta = |
| 5500 | session_entry->dph.dphHashTable.pDphNodeArray + i; |
| 5501 | if (psta && psta->added) |
| 5502 | lim_send_extended_chan_switch_action_frame( |
| 5503 | mac_ctx, |
| 5504 | psta->staAddr, |
| 5505 | switch_mode, op_class, new_channel, |
| 5506 | LIM_MAX_CSA_IE_UPDATES, session_entry); |
| 5507 | } |
| 5508 | } else if (LIM_IS_STA_ROLE(session_entry)) { |
| 5509 | lim_send_extended_chan_switch_action_frame(mac_ctx, |
| 5510 | session_entry->bssId, |
| 5511 | switch_mode, op_class, new_channel, |
| 5512 | LIM_MAX_CSA_IE_UPDATES, session_entry); |
| 5513 | } |
| 5514 | |
| 5515 | } |
| 5516 | |
| 5517 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5518 | * lim_process_sme_dfs_csa_ie_request() - process sme dfs csa ie req |
| 5519 | * |
| 5520 | * @mac_ctx: Pointer to Global MAC structure |
| 5521 | * @msg_buf: pointer to the SME message buffer |
| 5522 | * |
| 5523 | * This function processes SME request messages from HDD or upper layer |
| 5524 | * application. |
| 5525 | * |
| 5526 | * Return: None |
| 5527 | */ |
| 5528 | static void lim_process_sme_dfs_csa_ie_request(tpAniSirGlobal mac_ctx, |
| 5529 | uint32_t *msg_buf) |
| 5530 | { |
| 5531 | tpSirDfsCsaIeRequest dfs_csa_ie_req; |
| 5532 | tpPESession session_entry = NULL; |
| 5533 | uint32_t ch_width = 0; |
| 5534 | uint8_t session_id; |
| 5535 | tLimWiderBWChannelSwitchInfo *wider_bw_ch_switch; |
| 5536 | |
| 5537 | if (msg_buf == NULL) { |
| 5538 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 5539 | return; |
| 5540 | } |
| 5541 | |
| 5542 | dfs_csa_ie_req = (tSirDfsCsaIeRequest *)msg_buf; |
| 5543 | session_entry = pe_find_session_by_bssid(mac_ctx, |
| 5544 | dfs_csa_ie_req->bssid, &session_id); |
| 5545 | if (session_entry == NULL) { |
| 5546 | lim_log(mac_ctx, LOGE, FL( |
| 5547 | "Session not found for given BSSID" MAC_ADDRESS_STR), |
| 5548 | MAC_ADDR_ARRAY(dfs_csa_ie_req->bssid)); |
| 5549 | return; |
| 5550 | } |
| 5551 | |
| 5552 | if (session_entry->valid && !LIM_IS_AP_ROLE(session_entry)) { |
| 5553 | lim_log(mac_ctx, LOGE, FL("Invalid SystemRole %d"), |
| 5554 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 5555 | return; |
| 5556 | } |
| 5557 | |
| 5558 | /* target channel */ |
| 5559 | session_entry->gLimChannelSwitch.primaryChannel = |
| 5560 | dfs_csa_ie_req->targetChannel; |
| 5561 | |
| 5562 | /* Channel switch announcement needs to be included in beacon */ |
| 5563 | session_entry->dfsIncludeChanSwIe = true; |
| 5564 | session_entry->gLimChannelSwitch.switchCount = LIM_MAX_CSA_IE_UPDATES; |
| 5565 | session_entry->gLimChannelSwitch.ch_width = |
| 5566 | dfs_csa_ie_req->ch_bandwidth; |
| 5567 | if (mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch == false) |
| 5568 | session_entry->gLimChannelSwitch.switchMode = 1; |
| 5569 | |
| 5570 | /* |
| 5571 | * Validate if SAP is operating HT or VHT mode and set the Channel |
| 5572 | * Switch Wrapper element with the Wide Band Switch subelement. |
| 5573 | */ |
| 5574 | if (true != session_entry->vhtCapability) |
| 5575 | goto skip_vht; |
| 5576 | |
| 5577 | if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ == |
| 5578 | session_entry->vhtTxChannelWidthSet) |
| 5579 | ch_width = eHT_CHANNEL_WIDTH_80MHZ; |
| 5580 | else if (WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ == |
| 5581 | session_entry->vhtTxChannelWidthSet) |
| 5582 | ch_width = session_entry->htSupportedChannelWidthSet; |
| 5583 | /* Now encode the Wider Ch BW element depending on the ch width */ |
| 5584 | wider_bw_ch_switch = &session_entry->gLimWiderBWChannelSwitch; |
| 5585 | switch (ch_width) { |
| 5586 | case eHT_CHANNEL_WIDTH_20MHZ: |
| 5587 | /* |
| 5588 | * Wide channel BW sublement in channel wrapper element is not |
| 5589 | * required in case of 20 Mhz operation. Currently It is set |
| 5590 | * only set in case of 40/80 Mhz Operation. |
| 5591 | */ |
| 5592 | session_entry->dfsIncludeChanWrapperIe = false; |
| 5593 | wider_bw_ch_switch->newChanWidth = |
| 5594 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ; |
| 5595 | break; |
| 5596 | case eHT_CHANNEL_WIDTH_40MHZ: |
| 5597 | session_entry->dfsIncludeChanWrapperIe = true; |
| 5598 | wider_bw_ch_switch->newChanWidth = |
| 5599 | WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ; |
| 5600 | break; |
| 5601 | case eHT_CHANNEL_WIDTH_80MHZ: |
| 5602 | session_entry->dfsIncludeChanWrapperIe = true; |
| 5603 | wider_bw_ch_switch->newChanWidth = |
| 5604 | WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ; |
| 5605 | break; |
| 5606 | case eHT_CHANNEL_WIDTH_160MHZ: |
| 5607 | session_entry->dfsIncludeChanWrapperIe = true; |
| 5608 | wider_bw_ch_switch->newChanWidth = |
| 5609 | WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ; |
| 5610 | break; |
| 5611 | default: |
| 5612 | session_entry->dfsIncludeChanWrapperIe = false; |
| 5613 | /* |
| 5614 | * Need to handle 80+80 Mhz Scenario. When 80+80 is supported |
| 5615 | * set the gLimWiderBWChannelSwitch.newChanWidth to 3 |
| 5616 | */ |
| 5617 | lim_log(mac_ctx, LOGE, FL("Invalid Channel Width")); |
| 5618 | break; |
| 5619 | } |
| 5620 | /* Fetch the center channel based on the channel width */ |
| 5621 | wider_bw_ch_switch->newCenterChanFreq0 = |
| 5622 | lim_get_center_channel(mac_ctx, dfs_csa_ie_req->targetChannel, |
| 5623 | session_entry->htSecondaryChannelOffset, |
| 5624 | wider_bw_ch_switch->newChanWidth); |
| 5625 | /* |
| 5626 | * This is not applicable for 20/40/80 Mhz.Only used when we support |
| 5627 | * 80+80 Mhz operation. In case of 80+80 Mhz, this parameter indicates |
| 5628 | * center channel frequency index of 80 Mhz channel of |
| 5629 | * frequency segment 1. |
| 5630 | */ |
| 5631 | wider_bw_ch_switch->newCenterChanFreq1 = 0; |
| 5632 | skip_vht: |
| 5633 | /* Send CSA IE request from here */ |
| 5634 | if (sch_set_fixed_beacon_fields(mac_ctx, session_entry) != |
| 5635 | eSIR_SUCCESS) { |
| 5636 | lim_log(mac_ctx, LOGE, FL("Unable to set CSA IE in beacon")); |
| 5637 | return; |
| 5638 | } |
| 5639 | |
| 5640 | /* |
| 5641 | * First beacon update request is sent here, the remaining updates are |
| 5642 | * done when the FW responds back after sending the first beacon after |
| 5643 | * the template update |
| 5644 | */ |
| 5645 | lim_send_beacon_ind(mac_ctx, session_entry); |
| 5646 | lim_log(mac_ctx, LOG1, FL("Updated CSA IE, IE COUNT = %d"), |
| 5647 | session_entry->gLimChannelSwitch.switchCount); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 5648 | /* Send ECSA Action frame after updating the beacon */ |
| 5649 | send_extended_chan_switch_action_frame(mac_ctx, |
| 5650 | session_entry->gLimChannelSwitch.primaryChannel, |
| 5651 | session_entry->gLimChannelSwitch.ch_width, |
| 5652 | session_entry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5653 | session_entry->gLimChannelSwitch.switchCount--; |
| 5654 | } |
| 5655 | |
| 5656 | /** |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 5657 | * lim_process_ext_change_channel()- function to send ECSA |
| 5658 | * action frame for STA/CLI . |
| 5659 | * @mac_ctx: pointer to global mac structure |
| 5660 | * @msg: params from sme for new channel. |
| 5661 | * |
| 5662 | * This function is called to send ECSA frame for STA/CLI. |
| 5663 | * |
| 5664 | * Return: void |
| 5665 | */ |
| 5666 | |
| 5667 | static void lim_process_ext_change_channel(tpAniSirGlobal mac_ctx, |
| 5668 | uint32_t *msg) |
| 5669 | { |
| 5670 | struct sir_sme_ext_cng_chan_req *ext_chng_channel = |
| 5671 | (struct sir_sme_ext_cng_chan_req *) msg; |
| 5672 | tpPESession session_entry = NULL; |
| 5673 | |
| 5674 | if (NULL == msg) { |
| 5675 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 5676 | return; |
| 5677 | } |
| 5678 | session_entry = |
| 5679 | pe_find_session_by_sme_session_id(mac_ctx, |
| 5680 | ext_chng_channel->session_id); |
| 5681 | if (NULL == session_entry) { |
| 5682 | lim_log(mac_ctx, LOGE, |
| 5683 | FL("Session not found for given session %d"), |
| 5684 | ext_chng_channel->session_id); |
| 5685 | return; |
| 5686 | } |
| 5687 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 5688 | lim_log(mac_ctx, LOGE, |
| 5689 | FL("not an STA/CLI session")); |
| 5690 | return; |
| 5691 | } |
| 5692 | send_extended_chan_switch_action_frame(mac_ctx, |
| 5693 | ext_chng_channel->new_channel, |
| 5694 | 0, session_entry); |
| 5695 | } |
| 5696 | |
| 5697 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5698 | * lim_process_nss_update_request() - process sme nss update req |
| 5699 | * |
| 5700 | * @mac_ctx: Pointer to Global MAC structure |
| 5701 | * @msg_buf: pointer to the SME message buffer |
| 5702 | * |
| 5703 | * This function processes SME request messages from HDD or upper layer |
| 5704 | * application. |
| 5705 | * |
| 5706 | * Return: None |
| 5707 | */ |
| 5708 | static void lim_process_nss_update_request(tpAniSirGlobal mac_ctx, |
| 5709 | uint32_t *msg_buf) |
| 5710 | { |
| 5711 | struct sir_nss_update_request *nss_update_req_ptr; |
| 5712 | tpPESession session_entry = NULL; |
| 5713 | |
| 5714 | if (msg_buf == NULL) { |
| 5715 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 5716 | return; |
| 5717 | } |
| 5718 | |
| 5719 | nss_update_req_ptr = (struct sir_nss_update_request *)msg_buf; |
| 5720 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 5721 | nss_update_req_ptr->vdev_id); |
| 5722 | if (session_entry == NULL) { |
| 5723 | lim_log(mac_ctx, LOGE, FL( |
| 5724 | "Session not found for given session_id %d"), |
| 5725 | nss_update_req_ptr->vdev_id); |
| 5726 | return; |
| 5727 | } |
| 5728 | |
| 5729 | if (session_entry->valid && !LIM_IS_AP_ROLE(session_entry)) { |
| 5730 | lim_log(mac_ctx, LOGE, FL("Invalid SystemRole %d"), |
| 5731 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 5732 | return; |
| 5733 | } |
| 5734 | |
| 5735 | /* populate nss field in the beacon */ |
| 5736 | session_entry->gLimOperatingMode.present = 1; |
| 5737 | session_entry->gLimOperatingMode.rxNSS = nss_update_req_ptr->new_nss; |
| 5738 | /* Send nss update request from here */ |
| 5739 | if (sch_set_fixed_beacon_fields(mac_ctx, session_entry) != |
| 5740 | eSIR_SUCCESS) { |
| 5741 | lim_log(mac_ctx, LOGE, |
| 5742 | FL("Unable to set op mode IE in beacon")); |
| 5743 | return; |
| 5744 | } |
| 5745 | |
| 5746 | lim_send_beacon_ind(mac_ctx, session_entry); |
| 5747 | } |
| 5748 | |
| 5749 | /** |
| 5750 | * lim_process_set_ie_req() - process sme set IE request |
| 5751 | * |
| 5752 | * @mac_ctx: Pointer to Global MAC structure |
| 5753 | * @msg_buf: pointer to the SME message buffer |
| 5754 | * |
| 5755 | * This function processes SME request messages from HDD or upper layer |
| 5756 | * application. |
| 5757 | * |
| 5758 | * Return: None |
| 5759 | */ |
| 5760 | static void lim_process_set_ie_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) |
| 5761 | { |
| 5762 | struct send_extcap_ie *msg; |
| 5763 | CDF_STATUS status; |
| 5764 | |
| 5765 | if (msg_buf == NULL) { |
| 5766 | lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); |
| 5767 | return; |
| 5768 | } |
| 5769 | |
| 5770 | msg = (struct send_extcap_ie *)msg_buf; |
| 5771 | status = lim_send_ext_cap_ie(mac_ctx, msg->session_id, NULL, false); |
| 5772 | if (CDF_STATUS_SUCCESS != status) |
| 5773 | lim_log(mac_ctx, LOGE, FL("Unable to send ExtCap to FW")); |
| 5774 | |
| 5775 | } |