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