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