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