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