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