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