blob: 3034eba8b602f8c475306ace7661f3344f0d5520 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Arif Hussainee10f902017-12-27 16:30:17 -08002 * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/*
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080020 * This file lim ProcessMessageQueue.cc contains the code
21 * for processing LIM message Queue.
22 * Author: Chandra Modumudi
23 * Date: 02/11/02
24 * History:-
25 * Date Modified by Modification Information
26 * --------------------------------------------------------------------
27 *
28 */
29#include "cds_api.h"
30#include "wni_api.h"
31#include "wma_types.h"
32
33#include "wni_cfg.h"
34#include "cfg_api.h"
35#include "sir_common.h"
36#include "utils_api.h"
37#include "lim_types.h"
38#include "lim_utils.h"
39#include "lim_assoc_utils.h"
40#include "lim_prop_exts_utils.h"
41
42#include "lim_admit_control.h"
43#include "lim_ibss_peer_mgmt.h"
44#include "sch_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080045#include "lim_ft_defs.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046#include "lim_session.h"
47#include "lim_send_messages.h"
48
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080049#include "rrm_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080051#include "lim_ft.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080052
Anurag Chouhan6d760662016-02-20 16:05:43 +053053#include "qdf_types.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054#include "cds_packet.h"
Anurag Chouhan600c3a02016-03-01 10:33:54 +053055#include "qdf_mem.h"
Tushnim Bhattacharyya66348bd2017-03-09 15:02:10 -080056#include "wlan_policy_mgr_api.h"
Deepak Dhamdhere0f076bd2016-06-02 11:29:21 -070057#include "nan_datapath.h"
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -070058#include "wlan_reg_services_api.h"
Padma, Santhosh Kumardd3f4852018-01-16 18:51:51 +053059#include "lim_security_utils.h"
60#include "cds_ieee80211_common.h"
Abhishek Singh9fabbbb2018-01-29 17:38:36 +053061#include <wlan_scan_ucfg_api.h>
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +053062#include "wlan_mlme_public_struct.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063
Jeff Johnson9320c1e2018-12-02 13:09:20 -080064void lim_log_session_states(struct mac_context *mac);
65static void lim_process_normal_hdd_msg(struct mac_context *mac_ctx,
Rajeev Kumar416b73f2017-01-21 16:45:21 -080066 struct scheduler_msg *msg, uint8_t rsp_reqd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080067
Padma, Santhosh Kumardd3f4852018-01-16 18:51:51 +053068#ifdef WLAN_FEATURE_SAE
69/**
70 * lim_process_sae_msg() - Process SAE message
71 * @mac: Global MAC pointer
72 * @body: Buffer pointer
73 *
74 * Return: None
75 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -080076static void lim_process_sae_msg(struct mac_context *mac, struct sir_sae_msg *body)
Padma, Santhosh Kumardd3f4852018-01-16 18:51:51 +053077{
78 struct sir_sae_msg *sae_msg = body;
Jeff Johnsonb5b235f2018-11-19 06:54:31 -080079 struct pe_session *session;
Padma, Santhosh Kumardd3f4852018-01-16 18:51:51 +053080
81 if (!sae_msg) {
82 pe_err("SAE msg is NULL");
83 return;
84 }
85
86 session = pe_find_session_by_sme_session_id(mac,
87 sae_msg->session_id);
88 if (session == NULL) {
89 pe_err("SAE:Unable to find session");
90 return;
91 }
92
93 if (session->pePersona != QDF_STA_MODE) {
94 pe_err("SAE:Not supported in this mode %d",
95 session->pePersona);
96 return;
97 }
98
99 pe_debug("SAE:status %d limMlmState %d pePersona %d",
100 sae_msg->sae_status, session->limMlmState,
101 session->pePersona);
102 switch (session->limMlmState) {
103 case eLIM_MLM_WT_SAE_AUTH_STATE:
104 /* SAE authentication is completed. Restore from auth state */
105 if (tx_timer_running(&mac->lim.limTimers.sae_auth_timer))
106 lim_deactivate_and_change_timer(mac,
107 eLIM_AUTH_SAE_TIMER);
108 /* success */
109 if (sae_msg->sae_status == IEEE80211_STATUS_SUCCESS)
110 lim_restore_from_auth_state(mac,
111 eSIR_SME_SUCCESS,
112 eSIR_MAC_SUCCESS_STATUS,
113 session);
114 else
115 lim_restore_from_auth_state(mac,
116 eSIR_SME_AUTH_REFUSED,
117 eSIR_MAC_UNSPEC_FAILURE_STATUS,
118 session);
119 break;
120 default:
121 /* SAE msg is received in unexpected state */
122 pe_err("received SAE msg in state %X",
123 session->limMlmState);
124 lim_print_mlm_state(mac, LOGE, session->limMlmState);
125 break;
126 }
127}
128#else
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800129static inline void lim_process_sae_msg(struct mac_context *mac, void *body)
Padma, Santhosh Kumardd3f4852018-01-16 18:51:51 +0530130{}
131#endif
132
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800133/**
134 * lim_process_dual_mac_cfg_resp() - Process set dual mac config response
135 * @mac: Global MAC pointer
136 * @body: Set dual mac config response in sir_dual_mac_config_resp format
137 *
138 * Process the set dual mac config response and post the message
139 * to SME to process this further and release the active
140 * command list
141 *
142 * Return: None
143 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800144static void lim_process_dual_mac_cfg_resp(struct mac_context *mac, void *body)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800145{
146 struct sir_dual_mac_config_resp *resp, *param;
147 uint32_t len, fail_resp = 0;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700148 struct scheduler_msg msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800149
150 resp = (struct sir_dual_mac_config_resp *)body;
151 if (!resp) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700152 pe_err("Set dual mac cfg param is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800153 fail_resp = 1;
154 /* Not returning here. If possible, let us proceed
155 * and send fail response to SME
156 */
157 }
158
159 len = sizeof(*param);
160
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530161 param = qdf_mem_malloc(len);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700162 if (!param)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800163 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800164
165 if (fail_resp) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700166 pe_err("Send fail status to SME");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800167 param->status = SET_HW_MODE_STATUS_ECANCELED;
168 } else {
169 param->status = resp->status;
170 /*
171 * TODO: Update this HW mode info in any UMAC params, if needed
172 */
173 }
174
175 msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP;
176 msg.bodyptr = param;
177 msg.bodyval = 0;
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700178 pe_debug("Send eWNI_SME_SET_DUAL_MAC_CFG_RESP to SME");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800179 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
180 return;
181}
182
183/**
184 * lim_process_set_hw_mode_resp() - Process set HW mode response
185 * @mac: Global MAC pointer
186 * @body: Set HW mode response in sir_set_hw_mode_resp format
187 *
188 * Process the set HW mode response and post the message
189 * to SME to process this further and release the active
190 * command list
191 *
192 * Return: None
193 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800194static void lim_process_set_hw_mode_resp(struct mac_context *mac, void *body)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800195{
196 struct sir_set_hw_mode_resp *resp, *param;
197 uint32_t len, i, fail_resp = 0;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700198 struct scheduler_msg msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800199
200 resp = (struct sir_set_hw_mode_resp *)body;
201 if (!resp) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700202 pe_err("Set HW mode param is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800203 fail_resp = 1;
204 /* Not returning here. If possible, let us proceed
205 * and send fail response to SME */
206 }
207
208 len = sizeof(*param);
209
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530210 param = qdf_mem_malloc(len);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700211 if (!param)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800212 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213
214 if (fail_resp) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700215 pe_err("Send fail status to SME");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800216 param->status = SET_HW_MODE_STATUS_ECANCELED;
217 param->cfgd_hw_mode_index = 0;
218 param->num_vdev_mac_entries = 0;
219 } else {
220 param->status = resp->status;
221 param->cfgd_hw_mode_index = resp->cfgd_hw_mode_index;
222 param->num_vdev_mac_entries = resp->num_vdev_mac_entries;
223
224 for (i = 0; i < resp->num_vdev_mac_entries; i++) {
225 param->vdev_mac_map[i].vdev_id =
226 resp->vdev_mac_map[i].vdev_id;
227 param->vdev_mac_map[i].mac_id =
228 resp->vdev_mac_map[i].mac_id;
229 }
230 /*
231 * TODO: Update this HW mode info in any UMAC params, if needed
232 */
233 }
234
235 msg.type = eWNI_SME_SET_HW_MODE_RESP;
236 msg.bodyptr = param;
237 msg.bodyval = 0;
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700238 pe_err("Send eWNI_SME_SET_HW_MODE_RESP to SME");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800239 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
240 return;
241}
242
243/**
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800244 * lim_process_antenna_mode_resp() - Process set antenna mode
245 * response
246 * @mac: Global MAC pointer
247 * @body: Set antenna mode response in sir_antenna_mode_resp
248 * format
249 *
250 * Process the set antenna mode response and post the message
251 * to SME to process this further and release the active
252 * command list
253 *
254 * Return: None
255 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800256static void lim_process_set_antenna_resp(struct mac_context *mac, void *body)
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800257{
258 struct sir_antenna_mode_resp *resp, *param;
259 bool fail_resp = false;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700260 struct scheduler_msg msg = {0};
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800261
262 resp = (struct sir_antenna_mode_resp *)body;
263 if (!resp) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700264 pe_err("Set antenna mode resp is NULL");
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800265 fail_resp = true;
266 /* Not returning here. If possible, let us proceed
267 * and send fail response to SME
268 */
269 }
270
271 param = qdf_mem_malloc(sizeof(*param));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700272 if (!param)
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800273 return;
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800274
275 if (fail_resp) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700276 pe_err("Send fail status to SME");
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800277 param->status = SET_ANTENNA_MODE_STATUS_ECANCELED;
278 } else {
279 param->status = resp->status;
280 }
281
282 msg.type = eWNI_SME_SET_ANTENNA_MODE_RESP;
283 msg.bodyptr = param;
284 msg.bodyval = 0;
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700285 pe_debug("Send eWNI_SME_SET_ANTENNA_MODE_RESP to SME");
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800286 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
287 return;
288}
289
290/**
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530291 * lim_process_set_default_scan_ie_request() - Process the Set default
292 * Scan IE request from HDD.
293 * @mac_ctx: Pointer to Global MAC structure
294 * @msg_buf: Pointer to incoming data
295 *
296 * This function receives the default scan IEs and updates the ext cap IE
297 * (if present) with FTM capabilities and pass the Scan IEs to WMA.
298 *
299 * Return: None
300 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800301static void lim_process_set_default_scan_ie_request(struct mac_context *mac_ctx,
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530302 uint32_t *msg_buf)
303{
304 struct hdd_default_scan_ie *set_ie_params;
305 struct vdev_ie_info *wma_ie_params;
306 uint8_t *local_ie_buf;
307 uint16_t local_ie_len;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700308 struct scheduler_msg msg_q = {0};
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700309 QDF_STATUS ret_code;
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530310
311 if (!msg_buf) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700312 pe_err("msg_buf is NULL");
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530313 return;
314 }
315
316 set_ie_params = (struct hdd_default_scan_ie *) msg_buf;
317 local_ie_len = set_ie_params->ie_len;
318
319 local_ie_buf = qdf_mem_malloc(MAX_DEFAULT_SCAN_IE_LEN);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700320 if (!local_ie_buf)
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530321 return;
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530322
Selvaraj, Sridhar01741822016-08-30 18:26:19 +0530323 if (lim_update_ext_cap_ie(mac_ctx,
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530324 (uint8_t *)set_ie_params->ie_data,
325 local_ie_buf, &local_ie_len)) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700326 pe_err("Update ext cap IEs fails");
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530327 goto scan_ie_send_fail;
328 }
329
330 wma_ie_params = qdf_mem_malloc(sizeof(*wma_ie_params) + local_ie_len);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700331 if (!wma_ie_params)
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530332 goto scan_ie_send_fail;
Arif Hussainf5b6c412018-10-10 19:41:09 -0700333
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530334 wma_ie_params->vdev_id = set_ie_params->session_id;
335 wma_ie_params->ie_id = DEFAULT_SCAN_IE_ID;
336 wma_ie_params->length = local_ie_len;
337 wma_ie_params->data = (uint8_t *)(wma_ie_params)
338 + sizeof(*wma_ie_params);
339 qdf_mem_copy(wma_ie_params->data, local_ie_buf, local_ie_len);
340
341 msg_q.type = WMA_SET_IE_INFO;
342 msg_q.bodyptr = wma_ie_params;
343 msg_q.bodyval = 0;
344 ret_code = wma_post_ctrl_msg(mac_ctx, &msg_q);
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700345 if (QDF_STATUS_SUCCESS != ret_code) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700346 pe_err("fail to send WMA_SET_IE_INFO");
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +0530347 qdf_mem_free(wma_ie_params);
348 }
349scan_ie_send_fail:
350 qdf_mem_free(local_ie_buf);
351}
352
353/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800354 * lim_process_hw_mode_trans_ind() - Process set HW mode transition indication
355 * @mac: Global MAC pointer
356 * @body: Set HW mode response in sir_hw_mode_trans_ind format
357 *
358 * Process the set HW mode transition indication and post the message
359 * to SME to invoke the HDD callback
360 * command list
361 *
362 * Return: None
363 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800364static void lim_process_hw_mode_trans_ind(struct mac_context *mac, void *body)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800365{
366 struct sir_hw_mode_trans_ind *ind, *param;
367 uint32_t len, i;
Rajeev Kumar37d478b2017-04-17 16:59:28 -0700368 struct scheduler_msg msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800369
370 ind = (struct sir_hw_mode_trans_ind *)body;
371 if (!ind) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700372 pe_err("Set HW mode trans ind param is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800373 return;
374 }
375
376 len = sizeof(*param);
377
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530378 param = qdf_mem_malloc(len);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700379 if (!param)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800380 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800381
382 param->old_hw_mode_index = ind->old_hw_mode_index;
383 param->new_hw_mode_index = ind->new_hw_mode_index;
384 param->num_vdev_mac_entries = ind->num_vdev_mac_entries;
385
386 for (i = 0; i < ind->num_vdev_mac_entries; i++) {
387 param->vdev_mac_map[i].vdev_id =
388 ind->vdev_mac_map[i].vdev_id;
389 param->vdev_mac_map[i].mac_id =
390 ind->vdev_mac_map[i].mac_id;
391 }
392
393 /* TODO: Update this HW mode info in any UMAC params, if needed */
394
395 msg.type = eWNI_SME_HW_MODE_TRANS_IND;
396 msg.bodyptr = param;
397 msg.bodyval = 0;
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700398 pe_err("Send eWNI_SME_HW_MODE_TRANS_IND to SME");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800399 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
400 return;
401}
402
403/** -------------------------------------------------------------
404 \fn def_msg_decision
405 \brief The function decides whether to defer a message or not in limProcessMessage function
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800406 \param struct mac_context *mac
Rajeev Kumar416b73f2017-01-21 16:45:21 -0800407 \param struct scheduler_msg limMsg
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408 \param tSirMacTspecIE *ppInfo
409 \return none
410 -------------------------------------------------------------*/
411
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800412static uint8_t def_msg_decision(struct mac_context *mac_ctx,
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700413 struct scheduler_msg *lim_msg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800414{
Sandeep Puligillad9f88ce2017-04-11 19:41:57 -0700415 uint8_t type, subtype;
416 QDF_STATUS status;
417 bool mgmt_pkt_defer = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800418
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700419 /* this function should not changed */
420 if (mac_ctx->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) {
Jeff Johnson47d75242018-05-12 15:58:53 -0700421 /* Defer processing this message */
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700422 if (lim_defer_msg(mac_ctx, lim_msg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530423 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800424 FL("Unable to Defer Msg"));
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700425 lim_log_session_states(mac_ctx);
426 lim_handle_defer_msg_error(mac_ctx, lim_msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800427 }
428 return true;
429 }
Sandeep Puligillad9f88ce2017-04-11 19:41:57 -0700430
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700431 /*
432 * When defer is requested then defer all the messages except
433 * HAL responses.
434 */
435 if (!lim_is_system_in_scan_state(mac_ctx) &&
436 !GET_LIM_PROCESS_DEFD_MESGS(mac_ctx)) {
437 if (lim_msg->type == SIR_BB_XPORT_MGMT_MSG) {
Sandeep Puligillad9f88ce2017-04-11 19:41:57 -0700438 /*
439 * Dont defer beacon and probe response
440 * because it will fill the differ queue quickly
441 */
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700442 status = lim_util_get_type_subtype(lim_msg->bodyptr,
443 &type, &subtype);
Sandeep Puligillad9f88ce2017-04-11 19:41:57 -0700444 if (QDF_IS_STATUS_SUCCESS(status) &&
445 (type == SIR_MAC_MGMT_FRAME) &&
446 ((subtype == SIR_MAC_MGMT_BEACON) ||
447 (subtype == SIR_MAC_MGMT_PROBE_RSP)))
448 mgmt_pkt_defer = false;
449 }
450
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700451 if ((lim_msg->type != WMA_ADD_BSS_RSP) &&
452 (lim_msg->type != WMA_DELETE_BSS_RSP) &&
453 (lim_msg->type != WMA_DELETE_BSS_HO_FAIL_RSP) &&
454 (lim_msg->type != WMA_ADD_STA_RSP) &&
455 (lim_msg->type != WMA_DELETE_STA_RSP) &&
456 (lim_msg->type != WMA_SET_BSSKEY_RSP) &&
457 (lim_msg->type != WMA_SET_STAKEY_RSP) &&
458 (lim_msg->type != WMA_SET_STA_BCASTKEY_RSP) &&
459 (lim_msg->type != WMA_AGGR_QOS_RSP) &&
460 (lim_msg->type != WMA_SET_MIMOPS_RSP) &&
461 (lim_msg->type != WMA_SWITCH_CHANNEL_RSP) &&
462 (lim_msg->type != WMA_P2P_NOA_ATTR_IND) &&
463 (lim_msg->type != WMA_ADD_TS_RSP) &&
Hanumantha Reddy Pothulab8340212016-01-12 11:16:06 +0530464 /*
465 * LIM won't process any defer queue commands if gLimAddtsSent is
466 * set to TRUE. gLimAddtsSent will be set TRUE to while sending
467 * ADDTS REQ. Say, when deferring is enabled, if
468 * SIR_LIM_ADDTS_RSP_TIMEOUT is posted (because of not receiving ADDTS
469 * RSP) then this command will be added to defer queue and as
470 * gLimAddtsSent is set TRUE LIM will never process any commands from
471 * defer queue, including SIR_LIM_ADDTS_RSP_TIMEOUT. Hence allowing
472 * SIR_LIM_ADDTS_RSP_TIMEOUT command to be processed with deferring
473 * enabled, so that this will be processed immediately and sets
474 * gLimAddtsSent to FALSE.
475 */
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700476 (lim_msg->type != SIR_LIM_ADDTS_RSP_TIMEOUT) &&
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +0530477 /* Allow processing of RX frames while awaiting reception
478 * of ADD TS response over the air. This logic particularly
479 * handles the case when host sends ADD BA request to FW
480 * after ADD TS request is sent over the air and
481 * ADD TS response received over the air */
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700482 !(lim_msg->type == SIR_BB_XPORT_MGMT_MSG &&
483 mac_ctx->lim.gLimAddtsSent) &&
484 (mgmt_pkt_defer)) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700485 pe_debug("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode",
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700486 lim_msg_str(lim_msg->type));
Jeff Johnson47d75242018-05-12 15:58:53 -0700487 /* Defer processing this message */
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700488 if (lim_defer_msg(mac_ctx, lim_msg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530489 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Naveen Rawatb2fcd472018-06-10 22:24:24 -0700490 FL("Unable to Defer Msg"));
491 lim_log_session_states(mac_ctx);
492 lim_handle_defer_msg_error(mac_ctx, lim_msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800493 }
494 return true;
495 }
496 }
497 return false;
498}
499
500#ifdef FEATURE_WLAN_EXTSCAN
501static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800502__lim_pno_match_fwd_bcn_probepsp(struct mac_context *pmac, uint8_t *rx_pkt_info,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800503 tSirProbeRespBeacon *frame, uint32_t ie_len,
504 uint32_t msg_type)
505{
506 struct pno_match_found *result;
507 uint8_t *body;
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700508 struct scheduler_msg mmh_msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800509 tpSirMacMgmtHdr hdr;
510 uint32_t num_results = 1, len, i;
511
512 /* Upon receiving every matched beacon, bss info is forwarded to the
513 * the upper layer, hence num_results is set to 1 */
514 len = sizeof(*result) + (num_results * sizeof(tSirWifiScanResult)) +
515 ie_len;
516
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530517 result = qdf_mem_malloc(len);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700518 if (!result)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800519 return;
Arif Hussainf5b6c412018-10-10 19:41:09 -0700520
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800521 hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
522 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800523
524 /* Received frame does not have request id, hence set 0 */
525 result->request_id = 0;
526 result->more_data = 0;
527 result->num_results = num_results;
528
529 for (i = 0; i < result->num_results; i++) {
Anurag Chouhan210db072016-02-22 18:42:15 +0530530 result->ap[i].ts = qdf_mc_timer_get_system_time();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800531 result->ap[i].beaconPeriod = frame->beaconInterval;
532 result->ap[i].capability =
533 lim_get_u16((uint8_t *) &frame->capabilityInfo);
534 result->ap[i].channel = WMA_GET_RX_CH(rx_pkt_info);
Deepak Dhamdhere68929ec2015-08-05 15:16:35 -0700535 result->ap[i].rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800536 result->ap[i].rtt = 0;
537 result->ap[i].rtt_sd = 0;
538 result->ap[i].ieLength = ie_len;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530539 qdf_mem_copy((uint8_t *) &result->ap[i].ssid[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800540 (uint8_t *) frame->ssId.ssId, frame->ssId.length);
541 result->ap[i].ssid[frame->ssId.length] = '\0';
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530542 qdf_mem_copy((uint8_t *) &result->ap[i].bssid,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800543 (uint8_t *) hdr->bssId,
544 sizeof(tSirMacAddr));
545 /* Copy IE fields */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530546 qdf_mem_copy((uint8_t *) &result->ap[i].ieData,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800547 body + SIR_MAC_B_PR_SSID_OFFSET, ie_len);
548 }
549
550 mmh_msg.type = msg_type;
551 mmh_msg.bodyptr = result;
552 mmh_msg.bodyval = 0;
553 lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT);
554}
555
556
557static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800558__lim_ext_scan_forward_bcn_probe_rsp(struct mac_context *pmac, uint8_t *rx_pkt_info,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800559 tSirProbeRespBeacon *frame,
560 uint32_t ie_len,
561 uint32_t msg_type)
562{
563 tpSirWifiFullScanResultEvent result;
564 uint8_t *body;
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700565 struct scheduler_msg mmh_msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800566 tpSirMacMgmtHdr hdr;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +0530567 uint32_t frame_len;
568 tSirBssDescription *bssdescr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800569
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530570 result = qdf_mem_malloc(sizeof(*result) + ie_len);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700571 if (!result)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800572 return;
Arif Hussainf5b6c412018-10-10 19:41:09 -0700573
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800574 hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
575 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800576
577 /* Received frame does not have request id, hence set 0 */
578 result->requestId = 0;
579
580 result->moreData = 0;
Anurag Chouhan210db072016-02-22 18:42:15 +0530581 result->ap.ts = qdf_mc_timer_get_system_time();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800582 result->ap.beaconPeriod = frame->beaconInterval;
583 result->ap.capability =
584 lim_get_u16((uint8_t *) &frame->capabilityInfo);
585 result->ap.channel = WMA_GET_RX_CH(rx_pkt_info);
Deepak Dhamdhere68929ec2015-08-05 15:16:35 -0700586 result->ap.rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800587 result->ap.rtt = 0;
588 result->ap.rtt_sd = 0;
589 result->ap.ieLength = ie_len;
590
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530591 qdf_mem_copy((uint8_t *) &result->ap.ssid[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800592 (uint8_t *) frame->ssId.ssId, frame->ssId.length);
593 result->ap.ssid[frame->ssId.length] = '\0';
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530594 qdf_mem_copy((uint8_t *) &result->ap.bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800595 (uint8_t *) hdr->bssId,
Anurag Chouhan6d760662016-02-20 16:05:43 +0530596 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800597 /* Copy IE fields */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530598 qdf_mem_copy((uint8_t *) &result->ap.ieData,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800599 body + SIR_MAC_B_PR_SSID_OFFSET, ie_len);
600
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +0530601 frame_len = sizeof(*bssdescr) + ie_len - sizeof(bssdescr->ieFields[1]);
Arif Hussainf5b6c412018-10-10 19:41:09 -0700602 bssdescr = qdf_mem_malloc(frame_len);
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +0530603
Arif Hussainf5b6c412018-10-10 19:41:09 -0700604 if (!bssdescr)
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +0530605 return;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +0530606
607 qdf_mem_zero(bssdescr, frame_len);
608
609 lim_collect_bss_description(pmac, bssdescr, frame, rx_pkt_info, false);
Abhinav Kumarf9989582018-02-06 17:42:22 +0530610
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +0530611 qdf_mem_free(bssdescr);
612
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800613 mmh_msg.type = msg_type;
614 mmh_msg.bodyptr = result;
615 mmh_msg.bodyval = 0;
616 lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT);
617}
618
619static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800620__lim_process_ext_scan_beacon_probe_rsp(struct mac_context *pmac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800621 uint8_t *rx_pkt_info,
622 uint8_t sub_type)
623{
624 tSirProbeRespBeacon *frame;
625 uint8_t *body;
626 uint32_t frm_len;
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700627 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800628
629 frm_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
630 if (frm_len <= SIR_MAC_B_PR_SSID_OFFSET) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700631 pe_err("RX packet has invalid length %d", frm_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800632 return;
633 }
634
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530635 frame = qdf_mem_malloc(sizeof(*frame));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700636 if (!frame)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800637 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800638
639 if (sub_type == SIR_MAC_MGMT_BEACON) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700640 pe_debug("Beacon due to ExtScan/epno");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800641 status = sir_convert_beacon_frame2_struct(pmac,
642 (uint8_t *)rx_pkt_info,
643 frame);
644 } else if (sub_type == SIR_MAC_MGMT_PROBE_RSP) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700645 pe_debug("Probe Rsp due to ExtScan/epno");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800646 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
647 status = sir_convert_probe_frame2_struct(pmac, body,
648 frm_len, frame);
649 } else {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530650 qdf_mem_free(frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800651 return;
652 }
653
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700654 if (status != QDF_STATUS_SUCCESS) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -0700655 pe_err("Frame parsing failed");
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530656 qdf_mem_free(frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800657 return;
658 }
659
660 if (WMA_IS_EXTSCAN_SCAN_SRC(rx_pkt_info))
661 __lim_ext_scan_forward_bcn_probe_rsp(pmac, rx_pkt_info, frame,
662 (frm_len - SIR_MAC_B_PR_SSID_OFFSET),
663 eWNI_SME_EXTSCAN_FULL_SCAN_RESULT_IND);
664
665 if (WMA_IS_EPNO_SCAN_SRC(rx_pkt_info))
666 __lim_pno_match_fwd_bcn_probepsp(pmac, rx_pkt_info, frame,
667 (frm_len - SIR_MAC_B_PR_SSID_OFFSET),
668 eWNI_SME_EPNO_NETWORK_FOUND_IND);
669
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530670 qdf_mem_free(frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671}
672#endif
673
674/*
675 * Beacon Handling Cases:
676 * during scanning, when no session is active:
677 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800678 * during scanning, when any session is active, but beacon/Pr does not belong to that session, pe_session will be null.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800679 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800680 * during scanning, when any session is active, and beacon/Pr belongs to one of the session, pe_session will not be null.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800681 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
682 * Not scanning, no session:
683 * there should not be any beacon coming, if coming, should be dropped.
684 * Not Scanning,
685 */
686static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800687__lim_handle_beacon(struct mac_context *mac, struct scheduler_msg *pMsg,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800688 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800689{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800690 uint8_t *pRxPacketInfo;
Srinivas Girigowda4d65ebe2017-10-13 21:41:42 -0700691
Jeff Johnson5cce7a02018-11-22 15:41:15 -0800692 lim_get_b_dfrom_rx_packet(mac, pMsg->bodyptr,
Anurag Chouhanffb21542016-02-17 14:33:03 +0530693 (uint32_t **) &pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800694
695 /* This function should not be called if beacon is received in scan state. */
696 /* So not doing any checks for the global state. */
697
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800698 if (pe_session == NULL) {
Jeff Johnson5cce7a02018-11-22 15:41:15 -0800699 sch_beacon_process(mac, pRxPacketInfo, NULL);
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800700 } else if ((pe_session->limSmeState == eLIM_SME_LINK_EST_STATE) ||
701 (pe_session->limSmeState == eLIM_SME_NORMAL_STATE)) {
702 sch_beacon_process(mac, pRxPacketInfo, pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800703 } else
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800704 lim_process_beacon_frame(mac, pRxPacketInfo, pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800705
706 return;
707}
708
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530709/*
710 * lim_fill_sap_bcn_pkt_meta(): Fills essential fields in Rx Pkt Meta
711 * @scan_entry: pointer to the scan cache entry of the beacon
712 * @rx_pkt: pointer to the cds pkt allocated
713 *
Jeff Johnson60ed45a2018-05-06 15:28:49 -0700714 * This API fills only the essential parameters in the Rx Pkt Meta which are
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530715 * required while converting the beacon frame to struct and while handling
716 * the beacon for implementation of SAP protection mechanisms.
717 *
718 * Return: None
719 */
720static void lim_fill_sap_bcn_pkt_meta(struct scan_cache_entry *scan_entry,
721 cds_pkt_t *rx_pkt)
722{
723 rx_pkt->pkt_meta.channel = scan_entry->channel.chan_idx;
724
725 rx_pkt->pkt_meta.mpdu_hdr_len = sizeof(struct ieee80211_frame);
726 rx_pkt->pkt_meta.mpdu_len = scan_entry->raw_frame.len;
727 rx_pkt->pkt_meta.mpdu_data_len = rx_pkt->pkt_meta.mpdu_len -
728 rx_pkt->pkt_meta.mpdu_hdr_len;
729
730 rx_pkt->pkt_meta.mpdu_hdr_ptr = scan_entry->raw_frame.ptr;
731 rx_pkt->pkt_meta.mpdu_data_ptr = rx_pkt->pkt_meta.mpdu_hdr_ptr +
732 rx_pkt->pkt_meta.mpdu_hdr_len;
733
734 /*
735 * The scan_entry->raw_frame contains the qdf_nbuf->data from the SKB
736 * of the beacon. We set the rx_pkt->pkt_meta.mpdu_hdr_ptr to point
737 * to this memory directly. However we do not have the pointer to
738 * the SKB itself here which is usually is pointed by rx_pkt->pkt_buf.
739 * Also, we always get the pkt data using WMA_GET_RX_MPDU_DATA and
740 * dont actually use the pkt_buf. So setting this to NULL.
741 */
742 rx_pkt->pkt_buf = NULL;
743}
744
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530745/*
746 * lim_allocate_and_get_bcn() - Allocate and get the bcn frame pkt and structure
747 * @mac_ctx: pointer to global mac_ctx
748 * @pkt: pointer to the pkt to be allocated
749 * @rx_pkt_info: pointer to the allocated pkt meta
750 * @bcn: pointer to the beacon struct
751 * @scan_entry: pointer to the scan cache entry from scan module
752 *
753 * Allocates a cds_pkt for beacon frame in scan cache entry,
754 * fills the essential pkt_meta elements and converts the
755 * pkt to beacon strcut.
756 *
757 * Return: QDF_STATUS
758 */
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400759static QDF_STATUS lim_allocate_and_get_bcn(
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800760 struct mac_context *mac_ctx,
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400761 cds_pkt_t **pkt,
762 uint8_t **rx_pkt_info,
763 tSchBeaconStruct **bcn,
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530764 struct scan_cache_entry *scan_entry)
765{
766 QDF_STATUS status;
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400767 uint8_t *rx_pkt_info_l = NULL;
768 tSchBeaconStruct *bcn_l = NULL;
769 cds_pkt_t *pkt_l = NULL;
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530770
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400771 pkt_l = qdf_mem_malloc(sizeof(cds_pkt_t));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700772 if (!pkt_l)
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530773 return QDF_STATUS_E_FAILURE;
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530774
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400775 status = wma_ds_peek_rx_packet_info(
776 pkt_l, (void *)&rx_pkt_info_l, false);
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530777 if (!QDF_IS_STATUS_SUCCESS(status)) {
778 pe_err("Failed to get Rx Pkt meta");
779 goto free;
780 }
781
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400782 bcn_l = qdf_mem_malloc(sizeof(tSchBeaconStruct));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700783 if (!bcn_l)
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530784 goto free;
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530785
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400786 lim_fill_sap_bcn_pkt_meta(scan_entry, pkt_l);
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530787
788 /* Convert the beacon frame into a structure */
789 if (sir_convert_beacon_frame2_struct(mac_ctx,
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400790 (uint8_t *)rx_pkt_info_l,
791 bcn_l) != QDF_STATUS_SUCCESS) {
792 pe_err("beacon parsing failed");
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530793 goto free;
794 }
795
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400796 *pkt = pkt_l;
797 *bcn = bcn_l;
798 *rx_pkt_info = rx_pkt_info_l;
799
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530800 return QDF_STATUS_SUCCESS;
801
802free:
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400803 if (pkt_l) {
804 qdf_mem_free(pkt_l);
805 pkt_l = NULL;
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530806 }
807
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400808 if (bcn_l) {
809 qdf_mem_free(bcn_l);
810 bcn_l = NULL;
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530811 }
812
813 return QDF_STATUS_E_FAILURE;
814}
815
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530816void lim_handle_sap_beacon(struct wlan_objmgr_pdev *pdev,
817 struct scan_cache_entry *scan_entry)
818{
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800819 struct mac_context *mac_ctx;
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530820 cds_pkt_t *pkt = NULL;
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530821 tSchBeaconStruct *bcn = NULL;
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530822 struct mgmt_beacon_probe_filter *filter;
823 QDF_STATUS status;
824 uint8_t *rx_pkt_info = NULL;
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530825 int session_id;
826
827 if (!scan_entry) {
828 pe_err("scan_entry is NULL");
829 return;
830 }
831
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400832 if (scan_entry->frm_subtype != MGMT_SUBTYPE_BEACON)
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530833 return;
834
835 mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
836 if (!mac_ctx) {
837 pe_err("Failed to get mac_ctx");
838 return;
839 }
840
841 filter = &mac_ctx->bcn_filter;
842
843 if (!filter->num_sap_sessions) {
844 return;
845 }
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530846 for (session_id = 0; session_id < mac_ctx->lim.maxBssId; session_id++) {
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530847 if (filter->sap_channel[session_id] &&
848 (filter->sap_channel[session_id] ==
849 scan_entry->channel.chan_idx)) {
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530850 if (!pkt) {
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400851 status = lim_allocate_and_get_bcn(
852 mac_ctx, &pkt, &rx_pkt_info,
853 &bcn, scan_entry);
854 if (!QDF_IS_STATUS_SUCCESS(status)) {
855 pe_debug("lim_allocate_and_get_bcn fail!");
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530856 return;
Liangwei Dong4bfffb42018-07-27 03:34:27 -0400857 }
Vignesh Viswanathan5ce817e2018-04-16 20:09:11 +0530858 }
859 sch_beacon_process_for_ap(mac_ctx, session_id,
860 rx_pkt_info, bcn);
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530861 }
862 }
863
Vignesh Viswanathan153ae932018-04-11 14:24:13 +0530864 /*
865 * Free only the pkt memory we allocated and not the pkt->pkt_buf.
866 * The actual SKB buffer is freed in the scan module from where
867 * this API is invoked via callback
868 */
869 if (bcn)
870 qdf_mem_free(bcn);
871 if (pkt)
872 qdf_mem_free(pkt);
873}
874
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800875/**
876 * lim_defer_msg()
877 *
878 ***FUNCTION:
879 * This function is called to defer the messages received
880 * during Learn mode
881 *
882 ***LOGIC:
883 * NA
884 *
885 ***ASSUMPTIONS:
886 * NA
887 *
888 ***NOTE:
889 * NA
890 *
Jeff Johnson5cce7a02018-11-22 15:41:15 -0800891 * @param mac - Pointer to Global MAC structure
Rajeev Kumar416b73f2017-01-21 16:45:21 -0800892 * @param pMsg of type struct scheduler_msg - Pointer to the message structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800893 * @return None
894 */
895
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800896uint32_t lim_defer_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800897{
898 uint32_t retCode = TX_SUCCESS;
899
Jeff Johnson5cce7a02018-11-22 15:41:15 -0800900 retCode = lim_write_deferred_msg_q(mac, pMsg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800901
902 if (retCode == TX_SUCCESS) {
903 MTRACE(mac_trace_msg_rx
Jeff Johnson5cce7a02018-11-22 15:41:15 -0800904 (mac, NO_SESSION,
Rachit Kankane0baf6e72018-01-19 15:01:50 +0530905 LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED)));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800906 } else {
Sandeep Puligillad9f88ce2017-04-11 19:41:57 -0700907 pe_err("Dropped lim message (0x%X) Message %s", pMsg->type, lim_msg_str(pMsg->type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800908 MTRACE(mac_trace_msg_rx
Jeff Johnson5cce7a02018-11-22 15:41:15 -0800909 (mac, NO_SESSION,
Rachit Kankane0baf6e72018-01-19 15:01:50 +0530910 LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED)));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800911 }
912
913 return retCode;
914} /*** end lim_defer_msg() ***/
915
916/**
917 * lim_handle_unknown_a2_index_frames() - This function handles Unknown Unicast
918 * (A2 Index) packets
919 * @mac_ctx: Pointer to the Global Mac Context.
920 * @rx_pkt_buffer: Pointer to the packet Buffer descriptor.
921 * @session_entry: Pointer to the PE Session Entry.
922 *
923 * This routine will handle public action frames.
924 *
925 * Return: None.
926 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800927static void lim_handle_unknown_a2_index_frames(struct mac_context *mac_ctx,
Jeff Johnsonb5b235f2018-11-19 06:54:31 -0800928 void *rx_pkt_buffer, struct pe_session *session_entry)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800929{
930#ifdef FEATURE_WLAN_TDLS
931 tpSirMacDataHdr3a mac_hdr;
932#endif
933 if (LIM_IS_P2P_DEVICE_ROLE(session_entry))
934 lim_process_action_frame_no_session(mac_ctx,
935 (uint8_t *) rx_pkt_buffer);
936#ifdef FEATURE_WLAN_TDLS
937 mac_hdr = WMA_GET_RX_MPDUHEADER3A(rx_pkt_buffer);
938
939 if (lim_is_group_addr(mac_hdr->addr2)) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +0530940 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800941 FL("Ignoring A2 Invalid Packet received for MC/BC:"));
Abhishek Singh5d8d7332017-08-10 15:15:24 +0530942 lim_print_mac_addr(mac_ctx, mac_hdr->addr2, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800943 return;
944 }
Abhishek Singh5d8d7332017-08-10 15:15:24 +0530945 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800946 FL("type=0x%x, subtype=0x%x"),
947 mac_hdr->fc.type, mac_hdr->fc.subType);
948 /* Currently only following type and subtype are handled.
949 * If there are more combinations, then add switch-case
950 * statements.
951 */
952 if (LIM_IS_STA_ROLE(session_entry) &&
953 (mac_hdr->fc.type == SIR_MAC_MGMT_FRAME) &&
954 (mac_hdr->fc.subType == SIR_MAC_MGMT_ACTION))
955 lim_process_action_frame(mac_ctx, rx_pkt_buffer, session_entry);
956#endif
957 return;
958}
959
960/**
961 * lim_check_mgmt_registered_frames() - This function handles registered
962 * management frames.
963 *
964 * @mac_ctx: Pointer to the Global Mac Context.
965 * @buff_desc: Pointer to the packet Buffer descriptor.
966 * @session_entry: Pointer to the PE Session Entry.
967 *
968 * This function is called to process to check if received frame match with
969 * any of the registered frame from HDD. If yes pass this frame to SME.
970 *
971 * Return: True or False for Match or Mismatch respectively.
972 */
973static bool
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800974lim_check_mgmt_registered_frames(struct mac_context *mac_ctx, uint8_t *buff_desc,
Jeff Johnsonb5b235f2018-11-19 06:54:31 -0800975 struct pe_session *session_entry)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800976{
977 tSirMacFrameCtl fc;
978 tpSirMacMgmtHdr hdr;
979 uint8_t *body;
980 struct mgmt_frm_reg_info *mgmt_frame = NULL;
981 struct mgmt_frm_reg_info *next_frm = NULL;
982 uint16_t frm_type;
983 uint16_t frm_len;
984 uint8_t type, sub_type;
985 bool match = false;
Anurag Chouhanffb21542016-02-17 14:33:03 +0530986 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800987
988 hdr = WMA_GET_RX_MAC_HEADER(buff_desc);
989 fc = hdr->fc;
990 frm_type = (fc.type << 2) | (fc.subType << 4);
991 body = WMA_GET_RX_MPDU_DATA(buff_desc);
992 frm_len = WMA_GET_RX_PAYLOAD_LEN(buff_desc);
993
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530994 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +0530995 qdf_list_peek_front(&mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
996 (qdf_list_node_t **) &mgmt_frame);
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530997 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800998
999 while (mgmt_frame != NULL) {
1000 type = (mgmt_frame->frameType >> 2) & 0x03;
1001 sub_type = (mgmt_frame->frameType >> 4) & 0x0f;
1002 if ((type == SIR_MAC_MGMT_FRAME)
1003 && (fc.type == SIR_MAC_MGMT_FRAME)
1004 && (sub_type == SIR_MAC_MGMT_RESERVED15)) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05301005 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001006 FL
1007 ("rcvd frm match for SIR_MAC_MGMT_RESERVED15"));
1008 match = true;
1009 break;
1010 }
1011 if (mgmt_frame->frameType == frm_type) {
1012 if (mgmt_frame->matchLen <= 0) {
1013 match = true;
1014 break;
1015 }
1016 if (mgmt_frame->matchLen <= frm_len &&
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301017 (!qdf_mem_cmp(mgmt_frame->matchData, body,
1018 mgmt_frame->matchLen))) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001019 /* found match! */
1020 match = true;
1021 break;
1022 }
1023 }
1024
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301025 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +05301026 qdf_status =
1027 qdf_list_peek_next(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001028 &mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
Anurag Chouhanffb21542016-02-17 14:33:03 +05301029 (qdf_list_node_t *) mgmt_frame,
1030 (qdf_list_node_t **) &next_frm);
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301031 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001032 mgmt_frame = next_frm;
1033 next_frm = NULL;
1034 }
1035
1036 if (match) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05301037 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001038 FL("rcvd frame match with registered frame params"));
1039 /* Indicate this to SME */
1040 lim_send_sme_mgmt_frame_ind(mac_ctx, hdr->fc.subType,
1041 (uint8_t *) hdr,
1042 WMA_GET_RX_PAYLOAD_LEN(buff_desc) +
1043 sizeof(tSirMacMgmtHdr), mgmt_frame->sessionId,
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +05301044 WMA_GET_RX_CH(buff_desc), session_entry,
1045 WMA_GET_RX_RSSI_NORMALIZED(buff_desc));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001046
1047 if ((type == SIR_MAC_MGMT_FRAME)
1048 && (fc.type == SIR_MAC_MGMT_FRAME)
1049 && (sub_type == SIR_MAC_MGMT_RESERVED15))
1050 /* These packets needs to be processed by PE/SME
1051 * as well as HDD.If it returns true here,
1052 * the packet is forwarded to HDD only.
1053 */
1054 match = false;
1055 }
1056
1057 return match;
1058}
1059
Krunal Sonic65fc492018-03-09 15:53:28 -08001060#ifdef FEATURE_WLAN_DIAG_SUPPORT
1061/**
1062 * lim_is_mgmt_frame_loggable() - to log non-excessive mgmt frames
1063 * @type: type of frames i.e. mgmt, control, data
1064 * @subtype: subtype of frames i.e. beacon, probe rsp, probe req and etc
1065 *
1066 * This API tells if given mgmt frame is expected to come excessive in
1067 * amount or not.
1068 *
1069 * Return: true if mgmt is expected to come not that often, so makes it
1070 * loggable. false if mgmt is expected to come too often, so makes
1071 * it not loggable
1072 */
1073static bool
1074lim_is_mgmt_frame_loggable(uint8_t type, uint8_t subtype)
1075{
1076 if (type != SIR_MAC_MGMT_FRAME)
1077 return false;
1078
1079 switch (subtype) {
1080 case SIR_MAC_MGMT_BEACON:
1081 case SIR_MAC_MGMT_PROBE_REQ:
1082 case SIR_MAC_MGMT_PROBE_RSP:
1083 return false;
1084 default:
1085 return true;
1086 }
1087}
1088#else
1089static bool
1090lim_is_mgmt_frame_loggable(uint8_t type, uint8_t subtype)
1091{
1092 return false;
1093}
1094#endif
1095
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001096/**
1097 * lim_handle80211_frames()
1098 *
1099 ***FUNCTION:
1100 * This function is called to process 802.11 frames
1101 * received by LIM.
1102 *
1103 ***LOGIC:
1104 * NA
1105 *
1106 ***ASSUMPTIONS:
1107 * NA
1108 *
1109 ***NOTE:
1110 * NA
1111 *
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001112 * @param mac - Pointer to Global MAC structure
Rajeev Kumar416b73f2017-01-21 16:45:21 -08001113 * @param pMsg of type struct scheduler_msg - Pointer to the message structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001114 * @return None
1115 */
1116
1117static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001118lim_handle80211_frames(struct mac_context *mac, struct scheduler_msg *limMsg,
Rajeev Kumarfeb96382017-01-22 19:42:09 -08001119 uint8_t *pDeferMsg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001120{
1121 uint8_t *pRxPacketInfo = NULL;
1122 tSirMacFrameCtl fc;
1123 tpSirMacMgmtHdr pHdr = NULL;
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001124 struct pe_session *pe_session = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001125 uint8_t sessionId;
Srinivas Girigowda74a66d62017-06-21 23:28:25 -07001126 bool isFrmFt = false;
Jingxiang Ge6c9352f2017-10-26 11:27:36 +08001127 uint8_t channel;
1128 bool is_hw_sbs_capable = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001129
1130 *pDeferMsg = false;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001131 lim_get_b_dfrom_rx_packet(mac, limMsg->bodyptr,
Anurag Chouhanffb21542016-02-17 14:33:03 +05301132 (uint32_t **) &pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001133
1134 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1135 isFrmFt = WMA_GET_RX_FT_DONE(pRxPacketInfo);
Jingxiang Ge6c9352f2017-10-26 11:27:36 +08001136 channel = WMA_GET_RX_CH(pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001137 fc = pHdr->fc;
1138
Jingxiang Ge6c9352f2017-10-26 11:27:36 +08001139 is_hw_sbs_capable =
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001140 policy_mgr_is_hw_sbs_capable(mac->psoc);
Jingxiang Ge6c9352f2017-10-26 11:27:36 +08001141 if (IS_5G_CH(channel) &&
1142 (!is_hw_sbs_capable ||
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001143 (is_hw_sbs_capable && wlan_reg_is_dfs_ch(mac->pdev, channel))) &&
1144 mac->sap.SapDfsInfo.is_dfs_cac_timer_running) {
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001145 pe_session = pe_find_session_by_bssid(mac,
Krishna Kumaar Natarajanb7f9a352016-03-18 11:40:07 -07001146 pHdr->bssId, &sessionId);
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001147 if (pe_session &&
1148 (QDF_SAP_MODE == pe_session->pePersona)) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001149 pe_debug("CAC timer running - drop the frame");
Krishna Kumaar Natarajanb7f9a352016-03-18 11:40:07 -07001150 goto end;
1151 }
1152 }
1153
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001154#ifdef WLAN_DUMP_MGMTFRAMES
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001155 pe_debug("ProtVersion %d, Type %d, Subtype %d rateIndex=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001156 fc.protVer, fc.type, fc.subType,
1157 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301158 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, pHdr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001159 WMA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
1160#endif
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001161 if (mac->mlme_cfg->gen.debug_packet_log & 0x1) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001162 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
1163 (fc.subType != SIR_MAC_MGMT_PROBE_REQ) &&
1164 (fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
1165 (fc.subType != SIR_MAC_MGMT_BEACON)) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001166 pe_debug("RX MGMT - Type %hu, SubType %hu, seq num[%d]",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001167 fc.type,
1168 fc.subType,
1169 ((pHdr->seqControl.seqNumHi <<
1170 HIGH_SEQ_NUM_OFFSET) |
1171 pHdr->seqControl.seqNumLo));
1172 }
1173 }
1174#ifdef FEATURE_WLAN_EXTSCAN
1175 if (WMA_IS_EXTSCAN_SCAN_SRC(pRxPacketInfo) ||
1176 WMA_IS_EPNO_SCAN_SRC(pRxPacketInfo)) {
1177 if (fc.subType == SIR_MAC_MGMT_BEACON ||
1178 fc.subType == SIR_MAC_MGMT_PROBE_RSP) {
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001179 __lim_process_ext_scan_beacon_probe_rsp(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001180 pRxPacketInfo,
1181 fc.subType);
1182 } else {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001183 pe_err("Wrong frameType %d, Subtype %d for %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001184 fc.type, fc.subType,
1185 WMA_GET_SCAN_SRC(pRxPacketInfo));
1186 }
1187 goto end;
1188 }
1189#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001190 /* Added For BT-AMP Support */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001191 pe_session = pe_find_session_by_bssid(mac, pHdr->bssId,
Anurag Chouhanffb21542016-02-17 14:33:03 +05301192 &sessionId);
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001193 if (pe_session == NULL) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001194 if (fc.subType == SIR_MAC_MGMT_AUTH) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001195 pe_debug("ProtVersion %d, Type %d, Subtype %d rateIndex=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001196 fc.protVer, fc.type, fc.subType,
1197 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001198 lim_print_mac_addr(mac, pHdr->bssId, LOGD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001199 if (lim_process_auth_frame_no_session
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001200 (mac, pRxPacketInfo,
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001201 limMsg->bodyptr) == QDF_STATUS_SUCCESS) {
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001202 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001203 }
1204 }
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001205 /* Public action frame can be received from non-assoc stations*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001206 if ((fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
1207 (fc.subType != SIR_MAC_MGMT_BEACON) &&
1208 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001209 && (fc.subType != SIR_MAC_MGMT_ACTION)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001210
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001211 pe_session = pe_find_session_by_peer_sta(mac,
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001212 pHdr->sa, &sessionId);
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001213 if (pe_session == NULL) {
Abhishek Singh154637a2017-06-19 18:02:11 +05301214 pe_debug("session does not exist for bssId");
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001215 lim_print_mac_addr(mac, pHdr->sa, LOGD);
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001216 goto end;
1217 } else {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001218 pe_debug("SessionId:%d exists for given Bssid",
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001219 pe_session->peSessionId);
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001220 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001221 }
1222 /* For p2p resp frames search for valid session with DA as */
1223 /* BSSID will be SA and session will be present with DA only */
1224 if (fc.subType == SIR_MAC_MGMT_ACTION) {
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001225 pe_session =
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001226 pe_find_session_by_bssid(mac, pHdr->da, &sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001227 }
1228 }
1229
1230 /* Check if frame is registered by HDD */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001231 if (lim_check_mgmt_registered_frames(mac, pRxPacketInfo, pe_session)) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001232 pe_debug("Received frame is passed to SME");
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001233 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001234 }
1235
1236 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION) { /* Received Frame with non-zero Protocol Version */
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001237 pe_err("Unexpected frame with protVersion %d received",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001238 fc.protVer);
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001239 lim_pkt_free(mac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001240 (void *)limMsg->bodyptr);
1241#ifdef WLAN_DEBUG
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001242 mac->lim.numProtErr++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001243#endif
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -07001244 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001245 }
1246
1247/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
1248
1249#ifdef WLAN_DEBUG
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001250 mac->lim.numMAC[fc.type][fc.subType]++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001251#endif
1252
1253 switch (fc.type) {
1254 case SIR_MAC_MGMT_FRAME:
1255 {
1256 /* Received Management frame */
1257 switch (fc.subType) {
1258 case SIR_MAC_MGMT_ASSOC_REQ:
1259 /* Make sure the role supports Association */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001260 if (LIM_IS_AP_ROLE(pe_session))
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001261 lim_process_assoc_req_frame(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001262 pRxPacketInfo,
1263 LIM_ASSOC,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001264 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001265 else {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001266 pe_err("unexpected message received %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001267 limMsg->type);
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001268 lim_print_msg_name(mac, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001269 limMsg->type);
1270 }
1271 break;
1272
1273 case SIR_MAC_MGMT_ASSOC_RSP:
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001274 lim_process_assoc_rsp_frame(mac, pRxPacketInfo,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001275 LIM_ASSOC,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001276 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001277 break;
1278
1279 case SIR_MAC_MGMT_REASSOC_REQ:
1280 /* Make sure the role supports Reassociation */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001281 if (LIM_IS_AP_ROLE(pe_session)) {
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001282 lim_process_assoc_req_frame(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001283 pRxPacketInfo,
1284 LIM_REASSOC,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001285 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001286 } else {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001287 pe_err("unexpected message received %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001288 limMsg->type);
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001289 lim_print_msg_name(mac, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001290 limMsg->type);
1291 }
1292 break;
1293
1294 case SIR_MAC_MGMT_REASSOC_RSP:
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001295 lim_process_assoc_rsp_frame(mac, pRxPacketInfo,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001296 LIM_REASSOC,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001297 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001298 break;
1299
1300 case SIR_MAC_MGMT_PROBE_REQ:
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001301 lim_process_probe_req_frame_multiple_bss(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001302 pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001303 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001304 break;
1305
1306 case SIR_MAC_MGMT_PROBE_RSP:
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001307 if (pe_session)
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001308 lim_process_probe_rsp_frame(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001309 pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001310 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001311 break;
1312
1313 case SIR_MAC_MGMT_BEACON:
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001314 __lim_handle_beacon(mac, limMsg, pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001315 break;
1316
1317 case SIR_MAC_MGMT_DISASSOC:
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001318 lim_process_disassoc_frame(mac, pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001319 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001320 break;
1321
1322 case SIR_MAC_MGMT_AUTH:
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001323 lim_process_auth_frame(mac, pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001324 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001325 break;
1326
1327 case SIR_MAC_MGMT_DEAUTH:
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001328 lim_process_deauth_frame(mac, pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001329 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001330 break;
1331
1332 case SIR_MAC_MGMT_ACTION:
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001333 if (pe_session == NULL)
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001334 lim_process_action_frame_no_session(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001335 pRxPacketInfo);
1336 else {
1337 if (WMA_GET_RX_UNKNOWN_UCAST
1338 (pRxPacketInfo))
1339 lim_handle_unknown_a2_index_frames
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001340 (mac, pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001341 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001342 else
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001343 lim_process_action_frame(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001344 pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001345 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001346 }
1347 break;
1348 default:
1349 /* Received Management frame of 'reserved' subtype */
1350 break;
1351 } /* switch (fc.subType) */
1352
1353 }
1354 break;
1355 case SIR_MAC_DATA_FRAME:
1356 {
1357 }
1358 break;
1359 default:
1360 /* Received frame of type 'reserved' */
1361 break;
1362
1363 } /* switch (fc.type) */
Krunal Sonic65fc492018-03-09 15:53:28 -08001364 if (lim_is_mgmt_frame_loggable(fc.type, fc.subType))
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001365 lim_diag_mgmt_rx_event_report(mac, pHdr,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001366 pe_session,
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001367 QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001368end:
Jeff Johnson5cce7a02018-11-22 15:41:15 -08001369 lim_pkt_free(mac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370 (void *)limMsg->bodyptr);
1371 return;
1372} /*** end lim_handle80211_frames() ***/
1373
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001374void lim_process_abort_scan_ind(struct mac_context *mac_ctx,
Abhishek Singh9fabbbb2018-01-29 17:38:36 +05301375 uint8_t vdev_id, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001376{
Abhishek Singh9fabbbb2018-01-29 17:38:36 +05301377 QDF_STATUS status;
1378 struct scan_cancel_request *req;
1379 struct wlan_objmgr_vdev *vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001380
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001381 pe_debug("scan_id %d, scan_requestor_id 0x%x",
Abhishek Singh9fabbbb2018-01-29 17:38:36 +05301382 scan_id, scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001383
Abhishek Singh9fabbbb2018-01-29 17:38:36 +05301384 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
1385 mac_ctx->psoc, vdev_id,
1386 WLAN_LEGACY_MAC_ID);
1387 if (!vdev) {
1388 pe_debug("vdev is NULL");
1389 return;
1390 }
1391
1392 req = qdf_mem_malloc(sizeof(*req));
Arif Hussainf5b6c412018-10-10 19:41:09 -07001393 if (!req)
Abhishek Singh9fabbbb2018-01-29 17:38:36 +05301394 goto fail;
Abhishek Singh9fabbbb2018-01-29 17:38:36 +05301395
1396 req->vdev = vdev;
1397 req->cancel_req.requester = scan_requestor_id;
1398 req->cancel_req.scan_id = scan_id;
1399 req->cancel_req.vdev_id = vdev_id;
1400 req->cancel_req.req_type = WLAN_SCAN_CANCEL_SINGLE;
1401
1402 status = ucfg_scan_cancel(req);
1403 if (QDF_IS_STATUS_ERROR(status))
1404 pe_err("Cancel scan request failed");
1405
1406fail:
1407 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001408}
1409
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001410static void lim_process_sme_obss_scan_ind(struct mac_context *mac_ctx,
Rajeev Kumarfeb96382017-01-22 19:42:09 -08001411 struct scheduler_msg *msg)
Sandeep Puligillae0875662016-02-12 16:09:21 -08001412{
Jeff Johnson0f99bd82018-11-18 18:42:12 -08001413 struct pe_session *session;
Sandeep Puligillae0875662016-02-12 16:09:21 -08001414 uint8_t session_id;
1415 struct sme_obss_ht40_scanind_msg *ht40_scanind;
1416
1417 ht40_scanind = (struct sme_obss_ht40_scanind_msg *)msg->bodyptr;
1418 session = pe_find_session_by_bssid(mac_ctx,
1419 ht40_scanind->mac_addr.bytes, &session_id);
1420 if (session == NULL) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05301421 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Sandeep Puligillae0875662016-02-12 16:09:21 -08001422 "OBSS Scan not started: session id is NULL");
1423 return;
1424 }
1425 if (session->htSupportedChannelWidthSet ==
1426 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05301427 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Sandeep Puligillae0875662016-02-12 16:09:21 -08001428 "OBSS Scan Start Req: session id %d"
1429 "htSupportedChannelWidthSet %d",
1430 session->peSessionId,
1431 session->htSupportedChannelWidthSet);
1432 lim_send_ht40_obss_scanind(mac_ctx, session);
1433 } else {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05301434 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
Sandeep Puligillae0875662016-02-12 16:09:21 -08001435 "OBSS Scan not started: channel width - %d session %d",
1436 session->htSupportedChannelWidthSet,
1437 session->peSessionId);
1438 }
1439 return;
1440}
1441
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001442/**
1443 * lim_process_messages() - Process messages from upper layers.
1444 *
Ankit Guptafef4c022016-09-26 12:11:30 -07001445 * @mac_ctx: Pointer to the Global Mac Context.
1446 * @msg: Received message.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001447 *
1448 * Return: None.
1449 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001450static void lim_process_messages(struct mac_context *mac_ctx,
Rajeev Kumarfeb96382017-01-22 19:42:09 -08001451 struct scheduler_msg *msg)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001452{
1453#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1454 uint8_t vdev_id = 0;
1455 tUpdateBeaconParams beacon_params;
1456#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1457 uint8_t i;
Jeff Johnsonb5b235f2018-11-19 06:54:31 -08001458 struct pe_session *session_entry = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001459 uint8_t defer_msg = false;
1460 tLinkStateParams *link_state_param;
1461 uint16_t pkt_len = 0;
1462 cds_pkt_t *body_ptr = NULL;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301463 QDF_STATUS qdf_status;
Rajeev Kumarcf7bd802017-04-18 11:11:42 -07001464 struct scheduler_msg new_msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001465
1466#ifdef FEATURE_WLAN_TDLS
jiad7b8a5e02018-11-26 16:37:57 +08001467 uint8_t session_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001468 tSirTdlsInd *tdls_ind = NULL;
1469 tpDphHashNode sta_ds = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001470#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001471 if (msg == NULL) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001472 pe_err("Message pointer is Null");
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301473 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001474 return;
1475 }
Pragaspathi Thilagarajb4b7aae2018-05-22 18:28:17 +05301476
1477 if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) {
1478 qdf_mem_free(msg->bodyptr);
1479 msg->bodyptr = NULL;
1480 return;
1481 }
1482
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001483#ifdef WLAN_DEBUG
1484 mac_ctx->lim.numTot++;
1485#endif
Sreelakshmi Konamki544e33b2016-08-17 15:08:48 +05301486 /*
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301487 * MTRACE logs not captured for events received from SME
1488 * SME enums (eWNI_SME_START_REQ) starts with 0x16xx.
1489 * Compare received SME events with SIR_SME_MODULE_ID
Sreelakshmi Konamki544e33b2016-08-17 15:08:48 +05301490 */
Sreelakshmi Konamki075431a2017-03-16 15:23:30 +05301491 if ((SIR_SME_MODULE_ID ==
1492 (uint8_t)MAC_TRACE_GET_MODULE_ID(msg->type)) &&
1493 (msg->type != eWNI_SME_REGISTER_MGMT_FRAME_REQ)) {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301494 MTRACE(mac_trace(mac_ctx, TRACE_CODE_RX_SME_MSG,
1495 NO_SESSION, msg->type));
1496 } else {
1497 /*
1498 * Omitting below message types as these are too frequent
1499 * and when crash happens we loose critical trace logs
1500 * if these are also logged
1501 */
1502 if (msg->type != SIR_CFG_PARAM_UPDATE_IND &&
Sreelakshmi Konamki075431a2017-03-16 15:23:30 +05301503 msg->type != SIR_BB_XPORT_MGMT_MSG &&
1504 msg->type != WMA_RX_SCAN_EVENT)
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301505 MTRACE(mac_trace_msg_rx(mac_ctx, NO_SESSION,
1506 LIM_TRACE_MAKE_RXMSG(msg->type,
Rachit Kankane0baf6e72018-01-19 15:01:50 +05301507 LIM_MSG_PROCESSED)));
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301508 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001509
1510 switch (msg->type) {
1511
1512 case SIR_LIM_UPDATE_BEACON:
1513 lim_update_beacon(mac_ctx);
1514 break;
1515 case SIR_CFG_PARAM_UPDATE_IND:
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05301516 if (!lim_is_system_in_scan_state(mac_ctx))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001517 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001518 /* System is in DFS (Learn) mode.
Jeff Johnson47d75242018-05-12 15:58:53 -07001519 * Defer processing this message
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001520 */
1521 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
1522 if (!(mac_ctx->lim.deferredMsgCnt & 0xF))
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301523 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001524 FL("Unable to Defer Msg"));
1525 lim_log_session_states(mac_ctx);
1526 lim_print_msg_name(mac_ctx, LOGE, msg->type);
1527 }
1528 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001529 case WMA_SWITCH_CHANNEL_RSP:
1530 lim_process_switch_channel_rsp(mac_ctx, msg->bodyptr);
1531 msg->bodyptr = NULL;
1532 break;
1533#ifdef ANI_SIR_IBSS_PEER_CACHING
1534 case WMA_IBSS_STA_ADD:
1535 lim_ibss_sta_add(mac_ctx, msg->bodyptr);
1536 break;
1537#endif
1538 case SIR_BB_XPORT_MGMT_MSG:
1539 /* These messages are from Peer MAC entity. */
1540#ifdef WLAN_DEBUG
1541 mac_ctx->lim.numBbt++;
1542#endif
1543 /* The original msg which we were deferring have the
1544 * bodyPointer point to 'BD' instead of 'cds pkt'. If we
1545 * don't make a copy of msg, then overwrite the
1546 * msg->bodyPointer and next time when we try to
1547 * process the msg, we will try to use 'BD' as
1548 * 'cds Pkt' which will cause a crash
1549 */
1550 if (msg->bodyptr == NULL) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001551 pe_err("Message bodyptr is Null");
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301552 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001553 break;
1554 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301555 qdf_mem_copy((uint8_t *) &new_msg,
Rajeev Kumar416b73f2017-01-21 16:45:21 -08001556 (uint8_t *) msg, sizeof(struct scheduler_msg));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001557 body_ptr = (cds_pkt_t *) new_msg.bodyptr;
1558 cds_pkt_get_packet_length(body_ptr, &pkt_len);
1559
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301560 qdf_status = wma_ds_peek_rx_packet_info(body_ptr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001561 (void **) &new_msg.bodyptr, false);
1562
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301563 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Sreelakshmi Konamki6d478cd2017-03-28 11:59:25 +05301564 lim_decrement_pending_mgmt_count(mac_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001565 cds_pkt_return_packet(body_ptr);
1566 break;
1567 }
Abhinav Kumar5670d362018-01-16 17:31:54 +05301568 if (WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr))
1569 pe_debug("roamCandidateInd: %d",
1570 WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr));
1571 if (WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr))
1572 pe_debug("offloadScanLearn: %d",
1573 WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001574
1575 lim_handle80211_frames(mac_ctx, &new_msg, &defer_msg);
1576
1577 if (defer_msg == true) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05301578 QDF_TRACE(QDF_MODULE_ID_PE, LOGD,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001579 FL("Defer Msg type=%x"), msg->type);
1580 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301581 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001582 FL("Unable to Defer Msg"));
1583 lim_log_session_states(mac_ctx);
Sreelakshmi Konamki6d478cd2017-03-28 11:59:25 +05301584 lim_decrement_pending_mgmt_count(mac_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001585 cds_pkt_return_packet(body_ptr);
1586 }
Sreelakshmi Konamki6d478cd2017-03-28 11:59:25 +05301587 } else {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001588 /* PE is not deferring this 802.11 frame so we need to
1589 * call cds_pkt_return. Asumption here is when Rx mgmt
1590 * frame processing is done, cds packet could be
1591 * freed here.
1592 */
Sreelakshmi Konamki6d478cd2017-03-28 11:59:25 +05301593 lim_decrement_pending_mgmt_count(mac_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001594 cds_pkt_return_packet(body_ptr);
Sreelakshmi Konamki6d478cd2017-03-28 11:59:25 +05301595 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001596 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001597 case eWNI_SME_DISASSOC_REQ:
1598 case eWNI_SME_DEAUTH_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001599#ifdef FEATURE_WLAN_TDLS
1600 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1601 case eWNI_SME_TDLS_ADD_STA_REQ:
1602 case eWNI_SME_TDLS_DEL_STA_REQ:
1603 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
1604#endif
1605 case eWNI_SME_RESET_AP_CAPS_CHANGED:
1606 case eWNI_SME_SET_HW_MODE_REQ:
1607 case eWNI_SME_SET_DUAL_MAC_CFG_REQ:
Archana Ramachandrana20ef812015-11-13 16:12:13 -08001608 case eWNI_SME_SET_ANTENNA_MODE_REQ:
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +05301609 case eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE:
Naveen Rawat8029a402017-06-01 10:54:19 -07001610 case eWNI_SME_UPDATE_CONFIG:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001611 /* These messages are from HDD. Need to respond to HDD */
1612 lim_process_normal_hdd_msg(mac_ctx, msg, true);
1613 break;
Kondabattini, Ganesh3f2d02c2016-09-13 12:23:47 +05301614 case eWNI_SME_SEND_DISASSOC_FRAME:
1615 /* Need to response to hdd */
1616 lim_process_normal_hdd_msg(mac_ctx, msg, true);
1617 break;
Kiran Kumar Lokere666bf852016-05-02 12:23:02 -07001618 case eWNI_SME_PDEV_SET_HT_VHT_IE:
Naveen Rawata410c5a2016-09-19 14:22:33 -07001619 case eWNI_SME_SET_VDEV_IES_PER_BAND:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001620 case eWNI_SME_SYS_READY_IND:
1621 case eWNI_SME_JOIN_REQ:
1622 case eWNI_SME_REASSOC_REQ:
1623 case eWNI_SME_START_BSS_REQ:
1624 case eWNI_SME_STOP_BSS_REQ:
1625 case eWNI_SME_SWITCH_CHL_IND:
1626 case eWNI_SME_SETCONTEXT_REQ:
1627 case eWNI_SME_DISASSOC_CNF:
1628 case eWNI_SME_DEAUTH_CNF:
1629 case eWNI_SME_ASSOC_CNF:
1630 case eWNI_SME_ADDTS_REQ:
1631 case eWNI_SME_DELTS_REQ:
1632 case eWNI_SME_GET_ASSOC_STAS_REQ:
Selvaraj, Sridhar7231c5f2016-09-28 12:42:33 +05301633 case eWNI_SME_SESSION_UPDATE_PARAM:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001634 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001635 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1636 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001637#if defined FEATURE_WLAN_ESE
1638 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
1639#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001640 case eWNI_SME_FT_UPDATE_KEY:
1641 case eWNI_SME_FT_PRE_AUTH_REQ:
1642 case eWNI_SME_FT_AGGR_QOS_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001643 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001644 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
1645 case eWNI_SME_GET_STATISTICS_REQ:
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001646#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001647 case eWNI_SME_GET_TSM_STATS_REQ:
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001648#endif /* FEATURE_WLAN_ESE */
Abhishek Singh7996eb72015-12-30 17:24:02 +05301649 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
Abhishek Singh518323d2015-10-19 17:42:01 +05301650 case eWNI_SME_EXT_CHANGE_CHANNEL:
Paul Zhang624f88d2018-11-07 15:29:45 +08001651 case eWNI_SME_ROAM_INVOKE:
1652 /* fall through */
Selvaraj, Sridhar01741822016-08-30 18:26:19 +05301653 case eWNI_SME_ROAM_SCAN_OFFLOAD_REQ:
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -08001654 case eWNI_SME_SET_ADDBA_ACCEPT:
Arif Hussaineb8ba362018-03-07 19:15:13 -08001655 case eWNI_SME_UPDATE_EDCA_PROFILE:
Kiran Kumar Lokere1dbf7222018-09-20 19:46:56 -07001656 case WNI_SME_UPDATE_MU_EDCA_PARAMS:
Kiran Kumar Lokereee205772018-09-27 00:27:27 -07001657 case WNI_SME_CFG_ACTION_FRM_HE_TB_PPDU:
Deepak Dhamdhere0f076bd2016-06-02 11:29:21 -07001658 /* These messages are from HDD.No need to respond to HDD */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001659 lim_process_normal_hdd_msg(mac_ctx, msg, false);
1660 break;
Padma, Santhosh Kumar22c462c2018-01-16 17:56:44 +05301661 case eWNI_SME_SEND_MGMT_FRAME_TX:
1662 lim_send_mgmt_frame_tx(mac_ctx, msg);
1663 qdf_mem_free(msg->bodyptr);
1664 msg->bodyptr = NULL;
1665 break;
Manjunathappa Prakash0e6e6b52016-04-21 11:48:48 -07001666 case eWNI_SME_MON_INIT_SESSION:
1667 lim_mon_init_session(mac_ctx, msg->bodyptr);
1668 qdf_mem_free(msg->bodyptr);
1669 msg->bodyptr = NULL;
1670 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001671#ifdef FEATURE_WLAN_TDLS
1672 case SIR_HAL_TDLS_IND:
1673 tdls_ind = (tpSirTdlsInd) msg->bodyptr;
1674 session_entry = pe_find_session_by_sta_id(mac_ctx,
1675 tdls_ind->staIdx, &session_id);
1676 if (session_entry == NULL) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05301677 pe_debug("No session exist for given bssId");
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301678 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001679 msg->bodyptr = NULL;
1680 return;
1681 }
1682 sta_ds = dph_get_hash_entry(mac_ctx, tdls_ind->assocId,
1683 &session_entry->dph.dphHashTable);
1684 if (sta_ds == NULL) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001685 pe_debug("No sta_ds exist for given staId");
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301686 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001687 msg->bodyptr = NULL;
1688 return;
1689 }
1690
1691 if (STA_ENTRY_TDLS_PEER == sta_ds->staType) {
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001692 pe_err("rcvd TDLS IND from FW with RC %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001693 tdls_ind->reasonCode);
1694 lim_send_sme_tdls_del_sta_ind(mac_ctx, sta_ds,
1695 session_entry, tdls_ind->reasonCode);
1696 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301697 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001698 msg->bodyptr = NULL;
1699 break;
1700#endif
1701 case SIR_HAL_P2P_NOA_ATTR_IND:
1702 session_entry = &mac_ctx->lim.gpSession[0];
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001703 pe_debug("Received message Noa_ATTR %x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001704 msg->type);
1705 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1706 session_entry = &mac_ctx->lim.gpSession[i];
1707 if ((session_entry != NULL) && (session_entry->valid)
1708 && (session_entry->pePersona ==
Anurag Chouhan6d760662016-02-20 16:05:43 +05301709 QDF_P2P_GO_MODE)) { /* Save P2P attr for Go */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301710 qdf_mem_copy(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001711 &session_entry->p2pGoPsUpdate,
1712 msg->bodyptr,
1713 sizeof(tSirP2PNoaAttr));
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001714 pe_debug("bssId"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001715 MAC_ADDRESS_STR
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001716 " ctWin=%d oppPsFlag=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001717 MAC_ADDR_ARRAY(
1718 session_entry->bssId),
1719 session_entry->p2pGoPsUpdate.ctWin,
1720 session_entry->p2pGoPsUpdate.oppPsFlag);
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001721 pe_debug("uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001722 session_entry->p2pGoPsUpdate.uNoa1IntervalCnt,
1723 session_entry->p2pGoPsUpdate.uNoa1Duration,
1724 session_entry->p2pGoPsUpdate.uNoa1Interval,
1725 session_entry->p2pGoPsUpdate.uNoa1StartTime);
1726 break;
1727 }
1728 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301729 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001730 msg->bodyptr = NULL;
1731 break;
1732 case WMA_MISSED_BEACON_IND:
1733 lim_ps_offload_handle_missed_beacon_ind(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301734 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001735 msg->bodyptr = NULL;
1736 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001737 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1738 lim_process_sme_req_messages(mac_ctx, msg);
1739 break;
1740#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001741 case WMA_TSM_STATS_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001742 lim_send_sme_pe_ese_tsm_rsp(mac_ctx,
1743 (tAniGetTsmStatsRsp *) msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001744 break;
1745#endif
1746 case WMA_ADD_TS_RSP:
1747 lim_process_hal_add_ts_rsp(mac_ctx, msg);
1748 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001749 case SIR_LIM_BEACON_GEN_IND:
1750 if (mac_ctx->lim.gLimSystemRole != eLIM_AP_ROLE)
Abhishek Singhfc740be2018-10-12 11:34:26 +05301751 sch_process_pre_beacon_ind(mac_ctx,
1752 msg, REASON_DEFAULT);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001753 break;
1754 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1755 lim_delete_sta_context(mac_ctx, msg);
1756 break;
Jinwei Chen1850d9c2018-08-20 15:59:06 +08001757 case SIR_LIM_RX_INVALID_PEER:
1758 lim_rx_invalid_peer_process(mac_ctx, msg);
1759 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001760 case SIR_LIM_JOIN_FAIL_TIMEOUT:
1761 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
1762 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1763 case SIR_LIM_AUTH_RSP_TIMEOUT:
1764 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1765 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001766 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001767 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1768 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
1769 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +05301770 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +05301771 case SIR_LIM_AUTH_SAE_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001772 /* These timeout messages are handled by MLM sub module */
1773 lim_process_mlm_req_messages(mac_ctx, msg);
1774 break;
1775 case SIR_LIM_HEART_BEAT_TIMEOUT:
1776 /** check if heart beat failed, even if one Beacon
1777 * is rcvd within the Heart Beat interval continue
1778 * normal processing
1779 */
1780 if (NULL == msg->bodyptr)
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001781 pe_err("Can't Process HB TO - bodyptr is Null");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001782 else {
Jeff Johnsonb5b235f2018-11-19 06:54:31 -08001783 session_entry = (struct pe_session *) msg->bodyptr;
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001784 pe_err("SIR_LIM_HEART_BEAT_TIMEOUT, Session %d",
Jeff Johnsonb5b235f2018-11-19 06:54:31 -08001785 ((struct pe_session *) msg->bodyptr)->peSessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001786 limResetHBPktCount(session_entry);
1787 lim_handle_heart_beat_timeout_for_session(mac_ctx,
1788 session_entry);
1789 }
1790 break;
1791 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1792 lim_handle_heart_beat_failure_timeout(mac_ctx);
1793 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001794 case SIR_LIM_CNF_WAIT_TIMEOUT:
1795 /* Does not receive CNF or dummy packet */
1796 lim_handle_cnf_wait_timeout(mac_ctx, (uint16_t) msg->bodyval);
1797 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001798 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1799 lim_process_channel_switch_timeout(mac_ctx);
1800 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001801 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1802 lim_handle_update_olbc_cache(mac_ctx);
1803 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001804 case WMA_ADD_BSS_RSP:
1805 lim_process_mlm_add_bss_rsp(mac_ctx, msg);
1806 break;
Kiran Kumar Lokere5798bfa2017-04-27 20:49:39 -07001807 case WMA_HIDDEN_SSID_RESTART_RSP:
1808 lim_process_mlm_update_hidden_ssid_rsp(mac_ctx, msg);
1809 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001810 case WMA_ADD_STA_RSP:
1811 lim_process_add_sta_rsp(mac_ctx, msg);
1812 break;
1813 case WMA_DELETE_STA_RSP:
1814 lim_process_mlm_del_sta_rsp(mac_ctx, msg);
1815 break;
1816 case WMA_DELETE_BSS_RSP:
Deepak Dhamdhere2dae1bd2016-10-27 10:58:29 -07001817 case WMA_DELETE_BSS_HO_FAIL_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001818 lim_handle_delete_bss_rsp(mac_ctx, msg);
1819 break;
1820 case WMA_CSA_OFFLOAD_EVENT:
Manishekar Chandrasekarancb052172016-04-22 12:19:04 +05301821 lim_handle_csa_offload_msg(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001822 break;
1823 case WMA_SET_BSSKEY_RSP:
1824 case WMA_SET_STA_BCASTKEY_RSP:
1825 lim_process_mlm_set_bss_key_rsp(mac_ctx, msg);
1826 break;
1827 case WMA_SET_STAKEY_RSP:
1828 lim_process_mlm_set_sta_key_rsp(mac_ctx, msg);
1829 break;
1830 case WMA_GET_STATISTICS_RSP:
1831 lim_send_sme_pe_statistics_rsp(mac_ctx, msg->type,
1832 (void *)msg->bodyptr);
1833 break;
1834 case WMA_SET_MIMOPS_RSP:
1835 case WMA_SET_TX_POWER_RSP:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301836 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001837 msg->bodyptr = NULL;
1838 break;
1839 case WMA_SET_MAX_TX_POWER_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001840 rrm_set_max_tx_power_rsp(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001841 if (msg->bodyptr != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301842 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001843 msg->bodyptr = NULL;
1844 }
1845 break;
1846 case SIR_LIM_ADDR2_MISS_IND:
Srinivas Girigowda9ab3bbd2017-03-26 13:57:56 -07001847 pe_err(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001848 FL("Addr2 mismatch interrupt received %X"), msg->type);
1849 /* message from HAL indicating addr2 mismatch interrupt occurred
1850 * msg->bodyptr contains only pointer to 48-bit addr2 field
1851 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301852 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001853 msg->bodyptr = NULL;
1854 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001855 case WMA_AGGR_QOS_RSP:
1856 lim_process_ft_aggr_qo_s_rsp(mac_ctx, msg);
1857 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001858 case WMA_SET_LINK_STATE_RSP:
1859 link_state_param = (tLinkStateParams *) msg->bodyptr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001860 session_entry = link_state_param->session;
1861 if (link_state_param->ft
1862#if defined WLAN_FEATURE_ROAM_OFFLOAD
1863 && !session_entry->bRoamSynchInProgress
1864#endif
1865 )
1866 lim_send_reassoc_req_with_ft_ies_mgmt_frame(mac_ctx,
1867 session_entry->pLimMlmReassocReq,
1868 session_entry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001869 if (link_state_param->callback)
1870 link_state_param->callback(mac_ctx,
1871 link_state_param->callbackArg,
1872 link_state_param->status);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301873 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001874 msg->bodyptr = NULL;
1875 break;
gaoleze5108942017-03-31 16:56:42 +08001876 case WMA_RX_CHN_STATUS_EVENT:
1877 lim_process_rx_channel_status_event(mac_ctx, msg->bodyptr);
1878 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001879 case WMA_IBSS_PEER_INACTIVITY_IND:
1880 lim_process_ibss_peer_inactivity(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301881 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001882 msg->bodyptr = NULL;
1883 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001884 case WMA_DFS_BEACON_TX_SUCCESS_IND:
1885 lim_process_beacon_tx_success_ind(mac_ctx, msg->type,
1886 (void *)msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301887 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001888 msg->bodyptr = NULL;
1889 break;
1890 case WMA_DISASSOC_TX_COMP:
Liangwei Dongc0b2e332017-11-16 06:04:46 -05001891 lim_disassoc_tx_complete_cnf(mac_ctx, msg->bodyval,
1892 msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001893 break;
1894 case WMA_DEAUTH_TX_COMP:
Liangwei Dongc0b2e332017-11-16 06:04:46 -05001895 lim_deauth_tx_complete_cnf(mac_ctx, msg->bodyval,
1896 msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001897 break;
1898#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1899 case WMA_UPDATE_Q2Q_IE_IND:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301900 qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001901 beacon_params.paramChangeBitmap = 0;
1902 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1903 vdev_id = ((uint8_t *)msg->bodyptr)[i];
1904 session_entry = pe_find_session_by_sme_session_id(
1905 mac_ctx, vdev_id);
1906 if (session_entry == NULL)
1907 continue;
1908 session_entry->sap_advertise_avoid_ch_ie =
1909 (uint8_t)msg->bodyval;
1910 /*
1911 * if message comes for DFS channel, no need to update:
1912 * 1) We wont have MCC with DFS channels. so no need to
1913 * add Q2Q IE
1914 * 2) We cannot end up in DFS channel SCC by channel
1915 * switch from non DFS MCC scenario, so no need to
1916 * remove Q2Q IE
1917 * 3) There is however a case where device start MCC and
1918 * then user modifies hostapd.conf and does SAP
1919 * restart, in such a case, beacon params will be
1920 * reset and thus will not contain Q2Q IE, by default
1921 */
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -07001922 if (wlan_reg_get_channel_state(mac_ctx->pdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001923 session_entry->currentOperChannel)
1924 != CHANNEL_STATE_DFS) {
1925 beacon_params.bssIdx = session_entry->bssIdx;
1926 beacon_params.beaconInterval =
1927 session_entry->beaconParams.beaconInterval;
1928 beacon_params.paramChangeBitmap |=
1929 PARAM_BCN_INTERVAL_CHANGED;
1930 sch_set_fixed_beacon_fields(mac_ctx,
1931 session_entry);
1932 lim_send_beacon_params(mac_ctx, &beacon_params,
1933 session_entry);
1934 }
1935 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301936 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001937 msg->bodyptr = NULL;
1938 break;
1939#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1940 case eWNI_SME_NSS_UPDATE_REQ:
1941 case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ:
1942 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301943 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001944 msg->bodyptr = NULL;
1945 break;
1946 case eWNI_SME_CHANNEL_CHANGE_REQ:
1947 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301948 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001949 msg->bodyptr = NULL;
1950 break;
1951 case eWNI_SME_START_BEACON_REQ:
1952 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301953 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001954 msg->bodyptr = NULL;
1955 break;
1956 case eWNI_SME_UPDATE_ADDITIONAL_IES:
1957 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301958 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001959 msg->bodyptr = NULL;
1960 break;
1961 case eWNI_SME_MODIFY_ADDITIONAL_IES:
1962 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301963 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001964 msg->bodyptr = NULL;
1965 break;
1966#ifdef QCA_HT_2040_COEX
1967 case eWNI_SME_SET_HT_2040_MODE:
1968 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301969 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001970 msg->bodyptr = NULL;
1971 break;
1972#endif
Manishekar Chandrasekarand9640342016-04-27 12:28:26 +05301973 case SIR_HAL_PDEV_SET_HW_MODE_RESP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001974 lim_process_set_hw_mode_resp(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301975 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001976 msg->bodyptr = NULL;
1977 break;
Manishekar Chandrasekaran05fd2672016-04-27 12:59:20 +05301978 case SIR_HAL_PDEV_HW_MODE_TRANS_IND:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001979 lim_process_hw_mode_trans_ind(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301980 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001981 msg->bodyptr = NULL;
1982 break;
Manishekar Chandrasekaran5d46f702016-04-27 12:50:52 +05301983 case SIR_HAL_PDEV_MAC_CFG_RESP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001984 lim_process_dual_mac_cfg_resp(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301985 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001986 msg->bodyptr = NULL;
1987 break;
1988 case eWNI_SME_SET_IE_REQ:
1989 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301990 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001991 msg->bodyptr = NULL;
1992 break;
Sandeep Puligillae0875662016-02-12 16:09:21 -08001993 case eWNI_SME_HT40_OBSS_SCAN_IND:
1994 lim_process_sme_obss_scan_ind(mac_ctx, msg);
1995 qdf_mem_free(msg->bodyptr);
Archana Ramachandrana20ef812015-11-13 16:12:13 -08001996 break;
1997 case SIR_HAL_SOC_ANTENNA_MODE_RESP:
1998 lim_process_set_antenna_resp(mac_ctx, msg->bodyptr);
1999 qdf_mem_free((void *)msg->bodyptr);
Sandeep Puligillae0875662016-02-12 16:09:21 -08002000 msg->bodyptr = NULL;
2001 break;
Deepak Dhamdhereb106ae52016-08-10 20:55:30 +05302002 case eWNI_SME_DEFAULT_SCAN_IE:
2003 lim_process_set_default_scan_ie_request(mac_ctx, msg->bodyptr);
2004 qdf_mem_free((void *)msg->bodyptr);
2005 msg->bodyptr = NULL;
2006 break;
Kiran Kumar Lokeree6476b22017-10-16 23:40:32 -07002007 case eWNI_SME_SET_HE_BSS_COLOR:
2008 lim_process_set_he_bss_color(mac_ctx, msg->bodyptr);
2009 qdf_mem_free((void *)msg->bodyptr);
2010 msg->bodyptr = NULL;
2011 break;
Nitesh Shah99dd9552017-03-20 19:27:47 +05302012 case eWNI_SME_DEL_ALL_TDLS_PEERS:
2013 lim_process_sme_del_all_tdls_peers(mac_ctx, msg->bodyptr);
2014 qdf_mem_free((void *)msg->bodyptr);
2015 msg->bodyptr = NULL;
2016 break;
Arif Hussainee10f902017-12-27 16:30:17 -08002017 case WMA_OBSS_DETECTION_INFO:
Arif Hussain1513cb22018-01-05 19:56:31 -08002018 lim_process_obss_detection_ind(mac_ctx, msg->bodyptr);
Arif Hussainee10f902017-12-27 16:30:17 -08002019 qdf_mem_free(msg->bodyptr);
2020 msg->bodyptr = NULL;
2021 break;
Padma, Santhosh Kumardd3f4852018-01-16 18:51:51 +05302022 case eWNI_SME_SEND_SAE_MSG:
2023 lim_process_sae_msg(mac_ctx, msg->bodyptr);
2024 qdf_mem_free((void *)msg->bodyptr);
2025 msg->bodyptr = NULL;
2026 break;
Arif Hussain05fb4872018-01-03 16:02:55 -08002027 case WMA_OBSS_COLOR_COLLISION_INFO:
2028 lim_process_obss_color_collision_info(mac_ctx, msg->bodyptr);
2029 qdf_mem_free((void *)msg->bodyptr);
2030 msg->bodyptr = NULL;
2031 break;
Abhishek Singh20a8e442018-09-12 15:50:44 +05302032#ifdef CONFIG_VDEV_SM
2033 case eWNI_SME_CSA_RESTART_REQ:
2034 lim_send_csa_restart_req(mac_ctx, msg->bodyval);
2035 break;
2036#endif
Abhishek Singhfc740be2018-10-12 11:34:26 +05302037 case WMA_SEND_BCN_RSP:
2038 lim_send_bcn_rsp(mac_ctx, (tpSendbeaconParams)msg->bodyptr);
2039 qdf_mem_free((void *)msg->bodyptr);
2040 msg->bodyptr = NULL;
2041 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002042 default:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302043 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002044 msg->bodyptr = NULL;
Varun Reddy Yeturudd51e8d2017-05-14 14:51:13 -07002045 pe_debug("Discarding unexpected message received %X",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002046 msg->type);
2047 lim_print_msg_name(mac_ctx, LOGE, msg->type);
2048 break;
2049
2050 } /* switch (msg->type) */
2051} /*** end lim_process_messages() ***/
2052
2053/**
Ankit Guptafef4c022016-09-26 12:11:30 -07002054 * lim_process_deferred_message_queue()
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002055 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002056 * This function is called by LIM while exiting from Learn
2057 * mode. This function fetches messages posted to the LIM
2058 * deferred message queue limDeferredMsgQ.
2059 *
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002060 * @mac: Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002061 * @return None
2062 */
2063
Jeff Johnson9320c1e2018-12-02 13:09:20 -08002064static void lim_process_deferred_message_queue(struct mac_context *mac)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002065{
Rajeev Kumarcf7bd802017-04-18 11:11:42 -07002066 struct scheduler_msg limMsg = {0};
Rajeev Kumar416b73f2017-01-21 16:45:21 -08002067 struct scheduler_msg *readMsg;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002068 uint16_t size;
2069
2070 /*
2071 ** check any deferred messages need to be processed
2072 **/
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002073 size = mac->lim.gLimDeferredMsgQ.size;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002074 if (size > 0) {
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002075 while ((readMsg = lim_read_deferred_msg_q(mac)) != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302076 qdf_mem_copy((uint8_t *) &limMsg,
Rajeev Kumarfeb96382017-01-22 19:42:09 -08002077 (uint8_t *) readMsg,
2078 sizeof(struct scheduler_msg));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002079 size--;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002080 lim_process_messages(mac, &limMsg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002081
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002082 if ((lim_is_system_in_scan_state(mac))
2083 || (true != GET_LIM_PROCESS_DEFD_MESGS(mac))
2084 || mac->lim.gLimAddtsSent)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002085 break;
2086 }
2087 }
2088} /*** end lim_process_deferred_message_queue() ***/
2089
2090/**
Ankit Guptafef4c022016-09-26 12:11:30 -07002091 * lim_message_processor() - Process messages from LIM.
2092 * @mac_ctx: Pointer to the Global Mac Context.
2093 * @msg: Received LIM message.
2094 *
2095 * Wrapper function for lim_process_messages when handling messages received by
2096 * LIM. Could either defer messages or process them.
2097 *
2098 * Return: None.
2099 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08002100void lim_message_processor(struct mac_context *mac_ctx, struct scheduler_msg *msg)
Ankit Guptafef4c022016-09-26 12:11:30 -07002101{
2102 if (eLIM_MLM_OFFLINE_STATE == mac_ctx->lim.gLimMlmState) {
2103 pe_free_msg(mac_ctx, msg);
2104 return;
2105 }
2106
2107 if (!def_msg_decision(mac_ctx, msg)) {
2108 lim_process_messages(mac_ctx, msg);
2109 /* process deferred message queue if allowed */
2110 if ((!(mac_ctx->lim.gLimAddtsSent)) &&
2111 (!(lim_is_system_in_scan_state(mac_ctx))) &&
2112 (true == GET_LIM_PROCESS_DEFD_MESGS(mac_ctx)))
2113 lim_process_deferred_message_queue(mac_ctx);
2114 }
2115}
2116
2117/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002118 * lim_process_normal_hdd_msg() - Process the message and defer if needed
2119 * @mac_ctx : Pointer to Global MAC structure
2120 * @msg : The message need to be processed
2121 * @rsp_reqd: whether return result to hdd
2122 *
2123 * This function checks the current lim state and decide whether the message
2124 * passed will be deferred or not.
2125 *
2126 * Return: None
2127 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08002128static void lim_process_normal_hdd_msg(struct mac_context *mac_ctx,
Rajeev Kumarfeb96382017-01-22 19:42:09 -08002129 struct scheduler_msg *msg,
2130 uint8_t rsp_reqd)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002131{
2132 bool defer_msg = true;
2133
2134 /* Added For BT-AMP Support */
2135 if ((mac_ctx->lim.gLimSystemRole == eLIM_AP_ROLE)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002136 || (mac_ctx->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)) {
2137 /*
2138 * This check is required only for the AP and in 2 cases.
2139 * 1. If we are in learn mode and we receive any of these
2140 * messages, you have to come out of scan and process the
2141 * message, hence dont defer the message here. In handler,
2142 * these message could be defered till we actually come out of
2143 * scan mode.
2144 * 2. If radar is detected, you might have to defer all of
2145 * these messages except Stop BSS request/ Switch channel
2146 * request. This decision is also made inside its handler.
2147 *
2148 * Please be careful while using the flag defer_msg. Possibly
2149 * you might end up in an infinite loop.
2150 */
2151 if ((msg->type == eWNI_SME_START_BSS_REQ) ||
2152 (msg->type == eWNI_SME_STOP_BSS_REQ) ||
2153 (msg->type == eWNI_SME_SWITCH_CHL_IND))
2154 defer_msg = false;
2155 }
2156
2157 if (((mac_ctx->lim.gLimAddtsSent) ||
2158 (lim_is_system_in_scan_state(mac_ctx))) && defer_msg) {
2159 /*
2160 * System is in DFS (Learn) mode or awaiting addts response or
Jeff Johnson47d75242018-05-12 15:58:53 -07002161 * if radar is detected, Defer processing this message
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002162 */
2163 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
2164#ifdef WLAN_DEBUG
2165 mac_ctx->lim.numSme++;
2166#endif
2167 lim_log_session_states(mac_ctx);
2168 /* Release body */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302169 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002170 msg->bodyptr = NULL;
2171 }
2172 } else {
2173 /*
2174 * These messages are from HDD.Since these requests may also be
2175 * generated internally within LIM module, need to distinquish
2176 * and send response to host
2177 */
2178 if (rsp_reqd)
2179 mac_ctx->lim.gLimRspReqd = true;
2180#ifdef WLAN_DEBUG
2181 mac_ctx->lim.numSme++;
2182#endif
2183 if (lim_process_sme_req_messages(mac_ctx, msg)) {
2184 /*
2185 * Release body. limProcessSmeReqMessage consumed the
2186 * buffer. We can free it.
2187 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302188 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002189 msg->bodyptr = NULL;
2190 }
2191 }
2192}
2193
2194void
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002195handle_ht_capabilityand_ht_info(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08002196 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002197{
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05302198 struct mlme_ht_capabilities_info *ht_cap_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002199
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002200 ht_cap_info = &mac->mlme_cfg->ht_caps.ht_cap_info;
2201 mac->lim.gHTLsigTXOPProtection =
Vignesh Viswanathan78182502018-08-06 15:13:30 +05302202 (uint8_t)ht_cap_info->l_sig_tx_op_protection;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002203 mac->lim.gHTMIMOPSState =
Vignesh Viswanathan78182502018-08-06 15:13:30 +05302204 (tSirMacHTMIMOPowerSaveState)ht_cap_info->mimo_power_save;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002205 mac->lim.gHTGreenfield = (uint8_t)ht_cap_info->green_field;
2206 mac->lim.gHTMaxAmsduLength =
Vignesh Viswanathan78182502018-08-06 15:13:30 +05302207 (uint8_t)ht_cap_info->maximal_amsdu_size;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002208 mac->lim.gHTShortGI20Mhz = (uint8_t)ht_cap_info->short_gi_20_mhz;
2209 mac->lim.gHTShortGI40Mhz = (uint8_t)ht_cap_info->short_gi_40_mhz;
2210 mac->lim.gHTPSMPSupport = (uint8_t)ht_cap_info->psmp;
2211 mac->lim.gHTDsssCckRate40MHzSupport =
Vignesh Viswanathan78182502018-08-06 15:13:30 +05302212 (uint8_t)ht_cap_info->dsss_cck_mode_40_mhz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002213
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002214 mac->lim.gHTAMpduDensity =
2215 (uint8_t)mac->mlme_cfg->ht_caps.ampdu_params.mpdu_density;
2216 mac->lim.gHTMaxRxAMpduFactor =
2217 (uint8_t)mac->mlme_cfg->ht_caps.ampdu_params.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302218 max_rx_ampdu_factor;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002219
2220 /* Get HT IE Info */
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002221 mac->lim.gHTServiceIntervalGranularity =
2222 (uint8_t)mac->mlme_cfg->ht_caps.info_field_1.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302223 service_interval_granularity;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002224 mac->lim.gHTControlledAccessOnly =
2225 (uint8_t)mac->mlme_cfg->ht_caps.info_field_1.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302226 controlled_access_only;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002227 mac->lim.gHTRifsMode = (uint8_t)mac->mlme_cfg->ht_caps.info_field_1.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302228 rifs_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002229
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002230 mac->lim.gHTOperMode = (tSirMacHTOperatingMode)mac->mlme_cfg->ht_caps.
Vignesh Viswanathanfe1b5bd2018-11-08 00:30:05 +05302231 info_field_2.op_mode;
2232
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002233 mac->lim.gHTPCOActive = (uint8_t)mac->mlme_cfg->ht_caps.info_field_3.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302234 pco_active;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002235 mac->lim.gHTPCOPhase = (uint8_t)mac->mlme_cfg->ht_caps.info_field_3.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302236 pco_phase;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002237 mac->lim.gHTSecondaryBeacon =
2238 (uint8_t)mac->mlme_cfg->ht_caps.info_field_3.secondary_beacon;
2239 mac->lim.gHTDualCTSProtection = (uint8_t)mac->mlme_cfg->ht_caps.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302240 info_field_3.dual_cts_protection;
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002241 mac->lim.gHTSTBCBasicMCS = (uint8_t)mac->mlme_cfg->ht_caps.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302242 info_field_3.basic_stbc_mcs;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002243
2244 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2245 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
Jeff Johnsonb5c13332018-12-03 09:54:51 -08002246 * For now, we might come here during init and join with pe_session = NULL; in that case just fill the globals which exist
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002247 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2248 */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08002249 if (pe_session != NULL) {
2250 pe_session->htCapability =
2251 IS_DOT11_MODE_HT(pe_session->dot11mode);
2252 pe_session->beaconParams.fLsigTXOPProtectionFullSupport =
Jeff Johnson5cce7a02018-11-22 15:41:15 -08002253 (uint8_t)mac->mlme_cfg->ht_caps.info_field_3.
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05302254 lsig_txop_protection_full_support;
Jeff Johnsonb5c13332018-12-03 09:54:51 -08002255 lim_init_obss_params(mac, pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002256 }
2257}
2258
Jeff Johnson9320c1e2018-12-02 13:09:20 -08002259void lim_log_session_states(struct mac_context *mac_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002260{
2261#ifdef WLAN_DEBUG
2262 int i;
2263
2264 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
2265 if (mac_ctx->lim.gpSession[i].valid) {
Abhishek Singh5d8d7332017-08-10 15:15:24 +05302266 QDF_TRACE(QDF_MODULE_ID_PE, LOGD,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002267 FL("sysRole(%d) Session (%d)"),
2268 mac_ctx->lim.gLimSystemRole, i);
Abhishek Singh5d8d7332017-08-10 15:15:24 +05302269 QDF_TRACE(QDF_MODULE_ID_PE, LOGD,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002270 FL("SME: Curr %s,Prev %s,MLM: Curr %s,Prev %s"),
2271 lim_sme_state_str(
2272 mac_ctx->lim.gpSession[i].limSmeState),
2273 lim_sme_state_str(
2274 mac_ctx->lim.gpSession[i].limPrevSmeState),
2275 lim_mlm_state_str(
2276 mac_ctx->lim.gpSession[i].limMlmState),
2277 lim_mlm_state_str(
2278 mac_ctx->lim.gpSession[i].limPrevMlmState));
2279 }
2280 }
2281#endif
2282}