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