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