blob: 6a485ab3a026723ed506c100dd1c6a3051f2422f [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Himanshu Agarwal2fdf77a2016-12-29 11:41:00 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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 Natarajanf599c6e2015-11-03 11:44:03 -080059#include "rrm_api.h"
Deepak Dhamdhere0f076bd2016-06-02 11:29:21 -070060#include "nan_datapath.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061
62#include "sap_api.h"
63
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080064
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065#include <lim_ft.h>
Naveen Rawat3b6068c2016-04-14 19:01:06 -070066#include "cds_regdomain.h"
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053067#include "lim_process_fils.h"
Naveen Rawat08db88f2017-09-08 15:07:48 -070068#include "wlan_utility.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080069
70/*
71 * This overhead is time for sending NOA start to host in case of GO/sending
72 * NULL data & receiving ACK in case of P2P Client and starting actual scanning
73 * with init scan req/rsp plus in case of concurrency, taking care of sending
74 * null data and receiving ACK to/from AP/Also SetChannel with calibration
75 * is taking around 7ms .
76 */
77#define SCAN_MESSAGING_OVERHEAD 20 /* in msecs */
78#define JOIN_NOA_DURATION 2000 /* in msecs */
79#define OEM_DATA_NOA_DURATION 60 /* in msecs */
80#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 /* in msecs */
81
82#define CONV_MS_TO_US 1024 /* conversion factor from ms to us */
83
Paul Zhangd2315472017-02-22 10:02:50 +080084#define BEACON_INTERVAL_THRESHOLD 50 /* in msecs */
85#define STA_BURST_SCAN_DURATION 120 /* in msecs */
86
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080087/* SME REQ processing function templates */
88static bool __lim_process_sme_sys_ready_ind(tpAniSirGlobal, uint32_t *);
Rajeev Kumarfeb96382017-01-22 19:42:09 -080089static bool __lim_process_sme_start_bss_req(tpAniSirGlobal,
90 struct scheduler_msg *pMsg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080091static void __lim_process_sme_scan_req(tpAniSirGlobal, uint32_t *);
92static void __lim_process_sme_join_req(tpAniSirGlobal, uint32_t *);
93static void __lim_process_sme_reassoc_req(tpAniSirGlobal, uint32_t *);
94static void __lim_process_sme_disassoc_req(tpAniSirGlobal, uint32_t *);
95static void __lim_process_sme_disassoc_cnf(tpAniSirGlobal, uint32_t *);
96static void __lim_process_sme_deauth_req(tpAniSirGlobal, uint32_t *);
97static void __lim_process_sme_set_context_req(tpAniSirGlobal, uint32_t *);
Rajeev Kumarfeb96382017-01-22 19:42:09 -080098static bool __lim_process_sme_stop_bss_req(tpAniSirGlobal,
99 struct scheduler_msg *pMsg);
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +0530100static void __lim_process_send_disassoc_frame(tpAniSirGlobal mac_ctx,
101 uint32_t *msg_buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800102static void lim_process_sme_channel_change_request(tpAniSirGlobal pMac,
103 uint32_t *pMsg);
104static void lim_process_sme_start_beacon_req(tpAniSirGlobal pMac, uint32_t *pMsg);
105static void lim_process_sme_dfs_csa_ie_request(tpAniSirGlobal pMac, uint32_t *pMsg);
106static void lim_process_nss_update_request(tpAniSirGlobal pMac, uint32_t *pMsg);
107static void lim_process_set_ie_req(tpAniSirGlobal pMac, uint32_t *pMsg);
108
109static void lim_start_bss_update_add_ie_buffer(tpAniSirGlobal pMac,
110 uint8_t **pDstData_buff,
111 uint16_t *pDstDataLen,
112 uint8_t *pSrcData_buff,
113 uint16_t srcDataLen);
114
115static void lim_update_add_ie_buffer(tpAniSirGlobal pMac,
116 uint8_t **pDstData_buff,
117 uint16_t *pDstDataLen,
118 uint8_t *pSrcData_buff, uint16_t srcDataLen);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -0800119static bool lim_update_ibss_prop_add_ies(tpAniSirGlobal pMac,
120 uint8_t **pDstData_buff,
121 uint16_t *pDstDataLen,
122 tSirModifyIE *pModifyIE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800123static void lim_process_modify_add_ies(tpAniSirGlobal pMac, uint32_t *pMsg);
124
125static void lim_process_update_add_ies(tpAniSirGlobal pMac, uint32_t *pMsg);
126
Abhishek Singh518323d2015-10-19 17:42:01 +0530127static void lim_process_ext_change_channel(tpAniSirGlobal mac_ctx,
128 uint32_t *msg);
129
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800130/**
131 * lim_process_set_hw_mode() - Send set HW mode command to WMA
132 * @mac: Globacl MAC pointer
133 * @msg: Message containing the hw mode index
134 *
135 * Send the set HW mode command to WMA
136 *
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530137 * Return: QDF_STATUS_SUCCESS if message posting is successful
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800138 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530139static QDF_STATUS lim_process_set_hw_mode(tpAniSirGlobal mac, uint32_t *msg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530141 QDF_STATUS status = QDF_STATUS_SUCCESS;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700142 struct scheduler_msg message = {0};
Tushnim Bhattacharyya66348bd2017-03-09 15:02:10 -0800143 struct policy_mgr_hw_mode *req_msg;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144 uint32_t len;
145 struct s_sir_set_hw_mode *buf;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700146 struct scheduler_msg resp_msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800147 struct sir_set_hw_mode_resp *param;
148
149 buf = (struct s_sir_set_hw_mode *) msg;
150 if (!buf) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700151 pe_err("Set HW mode param is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152 /* To free the active command list */
153 goto fail;
154 }
155
156 len = sizeof(*req_msg);
157
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530158 req_msg = qdf_mem_malloc(len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800159 if (!req_msg) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700160 pe_err("qdf_mem_malloc failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800161 /* Free the active command list
162 * Probably the malloc is going to fail there as well?!
163 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530164 return QDF_STATUS_E_NOMEM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800165 }
166
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800167 req_msg->hw_mode_index = buf->set_hw.hw_mode_index;
Chandrasekaran, Manishekaref70c0d2015-10-20 19:54:55 +0530168 req_msg->reason = buf->set_hw.reason;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800169 /* Other parameters are not needed for WMA */
170
Rajeev Kumarf7d84422017-01-21 15:45:44 -0800171 message.bodyptr = req_msg;
172 message.type = SIR_HAL_PDEV_SET_HW_MODE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700174 pe_debug("Posting SIR_HAL_SOC_SET_HW_MOD to WMA");
Rajeev Kumarf7d84422017-01-21 15:45:44 -0800175 status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530176 if (!QDF_IS_STATUS_SUCCESS(status)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700177 pe_err("scheduler_post_msg failed!(err=%d)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800178 status);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530179 qdf_mem_free(req_msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800180 goto fail;
181 }
182 return status;
183fail:
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530184 param = qdf_mem_malloc(sizeof(*param));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185 if (!param) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700186 pe_err("HW mode resp failed");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530187 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800188 }
189 param->status = SET_HW_MODE_STATUS_ECANCELED;
190 param->cfgd_hw_mode_index = 0;
191 param->num_vdev_mac_entries = 0;
192 resp_msg.type = eWNI_SME_SET_HW_MODE_RESP;
193 resp_msg.bodyptr = param;
194 resp_msg.bodyval = 0;
195 lim_sys_process_mmh_msg_api(mac, &resp_msg, ePROT);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530196 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800197}
198
199/**
200 * lim_process_set_dual_mac_cfg_req() - Set dual mac config command to WMA
201 * @mac: Global MAC pointer
202 * @msg: Message containing the dual mac config parameter
203 *
204 * Send the set dual mac config command to WMA
205 *
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530206 * Return: QDF_STATUS_SUCCESS if message posting is successful
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800207 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530208static QDF_STATUS lim_process_set_dual_mac_cfg_req(tpAniSirGlobal mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800209 uint32_t *msg)
210{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530211 QDF_STATUS status = QDF_STATUS_SUCCESS;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700212 struct scheduler_msg message = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213 struct sir_dual_mac_config *req_msg;
214 uint32_t len;
215 struct sir_set_dual_mac_cfg *buf;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700216 struct scheduler_msg resp_msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800217 struct sir_dual_mac_config_resp *param;
218
219 buf = (struct sir_set_dual_mac_cfg *) msg;
220 if (!buf) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700221 pe_err("Set Dual mac config is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800222 /* To free the active command list */
223 goto fail;
224 }
225
226 len = sizeof(*req_msg);
227
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530228 req_msg = qdf_mem_malloc(len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800229 if (!req_msg) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700230 pe_err("qdf_mem_malloc failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800231 /* Free the active command list
232 * Probably the malloc is going to fail there as well?!
233 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530234 return QDF_STATUS_E_NOMEM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800235 }
236
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800237 req_msg->scan_config = buf->set_dual_mac.scan_config;
238 req_msg->fw_mode_config = buf->set_dual_mac.fw_mode_config;
239 /* Other parameters are not needed for WMA */
240
Rajeev Kumarf7d84422017-01-21 15:45:44 -0800241 message.bodyptr = req_msg;
242 message.type = SIR_HAL_PDEV_DUAL_MAC_CFG_REQ;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800243
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700244 pe_debug("Post SIR_HAL_PDEV_DUAL_MAC_CFG_REQ to WMA: %x %x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245 req_msg->scan_config, req_msg->fw_mode_config);
Rajeev Kumarf7d84422017-01-21 15:45:44 -0800246 status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530247 if (!QDF_IS_STATUS_SUCCESS(status)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700248 pe_err("scheduler_post_msg failed!(err=%d)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800249 status);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530250 qdf_mem_free(req_msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800251 goto fail;
252 }
253 return status;
254fail:
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530255 param = qdf_mem_malloc(sizeof(*param));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800256 if (!param) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700257 pe_err("Dual mac config resp failed");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530258 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800259 }
260 param->status = SET_HW_MODE_STATUS_ECANCELED;
261 resp_msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP;
262 resp_msg.bodyptr = param;
263 resp_msg.bodyval = 0;
264 lim_sys_process_mmh_msg_api(mac, &resp_msg, ePROT);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530265 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800266}
267
268/**
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800269 * lim_process_set_antenna_mode_req() - Set antenna mode command
270 * to WMA
271 * @mac: Global MAC pointer
272 * @msg: Message containing the antenna mode parameter
273 *
274 * Send the set antenna mode command to WMA
275 *
276 * Return: QDF_STATUS_SUCCESS if message posting is successful
277 */
278static QDF_STATUS lim_process_set_antenna_mode_req(tpAniSirGlobal mac,
279 uint32_t *msg)
280{
281 QDF_STATUS status = QDF_STATUS_SUCCESS;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700282 struct scheduler_msg message = {0};
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800283 struct sir_antenna_mode_param *req_msg;
284 struct sir_set_antenna_mode *buf;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700285 struct scheduler_msg resp_msg = {0};
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800286 struct sir_antenna_mode_resp *param;
287
288 buf = (struct sir_set_antenna_mode *) msg;
289 if (!buf) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700290 pe_err("Set antenna mode is NULL");
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800291 /* To free the active command list */
292 goto fail;
293 }
294
295 req_msg = qdf_mem_malloc(sizeof(*req_msg));
296 if (!req_msg) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700297 pe_err("qdf_mem_malloc failed");
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800298 return QDF_STATUS_E_NOMEM;
299 }
300
301 req_msg->num_rx_chains = buf->set_antenna_mode.num_rx_chains;
302 req_msg->num_tx_chains = buf->set_antenna_mode.num_tx_chains;
303
Rajeev Kumarf7d84422017-01-21 15:45:44 -0800304 message.bodyptr = req_msg;
305 message.type = SIR_HAL_SOC_ANTENNA_MODE_REQ;
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800306
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700307 pe_debug("Post SIR_HAL_SOC_ANTENNA_MODE_REQ to WMA: %d %d",
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800308 req_msg->num_rx_chains,
309 req_msg->num_tx_chains);
Rajeev Kumarf7d84422017-01-21 15:45:44 -0800310 status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message);
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800311 if (!QDF_IS_STATUS_SUCCESS(status)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700312 pe_err("scheduler_post_msg failed!(err=%d)",
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800313 status);
314 qdf_mem_free(req_msg);
315 goto fail;
316 }
317 return status;
318fail:
319 param = qdf_mem_malloc(sizeof(*param));
320 if (!param) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700321 pe_err("antenna mode resp failed");
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800322 return QDF_STATUS_E_NOMEM;
323 }
324 param->status = SET_ANTENNA_MODE_STATUS_ECANCELED;
325 resp_msg.type = eWNI_SME_SET_ANTENNA_MODE_RESP;
326 resp_msg.bodyptr = param;
327 resp_msg.bodyval = 0;
328 lim_sys_process_mmh_msg_api(mac, &resp_msg, ePROT);
329 return QDF_STATUS_SUCCESS;
330}
331
332/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800333 * __lim_fresh_scan_reqd() - determine if a fresh scan request must be issued.
334 * @mac_ctx: Pointer to Global MAC structure
335 * @return_fresh_results: Trigger fresh scan.
336 *
337 * PE will do fresh scan, if all of the active sessions are in
338 * good state (Link Est or BSS Started). If one of the sessions
339 * is not in one of the above states, then PE does not do fresh
340 * scan. If no session exists (scanning very first time),
341 * then PE will always do fresh scan if SME asks it to do that.
342 *
343 * Return: true for fresh scan results, false if in invalid state.
344 */
345static uint8_t
346__lim_fresh_scan_reqd(tpAniSirGlobal mac_ctx, uint8_t return_fresh_results)
347{
348 uint8_t valid_state = true;
349 int i;
350
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700351
352 pe_debug("gLimSmeState: %d, returnFreshResults 0x%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800353 mac_ctx->lim.gLimSmeState, return_fresh_results);
354
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700355 if (mac_ctx->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800356 return false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800357
358 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
Naveen Rawatb6a951a2016-06-21 15:02:37 -0700359
360 if (mac_ctx->lim.gpSession[i].valid == false)
361 continue;
362
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700363 pe_debug("session %d, bsstype %d, limSystemRole %d, limSmeState %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800364 i, mac_ctx->lim.gpSession[i].bssType,
365 mac_ctx->lim.gpSession[i].limSystemRole,
366 mac_ctx->lim.gpSession[i].limSmeState);
Naveen Rawatb6a951a2016-06-21 15:02:37 -0700367
368 if (mac_ctx->lim.gpSession[i].bssType == eSIR_NDI_MODE)
369 continue;
370
371 if (mac_ctx->lim.gpSession[i].bssType ==
372 eSIR_INFRASTRUCTURE_MODE &&
373 mac_ctx->lim.gpSession[i].limSmeState ==
374 eLIM_SME_LINK_EST_STATE)
375 continue;
376
377 if (mac_ctx->lim.gpSession[i].bssType == eSIR_IBSS_MODE &&
378 mac_ctx->lim.gpSession[i].limSmeState ==
379 eLIM_SME_NORMAL_STATE)
380 continue;
381
382 if (mac_ctx->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE &&
383 mac_ctx->lim.gpSession[i].pePersona ==
384 QDF_P2P_GO_MODE &&
385 mac_ctx->lim.gpSession[i].limSmeState ==
386 eLIM_SME_NORMAL_STATE)
387 continue;
388
389 if (mac_ctx->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE &&
390 mac_ctx->lim.gpSession[i].limSmeState ==
391 eLIM_SME_NORMAL_STATE)
392 continue;
393
394 valid_state = false;
395 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800396 }
397
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700398 pe_debug("valid_state: %d", valid_state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800399
400 if ((valid_state) &&
401 (return_fresh_results & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
402 return true;
403 else
404 return false;
405}
406
407/**
408 * __lim_is_sme_assoc_cnf_valid()
409 *
410 ***FUNCTION:
411 * This function is called by __lim_process_sme_assoc_cnf_new() upon
412 * receiving SME_ASSOC_CNF.
413 *
414 ***LOGIC:
415 * Message validity checks are performed in this function
416 *
417 ***ASSUMPTIONS:
418 *
419 ***NOTE:
420 *
421 * @param pMeasReq Pointer to Received ASSOC_CNF message
422 * @return true When received SME_ASSOC_CNF is formatted
423 * correctly
424 * false otherwise
425 */
426
427static inline uint8_t __lim_is_sme_assoc_cnf_valid(tpSirSmeAssocCnf pAssocCnf)
428{
Anurag Chouhanc5548422016-02-24 18:33:27 +0530429 if (qdf_is_macaddr_group(&pAssocCnf->peer_macaddr))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430 return false;
431 else
432 return true;
433} /*** end __lim_is_sme_assoc_cnf_valid() ***/
434
435/**
436 * __lim_get_sme_join_req_size_for_alloc()
437 *
438 ***FUNCTION:
439 * This function is called in various places to get IE length
440 * from tSirBssDescription structure
441 * number being scanned.
442 *
443 ***PARAMS:
444 *
445 ***LOGIC:
446 *
447 ***ASSUMPTIONS:
448 * NA
449 *
450 ***NOTE:
451 * NA
452 *
453 * @param pBssDescr
454 * @return Total IE length
455 */
456
457static uint16_t __lim_get_sme_join_req_size_for_alloc(uint8_t *pBuf)
458{
459 uint16_t len = 0;
460
461 if (!pBuf)
462 return len;
463
464 pBuf += sizeof(uint16_t);
465 len = lim_get_u16(pBuf);
Arif Hussainc9651922017-04-16 14:08:23 -0700466 return len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800467}
468
469/**
470 * __lim_is_defered_msg_for_learn() - message handling in SME learn state
471 * @pMac: Global MAC context
472 * @pMsg: Pointer to message posted from SME to LIM.
473 *
474 * Has role only if 11h is enabled. Not used on STA side.
475 * Defers the message if SME is in learn state and brings
476 * the LIM back to normal mode.
477 *
478 * Return: true - If defered false - Otherwise
479 */
480
Rajeev Kumarfeb96382017-01-22 19:42:09 -0800481static bool __lim_is_defered_msg_for_learn(tpAniSirGlobal pMac,
482 struct scheduler_msg *pMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800483{
484 if (lim_is_system_in_scan_state(pMac)) {
485 if (lim_defer_msg(pMac, pMsg) != TX_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700486 pe_err("Could not defer Msg: %d", pMsg->type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800487 return false;
488 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700489 pe_debug("Defer the message, in learn mode type: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800490 pMsg->type);
491 return true;
492 }
493 return false;
494}
495
496/**
497 * __lim_is_defered_msg_for_radar() - Defers the message if radar is detected
498 * @mac_ctx: Pointer to Global MAC structure
499 * @message: Pointer to message posted from SME to LIM.
500 *
501 * Has role only if 11h is enabled. Not used on STA side.
502 * Defers the message if radar is detected.
503 *
504 * Return: true, if defered otherwise return false.
505 */
506static bool
Rajeev Kumarfeb96382017-01-22 19:42:09 -0800507__lim_is_defered_msg_for_radar(tpAniSirGlobal mac_ctx,
508 struct scheduler_msg *message)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800509{
510 /*
511 * fRadarDetCurOperChan will be set only if we
512 * detect radar in current operating channel and
513 * System Role == AP ROLE
514 *
515 * TODO: Need to take care radar detection.
516 *
517 * if (LIM_IS_RADAR_DETECTED(mac_ctx))
518 */
519 if (0) {
520 if (lim_defer_msg(mac_ctx, message) != TX_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700521 pe_err("Could not defer Msg: %d", message->type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800522 return false;
523 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700524 pe_debug("Defer the message, in learn mode type: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800525 message->type);
526 return true;
527 }
528 return false;
529}
530
531/**
532 * __lim_process_sme_sys_ready_ind () - Process ready indication from WMA
533 * @pMac: Global MAC context
534 * @pMsgBuf: Message from WMA
535 *
536 * handles the notification from HDD. PE just forwards this message to HAL.
537 *
538 * Return: true-Posting to HAL failed, so PE will consume the buffer.
539 * false-Posting to HAL successful, so HAL will consume the buffer.
540 */
541
542static bool __lim_process_sme_sys_ready_ind(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
543{
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700544 struct scheduler_msg msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800545 tSirSmeReadyReq *ready_req = (tSirSmeReadyReq *) pMsgBuf;
546
547 msg.type = WMA_SYS_READY_IND;
548 msg.reserved = 0;
549 msg.bodyptr = pMsgBuf;
550 msg.bodyval = 0;
551
Srinivas Girigowda35b00312017-06-27 21:52:03 -0700552 if (ANI_DRIVER_TYPE(pMac) != QDF_DRIVER_TYPE_MFG) {
Varun Reddy Yeturud5939f82015-12-24 18:14:02 -0800553 ready_req->pe_roam_synch_cb = pe_roam_synch_callback;
Himanshu Agarwal2fdf77a2016-12-29 11:41:00 +0530554 pe_register_mgmt_rx_frm_callback(pMac);
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700555 pe_register_callbacks_with_wma(pMac, ready_req);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800556 pMac->lim.add_bssdescr_callback = ready_req->add_bssdescr_cb;
Sandeep Puligilla1426d612017-04-12 18:22:06 -0700557 pMac->lim.sme_msg_callback = ready_req->sme_msg_cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800558 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700559
560 pe_debug("sending WMA_SYS_READY_IND msg to HAL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800561 MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msg.type));
562
563 if (eSIR_SUCCESS != wma_post_ctrl_msg(pMac, &msg)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700564 pe_err("wma_post_ctrl_msg failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800565 return true;
566 }
567 return false;
568}
569
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800570/**
571 *lim_configure_ap_start_bss_session() - Configure the AP Start BSS in session.
572 *@mac_ctx: Pointer to Global MAC structure
573 *@session: A pointer to session entry
574 *@sme_start_bss_req: Start BSS Request from upper layers.
575 *
576 * This function is used to configure the start bss parameters
577 * in to the session.
578 *
579 * Return: None.
580 */
581static void
582lim_configure_ap_start_bss_session(tpAniSirGlobal mac_ctx, tpPESession session,
583 tpSirSmeStartBssReq sme_start_bss_req)
584{
585 session->limSystemRole = eLIM_AP_ROLE;
586 session->privacy = sme_start_bss_req->privacy;
587 session->fwdWPSPBCProbeReq = sme_start_bss_req->fwdWPSPBCProbeReq;
588 session->authType = sme_start_bss_req->authType;
589 /* Store the DTIM period */
590 session->dtimPeriod = (uint8_t) sme_start_bss_req->dtimPeriod;
591 /* Enable/disable UAPSD */
592 session->apUapsdEnable = sme_start_bss_req->apUapsdEnable;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530593 if (session->pePersona == QDF_P2P_GO_MODE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800594 session->proxyProbeRspEn = 0;
595 } else {
596 /*
597 * To detect PBC overlap in SAP WPS mode,
598 * Host handles Probe Requests.
599 */
600 if (SAP_WPS_DISABLED == sme_start_bss_req->wps_state)
601 session->proxyProbeRspEn = 1;
602 else
603 session->proxyProbeRspEn = 0;
604 }
605 session->ssidHidden = sme_start_bss_req->ssidHidden;
606 session->wps_state = sme_start_bss_req->wps_state;
607 session->sap_dot11mc = sme_start_bss_req->sap_dot11mc;
Kapil Gupta4b2efbb2016-10-03 13:07:20 +0530608 session->vendor_vht_sap =
609 sme_start_bss_req->vendor_vht_sap;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800610 lim_get_short_slot_from_phy_mode(mac_ctx, session, session->gLimPhyMode,
611 &session->shortSlotTimeSupported);
612 session->isCoalesingInIBSSAllowed =
613 sme_start_bss_req->isCoalesingInIBSSAllowed;
614
Jiachao Wu712d4fd2017-08-23 16:52:34 +0800615 session->beacon_tx_rate = sme_start_bss_req->beacon_tx_rate;
616
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800617}
618
619/**
620 * __lim_handle_sme_start_bss_request() - process SME_START_BSS_REQ message
621 *@mac_ctx: Pointer to Global MAC structure
622 *@msg_buf: A pointer to the SME message buffer
623 *
624 * This function is called to process SME_START_BSS_REQ message
625 * from HDD or upper layer application.
626 *
627 * Return: None
628 */
629static void
630__lim_handle_sme_start_bss_request(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
631{
632 uint16_t size;
633 uint32_t val = 0;
634 tSirRetStatus ret_status;
635 tSirMacChanNum channel_number;
636 tLimMlmStartReq *mlm_start_req = NULL;
637 tpSirSmeStartBssReq sme_start_bss_req = NULL;
638 tSirResultCodes ret_code = eSIR_SME_SUCCESS;
639 /* Flag Used in case of IBSS to Auto generate BSSID. */
640 uint32_t auto_gen_bssid = false;
641 uint8_t session_id;
642 tpPESession session = NULL;
Krunal Sonib37bb352016-12-20 14:12:21 -0800643 uint8_t sme_session_id = 0xFF;
644 uint16_t sme_transaction_id = 0xFF;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800645 uint32_t chanwidth;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -0700646 struct vdev_type_nss *vdev_type_nss;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800647 tSirRetStatus cfg_get_wmi_dfs_master_param = eSIR_SUCCESS;
648
649/* FEATURE_WLAN_DIAG_SUPPORT */
650#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
651 /*
652 * Since the session is not created yet, sending NULL.
653 * The response should have the correct state.
654 */
655 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_START_BSS_REQ_EVENT,
656 NULL, 0, 0);
657#endif /* FEATURE_WLAN_DIAG_SUPPORT */
658
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700659 pe_debug("Received START_BSS_REQ");
Krunal Sonib37bb352016-12-20 14:12:21 -0800660 size = sizeof(tSirSmeStartBssReq);
661 sme_start_bss_req = qdf_mem_malloc(size);
662 if (NULL == sme_start_bss_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700663 pe_err("Allocate Memory fail for LimStartBssReq");
Krunal Sonib37bb352016-12-20 14:12:21 -0800664 /* Send failure response to host */
665 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
666 goto free;
667 }
668 qdf_mem_copy(sme_start_bss_req, msg_buf, sizeof(tSirSmeStartBssReq));
669 sme_session_id = sme_start_bss_req->sessionId;
670 sme_transaction_id = sme_start_bss_req->transactionId;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800672 if ((mac_ctx->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
673 (mac_ctx->lim.gLimSmeState == eLIM_SME_IDLE_STATE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800674 if (!lim_is_sme_start_bss_req_valid(mac_ctx,
675 sme_start_bss_req)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700676 pe_warn("Received invalid eWNI_SME_START_BSS_REQ");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800677 ret_code = eSIR_SME_INVALID_PARAMETERS;
678 goto free;
679 }
680
681 /*
682 * This is the place where PE is going to create a session.
683 * If session is not existed, then create a new session
684 */
685 session = pe_find_session_by_bssid(mac_ctx,
Srinivas Girigowdad8af4a62015-11-18 16:51:16 -0800686 sme_start_bss_req->bssid.bytes, &session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800687 if (session != NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700688 pe_warn("Session Already exists for given BSSID");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800689 ret_code = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
690 session = NULL;
691 goto free;
692 } else {
693 session = pe_create_session(mac_ctx,
Srinivas Girigowdad8af4a62015-11-18 16:51:16 -0800694 sme_start_bss_req->bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800695 &session_id, mac_ctx->lim.maxStation,
696 sme_start_bss_req->bssType);
697 if (session == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700698 pe_warn("Session Can not be created");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800699 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
700 goto free;
701 }
702 }
703
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700704 if (QDF_NDI_MODE != sme_start_bss_req->bssPersona) {
705 /* Probe resp add ie */
706 lim_start_bss_update_add_ie_buffer(mac_ctx,
707 &session->addIeParams.probeRespData_buff,
708 &session->addIeParams.probeRespDataLen,
709 sme_start_bss_req->addIeParams.
710 probeRespData_buff,
711 sme_start_bss_req->addIeParams.
712 probeRespDataLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800713
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700714 /* Probe Beacon add ie */
715 lim_start_bss_update_add_ie_buffer(mac_ctx,
716 &session->addIeParams.probeRespBCNData_buff,
717 &session->addIeParams.probeRespBCNDataLen,
718 sme_start_bss_req->addIeParams.
719 probeRespBCNData_buff,
720 sme_start_bss_req->addIeParams.
721 probeRespBCNDataLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800722
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700723 /* Assoc resp IE */
724 lim_start_bss_update_add_ie_buffer(mac_ctx,
725 &session->addIeParams.assocRespData_buff,
726 &session->addIeParams.assocRespDataLen,
727 sme_start_bss_req->addIeParams.
728 assocRespData_buff,
729 sme_start_bss_req->addIeParams.
730 assocRespDataLen);
731 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800732 /* Store the session related params in newly created session */
733 session->pLimStartBssReq = sme_start_bss_req;
734
735 /* Store PE session_id in session Table */
736 session->peSessionId = session_id;
737
738 /* Store SME session Id in sessionTable */
739 session->smeSessionId = sme_start_bss_req->sessionId;
740
741 session->transactionId = sme_start_bss_req->transactionId;
742
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530743 qdf_mem_copy(&(session->htConfig),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800744 &(sme_start_bss_req->htConfig),
745 sizeof(session->htConfig));
746
Sandeep Puligilla98917432016-06-10 13:50:28 -0700747 qdf_mem_copy(&(session->vht_config),
748 &(sme_start_bss_req->vht_config),
749 sizeof(session->vht_config));
750
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800751 sir_copy_mac_addr(session->selfMacAddr,
Srinivas Girigowdad8af4a62015-11-18 16:51:16 -0800752 sme_start_bss_req->self_macaddr.bytes);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800753
754 /* Copy SSID to session table */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530755 qdf_mem_copy((uint8_t *) &session->ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800756 (uint8_t *) &sme_start_bss_req->ssId,
757 (sme_start_bss_req->ssId.length + 1));
758
759 session->bssType = sme_start_bss_req->bssType;
760
761 session->nwType = sme_start_bss_req->nwType;
762
763 session->beaconParams.beaconInterval =
764 sme_start_bss_req->beaconInterval;
765
766 /* Store the channel number in session Table */
767 session->currentOperChannel =
768 sme_start_bss_req->channelId;
769
770 /* Store Persona */
771 session->pePersona = sme_start_bss_req->bssPersona;
Abhishek Singh4294f802017-08-10 16:37:07 +0530772 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800773 FL("PE PERSONA=%d"), session->pePersona);
774
775 /* Update the phymode */
776 session->gLimPhyMode = sme_start_bss_req->nwType;
777
778 session->maxTxPower =
779 cfg_get_regulatory_max_transmit_power(mac_ctx,
780 session->currentOperChannel);
781 /* Store the dot 11 mode in to the session Table */
782 session->dot11mode = sme_start_bss_req->dot11mode;
783#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
784 session->cc_switch_mode =
785 sme_start_bss_req->cc_switch_mode;
786#endif
787 session->htCapability =
788 IS_DOT11_MODE_HT(session->dot11mode);
789 session->vhtCapability =
790 IS_DOT11_MODE_VHT(session->dot11mode);
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -0800791
Srinivas Girigowda28fb0122017-03-26 22:21:20 -0700792 pe_debug("HT[%d], VHT[%d]",
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800793 session->htCapability, session->vhtCapability);
794
795 if (IS_DOT11_MODE_HE(session->dot11mode)) {
796 lim_update_session_he_capable(mac_ctx, session);
797 lim_copy_bss_he_cap(session, sme_start_bss_req);
798 }
799
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800800 session->txLdpcIniFeatureEnabled =
801 sme_start_bss_req->txLdpcIniFeatureEnabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800802#ifdef WLAN_FEATURE_11W
803 session->limRmfEnabled =
804 sme_start_bss_req->pmfCapable ? 1 : 0;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700805 pe_debug("Session RMF enabled: %d", session->limRmfEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800806#endif
807
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530808 qdf_mem_copy((void *)&session->rateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800809 (void *)&sme_start_bss_req->operationalRateSet,
810 sizeof(tSirMacRateSet));
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530811 qdf_mem_copy((void *)&session->extRateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800812 (void *)&sme_start_bss_req->extendedRateSet,
813 sizeof(tSirMacRateSet));
814
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -0700815 if (IS_5G_CH(session->currentOperChannel))
816 vdev_type_nss = &mac_ctx->vdev_type_nss_5g;
817 else
818 vdev_type_nss = &mac_ctx->vdev_type_nss_2g;
819
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800820 switch (sme_start_bss_req->bssType) {
821 case eSIR_INFRA_AP_MODE:
822 lim_configure_ap_start_bss_session(mac_ctx, session,
823 sme_start_bss_req);
Krunal Soni53993f72016-07-08 18:20:03 -0700824 if (session->pePersona == QDF_SAP_MODE)
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -0700825 session->vdev_nss = vdev_type_nss->sap;
Krunal Soni53993f72016-07-08 18:20:03 -0700826 else
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -0700827 session->vdev_nss = vdev_type_nss->p2p_go;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800828 break;
829 case eSIR_IBSS_MODE:
830 session->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
831 lim_get_short_slot_from_phy_mode(mac_ctx, session,
832 session->gLimPhyMode,
833 &session->shortSlotTimeSupported);
834
835 /*
836 * initialize to "OPEN".
837 * will be updated upon key installation
838 */
839 session->encryptType = eSIR_ED_NONE;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -0700840 session->vdev_nss = vdev_type_nss->ibss;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800841
842 break;
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700843 case eSIR_NDI_MODE:
844 session->limSystemRole = eLIM_NDI_ROLE;
845 break;
846
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800847
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800848 /*
849 * There is one more mode called auto mode.
850 * which is used no where
851 */
852
853 /* FORBUILD -TEMPFIX.. HOW TO use AUTO MODE????? */
854
855 default:
856 /* not used anywhere...used in scan function */
857 break;
858 }
859
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700860 pe_debug("persona - %d, nss - %d",
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -0700861 session->pePersona, session->vdev_nss);
862 session->nss = session->vdev_nss;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800863 /*
Rajeev Kumarc9a50e72016-04-15 15:18:42 -0700864 * Allocate memory for the array of
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800865 * parsed (Re)Assoc request structure
866 */
Rajeev Kumarc9a50e72016-04-15 15:18:42 -0700867 if (sme_start_bss_req->bssType == eSIR_INFRA_AP_MODE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800868 session->parsedAssocReq =
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530869 qdf_mem_malloc(session->dph.dphHashTable.
Rajeev Kumarc9a50e72016-04-15 15:18:42 -0700870 size * sizeof(tpSirAssocReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800871 if (NULL == session->parsedAssocReq) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700872 pe_warn("AllocateMemory() failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800873 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
874 goto free;
875 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800876 }
877
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700878 if (!sme_start_bss_req->channelId &&
879 sme_start_bss_req->bssType != eSIR_NDI_MODE) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700880 pe_err("Received invalid eWNI_SME_START_BSS_REQ");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800881 ret_code = eSIR_SME_INVALID_PARAMETERS;
882 goto free;
883 }
884 channel_number = sme_start_bss_req->channelId;
885#ifdef QCA_HT_2040_COEX
886 if (sme_start_bss_req->obssEnabled)
887 session->htSupportedChannelWidthSet =
888 session->htCapability;
889 else
890#endif
891 session->htSupportedChannelWidthSet =
892 (sme_start_bss_req->sec_ch_offset) ? 1 : 0;
893 session->htSecondaryChannelOffset =
894 sme_start_bss_req->sec_ch_offset;
895 session->htRecommendedTxWidthSet =
896 (session->htSecondaryChannelOffset) ? 1 : 0;
Abhishek Singh4294f802017-08-10 16:37:07 +0530897 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800898 FL("cbMode %u"), sme_start_bss_req->cbMode);
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800899 if (lim_is_session_he_capable(session) ||
900 session->vhtCapability || session->htCapability) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800901 chanwidth = sme_start_bss_req->vht_channel_width;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700902 pe_debug("vht_channel_width %u htSupportedChannelWidthSet %d",
Sandeep Puligillafade9b72016-02-01 12:41:54 -0800903 sme_start_bss_req->vht_channel_width,
904 session->htSupportedChannelWidthSet);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800905 session->ch_width = chanwidth;
906 if (session->htSupportedChannelWidthSet) {
907 session->ch_center_freq_seg0 =
908 sme_start_bss_req->center_freq_seg0;
909 session->ch_center_freq_seg1 =
910 sme_start_bss_req->center_freq_seg1;
911 } else {
912 session->ch_center_freq_seg0 = 0;
913 session->ch_center_freq_seg1 = 0;
914 }
915 }
916
917 if (session->vhtCapability &&
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -0800918 (session->ch_width > CH_WIDTH_80MHZ)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800919 session->nss = 1;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700920 pe_debug("nss set to [%d]", session->nss);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800921 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700922 pe_debug("vht su tx bformer %d",
Krunal Soni53993f72016-07-08 18:20:03 -0700923 session->vht_config.su_beam_former);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800924
925 /* Delete pre-auth list if any */
926 lim_delete_pre_auth_list(mac_ctx);
927
Krunal Soni53993f72016-07-08 18:20:03 -0700928 if (session->nss == 1) {
929 session->vht_config.su_beam_former = 0;
930 session->vht_config.tx_stbc = 0;
931 session->vht_config.num_soundingdim = 0;
Selvaraj, Sridhare01e0732016-09-13 12:45:22 +0530932 session->htConfig.ht_tx_stbc = 0;
Krunal Soni53993f72016-07-08 18:20:03 -0700933 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800934 /*
935 * keep the RSN/WPA IE information in PE Session Entry
936 * later will be using this to check when received (Re)Assoc req
937 */
938 lim_set_rs_nie_wp_aiefrom_sme_start_bss_req_message(mac_ctx,
939 &sme_start_bss_req->rsnIE, session);
940
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700941 if (LIM_IS_AP_ROLE(session) ||
942 LIM_IS_IBSS_ROLE(session) ||
943 LIM_IS_NDI_ROLE(session)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800944 session->gLimProtectionControl =
945 sme_start_bss_req->protEnabled;
946 /*
947 * each byte will have the following info
948 * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
949 * reserved reserved RIFS Lsig n-GF ht20 11g 11b
950 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530951 qdf_mem_copy((void *)&session->cfgProtection,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800952 (void *)&sme_start_bss_req->ht_capab,
953 sizeof(uint16_t));
954 /* Initialize WPS PBC session link list */
955 session->pAPWPSPBCSession = NULL;
956 }
957 /* Prepare and Issue LIM_MLM_START_REQ to MLM */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530958 mlm_start_req = qdf_mem_malloc(sizeof(tLimMlmStartReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800959 if (NULL == mlm_start_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700960 pe_err("Allocate Memory failed for mlmStartReq");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800961 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
962 goto free;
963 }
964
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800965 /* Copy SSID to the MLM start structure */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530966 qdf_mem_copy((uint8_t *) &mlm_start_req->ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800967 (uint8_t *) &sme_start_bss_req->ssId,
968 sme_start_bss_req->ssId.length + 1);
969 mlm_start_req->ssidHidden = sme_start_bss_req->ssidHidden;
970 mlm_start_req->obssProtEnabled =
971 sme_start_bss_req->obssProtEnabled;
972
973 mlm_start_req->bssType = session->bssType;
974
975 /* Fill PE session Id from the session Table */
976 mlm_start_req->sessionId = session->peSessionId;
977
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700978 if (mlm_start_req->bssType == eSIR_INFRA_AP_MODE ||
979 mlm_start_req->bssType == eSIR_NDI_MODE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800980 /*
981 * Copy the BSSId from sessionTable to
982 * mlmStartReq struct
983 */
984 sir_copy_mac_addr(mlm_start_req->bssId, session->bssId);
985 } else {
986 /* ibss mode */
987 mac_ctx->lim.gLimIbssCoalescingHappened = false;
988
989 ret_status = wlan_cfg_get_int(mac_ctx,
990 WNI_CFG_IBSS_AUTO_BSSID,
991 &auto_gen_bssid);
992 if (ret_status != eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -0700993 pe_err("Get Auto Gen BSSID fail,Status: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800994 ret_status);
Abhishek Singh4294f802017-08-10 16:37:07 +0530995 ret_code = eSIR_LOGE_EXCEPTION;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800996 goto free;
997 }
998
999 if (!auto_gen_bssid) {
1000 /*
1001 * We're not auto generating BSSID.
1002 * Instead, get it from session entry
1003 */
1004 sir_copy_mac_addr(mlm_start_req->bssId,
1005 session->bssId);
1006 /*
1007 * Start IBSS group BSSID
1008 * Auto Generating BSSID.
1009 */
1010 auto_gen_bssid = ((mlm_start_req->bssId[0] &
1011 0x01) ? true : false);
1012 }
1013
1014 if (auto_gen_bssid) {
1015 /*
1016 * if BSSID is not any uc id.
1017 * then use locally generated BSSID.
1018 * Autogenerate the BSSID
1019 */
1020 lim_get_random_bssid(mac_ctx,
1021 mlm_start_req->bssId);
1022 mlm_start_req->bssId[0] = 0x02;
1023
1024 /*
1025 * Copy randomly generated BSSID
1026 * to the session Table
1027 */
1028 sir_copy_mac_addr(session->bssId,
1029 mlm_start_req->bssId);
1030 }
1031 }
1032 /* store the channel num in mlmstart req structure */
1033 mlm_start_req->channelNumber = session->currentOperChannel;
1034 mlm_start_req->cbMode = sme_start_bss_req->cbMode;
1035 mlm_start_req->beaconPeriod =
1036 session->beaconParams.beaconInterval;
Arif Hussain671a1902017-03-17 09:08:32 -07001037 mlm_start_req->cac_duration_ms =
1038 sme_start_bss_req->cac_duration_ms;
1039 mlm_start_req->dfs_regdomain =
1040 sme_start_bss_req->dfs_regdomain;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001041 if (LIM_IS_AP_ROLE(session)) {
1042 mlm_start_req->dtimPeriod = session->dtimPeriod;
1043 mlm_start_req->wps_state = session->wps_state;
1044
1045 } else {
1046 if (wlan_cfg_get_int(mac_ctx,
1047 WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001048 pe_err("could not retrieve DTIM Period");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001049 mlm_start_req->dtimPeriod = (uint8_t) val;
1050 }
1051
1052 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_CFP_PERIOD, &val) !=
1053 eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001054 pe_err("could not retrieve Beacon interval");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001055 mlm_start_req->cfParamSet.cfpPeriod = (uint8_t) val;
1056
1057 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_CFP_MAX_DURATION, &val) !=
1058 eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001059 pe_err("could not retrieve CFPMaxDuration");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001060 mlm_start_req->cfParamSet.cfpMaxDuration = (uint16_t) val;
1061
1062 /*
1063 * this may not be needed anymore now,
1064 * as rateSet is now included in the
1065 * session entry and MLM has session context.
1066 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301067 qdf_mem_copy((void *)&mlm_start_req->rateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001068 (void *)&session->rateSet,
1069 sizeof(tSirMacRateSet));
1070
1071 /* Now populate the 11n related parameters */
1072 mlm_start_req->nwType = session->nwType;
1073 mlm_start_req->htCapable = session->htCapability;
1074
1075 mlm_start_req->htOperMode = mac_ctx->lim.gHTOperMode;
1076 /* Unused */
1077 mlm_start_req->dualCTSProtection =
1078 mac_ctx->lim.gHTDualCTSProtection;
1079 mlm_start_req->txChannelWidthSet =
1080 session->htRecommendedTxWidthSet;
1081
1082 session->limRFBand = lim_get_rf_band(channel_number);
1083
1084 /* Initialize 11h Enable Flag */
1085 session->lim11hEnable = 0;
gaolez76d2a162017-03-21 19:23:58 +08001086 if (mlm_start_req->bssType != eSIR_IBSS_MODE &&
1087 (CHAN_HOP_ALL_BANDS_ENABLE ||
1088 SIR_BAND_5_GHZ == session->limRFBand)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001089 if (wlan_cfg_get_int(mac_ctx,
1090 WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001091 pe_err("Fail to get WNI_CFG_11H_ENABLED");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001092 else
1093 session->lim11hEnable = val;
1094
1095 if (session->lim11hEnable &&
1096 (eSIR_INFRA_AP_MODE ==
1097 mlm_start_req->bssType)) {
1098 cfg_get_wmi_dfs_master_param =
1099 wlan_cfg_get_int(mac_ctx,
1100 WNI_CFG_DFS_MASTER_ENABLED,
1101 &val);
1102 session->lim11hEnable = val;
1103 }
1104 if (cfg_get_wmi_dfs_master_param != eSIR_SUCCESS)
1105 /* Failed get CFG WNI_CFG_DFS_MASTER_ENABLED */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001106 pe_err("Get Fail, CFG DFS ENABLE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001107 }
1108
1109 if (!session->lim11hEnable) {
1110 if (cfg_set_int(mac_ctx,
1111 WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) !=
1112 eSIR_SUCCESS)
1113 /*
1114 * Failed to set the CFG param
1115 * WNI_CFG_LOCAL_POWER_CONSTRAINT
1116 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001117 pe_err("Set LOCAL_POWER_CONSTRAINT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001118 }
1119
Jiachao Wu712d4fd2017-08-23 16:52:34 +08001120 mlm_start_req->beacon_tx_rate = session->beacon_tx_rate;
1121
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001122 session->limPrevSmeState = session->limSmeState;
1123 session->limSmeState = eLIM_SME_WT_START_BSS_STATE;
1124 MTRACE(mac_trace
1125 (mac_ctx, TRACE_CODE_SME_STATE,
1126 session->peSessionId,
1127 session->limSmeState));
1128
1129 lim_post_mlm_message(mac_ctx, LIM_MLM_START_REQ,
1130 (uint32_t *) mlm_start_req);
1131 return;
1132 } else {
1133
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001134 pe_err("Received unexpected START_BSS_REQ, in state %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001135 mac_ctx->lim.gLimSmeState);
1136 ret_code = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
Krunal Sonib37bb352016-12-20 14:12:21 -08001137 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001138 } /* if (mac_ctx->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) */
1139
1140free:
1141 if ((session != NULL) &&
Krunal Sonib37bb352016-12-20 14:12:21 -08001142 (session->pLimStartBssReq == sme_start_bss_req)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001143 session->pLimStartBssReq = NULL;
1144 }
Krunal Sonib37bb352016-12-20 14:12:21 -08001145 if (NULL != sme_start_bss_req)
1146 qdf_mem_free(sme_start_bss_req);
1147 if (NULL != mlm_start_req)
1148 qdf_mem_free(mlm_start_req);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001149 if (NULL != session) {
1150 pe_delete_session(mac_ctx, session);
1151 session = NULL;
1152 }
1153 lim_send_sme_start_bss_rsp(mac_ctx, eWNI_SME_START_BSS_RSP, ret_code,
1154 session, sme_session_id, sme_transaction_id);
1155}
1156
1157/**
1158 * __lim_process_sme_start_bss_req() - Call handler to start BSS
1159 *
1160 * @pMac: Global MAC context
1161 * @pMsg: Message pointer
1162 *
1163 * Wrapper for the function __lim_handle_sme_start_bss_request
1164 * This message will be defered until softmac come out of
1165 * scan mode or if we have detected radar on the current
1166 * operating channel.
1167 *
1168 * return true - If we consumed the buffer
1169 * false - If have defered the message.
1170 */
Rajeev Kumarfeb96382017-01-22 19:42:09 -08001171static bool __lim_process_sme_start_bss_req(tpAniSirGlobal pMac,
1172 struct scheduler_msg *pMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001173{
1174 if (__lim_is_defered_msg_for_learn(pMac, pMsg) ||
1175 __lim_is_defered_msg_for_radar(pMac, pMsg)) {
1176 /**
1177 * If message defered, buffer is not consumed yet.
1178 * So return false
1179 */
1180 return false;
1181 }
1182
1183 __lim_handle_sme_start_bss_request(pMac, (uint32_t *) pMsg->bodyptr);
1184 return true;
1185}
1186
1187/**
1188 * lim_get_random_bssid()
1189 *
1190 * FUNCTION:This function is called to process generate the random number for bssid
1191 * This function is called to process SME_SCAN_REQ message
1192 * from HDD or upper layer application.
1193 *
1194 * LOGIC:
1195 *
1196 * ASSUMPTIONS:
1197 *
1198 * NOTE:
1199 * 1. geneartes the unique random number for bssid in ibss
1200 *
1201 * @param pMac Pointer to Global MAC structure
1202 * @param *data Pointer to bssid buffer
1203 * @return None
1204 */
1205void lim_get_random_bssid(tpAniSirGlobal pMac, uint8_t *data)
1206{
1207 uint32_t random[2];
1208 random[0] = tx_time_get();
1209 random[0] |= (random[0] << 15);
1210 random[1] = random[0] >> 1;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301211 qdf_mem_copy(data, (uint8_t *) random, sizeof(tSirMacAddr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001212}
1213
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301214static QDF_STATUS lim_send_hal_start_scan_offload_req(tpAniSirGlobal pMac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001215 tpSirSmeScanReq pScanReq)
1216{
1217 tSirScanOffloadReq *pScanOffloadReq;
1218 uint8_t *p;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07001219 struct scheduler_msg msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001220 uint16_t i, len;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07001221 uint16_t addn_ie_len = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001222 tSirRetStatus status, rc = eSIR_SUCCESS;
1223 tDot11fIEExtCap extracted_extcap = {0};
1224 bool extcap_present = true;
1225
1226 if (pScanReq->uIEFieldLen) {
1227 status = lim_strip_extcap_update_struct(pMac,
1228 (uint8_t *) pScanReq + pScanReq->uIEFieldOffset,
1229 &pScanReq->uIEFieldLen, &extracted_extcap);
1230
1231 if (eSIR_SUCCESS != status) {
1232 extcap_present = false;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001233 pe_debug("Unable to Strip ExtCap IE from Scan Req");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001234 }
1235
1236 if (extcap_present) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001237 pe_debug("Extcap was part of SCAN IE - Updating FW");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001238 lim_send_ext_cap_ie(pMac, pScanReq->sessionId,
1239 &extracted_extcap, true);
1240 }
1241 } else {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001242 pe_debug("No IEs in the scan request from supplicant");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001243 }
1244
1245 /**
1246 * The tSirScanOffloadReq will reserve the space for first channel,
1247 * so allocate the memory for (numChannels - 1) and uIEFieldLen
1248 */
1249 len = sizeof(tSirScanOffloadReq) +
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07001250 (pScanReq->channelList.numChannels - 1) +
1251 pScanReq->uIEFieldLen;
Naveen Rawat02e12662016-08-31 16:49:27 -07001252
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301253 pScanOffloadReq = qdf_mem_malloc(len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001254 if (NULL == pScanOffloadReq) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001255 pe_err("AllocateMemory failed for pScanOffloadReq");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301256 return QDF_STATUS_E_NOMEM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001257 }
1258
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001259 msg.type = WMA_START_SCAN_OFFLOAD_REQ;
1260 msg.bodyptr = pScanOffloadReq;
1261 msg.bodyval = 0;
1262
Anurag Chouhanc5548422016-02-24 18:33:27 +05301263 qdf_copy_macaddr(&pScanOffloadReq->bssId, &pScanReq->bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001264
1265 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001266 pe_err("Invalid value (%d) for numSsid",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001267 SIR_SCAN_MAX_NUM_SSID);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301268 qdf_mem_free(pScanOffloadReq);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301269 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001270 }
1271
1272 pScanOffloadReq->numSsid = pScanReq->numSsid;
1273 for (i = 0; i < pScanOffloadReq->numSsid; i++) {
1274 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301275 qdf_mem_copy((uint8_t *) pScanOffloadReq->ssId[i].ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001276 (uint8_t *) pScanReq->ssId[i].ssId,
1277 pScanOffloadReq->ssId[i].length);
1278 }
1279
1280 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Anurag Chouhanc5548422016-02-24 18:33:27 +05301281 qdf_copy_macaddr(&pScanOffloadReq->selfMacAddr, &pScanReq->selfMacAddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001282 pScanOffloadReq->bssType = pScanReq->bssType;
1283 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1284 pScanOffloadReq->scanType = pScanReq->scanType;
1285 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1286 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1287 pScanOffloadReq->restTime = pScanReq->restTime;
Agrawal Ashish17bb3902016-05-05 13:29:40 +05301288 pScanOffloadReq->min_rest_time = pScanReq->min_rest_time;
1289 pScanOffloadReq->idle_time = pScanReq->idle_time;
Gupta, Kapil96c7f2f2016-04-25 19:13:41 +05301290 pScanOffloadReq->scan_adaptive_dwell_mode =
1291 pScanReq->scan_adaptive_dwell_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001292
Paul Zhangd2315472017-02-22 10:02:50 +08001293 for (i = 0; i < pMac->lim.maxBssId; i++) {
1294 tpPESession session_entry =
1295 pe_find_session_by_sme_session_id(pMac, i);
1296 if (session_entry &&
1297 (eLIM_MLM_LINK_ESTABLISHED_STATE ==
1298 session_entry->limMlmState) &&
1299 (session_entry->beaconParams.beaconInterval
1300 < BEACON_INTERVAL_THRESHOLD)) {
1301 pScanOffloadReq->burst_scan_duration =
1302 STA_BURST_SCAN_DURATION;
1303 break;
1304 }
1305 }
1306
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001307 /* for normal scan, the value for p2pScanType should be 0
1308 always */
1309 if (pScanReq->p2pSearch)
1310 pScanOffloadReq->p2pScanType = P2P_SCAN_TYPE_SEARCH;
1311
1312 pScanOffloadReq->sessionId = pScanReq->sessionId;
1313 pScanOffloadReq->scan_id = pScanReq->scan_id;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001314 pScanOffloadReq->scan_requestor_id = USER_SCAN_REQUESTOR_ID;
Gupta, Kapil96c7f2f2016-04-25 19:13:41 +05301315 pScanOffloadReq->scan_adaptive_dwell_mode =
1316 pScanReq->scan_adaptive_dwell_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001317
1318 if (pScanOffloadReq->sessionId >= pMac->lim.maxBssId)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001319 pe_err("Invalid pe sessionID: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001320 pScanOffloadReq->sessionId);
1321
1322 pScanOffloadReq->channelList.numChannels =
1323 pScanReq->channelList.numChannels;
1324 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1325 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1326 p[i] = pScanReq->channelList.channelNumber[i];
1327
1328 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1329 pScanOffloadReq->uIEFieldOffset = len - addn_ie_len -
1330 pScanOffloadReq->uIEFieldLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301331 qdf_mem_copy((uint8_t *) pScanOffloadReq +
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001332 pScanOffloadReq->uIEFieldOffset,
1333 (uint8_t *) pScanReq + pScanReq->uIEFieldOffset,
1334 pScanReq->uIEFieldLen);
Naveen Rawat02e12662016-08-31 16:49:27 -07001335
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001336 rc = wma_post_ctrl_msg(pMac, &msg);
1337 if (rc != eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001338 pe_err("wma_post_ctrl_msg() return failure");
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301339 qdf_mem_free(pScanOffloadReq);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301340 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001341 }
1342
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001343 pe_debug("Processed Offload Scan Request Successfully");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001344
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301345 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001346}
1347
1348/**
1349 * __lim_process_sme_scan_req() - Process the SME Scan Request
1350 * @mac_ctx: Global MAC Context
1351 * @msg_buf: Buffer which contains the request and pertinent parameters
1352 *
1353 * This function is called to process SME_SCAN_REQ message
1354 * from HDD or upper layer application.
1355 *
1356 * Return: None
1357 */
1358
1359static void __lim_process_sme_scan_req(tpAniSirGlobal mac_ctx,
1360 uint32_t *msg_buf)
1361{
1362 tpSirSmeScanReq scan_req;
1363 uint8_t valid_req = 0;
1364
1365#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1366 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL,
1367 eSIR_SUCCESS, eSIR_SUCCESS);
1368#endif
Sreelakshmi Konamki1bb6f312016-12-08 12:32:01 +05301369 mac_ctx->lim.beacon_probe_rsp_cnt_per_scan = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370
1371 scan_req = (tpSirSmeScanReq) msg_buf;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001372 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 Dhavali7090c5f2015-11-02 17:55:19 -08001373 scan_req->scan_id, scan_req->channelList.numChannels,
1374 scan_req->minChannelTime, scan_req->maxChannelTime,
1375 scan_req->uIEFieldLen, scan_req->returnAfterFirstMatch,
1376 scan_req->returnFreshResults, scan_req->returnUniqueResults,
Sreelakshmi Konamki39acb132015-12-16 13:06:22 +05301377 lim_scan_type_to_string(scan_req->scanType),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001378 scan_req->scanType, mac_ctx->lim.gLimRspReqd ? 1 : 0);
1379 /*
1380 * Since scan req always requires a response, we will overwrite response
1381 * required here. This is added esp to take care of the condition where
1382 * in p2p go case, we hold the scan req and insert single NOA. We send
1383 * the held scan request to FW later on getting start NOA ind from FW so
1384 * we lose state of the gLimRspReqd flag for the scan req if any other
1385 * request comes by then. e.g. While unit testing, we found when insert
1386 * single NOA is done, we see a get stats request which turns the flag
1387 * gLimRspReqd to false; now when we actually start the saved scan req
1388 * for init scan after getting NOA started, the gLimRspReqd being a
1389 * global flag is showing false instead of true value for this saved
1390 * scan req. Since all scan reqs coming to lim require a response,
1391 * there is no harm in setting the global flag gLimRspReqd to true here.
1392 */
1393 mac_ctx->lim.gLimRspReqd = true;
1394
1395 /*
1396 * copy the Self MAC address from SmeReq to the globalplace,
1397 * used for sending probe req
1398 */
Srinivas Girigowda2c6bf002015-09-24 11:43:31 -07001399 sir_copy_mac_addr(mac_ctx->lim.gSelfMacAddr,
1400 scan_req->selfMacAddr.bytes);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001401 valid_req = lim_is_sme_scan_req_valid(mac_ctx, scan_req);
1402
1403 if (!valid_req || mac_ctx->lim.scan_disabled) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001404 pe_err("Scan disabled %d, Valid Scan Req %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001405 mac_ctx->lim.scan_disabled, valid_req);
1406
1407 if (mac_ctx->lim.gLimRspReqd) {
1408 mac_ctx->lim.gLimRspReqd = false;
1409
1410 lim_send_sme_scan_rsp(mac_ctx,
1411 eSIR_SME_INVALID_PARAMETERS,
1412 scan_req->sessionId,
1413 scan_req->transactionId,
1414 scan_req->scan_id);
1415 }
1416 return;
1417 }
1418
1419 /*
1420 * If scan request is received in idle, joinFailed
1421 * states or in link established state (in STA role)
1422 * or in normal state (in STA-in-IBSS/AP role) with
1423 * 'return fresh scan results' request from HDD or
1424 * it is periodic background scanning request,
1425 * trigger fresh scan request to MLM
1426 */
1427 if (__lim_fresh_scan_reqd(mac_ctx, scan_req->returnFreshResults)) {
1428
1429 mac_ctx->lim.gLim24Band11dScanDone = 0;
1430 mac_ctx->lim.gLim50Band11dScanDone = 0;
1431 mac_ctx->lim.gLimReturnAfterFirstMatch =
1432 scan_req->returnAfterFirstMatch;
1433 mac_ctx->lim.gLimReturnUniqueResults =
1434 ((scan_req->returnUniqueResults) > 0 ? true : false);
1435
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301436 if (QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001437 lim_send_hal_start_scan_offload_req(mac_ctx,
1438 scan_req)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001439 pe_err("Couldn't send Offload scan request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001440 lim_send_sme_scan_rsp(mac_ctx,
1441 eSIR_SME_INVALID_PARAMETERS,
1442 scan_req->sessionId,
1443 scan_req->transactionId,
1444 scan_req->scan_id);
1445 return;
1446 }
Anurag Chouhanffb21542016-02-17 14:33:03 +05301447 } else {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001448 /* In all other cases return 'cached' scan results */
1449 if (mac_ctx->lim.gLimRspReqd) {
1450 mac_ctx->lim.gLimRspReqd = false;
1451 lim_send_sme_scan_rsp(mac_ctx, eSIR_SME_SUCCESS,
1452 scan_req->sessionId,
1453 scan_req->transactionId, scan_req->scan_id);
1454 }
1455 }
1456}
1457
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001458/**
1459 * __lim_process_clear_dfs_channel_list()
1460 *
1461 ***FUNCTION:
1462 ***Clear DFS channel list when country is changed/aquired.
1463 .*This message is sent from SME.
1464 *
1465 ***LOGIC:
1466 *
1467 ***ASSUMPTIONS:
1468 *
1469 ***NOTE:
1470 *
1471 * @param pMac Pointer to Global MAC structure
1472 * @param *pMsgBuf A pointer to the SME message buffer
1473 * @return None
1474 */
Rajeev Kumarfeb96382017-01-22 19:42:09 -08001475static void __lim_process_clear_dfs_channel_list(tpAniSirGlobal pMac,
1476 struct scheduler_msg *pMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001477{
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301478 qdf_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001479}
1480
1481/**
1482 * __lim_process_sme_join_req() - process SME_JOIN_REQ message
1483 * @mac_ctx: Pointer to Global MAC structure
1484 * @msg_buf: A pointer to the SME message buffer
1485 *
1486 * This function is called to process SME_JOIN_REQ message
1487 * from HDD or upper layer application.
1488 *
1489 * Return: None
1490 */
1491static void
1492__lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
1493{
1494 tpSirSmeJoinReq sme_join_req = NULL;
1495 tLimMlmJoinReq *mlm_join_req;
1496 tSirResultCodes ret_code = eSIR_SME_SUCCESS;
1497 uint32_t val = 0;
1498 uint16_t n_size;
1499 uint8_t session_id;
1500 tpPESession session = NULL;
Nitesh Shah0102cac2016-07-13 14:38:30 +05301501 uint8_t sme_session_id = 0;
1502 uint16_t sme_transaction_id = 0;
Amar Singhala297bfa2015-10-15 15:07:29 -07001503 int8_t local_power_constraint = 0, reg_max = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001504 uint16_t ie_len;
Naveen Rawat08db88f2017-09-08 15:07:48 -07001505 const uint8_t *vendor_ie;
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001506 tSirBssDescription *bss_desc;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07001507 struct vdev_type_nss *vdev_type_nss;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001508
Arif Hussain995fcaf2016-07-18 11:28:22 -07001509 if (!mac_ctx || !msg_buf) {
1510 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
1511 FL("JOIN REQ with invalid data"));
1512 return;
1513 }
1514
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001515/* FEATURE_WLAN_DIAG_SUPPORT */
1516#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1517 /*
1518 * Not sending any session, since it is not created yet.
1519 * The response whould have correct state.
1520 */
1521 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1522#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1523
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001524 /*
1525 * Expect Join request in idle state.
1526 * Reassociate request is expected in link established state.
1527 */
1528
1529 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1530 if (mac_ctx->lim.gLimSmeState == eLIM_SME_IDLE_STATE) {
1531 n_size = __lim_get_sme_join_req_size_for_alloc((uint8_t *)
1532 msg_buf);
1533
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301534 sme_join_req = qdf_mem_malloc(n_size);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001535 if (NULL == sme_join_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001536 pe_err("AllocateMemory failed for sme_join_req");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001537 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
Nitesh Shah0102cac2016-07-13 14:38:30 +05301538 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001539 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301540 (void)qdf_mem_copy((void *)sme_join_req, (void *)msg_buf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001541 n_size);
1542
1543 if (!lim_is_sme_join_req_valid(mac_ctx, sme_join_req)) {
1544 /* Received invalid eWNI_SME_JOIN_REQ */
1545 /* Log the event */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001546 pe_warn("SessionId:%d JOIN REQ with invalid data",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001547 sme_join_req->sessionId);
1548 ret_code = eSIR_SME_INVALID_PARAMETERS;
1549 goto end;
1550 }
1551
Krishna Kumaar Natarajanf599c6e2015-11-03 11:44:03 -08001552 /*
1553 * Update the capability here itself as this is used in
1554 * lim_extract_ap_capability() below. If not updated issues
1555 * like not honoring power constraint on 1st association after
1556 * driver loading might occur.
1557 */
1558 lim_update_rrm_capability(mac_ctx, sme_join_req);
1559
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001560 bss_desc = &sme_join_req->bssDescription;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001561 /* check for the existence of start BSS session */
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001562 session = pe_find_session_by_bssid(mac_ctx, bss_desc->bssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001563 &session_id);
1564
1565 if (session != NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001566 pe_err("Session(%d) Already exists for BSSID: "
1567 MAC_ADDRESS_STR " in limSmeState = %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001568 session_id,
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001569 MAC_ADDR_ARRAY(bss_desc->bssId),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001570 session->limSmeState);
1571
1572 if (session->limSmeState == eLIM_SME_LINK_EST_STATE &&
1573 session->smeSessionId == sme_join_req->sessionId) {
1574 /*
1575 * Received eWNI_SME_JOIN_REQ for same
1576 * BSS as currently associated.
1577 * Log the event and send success
1578 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001579 pe_warn("SessionId: %d", session_id);
1580 pe_warn("JOIN_REQ for current joined BSS");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001581 /* Send Join success response to host */
1582 ret_code = eSIR_SME_ALREADY_JOINED_A_BSS;
1583 session = NULL;
1584 goto end;
1585 } else {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001586 pe_err("JOIN_REQ not for current joined BSS");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001587 ret_code = eSIR_SME_REFUSED;
1588 session = NULL;
1589 goto end;
1590 }
1591 } else {
1592 /*
1593 * Session Entry does not exist for given BSSId
1594 * Try to Create a new session
1595 */
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001596 session = pe_create_session(mac_ctx, bss_desc->bssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001597 &session_id, mac_ctx->lim.maxStation,
1598 eSIR_INFRASTRUCTURE_MODE);
1599 if (session == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001600 pe_err("Session Can not be created");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001601 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
1602 goto end;
1603 } else
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001604 pe_debug("SessionId:%d New session created",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001605 session_id);
1606 }
Deepak Dhamdhere612392c2016-08-28 02:56:51 -07001607 session->max_amsdu_num = sme_join_req->max_amsdu_num;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001608
1609 /*
1610 * Store Session related parameters
1611 * Store PE session Id in session Table
1612 */
1613 session->peSessionId = session_id;
1614
1615 /* store the smejoin req handle in session table */
1616 session->pLimJoinReq = sme_join_req;
1617
1618 /* Store SME session Id in sessionTable */
1619 session->smeSessionId = sme_join_req->sessionId;
1620
1621 /* Store SME transaction Id in session Table */
1622 session->transactionId = sme_join_req->transactionId;
1623
1624 /* Store beaconInterval */
1625 session->beaconParams.beaconInterval =
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001626 bss_desc->beaconInterval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001627
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301628 qdf_mem_copy(&(session->htConfig), &(sme_join_req->htConfig),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001629 sizeof(session->htConfig));
1630
Sandeep Puligilla98917432016-06-10 13:50:28 -07001631 qdf_mem_copy(&(session->vht_config),
1632 &(sme_join_req->vht_config),
1633 sizeof(session->vht_config));
1634
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001635 /* Copying of bssId is already done, while creating session */
1636 sir_copy_mac_addr(session->selfMacAddr,
1637 sme_join_req->selfMacAddr);
1638 session->bssType = sme_join_req->bsstype;
1639
1640 session->statypeForBss = STA_ENTRY_PEER;
1641 session->limWmeEnabled = sme_join_req->isWMEenabled;
1642 session->limQosEnabled = sme_join_req->isQosEnabled;
Abhishek Singhf78bd2d2016-04-27 16:47:56 +05301643 session->wps_registration = sme_join_req->wps_registration;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001644
Selvaraj, Sridhar05ea0792017-05-17 12:17:03 +05301645 session->enable_bcast_probe_rsp =
1646 sme_join_req->enable_bcast_probe_rsp;
1647
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001648 /* Store vendor specfic IE for CISCO AP */
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001649 ie_len = (bss_desc->length + sizeof(bss_desc->length) -
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001650 GET_FIELD_OFFSET(tSirBssDescription, ieFields));
1651
Naveen Rawat08db88f2017-09-08 15:07:48 -07001652 vendor_ie = wlan_get_vendor_ie_ptr_from_oui(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001653 SIR_MAC_CISCO_OUI, SIR_MAC_CISCO_OUI_SIZE,
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001654 ((uint8_t *)&bss_desc->ieFields), ie_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001655
1656 if (NULL != vendor_ie) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001657 pe_debug("Cisco vendor OUI present");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001658 session->isCiscoVendorAP = true;
1659 } else {
1660 session->isCiscoVendorAP = false;
1661 }
1662
1663 /* Copy the dot 11 mode in to the session table */
1664
1665 session->dot11mode = sme_join_req->dot11mode;
1666#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1667 session->cc_switch_mode = sme_join_req->cc_switch_mode;
1668#endif
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001669 session->nwType = bss_desc->nwType;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001670 session->enableAmpduPs = sme_join_req->enableAmpduPs;
1671 session->enableHtSmps = sme_join_req->enableHtSmps;
1672 session->htSmpsvalue = sme_join_req->htSmps;
Archana Ramachandranfec24812016-02-16 16:31:56 -08001673 session->send_smps_action =
1674 sme_join_req->send_smps_action;
Archana Ramachandran5482d6a2016-03-29 17:09:22 -07001675 /*
1676 * By default supported NSS 1x1 is set to true
1677 * and later on updated while determining session
1678 * supported rates which is the intersection of
1679 * self and peer rates
1680 */
1681 session->supported_nss_1x1 = true;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05301682 /*Store Persona */
1683 session->pePersona = sme_join_req->staPersona;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001684 pe_debug("enable Smps: %d mode: %d send action: %d supported nss 1x1: %d pePersona %d cbMode %d",
Archana Ramachandran20d2e232016-02-11 16:58:40 -08001685 session->enableHtSmps,
Archana Ramachandranfec24812016-02-16 16:31:56 -08001686 session->htSmpsvalue,
Archana Ramachandran5482d6a2016-03-29 17:09:22 -07001687 session->send_smps_action,
Abhishek Singh23edd1c2016-05-05 11:56:06 +05301688 session->supported_nss_1x1,
1689 session->pePersona,
1690 sme_join_req->cbMode);
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07001691
1692 /*Store Persona */
1693 session->pePersona = sme_join_req->staPersona;
Abhishek Singh4294f802017-08-10 16:37:07 +05301694 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Abhishek Singhb59f8d42017-07-31 14:42:47 +05301695 FL("PE PERSONA=%d cbMode %u nwType: %d dot11mode: %d force_24ghz_in_ht20 %d"),
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08001696 session->pePersona, sme_join_req->cbMode,
Abhishek Singhb59f8d42017-07-31 14:42:47 +05301697 session->nwType, session->dot11mode,
1698 sme_join_req->force_24ghz_in_ht20);
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08001699
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07001700 /* Copy The channel Id to the session Table */
1701 session->currentOperChannel = bss_desc->channelId;
1702 if (IS_5G_CH(session->currentOperChannel))
1703 vdev_type_nss = &mac_ctx->vdev_type_nss_5g;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001704 else
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07001705 vdev_type_nss = &mac_ctx->vdev_type_nss_2g;
1706 if (session->pePersona == QDF_P2P_CLIENT_MODE)
1707 session->vdev_nss = vdev_type_nss->p2p_cli;
1708 else
1709 session->vdev_nss = vdev_type_nss->sta;
1710 session->nss = session->vdev_nss;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001711 session->vhtCapability =
1712 IS_DOT11_MODE_VHT(session->dot11mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001713 if (session->vhtCapability) {
Anurag Chouhan6d760662016-02-20 16:05:43 +05301714 if (session->pePersona == QDF_STA_MODE) {
Krunal Soni53993f72016-07-08 18:20:03 -07001715 session->vht_config.su_beam_formee =
1716 sme_join_req->vht_config.su_beam_formee;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001717 } else {
Krunal Soni53993f72016-07-08 18:20:03 -07001718 session->vht_config.su_beam_formee = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001719 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001720 session->enableVhtpAid =
1721 sme_join_req->enableVhtpAid;
1722 session->enableVhtGid =
1723 sme_join_req->enableVhtGid;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001724 pe_debug("vht su bformer [%d]",
Krunal Soni53993f72016-07-08 18:20:03 -07001725 session->vht_config.su_beam_former);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001726 }
Krunal Soni53993f72016-07-08 18:20:03 -07001727
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001728 if (IS_DOT11_MODE_HE(session->dot11mode)) {
1729 lim_update_session_he_capable(mac_ctx, session);
1730 lim_copy_join_req_he_cap(session, sme_join_req);
1731 }
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08001732
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001733 pe_debug("vhtCapability: %d su_beam_formee: %d txbf_csn_value: %d su_tx_bformer %d",
Abhishek Singh23edd1c2016-05-05 11:56:06 +05301734 session->vhtCapability,
Krunal Soni53993f72016-07-08 18:20:03 -07001735 session->vht_config.su_beam_formee,
1736 session->vht_config.csnof_beamformer_antSup,
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -08001737 session->vht_config.su_beam_former);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001738 /*Phy mode */
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001739 session->gLimPhyMode = bss_desc->nwType;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001740 handle_ht_capabilityand_ht_info(mac_ctx, session);
Abhishek Singhb59f8d42017-07-31 14:42:47 +05301741 session->force_24ghz_in_ht20 =
1742 sme_join_req->force_24ghz_in_ht20;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001743 /* cbMode is already merged value of peer and self -
1744 * done by csr in csr_get_cb_mode_from_ies */
1745 session->htSupportedChannelWidthSet =
1746 (sme_join_req->cbMode) ? 1 : 0;
1747 session->htRecommendedTxWidthSet =
1748 session->htSupportedChannelWidthSet;
1749 session->htSecondaryChannelOffset = sme_join_req->cbMode;
1750
1751 if (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == sme_join_req->cbMode) {
1752 session->ch_center_freq_seg0 =
1753 session->currentOperChannel - 2;
1754 session->ch_width = CH_WIDTH_40MHZ;
1755 } else if (PHY_DOUBLE_CHANNEL_LOW_PRIMARY ==
1756 sme_join_req->cbMode) {
1757 session->ch_center_freq_seg0 =
1758 session->currentOperChannel + 2;
1759 session->ch_width = CH_WIDTH_40MHZ;
1760 } else {
1761 session->ch_center_freq_seg0 = 0;
1762 session->ch_width = CH_WIDTH_20MHZ;
1763 }
1764
1765 /* Record if management frames need to be protected */
1766#ifdef WLAN_FEATURE_11W
Krishna Kumaar Natarajan48de7de2015-12-08 14:43:13 -08001767 if (eSIR_ED_AES_128_CMAC == sme_join_req->MgmtEncryptionType)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001768 session->limRmfEnabled = 1;
Krishna Kumaar Natarajan48de7de2015-12-08 14:43:13 -08001769 else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001770 session->limRmfEnabled = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001771#endif
1772
1773#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
Krunal Soni0acfdcd2016-03-09 12:03:06 -08001774 session->rssi = bss_desc->rssi;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001775#endif
1776
1777 /* Copy the SSID from smejoinreq to session entry */
1778 session->ssId.length = sme_join_req->ssId.length;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301779 qdf_mem_copy(session->ssId.ssId, sme_join_req->ssId.ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001780 session->ssId.length);
1781
1782 /*
1783 * Determin 11r or ESE connection based on input from SME
1784 * which inturn is dependent on the profile the user wants
1785 * to connect to, So input is coming from supplicant
1786 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001787 session->is11Rconnection = sme_join_req->is11Rconnection;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001788#ifdef FEATURE_WLAN_ESE
1789 session->isESEconnection = sme_join_req->isESEconnection;
1790#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001791 session->isFastTransitionEnabled =
1792 sme_join_req->isFastTransitionEnabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001793
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001794 session->isFastRoamIniFeatureEnabled =
1795 sme_join_req->isFastRoamIniFeatureEnabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001796 session->txLdpcIniFeatureEnabled =
1797 sme_join_req->txLdpcIniFeatureEnabled;
1798
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05301799 lim_update_fils_config(session, sme_join_req);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001800 if (session->bssType == eSIR_INFRASTRUCTURE_MODE) {
1801 session->limSystemRole = eLIM_STA_ROLE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001802 } else {
1803 /*
1804 * Throw an error and return and make
1805 * sure to delete the session.
1806 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001807 pe_err("recvd JOIN_REQ with invalid bss type %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001808 session->bssType);
1809 ret_code = eSIR_SME_INVALID_PARAMETERS;
1810 goto end;
1811 }
1812
1813 if (sme_join_req->addIEScan.length)
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301814 qdf_mem_copy(&session->pLimJoinReq->addIEScan,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001815 &sme_join_req->addIEScan, sizeof(tSirAddie));
1816
1817 if (sme_join_req->addIEAssoc.length)
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301818 qdf_mem_copy(&session->pLimJoinReq->addIEAssoc,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001819 &sme_join_req->addIEAssoc, sizeof(tSirAddie));
1820
1821 val = sizeof(tLimMlmJoinReq) +
1822 session->pLimJoinReq->bssDescription.length + 2;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301823 mlm_join_req = qdf_mem_malloc(val);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001824 if (NULL == mlm_join_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001825 pe_err("AllocateMemory failed for mlmJoinReq");
Nitesh Shah0102cac2016-07-13 14:38:30 +05301826 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
1827 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001828 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001829
1830 /* PE SessionId is stored as a part of JoinReq */
1831 mlm_join_req->sessionId = session->peSessionId;
1832
1833 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1834 (uint32_t *) &mlm_join_req->joinFailureTimeout) !=
1835 eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001836 pe_err("couldn't retrieve JoinFailureTimer value"
1837 " setting to default value");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001838 mlm_join_req->joinFailureTimeout =
1839 WNI_CFG_JOIN_FAILURE_TIMEOUT_STADEF;
1840 }
1841
1842 /* copy operational rate from session */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301843 qdf_mem_copy((void *)&session->rateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001844 (void *)&sme_join_req->operationalRateSet,
1845 sizeof(tSirMacRateSet));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301846 qdf_mem_copy((void *)&session->extRateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001847 (void *)&sme_join_req->extendedRateSet,
1848 sizeof(tSirMacRateSet));
1849 /*
1850 * this may not be needed anymore now, as rateSet is now
1851 * included in the session entry and MLM has session context.
1852 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301853 qdf_mem_copy((void *)&mlm_join_req->operationalRateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001854 (void *)&session->rateSet,
1855 sizeof(tSirMacRateSet));
1856
1857 session->encryptType = sme_join_req->UCEncryptionType;
1858
1859 mlm_join_req->bssDescription.length =
1860 session->pLimJoinReq->bssDescription.length;
1861
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301862 qdf_mem_copy((uint8_t *) &mlm_join_req->bssDescription.bssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001863 (uint8_t *)
1864 &session->pLimJoinReq->bssDescription.bssId,
1865 session->pLimJoinReq->bssDescription.length + 2);
1866
1867 session->limCurrentBssCaps =
1868 session->pLimJoinReq->bssDescription.capabilityInfo;
1869
1870 reg_max = cfg_get_regulatory_max_transmit_power(mac_ctx,
1871 session->currentOperChannel);
1872 local_power_constraint = reg_max;
1873
1874 lim_extract_ap_capability(mac_ctx,
1875 (uint8_t *)
1876 session->pLimJoinReq->bssDescription.ieFields,
1877 lim_get_ielen_from_bss_description(
1878 &session->pLimJoinReq->bssDescription),
1879 &session->limCurrentBssQosCaps,
1880 &session->limCurrentBssPropCap,
1881 &session->gLimCurrentBssUapsd,
1882 &local_power_constraint, session);
1883
Krunal Soni53993f72016-07-08 18:20:03 -07001884 /*
1885 * Once the AP capabilities are available then set the
1886 * beam forming capabilities accordingly.
1887 */
1888 if (session->nss == 1) {
1889 session->vht_config.su_beam_former = 0;
1890 session->vht_config.tx_stbc = 0;
1891 session->vht_config.num_soundingdim = 0;
Selvaraj, Sridhare01e0732016-09-13 12:45:22 +05301892 session->htConfig.ht_tx_stbc = 0;
Krunal Soni53993f72016-07-08 18:20:03 -07001893 }
1894
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001895 session->maxTxPower = lim_get_max_tx_power(reg_max,
1896 local_power_constraint,
1897 mac_ctx->roam.configParam.nTxPowerCap);
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +05301898
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001899 pe_debug("Reg max %d local power con %d max tx pwr %d",
Varun Reddy Yeturu0e3989a2016-04-15 13:30:42 +05301900 reg_max, local_power_constraint, session->maxTxPower);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001901
Agrawal Ashish1fdcbb62017-03-10 17:48:57 +05301902 if (sme_join_req->powerCap.maxTxPower > session->maxTxPower) {
1903 sme_join_req->powerCap.maxTxPower = session->maxTxPower;
1904 pe_debug("Update MaxTxPower in join Req to %d",
1905 sme_join_req->powerCap.maxTxPower);
1906 }
1907
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001908 if (session->gLimCurrentBssUapsd) {
1909 session->gUapsdPerAcBitmask =
1910 session->pLimJoinReq->uapsdPerAcBitmask;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001911 pe_debug("UAPSD flag for all AC - 0x%2x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001912 session->gUapsdPerAcBitmask);
1913
1914 /* resetting the dynamic uapsd mask */
1915 session->gUapsdPerAcDeliveryEnableMask = 0;
1916 session->gUapsdPerAcTriggerEnableMask = 0;
1917 }
1918
1919 session->limRFBand =
1920 lim_get_rf_band(session->currentOperChannel);
1921
1922 /* Initialize 11h Enable Flag */
1923 if (SIR_BAND_5_GHZ == session->limRFBand) {
1924 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_11H_ENABLED,
1925 &val) != eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001926 pe_err("Fail to get WNI_CFG_11H_ENABLED");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001927 session->lim11hEnable =
1928 WNI_CFG_11H_ENABLED_STADEF;
1929 } else {
1930 session->lim11hEnable = val;
1931 }
1932 } else {
1933 session->lim11hEnable = 0;
1934 }
1935
1936 /*
1937 * To care of the scenario when STA transitions from
1938 * IBSS to Infrastructure mode.
1939 */
1940 mac_ctx->lim.gLimIbssCoalescingHappened = false;
1941
1942 session->limPrevSmeState = session->limSmeState;
1943 session->limSmeState = eLIM_SME_WT_JOIN_STATE;
1944 MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE,
1945 session->peSessionId,
1946 session->limSmeState));
1947
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001948 /* Indicate whether spectrum management is enabled */
1949 session->spectrumMgtEnabled =
1950 sme_join_req->spectrumMgtIndicator;
1951
1952 /* Enable the spectrum management if this is a DFS channel */
1953 if (session->country_info_present &&
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -07001954 lim_isconnected_on_dfs_channel(mac_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001955 session->currentOperChannel))
1956 session->spectrumMgtEnabled = true;
1957
1958 session->isOSENConnection = sme_join_req->isOSENConnection;
1959
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001960 /* Issue LIM_MLM_JOIN_REQ to MLM */
1961 lim_post_mlm_message(mac_ctx, LIM_MLM_JOIN_REQ,
1962 (uint32_t *) mlm_join_req);
1963 return;
1964
1965 } else {
1966 /* Received eWNI_SME_JOIN_REQ un expected state */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001967 pe_err("received unexpected SME_JOIN_REQ in state %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001968 mac_ctx->lim.gLimSmeState);
1969 lim_print_sme_state(mac_ctx, LOGE, mac_ctx->lim.gLimSmeState);
1970 ret_code = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1971 session = NULL;
1972 goto end;
1973 }
1974
1975end:
Nitesh Shah0102cac2016-07-13 14:38:30 +05301976 lim_get_session_info(mac_ctx, (uint8_t *) msg_buf,
1977 &sme_session_id, &sme_transaction_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001978
1979 if (sme_join_req) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301980 qdf_mem_free(sme_join_req);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001981 sme_join_req = NULL;
1982 if (NULL != session)
1983 session->pLimJoinReq = NULL;
1984 }
1985 if (ret_code != eSIR_SME_SUCCESS) {
1986 if (NULL != session) {
1987 pe_delete_session(mac_ctx, session);
1988 session = NULL;
1989 }
1990 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07001991 pe_debug("Send failure status on sessionid: %d with ret_code: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001992 sme_session_id, ret_code);
1993 lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_JOIN_RSP, ret_code,
1994 eSIR_MAC_UNSPEC_FAILURE_STATUS, session, sme_session_id,
1995 sme_transaction_id);
1996}
1997
Amar Singhala297bfa2015-10-15 15:07:29 -07001998uint8_t lim_get_max_tx_power(int8_t regMax, int8_t apTxPower,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001999 uint8_t iniTxPower)
2000{
2001 uint8_t maxTxPower = 0;
Anurag Chouhan6d760662016-02-20 16:05:43 +05302002 uint8_t txPower = QDF_MIN(regMax, (apTxPower));
2003 txPower = QDF_MIN(txPower, iniTxPower);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002004 if ((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2005 maxTxPower = txPower;
2006 else if (txPower < MIN_TX_PWR_CAP)
2007 maxTxPower = MIN_TX_PWR_CAP;
2008 else
2009 maxTxPower = MAX_TX_PWR_CAP;
2010
2011 return maxTxPower;
2012}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002013
2014/**
2015 * __lim_process_sme_reassoc_req() - process reassoc req
2016 *
2017 * @mac_ctx: Pointer to Global MAC structure
2018 * @msg_buf: pointer to the SME message buffer
2019 *
2020 * This function is called to process SME_REASSOC_REQ message
2021 * from HDD or upper layer application.
2022 *
2023 * Return: None
2024 */
2025
2026static void __lim_process_sme_reassoc_req(tpAniSirGlobal mac_ctx,
2027 uint32_t *msg_buf)
2028{
2029 uint16_t caps;
2030 uint32_t val;
2031 tpSirSmeJoinReq reassoc_req = NULL;
2032 tLimMlmReassocReq *mlm_reassoc_req;
2033 tSirResultCodes ret_code = eSIR_SME_SUCCESS;
2034 tpPESession session_entry = NULL;
2035 uint8_t session_id;
2036 uint8_t sme_session_id;
2037 uint16_t transaction_id;
Amar Singhala297bfa2015-10-15 15:07:29 -07002038 int8_t local_pwr_constraint = 0, reg_max = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002039 uint32_t tele_bcn_en = 0;
2040 uint16_t size;
2041
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002042 size = __lim_get_sme_join_req_size_for_alloc((uint8_t *)msg_buf);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302043 reassoc_req = qdf_mem_malloc(size);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002044 if (NULL == reassoc_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002045 pe_err("call to AllocateMemory failed for reassoc_req");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002046
2047 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
2048 goto end;
2049 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302050 (void)qdf_mem_copy((void *)reassoc_req, (void *)msg_buf, size);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002051
2052 if (!lim_is_sme_join_req_valid(mac_ctx,
2053 (tpSirSmeJoinReq)reassoc_req)) {
2054 /*
2055 * Received invalid eWNI_SME_REASSOC_REQ
2056 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002057 pe_warn("received SME_REASSOC_REQ with invalid data");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002058
2059 ret_code = eSIR_SME_INVALID_PARAMETERS;
2060 goto end;
2061 }
2062
2063 session_entry = pe_find_session_by_bssid(mac_ctx,
2064 reassoc_req->bssDescription.bssId,
2065 &session_id);
2066 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002067 pe_err("Session does not exist for given bssId");
Varun Reddy Yeturu658b8022016-09-23 11:10:42 -07002068 lim_print_mac_addr(mac_ctx, reassoc_req->bssDescription.bssId,
2069 LOGE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002070 ret_code = eSIR_SME_INVALID_PARAMETERS;
Varun Reddy Yeturu658b8022016-09-23 11:10:42 -07002071 lim_get_session_info(mac_ctx, (uint8_t *)msg_buf,
2072 &sme_session_id, &transaction_id);
2073 session_entry =
2074 pe_find_session_by_sme_session_id(mac_ctx,
2075 sme_session_id);
2076 if (session_entry != NULL)
2077 lim_handle_sme_join_result(mac_ctx,
2078 eSIR_SME_INVALID_PARAMETERS,
2079 eSIR_MAC_UNSPEC_FAILURE_STATUS,
2080 session_entry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002081 goto end;
2082 }
2083#ifdef FEATURE_WLAN_DIAG_SUPPORT /* FEATURE_WLAN_DIAG_SUPPORT */
2084 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_REASSOC_REQ_EVENT,
2085 session_entry, eSIR_SUCCESS, eSIR_SUCCESS);
2086#endif /* FEATURE_WLAN_DIAG_SUPPORT */
2087 /* mac_ctx->lim.gpLimReassocReq = reassoc_req;//TO SUPPORT BT-AMP */
2088
2089 /* Store the reassoc handle in the session Table */
2090 session_entry->pLimReAssocReq = reassoc_req;
2091
2092 session_entry->dot11mode = reassoc_req->dot11mode;
2093 session_entry->vhtCapability =
2094 IS_DOT11_MODE_VHT(reassoc_req->dot11mode);
Archana Ramachandran20d2e232016-02-11 16:58:40 -08002095
Padma, Santhosh Kumar429553d2016-08-08 18:49:31 +05302096 if (session_entry->vhtCapability) {
2097 if (session_entry->pePersona == QDF_STA_MODE) {
2098 session_entry->vht_config.su_beam_formee =
2099 reassoc_req->vht_config.su_beam_formee;
2100 } else {
2101 reassoc_req->vht_config.su_beam_formee = 0;
2102 }
2103 session_entry->enableVhtpAid =
2104 reassoc_req->enableVhtpAid;
2105 session_entry->enableVhtGid =
2106 reassoc_req->enableVhtGid;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002107 pe_debug("vht su bformer [%d]", session_entry->vht_config.su_beam_former);
Padma, Santhosh Kumar429553d2016-08-08 18:49:31 +05302108 }
2109
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002110 pe_debug("vhtCapability: %d su_beam_formee: %d su_tx_bformer %d",
Padma, Santhosh Kumar429553d2016-08-08 18:49:31 +05302111 session_entry->vhtCapability,
2112 session_entry->vht_config.su_beam_formee,
2113 session_entry->vht_config.su_beam_former);
2114
Archana Ramachandran20d2e232016-02-11 16:58:40 -08002115 session_entry->enableHtSmps = reassoc_req->enableHtSmps;
2116 session_entry->htSmpsvalue = reassoc_req->htSmps;
Archana Ramachandranfec24812016-02-16 16:31:56 -08002117 session_entry->send_smps_action =
2118 reassoc_req->send_smps_action;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002119 pe_debug("enableHtSmps: %d htSmps: %d send action: %d supported nss 1x1: %d",
Archana Ramachandran20d2e232016-02-11 16:58:40 -08002120 session_entry->enableHtSmps,
Archana Ramachandranfec24812016-02-16 16:31:56 -08002121 session_entry->htSmpsvalue,
Archana Ramachandran5482d6a2016-03-29 17:09:22 -07002122 session_entry->send_smps_action,
2123 session_entry->supported_nss_1x1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002124 /*
2125 * Reassociate request is expected
2126 * in link established state only.
2127 */
2128
2129 if (session_entry->limSmeState != eLIM_SME_LINK_EST_STATE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002130 if (session_entry->limSmeState == eLIM_SME_WT_REASSOC_STATE) {
2131 /*
2132 * May be from 11r FT pre-auth. So lets check it
2133 * before we bail out
2134 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002135 pe_debug("Session in reassoc state is %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002136 session_entry->peSessionId);
2137
2138 /* Make sure its our preauth bssid */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302139 if (qdf_mem_cmp(reassoc_req->bssDescription.bssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002140 session_entry->limReAssocbssId,
2141 6)) {
2142 lim_print_mac_addr(mac_ctx,
2143 reassoc_req->bssDescription.
2144 bssId, LOGE);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002145 pe_err("Unknown bssId in reassoc state");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002146 ret_code = eSIR_SME_INVALID_PARAMETERS;
2147 goto end;
2148 }
2149
2150 lim_process_mlm_ft_reassoc_req(mac_ctx, msg_buf,
2151 session_entry);
2152 return;
2153 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002154 /*
2155 * Should not have received eWNI_SME_REASSOC_REQ
2156 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002157 pe_err("received unexpected SME_REASSOC_REQ in state %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002158 session_entry->limSmeState);
2159 lim_print_sme_state(mac_ctx, LOGE, session_entry->limSmeState);
2160
2161 ret_code = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2162 goto end;
2163 }
2164
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302165 qdf_mem_copy(session_entry->limReAssocbssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002166 session_entry->pLimReAssocReq->bssDescription.bssId,
2167 sizeof(tSirMacAddr));
2168
2169 session_entry->limReassocChannelId =
2170 session_entry->pLimReAssocReq->bssDescription.channelId;
2171
2172 session_entry->reAssocHtSupportedChannelWidthSet =
2173 (session_entry->pLimReAssocReq->cbMode) ? 1 : 0;
2174 session_entry->reAssocHtRecommendedTxWidthSet =
2175 session_entry->reAssocHtSupportedChannelWidthSet;
2176 session_entry->reAssocHtSecondaryChannelOffset =
2177 session_entry->pLimReAssocReq->cbMode;
2178
2179 session_entry->limReassocBssCaps =
2180 session_entry->pLimReAssocReq->bssDescription.capabilityInfo;
2181 reg_max = cfg_get_regulatory_max_transmit_power(mac_ctx,
2182 session_entry->currentOperChannel);
2183 local_pwr_constraint = reg_max;
2184
2185 lim_extract_ap_capability(mac_ctx,
2186 (uint8_t *)session_entry->pLimReAssocReq->bssDescription.ieFields,
2187 lim_get_ielen_from_bss_description(
2188 &session_entry->pLimReAssocReq->bssDescription),
2189 &session_entry->limReassocBssQosCaps,
2190 &session_entry->limReassocBssPropCap,
2191 &session_entry->gLimCurrentBssUapsd,
2192 &local_pwr_constraint, session_entry);
Anurag Chouhan6d760662016-02-20 16:05:43 +05302193 session_entry->maxTxPower = QDF_MIN(reg_max, (local_pwr_constraint));
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002194 pe_err("Reg max = %d, local pwr constraint = %d, max tx = %d",
Varun Reddy Yeturu0e3989a2016-04-15 13:30:42 +05302195 reg_max, local_pwr_constraint, session_entry->maxTxPower);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002196 /* Copy the SSID from session entry to local variable */
2197 session_entry->limReassocSSID.length = reassoc_req->ssId.length;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302198 qdf_mem_copy(session_entry->limReassocSSID.ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002199 reassoc_req->ssId.ssId,
2200 session_entry->limReassocSSID.length);
2201 if (session_entry->gLimCurrentBssUapsd) {
2202 session_entry->gUapsdPerAcBitmask =
2203 session_entry->pLimReAssocReq->uapsdPerAcBitmask;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002204 pe_debug("UAPSD flag for all AC - 0x%2x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002205 session_entry->gUapsdPerAcBitmask);
2206 }
2207
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302208 mlm_reassoc_req = qdf_mem_malloc(sizeof(tLimMlmReassocReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002209 if (NULL == mlm_reassoc_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002210 pe_err("call to AllocateMemory failed for mlmReassocReq");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002211
2212 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
2213 goto end;
2214 }
2215
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302216 qdf_mem_copy(mlm_reassoc_req->peerMacAddr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002217 session_entry->limReAssocbssId, sizeof(tSirMacAddr));
2218
2219 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2220 (uint32_t *)&mlm_reassoc_req->reassocFailureTimeout) !=
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002221 eSIR_SUCCESS)
2222 pe_err("could not retrieve ReassocFailureTimeout value");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002223
2224 if (cfg_get_capability_info(mac_ctx, &caps, session_entry) !=
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002225 eSIR_SUCCESS)
2226 pe_err("could not retrieve Capabilities value");
Selvaraj, Sridharaf54e2e2016-06-24 12:25:02 +05302227
2228 lim_update_caps_info_for_bss(mac_ctx, &caps,
2229 reassoc_req->bssDescription.capabilityInfo);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002230 pe_debug("Capabilities info Reassoc: 0x%X", caps);
Selvaraj, Sridharaf54e2e2016-06-24 12:25:02 +05302231
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002232 mlm_reassoc_req->capabilityInfo = caps;
2233
2234 /* Update PE session_id */
2235 mlm_reassoc_req->sessionId = session_id;
2236
2237 /*
2238 * If telescopic beaconing is enabled, set listen interval to
2239 * WNI_CFG_TELE_BCN_MAX_LI
2240 */
2241 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_TELE_BCN_WAKEUP_EN,
2242 &tele_bcn_en) != eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002243 pe_err("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002244
2245 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2246
2247 if (tele_bcn_en) {
2248 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2249 eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002250 pe_err("could not retrieve ListenInterval");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002251 } else {
2252 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_LISTEN_INTERVAL, &val) !=
2253 eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002254 pe_err("could not retrieve ListenInterval");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002255 }
2256
2257 mlm_reassoc_req->listenInterval = (uint16_t) val;
2258
2259 /* Indicate whether spectrum management is enabled */
2260 session_entry->spectrumMgtEnabled = reassoc_req->spectrumMgtIndicator;
2261
2262 /* Enable the spectrum management if this is a DFS channel */
2263 if (session_entry->country_info_present &&
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -07002264 lim_isconnected_on_dfs_channel(mac_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002265 session_entry->currentOperChannel))
2266 session_entry->spectrumMgtEnabled = true;
2267
2268 session_entry->limPrevSmeState = session_entry->limSmeState;
2269 session_entry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2270
2271 MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE,
2272 session_entry->peSessionId,
2273 session_entry->limSmeState));
2274
2275 lim_post_mlm_message(mac_ctx,
2276 LIM_MLM_REASSOC_REQ, (uint32_t *)mlm_reassoc_req);
2277 return;
2278end:
2279 if (reassoc_req) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302280 qdf_mem_free(reassoc_req);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002281 if (session_entry)
2282 session_entry->pLimReAssocReq = NULL;
2283 }
2284
2285 if (session_entry) {
2286 /*
2287 * error occurred after we determined the session so extract
2288 * session and transaction info from there
2289 */
2290 sme_session_id = session_entry->smeSessionId;
2291 transaction_id = session_entry->transactionId;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002292 } else {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002293 /*
2294 * error occurred before or during the time we determined
2295 * the session so extract the session and transaction info
2296 * from the message
2297 */
2298 lim_get_session_info(mac_ctx, (uint8_t *) msg_buf,
2299 &sme_session_id, &transaction_id);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002300 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002301 /*
2302 * Send Reassoc failure response to host
2303 * (note session_entry may be NULL, but that's OK)
2304 */
2305 lim_send_sme_join_reassoc_rsp(mac_ctx, eWNI_SME_REASSOC_RSP,
2306 ret_code, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2307 session_entry, sme_session_id,
2308 transaction_id);
2309}
2310
2311bool send_disassoc_frame = 1;
2312/**
2313 * __lim_process_sme_disassoc_req()
2314 *
2315 ***FUNCTION:
2316 * This function is called to process SME_DISASSOC_REQ message
2317 * from HDD or upper layer application.
2318 *
2319 ***LOGIC:
2320 *
2321 ***ASSUMPTIONS:
2322 *
2323 ***NOTE:
2324 *
2325 * @param pMac Pointer to Global MAC structure
2326 * @param *pMsgBuf A pointer to the SME message buffer
2327 * @return None
2328 */
2329
2330static void __lim_process_sme_disassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
2331{
2332 uint16_t disassocTrigger, reasonCode;
2333 tLimMlmDisassocReq *pMlmDisassocReq;
2334 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2335 tSirSmeDisassocReq smeDisassocReq;
2336 tpPESession psessionEntry = NULL;
2337 uint8_t sessionId;
2338 uint8_t smesessionId;
2339 uint16_t smetransactionId;
2340
2341 if (pMsgBuf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002342 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002343 return;
2344 }
2345
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302346 qdf_mem_copy(&smeDisassocReq, pMsgBuf, sizeof(tSirSmeDisassocReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002347 smesessionId = smeDisassocReq.sessionId;
2348 smetransactionId = smeDisassocReq.transactionId;
2349 if (!lim_is_sme_disassoc_req_valid(pMac,
2350 &smeDisassocReq,
2351 psessionEntry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002352 pe_err("received invalid SME_DISASSOC_REQ message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002353 if (pMac->lim.gLimRspReqd) {
2354 pMac->lim.gLimRspReqd = false;
2355
2356 retCode = eSIR_SME_INVALID_PARAMETERS;
2357 disassocTrigger = eLIM_HOST_DISASSOC;
2358 goto sendDisassoc;
2359 }
2360
2361 return;
2362 }
2363
2364 psessionEntry = pe_find_session_by_bssid(pMac,
Srinivas Girigowda1a245362016-01-05 22:43:30 -08002365 smeDisassocReq.bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002366 &sessionId);
2367 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002368 pe_err("session does not exist for given bssId "
2369 MAC_ADDRESS_STR,
Srinivas Girigowda1a245362016-01-05 22:43:30 -08002370 MAC_ADDR_ARRAY(smeDisassocReq.bssid.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002371 retCode = eSIR_SME_INVALID_PARAMETERS;
2372 disassocTrigger = eLIM_HOST_DISASSOC;
2373 goto sendDisassoc;
2374 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002375 pe_debug("received DISASSOC_REQ message on sessionid %d Systemrole %d Reason: %u SmeState: %d from: "
2376 MAC_ADDRESS_STR, smesessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002377 GET_LIM_SYSTEM_ROLE(psessionEntry), smeDisassocReq.reasonCode,
2378 pMac->lim.gLimSmeState,
Srinivas Girigowda1a245362016-01-05 22:43:30 -08002379 MAC_ADDR_ARRAY(smeDisassocReq.peer_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002380
2381#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
2382 lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry,
2383 0, smeDisassocReq.reasonCode);
2384#endif /* FEATURE_WLAN_DIAG_SUPPORT */
2385
2386 /* Update SME session Id and SME transaction ID */
2387
2388 psessionEntry->smeSessionId = smesessionId;
2389 psessionEntry->transactionId = smetransactionId;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002390 pe_debug("ho_fail: %d ", smeDisassocReq.process_ho_fail);
Deepak Dhamdhere2dae1bd2016-10-27 10:58:29 -07002391 psessionEntry->process_ho_fail = smeDisassocReq.process_ho_fail;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002392
2393 switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) {
2394 case eLIM_STA_ROLE:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002395 switch (psessionEntry->limSmeState) {
2396 case eLIM_SME_ASSOCIATED_STATE:
2397 case eLIM_SME_LINK_EST_STATE:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002398 pe_debug("Rcvd SME_DISASSOC_REQ in limSmeState: %d ",
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07002399 psessionEntry->limSmeState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002400 psessionEntry->limPrevSmeState =
2401 psessionEntry->limSmeState;
2402 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002403 /* Delete all TDLS peers connected before leaving BSS */
2404 lim_delete_tdls_peers(pMac, psessionEntry);
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07002405 MTRACE(mac_trace(pMac, TRACE_CODE_SME_STATE,
2406 psessionEntry->peSessionId,
2407 psessionEntry->limSmeState));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002408 break;
2409
2410 case eLIM_SME_WT_DEAUTH_STATE:
2411 /* PE shall still process the DISASSOC_REQ and proceed with
2412 * link tear down even if it had already sent a DEAUTH_IND to
2413 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2414 * its been set when PE entered WT_DEAUTH_STATE.
2415 */
2416 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
2417 MTRACE(mac_trace
2418 (pMac, TRACE_CODE_SME_STATE,
2419 psessionEntry->peSessionId,
2420 psessionEntry->limSmeState));
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002421 pe_debug("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002422 break;
2423
2424 case eLIM_SME_WT_DISASSOC_STATE:
2425 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2426 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2427 * PE can continue processing DISASSOC_REQ and send the response instead
2428 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2429 * for disassoc frame.
2430 *
2431 * It will send a disassoc, which is ok. However, we can use the global flag
2432 * sendDisassoc to not send disassoc frame.
2433 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002434 pe_debug("Rcvd SME_DISASSOC_REQ while in SME_WT_DISASSOC_STATE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002435 break;
2436
2437 case eLIM_SME_JOIN_FAILURE_STATE: {
2438 /* Already in Disconnected State, return success */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002439 pe_debug("Rcvd SME_DISASSOC_REQ while in eLIM_SME_JOIN_FAILURE_STATE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002440 if (pMac->lim.gLimRspReqd) {
2441 retCode = eSIR_SME_SUCCESS;
2442 disassocTrigger = eLIM_HOST_DISASSOC;
2443 goto sendDisassoc;
2444 }
2445 }
2446 break;
2447 default:
2448 /**
2449 * STA is not currently associated.
2450 * Log error and send response to host
2451 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002452 pe_err("received unexpected SME_DISASSOC_REQ in state %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002453 psessionEntry->limSmeState);
2454 lim_print_sme_state(pMac, LOGE,
2455 psessionEntry->limSmeState);
2456
2457 if (pMac->lim.gLimRspReqd) {
2458 if (psessionEntry->limSmeState !=
2459 eLIM_SME_WT_ASSOC_STATE)
2460 pMac->lim.gLimRspReqd = false;
2461
2462 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2463 disassocTrigger = eLIM_HOST_DISASSOC;
2464 goto sendDisassoc;
2465 }
2466
2467 return;
2468 }
2469
2470 break;
2471
2472 case eLIM_AP_ROLE:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002473 /* Fall through */
2474 break;
2475
2476 case eLIM_STA_IN_IBSS_ROLE:
2477 default:
2478 /* eLIM_UNKNOWN_ROLE */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002479 pe_err("received unexpected SME_DISASSOC_REQ for role %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002480 GET_LIM_SYSTEM_ROLE(psessionEntry));
2481
2482 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2483 disassocTrigger = eLIM_HOST_DISASSOC;
2484 goto sendDisassoc;
2485 } /* end switch (pMac->lim.gLimSystemRole) */
2486
Edhar, Mahesh Kumare3c8d352015-11-16 12:03:45 +05302487 disassocTrigger = eLIM_HOST_DISASSOC;
2488 reasonCode = smeDisassocReq.reasonCode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002489
2490 if (smeDisassocReq.doNotSendOverTheAir) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002491 pe_debug("do not send dissoc over the air");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002492 send_disassoc_frame = 0;
2493 }
2494 /* Trigger Disassociation frame to peer MAC entity */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002495 pe_debug("Sending Disasscoc with disassoc Trigger"
2496 " : %d, reasonCode : %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002497 disassocTrigger, reasonCode);
2498
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302499 pMlmDisassocReq = qdf_mem_malloc(sizeof(tLimMlmDisassocReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002500 if (NULL == pMlmDisassocReq) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002501 pe_err("call to AllocateMemory failed for mlmDisassocReq");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002502 return;
2503 }
2504
Anurag Chouhanc5548422016-02-24 18:33:27 +05302505 qdf_copy_macaddr(&pMlmDisassocReq->peer_macaddr,
Srinivas Girigowda1a245362016-01-05 22:43:30 -08002506 &smeDisassocReq.peer_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002507
2508 pMlmDisassocReq->reasonCode = reasonCode;
2509 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2510
2511 /* Update PE session ID */
2512 pMlmDisassocReq->sessionId = sessionId;
2513
2514 lim_post_mlm_message(pMac,
2515 LIM_MLM_DISASSOC_REQ, (uint32_t *) pMlmDisassocReq);
2516 return;
2517
2518sendDisassoc:
2519 if (psessionEntry)
Srinivas Girigowda1a245362016-01-05 22:43:30 -08002520 lim_send_sme_disassoc_ntf(pMac,
2521 smeDisassocReq.peer_macaddr.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002522 retCode,
2523 disassocTrigger,
2524 1, smesessionId, smetransactionId,
2525 psessionEntry);
2526 else
Srinivas Girigowda1a245362016-01-05 22:43:30 -08002527 lim_send_sme_disassoc_ntf(pMac,
2528 smeDisassocReq.peer_macaddr.bytes,
2529 retCode, disassocTrigger, 1,
2530 smesessionId, smetransactionId, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002531
2532} /*** end __lim_process_sme_disassoc_req() ***/
2533
2534/** -----------------------------------------------------------------
2535 \brief __lim_process_sme_disassoc_cnf() - Process SME_DISASSOC_CNF
2536
2537 This function is called to process SME_DISASSOC_CNF message
2538 from HDD or upper layer application.
2539
2540 \param pMac - global mac structure
2541 \param pStaDs - station dph hash node
2542 \return none
2543 \sa
2544 ----------------------------------------------------------------- */
2545static void __lim_process_sme_disassoc_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
2546{
2547 tSirSmeDisassocCnf smeDisassocCnf;
2548 uint16_t aid;
2549 tpDphHashNode pStaDs;
2550 tpPESession psessionEntry;
2551 uint8_t sessionId;
2552
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302553 qdf_mem_copy(&smeDisassocCnf, pMsgBuf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002554 sizeof(struct sSirSmeDisassocCnf));
2555
2556 psessionEntry = pe_find_session_by_bssid(pMac,
Srinivas Girigowda5f3c81a2016-01-04 21:47:19 -08002557 smeDisassocCnf.bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002558 &sessionId);
2559 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002560 pe_err("session does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002561 return;
2562 }
2563
2564 if (!lim_is_sme_disassoc_cnf_valid(pMac, &smeDisassocCnf, psessionEntry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002565 pe_err("received invalid SME_DISASSOC_CNF message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002566 return;
2567 }
2568#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
2569 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2570 lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT,
2571 psessionEntry,
2572 (uint16_t) smeDisassocCnf.statusCode, 0);
2573 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2574 lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT,
2575 psessionEntry,
2576 (uint16_t) smeDisassocCnf.statusCode, 0);
2577#endif /* FEATURE_WLAN_DIAG_SUPPORT */
2578
2579 switch (GET_LIM_SYSTEM_ROLE(psessionEntry)) {
2580 case eLIM_STA_ROLE:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002581 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2582 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)
2583 && (psessionEntry->limSmeState !=
2584 eLIM_SME_WT_DEAUTH_STATE)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002585 pe_err("received unexp SME_DISASSOC_CNF in state %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002586 psessionEntry->limSmeState);
2587 lim_print_sme_state(pMac, LOGE,
2588 psessionEntry->limSmeState);
2589 return;
2590 }
2591 break;
2592
2593 case eLIM_AP_ROLE:
2594 /* Fall through */
2595 break;
2596
2597 case eLIM_STA_IN_IBSS_ROLE:
2598 default: /* eLIM_UNKNOWN_ROLE */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002599 pe_err("received unexpected SME_DISASSOC_CNF role %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002600 GET_LIM_SYSTEM_ROLE(psessionEntry));
2601
2602 return;
2603 }
2604
2605 if ((psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2606 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE) ||
2607 LIM_IS_AP_ROLE(psessionEntry)) {
2608 pStaDs = dph_lookup_hash_entry(pMac,
Srinivas Girigowda5f3c81a2016-01-04 21:47:19 -08002609 smeDisassocCnf.peer_macaddr.bytes, &aid,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002610 &psessionEntry->dph.dphHashTable);
2611 if (pStaDs == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002612 pe_err("DISASSOC_CNF for a STA with no context, addr= "
2613 MAC_ADDRESS_STR,
Srinivas Girigowda5f3c81a2016-01-04 21:47:19 -08002614 MAC_ADDR_ARRAY(smeDisassocCnf.peer_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002615 return;
2616 }
Masti, Narayanraddi21bde252015-10-09 19:39:47 +05302617
2618 if ((pStaDs->mlmStaContext.mlmState ==
2619 eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
2620 (pStaDs->mlmStaContext.mlmState ==
2621 eLIM_MLM_WT_DEL_STA_RSP_STATE)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002622 pe_err("No need of cleanup for addr:" MAC_ADDRESS_STR "as MLM state is %d",
Srinivas Girigowda5f3c81a2016-01-04 21:47:19 -08002623 MAC_ADDR_ARRAY(smeDisassocCnf.peer_macaddr.bytes),
Masti, Narayanraddi21bde252015-10-09 19:39:47 +05302624 pStaDs->mlmStaContext.mlmState);
2625 return;
2626 }
2627
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002628 /* Delete FT session if there exists one */
2629 lim_ft_cleanup_pre_auth_info(pMac, psessionEntry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002630 lim_cleanup_rx_path(pMac, pStaDs, psessionEntry);
2631
2632 lim_clean_up_disassoc_deauth_req(pMac,
Srinivas Girigowda5f3c81a2016-01-04 21:47:19 -08002633 (char *)&smeDisassocCnf.peer_macaddr, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002634 }
2635
2636 return;
2637}
2638
2639/**
2640 * __lim_process_sme_deauth_req() - process sme deauth req
2641 * @mac_ctx: Pointer to Global MAC structure
2642 * @msg_buf: pointer to the SME message buffer
2643 *
2644 * This function is called to process SME_DEAUTH_REQ message
2645 * from HDD or upper layer application.
2646 *
2647 * Return: None
2648 */
2649
2650static void __lim_process_sme_deauth_req(tpAniSirGlobal mac_ctx,
2651 uint32_t *msg_buf)
2652{
2653 uint16_t deauth_trigger, reason_code;
2654 tLimMlmDeauthReq *mlm_deauth_req;
2655 tSirSmeDeauthReq sme_deauth_req;
2656 tSirResultCodes ret_code = eSIR_SME_SUCCESS;
2657 tpPESession session_entry;
2658 uint8_t session_id; /* PE sessionId */
2659 uint8_t sme_session_id;
2660 uint16_t sme_transaction_id;
2661
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302662 qdf_mem_copy(&sme_deauth_req, msg_buf, sizeof(tSirSmeDeauthReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002663 sme_session_id = sme_deauth_req.sessionId;
2664 sme_transaction_id = sme_deauth_req.transactionId;
2665
2666 /*
2667 * We need to get a session first but we don't even know
2668 * if the message is correct.
2669 */
Srinivas Girigowda9efa10e2016-01-04 18:49:40 -08002670 session_entry = pe_find_session_by_bssid(mac_ctx,
2671 sme_deauth_req.bssid.bytes,
2672 &session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002673 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002674 pe_err("session does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002675 ret_code = eSIR_SME_INVALID_PARAMETERS;
2676 deauth_trigger = eLIM_HOST_DEAUTH;
2677 goto send_deauth;
2678 }
2679
2680 if (!lim_is_sme_deauth_req_valid(mac_ctx, &sme_deauth_req,
2681 session_entry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002682 pe_err("received invalid SME_DEAUTH_REQ message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002683 mac_ctx->lim.gLimRspReqd = false;
2684
2685 ret_code = eSIR_SME_INVALID_PARAMETERS;
2686 deauth_trigger = eLIM_HOST_DEAUTH;
2687 goto send_deauth;
2688 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002689 pe_debug("received DEAUTH_REQ sessionid %d Systemrole %d reasoncode %u limSmestate %d from "
2690 MAC_ADDRESS_STR, sme_session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002691 GET_LIM_SYSTEM_ROLE(session_entry), sme_deauth_req.reasonCode,
2692 session_entry->limSmeState,
Srinivas Girigowda9efa10e2016-01-04 18:49:40 -08002693 MAC_ADDR_ARRAY(sme_deauth_req.peer_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002694#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
2695 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_DEAUTH_REQ_EVENT,
2696 session_entry, 0, sme_deauth_req.reasonCode);
2697#endif /* FEATURE_WLAN_DIAG_SUPPORT */
2698
2699 /* Update SME session ID and Transaction ID */
2700 session_entry->smeSessionId = sme_session_id;
2701 session_entry->transactionId = sme_transaction_id;
2702
2703 switch (GET_LIM_SYSTEM_ROLE(session_entry)) {
2704 case eLIM_STA_ROLE:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002705 switch (session_entry->limSmeState) {
2706 case eLIM_SME_ASSOCIATED_STATE:
2707 case eLIM_SME_LINK_EST_STATE:
Ganesh Kondabattini9d3d3b12017-03-15 16:20:19 +05302708 /* Delete all TDLS peers connected before leaving BSS */
2709 lim_delete_tdls_peers(mac_ctx, session_entry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002710 case eLIM_SME_WT_ASSOC_STATE:
2711 case eLIM_SME_JOIN_FAILURE_STATE:
2712 case eLIM_SME_IDLE_STATE:
2713 session_entry->limPrevSmeState =
2714 session_entry->limSmeState;
2715 session_entry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
2716 MTRACE(mac_trace(mac_ctx, TRACE_CODE_SME_STATE,
2717 session_entry->peSessionId,
2718 session_entry->limSmeState));
2719 /* Send Deauthentication request to MLM below */
2720 break;
2721 case eLIM_SME_WT_DEAUTH_STATE:
2722 case eLIM_SME_WT_DISASSOC_STATE:
2723 /*
2724 * PE Recieved a Deauth/Disassoc frame. Normally it get
2725 * DEAUTH_CNF/DISASSOC_CNF but it received DEAUTH_REQ.
2726 * Which means host is also trying to disconnect.
2727 * PE can continue processing DEAUTH_REQ and send
2728 * the response instead of failing the request.
2729 * SME will anyway ignore DEAUTH_IND/DISASSOC_IND that
2730 * was sent for deauth/disassoc frame.
2731 */
2732 session_entry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002733 pe_debug("Rcvd SME_DEAUTH_REQ while in SME_WT_DEAUTH_STATE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002734 break;
2735 default:
2736 /*
2737 * STA is not in a state to deauthenticate with
2738 * peer. Log error and send response to host.
2739 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002740 pe_err("received unexp SME_DEAUTH_REQ in state %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002741 session_entry->limSmeState);
2742 lim_print_sme_state(mac_ctx, LOGE,
2743 session_entry->limSmeState);
2744
2745 if (mac_ctx->lim.gLimRspReqd) {
2746 mac_ctx->lim.gLimRspReqd = false;
2747
2748 ret_code = eSIR_SME_STA_NOT_AUTHENTICATED;
2749 deauth_trigger = eLIM_HOST_DEAUTH;
2750
wadesong42968e92017-06-08 14:11:21 +08002751 /*
2752 * here we received deauth request from AP so
2753 * sme state is eLIM_SME_WT_DEAUTH_STATE.if we
2754 * have ISSUED delSta then mlm state should be
2755 * eLIM_MLM_WT_DEL_STA_RSP_STATE and ifwe got
2756 * delBSS rsp then mlm state should be
2757 * eLIM_MLM_IDLE_STATE so the below condition
2758 * captures the state where delSta not done
2759 * and firmware still in connected state.
2760 */
2761 if (session_entry->limSmeState ==
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002762 eLIM_SME_WT_DEAUTH_STATE &&
2763 session_entry->limMlmState !=
2764 eLIM_MLM_IDLE_STATE &&
2765 session_entry->limMlmState !=
2766 eLIM_MLM_WT_DEL_STA_RSP_STATE)
wadesong42968e92017-06-08 14:11:21 +08002767 ret_code = eSIR_SME_DEAUTH_STATUS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002768 goto send_deauth;
2769 }
2770 return;
2771 }
2772 break;
2773
2774 case eLIM_STA_IN_IBSS_ROLE:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002775 pe_err("Deauth not allowed in IBSS");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002776 if (mac_ctx->lim.gLimRspReqd) {
2777 mac_ctx->lim.gLimRspReqd = false;
2778 ret_code = eSIR_SME_INVALID_PARAMETERS;
2779 deauth_trigger = eLIM_HOST_DEAUTH;
2780 goto send_deauth;
2781 }
2782 return;
2783 case eLIM_AP_ROLE:
2784 break;
2785 default:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002786 pe_err("received unexpected SME_DEAUTH_REQ for role %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002787 GET_LIM_SYSTEM_ROLE(session_entry));
2788 if (mac_ctx->lim.gLimRspReqd) {
2789 mac_ctx->lim.gLimRspReqd = false;
2790 ret_code = eSIR_SME_INVALID_PARAMETERS;
2791 deauth_trigger = eLIM_HOST_DEAUTH;
2792 goto send_deauth;
2793 }
2794 return;
2795 } /* end switch (mac_ctx->lim.gLimSystemRole) */
2796
2797 if (sme_deauth_req.reasonCode == eLIM_LINK_MONITORING_DEAUTH) {
2798 /* Deauthentication is triggered by Link Monitoring */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002799 pe_debug("** Lost link with AP **");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002800 deauth_trigger = eLIM_LINK_MONITORING_DEAUTH;
2801 reason_code = eSIR_MAC_UNSPEC_FAILURE_REASON;
2802 } else {
2803 deauth_trigger = eLIM_HOST_DEAUTH;
2804 reason_code = sme_deauth_req.reasonCode;
2805 }
2806
2807 /* Trigger Deauthentication frame to peer MAC entity */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302808 mlm_deauth_req = qdf_mem_malloc(sizeof(tLimMlmDeauthReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002809 if (NULL == mlm_deauth_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002810 pe_err("call to AllocateMemory failed for mlmDeauthReq");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002811 if (mac_ctx->lim.gLimRspReqd) {
2812 mac_ctx->lim.gLimRspReqd = false;
2813 ret_code = eSIR_SME_RESOURCES_UNAVAILABLE;
2814 deauth_trigger = eLIM_HOST_DEAUTH;
2815 goto send_deauth;
2816 }
2817 return;
2818 }
2819
Anurag Chouhanc5548422016-02-24 18:33:27 +05302820 qdf_copy_macaddr(&mlm_deauth_req->peer_macaddr,
Srinivas Girigowda9efa10e2016-01-04 18:49:40 -08002821 &sme_deauth_req.peer_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002822
2823 mlm_deauth_req->reasonCode = reason_code;
2824 mlm_deauth_req->deauthTrigger = deauth_trigger;
2825
2826 /* Update PE session Id */
2827 mlm_deauth_req->sessionId = session_id;
2828
2829 lim_post_mlm_message(mac_ctx, LIM_MLM_DEAUTH_REQ,
2830 (uint32_t *)mlm_deauth_req);
2831 return;
2832
2833send_deauth:
Srinivas Girigowda9efa10e2016-01-04 18:49:40 -08002834 lim_send_sme_deauth_ntf(mac_ctx, sme_deauth_req.peer_macaddr.bytes,
2835 ret_code, deauth_trigger, 1,
2836 sme_session_id, sme_transaction_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002837}
2838
2839/**
2840 * __lim_process_sme_set_context_req()
2841 *
2842 * @mac_ctx: Pointer to Global MAC structure
2843 * @msg_buf: pointer to the SME message buffer
2844 *
2845 * This function is called to process SME_SETCONTEXT_REQ message
2846 * from HDD or upper layer application.
2847 *
2848 * Return: None
2849 */
2850
2851static void
2852__lim_process_sme_set_context_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
2853{
2854 tpSirSmeSetContextReq set_context_req;
2855 tLimMlmSetKeysReq *mlm_set_key_req;
2856 tpPESession session_entry;
2857 uint8_t session_id; /* PE sessionID */
2858 uint8_t sme_session_id;
2859 uint16_t sme_transaction_id;
2860
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002861 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002862 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002863 return;
2864 }
2865
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302866 set_context_req = qdf_mem_malloc(sizeof(struct sSirSmeSetContextReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002867 if (NULL == set_context_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002868 pe_err("call to AllocateMemory failed for set_context_req");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002869 return;
2870 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302871 qdf_mem_copy(set_context_req, msg_buf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002872 sizeof(struct sSirSmeSetContextReq));
2873 sme_session_id = set_context_req->sessionId;
2874 sme_transaction_id = set_context_req->transactionId;
2875
2876 if ((!lim_is_sme_set_context_req_valid(mac_ctx, set_context_req))) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002877 pe_warn("received invalid SME_SETCONTEXT_REQ message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002878 goto end;
2879 }
2880
2881 if (set_context_req->keyMaterial.numKeys >
2882 SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002883 pe_err("numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002884 set_context_req->keyMaterial.numKeys);
2885 lim_send_sme_set_context_rsp(mac_ctx,
Srinivas Girigowdad5965c42015-12-04 13:43:16 -08002886 set_context_req->peer_macaddr, 1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002887 eSIR_SME_INVALID_PARAMETERS, NULL,
2888 sme_session_id, sme_transaction_id);
2889 goto end;
2890 }
2891
2892 session_entry = pe_find_session_by_bssid(mac_ctx,
Srinivas Girigowdad5965c42015-12-04 13:43:16 -08002893 set_context_req->bssid.bytes, &session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002894 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002895 pe_err("Session does not exist for given BSSID");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002896 lim_send_sme_set_context_rsp(mac_ctx,
Srinivas Girigowdad5965c42015-12-04 13:43:16 -08002897 set_context_req->peer_macaddr, 1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002898 eSIR_SME_INVALID_PARAMETERS, NULL,
2899 sme_session_id, sme_transaction_id);
2900 goto end;
2901 }
2902#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
2903 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT,
2904 session_entry, 0, 0);
2905#endif /* FEATURE_WLAN_DIAG_SUPPORT */
2906
Rajeev Kumarc9a50e72016-04-15 15:18:42 -07002907 if ((LIM_IS_STA_ROLE(session_entry) &&
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002908 (session_entry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2909 ((LIM_IS_IBSS_ROLE(session_entry) ||
Rajeev Kumarc9a50e72016-04-15 15:18:42 -07002910 LIM_IS_AP_ROLE(session_entry)) &&
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002911 (session_entry->limSmeState == eLIM_SME_NORMAL_STATE))) {
2912 /* Trigger MLM_SETKEYS_REQ */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302913 mlm_set_key_req = qdf_mem_malloc(sizeof(tLimMlmSetKeysReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002914 if (NULL == mlm_set_key_req) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002915 pe_err("mem alloc failed for mlmSetKeysReq");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002916 goto end;
2917 }
2918 mlm_set_key_req->edType = set_context_req->keyMaterial.edType;
2919 mlm_set_key_req->numKeys =
2920 set_context_req->keyMaterial.numKeys;
2921 if (mlm_set_key_req->numKeys >
2922 SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002923 pe_err("no.of keys exceeded max num of default keys limit");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002924 goto end;
2925 }
Anurag Chouhanc5548422016-02-24 18:33:27 +05302926 qdf_copy_macaddr(&mlm_set_key_req->peer_macaddr,
Srinivas Girigowdad5965c42015-12-04 13:43:16 -08002927 &set_context_req->peer_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002928
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302929 qdf_mem_copy((uint8_t *) &mlm_set_key_req->key,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002930 (uint8_t *) &set_context_req->keyMaterial.key,
2931 sizeof(tSirKeys) *
2932 (mlm_set_key_req->numKeys ? mlm_set_key_req->
2933 numKeys : 1));
2934
2935 mlm_set_key_req->sessionId = session_id;
2936 mlm_set_key_req->smesessionId = sme_session_id;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002937 pe_debug("received SETCONTEXT_REQ message sessionId=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002938 mlm_set_key_req->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002939
2940 if (((set_context_req->keyMaterial.edType == eSIR_ED_WEP40) ||
2941 (set_context_req->keyMaterial.edType == eSIR_ED_WEP104)) &&
2942 LIM_IS_AP_ROLE(session_entry)) {
2943 if (set_context_req->keyMaterial.key[0].keyLength) {
2944 uint8_t key_id;
2945 key_id =
2946 set_context_req->keyMaterial.key[0].keyId;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302947 qdf_mem_copy((uint8_t *)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002948 &session_entry->WEPKeyMaterial[key_id],
2949 (uint8_t *) &set_context_req->keyMaterial,
2950 sizeof(tSirKeyMaterial));
2951 } else {
2952 uint32_t i;
2953 for (i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS;
2954 i++) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302955 qdf_mem_copy((uint8_t *)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002956 &mlm_set_key_req->key[i],
2957 (uint8_t *)session_entry->WEPKeyMaterial[i].key,
2958 sizeof(tSirKeys));
2959 }
2960 }
2961 }
2962 lim_post_mlm_message(mac_ctx, LIM_MLM_SETKEYS_REQ,
2963 (uint32_t *) mlm_set_key_req);
2964 } else {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07002965 pe_err("rcvd unexpected SME_SETCONTEXT_REQ for role %d, state=%X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002966 GET_LIM_SYSTEM_ROLE(session_entry),
2967 session_entry->limSmeState);
2968 lim_print_sme_state(mac_ctx, LOGE, session_entry->limSmeState);
2969
2970 lim_send_sme_set_context_rsp(mac_ctx,
Srinivas Girigowdad5965c42015-12-04 13:43:16 -08002971 set_context_req->peer_macaddr, 1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002972 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,
2973 session_entry, sme_session_id,
2974 sme_transaction_id);
2975 }
2976end:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302977 qdf_mem_free(set_context_req);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002978 return;
2979}
2980
2981/**
2982 * lim_process_sme_get_assoc_sta_info() - process sme assoc sta req
2983 *
2984 * @mac_ctx: Pointer to Global MAC structure
2985 * @msg_buf: pointer to the SME message buffer
2986 *
2987 * This function is called to process SME_GET_ASSOC_STAS_REQ message
2988 * from HDD or upper layer application.
2989 *
2990 * Return: None
2991 */
2992
Jeff Johnson801f1532016-10-07 07:54:50 -07002993static void lim_process_sme_get_assoc_sta_info(tpAniSirGlobal mac_ctx,
2994 uint32_t *msg_buf)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002995{
2996 tSirSmeGetAssocSTAsReq get_assoc_stas_req;
2997 tpDphHashNode sta_ds = NULL;
2998 tpPESession session_entry = NULL;
2999 tSap_Event sap_event;
3000 tpWLAN_SAPEventCB sap_event_cb = NULL;
3001 tpSap_AssocMacAddr assoc_sta_tmp = NULL;
3002 uint8_t session_id = CSR_SESSION_ID_INVALID;
3003 uint8_t assoc_id = 0;
3004 uint8_t sta_cnt = 0;
3005
3006 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003007 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003008 return;
3009 }
3010
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303011 qdf_mem_copy(&get_assoc_stas_req, msg_buf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003012 sizeof(struct sSirSmeGetAssocSTAsReq));
3013 /*
3014 * Get Associated stations from PE.
3015 * Find PE session Entry
3016 */
3017 session_entry = pe_find_session_by_bssid(mac_ctx,
Srinivas Girigowda61de4bb2015-11-25 15:46:41 -08003018 get_assoc_stas_req.bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003019 &session_id);
3020 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003021 pe_err("session does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003022 goto lim_assoc_sta_end;
3023 }
3024
3025 if (!LIM_IS_AP_ROLE(session_entry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003026 pe_err("Received unexpected message in state %X, in role %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003027 session_entry->limSmeState,
3028 GET_LIM_SYSTEM_ROLE(session_entry));
3029 goto lim_assoc_sta_end;
3030 }
3031 /* Retrieve values obtained in the request message */
3032 sap_event_cb = (tpWLAN_SAPEventCB)get_assoc_stas_req.pSapEventCallback;
3033 assoc_sta_tmp = (tpSap_AssocMacAddr)get_assoc_stas_req.pAssocStasArray;
3034
3035 if (NULL == assoc_sta_tmp)
3036 goto lim_assoc_sta_end;
3037 for (assoc_id = 0; assoc_id < session_entry->dph.dphHashTable.size;
3038 assoc_id++) {
3039 sta_ds = dph_get_hash_entry(mac_ctx, assoc_id,
3040 &session_entry->dph.dphHashTable);
3041 if (NULL == sta_ds)
3042 continue;
3043 if (sta_ds->valid) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303044 qdf_mem_copy((uint8_t *) &assoc_sta_tmp->staMac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003045 (uint8_t *) &sta_ds->staAddr,
Anurag Chouhan6d760662016-02-20 16:05:43 +05303046 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003047 assoc_sta_tmp->assocId = (uint8_t) sta_ds->assocId;
3048 assoc_sta_tmp->staId = (uint8_t) sta_ds->staIndex;
3049
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303050 qdf_mem_copy((uint8_t *)&assoc_sta_tmp->supportedRates,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003051 (uint8_t *)&sta_ds->supportedRates,
3052 sizeof(tSirSupportedRates));
3053 assoc_sta_tmp->ShortGI40Mhz = sta_ds->htShortGI40Mhz;
3054 assoc_sta_tmp->ShortGI20Mhz = sta_ds->htShortGI20Mhz;
3055 assoc_sta_tmp->Support40Mhz =
3056 sta_ds->htDsssCckRate40MHzSupport;
3057
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003058 pe_debug("dph Station Number = %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003059 sta_cnt + 1);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003060 pe_debug("MAC = " MAC_ADDRESS_STR,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003061 MAC_ADDR_ARRAY(sta_ds->staAddr));
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003062 pe_debug("Association Id: %d Station Index: %d",
3063 sta_ds->assocId, sta_ds->staIndex);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003064 assoc_sta_tmp++;
3065 sta_cnt++;
3066 }
3067 }
3068lim_assoc_sta_end:
3069 /*
3070 * Call hdd callback with sap event to send the list of
3071 * associated stations from PE
3072 */
3073 if (sap_event_cb != NULL) {
3074 sap_event.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3075 sap_event.sapevt.sapAssocStaListEvent.module =
Anurag Chouhan6d760662016-02-20 16:05:43 +05303076 QDF_MODULE_ID_PE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003077 sap_event.sapevt.sapAssocStaListEvent.noOfAssocSta = sta_cnt;
3078 sap_event.sapevt.sapAssocStaListEvent.pAssocStas =
3079 (tpSap_AssocMacAddr)get_assoc_stas_req.pAssocStasArray;
3080 sap_event_cb(&sap_event, get_assoc_stas_req.pUsrContext);
3081 }
3082}
3083
3084/**
3085 * lim_process_sme_get_wpspbc_sessions - process sme get wpspbc req
3086 *
3087 * @mac_ctx: Pointer to Global MAC structure
3088 * @msg_buf: pointer to WPS PBC overlap query message
3089 *
3090 * This function parses get WPS PBC overlap information
3091 * message and call callback to pass WPS PBC overlap
3092 * information back to hdd.
3093 *
3094 * Return: None
3095 */
Jeff Johnson801f1532016-10-07 07:54:50 -07003096static void lim_process_sme_get_wpspbc_sessions(tpAniSirGlobal mac_ctx,
3097 uint32_t *msg_buf)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003098{
3099 tSirSmeGetWPSPBCSessionsReq get_wps_pbc_sessions_req;
3100 tpPESession session_entry = NULL;
3101 tSap_Event sap_event;
3102 tpWLAN_SAPEventCB sap_event_cb = NULL;
3103 uint8_t session_id = CSR_SESSION_ID_INVALID;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003104 tSap_GetWPSPBCSessionEvent *sap_get_wpspbc_event;
3105
3106 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003107 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003108 return;
3109 }
3110
3111 sap_get_wpspbc_event = &sap_event.sapevt.sapGetWPSPBCSessionEvent;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303112 sap_get_wpspbc_event->status = QDF_STATUS_E_FAULT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003113
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303114 qdf_mem_copy(&get_wps_pbc_sessions_req, msg_buf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003115 sizeof(struct sSirSmeGetWPSPBCSessionsReq));
3116 /*
3117 * Get Associated stations from PE
3118 * Find PE session Entry
3119 */
3120 session_entry = pe_find_session_by_bssid(mac_ctx,
Srinivas Girigowdaedcfab92015-11-24 15:21:41 -08003121 get_wps_pbc_sessions_req.bssid.bytes, &session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003122 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003123 pe_err("session does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003124 goto lim_get_wpspbc_sessions_end;
3125 }
3126
3127 if (!LIM_IS_AP_ROLE(session_entry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003128 pe_err("Received unexpected message in role %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003129 GET_LIM_SYSTEM_ROLE(session_entry));
3130 goto lim_get_wpspbc_sessions_end;
3131 }
3132 /*
3133 * Call hdd callback with sap event to send the
3134 * WPS PBC overlap information
3135 */
3136 sap_event.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
Anurag Chouhan6d760662016-02-20 16:05:43 +05303137 sap_get_wpspbc_event->module = QDF_MODULE_ID_PE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003138
Anurag Chouhanc5548422016-02-24 18:33:27 +05303139 if (qdf_is_macaddr_zero(&get_wps_pbc_sessions_req.remove_mac)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003140 lim_get_wpspbc_sessions(mac_ctx,
Srinivas Girigowda419e36b2015-11-24 15:39:54 -08003141 sap_get_wpspbc_event->addr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003142 sap_get_wpspbc_event->UUID_E,
3143 &sap_get_wpspbc_event->wpsPBCOverlap,
3144 session_entry);
3145 } else {
3146 lim_remove_pbc_sessions(mac_ctx,
Srinivas Girigowdaedcfab92015-11-24 15:21:41 -08003147 get_wps_pbc_sessions_req.remove_mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003148 session_entry);
3149 /* don't have to inform the HDD/Host */
3150 return;
3151 }
3152
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003153 pe_debug("wpsPBCOverlap %d", sap_get_wpspbc_event->wpsPBCOverlap);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003154 lim_print_mac_addr(mac_ctx,
Abhishek Singh4294f802017-08-10 16:37:07 +05303155 sap_get_wpspbc_event->addr.bytes, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003156
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303157 sap_get_wpspbc_event->status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003158
3159lim_get_wpspbc_sessions_end:
3160 sap_event_cb =
3161 (tpWLAN_SAPEventCB)get_wps_pbc_sessions_req.pSapEventCallback;
3162 if (NULL != sap_event_cb)
3163 sap_event_cb(&sap_event, get_wps_pbc_sessions_req.pUsrContext);
3164}
3165
3166/**
3167 * __lim_counter_measures()
3168 *
3169 * FUNCTION:
3170 * This function is called to "implement" MIC counter measure
3171 * and is *temporary* only
3172 *
3173 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3174 * we don't do the proper STA disassoc sequence since the
3175 * BSS will be stoped anyway
3176 *
3177 ***ASSUMPTIONS:
3178 *
3179 ***NOTE:
3180 *
3181 * @param pMac Pointer to Global MAC structure
3182 * @return None
3183 */
3184
3185static void __lim_counter_measures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3186{
3187 tSirMacAddr mac = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
Rajeev Kumarc9a50e72016-04-15 15:18:42 -07003188 if (LIM_IS_AP_ROLE(psessionEntry))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003189 lim_send_disassoc_mgmt_frame(pMac, eSIR_MAC_MIC_FAILURE_REASON,
3190 mac, psessionEntry, false);
3191};
3192
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003193static void
3194__lim_handle_sme_stop_bss_request(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
3195{
3196 tSirSmeStopBssReq stopBssReq;
3197 tSirRetStatus status;
3198 tLimSmeStates prevState;
3199 tpPESession psessionEntry;
3200 uint8_t smesessionId;
3201 uint8_t sessionId;
3202 uint16_t smetransactionId;
3203 uint8_t i = 0;
3204 tpDphHashNode pStaDs = NULL;
3205
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303206 qdf_mem_copy(&stopBssReq, pMsgBuf, sizeof(tSirSmeStopBssReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003207 smesessionId = stopBssReq.sessionId;
3208 smetransactionId = stopBssReq.transactionId;
3209
3210 if (!lim_is_sme_stop_bss_req_valid(pMsgBuf)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003211 pe_warn("received invalid SME_STOP_BSS_REQ message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003212 /* Send Stop BSS response to host */
3213 lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP,
3214 eSIR_SME_INVALID_PARAMETERS, smesessionId,
3215 smetransactionId);
3216 return;
3217 }
3218
3219 psessionEntry = pe_find_session_by_bssid(pMac,
Srinivas Girigowdaa2302652016-01-04 14:32:25 -08003220 stopBssReq.bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003221 &sessionId);
3222 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003223 pe_err("session does not exist for given BSSID");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003224 lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP,
3225 eSIR_SME_INVALID_PARAMETERS, smesessionId,
3226 smetransactionId);
3227 return;
3228 }
3229#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
3230 lim_diag_event_report(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry,
3231 0, 0);
3232#endif /* FEATURE_WLAN_DIAG_SUPPORT */
3233
3234 if (psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE || /* Added For BT -AMP Support */
3235 LIM_IS_STA_ROLE(psessionEntry)) {
3236 /**
3237 * Should not have received STOP_BSS_REQ in states
3238 * other than 'normal' state or on STA in Infrastructure
3239 * mode. Log error and return response to host.
3240 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003241 pe_err("received unexpected SME_STOP_BSS_REQ in state %X, for role %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003242 psessionEntry->limSmeState,
3243 GET_LIM_SYSTEM_ROLE(psessionEntry));
3244 lim_print_sme_state(pMac, LOGE, psessionEntry->limSmeState);
3245 /* / Send Stop BSS response to host */
3246 lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP,
3247 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, smesessionId,
3248 smetransactionId);
3249 return;
3250 }
3251
3252 if (LIM_IS_AP_ROLE(psessionEntry))
3253 lim_wpspbc_close(pMac, psessionEntry);
3254
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003255 pe_debug("RECEIVED STOP_BSS_REQ with reason code=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003256 stopBssReq.reasonCode);
3257
3258 prevState = psessionEntry->limSmeState;
3259
3260 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
3261 MTRACE(mac_trace
3262 (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId,
3263 psessionEntry->limSmeState));
3264
3265 /* Update SME session Id and Transaction Id */
3266 psessionEntry->smeSessionId = smesessionId;
3267 psessionEntry->transactionId = smetransactionId;
3268
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07003269 /* STA_IN_IBSS and NDI should NOT send Disassoc frame */
3270 if (!LIM_IS_IBSS_ROLE(psessionEntry) &&
3271 !LIM_IS_NDI_ROLE(psessionEntry)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003272 tSirMacAddr bcAddr = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
3273 if (stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES)
3274 /* Send disassoc all stations associated thru TKIP */
3275 __lim_counter_measures(pMac, psessionEntry);
3276 else
3277 lim_send_disassoc_mgmt_frame(pMac,
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07003278 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON,
3279 bcAddr, psessionEntry, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003280 }
3281
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07003282 if (!LIM_IS_NDI_ROLE(psessionEntry)) {
3283 /* Free the buffer allocated in START_BSS_REQ */
3284 qdf_mem_free(psessionEntry->addIeParams.probeRespData_buff);
3285 psessionEntry->addIeParams.probeRespDataLen = 0;
3286 psessionEntry->addIeParams.probeRespData_buff = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003287
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07003288 qdf_mem_free(psessionEntry->addIeParams.assocRespData_buff);
3289 psessionEntry->addIeParams.assocRespDataLen = 0;
3290 psessionEntry->addIeParams.assocRespData_buff = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003291
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07003292 qdf_mem_free(psessionEntry->addIeParams.probeRespBCNData_buff);
3293 psessionEntry->addIeParams.probeRespBCNDataLen = 0;
3294 psessionEntry->addIeParams.probeRespBCNData_buff = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003295
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07003296 /*
3297 * lim_del_bss is also called as part of coalescing,
3298 * when we send DEL BSS followed by Add Bss msg.
3299 */
3300 pMac->lim.gLimIbssCoalescingHappened = false;
3301 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003302 for (i = 1; i < pMac->lim.gLimAssocStaLimit; i++) {
3303 pStaDs =
3304 dph_get_hash_entry(pMac, i, &psessionEntry->dph.dphHashTable);
3305 if (NULL == pStaDs)
3306 continue;
3307 status = lim_del_sta(pMac, pStaDs, false, psessionEntry);
3308 if (eSIR_SUCCESS == status) {
3309 lim_delete_dph_hash_entry(pMac, pStaDs->staAddr,
3310 pStaDs->assocId, psessionEntry);
3311 lim_release_peer_idx(pMac, pStaDs->assocId, psessionEntry);
3312 } else {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003313 pe_err("lim_del_sta failed with Status: %d", status);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05303314 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003315 }
3316 }
3317 /* send a delBss to HAL and wait for a response */
3318 status = lim_del_bss(pMac, NULL, psessionEntry->bssIdx, psessionEntry);
3319
3320 if (status != eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003321 pe_err("delBss failed for bss %d", psessionEntry->bssIdx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003322 psessionEntry->limSmeState = prevState;
3323
3324 MTRACE(mac_trace
3325 (pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId,
3326 psessionEntry->limSmeState));
3327
3328 lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP,
3329 eSIR_SME_STOP_BSS_FAILURE, smesessionId,
3330 smetransactionId);
3331 }
3332}
3333
3334/**
3335 * __lim_process_sme_stop_bss_req() - Process STOP_BSS from SME
3336 * @pMac: Global MAC context
3337 * @pMsg: Message from SME
3338 *
3339 * Wrapper for the function __lim_handle_sme_stop_bss_request
3340 * This message will be defered until softmac come out of
3341 * scan mode. Message should be handled even if we have
3342 * detected radar in the current operating channel.
3343 *
3344 * Return: true - If we consumed the buffer
3345 * false - If have defered the message.
3346 */
3347
Rajeev Kumarfeb96382017-01-22 19:42:09 -08003348static bool __lim_process_sme_stop_bss_req(tpAniSirGlobal pMac,
3349 struct scheduler_msg *pMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003350{
3351 if (__lim_is_defered_msg_for_learn(pMac, pMsg)) {
3352 /**
3353 * If message defered, buffer is not consumed yet.
3354 * So return false
3355 */
3356 return false;
3357 }
3358 __lim_handle_sme_stop_bss_request(pMac, (uint32_t *) pMsg->bodyptr);
3359 return true;
3360} /*** end __lim_process_sme_stop_bss_req() ***/
3361
3362void lim_process_sme_del_bss_rsp(tpAniSirGlobal pMac,
3363 uint32_t body, tpPESession psessionEntry)
3364{
3365
3366 (void)body;
3367 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3368 lim_ibss_delete(pMac, psessionEntry);
3369 dph_hash_table_class_init(pMac, &psessionEntry->dph.dphHashTable);
3370 lim_delete_pre_auth_list(pMac);
3371 lim_send_sme_rsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,
3372 psessionEntry->smeSessionId,
3373 psessionEntry->transactionId);
3374 return;
3375}
3376
3377/**
3378 * __lim_process_sme_assoc_cnf_new() - process sme assoc/reassoc cnf
3379 *
3380 * @mac_ctx: pointer to mac context
3381 * @msg_type: message type
3382 * @msg_buf: pointer to the SME message buffer
3383 *
3384 * This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3385 * in BTAMP AP.
3386 *
3387 * Return: None
3388 */
3389
3390void __lim_process_sme_assoc_cnf_new(tpAniSirGlobal mac_ctx, uint32_t msg_type,
3391 uint32_t *msg_buf)
3392{
3393 tSirSmeAssocCnf assoc_cnf;
3394 tpDphHashNode sta_ds = NULL;
3395 tpPESession session_entry = NULL;
3396 uint8_t session_id;
3397 tpSirAssocReq assoc_req;
3398
3399 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003400 pe_err("msg_buf is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003401 goto end;
3402 }
3403
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303404 qdf_mem_copy(&assoc_cnf, msg_buf, sizeof(struct sSirSmeAssocCnf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003405 if (!__lim_is_sme_assoc_cnf_valid(&assoc_cnf)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003406 pe_err("Received invalid SME_RE(ASSOC)_CNF message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003407 goto end;
3408 }
3409
Srinivas Girigowdafb796d12016-01-05 23:04:28 -08003410 session_entry = pe_find_session_by_bssid(mac_ctx, assoc_cnf.bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003411 &session_id);
3412 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003413 pe_err("session does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003414 goto end;
3415 }
3416
Rajeev Kumarc9a50e72016-04-15 15:18:42 -07003417 if ((!LIM_IS_AP_ROLE(session_entry)) ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003418 ((session_entry->limSmeState != eLIM_SME_NORMAL_STATE) &&
3419 (session_entry->limSmeState !=
3420 eLIM_SME_NORMAL_CHANNEL_SCAN_STATE))) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003421 pe_err("Rcvd unexpected msg %X in state %X, in role %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003422 msg_type, session_entry->limSmeState,
3423 GET_LIM_SYSTEM_ROLE(session_entry));
3424 goto end;
3425 }
3426 sta_ds = dph_get_hash_entry(mac_ctx, assoc_cnf.aid,
3427 &session_entry->dph.dphHashTable);
3428 if (sta_ds == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003429 pe_err("Rcvd invalid msg %X due to no STA ctx, aid %d, peer",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003430 msg_type, assoc_cnf.aid);
Abhishek Singh5d8d7332017-08-10 15:15:24 +05303431 lim_print_mac_addr(mac_ctx, assoc_cnf.peer_macaddr.bytes, LOGE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003432
3433 /*
3434 * send a DISASSOC_IND message to WSM to make sure
3435 * the state in WSM and LIM is the same
3436 */
Srinivas Girigowdafb796d12016-01-05 23:04:28 -08003437 lim_send_sme_disassoc_ntf(mac_ctx, assoc_cnf.peer_macaddr.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003438 eSIR_SME_STA_NOT_ASSOCIATED,
3439 eLIM_PEER_ENTITY_DISASSOC, assoc_cnf.aid,
3440 session_entry->smeSessionId,
3441 session_entry->transactionId,
3442 session_entry);
3443 goto end;
3444 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303445 if (qdf_mem_cmp((uint8_t *)sta_ds->staAddr,
Srinivas Girigowdafb796d12016-01-05 23:04:28 -08003446 (uint8_t *) assoc_cnf.peer_macaddr.bytes,
Anurag Chouhan6d760662016-02-20 16:05:43 +05303447 QDF_MAC_ADDR_SIZE)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003448 pe_debug("peerMacAddr mismatched for aid %d, peer ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003449 assoc_cnf.aid);
Abhishek Singh5d8d7332017-08-10 15:15:24 +05303450 lim_print_mac_addr(mac_ctx, assoc_cnf.peer_macaddr.bytes, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003451 goto end;
3452 }
3453
3454 if ((sta_ds->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3455 ((sta_ds->mlmStaContext.subType == LIM_ASSOC) &&
3456 (msg_type != eWNI_SME_ASSOC_CNF)) ||
3457 ((sta_ds->mlmStaContext.subType == LIM_REASSOC) &&
3458 (msg_type != eWNI_SME_ASSOC_CNF))) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003459 pe_debug("not in MLM_WT_ASSOC_CNF_STATE, for aid %d, peer"
3460 "StaD mlmState: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003461 assoc_cnf.aid, sta_ds->mlmStaContext.mlmState);
Abhishek Singh5d8d7332017-08-10 15:15:24 +05303462 lim_print_mac_addr(mac_ctx, assoc_cnf.peer_macaddr.bytes, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003463 goto end;
3464 }
3465 /*
3466 * Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3467 * has been received
3468 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003469 pe_debug("Received SME_ASSOC_CNF. Delete Timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003470 lim_deactivate_and_change_per_sta_id_timer(mac_ctx,
3471 eLIM_CNF_WAIT_TIMER, sta_ds->assocId);
3472
3473 if (assoc_cnf.statusCode == eSIR_SME_SUCCESS) {
3474 /*
3475 * In BTAMP-AP, PE already finished the WMA_ADD_STA sequence
3476 * when it had received Assoc Request frame. Now, PE just needs
3477 * to send association rsp frame to the requesting BTAMP-STA.
3478 */
3479 sta_ds->mlmStaContext.mlmState =
3480 eLIM_MLM_LINK_ESTABLISHED_STATE;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003481 pe_debug("sending Assoc Rsp frame to STA (assoc id=%d)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003482 sta_ds->assocId);
3483 lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_SUCCESS,
3484 sta_ds->assocId, sta_ds->staAddr,
3485 sta_ds->mlmStaContext.subType, sta_ds,
3486 session_entry);
3487 goto end;
3488 } else {
3489 /*
3490 * SME_ASSOC_CNF status is non-success, so STA is not allowed
3491 * to be associated since the HAL sta entry is created for
3492 * denied STA we need to remove this HAL entry.
3493 * So to do that set updateContext to 1
3494 */
3495 if (!sta_ds->mlmStaContext.updateContext)
3496 sta_ds->mlmStaContext.updateContext = 1;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003497 pe_debug("Recv Assoc Cnf, status Code : %d(assoc id=%d)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003498 assoc_cnf.statusCode, sta_ds->assocId);
3499 lim_reject_association(mac_ctx, sta_ds->staAddr,
3500 sta_ds->mlmStaContext.subType,
3501 true, sta_ds->mlmStaContext.authType,
3502 sta_ds->assocId, true,
Sandeep Puligillaa9de16b2017-09-25 16:25:04 -07003503 eSIR_MAC_UNSPEC_FAILURE_STATUS,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003504 session_entry);
3505 }
3506end:
3507 if (((session_entry != NULL) && (sta_ds != NULL)) &&
3508 (session_entry->parsedAssocReq[sta_ds->assocId] != NULL)) {
3509 assoc_req = (tpSirAssocReq)
3510 session_entry->parsedAssocReq[sta_ds->assocId];
3511 if (assoc_req->assocReqFrame) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303512 qdf_mem_free(assoc_req->assocReqFrame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003513 assoc_req->assocReqFrame = NULL;
3514 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303515 qdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003516 session_entry->parsedAssocReq[sta_ds->assocId] = NULL;
3517 }
3518}
3519
3520static void __lim_process_sme_addts_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
3521{
3522 tpDphHashNode pStaDs;
3523 tSirMacAddr peerMac;
3524 tpSirAddtsReq pSirAddts;
3525 uint32_t timeout;
3526 tpPESession psessionEntry;
3527 uint8_t sessionId; /* PE sessionId */
3528 uint8_t smesessionId;
3529 uint16_t smetransactionId;
3530
3531 if (pMsgBuf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003532 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003533 return;
3534 }
3535
3536 lim_get_session_info(pMac, (uint8_t *) pMsgBuf, &smesessionId,
3537 &smetransactionId);
3538
3539 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3540
Srinivas Girigowdaaeb33322015-12-04 10:54:07 -08003541 psessionEntry = pe_find_session_by_bssid(pMac, pSirAddts->bssid.bytes,
3542 &sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003543 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003544 pe_err("Session Does not exist for given bssId");
yeshwanth sriram guntuka8fa6fa32017-03-23 13:59:22 +05303545 lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE,
3546 NULL, pSirAddts->req.tspec,
3547 smesessionId, smetransactionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003548 return;
3549 }
3550#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
3551 lim_diag_event_report(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0,
3552 0);
3553#endif /* FEATURE_WLAN_DIAG_SUPPORT */
3554
3555 /* if sta
3556 * - verify assoc state
3557 * - send addts request to ap
3558 * - wait for addts response from ap
3559 * if ap, just ignore with error log
3560 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003561 pe_debug("Received SME_ADDTS_REQ (TSid %d, UP %d)",
3562 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3563 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003564
Rajeev Kumarc9a50e72016-04-15 15:18:42 -07003565 if (!LIM_IS_STA_ROLE(psessionEntry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003566 pe_err("AddTs received on AP - ignoring");
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303567 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003568 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003569
3570 pStaDs =
3571 dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER,
3572 &psessionEntry->dph.dphHashTable);
3573
3574 if (pStaDs == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003575 pe_err("Cannot find AP context for addts req");
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303576 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003577 }
3578
3579 if ((!pStaDs->valid) || (pStaDs->mlmStaContext.mlmState !=
3580 eLIM_MLM_LINK_ESTABLISHED_STATE)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003581 pe_err("AddTs received in invalid MLM state");
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303582 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003583 }
3584
3585 pSirAddts->req.wsmTspecPresent = 0;
3586 pSirAddts->req.wmeTspecPresent = 0;
3587 pSirAddts->req.lleTspecPresent = 0;
3588
3589 if ((pStaDs->wsmEnabled) &&
3590 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy !=
3591 SIR_MAC_ACCESSPOLICY_EDCA))
3592 pSirAddts->req.wsmTspecPresent = 1;
3593 else if (pStaDs->wmeEnabled)
3594 pSirAddts->req.wmeTspecPresent = 1;
3595 else if (pStaDs->lleEnabled)
3596 pSirAddts->req.lleTspecPresent = 1;
3597 else {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003598 pe_warn("ADDTS_REQ ignore - qos is disabled");
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303599 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003600 }
3601
3602 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3603 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003604 pe_err("AddTs received in invalid LIMsme state (%d)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003605 psessionEntry->limSmeState);
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303606 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003607 }
3608
3609 if (pMac->lim.gLimAddtsSent) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003610 pe_err("Addts (token %d, tsid %d, up %d) is still pending",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003611 pMac->lim.gLimAddtsReq.req.dialogToken,
3612 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3613 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.
3614 userPrio);
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303615 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003616 }
3617
3618 sir_copy_mac_addr(peerMac, psessionEntry->bssId);
3619
3620 /* save the addts request */
3621 pMac->lim.gLimAddtsSent = true;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303622 qdf_mem_copy((uint8_t *) &pMac->lim.gLimAddtsReq,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003623 (uint8_t *) pSirAddts, sizeof(tSirAddtsReq));
3624
3625 /* ship out the message now */
3626 lim_send_addts_req_action_frame(pMac, peerMac, &pSirAddts->req,
3627 psessionEntry);
Abhishek Singh5d8d7332017-08-10 15:15:24 +05303628 pe_err("Sent ADDTS request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003629 /* start a timer to wait for the response */
3630 if (pSirAddts->timeout)
3631 timeout = pSirAddts->timeout;
3632 else if (wlan_cfg_get_int(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) !=
3633 eSIR_SUCCESS) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05303634 pe_debug("Unable to get Cfg param %d (Addts Rsp Timeout)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003635 WNI_CFG_ADDTS_RSP_TIMEOUT);
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303636 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003637 }
3638
3639 timeout = SYS_MS_TO_TICKS(timeout);
3640 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0)
3641 != TX_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003642 pe_err("AddtsRsp timer change failed!");
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303643 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003644 }
3645 pMac->lim.gLimAddtsRspTimerCount++;
3646 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3647 pMac->lim.gLimAddtsRspTimerCount) !=
3648 TX_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003649 pe_err("AddtsRsp timer change failed!");
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303650 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003651 }
3652 MTRACE(mac_trace
3653 (pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId,
3654 eLIM_ADDTS_RSP_TIMER));
3655
3656 /* add the sessionId to the timer object */
3657 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3658 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) !=
3659 TX_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003660 pe_err("AddtsRsp timer activation failed!");
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303661 goto send_failure_addts_rsp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003662 }
3663 return;
Sreelakshmi Konamki2972b6e2017-07-17 12:10:36 +05303664
3665send_failure_addts_rsp:
3666 lim_send_sme_addts_rsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE,
3667 psessionEntry, pSirAddts->req.tspec,
3668 smesessionId, smetransactionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003669}
3670
3671static void __lim_process_sme_delts_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
3672{
3673 tSirMacAddr peerMacAddr;
3674 uint8_t ac;
3675 tSirMacTSInfo *pTsinfo;
3676 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3677 tpDphHashNode pStaDs = NULL;
3678 tpPESession psessionEntry;
3679 uint8_t sessionId;
3680 uint32_t status = eSIR_SUCCESS;
3681 uint8_t smesessionId;
3682 uint16_t smetransactionId;
3683
3684 lim_get_session_info(pMac, (uint8_t *) pMsgBuf, &smesessionId,
3685 &smetransactionId);
3686
3687 psessionEntry = pe_find_session_by_bssid(pMac,
Srinivas Girigowdabab88932015-12-03 19:18:11 -08003688 pDeltsReq->bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003689 &sessionId);
3690 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003691 pe_err("Session Does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003692 status = eSIR_FAILURE;
3693 goto end;
3694 }
3695#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
3696 lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0,
3697 0);
3698#endif /* FEATURE_WLAN_DIAG_SUPPORT */
3699
3700 if (eSIR_SUCCESS !=
3701 lim_validate_delts_req(pMac, pDeltsReq, peerMacAddr, psessionEntry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003702 pe_err("lim_validate_delts_req failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003703 status = eSIR_FAILURE;
3704 lim_send_sme_delts_rsp(pMac, pDeltsReq, eSIR_FAILURE, psessionEntry,
3705 smesessionId, smetransactionId);
3706 return;
3707 }
3708
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003709 pe_debug("Sent DELTS request to station with assocId = %d MacAddr = "
3710 MAC_ADDRESS_STR,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003711 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
3712
3713 lim_send_delts_req_action_frame(pMac, peerMacAddr,
3714 pDeltsReq->req.wmeTspecPresent,
3715 &pDeltsReq->req.tsinfo,
3716 &pDeltsReq->req.tspec, psessionEntry);
3717
3718 pTsinfo =
3719 pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.
3720 tsinfo : &pDeltsReq->req.tsinfo;
3721
3722 /* We've successfully send DELTS frame to AP. Update the
3723 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
3724 * is no longer trigger enabled or delivery enabled
3725 */
3726 lim_set_tspec_uapsd_mask_per_session(pMac, psessionEntry,
3727 pTsinfo, CLEAR_UAPSD_MASK);
3728
3729 /* We're deleting the TSPEC, so this particular AC is no longer
3730 * admitted. PE needs to downgrade the EDCA
3731 * parameters(for the AC for which TS is being deleted) to the
3732 * next best AC for which ACM is not enabled, and send the
3733 * updated values to HAL.
3734 */
3735 ac = upToAc(pTsinfo->traffic.userPrio);
3736
3737 if (pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK) {
3738 psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &=
3739 ~(1 << ac);
3740 } else if (pTsinfo->traffic.direction ==
3741 SIR_MAC_DIRECTION_DNLINK) {
3742 psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &=
3743 ~(1 << ac);
3744 } else if (pTsinfo->traffic.direction ==
3745 SIR_MAC_DIRECTION_BIDIR) {
3746 psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &=
3747 ~(1 << ac);
3748 psessionEntry->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &=
3749 ~(1 << ac);
3750 }
3751
3752 lim_set_active_edca_params(pMac, psessionEntry->gLimEdcaParams,
3753 psessionEntry);
3754
3755 pStaDs =
3756 dph_get_hash_entry(pMac, DPH_STA_HASH_INDEX_PEER,
3757 &psessionEntry->dph.dphHashTable);
3758 if (pStaDs != NULL) {
3759 lim_send_edca_params(pMac, psessionEntry->gLimEdcaParamsActive,
3760 pStaDs->bssId);
3761 status = eSIR_SUCCESS;
3762 } else {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003763 pe_err("Self entry missing in Hash Table");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003764 status = eSIR_FAILURE;
3765 }
3766#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003767 lim_send_sme_tsm_ie_ind(pMac, psessionEntry, 0, 0, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003768#endif
3769
3770 /* send an sme response back */
3771end:
3772 lim_send_sme_delts_rsp(pMac, pDeltsReq, eSIR_SUCCESS, psessionEntry,
3773 smesessionId, smetransactionId);
3774}
3775
Sreelakshmi Konamkif76b4072017-03-01 10:41:05 +05303776void lim_process_sme_addts_rsp_timeout(tpAniSirGlobal pMac, uint32_t param)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003777{
3778 /* fetch the sessionEntry based on the sessionId */
3779 tpPESession psessionEntry;
3780 psessionEntry = pe_find_session_by_session_id(pMac,
3781 pMac->lim.limTimers.gLimAddtsRspTimer.
3782 sessionId);
3783 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003784 pe_err("Session Does not exist for given sessionID");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003785 return;
3786 }
3787
Rajeev Kumarc9a50e72016-04-15 15:18:42 -07003788 if (!LIM_IS_STA_ROLE(psessionEntry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003789 pe_warn("AddtsRspTimeout in non-Sta role (%d)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003790 GET_LIM_SYSTEM_ROLE(psessionEntry));
3791 pMac->lim.gLimAddtsSent = false;
3792 return;
3793 }
3794
3795 if (!pMac->lim.gLimAddtsSent) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003796 pe_warn("AddtsRspTimeout but no AddtsSent");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003797 return;
3798 }
3799
3800 if (param != pMac->lim.gLimAddtsRspTimerCount) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003801 pe_err("Invalid AddtsRsp Timer count %d (exp %d)", param,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003802 pMac->lim.gLimAddtsRspTimerCount);
3803 return;
3804 }
3805 /* this a real response timeout */
3806 pMac->lim.gLimAddtsSent = false;
3807 pMac->lim.gLimAddtsRspTimerCount++;
3808
3809 lim_send_sme_addts_rsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT,
3810 psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
3811 psessionEntry->smeSessionId,
3812 psessionEntry->transactionId);
3813}
3814
3815/**
3816 * __lim_process_sme_get_statistics_request()
3817 *
3818 ***FUNCTION:
3819 *
3820 *
3821 ***NOTE:
3822 *
3823 * @param pMac Pointer to Global MAC structure
3824 * @param *pMsgBuf A pointer to the SME message buffer
3825 * @return None
3826 */
3827static void
3828__lim_process_sme_get_statistics_request(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
3829{
3830 tpAniGetPEStatsReq pPEStatsReq;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07003831 struct scheduler_msg msgQ = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003832
3833 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
3834
3835 msgQ.type = WMA_GET_STATISTICS_REQ;
3836
3837 msgQ.reserved = 0;
3838 msgQ.bodyptr = pMsgBuf;
3839 msgQ.bodyval = 0;
3840 MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type));
3841
3842 if (eSIR_SUCCESS != (wma_post_ctrl_msg(pMac, &msgQ))) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303843 qdf_mem_free(pMsgBuf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003844 pMsgBuf = NULL;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003845 pe_err("Unable to forward request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003846 return;
3847 }
3848
3849 return;
3850}
3851
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08003852#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003853/**
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08003854 * __lim_process_sme_get_tsm_stats_request() - get tsm stats request
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003855 *
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08003856 * @pMac: Pointer to Global MAC structure
3857 * @pMsgBuf: A pointer to the SME message buffer
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003858 *
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08003859 * Return: None
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003860 */
3861static void
3862__lim_process_sme_get_tsm_stats_request(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
3863{
Rajeev Kumar37d478b2017-04-17 16:59:28 -07003864 struct scheduler_msg msgQ = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003865
3866 msgQ.type = WMA_TSM_STATS_REQ;
3867 msgQ.reserved = 0;
3868 msgQ.bodyptr = pMsgBuf;
3869 msgQ.bodyval = 0;
3870 MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type));
3871
3872 if (eSIR_SUCCESS != (wma_post_ctrl_msg(pMac, &msgQ))) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303873 qdf_mem_free(pMsgBuf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003874 pMsgBuf = NULL;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003875 pe_err("Unable to forward request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003876 return;
3877 }
3878}
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08003879#endif /* FEATURE_WLAN_ESE */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003880
Naveen Rawat8029a402017-06-01 10:54:19 -07003881static void lim_process_sme_update_config(tpAniSirGlobal mac_ctx,
3882 struct update_config *msg)
3883{
3884 tpPESession pe_session;
3885
3886 pe_debug("received eWNI_SME_UPDATE_HT_CONFIG message");
3887 if (msg == NULL) {
3888 pe_err("Buffer is Pointing to NULL");
3889 return;
3890 }
3891
3892 pe_session = pe_find_session_by_sme_session_id(mac_ctx,
3893 msg->sme_session_id);
3894 if (pe_session == NULL) {
3895 pe_warn("Session does not exist for given BSSID");
3896 return;
3897 }
3898
3899 switch (msg->capab) {
3900 case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING:
3901 pe_session->htConfig.ht_rx_ldpc = msg->value;
3902 break;
3903 case WNI_CFG_HT_CAP_INFO_TX_STBC:
3904 pe_session->htConfig.ht_tx_stbc = msg->value;
3905 break;
3906 case WNI_CFG_HT_CAP_INFO_RX_STBC:
3907 pe_session->htConfig.ht_rx_stbc = msg->value;
3908 break;
3909 case WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ:
3910 pe_session->htConfig.ht_sgi20 = msg->value;
3911 break;
3912 case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ:
3913 pe_session->htConfig.ht_sgi40 = msg->value;
3914 break;
3915 }
3916
3917 if (LIM_IS_AP_ROLE(pe_session)) {
3918 sch_set_fixed_beacon_fields(mac_ctx, pe_session);
3919 lim_send_beacon_ind(mac_ctx, pe_session);
3920 }
3921}
3922
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003923void
3924lim_send_vdev_restart(tpAniSirGlobal pMac,
3925 tpPESession psessionEntry, uint8_t sessionId)
3926{
3927 tpHalHiddenSsidVdevRestart pHalHiddenSsidVdevRestart = NULL;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07003928 struct scheduler_msg msgQ = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003929 tSirRetStatus retCode = eSIR_SUCCESS;
3930
3931 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003932 pe_err("Invalid parameters");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003933 return;
3934 }
3935
3936 pHalHiddenSsidVdevRestart =
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303937 qdf_mem_malloc(sizeof(tHalHiddenSsidVdevRestart));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003938 if (NULL == pHalHiddenSsidVdevRestart) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003939 pe_err("Unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003940 return;
3941 }
3942
3943 pHalHiddenSsidVdevRestart->ssidHidden = psessionEntry->ssidHidden;
3944 pHalHiddenSsidVdevRestart->sessionId = sessionId;
Kiran Kumar Lokere5798bfa2017-04-27 20:49:39 -07003945 pHalHiddenSsidVdevRestart->pe_session_id = psessionEntry->peSessionId;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003946
3947 msgQ.type = WMA_HIDDEN_SSID_VDEV_RESTART;
3948 msgQ.bodyptr = pHalHiddenSsidVdevRestart;
3949 msgQ.bodyval = 0;
3950
3951 retCode = wma_post_ctrl_msg(pMac, &msgQ);
3952 if (eSIR_SUCCESS != retCode) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003953 pe_err("wma_post_ctrl_msg() failed");
Anurag Chouhan600c3a02016-03-01 10:33:54 +05303954 qdf_mem_free(pHalHiddenSsidVdevRestart);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003955 }
3956}
3957
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05303958/**
3959 * __lim_process_roam_scan_offload_req() - Process Roam scan offload from csr
3960 * @mac_ctx: Pointer to Global MAC structure
3961 * @msg_buf: Pointer to SME message buffer
3962 *
3963 * Return: None
3964 */
3965static void __lim_process_roam_scan_offload_req(tpAniSirGlobal mac_ctx,
3966 uint32_t *msg_buf)
3967{
3968 tpPESession pe_session;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07003969 struct scheduler_msg wma_msg = {0};
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05303970 tSirRetStatus status;
3971 tSirRoamOffloadScanReq *req_buffer;
3972 uint16_t local_ie_len;
3973 uint8_t *local_ie_buf;
3974
3975 req_buffer = (tSirRoamOffloadScanReq *)msg_buf;
3976 pe_session = pe_find_session_by_sme_session_id(mac_ctx,
3977 req_buffer->sessionId);
3978
3979 local_ie_buf = qdf_mem_malloc(MAX_DEFAULT_SCAN_IE_LEN);
3980 if (!local_ie_buf) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07003981 pe_err("Mem Alloc failed for local_ie_buf");
Manikandan Mohan41e2d6f2017-04-10 16:17:39 +05303982 qdf_mem_free(req_buffer);
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05303983 return;
3984 }
3985
3986 local_ie_len = req_buffer->assoc_ie.length;
3987 /* Update ext cap IE if present */
3988 if (local_ie_len &&
Arif Hussain963331b2016-10-27 22:59:01 -07003989 !lim_update_ext_cap_ie(mac_ctx, req_buffer->assoc_ie.addIEdata,
3990 local_ie_buf, &local_ie_len)) {
3991 if (local_ie_len <
Arif Hussainc2bb4402016-10-25 15:24:08 -07003992 QDF_ARRAY_SIZE(req_buffer->assoc_ie.addIEdata)) {
3993 req_buffer->assoc_ie.length = local_ie_len;
3994 qdf_mem_copy(req_buffer->assoc_ie.addIEdata,
3995 local_ie_buf, local_ie_len);
3996 }
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05303997 }
3998 qdf_mem_free(local_ie_buf);
3999
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05304000 if (pe_session)
4001 lim_update_fils_rik(pe_session, req_buffer);
4002
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05304003 wma_msg.type = WMA_ROAM_SCAN_OFFLOAD_REQ;
4004 wma_msg.bodyptr = req_buffer;
4005
4006 status = wma_post_ctrl_msg(mac_ctx, &wma_msg);
4007 if (eSIR_SUCCESS != status) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004008 pe_err("Posting WMA_ROAM_SCAN_OFFLOAD_REQ failed");
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05304009 qdf_mem_free(req_buffer);
4010 }
4011}
4012
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304013/*
4014 * lim_handle_update_ssid_hidden() - Processes SSID hidden update
4015 * @mac_ctx: Pointer to global mac context
4016 * @session: Pointer to PE session
4017 * @ssid_hidden: SSID hidden value to set; 0 - Broadcast SSID,
4018 * 1 - Disable broadcast SSID
4019 *
4020 * Return: None
4021 */
4022static void lim_handle_update_ssid_hidden(tpAniSirGlobal mac_ctx,
4023 tpPESession session, uint8_t ssid_hidden)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004024{
Kiran Kumar Lokere5798bfa2017-04-27 20:49:39 -07004025 pe_debug("rcvd HIDE_SSID message old HIDE_SSID: %d new HIDE_SSID: %d",
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004026 session->ssidHidden, ssid_hidden);
4027
Kiran Kumar Lokere5798bfa2017-04-27 20:49:39 -07004028 if (ssid_hidden != session->ssidHidden) {
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304029 session->ssidHidden = ssid_hidden;
Kiran Kumar Lokere5798bfa2017-04-27 20:49:39 -07004030 } else {
4031 pe_debug("Dont process HIDE_SSID msg with existing setting");
Selvaraj, Sridhara0083c42016-06-22 22:15:43 +05304032 return;
4033 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004034
4035 /* Send vdev restart */
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304036 lim_send_vdev_restart(mac_ctx, session, session->smeSessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004037
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004038 return;
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304039}
4040
4041/**
4042 * __lim_process_sme_session_update - process SME session update msg
4043 *
4044 * @mac_ctx: Pointer to global mac context
4045 * @msg_buf: Pointer to the received message buffer
4046 *
4047 * Return: None
4048 */
4049static void __lim_process_sme_session_update(tpAniSirGlobal mac_ctx,
4050 uint32_t *msg_buf)
4051{
4052 struct sir_update_session_param *msg;
4053 tpPESession session;
4054
4055 if (!msg_buf) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004056 pe_err("Buffer is Pointing to NULL");
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304057 return;
4058 }
4059
4060 msg = (struct sir_update_session_param *) msg_buf;
4061
4062 session = pe_find_session_by_sme_session_id(mac_ctx, msg->session_id);
4063 if (!session) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004064 pe_warn("Session does not exist for given sessionId %d",
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304065 msg->session_id);
4066 return;
4067 }
4068
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004069 pe_debug("received SME Session update for %d val %d",
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304070 msg->param_type, msg->param_val);
4071 switch (msg->param_type) {
4072 case SIR_PARAM_SSID_HIDDEN:
4073 lim_handle_update_ssid_hidden(mac_ctx, session, msg->param_val);
4074 break;
Selvaraj, Sridharac4fcf32016-09-28 12:57:32 +05304075 case SIR_PARAM_IGNORE_ASSOC_DISALLOWED:
4076 session->ignore_assoc_disallowed = msg->param_val;
4077 break;
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304078 default:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004079 pe_err("Unknown session param");
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304080 break;
4081 }
4082}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004083
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004084/*
4085 Update the beacon Interval dynamically if beaconInterval is different in MCC
4086 */
4087static void __lim_process_sme_change_bi(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
4088{
4089 tpSirChangeBIParams pChangeBIParams;
4090 tpPESession psessionEntry;
4091 uint8_t sessionId = 0;
4092 tUpdateBeaconParams beaconParams;
4093
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004094 pe_debug("received Update Beacon Interval message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004095
4096 if (pMsgBuf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004097 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004098 return;
4099 }
4100
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304101 qdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004102 pChangeBIParams = (tpSirChangeBIParams) pMsgBuf;
4103
4104 psessionEntry = pe_find_session_by_bssid(pMac,
Srinivas Girigowda8e717d32015-11-24 15:54:33 -08004105 pChangeBIParams->bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004106 &sessionId);
4107 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004108 pe_err("Session does not exist for given BSSID");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004109 return;
4110 }
4111
4112 /*Update sessionEntry Beacon Interval */
4113 if (psessionEntry->beaconParams.beaconInterval !=
4114 pChangeBIParams->beaconInterval) {
4115 psessionEntry->beaconParams.beaconInterval =
4116 pChangeBIParams->beaconInterval;
4117 }
4118
4119 /*Update sch beaconInterval */
4120 if (pMac->sch.schObject.gSchBeaconInterval !=
4121 pChangeBIParams->beaconInterval) {
4122 pMac->sch.schObject.gSchBeaconInterval =
4123 pChangeBIParams->beaconInterval;
4124
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004125 pe_debug("LIM send update BeaconInterval Indication: %d",
4126 pChangeBIParams->beaconInterval);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004127
4128 if (false == pMac->sap.SapDfsInfo.is_dfs_cac_timer_running) {
4129 /* Update beacon */
4130 sch_set_fixed_beacon_fields(pMac, psessionEntry);
4131
4132 beaconParams.bssIdx = psessionEntry->bssIdx;
4133 /* Set change in beacon Interval */
4134 beaconParams.beaconInterval =
4135 pChangeBIParams->beaconInterval;
4136 beaconParams.paramChangeBitmap =
4137 PARAM_BCN_INTERVAL_CHANGED;
4138 lim_send_beacon_params(pMac, &beaconParams, psessionEntry);
4139 }
4140 }
4141
4142 return;
4143} /*** end __lim_process_sme_change_bi(tpAniSirGlobal pMac, uint32_t *pMsgBuf) ***/
4144
4145#ifdef QCA_HT_2040_COEX
4146static void __lim_process_sme_set_ht2040_mode(tpAniSirGlobal pMac,
4147 uint32_t *pMsgBuf)
4148{
4149 tpSirSetHT2040Mode pSetHT2040Mode;
4150 tpPESession psessionEntry;
4151 uint8_t sessionId = 0;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07004152 struct scheduler_msg msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004153 tUpdateVHTOpMode *pHtOpMode = NULL;
4154 uint16_t staId = 0;
4155 tpDphHashNode pStaDs = NULL;
4156
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004157 pe_debug("received Set HT 20/40 mode message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004158 if (pMsgBuf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004159 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004160 return;
4161 }
4162
4163 pSetHT2040Mode = (tpSirSetHT2040Mode) pMsgBuf;
4164
4165 psessionEntry = pe_find_session_by_bssid(pMac,
Srinivas Girigowdac52474d2015-11-24 15:49:31 -08004166 pSetHT2040Mode->bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004167 &sessionId);
4168 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004169 pe_debug("Session does not exist for given BSSID");
4170 lim_print_mac_addr(pMac, pSetHT2040Mode->bssid.bytes, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004171 return;
4172 }
4173
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004174 pe_debug("Update session entry for cbMod=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004175 pSetHT2040Mode->cbMode);
4176 /*Update sessionEntry HT related fields */
4177 switch (pSetHT2040Mode->cbMode) {
4178 case PHY_SINGLE_CHANNEL_CENTERED:
4179 psessionEntry->htSecondaryChannelOffset =
4180 PHY_SINGLE_CHANNEL_CENTERED;
4181 psessionEntry->htRecommendedTxWidthSet = 0;
4182 if (pSetHT2040Mode->obssEnabled)
4183 psessionEntry->htSupportedChannelWidthSet
4184 = eHT_CHANNEL_WIDTH_40MHZ;
4185 else
4186 psessionEntry->htSupportedChannelWidthSet
4187 = eHT_CHANNEL_WIDTH_20MHZ;
4188 break;
4189 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4190 psessionEntry->htSecondaryChannelOffset =
4191 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4192 psessionEntry->htRecommendedTxWidthSet = 1;
4193 break;
4194 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4195 psessionEntry->htSecondaryChannelOffset =
4196 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4197 psessionEntry->htRecommendedTxWidthSet = 1;
4198 break;
4199 default:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004200 pe_err("Invalid cbMode");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004201 return;
4202 }
4203
4204 /* Update beacon */
4205 sch_set_fixed_beacon_fields(pMac, psessionEntry);
4206 lim_send_beacon_ind(pMac, psessionEntry);
4207
4208 /* update OP Mode for each associated peer */
4209 for (staId = 0; staId < psessionEntry->dph.dphHashTable.size; staId++) {
4210 pStaDs = dph_get_hash_entry(pMac, staId,
4211 &psessionEntry->dph.dphHashTable);
4212 if (NULL == pStaDs)
4213 continue;
4214
4215 if (pStaDs->valid && pStaDs->htSupportedChannelWidthSet) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304216 pHtOpMode = qdf_mem_malloc(sizeof(tUpdateVHTOpMode));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004217 if (NULL == pHtOpMode) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004218 pe_err("Not able to allocate memory for setting OP mode");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004219 return;
4220 }
4221 pHtOpMode->opMode =
4222 (psessionEntry->htSecondaryChannelOffset ==
4223 PHY_SINGLE_CHANNEL_CENTERED) ?
4224 eHT_CHANNEL_WIDTH_20MHZ : eHT_CHANNEL_WIDTH_40MHZ;
4225 pHtOpMode->staId = staId;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304226 qdf_mem_copy(pHtOpMode->peer_mac, &pStaDs->staAddr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004227 sizeof(tSirMacAddr));
4228 pHtOpMode->smesessionId = sessionId;
4229
4230 msg.type = WMA_UPDATE_OP_MODE;
4231 msg.reserved = 0;
4232 msg.bodyptr = pHtOpMode;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004233 if (!QDF_IS_STATUS_SUCCESS
4234 (scheduler_post_msg(QDF_MODULE_ID_WMA, &msg))) {
4235 pe_err("Not able to post WMA_UPDATE_OP_MODE message to WMA");
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304236 qdf_mem_free(pHtOpMode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004237 return;
4238 }
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004239 pe_debug("Notifed FW about OP mode: %d for staId=%d",
4240 pHtOpMode->opMode, staId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004241
4242 } else
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004243 pe_debug("station %d does not support HT40", staId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004244 }
4245
4246 return;
4247}
4248#endif
4249
4250/* -------------------------------------------------------------------- */
4251/**
4252 * __lim_process_report_message
4253 *
4254 * FUNCTION: Processes the next received Radio Resource Management message
4255 *
4256 * LOGIC:
4257 *
4258 * ASSUMPTIONS:
4259 *
4260 * NOTE:
4261 *
4262 * @param None
4263 * @return None
4264 */
4265
Rajeev Kumarfeb96382017-01-22 19:42:09 -08004266static void __lim_process_report_message(tpAniSirGlobal pMac,
4267 struct scheduler_msg *pMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004268{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004269 switch (pMsg->type) {
4270 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4271 rrm_process_neighbor_report_req(pMac, pMsg->bodyptr);
4272 break;
4273 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004274 rrm_process_beacon_report_xmit(pMac, pMsg->bodyptr);
Krishna Kumaar Natarajanf599c6e2015-11-03 11:44:03 -08004275 break;
4276 default:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004277 pe_err("Invalid msg type: %d", pMsg->type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004278 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004279}
4280
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004281/* -------------------------------------------------------------------- */
4282/**
4283 * lim_send_set_max_tx_power_req
4284 *
4285 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4286 *
4287 * LOGIC:
4288 *
4289 * ASSUMPTIONS:
4290 *
4291 * NOTE:
4292 *
4293 * @param txPower txPower to be set.
4294 * @param pSessionEntry session entry.
4295 * @return None
4296 */
4297tSirRetStatus
Amar Singhala297bfa2015-10-15 15:07:29 -07004298lim_send_set_max_tx_power_req(tpAniSirGlobal pMac, int8_t txPower,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004299 tpPESession pSessionEntry)
4300{
4301 tpMaxTxPowerParams pMaxTxParams = NULL;
4302 tSirRetStatus retCode = eSIR_SUCCESS;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07004303 struct scheduler_msg msgQ = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004304
4305 if (pSessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004306 pe_err("Invalid parameters");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004307 return eSIR_FAILURE;
4308 }
4309
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304310 pMaxTxParams = qdf_mem_malloc(sizeof(tMaxTxPowerParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004311 if (NULL == pMaxTxParams) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004312 pe_err("Unable to allocate memory for pMaxTxParams");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004313 return eSIR_MEM_ALLOC_FAILED;
4314
4315 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004316 pMaxTxParams->power = txPower;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304317 qdf_mem_copy(pMaxTxParams->bssId.bytes, pSessionEntry->bssId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05304318 QDF_MAC_ADDR_SIZE);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304319 qdf_mem_copy(pMaxTxParams->selfStaMacAddr.bytes,
Srinivas Girigowda97215232015-09-24 12:26:28 -07004320 pSessionEntry->selfMacAddr,
Anurag Chouhan6d760662016-02-20 16:05:43 +05304321 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004322
4323 msgQ.type = WMA_SET_MAX_TX_POWER_REQ;
4324 msgQ.bodyptr = pMaxTxParams;
4325 msgQ.bodyval = 0;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004326 pe_debug("Post WMA_SET_MAX_TX_POWER_REQ to WMA");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004327 MTRACE(mac_trace_msg_tx(pMac, pSessionEntry->peSessionId, msgQ.type));
4328 retCode = wma_post_ctrl_msg(pMac, &msgQ);
4329 if (eSIR_SUCCESS != retCode) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004330 pe_err("wma_post_ctrl_msg() failed");
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304331 qdf_mem_free(pMaxTxParams);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004332 }
4333 return retCode;
4334}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004335
4336/**
4337 * __lim_process_sme_register_mgmt_frame_req() - process sme reg mgmt frame req
4338 *
4339 * @mac_ctx: Pointer to Global MAC structure
4340 * @msg_buf: pointer to the SME message buffer
4341 *
4342 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4343 * from SME. It Register this information within PE.
4344 *
4345 * Return: None
4346 */
4347static void __lim_process_sme_register_mgmt_frame_req(tpAniSirGlobal mac_ctx,
4348 uint32_t *msg_buf)
4349{
Anurag Chouhanffb21542016-02-17 14:33:03 +05304350 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004351 tpSirRegisterMgmtFrame sme_req = (tpSirRegisterMgmtFrame)msg_buf;
4352 struct mgmt_frm_reg_info *lim_mgmt_regn = NULL;
4353 struct mgmt_frm_reg_info *next = NULL;
4354 bool match = false;
4355
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004356 pe_debug("registerFrame %d, frameType %d, matchLen %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004357 sme_req->registerFrame, sme_req->frameType,
4358 sme_req->matchLen);
4359 /* First check whether entry exists already */
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304360 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +05304361 qdf_list_peek_front(&mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
4362 (qdf_list_node_t **) &lim_mgmt_regn);
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304363 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004364
4365 while (lim_mgmt_regn != NULL) {
4366 if (lim_mgmt_regn->frameType != sme_req->frameType)
4367 goto skip_match;
4368 if (sme_req->matchLen) {
4369 if ((lim_mgmt_regn->matchLen == sme_req->matchLen) &&
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304370 (!qdf_mem_cmp(lim_mgmt_regn->matchData,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004371 sme_req->matchData,
4372 lim_mgmt_regn->matchLen))) {
4373 /* found match! */
4374 match = true;
4375 break;
4376 }
4377 } else {
4378 /* found match! */
4379 match = true;
4380 break;
4381 }
4382skip_match:
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304383 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +05304384 qdf_status = qdf_list_peek_next(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004385 &mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
Anurag Chouhanffb21542016-02-17 14:33:03 +05304386 (qdf_list_node_t *)lim_mgmt_regn,
4387 (qdf_list_node_t **)&next);
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304388 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004389 lim_mgmt_regn = next;
4390 next = NULL;
4391 }
4392 if (match) {
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304393 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Naveen Rawat1a3dac62016-10-25 12:44:57 -07004394 if (QDF_STATUS_SUCCESS ==
4395 qdf_list_remove_node(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004396 &mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
Naveen Rawat1a3dac62016-10-25 12:44:57 -07004397 (qdf_list_node_t *)lim_mgmt_regn))
4398 qdf_mem_free(lim_mgmt_regn);
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304399 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004400 }
4401
4402 if (sme_req->registerFrame) {
4403 lim_mgmt_regn =
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304404 qdf_mem_malloc(sizeof(struct mgmt_frm_reg_info) +
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004405 sme_req->matchLen);
4406 if (lim_mgmt_regn != NULL) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004407 lim_mgmt_regn->frameType = sme_req->frameType;
4408 lim_mgmt_regn->matchLen = sme_req->matchLen;
4409 lim_mgmt_regn->sessionId = sme_req->sessionId;
4410 if (sme_req->matchLen) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304411 qdf_mem_copy(lim_mgmt_regn->matchData,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004412 sme_req->matchData,
4413 sme_req->matchLen);
4414 }
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304415 qdf_mutex_acquire(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004416 &mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +05304417 qdf_list_insert_front(&mac_ctx->lim.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004418 gLimMgmtFrameRegistratinQueue,
4419 &lim_mgmt_regn->node);
Anurag Chouhana37b5b72016-02-21 14:53:42 +05304420 qdf_mutex_release(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004421 &mac_ctx->lim.lim_frame_register_lock);
4422 }
4423 }
4424 return;
4425}
4426
4427static void __lim_deregister_deferred_sme_req_after_noa_start(tpAniSirGlobal pMac)
4428{
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004429 pe_debug("Dereg msgType %d", pMac->lim.gDeferMsgTypeForNOA);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004430 pMac->lim.gDeferMsgTypeForNOA = 0;
4431 if (pMac->lim.gpDefdSmeMsgForNOA != NULL) {
4432 /* __lim_process_sme_scan_req consumed the buffer. We can free it. */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304433 qdf_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004434 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4435 }
4436}
4437
4438/**
4439 * lim_process_regd_defd_sme_req_after_noa_start()
4440 *
4441 * mac_ctx: Pointer to Global MAC structure
4442 *
4443 * This function is called to process deferred sme req message
4444 * after noa start.
4445 *
4446 * Return: None
4447 */
4448void lim_process_regd_defd_sme_req_after_noa_start(tpAniSirGlobal mac_ctx)
4449{
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004450 pe_debug("Process defd sme req %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004451 mac_ctx->lim.gDeferMsgTypeForNOA);
4452
4453 if ((mac_ctx->lim.gDeferMsgTypeForNOA == 0) ||
4454 (mac_ctx->lim.gpDefdSmeMsgForNOA == NULL)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004455 pe_warn("start rcvd from FW when no sme deferred msg pending. Do nothing");
4456 pe_warn("It may happen when NOA start ind and timeout happen at the same time");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004457 return;
4458 }
4459 switch (mac_ctx->lim.gDeferMsgTypeForNOA) {
4460 case eWNI_SME_SCAN_REQ:
4461 __lim_process_sme_scan_req(mac_ctx,
4462 mac_ctx->lim.gpDefdSmeMsgForNOA);
4463 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004464 case eWNI_SME_JOIN_REQ:
4465 __lim_process_sme_join_req(mac_ctx,
4466 mac_ctx->lim.gpDefdSmeMsgForNOA);
4467 break;
4468 default:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004469 pe_err("Unknown deferred msg type %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004470 mac_ctx->lim.gDeferMsgTypeForNOA);
4471 break;
4472 }
4473 __lim_deregister_deferred_sme_req_after_noa_start(mac_ctx);
4474}
4475
4476static void
4477__lim_process_sme_reset_ap_caps_change(tpAniSirGlobal pMac, uint32_t *pMsgBuf)
4478{
4479 tpSirResetAPCapsChange pResetCapsChange;
4480 tpPESession psessionEntry;
4481 uint8_t sessionId = 0;
4482 if (pMsgBuf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004483 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004484 return;
4485 }
4486
4487 pResetCapsChange = (tpSirResetAPCapsChange) pMsgBuf;
4488 psessionEntry =
Srinivas Girigowda40567b92015-09-24 15:17:25 -07004489 pe_find_session_by_bssid(pMac, pResetCapsChange->bssId.bytes,
4490 &sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004491 if (psessionEntry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004492 pe_err("Session does not exist for given BSSID");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004493 return;
4494 }
4495
4496 psessionEntry->limSentCapsChangeNtf = false;
4497 return;
4498}
4499
4500/**
Abhishek Singh7996eb72015-12-30 17:24:02 +05304501 * lim_register_mgmt_frame_ind_cb() - Save the Management frame
4502 * indication callback in PE.
4503 * @mac_ptr: Mac pointer
4504 * @msg_buf: Msg pointer containing the callback
4505 *
4506 * This function is used save the Management frame
4507 * indication callback in PE.
4508 *
4509 * Return: None
4510 */
4511static void lim_register_mgmt_frame_ind_cb(tpAniSirGlobal mac_ctx,
4512 uint32_t *msg_buf)
4513{
4514 struct sir_sme_mgmt_frame_cb_req *sme_req =
4515 (struct sir_sme_mgmt_frame_cb_req *)msg_buf;
4516
4517 if (NULL == msg_buf) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004518 pe_err("msg_buf is null");
Abhishek Singh7996eb72015-12-30 17:24:02 +05304519 return;
4520 }
4521 if (sme_req->callback)
4522 mac_ctx->mgmt_frame_ind_cb =
4523 (sir_mgmt_frame_ind_callback)sme_req->callback;
4524 else
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004525 pe_err("sme_req->callback is null");
Abhishek Singh7996eb72015-12-30 17:24:02 +05304526}
4527
4528/**
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +05304529 *__lim_process_send_disassoc_frame: function processes disassoc frame
4530 * @mac_ctx: pointer to mac context
4531 * @msg_buf: message buffer
4532 *
4533 * function processes disassoc request received from SME
4534 *
4535 * return: none
4536 */
4537static void __lim_process_send_disassoc_frame(tpAniSirGlobal mac_ctx,
4538 uint32_t *msg_buf)
4539{
4540 struct sme_send_disassoc_frm_req sme_send_disassoc_frame_req;
4541 tSirRetStatus status;
4542 tpPESession session_entry = NULL;
4543 uint8_t sme_session_id;
4544 uint16_t sme_trans_id;
4545
4546 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004547 pe_err("Buffer is Pointing to NULL");
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +05304548 return;
4549 }
4550
4551 lim_get_session_info(mac_ctx, (uint8_t *)msg_buf, &sme_session_id,
4552 &sme_trans_id);
4553
4554 status = lim_send_disassoc_frm_req_ser_des(mac_ctx,
4555 &sme_send_disassoc_frame_req,
4556 (uint8_t *)msg_buf);
4557
4558 if ((eSIR_FAILURE == status) ||
4559 (lim_is_group_addr(sme_send_disassoc_frame_req.peer_mac) &&
4560 !lim_is_addr_bc(sme_send_disassoc_frame_req.peer_mac))) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004561 pe_err("received invalid SME_DISASSOC_REQ message");
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +05304562 return;
4563 }
4564
4565 session_entry = pe_find_session_by_sme_session_id(
4566 mac_ctx, sme_session_id);
4567 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004568 pe_err("session does not exist for given bssId "MAC_ADDRESS_STR,
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +05304569 MAC_ADDR_ARRAY(sme_send_disassoc_frame_req.peer_mac));
4570 return;
4571 }
4572
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004573 pe_debug("msg_type->%d len->%d sess_id->%d trans_id->%d mac->"MAC_ADDRESS_STR" reason->%d wait_for_ack->%d",
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +05304574 sme_send_disassoc_frame_req.msg_type,
4575 sme_send_disassoc_frame_req.length,
4576 sme_send_disassoc_frame_req.session_id,
4577 sme_send_disassoc_frame_req.trans_id,
4578 MAC_ADDR_ARRAY(sme_send_disassoc_frame_req.peer_mac),
4579 sme_send_disassoc_frame_req.reason,
4580 sme_send_disassoc_frame_req.wait_for_ack);
4581
4582 lim_send_disassoc_mgmt_frame(mac_ctx,
4583 sme_send_disassoc_frame_req.reason,
4584 sme_send_disassoc_frame_req.peer_mac,
4585 session_entry, sme_send_disassoc_frame_req.wait_for_ack);
4586}
4587
4588/**
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004589 * lim_set_pdev_ht_ie() - sends the set HT IE req to FW
4590 * @mac_ctx: Pointer to Global MAC structure
4591 * @pdev_id: pdev id to set the IE.
4592 * @nss: Nss values to prepare the HT IE.
4593 *
4594 * Prepares the HT IE with self capabilities for different
4595 * Nss values and sends the set HT IE req to FW.
4596 *
4597 * Return: None
4598 */
4599static void lim_set_pdev_ht_ie(tpAniSirGlobal mac_ctx, uint8_t pdev_id,
4600 uint8_t nss)
4601{
4602 struct set_ie_param *ie_params;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07004603 struct scheduler_msg msg = {0};
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004604 tSirRetStatus rc = eSIR_SUCCESS;
Naveen Rawat08db88f2017-09-08 15:07:48 -07004605 const uint8_t *p_ie = NULL;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004606 tHtCaps *p_ht_cap;
4607 int i;
4608
Kiran Kumar Lokere78790202016-09-16 14:09:50 -07004609 for (i = 1; i <= nss; i++) {
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004610 ie_params = qdf_mem_malloc(sizeof(*ie_params));
4611 if (NULL == ie_params) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004612 pe_err("mem alloc failed");
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004613 return;
4614 }
4615 ie_params->nss = i;
4616 ie_params->pdev_id = pdev_id;
4617 ie_params->ie_type = DOT11_HT_IE;
4618 /* 2 for IE len and EID */
4619 ie_params->ie_len = 2 + sizeof(tHtCaps);
4620 ie_params->ie_ptr = qdf_mem_malloc(ie_params->ie_len);
4621 if (NULL == ie_params->ie_ptr) {
4622 qdf_mem_free(ie_params);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004623 pe_err("mem alloc failed");
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004624 return;
4625 }
4626 *ie_params->ie_ptr = SIR_MAC_HT_CAPABILITIES_EID;
4627 *(ie_params->ie_ptr + 1) = ie_params->ie_len - 2;
4628 lim_set_ht_caps(mac_ctx, NULL, ie_params->ie_ptr,
4629 ie_params->ie_len);
4630
4631 if (NSS_1x1_MODE == i) {
Naveen Rawat08db88f2017-09-08 15:07:48 -07004632 p_ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_HTCAPS,
4633 ie_params->ie_ptr, ie_params->ie_len);
Kiran Kumar Lokere53981332016-05-02 18:12:11 -07004634 if (NULL == p_ie) {
4635 qdf_mem_free(ie_params->ie_ptr);
4636 qdf_mem_free(ie_params);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004637 pe_err("failed to get IE ptr");
Kiran Kumar Lokere53981332016-05-02 18:12:11 -07004638 return;
4639 }
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004640 p_ht_cap = (tHtCaps *)&p_ie[2];
4641 p_ht_cap->supportedMCSSet[1] = 0;
4642 p_ht_cap->txSTBC = 0;
4643 }
4644
4645 msg.type = WMA_SET_PDEV_IE_REQ;
4646 msg.bodyptr = ie_params;
4647 msg.bodyval = 0;
4648
4649 rc = wma_post_ctrl_msg(mac_ctx, &msg);
4650 if (rc != eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004651 pe_err("wma_post_ctrl_msg() return failure");
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004652 qdf_mem_free(ie_params->ie_ptr);
4653 qdf_mem_free(ie_params);
4654 return;
4655 }
4656 }
4657}
4658
4659/**
4660 * lim_set_pdev_vht_ie() - sends the set VHT IE to req FW
4661 * @mac_ctx: Pointer to Global MAC structure
4662 * @pdev_id: pdev id to set the IE.
4663 * @nss: Nss values to prepare the VHT IE.
4664 *
4665 * Prepares the VHT IE with self capabilities for different
4666 * Nss values and sends the set VHT IE req to FW.
4667 *
4668 * Return: None
4669 */
4670static void lim_set_pdev_vht_ie(tpAniSirGlobal mac_ctx, uint8_t pdev_id,
4671 uint8_t nss)
4672{
4673 struct set_ie_param *ie_params;
Rajeev Kumar37d478b2017-04-17 16:59:28 -07004674 struct scheduler_msg msg = {0};
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004675 tSirRetStatus rc = eSIR_SUCCESS;
Naveen Rawat08db88f2017-09-08 15:07:48 -07004676 const uint8_t *p_ie = NULL;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004677 tSirMacVHTCapabilityInfo *vht_cap;
4678 int i;
4679 tSirVhtMcsInfo *vht_mcs;
4680
Kiran Kumar Lokere78790202016-09-16 14:09:50 -07004681 for (i = 1; i <= nss; i++) {
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004682 ie_params = qdf_mem_malloc(sizeof(*ie_params));
4683 if (NULL == ie_params) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004684 pe_err("mem alloc failed");
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004685 return;
4686 }
4687 ie_params->nss = i;
4688 ie_params->pdev_id = pdev_id;
4689 ie_params->ie_type = DOT11_VHT_IE;
4690 /* 2 for IE len and EID */
4691 ie_params->ie_len = 2 + sizeof(tSirMacVHTCapabilityInfo) +
4692 sizeof(tSirVhtMcsInfo);
4693 ie_params->ie_ptr = qdf_mem_malloc(ie_params->ie_len);
4694 if (NULL == ie_params->ie_ptr) {
4695 qdf_mem_free(ie_params);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004696 pe_err("mem alloc failed");
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004697 return;
4698 }
4699 *ie_params->ie_ptr = SIR_MAC_VHT_CAPABILITIES_EID;
4700 *(ie_params->ie_ptr + 1) = ie_params->ie_len - 2;
4701 lim_set_vht_caps(mac_ctx, NULL, ie_params->ie_ptr,
4702 ie_params->ie_len);
4703
4704 if (NSS_1x1_MODE == i) {
Naveen Rawat08db88f2017-09-08 15:07:48 -07004705 p_ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_VHTCAPS,
4706 ie_params->ie_ptr, ie_params->ie_len);
Kiran Kumar Lokere53981332016-05-02 18:12:11 -07004707 if (NULL == p_ie) {
4708 qdf_mem_free(ie_params->ie_ptr);
4709 qdf_mem_free(ie_params);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004710 pe_err("failed to get IE ptr");
Kiran Kumar Lokere53981332016-05-02 18:12:11 -07004711 return;
4712 }
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004713 vht_cap = (tSirMacVHTCapabilityInfo *)&p_ie[2];
4714 vht_cap->txSTBC = 0;
4715 vht_mcs =
4716 (tSirVhtMcsInfo *)&p_ie[2 +
4717 sizeof(tSirMacVHTCapabilityInfo)];
4718 vht_mcs->rxMcsMap |= DISABLE_NSS2_MCS;
4719 vht_mcs->rxHighest =
4720 VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_1_1;
4721 vht_mcs->txMcsMap |= DISABLE_NSS2_MCS;
4722 vht_mcs->txHighest =
4723 VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_1_1;
4724 }
4725 msg.type = WMA_SET_PDEV_IE_REQ;
4726 msg.bodyptr = ie_params;
4727 msg.bodyval = 0;
4728
4729 rc = wma_post_ctrl_msg(mac_ctx, &msg);
4730 if (rc != eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004731 pe_err("wma_post_ctrl_msg failure");
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004732 qdf_mem_free(ie_params->ie_ptr);
4733 qdf_mem_free(ie_params);
4734 return;
4735 }
4736 }
4737}
4738
4739/**
Naveen Rawata410c5a2016-09-19 14:22:33 -07004740 * lim_process_set_vdev_ies_per_band() - process the set vdev IE req
4741 * @mac_ctx: Pointer to Global MAC structure
4742 * @msg_buf: Pointer to the SME message buffer
4743 *
4744 * This function is called by limProcessMessageQueue(). This function sets the
4745 * VDEV IEs to the FW.
4746 *
4747 * Return: None
4748 */
4749static void lim_process_set_vdev_ies_per_band(tpAniSirGlobal mac_ctx,
4750 uint32_t *msg_buf)
4751{
4752 struct sir_set_vdev_ies_per_band *p_msg =
4753 (struct sir_set_vdev_ies_per_band *)msg_buf;
4754
4755 if (NULL == p_msg) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004756 pe_err("NULL p_msg");
Naveen Rawata410c5a2016-09-19 14:22:33 -07004757 return;
4758 }
4759
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004760 pe_debug("rcvd set vdev ie per band req vdev_id = %d",
Naveen Rawata410c5a2016-09-19 14:22:33 -07004761 p_msg->vdev_id);
4762 /* intentionally using NULL here so that self capabilty are sent */
4763 if (lim_send_ies_per_band(mac_ctx, NULL, p_msg->vdev_id) !=
4764 QDF_STATUS_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004765 pe_err("Unable to send HT/VHT Cap to FW");
Naveen Rawata410c5a2016-09-19 14:22:33 -07004766}
4767
4768/**
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004769 * lim_process_set_pdev_IEs() - process the set pdev IE req
4770 * @mac_ctx: Pointer to Global MAC structure
4771 * @msg_buf: Pointer to the SME message buffer
4772 *
4773 * This function is called by limProcessMessageQueue(). This
4774 * function sets the PDEV IEs to the FW.
4775 *
4776 * Return: None
4777 */
4778static void lim_process_set_pdev_IEs(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
4779{
4780 struct sir_set_ht_vht_cfg *ht_vht_cfg;
4781
4782 ht_vht_cfg = (struct sir_set_ht_vht_cfg *)msg_buf;
4783
4784 if (NULL == ht_vht_cfg) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004785 pe_err("NULL ht_vht_cfg");
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004786 return;
4787 }
4788
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004789 pe_debug("rcvd set pdev ht vht ie req with nss = %d",
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07004790 ht_vht_cfg->nss);
4791 lim_set_pdev_ht_ie(mac_ctx, ht_vht_cfg->pdev_id, ht_vht_cfg->nss);
4792
4793 if (IS_DOT11_MODE_VHT(ht_vht_cfg->dot11mode))
4794 lim_set_pdev_vht_ie(mac_ctx, ht_vht_cfg->pdev_id,
4795 ht_vht_cfg->nss);
4796}
4797
4798/**
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +05304799 * lim_process_sme_update_access_policy_vendor_ie: function updates vendor IE
4800 *
4801 * access policy
4802 * @mac_ctx: pointer to mac context
4803 * @msg: message buffer
4804 *
4805 * function processes vendor IE and access policy from SME and updates PE
4806 *
4807 * session entry
4808 *
4809 * return: none
4810*/
4811static void lim_process_sme_update_access_policy_vendor_ie(
4812 tpAniSirGlobal mac_ctx,
4813 uint32_t *msg)
4814{
4815 struct sme_update_access_policy_vendor_ie *update_vendor_ie;
4816 struct sPESession *pe_session_entry;
4817 uint8_t num_bytes;
4818
4819 if (!msg) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004820 pe_err("Buffer is Pointing to NULL");
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +05304821 return;
4822 }
4823 update_vendor_ie = (struct sme_update_access_policy_vendor_ie *) msg;
4824 pe_session_entry = pe_find_session_by_sme_session_id(mac_ctx,
4825 update_vendor_ie->sme_session_id);
4826
4827 if (!pe_session_entry) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004828 pe_err("Session does not exist for given sme session id(%hu)",
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +05304829 update_vendor_ie->sme_session_id);
4830 return;
4831 }
4832 if (pe_session_entry->access_policy_vendor_ie)
4833 qdf_mem_free(pe_session_entry->access_policy_vendor_ie);
4834
4835 num_bytes = update_vendor_ie->ie[1] + 2;
4836 pe_session_entry->access_policy_vendor_ie = qdf_mem_malloc(num_bytes);
4837
4838 if (!pe_session_entry->access_policy_vendor_ie) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004839 pe_err("Failed to allocate memory for vendor ie");
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +05304840 return;
4841 }
4842 qdf_mem_copy(pe_session_entry->access_policy_vendor_ie,
4843 &update_vendor_ie->ie[0], num_bytes);
4844
4845 pe_session_entry->access_policy = update_vendor_ie->access_policy;
4846}
4847
4848/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004849 * lim_process_sme_req_messages()
4850 *
4851 ***FUNCTION:
4852 * This function is called by limProcessMessageQueue(). This
4853 * function processes SME request messages from HDD or upper layer
4854 * application.
4855 *
4856 ***LOGIC:
4857 *
4858 ***ASSUMPTIONS:
4859 *
4860 ***NOTE:
4861 *
4862 * @param pMac Pointer to Global MAC structure
4863 * @param msgType Indicates the SME message type
4864 * @param *pMsgBuf A pointer to the SME message buffer
4865 * @return Boolean - true - if pMsgBuf is consumed and can be freed.
4866 * false - if pMsgBuf is not to be freed.
4867 */
4868
Rajeev Kumarfeb96382017-01-22 19:42:09 -08004869bool lim_process_sme_req_messages(tpAniSirGlobal pMac,
4870 struct scheduler_msg *pMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004871{
4872 bool bufConsumed = true; /* Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed. */
4873 uint32_t *pMsgBuf = pMsg->bodyptr;
4874 tpSirSmeScanReq pScanReq;
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07004875
4876 pe_debug("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004877 lim_msg_str(pMsg->type), pMsg->type,
4878 lim_sme_state_str(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
4879 lim_mlm_state_str(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004880
4881 pScanReq = (tpSirSmeScanReq) pMsgBuf;
4882 /* If no insert NOA required then execute the code below */
4883
4884 switch (pMsg->type) {
4885 case eWNI_SME_SYS_READY_IND:
4886 bufConsumed = __lim_process_sme_sys_ready_ind(pMac, pMsgBuf);
4887 break;
4888
4889 case eWNI_SME_START_BSS_REQ:
4890 bufConsumed = __lim_process_sme_start_bss_req(pMac, pMsg);
4891 break;
4892
4893 case eWNI_SME_SCAN_REQ:
4894 __lim_process_sme_scan_req(pMac, pMsgBuf);
4895 break;
4896
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004897 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
4898 __lim_process_clear_dfs_channel_list(pMac, pMsg);
4899 break;
4900 case eWNI_SME_JOIN_REQ:
4901 __lim_process_sme_join_req(pMac, pMsgBuf);
4902 break;
4903
4904 case eWNI_SME_REASSOC_REQ:
4905 __lim_process_sme_reassoc_req(pMac, pMsgBuf);
4906 break;
4907
4908 case eWNI_SME_DISASSOC_REQ:
4909 __lim_process_sme_disassoc_req(pMac, pMsgBuf);
4910 break;
4911
4912 case eWNI_SME_DISASSOC_CNF:
4913 case eWNI_SME_DEAUTH_CNF:
4914 __lim_process_sme_disassoc_cnf(pMac, pMsgBuf);
4915 break;
4916
4917 case eWNI_SME_DEAUTH_REQ:
4918 __lim_process_sme_deauth_req(pMac, pMsgBuf);
4919 break;
4920
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +05304921 case eWNI_SME_SEND_DISASSOC_FRAME:
4922 __lim_process_send_disassoc_frame(pMac, pMsgBuf);
4923 break;
4924
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004925 case eWNI_SME_SETCONTEXT_REQ:
4926 __lim_process_sme_set_context_req(pMac, pMsgBuf);
4927 break;
4928
4929 case eWNI_SME_STOP_BSS_REQ:
4930 bufConsumed = __lim_process_sme_stop_bss_req(pMac, pMsg);
4931 break;
4932
4933 case eWNI_SME_ASSOC_CNF:
4934 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07004935 pe_debug("Received ASSOC_CNF message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004936 __lim_process_sme_assoc_cnf_new(pMac, pMsg->type,
4937 pMsgBuf);
4938 break;
4939
4940 case eWNI_SME_ADDTS_REQ:
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07004941 pe_debug("Received ADDTS_REQ message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004942 __lim_process_sme_addts_req(pMac, pMsgBuf);
4943 break;
4944
4945 case eWNI_SME_DELTS_REQ:
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07004946 pe_debug("Received DELTS_REQ message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004947 __lim_process_sme_delts_req(pMac, pMsgBuf);
4948 break;
4949
4950 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07004951 pe_debug("Received SIR_LIM_ADDTS_RSP_TIMEOUT message");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004952 lim_process_sme_addts_rsp_timeout(pMac, pMsg->bodyval);
4953 break;
4954
4955 case eWNI_SME_GET_STATISTICS_REQ:
4956 __lim_process_sme_get_statistics_request(pMac, pMsgBuf);
4957 /* HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false. */
4958 bufConsumed = false;
4959 break;
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08004960#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004961 case eWNI_SME_GET_TSM_STATS_REQ:
4962 __lim_process_sme_get_tsm_stats_request(pMac, pMsgBuf);
4963 bufConsumed = false;
4964 break;
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08004965#endif /* FEATURE_WLAN_ESE */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004966 case eWNI_SME_GET_ASSOC_STAS_REQ:
4967 lim_process_sme_get_assoc_sta_info(pMac, pMsgBuf);
4968 break;
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05304969 case eWNI_SME_SESSION_UPDATE_PARAM:
4970 __lim_process_sme_session_update(pMac, pMsgBuf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004971 break;
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05304972 case eWNI_SME_ROAM_SCAN_OFFLOAD_REQ:
4973 __lim_process_roam_scan_offload_req(pMac, pMsgBuf);
4974 bufConsumed = false;
4975 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004976 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
4977 lim_process_sme_get_wpspbc_sessions(pMac, pMsgBuf);
4978 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004979 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
4980 /* Update the beaconInterval */
4981 __lim_process_sme_change_bi(pMac, pMsgBuf);
4982 break;
4983
4984#ifdef QCA_HT_2040_COEX
4985 case eWNI_SME_SET_HT_2040_MODE:
4986 __lim_process_sme_set_ht2040_mode(pMac, pMsgBuf);
4987 break;
4988#endif
4989
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004990 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4991 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4992 __lim_process_report_message(pMac, pMsg);
4993 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004994
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004995 case eWNI_SME_FT_PRE_AUTH_REQ:
4996 bufConsumed = (bool) lim_process_ft_pre_auth_req(pMac, pMsg);
4997 break;
4998 case eWNI_SME_FT_UPDATE_KEY:
4999 lim_process_ft_update_key(pMac, pMsgBuf);
5000 break;
5001
5002 case eWNI_SME_FT_AGGR_QOS_REQ:
5003 lim_process_ft_aggr_qos_req(pMac, pMsgBuf);
5004 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005005
5006 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5007 __lim_process_sme_register_mgmt_frame_req(pMac, pMsgBuf);
5008 break;
5009#ifdef FEATURE_WLAN_TDLS
5010 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5011 lim_process_sme_tdls_mgmt_send_req(pMac, pMsgBuf);
5012 break;
5013 case eWNI_SME_TDLS_ADD_STA_REQ:
5014 lim_process_sme_tdls_add_sta_req(pMac, pMsgBuf);
5015 break;
5016 case eWNI_SME_TDLS_DEL_STA_REQ:
5017 lim_process_sme_tdls_del_sta_req(pMac, pMsgBuf);
5018 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005019#endif
5020 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5021 __lim_process_sme_reset_ap_caps_change(pMac, pMsgBuf);
5022 break;
5023
5024 case eWNI_SME_CHANNEL_CHANGE_REQ:
5025 lim_process_sme_channel_change_request(pMac, pMsgBuf);
5026 break;
5027
5028 case eWNI_SME_START_BEACON_REQ:
5029 lim_process_sme_start_beacon_req(pMac, pMsgBuf);
5030 break;
5031
5032 case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ:
5033 lim_process_sme_dfs_csa_ie_request(pMac, pMsgBuf);
5034 break;
5035
5036 case eWNI_SME_UPDATE_ADDITIONAL_IES:
5037 lim_process_update_add_ies(pMac, pMsgBuf);
5038 break;
5039
5040 case eWNI_SME_MODIFY_ADDITIONAL_IES:
5041 lim_process_modify_add_ies(pMac, pMsgBuf);
5042 break;
5043 case eWNI_SME_SET_HW_MODE_REQ:
5044 lim_process_set_hw_mode(pMac, pMsgBuf);
5045 break;
5046 case eWNI_SME_NSS_UPDATE_REQ:
5047 lim_process_nss_update_request(pMac, pMsgBuf);
5048 break;
5049 case eWNI_SME_SET_DUAL_MAC_CFG_REQ:
5050 lim_process_set_dual_mac_cfg_req(pMac, pMsgBuf);
5051 break;
5052 case eWNI_SME_SET_IE_REQ:
5053 lim_process_set_ie_req(pMac, pMsgBuf);
5054 break;
Abhishek Singh7996eb72015-12-30 17:24:02 +05305055 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
5056 lim_register_mgmt_frame_ind_cb(pMac, pMsgBuf);
5057 break;
Abhishek Singh518323d2015-10-19 17:42:01 +05305058 case eWNI_SME_EXT_CHANGE_CHANNEL:
5059 lim_process_ext_change_channel(pMac, pMsgBuf);
5060 break;
Archana Ramachandrana20ef812015-11-13 16:12:13 -08005061 case eWNI_SME_SET_ANTENNA_MODE_REQ:
5062 lim_process_set_antenna_mode_req(pMac, pMsgBuf);
5063 break;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07005064 case eWNI_SME_PDEV_SET_HT_VHT_IE:
5065 lim_process_set_pdev_IEs(pMac, pMsgBuf);
Naveen Rawata410c5a2016-09-19 14:22:33 -07005066 break;
5067 case eWNI_SME_SET_VDEV_IES_PER_BAND:
5068 lim_process_set_vdev_ies_per_band(pMac, pMsgBuf);
5069 break;
Naveen Rawatf28315c2016-06-29 18:06:02 -07005070 case eWNI_SME_NDP_END_REQ:
Deepak Dhamdhere0f076bd2016-06-02 11:29:21 -07005071 case eWNI_SME_NDP_INITIATOR_REQ:
Abhishek Singh4fef7472016-06-06 11:36:03 -07005072 case eWNI_SME_NDP_RESPONDER_REQ:
Deepak Dhamdhere0f076bd2016-06-02 11:29:21 -07005073 lim_handle_ndp_request_message(pMac, pMsg);
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07005074 break;
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +05305075 case eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE:
5076 lim_process_sme_update_access_policy_vendor_ie(pMac, pMsgBuf);
5077 break;
Naveen Rawat8029a402017-06-01 10:54:19 -07005078 case eWNI_SME_UPDATE_CONFIG:
5079 lim_process_sme_update_config(pMac,
5080 (struct update_config *)pMsgBuf);
5081 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005082 default:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305083 qdf_mem_free((void *)pMsg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005084 pMsg->bodyptr = NULL;
5085 break;
5086 } /* switch (msgType) */
5087
5088 return bufConsumed;
5089} /*** end lim_process_sme_req_messages() ***/
5090
5091/**
5092 * lim_process_sme_start_beacon_req()
5093 *
5094 ***FUNCTION:
5095 * This function is called by limProcessMessageQueue(). This
5096 * function processes SME request messages from HDD or upper layer
5097 * application.
5098 *
5099 ***LOGIC:
5100 *
5101 ***ASSUMPTIONS:
5102 *
5103 ***NOTE:
5104 *
5105 * @param pMac Pointer to Global MAC structure
5106 * @param msgType Indicates the SME message type
5107 * @param *pMsgBuf A pointer to the SME message buffer
5108 * @return Boolean - true - if pMsgBuf is consumed and can be freed.
5109 * false - if pMsgBuf is not to be freed.
5110 */
5111static void lim_process_sme_start_beacon_req(tpAniSirGlobal pMac, uint32_t *pMsg)
5112{
5113 tpSirStartBeaconIndication pBeaconStartInd;
5114 tpPESession psessionEntry;
5115 uint8_t sessionId; /* PE sessionID */
5116
5117 if (pMsg == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005118 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005119 return;
5120 }
5121
5122 pBeaconStartInd = (tpSirStartBeaconIndication) pMsg;
5123 psessionEntry = pe_find_session_by_bssid(pMac,
5124 pBeaconStartInd->bssid,
5125 &sessionId);
5126 if (psessionEntry == NULL) {
5127 lim_print_mac_addr(pMac, pBeaconStartInd->bssid, LOGE);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005128 pe_err("Session does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005129 return;
5130 }
5131
5132 if (pBeaconStartInd->beaconStartStatus == true) {
5133 /*
5134 * Currently this Indication comes from SAP
5135 * to start Beacon Tx on a DFS channel
5136 * since beaconing has to be done on DFS
5137 * channel only after CAC WAIT is completed.
5138 * On a DFS Channel LIM does not start beacon
5139 * Tx right after the WMA_ADD_BSS_RSP.
5140 */
5141 lim_apply_configuration(pMac, psessionEntry);
Abhishek Singh4294f802017-08-10 16:37:07 +05305142 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005143 FL("Start Beacon with ssid %s Ch %d"),
5144 psessionEntry->ssId.ssId,
5145 psessionEntry->currentOperChannel);
5146 lim_send_beacon_ind(pMac, psessionEntry);
5147 } else {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005148 pe_err("Invalid Beacon Start Indication");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005149 return;
5150 }
5151}
5152
5153/**
5154 * lim_process_sme_channel_change_request() - process sme ch change req
5155 *
5156 * @mac_ctx: Pointer to Global MAC structure
5157 * @msg_buf: pointer to the SME message buffer
5158 *
5159 * This function is called to process SME_CHANNEL_CHANGE_REQ message
5160 *
5161 * Return: None
5162 */
5163static void lim_process_sme_channel_change_request(tpAniSirGlobal mac_ctx,
5164 uint32_t *msg_buf)
5165{
5166 tpSirChanChangeRequest ch_change_req;
5167 tpPESession session_entry;
5168 uint8_t session_id; /* PE session_id */
Amar Singhala297bfa2015-10-15 15:07:29 -07005169 int8_t max_tx_pwr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005170 uint32_t val = 0;
5171
5172 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005173 pe_err("msg_buf is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005174 return;
5175 }
5176 ch_change_req = (tpSirChanChangeRequest)msg_buf;
5177
5178 max_tx_pwr = cfg_get_regulatory_max_transmit_power(mac_ctx,
5179 ch_change_req->targetChannel);
5180
5181 if ((ch_change_req->messageType != eWNI_SME_CHANNEL_CHANGE_REQ) ||
5182 (max_tx_pwr == WMA_MAX_TXPOWER_INVALID)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005183 pe_err("Invalid Request/max_tx_pwr");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005184 return;
5185 }
5186
5187 session_entry = pe_find_session_by_bssid(mac_ctx,
5188 ch_change_req->bssid, &session_id);
5189 if (session_entry == NULL) {
5190 lim_print_mac_addr(mac_ctx, ch_change_req->bssid, LOGE);
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005191 pe_err("Session does not exist for given bssId");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005192 return;
5193 }
5194
5195 if (session_entry->currentOperChannel ==
5196 ch_change_req->targetChannel) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005197 pe_err("target CH is same as current CH");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005198 return;
5199 }
5200
5201 if (LIM_IS_AP_ROLE(session_entry))
5202 session_entry->channelChangeReasonCode =
5203 LIM_SWITCH_CHANNEL_SAP_DFS;
5204 else
5205 session_entry->channelChangeReasonCode =
5206 LIM_SWITCH_CHANNEL_OPERATION;
5207
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005208 pe_debug("switch old chnl %d to new chnl %d, ch_bw %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005209 session_entry->currentOperChannel,
5210 ch_change_req->targetChannel,
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005211 ch_change_req->ch_width);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005212
5213 /* Store the New Channel Params in session_entry */
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005214 session_entry->ch_width = ch_change_req->ch_width;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005215 session_entry->ch_center_freq_seg0 =
5216 ch_change_req->center_freq_seg_0;
5217 session_entry->ch_center_freq_seg1 =
5218 ch_change_req->center_freq_seg_1;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005219 session_entry->htSecondaryChannelOffset = ch_change_req->sec_ch_offset;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005220 session_entry->htSupportedChannelWidthSet =
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005221 (ch_change_req->ch_width ? 1 : 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005222 session_entry->htRecommendedTxWidthSet =
5223 session_entry->htSupportedChannelWidthSet;
5224 session_entry->currentOperChannel =
5225 ch_change_req->targetChannel;
5226 session_entry->limRFBand =
5227 lim_get_rf_band(session_entry->currentOperChannel);
5228 /* Initialize 11h Enable Flag */
gaolez76d2a162017-03-21 19:23:58 +08005229 if (CHAN_HOP_ALL_BANDS_ENABLE ||
5230 SIR_BAND_5_GHZ == session_entry->limRFBand) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005231 if (wlan_cfg_get_int(mac_ctx, WNI_CFG_11H_ENABLED, &val) !=
5232 eSIR_SUCCESS)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005233 pe_err("Fail to get WNI_CFG_11H_ENABLED");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005234 }
5235
5236 session_entry->lim11hEnable = val;
5237 session_entry->dot11mode = ch_change_req->dot11mode;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305238 qdf_mem_copy(&session_entry->rateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005239 &ch_change_req->operational_rateset,
5240 sizeof(session_entry->rateSet));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305241 qdf_mem_copy(&session_entry->extRateSet,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005242 &ch_change_req->extended_rateset,
5243 sizeof(session_entry->extRateSet));
5244 lim_set_channel(mac_ctx, ch_change_req->targetChannel,
5245 session_entry->ch_center_freq_seg0,
5246 session_entry->ch_center_freq_seg1,
5247 session_entry->ch_width,
Arif Hussain671a1902017-03-17 09:08:32 -07005248 max_tx_pwr, session_entry->peSessionId,
5249 ch_change_req->cac_duration_ms,
5250 ch_change_req->dfs_regdomain);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005251}
5252
5253/******************************************************************************
5254* lim_start_bss_update_add_ie_buffer()
5255*
5256***FUNCTION:
5257* This function checks the src buffer and its length and then malloc for
5258* dst buffer update the same
5259*
5260***LOGIC:
5261*
5262***ASSUMPTIONS:
5263*
5264***NOTE:
5265*
5266* @param pMac Pointer to Global MAC structure
5267* @param **pDstData_buff A pointer to pointer of uint8_t dst buffer
5268* @param *pDstDataLen A pointer to pointer of uint16_t dst buffer length
5269* @param *pSrcData_buff A pointer of uint8_t src buffer
5270* @param srcDataLen src buffer length
5271******************************************************************************/
5272
5273static void
5274lim_start_bss_update_add_ie_buffer(tpAniSirGlobal pMac,
5275 uint8_t **pDstData_buff,
5276 uint16_t *pDstDataLen,
5277 uint8_t *pSrcData_buff, uint16_t srcDataLen)
5278{
5279
5280 if (srcDataLen > 0 && pSrcData_buff != NULL) {
5281 *pDstDataLen = srcDataLen;
5282
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305283 *pDstData_buff = qdf_mem_malloc(*pDstDataLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005284
5285 if (NULL == *pDstData_buff) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005286 pe_err("AllocateMemory failed for pDstData_buff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005287 return;
5288 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305289 qdf_mem_copy(*pDstData_buff, pSrcData_buff, *pDstDataLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005290 } else {
5291 *pDstData_buff = NULL;
5292 *pDstDataLen = 0;
5293 }
5294}
5295
5296/******************************************************************************
5297* lim_update_add_ie_buffer()
5298*
5299***FUNCTION:
5300* This function checks the src buffer and length if src buffer length more
5301* than dst buffer length then free the dst buffer and malloc for the new src
5302* length, and update the dst buffer and length. But if dst buffer is bigger
5303* than src buffer length then it just update the dst buffer and length
5304*
5305***LOGIC:
5306*
5307***ASSUMPTIONS:
5308*
5309***NOTE:
5310*
5311* @param pMac Pointer to Global MAC structure
5312* @param **pDstData_buff A pointer to pointer of uint8_t dst buffer
5313* @param *pDstDataLen A pointer to pointer of uint16_t dst buffer length
5314* @param *pSrcData_buff A pointer of uint8_t src buffer
5315* @param srcDataLen src buffer length
5316******************************************************************************/
5317
5318static void
5319lim_update_add_ie_buffer(tpAniSirGlobal pMac,
5320 uint8_t **pDstData_buff,
5321 uint16_t *pDstDataLen,
5322 uint8_t *pSrcData_buff, uint16_t srcDataLen)
5323{
5324
5325 if (NULL == pSrcData_buff) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005326 pe_err("src buffer is null");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005327 return;
5328 }
5329
5330 if (srcDataLen > *pDstDataLen) {
5331 *pDstDataLen = srcDataLen;
5332 /* free old buffer */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305333 qdf_mem_free(*pDstData_buff);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005334 /* allocate a new */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305335 *pDstData_buff = qdf_mem_malloc(*pDstDataLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005336
5337 if (NULL == *pDstData_buff) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005338 pe_err("Memory allocation failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005339 *pDstDataLen = 0;
5340 return;
5341 }
5342 }
5343
5344 /* copy the content of buffer into dst buffer
5345 */
5346 *pDstDataLen = srcDataLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305347 qdf_mem_copy(*pDstData_buff, pSrcData_buff, *pDstDataLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005348
5349}
5350
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08005351/**
5352 * lim_update_ibss_prop_add_ies() - update IBSS prop IE
5353 * @pMac : Pointer to Global MAC structure
5354 * @pDstData_buff : A pointer to pointer of dst buffer
5355 * @pDstDataLen : A pointer to pointer of dst buffer length
5356 * @pModifyIE : A pointer to tSirModifyIE
5357 *
5358 * This function replaces previous ibss prop_ie with new ibss prop_ie.
5359 *
5360 * Return:
5361 * True or false depending upon whether IE is updated or not
5362 */
5363static bool
5364lim_update_ibss_prop_add_ies(tpAniSirGlobal pMac, uint8_t **pDstData_buff,
5365 uint16_t *pDstDataLen, tSirModifyIE *pModifyIE)
5366{
Hong Shi1553d692016-09-28 12:16:19 +08005367 int32_t oui_length;
5368 uint8_t *ibss_ie = NULL;
5369 uint8_t *vendor_ie;
5370#define MAC_VENDOR_OUI "\x00\x16\x32"
5371#define MAC_VENDOR_SIZE 3
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08005372
5373 ibss_ie = pModifyIE->pIEBuffer;
5374 oui_length = pModifyIE->oui_length;
5375
5376 if ((0 == oui_length) || (NULL == ibss_ie)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005377 pe_err("Invalid set IBSS vendor IE command length %d",
5378 oui_length);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08005379 return false;
5380 }
5381
Hong Shi1553d692016-09-28 12:16:19 +08005382 /*
5383 * Why replace only beacon OUI data here:
5384 * 1. other ie (such as wpa) shall not be overwritten here.
5385 * 2. per spec, beacon oui ie might be set twice and original one
5386 * shall be updated.
5387 */
Naveen Rawat08db88f2017-09-08 15:07:48 -07005388 vendor_ie = (uint8_t *)wlan_get_vendor_ie_ptr_from_oui(MAC_VENDOR_OUI,
Hong Shi1553d692016-09-28 12:16:19 +08005389 MAC_VENDOR_SIZE, *pDstData_buff, *pDstDataLen);
5390 if (vendor_ie) {
5391 QDF_ASSERT((vendor_ie[1] + 2) == pModifyIE->ieBufferlength);
5392 qdf_mem_copy(vendor_ie, pModifyIE->pIEBuffer,
5393 pModifyIE->ieBufferlength);
5394 } else {
Naveen Rawat668dee32017-09-29 14:39:40 -07005395 uint16_t new_length;
5396 uint8_t *new_ptr;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08005397
Naveen Rawat668dee32017-09-29 14:39:40 -07005398 /*
5399 * check for uint16 overflow before using sum of two numbers as
5400 * length of size to malloc
5401 */
5402 if (USHRT_MAX - pModifyIE->ieBufferlength < *pDstDataLen) {
5403 pe_err("U16 overflow due to %d + %d",
5404 pModifyIE->ieBufferlength, *pDstDataLen);
5405 return false;
5406 }
5407
5408 new_length = pModifyIE->ieBufferlength + *pDstDataLen;
5409 new_ptr = qdf_mem_malloc(new_length);
Hong Shi1553d692016-09-28 12:16:19 +08005410 if (NULL == new_ptr) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005411 pe_err("Memory allocation failed");
Hong Shi1553d692016-09-28 12:16:19 +08005412 return false;
5413 }
5414 qdf_mem_copy(new_ptr, *pDstData_buff, *pDstDataLen);
5415 qdf_mem_copy(&new_ptr[*pDstDataLen], pModifyIE->pIEBuffer,
5416 pModifyIE->ieBufferlength);
5417 qdf_mem_free(*pDstData_buff);
5418 *pDstDataLen = new_length;
5419 *pDstData_buff = new_ptr;
5420 }
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08005421 return true;
5422}
5423
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005424/*
5425* lim_process_modify_add_ies() - process modify additional IE req.
5426*
5427* @mac_ctx: Pointer to Global MAC structure
5428* @msg_buf: pointer to the SME message buffer
5429*
5430* This function update the PE buffers for additional IEs.
5431*
5432* Return: None
5433*/
5434static void lim_process_modify_add_ies(tpAniSirGlobal mac_ctx,
5435 uint32_t *msg_buf)
5436{
5437 tpSirModifyIEsInd modify_add_ies;
5438 tpPESession session_entry;
5439 uint8_t session_id;
5440 bool ret = false;
5441 tSirAddIeParams *add_ie_params;
5442
5443 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005444 pe_err("msg_buf is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005445 return;
5446 }
5447
5448 modify_add_ies = (tpSirModifyIEsInd)msg_buf;
5449 /* Incoming message has smeSession, use BSSID to find PE session */
5450 session_entry = pe_find_session_by_bssid(mac_ctx,
Srinivas Girigowda34b634c2015-11-18 22:22:01 -08005451 modify_add_ies->modifyIE.bssid.bytes, &session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005452
5453 if (NULL == session_entry) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005454 pe_err("Session not found for given bssid"
5455 MAC_ADDRESS_STR,
Srinivas Girigowda34b634c2015-11-18 22:22:01 -08005456 MAC_ADDR_ARRAY(modify_add_ies->modifyIE.bssid.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005457 goto end;
5458 }
5459 if ((0 == modify_add_ies->modifyIE.ieBufferlength) ||
5460 (0 == modify_add_ies->modifyIE.ieIDLen) ||
5461 (NULL == modify_add_ies->modifyIE.pIEBuffer)) {
Jeff Johnson11bd4f32017-09-18 08:15:17 -07005462 pe_err("Invalid request pIEBuffer %pK ieBufferlength %d ieIDLen %d ieID %d. update Type %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005463 modify_add_ies->modifyIE.pIEBuffer,
5464 modify_add_ies->modifyIE.ieBufferlength,
5465 modify_add_ies->modifyIE.ieID,
5466 modify_add_ies->modifyIE.ieIDLen,
5467 modify_add_ies->updateType);
5468 goto end;
5469 }
5470 add_ie_params = &session_entry->addIeParams;
5471 switch (modify_add_ies->updateType) {
5472 case eUPDATE_IE_PROBE_RESP:
5473 /* Probe resp */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08005474 if (LIM_IS_IBSS_ROLE(session_entry)) {
5475 lim_update_ibss_prop_add_ies(mac_ctx,
5476 &add_ie_params->probeRespData_buff,
5477 &add_ie_params->probeRespDataLen,
5478 &modify_add_ies->modifyIE);
5479 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005480 break;
5481 case eUPDATE_IE_ASSOC_RESP:
5482 /* assoc resp IE */
5483 if (add_ie_params->assocRespDataLen == 0) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05305484 QDF_TRACE(QDF_MODULE_ID_PE,
5485 QDF_TRACE_LEVEL_ERROR, FL(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005486 "assoc resp add ie not present %d"),
5487 add_ie_params->assocRespDataLen);
5488 }
5489 /* search through the buffer and modify the IE */
5490 break;
5491 case eUPDATE_IE_PROBE_BCN:
5492 /*probe beacon IE */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08005493 if (LIM_IS_IBSS_ROLE(session_entry)) {
5494 ret = lim_update_ibss_prop_add_ies(mac_ctx,
5495 &add_ie_params->probeRespBCNData_buff,
5496 &add_ie_params->probeRespBCNDataLen,
5497 &modify_add_ies->modifyIE);
5498 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005499 if (ret == true && modify_add_ies->modifyIE.notify) {
5500 lim_handle_param_update(mac_ctx,
5501 modify_add_ies->updateType);
5502 }
5503 break;
5504 default:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005505 pe_err("unhandled buffer type %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005506 modify_add_ies->updateType);
5507 break;
5508 }
5509end:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305510 qdf_mem_free(modify_add_ies->modifyIE.pIEBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005511 modify_add_ies->modifyIE.pIEBuffer = NULL;
5512}
5513
5514/*
5515* lim_process_update_add_ies() - process additional IE update req
5516*
5517* @mac_ctx: Pointer to Global MAC structure
5518* @msg_buf: pointer to the SME message buffer
5519*
5520* This function update the PE buffers for additional IEs.
5521*
5522* Return: None
5523*/
5524static void lim_process_update_add_ies(tpAniSirGlobal mac_ctx,
5525 uint32_t *msg_buf)
5526{
5527 tpSirUpdateIEsInd update_add_ies = (tpSirUpdateIEsInd)msg_buf;
5528 uint8_t session_id;
5529 tpPESession session_entry;
5530 tSirAddIeParams *addn_ie;
5531 uint16_t new_length = 0;
5532 uint8_t *new_ptr = NULL;
5533 tSirUpdateIE *update_ie;
5534
5535 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005536 pe_err("msg_buf is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005537 return;
5538 }
5539 update_ie = &update_add_ies->updateIE;
5540 /* incoming message has smeSession, use BSSID to find PE session */
5541 session_entry = pe_find_session_by_bssid(mac_ctx,
Srinivas Girigowda8b983962015-11-18 22:14:34 -08005542 update_ie->bssid.bytes, &session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005543
5544 if (NULL == session_entry) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005545 pe_err("Session not found for given bssid"
5546 MAC_ADDRESS_STR,
Srinivas Girigowda8b983962015-11-18 22:14:34 -08005547 MAC_ADDR_ARRAY(update_ie->bssid.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005548 goto end;
5549 }
5550 addn_ie = &session_entry->addIeParams;
5551 /* if len is 0, upper layer requested freeing of buffer */
5552 if (0 == update_ie->ieBufferlength) {
5553 switch (update_add_ies->updateType) {
5554 case eUPDATE_IE_PROBE_RESP:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305555 qdf_mem_free(addn_ie->probeRespData_buff);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005556 addn_ie->probeRespData_buff = NULL;
5557 addn_ie->probeRespDataLen = 0;
5558 break;
5559 case eUPDATE_IE_ASSOC_RESP:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305560 qdf_mem_free(addn_ie->assocRespData_buff);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005561 addn_ie->assocRespData_buff = NULL;
5562 addn_ie->assocRespDataLen = 0;
5563 break;
5564 case eUPDATE_IE_PROBE_BCN:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305565 qdf_mem_free(addn_ie->probeRespBCNData_buff);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005566 addn_ie->probeRespBCNData_buff = NULL;
5567 addn_ie->probeRespBCNDataLen = 0;
5568
5569 if (update_ie->notify)
5570 lim_handle_param_update(mac_ctx,
5571 update_add_ies->updateType);
5572 break;
5573 default:
5574 break;
5575 }
5576 return;
5577 }
5578 switch (update_add_ies->updateType) {
5579 case eUPDATE_IE_PROBE_RESP:
5580 if (update_ie->append) {
5581 /*
5582 * In case of append, allocate new memory
Varun Reddy Yeturu84637fc2017-10-02 11:52:37 -07005583 * with combined length.
5584 * Multiple back to back append commands
5585 * can lead to a huge length.So, check
5586 * for the validity of the length.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005587 */
Varun Reddy Yeturu84637fc2017-10-02 11:52:37 -07005588 if (addn_ie->probeRespDataLen >
5589 (USHRT_MAX - update_ie->ieBufferlength)) {
5590 pe_err("IE Length overflow, curr:%d, new:%d",
5591 addn_ie->probeRespDataLen,
5592 update_ie->ieBufferlength);
5593 goto end;
5594 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005595 new_length = update_ie->ieBufferlength +
5596 addn_ie->probeRespDataLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305597 new_ptr = qdf_mem_malloc(new_length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005598 if (NULL == new_ptr) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005599 pe_err("Memory allocation failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005600 goto end;
5601 }
5602 /* append buffer to end of local buffers */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305603 qdf_mem_copy(new_ptr, addn_ie->probeRespData_buff,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005604 addn_ie->probeRespDataLen);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305605 qdf_mem_copy(&new_ptr[addn_ie->probeRespDataLen],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005606 update_ie->pAdditionIEBuffer,
5607 update_ie->ieBufferlength);
5608 /* free old memory */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305609 qdf_mem_free(addn_ie->probeRespData_buff);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005610 /* adjust length accordingly */
5611 addn_ie->probeRespDataLen = new_length;
5612 /* save refernece of local buffer in PE session */
5613 addn_ie->probeRespData_buff = new_ptr;
5614 goto end;
5615 }
5616 lim_update_add_ie_buffer(mac_ctx, &addn_ie->probeRespData_buff,
5617 &addn_ie->probeRespDataLen,
5618 update_ie->pAdditionIEBuffer,
5619 update_ie->ieBufferlength);
5620 break;
5621 case eUPDATE_IE_ASSOC_RESP:
5622 /* assoc resp IE */
5623 lim_update_add_ie_buffer(mac_ctx, &addn_ie->assocRespData_buff,
5624 &addn_ie->assocRespDataLen,
5625 update_ie->pAdditionIEBuffer,
5626 update_ie->ieBufferlength);
5627 break;
5628 case eUPDATE_IE_PROBE_BCN:
5629 /* probe resp Bcn IE */
5630 lim_update_add_ie_buffer(mac_ctx,
5631 &addn_ie->probeRespBCNData_buff,
5632 &addn_ie->probeRespBCNDataLen,
5633 update_ie->pAdditionIEBuffer,
5634 update_ie->ieBufferlength);
5635 if (update_ie->notify)
5636 lim_handle_param_update(mac_ctx,
5637 update_add_ies->updateType);
5638 break;
5639 default:
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005640 pe_err("unhandled buffer type %d", update_add_ies->updateType);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005641 break;
5642 }
5643end:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305644 qdf_mem_free(update_ie->pAdditionIEBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005645 update_ie->pAdditionIEBuffer = NULL;
5646}
5647
5648/**
Abhishek Singh518323d2015-10-19 17:42:01 +05305649 * send_extended_chan_switch_action_frame()- function to send ECSA
5650 * action frame for each sta connected to SAP/GO and AP in case of
5651 * STA .
5652 * @mac_ctx: pointer to global mac structure
5653 * @new_channel: new channel to switch to.
5654 * @ch_bandwidth: BW of channel to calculate op_class
5655 * @session_entry: pe session
5656 *
5657 * This function is called to send ECSA frame for STA/CLI and SAP/GO.
5658 *
5659 * Return: void
5660 */
5661
5662static void send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx,
5663 uint16_t new_channel, uint8_t ch_bandwidth,
5664 tpPESession session_entry)
5665{
5666 uint16_t op_class;
5667 uint8_t switch_mode = 0, i;
5668 tpDphHashNode psta;
gaoleze2920bd2017-03-21 17:38:42 +08005669 uint8_t switch_count;
Abhishek Singh518323d2015-10-19 17:42:01 +05305670
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -07005671 op_class = wlan_reg_dmn_get_opclass_from_channel(
Abhishek Singh518323d2015-10-19 17:42:01 +05305672 mac_ctx->scan.countryCodeCurrent,
5673 new_channel,
5674 ch_bandwidth);
5675
5676 if (LIM_IS_AP_ROLE(session_entry) &&
5677 (mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch == false))
gaolez76d2a162017-03-21 19:23:58 +08005678 switch_mode = session_entry->gLimChannelSwitch.switchMode;
Abhishek Singh518323d2015-10-19 17:42:01 +05305679
gaoleze2920bd2017-03-21 17:38:42 +08005680 switch_count = session_entry->gLimChannelSwitch.switchCount;
5681
Abhishek Singh518323d2015-10-19 17:42:01 +05305682 if (LIM_IS_AP_ROLE(session_entry)) {
gaolez3b07a2c2017-03-22 12:59:17 +08005683 for (i = 0; i <= mac_ctx->lim.maxStation; i++) {
Abhishek Singh518323d2015-10-19 17:42:01 +05305684 psta =
5685 session_entry->dph.dphHashTable.pDphNodeArray + i;
5686 if (psta && psta->added)
5687 lim_send_extended_chan_switch_action_frame(
5688 mac_ctx,
5689 psta->staAddr,
5690 switch_mode, op_class, new_channel,
gaoleze2920bd2017-03-21 17:38:42 +08005691 switch_count, session_entry);
Abhishek Singh518323d2015-10-19 17:42:01 +05305692 }
5693 } else if (LIM_IS_STA_ROLE(session_entry)) {
5694 lim_send_extended_chan_switch_action_frame(mac_ctx,
5695 session_entry->bssId,
5696 switch_mode, op_class, new_channel,
gaoleze2920bd2017-03-21 17:38:42 +08005697 switch_count, session_entry);
Abhishek Singh518323d2015-10-19 17:42:01 +05305698 }
5699
5700}
5701
5702/**
gaolez76d2a162017-03-21 19:23:58 +08005703 * lim_send_chan_switch_action_frame()- Send an action frame
5704 * containing CSA IE or ECSA IE depending on the connected
5705 * sta capability.
5706 *
5707 * @mac_ctx: pointer to global mac structure
5708 * @new_channel: new channel to switch to.
5709 * @ch_bandwidth: BW of channel to calculate op_class
5710 * @session_entry: pe session
5711 *
5712 * Return: void
5713 */
5714static
5715void lim_send_chan_switch_action_frame(tpAniSirGlobal mac_ctx,
5716 uint16_t new_channel,
5717 uint8_t ch_bandwidth,
5718 tpPESession session_entry)
5719{
5720 uint16_t op_class;
5721 uint8_t switch_mode = 0, i;
5722 uint8_t switch_count;
5723 tpDphHashNode psta;
5724 tpDphHashNode dph_node_array_ptr;
5725
5726 dph_node_array_ptr = session_entry->dph.dphHashTable.pDphNodeArray;
5727
5728 op_class = wlan_reg_dmn_get_opclass_from_channel(
5729 mac_ctx->scan.countryCodeCurrent,
5730 new_channel, ch_bandwidth);
5731
5732 if (LIM_IS_AP_ROLE(session_entry) &&
5733 (false == mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch))
5734 switch_mode = session_entry->gLimChannelSwitch.switchMode;
5735
5736 switch_count = session_entry->gLimChannelSwitch.switchCount;
5737
5738 if (LIM_IS_AP_ROLE(session_entry)) {
5739 for (i = 0; i < mac_ctx->lim.maxStation; i++) {
5740 psta = dph_node_array_ptr + i;
5741 if (!(psta && psta->added))
5742 continue;
5743 if (session_entry->lim_non_ecsa_cap_num == 0)
5744 lim_send_extended_chan_switch_action_frame
5745 (mac_ctx, psta->staAddr, switch_mode,
5746 op_class, new_channel, switch_count,
5747 session_entry);
5748 else
5749 lim_send_channel_switch_mgmt_frame
5750 (mac_ctx, psta->staAddr, switch_mode,
5751 new_channel, switch_count,
5752 session_entry);
5753 }
5754 } else if (LIM_IS_STA_ROLE(session_entry)) {
5755 lim_send_extended_chan_switch_action_frame
5756 (mac_ctx, session_entry->bssId, switch_mode, op_class,
5757 new_channel, switch_count, session_entry);
5758 }
5759}
5760
5761/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005762 * lim_process_sme_dfs_csa_ie_request() - process sme dfs csa ie req
5763 *
5764 * @mac_ctx: Pointer to Global MAC structure
5765 * @msg_buf: pointer to the SME message buffer
5766 *
5767 * This function processes SME request messages from HDD or upper layer
5768 * application.
5769 *
5770 * Return: None
5771 */
5772static void lim_process_sme_dfs_csa_ie_request(tpAniSirGlobal mac_ctx,
5773 uint32_t *msg_buf)
5774{
5775 tpSirDfsCsaIeRequest dfs_csa_ie_req;
5776 tpPESession session_entry = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005777 uint8_t session_id;
5778 tLimWiderBWChannelSwitchInfo *wider_bw_ch_switch;
Amar Singhal22995112016-01-22 10:42:33 -08005779 enum offset_t ch_offset;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005780
5781 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005782 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005783 return;
5784 }
5785
5786 dfs_csa_ie_req = (tSirDfsCsaIeRequest *)msg_buf;
5787 session_entry = pe_find_session_by_bssid(mac_ctx,
5788 dfs_csa_ie_req->bssid, &session_id);
5789 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005790 pe_err("Session not found for given BSSID" MAC_ADDRESS_STR,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005791 MAC_ADDR_ARRAY(dfs_csa_ie_req->bssid));
5792 return;
5793 }
5794
5795 if (session_entry->valid && !LIM_IS_AP_ROLE(session_entry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005796 pe_err("Invalid SystemRole %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005797 GET_LIM_SYSTEM_ROLE(session_entry));
5798 return;
5799 }
5800
5801 /* target channel */
5802 session_entry->gLimChannelSwitch.primaryChannel =
5803 dfs_csa_ie_req->targetChannel;
5804
5805 /* Channel switch announcement needs to be included in beacon */
5806 session_entry->dfsIncludeChanSwIe = true;
gaoleze2920bd2017-03-21 17:38:42 +08005807 session_entry->gLimChannelSwitch.switchCount =
5808 dfs_csa_ie_req->ch_switch_beacon_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005809 session_entry->gLimChannelSwitch.ch_width =
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005810 dfs_csa_ie_req->ch_params.ch_width;
Chandrasekaran Manishekar4fcb7f52016-03-07 19:09:20 +05305811 session_entry->gLimChannelSwitch.sec_ch_offset =
5812 dfs_csa_ie_req->ch_params.sec_ch_offset;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005813 if (mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch == false)
gaolez76d2a162017-03-21 19:23:58 +08005814 session_entry->gLimChannelSwitch.switchMode =
5815 dfs_csa_ie_req->ch_switch_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005816
5817 /*
5818 * Validate if SAP is operating HT or VHT mode and set the Channel
5819 * Switch Wrapper element with the Wide Band Switch subelement.
5820 */
5821 if (true != session_entry->vhtCapability)
5822 goto skip_vht;
5823
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005824 /* Now encode the Wider Ch BW element depending on the ch width */
5825 wider_bw_ch_switch = &session_entry->gLimWiderBWChannelSwitch;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005826 switch (dfs_csa_ie_req->ch_params.ch_width) {
5827 case CH_WIDTH_20MHZ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005828 /*
5829 * Wide channel BW sublement in channel wrapper element is not
5830 * required in case of 20 Mhz operation. Currently It is set
5831 * only set in case of 40/80 Mhz Operation.
5832 */
5833 session_entry->dfsIncludeChanWrapperIe = false;
5834 wider_bw_ch_switch->newChanWidth =
5835 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
5836 break;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005837 case CH_WIDTH_40MHZ:
5838 session_entry->dfsIncludeChanWrapperIe = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005839 wider_bw_ch_switch->newChanWidth =
5840 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
5841 break;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005842 case CH_WIDTH_80MHZ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005843 session_entry->dfsIncludeChanWrapperIe = true;
5844 wider_bw_ch_switch->newChanWidth =
5845 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
5846 break;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005847 case CH_WIDTH_160MHZ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005848 session_entry->dfsIncludeChanWrapperIe = true;
5849 wider_bw_ch_switch->newChanWidth =
5850 WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ;
5851 break;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005852 case CH_WIDTH_80P80MHZ:
5853 session_entry->dfsIncludeChanWrapperIe = true;
5854 wider_bw_ch_switch->newChanWidth =
5855 WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ;
Sandeep Puligilla2111d3c2016-02-03 01:46:15 -08005856 /*
5857 * This is not applicable for 20/40/80 Mhz.
5858 * Only used when we support 80+80 Mhz operation.
5859 * In case of 80+80 Mhz, this parameter indicates
5860 * center channel frequency index of 80 Mhz channel of
5861 * frequency segment 1.
5862 */
5863 wider_bw_ch_switch->newCenterChanFreq1 =
5864 dfs_csa_ie_req->ch_params.center_freq_seg1;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005865 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005866 default:
5867 session_entry->dfsIncludeChanWrapperIe = false;
5868 /*
5869 * Need to handle 80+80 Mhz Scenario. When 80+80 is supported
5870 * set the gLimWiderBWChannelSwitch.newChanWidth to 3
5871 */
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005872 pe_err("Invalid Channel Width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005873 break;
5874 }
5875 /* Fetch the center channel based on the channel width */
5876 wider_bw_ch_switch->newCenterChanFreq0 =
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08005877 dfs_csa_ie_req->ch_params.center_freq_seg0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005878skip_vht:
5879 /* Send CSA IE request from here */
5880 if (sch_set_fixed_beacon_fields(mac_ctx, session_entry) !=
5881 eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005882 pe_err("Unable to set CSA IE in beacon");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005883 return;
5884 }
5885
5886 /*
5887 * First beacon update request is sent here, the remaining updates are
5888 * done when the FW responds back after sending the first beacon after
5889 * the template update
5890 */
5891 lim_send_beacon_ind(mac_ctx, session_entry);
Chandrasekaran, Manishekardc351562016-01-11 19:28:52 +05305892
5893 if (dfs_csa_ie_req->ch_params.ch_width == CH_WIDTH_80MHZ)
5894 ch_offset = BW80;
5895 else
5896 ch_offset = dfs_csa_ie_req->ch_params.sec_ch_offset;
5897
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005898 pe_debug("IE count:%d chan:%d width:%d wrapper:%d ch_offset:%d",
Chandrasekaran, Manishekardc351562016-01-11 19:28:52 +05305899 session_entry->gLimChannelSwitch.switchCount,
5900 session_entry->gLimChannelSwitch.primaryChannel,
5901 session_entry->gLimChannelSwitch.ch_width,
5902 session_entry->dfsIncludeChanWrapperIe,
5903 ch_offset);
5904
gaolez76d2a162017-03-21 19:23:58 +08005905 /* Send ECSA/CSA Action frame after updating the beacon */
5906 if (CHAN_HOP_ALL_BANDS_ENABLE)
5907 lim_send_chan_switch_action_frame(mac_ctx,
5908 session_entry->gLimChannelSwitch.primaryChannel,
5909 ch_offset, session_entry);
5910 else
5911 send_extended_chan_switch_action_frame(mac_ctx,
5912 session_entry->gLimChannelSwitch.primaryChannel,
5913 ch_offset, session_entry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005914 session_entry->gLimChannelSwitch.switchCount--;
5915}
5916
5917/**
Abhishek Singh518323d2015-10-19 17:42:01 +05305918 * lim_process_ext_change_channel()- function to send ECSA
5919 * action frame for STA/CLI .
5920 * @mac_ctx: pointer to global mac structure
5921 * @msg: params from sme for new channel.
5922 *
5923 * This function is called to send ECSA frame for STA/CLI.
5924 *
5925 * Return: void
5926 */
5927
5928static void lim_process_ext_change_channel(tpAniSirGlobal mac_ctx,
5929 uint32_t *msg)
5930{
5931 struct sir_sme_ext_cng_chan_req *ext_chng_channel =
5932 (struct sir_sme_ext_cng_chan_req *) msg;
5933 tpPESession session_entry = NULL;
5934
5935 if (NULL == msg) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005936 pe_err("Buffer is Pointing to NULL");
Abhishek Singh518323d2015-10-19 17:42:01 +05305937 return;
5938 }
5939 session_entry =
5940 pe_find_session_by_sme_session_id(mac_ctx,
5941 ext_chng_channel->session_id);
5942 if (NULL == session_entry) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005943 pe_err("Session not found for given session %d",
Abhishek Singh518323d2015-10-19 17:42:01 +05305944 ext_chng_channel->session_id);
5945 return;
5946 }
5947 if (LIM_IS_AP_ROLE(session_entry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005948 pe_err("not an STA/CLI session");
Abhishek Singh518323d2015-10-19 17:42:01 +05305949 return;
5950 }
5951 send_extended_chan_switch_action_frame(mac_ctx,
5952 ext_chng_channel->new_channel,
5953 0, session_entry);
5954}
5955
5956/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005957 * lim_process_nss_update_request() - process sme nss update req
5958 *
5959 * @mac_ctx: Pointer to Global MAC structure
5960 * @msg_buf: pointer to the SME message buffer
5961 *
5962 * This function processes SME request messages from HDD or upper layer
5963 * application.
5964 *
5965 * Return: None
5966 */
5967static void lim_process_nss_update_request(tpAniSirGlobal mac_ctx,
5968 uint32_t *msg_buf)
5969{
5970 struct sir_nss_update_request *nss_update_req_ptr;
5971 tpPESession session_entry = NULL;
5972
5973 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005974 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005975 return;
5976 }
5977
5978 nss_update_req_ptr = (struct sir_nss_update_request *)msg_buf;
Chandrasekaran, Manishekar5738eb02016-02-02 12:22:00 +05305979 session_entry = pe_find_session_by_sme_session_id(mac_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005980 nss_update_req_ptr->vdev_id);
5981 if (session_entry == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005982 pe_err("Session not found for given session_id %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005983 nss_update_req_ptr->vdev_id);
5984 return;
5985 }
5986
5987 if (session_entry->valid && !LIM_IS_AP_ROLE(session_entry)) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07005988 pe_err("Invalid SystemRole %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005989 GET_LIM_SYSTEM_ROLE(session_entry));
5990 return;
5991 }
5992
5993 /* populate nss field in the beacon */
5994 session_entry->gLimOperatingMode.present = 1;
5995 session_entry->gLimOperatingMode.rxNSS = nss_update_req_ptr->new_nss;
Ganesh Kondabattini5e0ac2a2017-05-16 14:29:32 +05305996 session_entry->gLimOperatingMode.chanWidth = session_entry->ch_width;
5997
5998 if ((nss_update_req_ptr->new_nss == NSS_1x1_MODE) &&
5999 (session_entry->ch_width > CH_WIDTH_80MHZ))
6000 session_entry->gLimOperatingMode.chanWidth = CH_WIDTH_80MHZ;
6001
6002 pe_debug("ch width %hu", session_entry->gLimOperatingMode.chanWidth);
6003
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006004 /* Send nss update request from here */
6005 if (sch_set_fixed_beacon_fields(mac_ctx, session_entry) !=
6006 eSIR_SUCCESS) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07006007 pe_err("Unable to set op mode IE in beacon");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006008 return;
6009 }
6010
6011 lim_send_beacon_ind(mac_ctx, session_entry);
6012}
6013
6014/**
6015 * lim_process_set_ie_req() - process sme set IE request
6016 *
6017 * @mac_ctx: Pointer to Global MAC structure
6018 * @msg_buf: pointer to the SME message buffer
6019 *
6020 * This function processes SME request messages from HDD or upper layer
6021 * application.
6022 *
6023 * Return: None
6024 */
6025static void lim_process_set_ie_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
6026{
6027 struct send_extcap_ie *msg;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306028 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006029
6030 if (msg_buf == NULL) {
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07006031 pe_err("Buffer is Pointing to NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006032 return;
6033 }
6034
6035 msg = (struct send_extcap_ie *)msg_buf;
6036 status = lim_send_ext_cap_ie(mac_ctx, msg->session_id, NULL, false);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306037 if (QDF_STATUS_SUCCESS != status)
Srinivas Girigowda15b355e2017-03-26 21:51:00 -07006038 pe_err("Unable to send ExtCap to FW");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006039
6040}