blob: 17073ce5b8e91e8b67ffdcb6b4bff4fcf751e6d2 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Abhishek Singh7996eb72015-12-30 17:24:02 +05302 * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
29 * This file lim ProcessMessageQueue.cc contains the code
30 * for processing LIM message Queue.
31 * Author: Chandra Modumudi
32 * Date: 02/11/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38#include "cds_api.h"
39#include "wni_api.h"
40#include "wma_types.h"
41
42#include "wni_cfg.h"
43#include "cfg_api.h"
44#include "sir_common.h"
45#include "utils_api.h"
46#include "lim_types.h"
47#include "lim_utils.h"
48#include "lim_assoc_utils.h"
49#include "lim_prop_exts_utils.h"
50
51#include "lim_admit_control.h"
52#include "lim_ibss_peer_mgmt.h"
53#include "sch_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054#include "lim_ft_defs.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055#include "lim_session.h"
56#include "lim_send_messages.h"
57
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080058#include "rrm_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080060#include "lim_ft.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061
Anurag Chouhan6d760662016-02-20 16:05:43 +053062#include "qdf_types.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063#include "cds_packet.h"
Anurag Chouhan600c3a02016-03-01 10:33:54 +053064#include "qdf_mem.h"
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +053065#include "cds_concurrency.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080066
67void lim_log_session_states(tpAniSirGlobal pMac);
68static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx,
69 struct sSirMsgQ *msg, uint8_t rsp_reqd);
70
71/**
72 * lim_process_dual_mac_cfg_resp() - Process set dual mac config response
73 * @mac: Global MAC pointer
74 * @body: Set dual mac config response in sir_dual_mac_config_resp format
75 *
76 * Process the set dual mac config response and post the message
77 * to SME to process this further and release the active
78 * command list
79 *
80 * Return: None
81 */
82static void lim_process_dual_mac_cfg_resp(tpAniSirGlobal mac, void *body)
83{
84 struct sir_dual_mac_config_resp *resp, *param;
85 uint32_t len, fail_resp = 0;
86 tSirMsgQ msg;
87
88 resp = (struct sir_dual_mac_config_resp *)body;
89 if (!resp) {
90 lim_log(mac, LOGE, FL("Set dual mac cfg param is NULL"));
91 fail_resp = 1;
92 /* Not returning here. If possible, let us proceed
93 * and send fail response to SME
94 */
95 }
96
97 len = sizeof(*param);
98
Anurag Chouhan600c3a02016-03-01 10:33:54 +053099 param = qdf_mem_malloc(len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800100 if (!param) {
101 lim_log(mac, LOGE, FL("Fail to allocate memory"));
102 /* Memory allocation for param failed.
103 * Cannot send fail status back to SME
104 */
105 return;
106 }
107
108 if (fail_resp) {
109 lim_log(mac, LOGE, FL("Send fail status to SME"));
110 param->status = SET_HW_MODE_STATUS_ECANCELED;
111 } else {
112 param->status = resp->status;
113 /*
114 * TODO: Update this HW mode info in any UMAC params, if needed
115 */
116 }
117
118 msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP;
119 msg.bodyptr = param;
120 msg.bodyval = 0;
121 lim_log(mac, LOG1, FL("Send eWNI_SME_SET_DUAL_MAC_CFG_RESP to SME"));
122 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
123 return;
124}
125
126/**
127 * lim_process_set_hw_mode_resp() - Process set HW mode response
128 * @mac: Global MAC pointer
129 * @body: Set HW mode response in sir_set_hw_mode_resp format
130 *
131 * Process the set HW mode response and post the message
132 * to SME to process this further and release the active
133 * command list
134 *
135 * Return: None
136 */
137static void lim_process_set_hw_mode_resp(tpAniSirGlobal mac, void *body)
138{
139 struct sir_set_hw_mode_resp *resp, *param;
140 uint32_t len, i, fail_resp = 0;
141 tSirMsgQ msg;
142
143 resp = (struct sir_set_hw_mode_resp *)body;
144 if (!resp) {
145 lim_log(mac, LOGE, FL("Set HW mode param is NULL"));
146 fail_resp = 1;
147 /* Not returning here. If possible, let us proceed
148 * and send fail response to SME */
149 }
150
151 len = sizeof(*param);
152
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530153 param = qdf_mem_malloc(len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800154 if (!param) {
155 lim_log(mac, LOGE, FL("Fail to allocate memory"));
156 /* Memory allocation for param failed.
157 * Cannot send fail status back to SME
158 */
159 return;
160 }
161
162 if (fail_resp) {
163 lim_log(mac, LOGE, FL("Send fail status to SME"));
164 param->status = SET_HW_MODE_STATUS_ECANCELED;
165 param->cfgd_hw_mode_index = 0;
166 param->num_vdev_mac_entries = 0;
167 } else {
168 param->status = resp->status;
169 param->cfgd_hw_mode_index = resp->cfgd_hw_mode_index;
170 param->num_vdev_mac_entries = resp->num_vdev_mac_entries;
171
172 for (i = 0; i < resp->num_vdev_mac_entries; i++) {
173 param->vdev_mac_map[i].vdev_id =
174 resp->vdev_mac_map[i].vdev_id;
175 param->vdev_mac_map[i].mac_id =
176 resp->vdev_mac_map[i].mac_id;
177 }
178 /*
179 * TODO: Update this HW mode info in any UMAC params, if needed
180 */
181 }
182
183 msg.type = eWNI_SME_SET_HW_MODE_RESP;
184 msg.bodyptr = param;
185 msg.bodyval = 0;
186 lim_log(mac, LOGE, FL("Send eWNI_SME_SET_HW_MODE_RESP to SME"));
187 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
188 return;
189}
190
191/**
Archana Ramachandrana20ef812015-11-13 16:12:13 -0800192 * lim_process_antenna_mode_resp() - Process set antenna mode
193 * response
194 * @mac: Global MAC pointer
195 * @body: Set antenna mode response in sir_antenna_mode_resp
196 * format
197 *
198 * Process the set antenna mode response and post the message
199 * to SME to process this further and release the active
200 * command list
201 *
202 * Return: None
203 */
204static void lim_process_set_antenna_resp(tpAniSirGlobal mac, void *body)
205{
206 struct sir_antenna_mode_resp *resp, *param;
207 bool fail_resp = false;
208 tSirMsgQ msg;
209
210 resp = (struct sir_antenna_mode_resp *)body;
211 if (!resp) {
212 lim_log(mac, LOGE, FL("Set antenna mode resp is NULL"));
213 fail_resp = true;
214 /* Not returning here. If possible, let us proceed
215 * and send fail response to SME
216 */
217 }
218
219 param = qdf_mem_malloc(sizeof(*param));
220 if (!param) {
221 lim_log(mac, LOGE, FL("Fail to allocate memory"));
222 /* Memory allocation for param failed.
223 * Cannot send fail status back to SME
224 */
225 return;
226 }
227
228 if (fail_resp) {
229 lim_log(mac, LOGE, FL("Send fail status to SME"));
230 param->status = SET_ANTENNA_MODE_STATUS_ECANCELED;
231 } else {
232 param->status = resp->status;
233 }
234
235 msg.type = eWNI_SME_SET_ANTENNA_MODE_RESP;
236 msg.bodyptr = param;
237 msg.bodyval = 0;
238 lim_log(mac, LOG1, FL("Send eWNI_SME_SET_ANTENNA_MODE_RESP to SME"));
239 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
240 return;
241}
242
243/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800244 * lim_process_hw_mode_trans_ind() - Process set HW mode transition indication
245 * @mac: Global MAC pointer
246 * @body: Set HW mode response in sir_hw_mode_trans_ind format
247 *
248 * Process the set HW mode transition indication and post the message
249 * to SME to invoke the HDD callback
250 * command list
251 *
252 * Return: None
253 */
254static void lim_process_hw_mode_trans_ind(tpAniSirGlobal mac, void *body)
255{
256 struct sir_hw_mode_trans_ind *ind, *param;
257 uint32_t len, i;
258 tSirMsgQ msg;
259
260 ind = (struct sir_hw_mode_trans_ind *)body;
261 if (!ind) {
262 lim_log(mac, LOGE, FL("Set HW mode trans ind param is NULL"));
263 return;
264 }
265
266 len = sizeof(*param);
267
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530268 param = qdf_mem_malloc(len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800269 if (!param) {
270 lim_log(mac, LOGE, FL("Fail to allocate memory"));
271 return;
272 }
273
274 param->old_hw_mode_index = ind->old_hw_mode_index;
275 param->new_hw_mode_index = ind->new_hw_mode_index;
276 param->num_vdev_mac_entries = ind->num_vdev_mac_entries;
277
278 for (i = 0; i < ind->num_vdev_mac_entries; i++) {
279 param->vdev_mac_map[i].vdev_id =
280 ind->vdev_mac_map[i].vdev_id;
281 param->vdev_mac_map[i].mac_id =
282 ind->vdev_mac_map[i].mac_id;
283 }
284
285 /* TODO: Update this HW mode info in any UMAC params, if needed */
286
287 msg.type = eWNI_SME_HW_MODE_TRANS_IND;
288 msg.bodyptr = param;
289 msg.bodyval = 0;
290 lim_log(mac, LOGE, FL("Send eWNI_SME_HW_MODE_TRANS_IND to SME"));
291 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
292 return;
293}
294
295/** -------------------------------------------------------------
296 \fn def_msg_decision
297 \brief The function decides whether to defer a message or not in limProcessMessage function
298 \param tpAniSirGlobal pMac
299 \param tSirMsgQ limMsg
300 \param tSirMacTspecIE *ppInfo
301 \return none
302 -------------------------------------------------------------*/
303
304uint8_t static def_msg_decision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
305{
306
307/* this function should not changed */
308 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) {
309 /* Defer processsing this message */
310 if (lim_defer_msg(pMac, limMsg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530311 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800312 FL("Unable to Defer Msg"));
313 lim_log_session_states(pMac);
314 lim_handle_defer_msg_error(pMac, limMsg);
315 }
316 return true;
317 }
318 /* When defer is requested then defer all the messages except HAL responses. */
319 if ((!lim_is_system_in_scan_state(pMac))
320 && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac))
321 && !pMac->lim.gLimSystemInScanLearnMode) {
322 if ((limMsg->type != WMA_ADD_BSS_RSP)
323 && (limMsg->type != WMA_DELETE_BSS_RSP)
324 && (limMsg->type != WMA_ADD_STA_RSP)
325 && (limMsg->type != WMA_DELETE_STA_RSP)
326 && (limMsg->type != WMA_SET_BSSKEY_RSP)
327 && (limMsg->type != WMA_SET_STAKEY_RSP)
328 && (limMsg->type != WMA_SET_STA_BCASTKEY_RSP)
329 && (limMsg->type != WMA_AGGR_QOS_RSP)
330 && (limMsg->type != WMA_SET_MIMOPS_RSP)
331 && (limMsg->type != WMA_SWITCH_CHANNEL_RSP)
332 && (limMsg->type != WMA_P2P_NOA_ATTR_IND)
333 && (limMsg->type != WMA_P2P_NOA_START_IND) &&
334#ifdef FEATURE_OEM_DATA_SUPPORT
335 (limMsg->type != WMA_START_OEM_DATA_RSP) &&
336#endif
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +0530337 (limMsg->type != WMA_ADD_TS_RSP) &&
Hanumantha Reddy Pothulab8340212016-01-12 11:16:06 +0530338 /*
339 * LIM won't process any defer queue commands if gLimAddtsSent is
340 * set to TRUE. gLimAddtsSent will be set TRUE to while sending
341 * ADDTS REQ. Say, when deferring is enabled, if
342 * SIR_LIM_ADDTS_RSP_TIMEOUT is posted (because of not receiving ADDTS
343 * RSP) then this command will be added to defer queue and as
344 * gLimAddtsSent is set TRUE LIM will never process any commands from
345 * defer queue, including SIR_LIM_ADDTS_RSP_TIMEOUT. Hence allowing
346 * SIR_LIM_ADDTS_RSP_TIMEOUT command to be processed with deferring
347 * enabled, so that this will be processed immediately and sets
348 * gLimAddtsSent to FALSE.
349 */
350 (limMsg->type != SIR_LIM_ADDTS_RSP_TIMEOUT) &&
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +0530351 /* Allow processing of RX frames while awaiting reception
352 * of ADD TS response over the air. This logic particularly
353 * handles the case when host sends ADD BA request to FW
354 * after ADD TS request is sent over the air and
355 * ADD TS response received over the air */
356 !(limMsg->type == SIR_BB_XPORT_MGMT_MSG &&
357 pMac->lim.gLimAddtsSent)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800358 PELOG1(lim_log
359 (pMac, LOG1,
360 FL
361 ("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode"),
362 lim_msg_str(limMsg->type));
363 )
364 /* Defer processsing this message */
365 if (lim_defer_msg(pMac, limMsg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530366 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800367 FL("Unable to Defer Msg"));
368 lim_log_session_states(pMac);
369 lim_handle_defer_msg_error(pMac, limMsg);
370
371 }
372 return true;
373 }
374 }
375 return false;
376}
377
378#ifdef FEATURE_WLAN_EXTSCAN
379static void
380__lim_pno_match_fwd_bcn_probepsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info,
381 tSirProbeRespBeacon *frame, uint32_t ie_len,
382 uint32_t msg_type)
383{
384 struct pno_match_found *result;
385 uint8_t *body;
386 tSirMsgQ mmh_msg;
387 tpSirMacMgmtHdr hdr;
388 uint32_t num_results = 1, len, i;
389
390 /* Upon receiving every matched beacon, bss info is forwarded to the
391 * the upper layer, hence num_results is set to 1 */
392 len = sizeof(*result) + (num_results * sizeof(tSirWifiScanResult)) +
393 ie_len;
394
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530395 result = qdf_mem_malloc(len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800396 if (NULL == result) {
397 lim_log(pmac, LOGE, FL("Memory allocation failed"));
398 return;
399 }
400 hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
401 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530402 qdf_mem_zero(result, sizeof(*result) + ie_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800403
404 /* Received frame does not have request id, hence set 0 */
405 result->request_id = 0;
406 result->more_data = 0;
407 result->num_results = num_results;
408
409 for (i = 0; i < result->num_results; i++) {
Anurag Chouhan210db072016-02-22 18:42:15 +0530410 result->ap[i].ts = qdf_mc_timer_get_system_time();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800411 result->ap[i].beaconPeriod = frame->beaconInterval;
412 result->ap[i].capability =
413 lim_get_u16((uint8_t *) &frame->capabilityInfo);
414 result->ap[i].channel = WMA_GET_RX_CH(rx_pkt_info);
Deepak Dhamdhere68929ec2015-08-05 15:16:35 -0700415 result->ap[i].rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800416 result->ap[i].rtt = 0;
417 result->ap[i].rtt_sd = 0;
418 result->ap[i].ieLength = ie_len;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530419 qdf_mem_copy((uint8_t *) &result->ap[i].ssid[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800420 (uint8_t *) frame->ssId.ssId, frame->ssId.length);
421 result->ap[i].ssid[frame->ssId.length] = '\0';
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530422 qdf_mem_copy((uint8_t *) &result->ap[i].bssid,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423 (uint8_t *) hdr->bssId,
424 sizeof(tSirMacAddr));
425 /* Copy IE fields */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530426 qdf_mem_copy((uint8_t *) &result->ap[i].ieData,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800427 body + SIR_MAC_B_PR_SSID_OFFSET, ie_len);
428 }
429
430 mmh_msg.type = msg_type;
431 mmh_msg.bodyptr = result;
432 mmh_msg.bodyval = 0;
433 lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT);
434}
435
436
437static void
438__lim_ext_scan_forward_bcn_probe_rsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info,
439 tSirProbeRespBeacon *frame,
440 uint32_t ie_len,
441 uint32_t msg_type)
442{
443 tpSirWifiFullScanResultEvent result;
444 uint8_t *body;
445 tSirMsgQ mmh_msg;
446 tpSirMacMgmtHdr hdr;
447
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530448 result = qdf_mem_malloc(sizeof(*result) + ie_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800449 if (NULL == result) {
450 lim_log(pmac, LOGE, FL("Memory allocation failed"));
451 return;
452 }
453 hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
454 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530455 qdf_mem_zero(result, sizeof(*result) + ie_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800456
457 /* Received frame does not have request id, hence set 0 */
458 result->requestId = 0;
459
460 result->moreData = 0;
Anurag Chouhan210db072016-02-22 18:42:15 +0530461 result->ap.ts = qdf_mc_timer_get_system_time();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800462 result->ap.beaconPeriod = frame->beaconInterval;
463 result->ap.capability =
464 lim_get_u16((uint8_t *) &frame->capabilityInfo);
465 result->ap.channel = WMA_GET_RX_CH(rx_pkt_info);
Deepak Dhamdhere68929ec2015-08-05 15:16:35 -0700466 result->ap.rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800467 result->ap.rtt = 0;
468 result->ap.rtt_sd = 0;
469 result->ap.ieLength = ie_len;
470
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530471 qdf_mem_copy((uint8_t *) &result->ap.ssid[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800472 (uint8_t *) frame->ssId.ssId, frame->ssId.length);
473 result->ap.ssid[frame->ssId.length] = '\0';
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530474 qdf_mem_copy((uint8_t *) &result->ap.bssid.bytes,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800475 (uint8_t *) hdr->bssId,
Anurag Chouhan6d760662016-02-20 16:05:43 +0530476 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800477 /* Copy IE fields */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530478 qdf_mem_copy((uint8_t *) &result->ap.ieData,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800479 body + SIR_MAC_B_PR_SSID_OFFSET, ie_len);
480
481 mmh_msg.type = msg_type;
482 mmh_msg.bodyptr = result;
483 mmh_msg.bodyval = 0;
484 lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT);
485}
486
487static void
488__lim_process_ext_scan_beacon_probe_rsp(tpAniSirGlobal pmac,
489 uint8_t *rx_pkt_info,
490 uint8_t sub_type)
491{
492 tSirProbeRespBeacon *frame;
493 uint8_t *body;
494 uint32_t frm_len;
495 tSirRetStatus status;
496
497 frm_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
498 if (frm_len <= SIR_MAC_B_PR_SSID_OFFSET) {
499 lim_log(pmac, LOGP,
500 FL("RX packet has invalid length %d"), frm_len);
501 return;
502 }
503
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530504 frame = qdf_mem_malloc(sizeof(*frame));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800505 if (NULL == frame) {
506 lim_log(pmac, LOGE, FL("Memory allocation failed"));
507 return;
508 }
509
510 if (sub_type == SIR_MAC_MGMT_BEACON) {
511 lim_log(pmac, LOG2, FL("Beacon due to ExtScan/epno"));
512 status = sir_convert_beacon_frame2_struct(pmac,
513 (uint8_t *)rx_pkt_info,
514 frame);
515 } else if (sub_type == SIR_MAC_MGMT_PROBE_RSP) {
516 lim_log(pmac, LOG2, FL("Probe Rsp due to ExtScan/epno"));
517 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
518 status = sir_convert_probe_frame2_struct(pmac, body,
519 frm_len, frame);
520 } else {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530521 qdf_mem_free(frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800522 return;
523 }
524
525 if (status != eSIR_SUCCESS) {
526 lim_log(pmac, LOGE, FL("Frame parsing failed"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530527 qdf_mem_free(frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800528 return;
529 }
530
531 if (WMA_IS_EXTSCAN_SCAN_SRC(rx_pkt_info))
532 __lim_ext_scan_forward_bcn_probe_rsp(pmac, rx_pkt_info, frame,
533 (frm_len - SIR_MAC_B_PR_SSID_OFFSET),
534 eWNI_SME_EXTSCAN_FULL_SCAN_RESULT_IND);
535
536 if (WMA_IS_EPNO_SCAN_SRC(rx_pkt_info))
537 __lim_pno_match_fwd_bcn_probepsp(pmac, rx_pkt_info, frame,
538 (frm_len - SIR_MAC_B_PR_SSID_OFFSET),
539 eWNI_SME_EPNO_NETWORK_FOUND_IND);
540
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530541 qdf_mem_free(frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800542}
543#endif
544
545/*
546 * Beacon Handling Cases:
547 * during scanning, when no session is active:
548 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
549 * during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
550 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
551 * during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
552 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
553 * Not scanning, no session:
554 * there should not be any beacon coming, if coming, should be dropped.
555 * Not Scanning,
556 */
557static void
558__lim_handle_beacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg,
559 tpPESession psessionEntry)
560{
561 /* checking for global SME state... */
562 uint8_t *pRxPacketInfo;
563 lim_get_b_dfrom_rx_packet(pMac, pMsg->bodyptr,
Anurag Chouhanffb21542016-02-17 14:33:03 +0530564 (uint32_t **) &pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800565
566 /* This function should not be called if beacon is received in scan state. */
567 /* So not doing any checks for the global state. */
568
569 if (psessionEntry == NULL) {
570 sch_beacon_process(pMac, pRxPacketInfo, NULL);
571 } else if ((psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
572 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)) {
573 sch_beacon_process(pMac, pRxPacketInfo, psessionEntry);
574 } else
575 lim_process_beacon_frame(pMac, pRxPacketInfo, psessionEntry);
576
577 return;
578}
579
580/**
581 * lim_defer_msg()
582 *
583 ***FUNCTION:
584 * This function is called to defer the messages received
585 * during Learn mode
586 *
587 ***LOGIC:
588 * NA
589 *
590 ***ASSUMPTIONS:
591 * NA
592 *
593 ***NOTE:
594 * NA
595 *
596 * @param pMac - Pointer to Global MAC structure
597 * @param pMsg of type tSirMsgQ - Pointer to the message structure
598 * @return None
599 */
600
601uint32_t lim_defer_msg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
602{
603 uint32_t retCode = TX_SUCCESS;
604
605 retCode = lim_write_deferred_msg_q(pMac, pMsg);
606
607 if (retCode == TX_SUCCESS) {
608 MTRACE(mac_trace_msg_rx
609 (pMac, NO_SESSION,
610 LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));
611 )
612 } else {
613 lim_log(pMac, LOGE, FL("Dropped lim message (0x%X)"),
614 pMsg->type);
615 MTRACE(mac_trace_msg_rx
616 (pMac, NO_SESSION,
617 LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));
618 )
619 }
620
621 return retCode;
622} /*** end lim_defer_msg() ***/
623
624/**
625 * lim_handle_unknown_a2_index_frames() - This function handles Unknown Unicast
626 * (A2 Index) packets
627 * @mac_ctx: Pointer to the Global Mac Context.
628 * @rx_pkt_buffer: Pointer to the packet Buffer descriptor.
629 * @session_entry: Pointer to the PE Session Entry.
630 *
631 * This routine will handle public action frames.
632 *
633 * Return: None.
634 */
635static void lim_handle_unknown_a2_index_frames(tpAniSirGlobal mac_ctx,
636 void *rx_pkt_buffer, tpPESession session_entry)
637{
638#ifdef FEATURE_WLAN_TDLS
639 tpSirMacDataHdr3a mac_hdr;
640#endif
641 if (LIM_IS_P2P_DEVICE_ROLE(session_entry))
642 lim_process_action_frame_no_session(mac_ctx,
643 (uint8_t *) rx_pkt_buffer);
644#ifdef FEATURE_WLAN_TDLS
645 mac_hdr = WMA_GET_RX_MPDUHEADER3A(rx_pkt_buffer);
646
647 if (lim_is_group_addr(mac_hdr->addr2)) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530648 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO_HIGH,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800649 FL("Ignoring A2 Invalid Packet received for MC/BC:"));
650 lim_print_mac_addr(mac_ctx, mac_hdr->addr2, LOG2);
651 return;
652 }
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530653 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800654 FL("type=0x%x, subtype=0x%x"),
655 mac_hdr->fc.type, mac_hdr->fc.subType);
656 /* Currently only following type and subtype are handled.
657 * If there are more combinations, then add switch-case
658 * statements.
659 */
660 if (LIM_IS_STA_ROLE(session_entry) &&
661 (mac_hdr->fc.type == SIR_MAC_MGMT_FRAME) &&
662 (mac_hdr->fc.subType == SIR_MAC_MGMT_ACTION))
663 lim_process_action_frame(mac_ctx, rx_pkt_buffer, session_entry);
664#endif
665 return;
666}
667
668/**
669 * lim_check_mgmt_registered_frames() - This function handles registered
670 * management frames.
671 *
672 * @mac_ctx: Pointer to the Global Mac Context.
673 * @buff_desc: Pointer to the packet Buffer descriptor.
674 * @session_entry: Pointer to the PE Session Entry.
675 *
676 * This function is called to process to check if received frame match with
677 * any of the registered frame from HDD. If yes pass this frame to SME.
678 *
679 * Return: True or False for Match or Mismatch respectively.
680 */
681static bool
682lim_check_mgmt_registered_frames(tpAniSirGlobal mac_ctx, uint8_t *buff_desc,
683 tpPESession session_entry)
684{
685 tSirMacFrameCtl fc;
686 tpSirMacMgmtHdr hdr;
687 uint8_t *body;
688 struct mgmt_frm_reg_info *mgmt_frame = NULL;
689 struct mgmt_frm_reg_info *next_frm = NULL;
690 uint16_t frm_type;
691 uint16_t frm_len;
692 uint8_t type, sub_type;
693 bool match = false;
Anurag Chouhanffb21542016-02-17 14:33:03 +0530694 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800695
696 hdr = WMA_GET_RX_MAC_HEADER(buff_desc);
697 fc = hdr->fc;
698 frm_type = (fc.type << 2) | (fc.subType << 4);
699 body = WMA_GET_RX_MPDU_DATA(buff_desc);
700 frm_len = WMA_GET_RX_PAYLOAD_LEN(buff_desc);
701
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530702 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +0530703 qdf_list_peek_front(&mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
704 (qdf_list_node_t **) &mgmt_frame);
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530705 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800706
707 while (mgmt_frame != NULL) {
708 type = (mgmt_frame->frameType >> 2) & 0x03;
709 sub_type = (mgmt_frame->frameType >> 4) & 0x0f;
710 if ((type == SIR_MAC_MGMT_FRAME)
711 && (fc.type == SIR_MAC_MGMT_FRAME)
712 && (sub_type == SIR_MAC_MGMT_RESERVED15)) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530713 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO_HIGH,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800714 FL
715 ("rcvd frm match for SIR_MAC_MGMT_RESERVED15"));
716 match = true;
717 break;
718 }
719 if (mgmt_frame->frameType == frm_type) {
720 if (mgmt_frame->matchLen <= 0) {
721 match = true;
722 break;
723 }
724 if (mgmt_frame->matchLen <= frm_len &&
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530725 (!qdf_mem_cmp(mgmt_frame->matchData, body,
726 mgmt_frame->matchLen))) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800727 /* found match! */
728 match = true;
729 break;
730 }
731 }
732
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530733 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +0530734 qdf_status =
735 qdf_list_peek_next(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800736 &mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
Anurag Chouhanffb21542016-02-17 14:33:03 +0530737 (qdf_list_node_t *) mgmt_frame,
738 (qdf_list_node_t **) &next_frm);
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530739 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800740 mgmt_frame = next_frm;
741 next_frm = NULL;
742 }
743
744 if (match) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530745 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800746 FL("rcvd frame match with registered frame params"));
747 /* Indicate this to SME */
748 lim_send_sme_mgmt_frame_ind(mac_ctx, hdr->fc.subType,
749 (uint8_t *) hdr,
750 WMA_GET_RX_PAYLOAD_LEN(buff_desc) +
751 sizeof(tSirMacMgmtHdr), mgmt_frame->sessionId,
752 WMA_GET_RX_CH(buff_desc), session_entry, 0);
753
754 if ((type == SIR_MAC_MGMT_FRAME)
755 && (fc.type == SIR_MAC_MGMT_FRAME)
756 && (sub_type == SIR_MAC_MGMT_RESERVED15))
757 /* These packets needs to be processed by PE/SME
758 * as well as HDD.If it returns true here,
759 * the packet is forwarded to HDD only.
760 */
761 match = false;
762 }
763
764 return match;
765}
766
767/**
768 * lim_handle80211_frames()
769 *
770 ***FUNCTION:
771 * This function is called to process 802.11 frames
772 * received by LIM.
773 *
774 ***LOGIC:
775 * NA
776 *
777 ***ASSUMPTIONS:
778 * NA
779 *
780 ***NOTE:
781 * NA
782 *
783 * @param pMac - Pointer to Global MAC structure
784 * @param pMsg of type tSirMsgQ - Pointer to the message structure
785 * @return None
786 */
787
788static void
789lim_handle80211_frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, uint8_t *pDeferMsg)
790{
791 uint8_t *pRxPacketInfo = NULL;
792 tSirMacFrameCtl fc;
793 tpSirMacMgmtHdr pHdr = NULL;
794 tpPESession psessionEntry = NULL;
795 uint8_t sessionId;
796 tAniBool isFrmFt = false;
797
798 *pDeferMsg = false;
799 lim_get_b_dfrom_rx_packet(pMac, limMsg->bodyptr,
Anurag Chouhanffb21542016-02-17 14:33:03 +0530800 (uint32_t **) &pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800801
802 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
803 isFrmFt = WMA_GET_RX_FT_DONE(pRxPacketInfo);
804 fc = pHdr->fc;
805
806#ifdef WLAN_DUMP_MGMTFRAMES
807 lim_log(pMac, LOGE,
808 FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
809 fc.protVer, fc.type, fc.subType,
810 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530811 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, pHdr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800812 WMA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
813#endif
814 if (pMac->fEnableDebugLog & 0x1) {
815 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
816 (fc.subType != SIR_MAC_MGMT_PROBE_REQ) &&
817 (fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
818 (fc.subType != SIR_MAC_MGMT_BEACON)) {
819 lim_log(pMac, LOGE,
820 FL("RX MGMT - Type %hu, SubType %hu, seq num[%d]"),
821 fc.type,
822 fc.subType,
823 ((pHdr->seqControl.seqNumHi <<
824 HIGH_SEQ_NUM_OFFSET) |
825 pHdr->seqControl.seqNumLo));
826 }
827 }
828#ifdef FEATURE_WLAN_EXTSCAN
829 if (WMA_IS_EXTSCAN_SCAN_SRC(pRxPacketInfo) ||
830 WMA_IS_EPNO_SCAN_SRC(pRxPacketInfo)) {
831 if (fc.subType == SIR_MAC_MGMT_BEACON ||
832 fc.subType == SIR_MAC_MGMT_PROBE_RSP) {
833 __lim_process_ext_scan_beacon_probe_rsp(pMac,
834 pRxPacketInfo,
835 fc.subType);
836 } else {
837 lim_log(pMac, LOGE,
838 FL("Wrong frameType %d, Subtype %d for %d"),
839 fc.type, fc.subType,
840 WMA_GET_SCAN_SRC(pRxPacketInfo));
841 }
842 goto end;
843 }
844#endif
845 if (WMA_GET_OFFLOADSCANLEARN(pRxPacketInfo)) {
846 if (fc.subType == SIR_MAC_MGMT_BEACON) {
847 lim_log(pMac, LOG2, FL("Learning scan beacon"));
848 __lim_handle_beacon(pMac, limMsg, NULL);
849 } else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP) {
850 lim_log(pMac, LOG2, FL("Learning scan probe rsp"));
851 lim_process_probe_rsp_frame_no_session(pMac, pRxPacketInfo);
852 } else {
853 lim_log(pMac, LOGE,
854 FL("Wrong frame Type %d, Subtype %d for LFR"),
855 fc.type, fc.subType);
856 }
857 goto end;
858 }
859 /* Added For BT-AMP Support */
Anurag Chouhanffb21542016-02-17 14:33:03 +0530860 psessionEntry = pe_find_session_by_bssid(pMac, pHdr->bssId,
861 &sessionId);
862 if (psessionEntry == NULL) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800863 if (fc.subType == SIR_MAC_MGMT_AUTH) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800864 lim_log(pMac, LOG1,
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700865 FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800866 fc.protVer, fc.type, fc.subType,
867 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
868 lim_print_mac_addr(pMac, pHdr->bssId, LOG1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800869 if (lim_process_auth_frame_no_session
870 (pMac, pRxPacketInfo,
871 limMsg->bodyptr) == eSIR_SUCCESS) {
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700872 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800873 }
874 }
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700875 /* Public action frame can be received from non-assoc stations*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800876 if ((fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
877 (fc.subType != SIR_MAC_MGMT_BEACON) &&
878 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700879 && (fc.subType != SIR_MAC_MGMT_ACTION)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800880
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700881 psessionEntry = pe_find_session_by_peer_sta(pMac,
882 pHdr->sa, &sessionId);
883 if (psessionEntry == NULL) {
884 lim_log(pMac, LOG3,
885 FL("session does not exist for bssId"));
886 lim_print_mac_addr(pMac, pHdr->sa, LOG3);
887 goto end;
888 } else {
889 lim_log(pMac, LOG3,
890 "SessionId:%d exists for given Bssid",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800891 psessionEntry->peSessionId);
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700892 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800893 }
894 /* For p2p resp frames search for valid session with DA as */
895 /* BSSID will be SA and session will be present with DA only */
896 if (fc.subType == SIR_MAC_MGMT_ACTION) {
897 psessionEntry =
898 pe_find_session_by_bssid(pMac, pHdr->da, &sessionId);
899 }
900 }
901
902 /* Check if frame is registered by HDD */
903 if (lim_check_mgmt_registered_frames(pMac, pRxPacketInfo, psessionEntry)) {
904 lim_log(pMac, LOG1, FL("Received frame is passed to SME"));
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700905 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800906 }
907
908 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION) { /* Received Frame with non-zero Protocol Version */
909 lim_log(pMac, LOGE,
910 FL("Unexpected frame with protVersion %d received"),
911 fc.protVer);
912 lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
913 (void *)limMsg->bodyptr);
914#ifdef WLAN_DEBUG
915 pMac->lim.numProtErr++;
916#endif
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700917 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800918 }
919
920/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
921
922#ifdef WLAN_DEBUG
923 pMac->lim.numMAC[fc.type][fc.subType]++;
924#endif
925
926 switch (fc.type) {
927 case SIR_MAC_MGMT_FRAME:
928 {
929 /* Received Management frame */
930 switch (fc.subType) {
931 case SIR_MAC_MGMT_ASSOC_REQ:
932 /* Make sure the role supports Association */
933 if (LIM_IS_BT_AMP_AP_ROLE(psessionEntry) ||
934 LIM_IS_AP_ROLE(psessionEntry))
935 lim_process_assoc_req_frame(pMac,
936 pRxPacketInfo,
937 LIM_ASSOC,
938 psessionEntry);
939 else {
940 /* Unwanted messages - Log error */
941 lim_log(pMac, LOGE,
942 FL
943 ("unexpected message received %X"),
944 limMsg->type);
945 lim_print_msg_name(pMac, LOGE,
946 limMsg->type);
947 }
948 break;
949
950 case SIR_MAC_MGMT_ASSOC_RSP:
951 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
952 LIM_ASSOC,
953 psessionEntry);
954 break;
955
956 case SIR_MAC_MGMT_REASSOC_REQ:
957 /* Make sure the role supports Reassociation */
958 if (LIM_IS_BT_AMP_AP_ROLE(psessionEntry) ||
959 LIM_IS_AP_ROLE(psessionEntry)) {
960 lim_process_assoc_req_frame(pMac,
961 pRxPacketInfo,
962 LIM_REASSOC,
963 psessionEntry);
964 } else {
965 /* Unwanted messages - Log error */
966 lim_log(pMac, LOGE,
967 FL
968 ("unexpected message received %X"),
969 limMsg->type);
970 lim_print_msg_name(pMac, LOGE,
971 limMsg->type);
972 }
973 break;
974
975 case SIR_MAC_MGMT_REASSOC_RSP:
976 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
977 LIM_REASSOC,
978 psessionEntry);
979 break;
980
981 case SIR_MAC_MGMT_PROBE_REQ:
982 lim_process_probe_req_frame_multiple_bss(pMac,
983 pRxPacketInfo,
984 psessionEntry);
985 break;
986
987 case SIR_MAC_MGMT_PROBE_RSP:
988 if (psessionEntry == NULL)
989 lim_process_probe_rsp_frame_no_session(pMac,
990 pRxPacketInfo);
991 else
992 lim_process_probe_rsp_frame(pMac,
993 pRxPacketInfo,
994 psessionEntry);
995 break;
996
997 case SIR_MAC_MGMT_BEACON:
998 __lim_handle_beacon(pMac, limMsg, psessionEntry);
999 break;
1000
1001 case SIR_MAC_MGMT_DISASSOC:
1002 lim_process_disassoc_frame(pMac, pRxPacketInfo,
1003 psessionEntry);
1004 break;
1005
1006 case SIR_MAC_MGMT_AUTH:
1007 lim_process_auth_frame(pMac, pRxPacketInfo,
1008 psessionEntry);
1009 break;
1010
1011 case SIR_MAC_MGMT_DEAUTH:
1012 lim_process_deauth_frame(pMac, pRxPacketInfo,
1013 psessionEntry);
1014 break;
1015
1016 case SIR_MAC_MGMT_ACTION:
1017 if (psessionEntry == NULL)
1018 lim_process_action_frame_no_session(pMac,
1019 pRxPacketInfo);
1020 else {
1021 if (WMA_GET_RX_UNKNOWN_UCAST
1022 (pRxPacketInfo))
1023 lim_handle_unknown_a2_index_frames
1024 (pMac, pRxPacketInfo,
1025 psessionEntry);
1026 else
1027 lim_process_action_frame(pMac,
1028 pRxPacketInfo,
1029 psessionEntry);
1030 }
1031 break;
1032 default:
1033 /* Received Management frame of 'reserved' subtype */
1034 break;
1035 } /* switch (fc.subType) */
1036
1037 }
1038 break;
1039 case SIR_MAC_DATA_FRAME:
1040 {
1041 }
1042 break;
1043 default:
1044 /* Received frame of type 'reserved' */
1045 break;
1046
1047 } /* switch (fc.type) */
1048
1049end:
1050 lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
1051 (void *)limMsg->bodyptr);
1052 return;
1053} /*** end lim_handle80211_frames() ***/
1054
1055/**
1056 * lim_send_stop_scan_offload_req()
1057 *
1058 ***FUNCTION:
1059 * This function will be called to abort the ongoing offloaded scan
1060 * request.
1061 *
1062 *
1063 ***NOTE:
1064 *
1065 * @param pMac Pointer to Global MAC structure
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301066 * @return QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001067 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301068QDF_STATUS lim_send_stop_scan_offload_req(tpAniSirGlobal pMac,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001069 uint8_t SessionId, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001070{
1071 tSirMsgQ msg;
1072 tSirRetStatus rc = eSIR_SUCCESS;
1073 tAbortScanParams *pAbortScanParams;
1074
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301075 pAbortScanParams = qdf_mem_malloc(sizeof(tAbortScanParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001076 if (NULL == pAbortScanParams) {
1077 lim_log(pMac, LOGP,
1078 FL("Memory allocation failed for AbortScanParams"));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301079 return QDF_STATUS_E_NOMEM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001080 }
1081
1082 pAbortScanParams->SessionId = SessionId;
1083 pAbortScanParams->scan_id = scan_id;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001084 pAbortScanParams->scan_requestor_id = scan_requestor_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001085 msg.type = WMA_STOP_SCAN_OFFLOAD_REQ;
1086 msg.bodyptr = pAbortScanParams;
1087 msg.bodyval = 0;
1088
1089 rc = wma_post_ctrl_msg(pMac, &msg);
1090 if (rc != eSIR_SUCCESS) {
1091 lim_log(pMac, LOGE, FL("wma_post_ctrl_msg() return failure"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301092 qdf_mem_free(pAbortScanParams);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301093 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001094 }
1095
1096 lim_log(pMac, LOG1, FL("Abort ongoing offload scan."));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301097 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001098
1099}
1100
1101/**
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001102 * lim_process_abort_scan_ind() - abort the scan which is presently being run
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001103 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001104 * @mac_ctx: Pointer to Global MAC structure
1105 * @session_id: PE session
1106 * @scan_id: Scan ID from the scan request
1107 * @scan_requesor_id: Entity requesting the scan
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001108 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001109 * @return: None
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001110 */
1111void lim_process_abort_scan_ind(tpAniSirGlobal mac_ctx,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001112 uint8_t session_id, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001113{
1114#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001115 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
1116 NULL, 0, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001117#endif
1118
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001119 lim_log(mac_ctx, LOG2, FL("scan_id %d, scan_requestor_id 0x%x"),
1120 scan_id, scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001121
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001122 /* send stop scan cmd to firmware */
1123 lim_send_stop_scan_offload_req(mac_ctx, session_id, scan_id,
1124 scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001125 return;
1126}
1127
1128/**
1129 * lim_message_processor() - Process messages from LIM.
1130 *
1131 * @mac_ctx: Pointer to the Global Mac Context.
1132 * @msg: Received LIM message.
1133 *
1134 * Wrapper function for lim_process_messages when handling messages received by
1135 * LIM.Could either defer messages or process them.
1136 *
1137 * Return: None.
1138 */
1139void lim_message_processor(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1140{
1141 if (eLIM_MLM_OFFLINE_STATE == mac_ctx->lim.gLimMlmState) {
1142 pe_free_msg(mac_ctx, msg);
1143 return;
1144 }
1145
1146 if (!def_msg_decision(mac_ctx, msg)) {
1147 lim_process_messages(mac_ctx, msg);
1148 /* process deferred message queue if allowed */
1149 if ((!(mac_ctx->lim.gLimAddtsSent)) &&
1150 (!(lim_is_system_in_scan_state(mac_ctx))) &&
1151 (true == GET_LIM_PROCESS_DEFD_MESGS(mac_ctx)))
1152 lim_process_deferred_message_queue(mac_ctx);
1153 }
1154}
1155
1156#ifdef FEATURE_OEM_DATA_SUPPORT
1157
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301158void lim_oem_data_rsp_handle_resume_link_rsp(tpAniSirGlobal pMac, QDF_STATUS status,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001159 uint32_t *mlmOemDataRsp)
1160{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301161 if (status != QDF_STATUS_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001162 lim_log(pMac, LOGE,
1163 FL
1164 ("OEM Data Rsp failed to get the response for resume link"));
1165 }
1166
1167 if (NULL != pMac->lim.gpLimMlmOemDataReq) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301168 qdf_mem_free(pMac->lim.gpLimMlmOemDataReq);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001169 pMac->lim.gpLimMlmOemDataReq = NULL;
1170 }
1171 /* "Failure" status doesn't mean that Oem Data Rsp did not happen */
1172 /* and hence we need to respond to upper layers. Only Resume link is failed, but */
1173 /* we got the oem data response already. */
1174 /* Post the meessage to MLM */
1175 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1176 (uint32_t *) (mlmOemDataRsp));
1177
1178 return;
1179}
1180
1181void lim_process_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *body)
1182{
1183 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1184
1185 /* Process all the messages for the lim queue */
1186 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1187
1188 mlmOemDataRsp = (tpLimMlmOemDataRsp) body;
1189
1190 PELOG1(lim_log
1191 (pMac, LOG1, FL("%s: sending oem data response msg to sme"),
1192 __func__);
1193 )
1194 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1195 (uint32_t *) (mlmOemDataRsp));
1196
1197 return;
1198}
1199
1200#endif
1201
Sandeep Puligillae0875662016-02-12 16:09:21 -08001202static void lim_process_sme_obss_scan_ind(tpAniSirGlobal mac_ctx,
1203 struct sSirMsgQ *msg)
1204{
1205 struct sPESession *session;
1206 uint8_t session_id;
1207 struct sme_obss_ht40_scanind_msg *ht40_scanind;
1208
1209 ht40_scanind = (struct sme_obss_ht40_scanind_msg *)msg->bodyptr;
1210 session = pe_find_session_by_bssid(mac_ctx,
1211 ht40_scanind->mac_addr.bytes, &session_id);
1212 if (session == NULL) {
1213 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1214 "OBSS Scan not started: session id is NULL");
1215 return;
1216 }
1217 if (session->htSupportedChannelWidthSet ==
1218 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
1219 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1220 "OBSS Scan Start Req: session id %d"
1221 "htSupportedChannelWidthSet %d",
1222 session->peSessionId,
1223 session->htSupportedChannelWidthSet);
1224 lim_send_ht40_obss_scanind(mac_ctx, session);
1225 } else {
1226 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1227 "OBSS Scan not started: channel width - %d session %d",
1228 session->htSupportedChannelWidthSet,
1229 session->peSessionId);
1230 }
1231 return;
1232}
1233
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001234/**
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301235 * lim_handle_hw_mode_change_on_csa() - Do HW mode change on CSA for STA mode
1236 * @mac_ctx: Global MAC context
1237 * @msg: Received message
1238 *
1239 * Checks if hw mode change is required for the new channel.
1240 * If MCC upgrade is required, this function will start the opportunistic
1241 * timer and the caller will invoke the other APIs to perform vdev restart on
1242 * the new channel.
1243 *
1244 * If DBS downgrade is required, this function will initiate the hw mode
1245 * change and vdev restart will happen on the new channel after getting hw
1246 * mode response
1247 *
1248 * Return: QDF_STATUS_SUCCESS if processing of csa params (and hence vdev
1249 * restart) needs to happen or if no hw mode change is required,
1250 * QDF_STATUS_E_FAILURE otherwise.
1251 */
1252static QDF_STATUS lim_handle_hw_mode_change_on_csa(tpAniSirGlobal mac_ctx,
1253 tpSirMsgQ msg)
1254{
1255 tpPESession session_entry;
1256 struct csa_offload_params *csa_params =
1257 (struct csa_offload_params *) (msg->bodyptr);
1258 tpDphHashNode sta_ds = NULL;
1259 uint8_t session_id;
1260 uint16_t aid = 0;
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301261 QDF_STATUS status = QDF_STATUS_E_FAILURE;
1262
1263 lim_log(mac_ctx, LOG1, FL("handle hw mode change for csa"));
1264
1265 if (!csa_params) {
1266 lim_log(mac_ctx, LOGE, FL("limMsgQ body ptr is NULL"));
1267 /* qdf_mem_free() can handle NULL values */
1268 goto err;
1269 }
1270
1271 session_entry = pe_find_session_by_bssid(mac_ctx,
1272 csa_params->bssId, &session_id);
1273 if (!session_entry) {
1274 lim_log(mac_ctx, LOGE, FL("Session does not exist"));
1275 goto err;
1276 }
1277
1278 sta_ds = dph_lookup_hash_entry(mac_ctx, session_entry->bssId, &aid,
1279 &session_entry->dph.dphHashTable);
1280
1281 if (!sta_ds) {
1282 lim_log(mac_ctx, LOGE, FL("sta_ds does not exist"));
1283 goto err;
1284 }
1285
Krunal Soniee572472016-02-11 11:48:53 -08001286 status = cds_handle_hw_mode_change_on_csa(session_entry->smeSessionId,
1287 csa_params->channel, csa_params->bssId,
1288 &session_entry->saved_csa_params, csa_params,
1289 sizeof(session_entry->saved_csa_params));
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301290
Krunal Soniee572472016-02-11 11:48:53 -08001291 if (QDF_IS_STATUS_SUCCESS(status))
1292 return status;
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301293
1294err:
1295 qdf_mem_free(csa_params);
1296 return status;
1297}
1298
1299/**
1300 * lim_handle_hw_mode_change_on_csa_event() - Handle hw mode change on csa
1301 * @mac_ctx: Pointer to the Global Mac Context
1302 * @msg: Received message
1303 *
1304 * Checks if a hw mode change is required for the received csa event. Processes
1305 * csa params and do vdev restart immediately if the there is no need for a hw
1306 * mode change or if MCC upgrade is required
1307 *
1308 * Return: None
1309 */
1310static void lim_handle_hw_mode_change_on_csa_event(tpAniSirGlobal mac_ctx,
1311 tpSirMsgQ msg)
1312{
1313 QDF_STATUS qdf_status;
1314
1315 lim_log(mac_ctx, LOG1, FL("lim received csa offload event"));
1316 if (mac_ctx->policy_manager_enabled &&
1317 wma_is_hw_dbs_capable() == true) {
1318 /* Check if a hw mode change is required */
1319 qdf_status = lim_handle_hw_mode_change_on_csa(mac_ctx,
1320 msg);
1321 /* Process csa params and do vdev restart immediately if
1322 * there is no need for a hw mode change or if MCC upgrade is
1323 * required.
1324 */
1325 if (QDF_IS_STATUS_SUCCESS(qdf_status))
1326 lim_handle_csa_offload_msg(mac_ctx, msg);
1327 } else {
1328 lim_handle_csa_offload_msg(mac_ctx, msg);
1329 }
1330}
1331
1332/**
1333 * lim_handle_csa_event_post_dbs_downgrade() - Process csa event post dbs
1334 * downgrade
1335 * @mac_ctx: Pointer to the Global Mac Context
1336 * @msg: Received message
1337 *
1338 * Process the csa event to do vdev restart on the new channel after the dbs
1339 * downgrade. If there was a DBS downgrade as part of the event
1340 * WMA_CSA_OFFLOAD_EVENT, SIR_LIM_CSA_POST_HW_MODE_CHANGE will be received after
1341 * receiving the set hw mode response, where this processing will happen.
1342 *
1343 * Return: None
1344 */
1345static void lim_handle_csa_event_post_dbs_downgrade(tpAniSirGlobal mac_ctx,
1346 tpSirMsgQ msg)
1347{
1348 tSirMsgQ csa_msg;
1349 tpPESession session_entry;
1350
1351 struct sir_saved_csa_params *buf =
1352 (struct sir_saved_csa_params *)msg->bodyptr;
1353
1354 /* Null check for 'msg' already done before coming here in the caller */
1355
1356 session_entry = pe_find_session_by_sme_session_id(mac_ctx,
1357 buf->session_id);
1358 if (!session_entry) {
1359 lim_log(mac_ctx, LOGE, FL("Invalid session id:%d"),
1360 buf->session_id);
1361 return;
1362 }
1363
1364 lim_log(mac_ctx, LOG1,
1365 FL("received csa offload event post hw change for %pM"),
1366 session_entry->saved_csa_params.bssId);
1367
1368 csa_msg.bodyptr = qdf_mem_malloc(
1369 sizeof(struct csa_offload_params));
1370 if (!csa_msg.bodyptr) {
1371 lim_log(mac_ctx, LOGE, FL("malloc failed for csa msg"));
1372 goto clean_msg_body;
1373 }
1374
1375 qdf_mem_copy((void *)csa_msg.bodyptr,
1376 (void *)&session_entry->saved_csa_params,
1377 sizeof(struct csa_offload_params));
1378 /* If there was a DBS downgrade as part of the event
1379 * WMA_CSA_OFFLOAD_EVENT, SIR_LIM_CSA_POST_HW_MODE_CHANGE will
1380 * be received after receiving the set hw mode response.
1381 */
1382 lim_handle_csa_offload_msg(mac_ctx, &csa_msg);
1383clean_msg_body:
1384 if (msg->bodyptr)
1385 qdf_mem_free(msg->bodyptr);
1386}
1387
1388/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001389 * lim_process_messages() - Process messages from upper layers.
1390 *
1391 * @mac_ctx: Pointer to the Global Mac Context.
1392 * @msg: Received message.
1393 *
1394 * Return: None.
1395 */
1396void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1397{
1398#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1399 uint8_t vdev_id = 0;
1400 tUpdateBeaconParams beacon_params;
1401#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1402 uint8_t i;
1403 uint8_t p2p_go_exists = 0;
1404 tpPESession session_entry = NULL;
1405 uint8_t defer_msg = false;
1406 tLinkStateParams *link_state_param;
1407 uint16_t pkt_len = 0;
1408 cds_pkt_t *body_ptr = NULL;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301409 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001410 tSirMsgQ new_msg;
1411 tSirSmeScanAbortReq *req_msg = NULL;
1412 uint8_t session_id;
1413 uint32_t scan_id;
1414
1415#ifdef FEATURE_WLAN_TDLS
1416 tSirTdlsInd *tdls_ind = NULL;
1417 tpDphHashNode sta_ds = NULL;
1418 tTdlsLinkEstablishParams *tdls_link_params = NULL;
1419#endif
1420 tSirMbMsgP2p *p2p_msg = NULL;
1421 if (ANI_DRIVER_TYPE(mac_ctx) == eDRIVER_TYPE_MFG) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301422 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001423 msg->bodyptr = NULL;
1424 return;
1425 }
1426 if (msg == NULL) {
1427 lim_log(mac_ctx, LOGE, FL("Message pointer is Null"));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301428 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001429 return;
1430 }
1431#ifdef WLAN_DEBUG
1432 mac_ctx->lim.numTot++;
1433#endif
1434 MTRACE(mac_trace_msg_rx(mac_ctx, NO_SESSION,
1435 LIM_TRACE_MAKE_RXMSG(msg->type, LIM_MSG_PROCESSED));)
1436
1437 switch (msg->type) {
1438
1439 case SIR_LIM_UPDATE_BEACON:
1440 lim_update_beacon(mac_ctx);
1441 break;
1442 case SIR_CFG_PARAM_UPDATE_IND:
1443 if (!lim_is_system_in_scan_state(mac_ctx)) {
1444 lim_handle_cf_gparam_update(mac_ctx, msg->bodyval);
1445 break;
1446 }
1447 /* System is in DFS (Learn) mode.
1448 * Defer processsing this message
1449 */
1450 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
1451 if (!(mac_ctx->lim.deferredMsgCnt & 0xF))
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301452 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001453 FL("Unable to Defer Msg"));
1454 lim_log_session_states(mac_ctx);
1455 lim_print_msg_name(mac_ctx, LOGE, msg->type);
1456 }
1457 break;
1458#ifdef FEATURE_OEM_DATA_SUPPORT
1459 case WMA_START_OEM_DATA_RSP:
1460 lim_process_oem_data_rsp(mac_ctx, msg->bodyptr);
1461 msg->bodyptr = NULL;
1462 break;
1463#endif
1464 case WMA_SWITCH_CHANNEL_RSP:
1465 lim_process_switch_channel_rsp(mac_ctx, msg->bodyptr);
1466 msg->bodyptr = NULL;
1467 break;
1468#ifdef ANI_SIR_IBSS_PEER_CACHING
1469 case WMA_IBSS_STA_ADD:
1470 lim_ibss_sta_add(mac_ctx, msg->bodyptr);
1471 break;
1472#endif
1473 case SIR_BB_XPORT_MGMT_MSG:
1474 /* These messages are from Peer MAC entity. */
1475#ifdef WLAN_DEBUG
1476 mac_ctx->lim.numBbt++;
1477#endif
1478 /* The original msg which we were deferring have the
1479 * bodyPointer point to 'BD' instead of 'cds pkt'. If we
1480 * don't make a copy of msg, then overwrite the
1481 * msg->bodyPointer and next time when we try to
1482 * process the msg, we will try to use 'BD' as
1483 * 'cds Pkt' which will cause a crash
1484 */
1485 if (msg->bodyptr == NULL) {
1486 lim_log(mac_ctx, LOGE, FL("Message bodyptr is Null"));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301487 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001488 break;
1489 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301490 qdf_mem_copy((uint8_t *) &new_msg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001491 (uint8_t *) msg, sizeof(tSirMsgQ));
1492 body_ptr = (cds_pkt_t *) new_msg.bodyptr;
1493 cds_pkt_get_packet_length(body_ptr, &pkt_len);
1494
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301495 qdf_status = wma_ds_peek_rx_packet_info(body_ptr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001496 (void **) &new_msg.bodyptr, false);
1497
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301498 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001499 cds_pkt_return_packet(body_ptr);
1500 break;
1501 }
1502
Anurag Chouhanffb21542016-02-17 14:33:03 +05301503 if (WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr))
1504 lim_log(mac_ctx, LOG1, FL("roamCandidateInd %d"),
1505 WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001506
Anurag Chouhanffb21542016-02-17 14:33:03 +05301507 if (WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr))
1508 lim_log(mac_ctx, LOG1, FL("offloadScanLearn %d"),
1509 WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001510
1511 lim_handle80211_frames(mac_ctx, &new_msg, &defer_msg);
1512
1513 if (defer_msg == true) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301514 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001515 FL("Defer Msg type=%x"), msg->type);
1516 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301517 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001518 FL("Unable to Defer Msg"));
1519 lim_log_session_states(mac_ctx);
1520 cds_pkt_return_packet(body_ptr);
1521 }
1522 } else
1523 /* PE is not deferring this 802.11 frame so we need to
1524 * call cds_pkt_return. Asumption here is when Rx mgmt
1525 * frame processing is done, cds packet could be
1526 * freed here.
1527 */
1528 cds_pkt_return_packet(body_ptr);
1529 break;
1530 case eWNI_SME_SCAN_REQ:
1531 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
1532 case eWNI_SME_DISASSOC_REQ:
1533 case eWNI_SME_DEAUTH_REQ:
1534#ifdef FEATURE_OEM_DATA_SUPPORT
1535 case eWNI_SME_OEM_DATA_REQ:
1536#endif
1537#ifdef FEATURE_WLAN_TDLS
1538 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1539 case eWNI_SME_TDLS_ADD_STA_REQ:
1540 case eWNI_SME_TDLS_DEL_STA_REQ:
1541 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
1542#endif
1543 case eWNI_SME_RESET_AP_CAPS_CHANGED:
1544 case eWNI_SME_SET_HW_MODE_REQ:
1545 case eWNI_SME_SET_DUAL_MAC_CFG_REQ:
Archana Ramachandrana20ef812015-11-13 16:12:13 -08001546 case eWNI_SME_SET_ANTENNA_MODE_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001547 /* These messages are from HDD. Need to respond to HDD */
1548 lim_process_normal_hdd_msg(mac_ctx, msg, true);
1549 break;
1550
1551 case eWNI_SME_SCAN_ABORT_IND:
1552 req_msg = msg->bodyptr;
1553 if (req_msg) {
1554 session_id = req_msg->sessionId;
1555 scan_id = req_msg->scan_id;
1556 lim_process_abort_scan_ind(mac_ctx, session_id,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001557 scan_id, USER_SCAN_REQUESTOR_ID);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301558 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001559 msg->bodyptr = NULL;
1560 }
1561 break;
1562 case eWNI_SME_SYS_READY_IND:
1563 case eWNI_SME_JOIN_REQ:
1564 case eWNI_SME_REASSOC_REQ:
1565 case eWNI_SME_START_BSS_REQ:
1566 case eWNI_SME_STOP_BSS_REQ:
1567 case eWNI_SME_SWITCH_CHL_IND:
1568 case eWNI_SME_SETCONTEXT_REQ:
1569 case eWNI_SME_DISASSOC_CNF:
1570 case eWNI_SME_DEAUTH_CNF:
1571 case eWNI_SME_ASSOC_CNF:
1572 case eWNI_SME_ADDTS_REQ:
1573 case eWNI_SME_DELTS_REQ:
1574 case eWNI_SME_GET_ASSOC_STAS_REQ:
1575 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1576 case eWNI_SME_UPDATE_APWPSIE_REQ:
1577 case eWNI_SME_HIDE_SSID_REQ:
1578 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1579 case eWNI_SME_SET_APWPARSNIEs_REQ:
1580 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001581 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1582 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001583#if defined FEATURE_WLAN_ESE
1584 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
1585#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001586 case eWNI_SME_FT_UPDATE_KEY:
1587 case eWNI_SME_FT_PRE_AUTH_REQ:
1588 case eWNI_SME_FT_AGGR_QOS_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001589 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1590 case eWNI_SME_UPDATE_NOA:
1591 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
1592 case eWNI_SME_GET_STATISTICS_REQ:
1593#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
1594 case eWNI_SME_GET_TSM_STATS_REQ:
1595#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Abhishek Singh7996eb72015-12-30 17:24:02 +05301596 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
Abhishek Singh518323d2015-10-19 17:42:01 +05301597 case eWNI_SME_EXT_CHANGE_CHANNEL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001598 /* These messages are from HDD.No need to respond to HDD */
1599 lim_process_normal_hdd_msg(mac_ctx, msg, false);
1600 break;
1601
1602 case eWNI_PMC_SMPS_STATE_IND:
1603 if (msg->bodyptr) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301604 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001605 msg->bodyptr = NULL;
1606 }
1607 break;
1608 case eWNI_SME_SEND_ACTION_FRAME_IND:
1609 lim_send_p2p_action_frame(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301610 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001611 msg->bodyptr = NULL;
1612 break;
1613 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1614 p2p_msg = (tSirMbMsgP2p *) msg->bodyptr;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001615 lim_process_abort_scan_ind(mac_ctx, p2p_msg->sessionId,
1616 p2p_msg->scan_id, ROC_SCAN_REQUESTOR_ID);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301617 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001618 msg->bodyptr = NULL;
1619 break;
1620 case SIR_HAL_P2P_NOA_START_IND:
1621 session_entry = &mac_ctx->lim.gpSession[0];
1622 lim_log(mac_ctx, LOG1, "LIM received NOA start %x", msg->type);
1623
1624 /* Since insert NOA is done and NOA start msg received,
1625 * we should deactivate the Insert NOA timer
1626 */
1627 lim_deactivate_and_change_timer(mac_ctx,
1628 eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1629
1630 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1631 session_entry = &mac_ctx->lim.gpSession[i];
1632 if ((session_entry != NULL) && (session_entry->valid) &&
Anurag Chouhan6d760662016-02-20 16:05:43 +05301633 (session_entry->pePersona == QDF_P2P_GO_MODE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001634 /* Save P2P NOA start attribute for Go persona*/
1635 p2p_go_exists = 1;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301636 qdf_mem_copy(&session_entry->p2pGoPsNoaStartInd,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001637 msg->bodyptr, sizeof(tSirP2PNoaStart));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301638 qdf_status =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001639 session_entry->p2pGoPsNoaStartInd.status;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301640 if (qdf_status != QDF_STATUS_SUCCESS)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301641 QDF_TRACE(QDF_MODULE_ID_PE, LOGW,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001642 FL(
1643 "GO NOA start status %d by FW"),
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301644 qdf_status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001645 break;
1646 }
1647 }
1648
1649 if (p2p_go_exists == 0)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301650 QDF_TRACE(QDF_MODULE_ID_PE, LOGW,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001651 FL(
1652 "GO is removed by the time NOA start recvd"));
1653
1654 /* We received the NOA start indication. Now we can send down
1655 * the SME request which requires off-channel operation */
1656 lim_process_regd_defd_sme_req_after_noa_start(mac_ctx);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301657 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001658 msg->bodyptr = NULL;
1659 break;
1660#ifdef FEATURE_WLAN_TDLS
1661 case SIR_HAL_TDLS_IND:
1662 tdls_ind = (tpSirTdlsInd) msg->bodyptr;
1663 session_entry = pe_find_session_by_sta_id(mac_ctx,
1664 tdls_ind->staIdx, &session_id);
1665 if (session_entry == NULL) {
1666 lim_log(mac_ctx, LOG1,
1667 FL("No session exist for given bssId"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301668 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001669 msg->bodyptr = NULL;
1670 return;
1671 }
1672 sta_ds = dph_get_hash_entry(mac_ctx, tdls_ind->assocId,
1673 &session_entry->dph.dphHashTable);
1674 if (sta_ds == NULL) {
1675 lim_log(mac_ctx, LOG1,
1676 FL("No sta_ds exist for given staId"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301677 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001678 msg->bodyptr = NULL;
1679 return;
1680 }
1681
1682 if (STA_ENTRY_TDLS_PEER == sta_ds->staType) {
1683 lim_log(mac_ctx, LOGE,
1684 FL("rcvd TDLS IND from FW with RC %d "),
1685 tdls_ind->reasonCode);
1686 lim_send_sme_tdls_del_sta_ind(mac_ctx, sta_ds,
1687 session_entry, tdls_ind->reasonCode);
1688 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301689 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001690 msg->bodyptr = NULL;
1691 break;
1692#endif
1693 case SIR_HAL_P2P_NOA_ATTR_IND:
1694 session_entry = &mac_ctx->lim.gpSession[0];
1695 lim_log(mac_ctx, LOG1, FL("Received message Noa_ATTR %x"),
1696 msg->type);
1697 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1698 session_entry = &mac_ctx->lim.gpSession[i];
1699 if ((session_entry != NULL) && (session_entry->valid)
1700 && (session_entry->pePersona ==
Anurag Chouhan6d760662016-02-20 16:05:43 +05301701 QDF_P2P_GO_MODE)) { /* Save P2P attr for Go */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301702 qdf_mem_copy(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001703 &session_entry->p2pGoPsUpdate,
1704 msg->bodyptr,
1705 sizeof(tSirP2PNoaAttr));
1706 lim_log(mac_ctx, LOG2,
1707 FL("bssId"
1708 MAC_ADDRESS_STR
1709 " ctWin=%d oppPsFlag=%d"),
1710 MAC_ADDR_ARRAY(
1711 session_entry->bssId),
1712 session_entry->p2pGoPsUpdate.ctWin,
1713 session_entry->p2pGoPsUpdate.oppPsFlag);
1714 lim_log(mac_ctx, LOG2,
1715 FL
1716 (" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
1717 session_entry->p2pGoPsUpdate.uNoa1IntervalCnt,
1718 session_entry->p2pGoPsUpdate.uNoa1Duration,
1719 session_entry->p2pGoPsUpdate.uNoa1Interval,
1720 session_entry->p2pGoPsUpdate.uNoa1StartTime);
1721 break;
1722 }
1723 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301724 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001725 msg->bodyptr = NULL;
1726 break;
1727 case WMA_MISSED_BEACON_IND:
1728 lim_ps_offload_handle_missed_beacon_ind(mac_ctx, msg);
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;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001732 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1733 lim_process_sme_req_messages(mac_ctx, msg);
1734 break;
1735#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001736 case WMA_TSM_STATS_RSP:
1737#ifdef FEATURE_WLAN_ESE_UPLOAD
1738 lim_send_sme_pe_ese_tsm_rsp(mac_ctx,
1739 (tAniGetTsmStatsRsp *) msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001740#endif /* FEATURE_WLAN_ESE_UPLOAD */
1741 break;
1742#endif
1743 case WMA_ADD_TS_RSP:
1744 lim_process_hal_add_ts_rsp(mac_ctx, msg);
1745 break;
1746 case SIR_LIM_DEL_TS_IND:
1747 lim_process_del_ts_ind(mac_ctx, msg);
1748 break;
1749 case SIR_LIM_BEACON_GEN_IND:
1750 if (mac_ctx->lim.gLimSystemRole != eLIM_AP_ROLE)
1751 sch_process_pre_beacon_ind(mac_ctx, msg);
1752 break;
1753 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1754 lim_delete_sta_context(mac_ctx, msg);
1755 break;
1756 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1757 case SIR_LIM_JOIN_FAIL_TIMEOUT:
1758 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
1759 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1760 case SIR_LIM_AUTH_RSP_TIMEOUT:
1761 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1762 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001763 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001764 case SIR_LIM_REMAIN_CHN_TIMEOUT:
1765 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
1766 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1767 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
1768 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
1769 /* These timeout messages are handled by MLM sub module */
1770 lim_process_mlm_req_messages(mac_ctx, msg);
1771 break;
1772 case SIR_LIM_HEART_BEAT_TIMEOUT:
1773 /** check if heart beat failed, even if one Beacon
1774 * is rcvd within the Heart Beat interval continue
1775 * normal processing
1776 */
1777 if (NULL == msg->bodyptr)
1778 lim_log(mac_ctx, LOGE,
1779 FL("Can't Process HB TO - bodyptr is Null"));
1780 else {
1781 session_entry = (tpPESession) msg->bodyptr;
1782 lim_log(mac_ctx, LOGE,
1783 FL
1784 ("SIR_LIM_HEART_BEAT_TIMEOUT, Session %d"),
1785 ((tpPESession) msg->bodyptr)->peSessionId);
1786 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;
1794 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1795 mac_ctx->lim.gLimDisassocFrameCredit = 0;
1796 break;
1797 case SIR_LIM_CNF_WAIT_TIMEOUT:
1798 /* Does not receive CNF or dummy packet */
1799 lim_handle_cnf_wait_timeout(mac_ctx, (uint16_t) msg->bodyval);
1800 break;
1801 case SIR_LIM_RETRY_INTERRUPT_MSG:
1802 /* Message from ISR upon TFP's max retry limit interrupt */
1803 break;
1804 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1805 /* Message from ISR upon SP's Invalid session key interrupt */
1806 break;
1807 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1808 /* Message from ISR upon SP's Invalid key ID interrupt */
1809 break;
1810 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1811 /* Message from ISR upon SP's Replay threshold interrupt */
1812 break;
1813 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1814 lim_process_channel_switch_timeout(mac_ctx);
1815 break;
1816 case SIR_LIM_QUIET_TIMEOUT:
1817 lim_process_quiet_timeout(mac_ctx);
1818 break;
1819 case SIR_LIM_QUIET_BSS_TIMEOUT:
1820 lim_process_quiet_bss_timeout(mac_ctx);
1821 break;
1822 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1823 lim_handle_update_olbc_cache(mac_ctx);
1824 break;
1825#ifdef FEATURE_WLAN_TDLS
1826 case SIR_HAL_TDLS_SHOULD_DISCOVER:
1827 case SIR_HAL_TDLS_SHOULD_TEARDOWN:
1828 case SIR_HAL_TDLS_PEER_DISCONNECTED:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301829 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001830 ("%s received tdls event: 0x%x"), __func__, msg->type);
1831 lim_send_sme_tdls_event_notify(mac_ctx, msg->type,
1832 (void *)msg->bodyptr);
1833 break;
1834#endif
1835 case WMA_ADD_BSS_RSP:
1836 lim_process_mlm_add_bss_rsp(mac_ctx, msg);
1837 break;
1838 case WMA_ADD_STA_RSP:
1839 lim_process_add_sta_rsp(mac_ctx, msg);
1840 break;
1841 case WMA_DELETE_STA_RSP:
1842 lim_process_mlm_del_sta_rsp(mac_ctx, msg);
1843 break;
1844 case WMA_DELETE_BSS_RSP:
1845 lim_handle_delete_bss_rsp(mac_ctx, msg);
1846 break;
1847 case WMA_CSA_OFFLOAD_EVENT:
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301848 lim_handle_hw_mode_change_on_csa_event(mac_ctx, msg);
1849 break;
1850 case SIR_LIM_CSA_POST_HW_MODE_CHANGE:
1851 lim_handle_csa_event_post_dbs_downgrade(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001852 break;
1853 case WMA_SET_BSSKEY_RSP:
1854 case WMA_SET_STA_BCASTKEY_RSP:
1855 lim_process_mlm_set_bss_key_rsp(mac_ctx, msg);
1856 break;
1857 case WMA_SET_STAKEY_RSP:
1858 lim_process_mlm_set_sta_key_rsp(mac_ctx, msg);
1859 break;
1860 case WMA_GET_STATISTICS_RSP:
1861 lim_send_sme_pe_statistics_rsp(mac_ctx, msg->type,
1862 (void *)msg->bodyptr);
1863 break;
1864 case WMA_SET_MIMOPS_RSP:
1865 case WMA_SET_TX_POWER_RSP:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301866 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001867 msg->bodyptr = NULL;
1868 break;
1869 case WMA_SET_MAX_TX_POWER_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001870 rrm_set_max_tx_power_rsp(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001871 if (msg->bodyptr != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301872 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001873 msg->bodyptr = NULL;
1874 }
1875 break;
1876 case SIR_LIM_ADDR2_MISS_IND:
1877 lim_log(mac_ctx, LOGE,
1878 FL("Addr2 mismatch interrupt received %X"), msg->type);
1879 /* message from HAL indicating addr2 mismatch interrupt occurred
1880 * msg->bodyptr contains only pointer to 48-bit addr2 field
1881 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301882 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001883 msg->bodyptr = NULL;
1884 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001885 case WMA_AGGR_QOS_RSP:
1886 lim_process_ft_aggr_qo_s_rsp(mac_ctx, msg);
1887 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001888 case WMA_SET_LINK_STATE_RSP:
1889 link_state_param = (tLinkStateParams *) msg->bodyptr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001890 session_entry = link_state_param->session;
1891 if (link_state_param->ft
1892#if defined WLAN_FEATURE_ROAM_OFFLOAD
1893 && !session_entry->bRoamSynchInProgress
1894#endif
1895 )
1896 lim_send_reassoc_req_with_ft_ies_mgmt_frame(mac_ctx,
1897 session_entry->pLimMlmReassocReq,
1898 session_entry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001899 if (link_state_param->callback)
1900 link_state_param->callback(mac_ctx,
1901 link_state_param->callbackArg,
1902 link_state_param->status);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301903 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001904 msg->bodyptr = NULL;
1905 break;
1906 case eWNI_SME_SET_BCN_FILTER_REQ:
1907 session_id = (uint8_t) msg->bodyval;
1908 session_entry = &mac_ctx->lim.gpSession[session_id];
1909 if ((session_entry != NULL) &&
1910 (lim_send_beacon_filter_info(mac_ctx, session_entry) !=
1911 eSIR_SUCCESS))
1912 lim_log(mac_ctx, LOGE,
1913 FL("Failied to send Beacon Filter Info "));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301914 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001915 msg->bodyptr = NULL;
1916 break;
1917#ifdef FEATURE_WLAN_TDLS
1918 case WMA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
1919 tdls_link_params = (tTdlsLinkEstablishParams *) msg->bodyptr;
1920 session_entry = pe_find_session_by_sta_id(mac_ctx,
1921 tdls_link_params->staIdx, &session_id);
1922 if (session_entry == NULL) {
1923 lim_log(mac_ctx, LOGE,
1924 FL("session %u does not exist"), session_id);
1925 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP
1926 * message to SME with session id as zero and status
1927 * as FAILURE so, that message queued in SME queue
1928 * can be freed to prevent the SME cmd buffer leak
1929 */
1930 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx, 0,
1931 NULL, NULL, eSIR_FAILURE);
1932 } else {
1933 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx,
1934 session_entry->smeSessionId, NULL, NULL,
1935 tdls_link_params->status);
1936 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301937 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001938 msg->bodyptr = NULL;
1939 break;
1940#endif
1941 case WMA_RX_SCAN_EVENT:
1942 lim_process_rx_scan_event(mac_ctx, msg->bodyptr);
1943 break;
1944 case WMA_IBSS_PEER_INACTIVITY_IND:
1945 lim_process_ibss_peer_inactivity(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301946 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001947 msg->bodyptr = NULL;
1948 break;
1949 case WMA_DFS_RADAR_IND:
1950 lim_send_sme_dfs_event_notify(mac_ctx, msg->type,
1951 (void *)msg->bodyptr);
1952 /* msg->bodyptr will be freed up by SME/CSR */
1953 break;
1954 case WMA_DFS_BEACON_TX_SUCCESS_IND:
1955 lim_process_beacon_tx_success_ind(mac_ctx, msg->type,
1956 (void *)msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301957 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001958 msg->bodyptr = NULL;
1959 break;
1960 case WMA_DISASSOC_TX_COMP:
1961 lim_disassoc_tx_complete_cnf(mac_ctx, msg->bodyval);
1962 break;
1963 case WMA_DEAUTH_TX_COMP:
1964 lim_deauth_tx_complete_cnf(mac_ctx, msg->bodyval);
1965 break;
1966#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1967 case WMA_UPDATE_Q2Q_IE_IND:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301968 qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001969 beacon_params.paramChangeBitmap = 0;
1970 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1971 vdev_id = ((uint8_t *)msg->bodyptr)[i];
1972 session_entry = pe_find_session_by_sme_session_id(
1973 mac_ctx, vdev_id);
1974 if (session_entry == NULL)
1975 continue;
1976 session_entry->sap_advertise_avoid_ch_ie =
1977 (uint8_t)msg->bodyval;
1978 /*
1979 * if message comes for DFS channel, no need to update:
1980 * 1) We wont have MCC with DFS channels. so no need to
1981 * add Q2Q IE
1982 * 2) We cannot end up in DFS channel SCC by channel
1983 * switch from non DFS MCC scenario, so no need to
1984 * remove Q2Q IE
1985 * 3) There is however a case where device start MCC and
1986 * then user modifies hostapd.conf and does SAP
1987 * restart, in such a case, beacon params will be
1988 * reset and thus will not contain Q2Q IE, by default
1989 */
1990 if (cds_get_channel_state(
1991 session_entry->currentOperChannel)
1992 != CHANNEL_STATE_DFS) {
1993 beacon_params.bssIdx = session_entry->bssIdx;
1994 beacon_params.beaconInterval =
1995 session_entry->beaconParams.beaconInterval;
1996 beacon_params.paramChangeBitmap |=
1997 PARAM_BCN_INTERVAL_CHANGED;
1998 sch_set_fixed_beacon_fields(mac_ctx,
1999 session_entry);
2000 lim_send_beacon_params(mac_ctx, &beacon_params,
2001 session_entry);
2002 }
2003 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302004 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002005 msg->bodyptr = NULL;
2006 break;
2007#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
2008 case eWNI_SME_NSS_UPDATE_REQ:
2009 case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ:
2010 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302011 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002012 msg->bodyptr = NULL;
2013 break;
2014 case eWNI_SME_CHANNEL_CHANGE_REQ:
2015 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302016 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002017 msg->bodyptr = NULL;
2018 break;
2019 case eWNI_SME_START_BEACON_REQ:
2020 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302021 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002022 msg->bodyptr = NULL;
2023 break;
2024 case eWNI_SME_UPDATE_ADDITIONAL_IES:
2025 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302026 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002027 msg->bodyptr = NULL;
2028 break;
2029 case eWNI_SME_MODIFY_ADDITIONAL_IES:
2030 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302031 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002032 msg->bodyptr = NULL;
2033 break;
2034#ifdef QCA_HT_2040_COEX
2035 case eWNI_SME_SET_HT_2040_MODE:
2036 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302037 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002038 msg->bodyptr = NULL;
2039 break;
2040#endif
2041 case SIR_HAL_SOC_SET_HW_MODE_RESP:
2042 lim_process_set_hw_mode_resp(mac_ctx, msg->bodyptr);
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;
2045 break;
2046 case SIR_HAL_SOC_HW_MODE_TRANS_IND:
2047 lim_process_hw_mode_trans_ind(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302048 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002049 msg->bodyptr = NULL;
2050 break;
2051 case SIR_HAL_SOC_DUAL_MAC_CFG_RESP:
2052 lim_process_dual_mac_cfg_resp(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302053 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002054 msg->bodyptr = NULL;
2055 break;
2056 case eWNI_SME_SET_IE_REQ:
2057 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302058 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002059 msg->bodyptr = NULL;
2060 break;
Sandeep Puligillae0875662016-02-12 16:09:21 -08002061 case eWNI_SME_HT40_OBSS_SCAN_IND:
2062 lim_process_sme_obss_scan_ind(mac_ctx, msg);
2063 qdf_mem_free(msg->bodyptr);
Archana Ramachandrana20ef812015-11-13 16:12:13 -08002064 break;
2065 case SIR_HAL_SOC_ANTENNA_MODE_RESP:
2066 lim_process_set_antenna_resp(mac_ctx, msg->bodyptr);
2067 qdf_mem_free((void *)msg->bodyptr);
Sandeep Puligillae0875662016-02-12 16:09:21 -08002068 msg->bodyptr = NULL;
2069 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002070 default:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302071 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002072 msg->bodyptr = NULL;
2073 /* Unwanted messages */
2074 /* Log error */
2075 lim_log(mac_ctx, LOGE,
2076 FL("Discarding unexpected message received %X"),
2077 msg->type);
2078 lim_print_msg_name(mac_ctx, LOGE, msg->type);
2079 break;
2080
2081 } /* switch (msg->type) */
2082} /*** end lim_process_messages() ***/
2083
2084/**
2085 * lim_process_deferred_message_queue
2086 *
2087 ***FUNCTION:
2088 * This function is called by LIM while exiting from Learn
2089 * mode. This function fetches messages posted to the LIM
2090 * deferred message queue limDeferredMsgQ.
2091 *
2092 ***LOGIC:
2093 *
2094 ***ASSUMPTIONS:
2095 * NA
2096 *
2097 ***NOTE:
2098 * NA
2099 *
2100 * @param pMac - Pointer to Global MAC structure
2101 * @return None
2102 */
2103
2104void lim_process_deferred_message_queue(tpAniSirGlobal pMac)
2105{
2106 tSirMsgQ limMsg = { 0, 0, 0 };
2107
2108 tSirMsgQ *readMsg;
2109 uint16_t size;
2110
2111 /*
2112 ** check any deferred messages need to be processed
2113 **/
2114 size = pMac->lim.gLimDeferredMsgQ.size;
2115 if (size > 0) {
2116 while ((readMsg = lim_read_deferred_msg_q(pMac)) != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302117 qdf_mem_copy((uint8_t *) &limMsg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002118 (uint8_t *) readMsg, sizeof(tSirMsgQ));
2119 size--;
2120 lim_process_messages(pMac, &limMsg);
2121
2122 if ((lim_is_system_in_scan_state(pMac))
2123 || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac))
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +05302124 || (pMac->lim.gLimSystemInScanLearnMode)
2125 || pMac->lim.gLimAddtsSent)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002126 break;
2127 }
2128 }
2129} /*** end lim_process_deferred_message_queue() ***/
2130
2131/**
2132 * lim_process_normal_hdd_msg() - Process the message and defer if needed
2133 * @mac_ctx : Pointer to Global MAC structure
2134 * @msg : The message need to be processed
2135 * @rsp_reqd: whether return result to hdd
2136 *
2137 * This function checks the current lim state and decide whether the message
2138 * passed will be deferred or not.
2139 *
2140 * Return: None
2141 */
2142static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx, tSirMsgQ *msg,
2143 uint8_t rsp_reqd)
2144{
2145 bool defer_msg = true;
2146
2147 /* Added For BT-AMP Support */
2148 if ((mac_ctx->lim.gLimSystemRole == eLIM_AP_ROLE)
2149 || (mac_ctx->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE)
2150 || (mac_ctx->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2151 || (mac_ctx->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)) {
2152 /*
2153 * This check is required only for the AP and in 2 cases.
2154 * 1. If we are in learn mode and we receive any of these
2155 * messages, you have to come out of scan and process the
2156 * message, hence dont defer the message here. In handler,
2157 * these message could be defered till we actually come out of
2158 * scan mode.
2159 * 2. If radar is detected, you might have to defer all of
2160 * these messages except Stop BSS request/ Switch channel
2161 * request. This decision is also made inside its handler.
2162 *
2163 * Please be careful while using the flag defer_msg. Possibly
2164 * you might end up in an infinite loop.
2165 */
2166 if ((msg->type == eWNI_SME_START_BSS_REQ) ||
2167 (msg->type == eWNI_SME_STOP_BSS_REQ) ||
2168 (msg->type == eWNI_SME_SWITCH_CHL_IND))
2169 defer_msg = false;
2170 }
2171
2172 if (((mac_ctx->lim.gLimAddtsSent) ||
2173 (lim_is_system_in_scan_state(mac_ctx))) && defer_msg) {
2174 /*
2175 * System is in DFS (Learn) mode or awaiting addts response or
2176 * if radar is detected, Defer processsing this message
2177 */
2178 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
2179#ifdef WLAN_DEBUG
2180 mac_ctx->lim.numSme++;
2181#endif
2182 lim_log_session_states(mac_ctx);
2183 /* Release body */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302184 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002185 msg->bodyptr = NULL;
2186 }
2187 } else {
2188 /*
2189 * These messages are from HDD.Since these requests may also be
2190 * generated internally within LIM module, need to distinquish
2191 * and send response to host
2192 */
2193 if (rsp_reqd)
2194 mac_ctx->lim.gLimRspReqd = true;
2195#ifdef WLAN_DEBUG
2196 mac_ctx->lim.numSme++;
2197#endif
2198 if (lim_process_sme_req_messages(mac_ctx, msg)) {
2199 /*
2200 * Release body. limProcessSmeReqMessage consumed the
2201 * buffer. We can free it.
2202 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302203 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002204 msg->bodyptr = NULL;
2205 }
2206 }
2207}
2208
2209void
2210handle_ht_capabilityand_ht_info(struct sAniSirGlobal *pMac,
2211 tpPESession psessionEntry)
2212{
2213 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2214 tSirMacHTParametersInfo macHTParametersInfo;
2215 tSirMacHTInfoField1 macHTInfoField1;
2216 tSirMacHTInfoField2 macHTInfoField2;
2217 tSirMacHTInfoField3 macHTInfoField3;
2218 uint32_t cfgValue;
2219 uint8_t *ptr;
2220
2221 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) !=
2222 eSIR_SUCCESS) {
2223 lim_log(pMac, LOGP,
2224 FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
2225 return;
2226 }
2227 ptr = (uint8_t *) &macHTCapabilityInfo;
2228 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2229 pMac->lim.gHTLsigTXOPProtection =
2230 (uint8_t) macHTCapabilityInfo.lsigTXOPProtection;
2231 pMac->lim.gHTMIMOPSState =
2232 (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2233 pMac->lim.gHTGreenfield = (uint8_t) macHTCapabilityInfo.greenField;
2234 pMac->lim.gHTMaxAmsduLength =
2235 (uint8_t) macHTCapabilityInfo.maximalAMSDUsize;
2236 pMac->lim.gHTShortGI20Mhz = (uint8_t) macHTCapabilityInfo.shortGI20MHz;
2237 pMac->lim.gHTShortGI40Mhz = (uint8_t) macHTCapabilityInfo.shortGI40MHz;
2238 pMac->lim.gHTPSMPSupport = (uint8_t) macHTCapabilityInfo.psmp;
2239 pMac->lim.gHTDsssCckRate40MHzSupport =
2240 (uint8_t) macHTCapabilityInfo.dsssCckMode40MHz;
2241
2242 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) !=
2243 eSIR_SUCCESS) {
2244 lim_log(pMac, LOGP,
2245 FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
2246 return;
2247 }
2248 ptr = (uint8_t *) &macHTParametersInfo;
2249 *ptr = (uint8_t) (cfgValue & 0xff);
2250 pMac->lim.gHTAMpduDensity = (uint8_t) macHTParametersInfo.mpduDensity;
2251 pMac->lim.gHTMaxRxAMpduFactor =
2252 (uint8_t) macHTParametersInfo.maxRxAMPDUFactor;
2253
2254 /* Get HT IE Info */
2255 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) !=
2256 eSIR_SUCCESS) {
2257 lim_log(pMac, LOGP,
2258 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
2259 return;
2260 }
2261 ptr = (uint8_t *) &macHTInfoField1;
2262 *((uint8_t *) ptr) = (uint8_t) (cfgValue & 0xff);
2263 pMac->lim.gHTServiceIntervalGranularity =
2264 (uint8_t) macHTInfoField1.serviceIntervalGranularity;
2265 pMac->lim.gHTControlledAccessOnly =
2266 (uint8_t) macHTInfoField1.controlledAccessOnly;
2267 pMac->lim.gHTRifsMode = (uint8_t) macHTInfoField1.rifsMode;
2268
2269 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) !=
2270 eSIR_SUCCESS) {
2271 lim_log(pMac, LOGP,
2272 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
2273 return;
2274 }
2275 ptr = (uint8_t *) &macHTInfoField2;
2276 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2277 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2278
2279 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) !=
2280 eSIR_SUCCESS) {
2281 lim_log(pMac, LOGP,
2282 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
2283 return;
2284 }
2285 ptr = (uint8_t *) &macHTInfoField3;
2286 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2287 pMac->lim.gHTPCOActive = (uint8_t) macHTInfoField3.pcoActive;
2288 pMac->lim.gHTPCOPhase = (uint8_t) macHTInfoField3.pcoPhase;
2289 pMac->lim.gHTSecondaryBeacon =
2290 (uint8_t) macHTInfoField3.secondaryBeacon;
2291 pMac->lim.gHTDualCTSProtection =
2292 (uint8_t) macHTInfoField3.dualCTSProtection;
2293 pMac->lim.gHTSTBCBasicMCS = (uint8_t) macHTInfoField3.basicSTBCMCS;
2294
2295 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2296 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2297 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2298 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2299 */
2300 if (psessionEntry != NULL) {
2301 psessionEntry->htCapability =
2302 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2303 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2304 (uint8_t) macHTInfoField3.lsigTXOPProtectionFullSupport;
Sandeep Puligillae0875662016-02-12 16:09:21 -08002305 lim_init_obss_params(pMac, psessionEntry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002306 }
2307}
2308
2309void lim_log_session_states(tpAniSirGlobal mac_ctx)
2310{
2311#ifdef WLAN_DEBUG
2312 int i;
2313
2314 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
2315 if (mac_ctx->lim.gpSession[i].valid) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05302316 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002317 FL("sysRole(%d) Session (%d)"),
2318 mac_ctx->lim.gLimSystemRole, i);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05302319 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002320 FL("SME: Curr %s,Prev %s,MLM: Curr %s,Prev %s"),
2321 lim_sme_state_str(
2322 mac_ctx->lim.gpSession[i].limSmeState),
2323 lim_sme_state_str(
2324 mac_ctx->lim.gpSession[i].limPrevSmeState),
2325 lim_mlm_state_str(
2326 mac_ctx->lim.gpSession[i].limMlmState),
2327 lim_mlm_state_str(
2328 mac_ctx->lim.gpSession[i].limPrevMlmState));
2329 }
2330 }
2331#endif
2332}