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