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