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