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