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