blob: 884b2050a8c47507f2745f296e82b6d9de16f085 [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 */
Rajeev Kumarcf835a02016-04-15 15:01:31 -0700933 if (LIM_IS_AP_ROLE(psessionEntry))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800934 lim_process_assoc_req_frame(pMac,
935 pRxPacketInfo,
936 LIM_ASSOC,
937 psessionEntry);
938 else {
939 /* Unwanted messages - Log error */
940 lim_log(pMac, LOGE,
941 FL
942 ("unexpected message received %X"),
943 limMsg->type);
944 lim_print_msg_name(pMac, LOGE,
945 limMsg->type);
946 }
947 break;
948
949 case SIR_MAC_MGMT_ASSOC_RSP:
950 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
951 LIM_ASSOC,
952 psessionEntry);
953 break;
954
955 case SIR_MAC_MGMT_REASSOC_REQ:
956 /* Make sure the role supports Reassociation */
Rajeev Kumarcf835a02016-04-15 15:01:31 -0700957 if (LIM_IS_AP_ROLE(psessionEntry)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800958 lim_process_assoc_req_frame(pMac,
959 pRxPacketInfo,
960 LIM_REASSOC,
961 psessionEntry);
962 } else {
963 /* Unwanted messages - Log error */
964 lim_log(pMac, LOGE,
965 FL
966 ("unexpected message received %X"),
967 limMsg->type);
968 lim_print_msg_name(pMac, LOGE,
969 limMsg->type);
970 }
971 break;
972
973 case SIR_MAC_MGMT_REASSOC_RSP:
974 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
975 LIM_REASSOC,
976 psessionEntry);
977 break;
978
979 case SIR_MAC_MGMT_PROBE_REQ:
980 lim_process_probe_req_frame_multiple_bss(pMac,
981 pRxPacketInfo,
982 psessionEntry);
983 break;
984
985 case SIR_MAC_MGMT_PROBE_RSP:
986 if (psessionEntry == NULL)
987 lim_process_probe_rsp_frame_no_session(pMac,
988 pRxPacketInfo);
989 else
990 lim_process_probe_rsp_frame(pMac,
991 pRxPacketInfo,
992 psessionEntry);
993 break;
994
995 case SIR_MAC_MGMT_BEACON:
996 __lim_handle_beacon(pMac, limMsg, psessionEntry);
997 break;
998
999 case SIR_MAC_MGMT_DISASSOC:
1000 lim_process_disassoc_frame(pMac, pRxPacketInfo,
1001 psessionEntry);
1002 break;
1003
1004 case SIR_MAC_MGMT_AUTH:
1005 lim_process_auth_frame(pMac, pRxPacketInfo,
1006 psessionEntry);
1007 break;
1008
1009 case SIR_MAC_MGMT_DEAUTH:
1010 lim_process_deauth_frame(pMac, pRxPacketInfo,
1011 psessionEntry);
1012 break;
1013
1014 case SIR_MAC_MGMT_ACTION:
1015 if (psessionEntry == NULL)
1016 lim_process_action_frame_no_session(pMac,
1017 pRxPacketInfo);
1018 else {
1019 if (WMA_GET_RX_UNKNOWN_UCAST
1020 (pRxPacketInfo))
1021 lim_handle_unknown_a2_index_frames
1022 (pMac, pRxPacketInfo,
1023 psessionEntry);
1024 else
1025 lim_process_action_frame(pMac,
1026 pRxPacketInfo,
1027 psessionEntry);
1028 }
1029 break;
1030 default:
1031 /* Received Management frame of 'reserved' subtype */
1032 break;
1033 } /* switch (fc.subType) */
1034
1035 }
1036 break;
1037 case SIR_MAC_DATA_FRAME:
1038 {
1039 }
1040 break;
1041 default:
1042 /* Received frame of type 'reserved' */
1043 break;
1044
1045 } /* switch (fc.type) */
1046
1047end:
1048 lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
1049 (void *)limMsg->bodyptr);
1050 return;
1051} /*** end lim_handle80211_frames() ***/
1052
1053/**
1054 * lim_send_stop_scan_offload_req()
1055 *
1056 ***FUNCTION:
1057 * This function will be called to abort the ongoing offloaded scan
1058 * request.
1059 *
1060 *
1061 ***NOTE:
1062 *
1063 * @param pMac Pointer to Global MAC structure
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301064 * @return QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301066QDF_STATUS lim_send_stop_scan_offload_req(tpAniSirGlobal pMac,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001067 uint8_t SessionId, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001068{
1069 tSirMsgQ msg;
1070 tSirRetStatus rc = eSIR_SUCCESS;
1071 tAbortScanParams *pAbortScanParams;
1072
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301073 pAbortScanParams = qdf_mem_malloc(sizeof(tAbortScanParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001074 if (NULL == pAbortScanParams) {
1075 lim_log(pMac, LOGP,
1076 FL("Memory allocation failed for AbortScanParams"));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301077 return QDF_STATUS_E_NOMEM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001078 }
1079
1080 pAbortScanParams->SessionId = SessionId;
1081 pAbortScanParams->scan_id = scan_id;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001082 pAbortScanParams->scan_requestor_id = scan_requestor_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001083 msg.type = WMA_STOP_SCAN_OFFLOAD_REQ;
1084 msg.bodyptr = pAbortScanParams;
1085 msg.bodyval = 0;
1086
1087 rc = wma_post_ctrl_msg(pMac, &msg);
1088 if (rc != eSIR_SUCCESS) {
1089 lim_log(pMac, LOGE, FL("wma_post_ctrl_msg() return failure"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301090 qdf_mem_free(pAbortScanParams);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301091 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001092 }
1093
1094 lim_log(pMac, LOG1, FL("Abort ongoing offload scan."));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301095 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001096
1097}
1098
1099/**
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001100 * lim_process_abort_scan_ind() - abort the scan which is presently being run
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001101 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001102 * @mac_ctx: Pointer to Global MAC structure
1103 * @session_id: PE session
1104 * @scan_id: Scan ID from the scan request
1105 * @scan_requesor_id: Entity requesting the scan
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001106 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001107 * @return: None
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001108 */
1109void lim_process_abort_scan_ind(tpAniSirGlobal mac_ctx,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001110 uint8_t session_id, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001111{
1112#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001113 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
1114 NULL, 0, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001115#endif
1116
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001117 lim_log(mac_ctx, LOG2, FL("scan_id %d, scan_requestor_id 0x%x"),
1118 scan_id, scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001119
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001120 /* send stop scan cmd to firmware */
1121 lim_send_stop_scan_offload_req(mac_ctx, session_id, scan_id,
1122 scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001123 return;
1124}
1125
1126/**
1127 * lim_message_processor() - Process messages from LIM.
1128 *
1129 * @mac_ctx: Pointer to the Global Mac Context.
1130 * @msg: Received LIM message.
1131 *
1132 * Wrapper function for lim_process_messages when handling messages received by
1133 * LIM.Could either defer messages or process them.
1134 *
1135 * Return: None.
1136 */
1137void lim_message_processor(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1138{
1139 if (eLIM_MLM_OFFLINE_STATE == mac_ctx->lim.gLimMlmState) {
1140 pe_free_msg(mac_ctx, msg);
1141 return;
1142 }
1143
1144 if (!def_msg_decision(mac_ctx, msg)) {
1145 lim_process_messages(mac_ctx, msg);
1146 /* process deferred message queue if allowed */
1147 if ((!(mac_ctx->lim.gLimAddtsSent)) &&
1148 (!(lim_is_system_in_scan_state(mac_ctx))) &&
1149 (true == GET_LIM_PROCESS_DEFD_MESGS(mac_ctx)))
1150 lim_process_deferred_message_queue(mac_ctx);
1151 }
1152}
1153
1154#ifdef FEATURE_OEM_DATA_SUPPORT
1155
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301156void lim_oem_data_rsp_handle_resume_link_rsp(tpAniSirGlobal pMac, QDF_STATUS status,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001157 uint32_t *mlmOemDataRsp)
1158{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301159 if (status != QDF_STATUS_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001160 lim_log(pMac, LOGE,
1161 FL
1162 ("OEM Data Rsp failed to get the response for resume link"));
1163 }
1164
1165 if (NULL != pMac->lim.gpLimMlmOemDataReq) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301166 qdf_mem_free(pMac->lim.gpLimMlmOemDataReq);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001167 pMac->lim.gpLimMlmOemDataReq = NULL;
1168 }
1169 /* "Failure" status doesn't mean that Oem Data Rsp did not happen */
1170 /* and hence we need to respond to upper layers. Only Resume link is failed, but */
1171 /* we got the oem data response already. */
1172 /* Post the meessage to MLM */
1173 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1174 (uint32_t *) (mlmOemDataRsp));
1175
1176 return;
1177}
1178
1179void lim_process_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *body)
1180{
1181 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1182
1183 /* Process all the messages for the lim queue */
1184 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1185
1186 mlmOemDataRsp = (tpLimMlmOemDataRsp) body;
1187
1188 PELOG1(lim_log
1189 (pMac, LOG1, FL("%s: sending oem data response msg to sme"),
1190 __func__);
1191 )
1192 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1193 (uint32_t *) (mlmOemDataRsp));
1194
1195 return;
1196}
1197
1198#endif
1199
Sandeep Puligillae0875662016-02-12 16:09:21 -08001200static void lim_process_sme_obss_scan_ind(tpAniSirGlobal mac_ctx,
1201 struct sSirMsgQ *msg)
1202{
1203 struct sPESession *session;
1204 uint8_t session_id;
1205 struct sme_obss_ht40_scanind_msg *ht40_scanind;
1206
1207 ht40_scanind = (struct sme_obss_ht40_scanind_msg *)msg->bodyptr;
1208 session = pe_find_session_by_bssid(mac_ctx,
1209 ht40_scanind->mac_addr.bytes, &session_id);
1210 if (session == NULL) {
1211 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1212 "OBSS Scan not started: session id is NULL");
1213 return;
1214 }
1215 if (session->htSupportedChannelWidthSet ==
1216 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
1217 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1218 "OBSS Scan Start Req: session id %d"
1219 "htSupportedChannelWidthSet %d",
1220 session->peSessionId,
1221 session->htSupportedChannelWidthSet);
1222 lim_send_ht40_obss_scanind(mac_ctx, session);
1223 } else {
1224 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1225 "OBSS Scan not started: channel width - %d session %d",
1226 session->htSupportedChannelWidthSet,
1227 session->peSessionId);
1228 }
1229 return;
1230}
1231
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001232/**
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301233 * lim_handle_hw_mode_change_on_csa() - Do HW mode change on CSA for STA mode
1234 * @mac_ctx: Global MAC context
1235 * @msg: Received message
1236 *
1237 * Checks if hw mode change is required for the new channel.
1238 * If MCC upgrade is required, this function will start the opportunistic
1239 * timer and the caller will invoke the other APIs to perform vdev restart on
1240 * the new channel.
1241 *
1242 * If DBS downgrade is required, this function will initiate the hw mode
1243 * change and vdev restart will happen on the new channel after getting hw
1244 * mode response
1245 *
1246 * Return: QDF_STATUS_SUCCESS if processing of csa params (and hence vdev
1247 * restart) needs to happen or if no hw mode change is required,
1248 * QDF_STATUS_E_FAILURE otherwise.
1249 */
1250static QDF_STATUS lim_handle_hw_mode_change_on_csa(tpAniSirGlobal mac_ctx,
1251 tpSirMsgQ msg)
1252{
1253 tpPESession session_entry;
1254 struct csa_offload_params *csa_params =
1255 (struct csa_offload_params *) (msg->bodyptr);
1256 tpDphHashNode sta_ds = NULL;
1257 uint8_t session_id;
1258 uint16_t aid = 0;
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301259 QDF_STATUS status = QDF_STATUS_E_FAILURE;
1260
1261 lim_log(mac_ctx, LOG1, FL("handle hw mode change for csa"));
1262
1263 if (!csa_params) {
1264 lim_log(mac_ctx, LOGE, FL("limMsgQ body ptr is NULL"));
1265 /* qdf_mem_free() can handle NULL values */
1266 goto err;
1267 }
1268
1269 session_entry = pe_find_session_by_bssid(mac_ctx,
1270 csa_params->bssId, &session_id);
1271 if (!session_entry) {
1272 lim_log(mac_ctx, LOGE, FL("Session does not exist"));
1273 goto err;
1274 }
1275
1276 sta_ds = dph_lookup_hash_entry(mac_ctx, session_entry->bssId, &aid,
1277 &session_entry->dph.dphHashTable);
1278
1279 if (!sta_ds) {
1280 lim_log(mac_ctx, LOGE, FL("sta_ds does not exist"));
1281 goto err;
1282 }
1283
Krunal Soniee572472016-02-11 11:48:53 -08001284 status = cds_handle_hw_mode_change_on_csa(session_entry->smeSessionId,
1285 csa_params->channel, csa_params->bssId,
1286 &session_entry->saved_csa_params, csa_params,
1287 sizeof(session_entry->saved_csa_params));
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301288
Krunal Soniee572472016-02-11 11:48:53 -08001289 if (QDF_IS_STATUS_SUCCESS(status))
1290 return status;
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301291
1292err:
1293 qdf_mem_free(csa_params);
1294 return status;
1295}
1296
1297/**
1298 * lim_handle_hw_mode_change_on_csa_event() - Handle hw mode change on csa
1299 * @mac_ctx: Pointer to the Global Mac Context
1300 * @msg: Received message
1301 *
1302 * Checks if a hw mode change is required for the received csa event. Processes
1303 * csa params and do vdev restart immediately if the there is no need for a hw
1304 * mode change or if MCC upgrade is required
1305 *
1306 * Return: None
1307 */
1308static void lim_handle_hw_mode_change_on_csa_event(tpAniSirGlobal mac_ctx,
1309 tpSirMsgQ msg)
1310{
1311 QDF_STATUS qdf_status;
1312
1313 lim_log(mac_ctx, LOG1, FL("lim received csa offload event"));
1314 if (mac_ctx->policy_manager_enabled &&
1315 wma_is_hw_dbs_capable() == true) {
1316 /* Check if a hw mode change is required */
1317 qdf_status = lim_handle_hw_mode_change_on_csa(mac_ctx,
1318 msg);
1319 /* Process csa params and do vdev restart immediately if
1320 * there is no need for a hw mode change or if MCC upgrade is
1321 * required.
1322 */
1323 if (QDF_IS_STATUS_SUCCESS(qdf_status))
1324 lim_handle_csa_offload_msg(mac_ctx, msg);
1325 } else {
1326 lim_handle_csa_offload_msg(mac_ctx, msg);
1327 }
1328}
1329
1330/**
1331 * lim_handle_csa_event_post_dbs_downgrade() - Process csa event post dbs
1332 * downgrade
1333 * @mac_ctx: Pointer to the Global Mac Context
1334 * @msg: Received message
1335 *
1336 * Process the csa event to do vdev restart on the new channel after the dbs
1337 * downgrade. If there was a DBS downgrade as part of the event
1338 * WMA_CSA_OFFLOAD_EVENT, SIR_LIM_CSA_POST_HW_MODE_CHANGE will be received after
1339 * receiving the set hw mode response, where this processing will happen.
1340 *
1341 * Return: None
1342 */
1343static void lim_handle_csa_event_post_dbs_downgrade(tpAniSirGlobal mac_ctx,
1344 tpSirMsgQ msg)
1345{
1346 tSirMsgQ csa_msg;
1347 tpPESession session_entry;
1348
1349 struct sir_saved_csa_params *buf =
1350 (struct sir_saved_csa_params *)msg->bodyptr;
1351
1352 /* Null check for 'msg' already done before coming here in the caller */
1353
1354 session_entry = pe_find_session_by_sme_session_id(mac_ctx,
1355 buf->session_id);
1356 if (!session_entry) {
1357 lim_log(mac_ctx, LOGE, FL("Invalid session id:%d"),
1358 buf->session_id);
1359 return;
1360 }
1361
1362 lim_log(mac_ctx, LOG1,
1363 FL("received csa offload event post hw change for %pM"),
1364 session_entry->saved_csa_params.bssId);
1365
1366 csa_msg.bodyptr = qdf_mem_malloc(
1367 sizeof(struct csa_offload_params));
1368 if (!csa_msg.bodyptr) {
1369 lim_log(mac_ctx, LOGE, FL("malloc failed for csa msg"));
1370 goto clean_msg_body;
1371 }
1372
1373 qdf_mem_copy((void *)csa_msg.bodyptr,
1374 (void *)&session_entry->saved_csa_params,
1375 sizeof(struct csa_offload_params));
1376 /* If there was a DBS downgrade as part of the event
1377 * WMA_CSA_OFFLOAD_EVENT, SIR_LIM_CSA_POST_HW_MODE_CHANGE will
1378 * be received after receiving the set hw mode response.
1379 */
1380 lim_handle_csa_offload_msg(mac_ctx, &csa_msg);
1381clean_msg_body:
1382 if (msg->bodyptr)
1383 qdf_mem_free(msg->bodyptr);
1384}
1385
1386/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001387 * lim_process_messages() - Process messages from upper layers.
1388 *
1389 * @mac_ctx: Pointer to the Global Mac Context.
1390 * @msg: Received message.
1391 *
1392 * Return: None.
1393 */
1394void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1395{
1396#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1397 uint8_t vdev_id = 0;
1398 tUpdateBeaconParams beacon_params;
1399#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1400 uint8_t i;
1401 uint8_t p2p_go_exists = 0;
1402 tpPESession session_entry = NULL;
1403 uint8_t defer_msg = false;
1404 tLinkStateParams *link_state_param;
1405 uint16_t pkt_len = 0;
1406 cds_pkt_t *body_ptr = NULL;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301407 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001408 tSirMsgQ new_msg;
1409 tSirSmeScanAbortReq *req_msg = NULL;
1410 uint8_t session_id;
1411 uint32_t scan_id;
1412
1413#ifdef FEATURE_WLAN_TDLS
1414 tSirTdlsInd *tdls_ind = NULL;
1415 tpDphHashNode sta_ds = NULL;
1416 tTdlsLinkEstablishParams *tdls_link_params = NULL;
1417#endif
1418 tSirMbMsgP2p *p2p_msg = NULL;
1419 if (ANI_DRIVER_TYPE(mac_ctx) == eDRIVER_TYPE_MFG) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301420 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001421 msg->bodyptr = NULL;
1422 return;
1423 }
1424 if (msg == NULL) {
1425 lim_log(mac_ctx, LOGE, FL("Message pointer is Null"));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301426 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001427 return;
1428 }
1429#ifdef WLAN_DEBUG
1430 mac_ctx->lim.numTot++;
1431#endif
1432 MTRACE(mac_trace_msg_rx(mac_ctx, NO_SESSION,
1433 LIM_TRACE_MAKE_RXMSG(msg->type, LIM_MSG_PROCESSED));)
1434
1435 switch (msg->type) {
1436
1437 case SIR_LIM_UPDATE_BEACON:
1438 lim_update_beacon(mac_ctx);
1439 break;
1440 case SIR_CFG_PARAM_UPDATE_IND:
1441 if (!lim_is_system_in_scan_state(mac_ctx)) {
1442 lim_handle_cf_gparam_update(mac_ctx, msg->bodyval);
1443 break;
1444 }
1445 /* System is in DFS (Learn) mode.
1446 * Defer processsing this message
1447 */
1448 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
1449 if (!(mac_ctx->lim.deferredMsgCnt & 0xF))
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301450 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001451 FL("Unable to Defer Msg"));
1452 lim_log_session_states(mac_ctx);
1453 lim_print_msg_name(mac_ctx, LOGE, msg->type);
1454 }
1455 break;
1456#ifdef FEATURE_OEM_DATA_SUPPORT
1457 case WMA_START_OEM_DATA_RSP:
1458 lim_process_oem_data_rsp(mac_ctx, msg->bodyptr);
1459 msg->bodyptr = NULL;
1460 break;
1461#endif
1462 case WMA_SWITCH_CHANNEL_RSP:
1463 lim_process_switch_channel_rsp(mac_ctx, msg->bodyptr);
1464 msg->bodyptr = NULL;
1465 break;
1466#ifdef ANI_SIR_IBSS_PEER_CACHING
1467 case WMA_IBSS_STA_ADD:
1468 lim_ibss_sta_add(mac_ctx, msg->bodyptr);
1469 break;
1470#endif
1471 case SIR_BB_XPORT_MGMT_MSG:
1472 /* These messages are from Peer MAC entity. */
1473#ifdef WLAN_DEBUG
1474 mac_ctx->lim.numBbt++;
1475#endif
1476 /* The original msg which we were deferring have the
1477 * bodyPointer point to 'BD' instead of 'cds pkt'. If we
1478 * don't make a copy of msg, then overwrite the
1479 * msg->bodyPointer and next time when we try to
1480 * process the msg, we will try to use 'BD' as
1481 * 'cds Pkt' which will cause a crash
1482 */
1483 if (msg->bodyptr == NULL) {
1484 lim_log(mac_ctx, LOGE, FL("Message bodyptr is Null"));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301485 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001486 break;
1487 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301488 qdf_mem_copy((uint8_t *) &new_msg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001489 (uint8_t *) msg, sizeof(tSirMsgQ));
1490 body_ptr = (cds_pkt_t *) new_msg.bodyptr;
1491 cds_pkt_get_packet_length(body_ptr, &pkt_len);
1492
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301493 qdf_status = wma_ds_peek_rx_packet_info(body_ptr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001494 (void **) &new_msg.bodyptr, false);
1495
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301496 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001497 cds_pkt_return_packet(body_ptr);
1498 break;
1499 }
1500
Anurag Chouhanffb21542016-02-17 14:33:03 +05301501 if (WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr))
1502 lim_log(mac_ctx, LOG1, FL("roamCandidateInd %d"),
1503 WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001504
Anurag Chouhanffb21542016-02-17 14:33:03 +05301505 if (WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr))
1506 lim_log(mac_ctx, LOG1, FL("offloadScanLearn %d"),
1507 WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001508
1509 lim_handle80211_frames(mac_ctx, &new_msg, &defer_msg);
1510
1511 if (defer_msg == true) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301512 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001513 FL("Defer Msg type=%x"), msg->type);
1514 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301515 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001516 FL("Unable to Defer Msg"));
1517 lim_log_session_states(mac_ctx);
1518 cds_pkt_return_packet(body_ptr);
1519 }
1520 } else
1521 /* PE is not deferring this 802.11 frame so we need to
1522 * call cds_pkt_return. Asumption here is when Rx mgmt
1523 * frame processing is done, cds packet could be
1524 * freed here.
1525 */
1526 cds_pkt_return_packet(body_ptr);
1527 break;
1528 case eWNI_SME_SCAN_REQ:
1529 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
1530 case eWNI_SME_DISASSOC_REQ:
1531 case eWNI_SME_DEAUTH_REQ:
1532#ifdef FEATURE_OEM_DATA_SUPPORT
1533 case eWNI_SME_OEM_DATA_REQ:
1534#endif
1535#ifdef FEATURE_WLAN_TDLS
1536 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1537 case eWNI_SME_TDLS_ADD_STA_REQ:
1538 case eWNI_SME_TDLS_DEL_STA_REQ:
1539 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
1540#endif
1541 case eWNI_SME_RESET_AP_CAPS_CHANGED:
1542 case eWNI_SME_SET_HW_MODE_REQ:
1543 case eWNI_SME_SET_DUAL_MAC_CFG_REQ:
Archana Ramachandrana20ef812015-11-13 16:12:13 -08001544 case eWNI_SME_SET_ANTENNA_MODE_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001545 /* These messages are from HDD. Need to respond to HDD */
1546 lim_process_normal_hdd_msg(mac_ctx, msg, true);
1547 break;
1548
1549 case eWNI_SME_SCAN_ABORT_IND:
1550 req_msg = msg->bodyptr;
1551 if (req_msg) {
1552 session_id = req_msg->sessionId;
1553 scan_id = req_msg->scan_id;
1554 lim_process_abort_scan_ind(mac_ctx, session_id,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001555 scan_id, USER_SCAN_REQUESTOR_ID);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301556 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001557 msg->bodyptr = NULL;
1558 }
1559 break;
1560 case eWNI_SME_SYS_READY_IND:
1561 case eWNI_SME_JOIN_REQ:
1562 case eWNI_SME_REASSOC_REQ:
1563 case eWNI_SME_START_BSS_REQ:
1564 case eWNI_SME_STOP_BSS_REQ:
1565 case eWNI_SME_SWITCH_CHL_IND:
1566 case eWNI_SME_SETCONTEXT_REQ:
1567 case eWNI_SME_DISASSOC_CNF:
1568 case eWNI_SME_DEAUTH_CNF:
1569 case eWNI_SME_ASSOC_CNF:
1570 case eWNI_SME_ADDTS_REQ:
1571 case eWNI_SME_DELTS_REQ:
1572 case eWNI_SME_GET_ASSOC_STAS_REQ:
1573 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1574 case eWNI_SME_UPDATE_APWPSIE_REQ:
1575 case eWNI_SME_HIDE_SSID_REQ:
1576 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1577 case eWNI_SME_SET_APWPARSNIEs_REQ:
1578 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001579 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1580 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001581#if defined FEATURE_WLAN_ESE
1582 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
1583#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001584 case eWNI_SME_FT_UPDATE_KEY:
1585 case eWNI_SME_FT_PRE_AUTH_REQ:
1586 case eWNI_SME_FT_AGGR_QOS_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001587 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1588 case eWNI_SME_UPDATE_NOA:
1589 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
1590 case eWNI_SME_GET_STATISTICS_REQ:
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001591#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001592 case eWNI_SME_GET_TSM_STATS_REQ:
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001593#endif /* FEATURE_WLAN_ESE */
Abhishek Singh7996eb72015-12-30 17:24:02 +05301594 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
Abhishek Singh518323d2015-10-19 17:42:01 +05301595 case eWNI_SME_EXT_CHANGE_CHANNEL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001596 /* These messages are from HDD.No need to respond to HDD */
1597 lim_process_normal_hdd_msg(mac_ctx, msg, false);
1598 break;
1599
1600 case eWNI_PMC_SMPS_STATE_IND:
1601 if (msg->bodyptr) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301602 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001603 msg->bodyptr = NULL;
1604 }
1605 break;
1606 case eWNI_SME_SEND_ACTION_FRAME_IND:
1607 lim_send_p2p_action_frame(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301608 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001609 msg->bodyptr = NULL;
1610 break;
1611 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1612 p2p_msg = (tSirMbMsgP2p *) msg->bodyptr;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001613 lim_process_abort_scan_ind(mac_ctx, p2p_msg->sessionId,
1614 p2p_msg->scan_id, ROC_SCAN_REQUESTOR_ID);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301615 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001616 msg->bodyptr = NULL;
1617 break;
1618 case SIR_HAL_P2P_NOA_START_IND:
1619 session_entry = &mac_ctx->lim.gpSession[0];
1620 lim_log(mac_ctx, LOG1, "LIM received NOA start %x", msg->type);
1621
1622 /* Since insert NOA is done and NOA start msg received,
1623 * we should deactivate the Insert NOA timer
1624 */
1625 lim_deactivate_and_change_timer(mac_ctx,
1626 eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1627
1628 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1629 session_entry = &mac_ctx->lim.gpSession[i];
1630 if ((session_entry != NULL) && (session_entry->valid) &&
Anurag Chouhan6d760662016-02-20 16:05:43 +05301631 (session_entry->pePersona == QDF_P2P_GO_MODE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001632 /* Save P2P NOA start attribute for Go persona*/
1633 p2p_go_exists = 1;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301634 qdf_mem_copy(&session_entry->p2pGoPsNoaStartInd,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001635 msg->bodyptr, sizeof(tSirP2PNoaStart));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301636 qdf_status =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001637 session_entry->p2pGoPsNoaStartInd.status;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301638 if (qdf_status != QDF_STATUS_SUCCESS)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301639 QDF_TRACE(QDF_MODULE_ID_PE, LOGW,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001640 FL(
1641 "GO NOA start status %d by FW"),
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301642 qdf_status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001643 break;
1644 }
1645 }
1646
1647 if (p2p_go_exists == 0)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301648 QDF_TRACE(QDF_MODULE_ID_PE, LOGW,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001649 FL(
1650 "GO is removed by the time NOA start recvd"));
1651
1652 /* We received the NOA start indication. Now we can send down
1653 * the SME request which requires off-channel operation */
1654 lim_process_regd_defd_sme_req_after_noa_start(mac_ctx);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301655 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001656 msg->bodyptr = NULL;
1657 break;
1658#ifdef FEATURE_WLAN_TDLS
1659 case SIR_HAL_TDLS_IND:
1660 tdls_ind = (tpSirTdlsInd) msg->bodyptr;
1661 session_entry = pe_find_session_by_sta_id(mac_ctx,
1662 tdls_ind->staIdx, &session_id);
1663 if (session_entry == NULL) {
1664 lim_log(mac_ctx, LOG1,
1665 FL("No session exist for given bssId"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301666 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001667 msg->bodyptr = NULL;
1668 return;
1669 }
1670 sta_ds = dph_get_hash_entry(mac_ctx, tdls_ind->assocId,
1671 &session_entry->dph.dphHashTable);
1672 if (sta_ds == NULL) {
1673 lim_log(mac_ctx, LOG1,
1674 FL("No sta_ds exist for given staId"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301675 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001676 msg->bodyptr = NULL;
1677 return;
1678 }
1679
1680 if (STA_ENTRY_TDLS_PEER == sta_ds->staType) {
1681 lim_log(mac_ctx, LOGE,
1682 FL("rcvd TDLS IND from FW with RC %d "),
1683 tdls_ind->reasonCode);
1684 lim_send_sme_tdls_del_sta_ind(mac_ctx, sta_ds,
1685 session_entry, tdls_ind->reasonCode);
1686 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301687 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001688 msg->bodyptr = NULL;
1689 break;
1690#endif
1691 case SIR_HAL_P2P_NOA_ATTR_IND:
1692 session_entry = &mac_ctx->lim.gpSession[0];
1693 lim_log(mac_ctx, LOG1, FL("Received message Noa_ATTR %x"),
1694 msg->type);
1695 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1696 session_entry = &mac_ctx->lim.gpSession[i];
1697 if ((session_entry != NULL) && (session_entry->valid)
1698 && (session_entry->pePersona ==
Anurag Chouhan6d760662016-02-20 16:05:43 +05301699 QDF_P2P_GO_MODE)) { /* Save P2P attr for Go */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301700 qdf_mem_copy(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001701 &session_entry->p2pGoPsUpdate,
1702 msg->bodyptr,
1703 sizeof(tSirP2PNoaAttr));
1704 lim_log(mac_ctx, LOG2,
1705 FL("bssId"
1706 MAC_ADDRESS_STR
1707 " ctWin=%d oppPsFlag=%d"),
1708 MAC_ADDR_ARRAY(
1709 session_entry->bssId),
1710 session_entry->p2pGoPsUpdate.ctWin,
1711 session_entry->p2pGoPsUpdate.oppPsFlag);
1712 lim_log(mac_ctx, LOG2,
1713 FL
1714 (" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
1715 session_entry->p2pGoPsUpdate.uNoa1IntervalCnt,
1716 session_entry->p2pGoPsUpdate.uNoa1Duration,
1717 session_entry->p2pGoPsUpdate.uNoa1Interval,
1718 session_entry->p2pGoPsUpdate.uNoa1StartTime);
1719 break;
1720 }
1721 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301722 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001723 msg->bodyptr = NULL;
1724 break;
1725 case WMA_MISSED_BEACON_IND:
1726 lim_ps_offload_handle_missed_beacon_ind(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301727 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001728 msg->bodyptr = NULL;
1729 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001730 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1731 lim_process_sme_req_messages(mac_ctx, msg);
1732 break;
1733#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001734 case WMA_TSM_STATS_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001735 lim_send_sme_pe_ese_tsm_rsp(mac_ctx,
1736 (tAniGetTsmStatsRsp *) msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001737 break;
1738#endif
1739 case WMA_ADD_TS_RSP:
1740 lim_process_hal_add_ts_rsp(mac_ctx, msg);
1741 break;
1742 case SIR_LIM_DEL_TS_IND:
1743 lim_process_del_ts_ind(mac_ctx, msg);
1744 break;
1745 case SIR_LIM_BEACON_GEN_IND:
1746 if (mac_ctx->lim.gLimSystemRole != eLIM_AP_ROLE)
1747 sch_process_pre_beacon_ind(mac_ctx, msg);
1748 break;
1749 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1750 lim_delete_sta_context(mac_ctx, msg);
1751 break;
1752 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1753 case SIR_LIM_JOIN_FAIL_TIMEOUT:
1754 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
1755 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1756 case SIR_LIM_AUTH_RSP_TIMEOUT:
1757 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1758 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001759 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001760 case SIR_LIM_REMAIN_CHN_TIMEOUT:
1761 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
1762 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1763 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
1764 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +05301765 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001766 /* These timeout messages are handled by MLM sub module */
1767 lim_process_mlm_req_messages(mac_ctx, msg);
1768 break;
1769 case SIR_LIM_HEART_BEAT_TIMEOUT:
1770 /** check if heart beat failed, even if one Beacon
1771 * is rcvd within the Heart Beat interval continue
1772 * normal processing
1773 */
1774 if (NULL == msg->bodyptr)
1775 lim_log(mac_ctx, LOGE,
1776 FL("Can't Process HB TO - bodyptr is Null"));
1777 else {
1778 session_entry = (tpPESession) msg->bodyptr;
1779 lim_log(mac_ctx, LOGE,
1780 FL
1781 ("SIR_LIM_HEART_BEAT_TIMEOUT, Session %d"),
1782 ((tpPESession) msg->bodyptr)->peSessionId);
1783 limResetHBPktCount(session_entry);
1784 lim_handle_heart_beat_timeout_for_session(mac_ctx,
1785 session_entry);
1786 }
1787 break;
1788 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1789 lim_handle_heart_beat_failure_timeout(mac_ctx);
1790 break;
1791 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1792 mac_ctx->lim.gLimDisassocFrameCredit = 0;
1793 break;
1794 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;
1798 case SIR_LIM_RETRY_INTERRUPT_MSG:
1799 /* Message from ISR upon TFP's max retry limit interrupt */
1800 break;
1801 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1802 /* Message from ISR upon SP's Invalid session key interrupt */
1803 break;
1804 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1805 /* Message from ISR upon SP's Invalid key ID interrupt */
1806 break;
1807 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1808 /* Message from ISR upon SP's Replay threshold interrupt */
1809 break;
1810 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1811 lim_process_channel_switch_timeout(mac_ctx);
1812 break;
1813 case SIR_LIM_QUIET_TIMEOUT:
1814 lim_process_quiet_timeout(mac_ctx);
1815 break;
1816 case SIR_LIM_QUIET_BSS_TIMEOUT:
1817 lim_process_quiet_bss_timeout(mac_ctx);
1818 break;
1819 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1820 lim_handle_update_olbc_cache(mac_ctx);
1821 break;
1822#ifdef FEATURE_WLAN_TDLS
1823 case SIR_HAL_TDLS_SHOULD_DISCOVER:
1824 case SIR_HAL_TDLS_SHOULD_TEARDOWN:
1825 case SIR_HAL_TDLS_PEER_DISCONNECTED:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301826 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001827 ("%s received tdls event: 0x%x"), __func__, msg->type);
1828 lim_send_sme_tdls_event_notify(mac_ctx, msg->type,
1829 (void *)msg->bodyptr);
1830 break;
1831#endif
1832 case WMA_ADD_BSS_RSP:
1833 lim_process_mlm_add_bss_rsp(mac_ctx, msg);
1834 break;
1835 case WMA_ADD_STA_RSP:
1836 lim_process_add_sta_rsp(mac_ctx, msg);
1837 break;
1838 case WMA_DELETE_STA_RSP:
1839 lim_process_mlm_del_sta_rsp(mac_ctx, msg);
1840 break;
1841 case WMA_DELETE_BSS_RSP:
1842 lim_handle_delete_bss_rsp(mac_ctx, msg);
1843 break;
1844 case WMA_CSA_OFFLOAD_EVENT:
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301845 lim_handle_hw_mode_change_on_csa_event(mac_ctx, msg);
1846 break;
1847 case SIR_LIM_CSA_POST_HW_MODE_CHANGE:
1848 lim_handle_csa_event_post_dbs_downgrade(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001849 break;
1850 case WMA_SET_BSSKEY_RSP:
1851 case WMA_SET_STA_BCASTKEY_RSP:
1852 lim_process_mlm_set_bss_key_rsp(mac_ctx, msg);
1853 break;
1854 case WMA_SET_STAKEY_RSP:
1855 lim_process_mlm_set_sta_key_rsp(mac_ctx, msg);
1856 break;
1857 case WMA_GET_STATISTICS_RSP:
1858 lim_send_sme_pe_statistics_rsp(mac_ctx, msg->type,
1859 (void *)msg->bodyptr);
1860 break;
1861 case WMA_SET_MIMOPS_RSP:
1862 case WMA_SET_TX_POWER_RSP:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301863 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001864 msg->bodyptr = NULL;
1865 break;
1866 case WMA_SET_MAX_TX_POWER_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001867 rrm_set_max_tx_power_rsp(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001868 if (msg->bodyptr != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301869 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001870 msg->bodyptr = NULL;
1871 }
1872 break;
1873 case SIR_LIM_ADDR2_MISS_IND:
1874 lim_log(mac_ctx, LOGE,
1875 FL("Addr2 mismatch interrupt received %X"), msg->type);
1876 /* message from HAL indicating addr2 mismatch interrupt occurred
1877 * msg->bodyptr contains only pointer to 48-bit addr2 field
1878 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301879 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001880 msg->bodyptr = NULL;
1881 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001882 case WMA_AGGR_QOS_RSP:
1883 lim_process_ft_aggr_qo_s_rsp(mac_ctx, msg);
1884 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001885 case WMA_SET_LINK_STATE_RSP:
1886 link_state_param = (tLinkStateParams *) msg->bodyptr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001887 session_entry = link_state_param->session;
1888 if (link_state_param->ft
1889#if defined WLAN_FEATURE_ROAM_OFFLOAD
1890 && !session_entry->bRoamSynchInProgress
1891#endif
1892 )
1893 lim_send_reassoc_req_with_ft_ies_mgmt_frame(mac_ctx,
1894 session_entry->pLimMlmReassocReq,
1895 session_entry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001896 if (link_state_param->callback)
1897 link_state_param->callback(mac_ctx,
1898 link_state_param->callbackArg,
1899 link_state_param->status);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301900 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001901 msg->bodyptr = NULL;
1902 break;
1903 case eWNI_SME_SET_BCN_FILTER_REQ:
1904 session_id = (uint8_t) msg->bodyval;
1905 session_entry = &mac_ctx->lim.gpSession[session_id];
1906 if ((session_entry != NULL) &&
1907 (lim_send_beacon_filter_info(mac_ctx, session_entry) !=
1908 eSIR_SUCCESS))
1909 lim_log(mac_ctx, LOGE,
1910 FL("Failied to send Beacon Filter Info "));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301911 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001912 msg->bodyptr = NULL;
1913 break;
1914#ifdef FEATURE_WLAN_TDLS
1915 case WMA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
1916 tdls_link_params = (tTdlsLinkEstablishParams *) msg->bodyptr;
1917 session_entry = pe_find_session_by_sta_id(mac_ctx,
1918 tdls_link_params->staIdx, &session_id);
1919 if (session_entry == NULL) {
1920 lim_log(mac_ctx, LOGE,
1921 FL("session %u does not exist"), session_id);
1922 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP
1923 * message to SME with session id as zero and status
1924 * as FAILURE so, that message queued in SME queue
1925 * can be freed to prevent the SME cmd buffer leak
1926 */
1927 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx, 0,
1928 NULL, NULL, eSIR_FAILURE);
1929 } else {
1930 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx,
1931 session_entry->smeSessionId, NULL, NULL,
1932 tdls_link_params->status);
1933 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301934 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001935 msg->bodyptr = NULL;
1936 break;
1937#endif
1938 case WMA_RX_SCAN_EVENT:
1939 lim_process_rx_scan_event(mac_ctx, msg->bodyptr);
1940 break;
1941 case WMA_IBSS_PEER_INACTIVITY_IND:
1942 lim_process_ibss_peer_inactivity(mac_ctx, msg->bodyptr);
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 WMA_DFS_RADAR_IND:
1947 lim_send_sme_dfs_event_notify(mac_ctx, msg->type,
1948 (void *)msg->bodyptr);
1949 /* msg->bodyptr will be freed up by SME/CSR */
1950 break;
1951 case WMA_DFS_BEACON_TX_SUCCESS_IND:
1952 lim_process_beacon_tx_success_ind(mac_ctx, msg->type,
1953 (void *)msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301954 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001955 msg->bodyptr = NULL;
1956 break;
1957 case WMA_DISASSOC_TX_COMP:
1958 lim_disassoc_tx_complete_cnf(mac_ctx, msg->bodyval);
1959 break;
1960 case WMA_DEAUTH_TX_COMP:
1961 lim_deauth_tx_complete_cnf(mac_ctx, msg->bodyval);
1962 break;
1963#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1964 case WMA_UPDATE_Q2Q_IE_IND:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301965 qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001966 beacon_params.paramChangeBitmap = 0;
1967 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1968 vdev_id = ((uint8_t *)msg->bodyptr)[i];
1969 session_entry = pe_find_session_by_sme_session_id(
1970 mac_ctx, vdev_id);
1971 if (session_entry == NULL)
1972 continue;
1973 session_entry->sap_advertise_avoid_ch_ie =
1974 (uint8_t)msg->bodyval;
1975 /*
1976 * if message comes for DFS channel, no need to update:
1977 * 1) We wont have MCC with DFS channels. so no need to
1978 * add Q2Q IE
1979 * 2) We cannot end up in DFS channel SCC by channel
1980 * switch from non DFS MCC scenario, so no need to
1981 * remove Q2Q IE
1982 * 3) There is however a case where device start MCC and
1983 * then user modifies hostapd.conf and does SAP
1984 * restart, in such a case, beacon params will be
1985 * reset and thus will not contain Q2Q IE, by default
1986 */
1987 if (cds_get_channel_state(
1988 session_entry->currentOperChannel)
1989 != CHANNEL_STATE_DFS) {
1990 beacon_params.bssIdx = session_entry->bssIdx;
1991 beacon_params.beaconInterval =
1992 session_entry->beaconParams.beaconInterval;
1993 beacon_params.paramChangeBitmap |=
1994 PARAM_BCN_INTERVAL_CHANGED;
1995 sch_set_fixed_beacon_fields(mac_ctx,
1996 session_entry);
1997 lim_send_beacon_params(mac_ctx, &beacon_params,
1998 session_entry);
1999 }
2000 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302001 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002002 msg->bodyptr = NULL;
2003 break;
2004#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
2005 case eWNI_SME_NSS_UPDATE_REQ:
2006 case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ:
2007 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302008 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002009 msg->bodyptr = NULL;
2010 break;
2011 case eWNI_SME_CHANNEL_CHANGE_REQ:
2012 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302013 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002014 msg->bodyptr = NULL;
2015 break;
2016 case eWNI_SME_START_BEACON_REQ:
2017 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302018 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002019 msg->bodyptr = NULL;
2020 break;
2021 case eWNI_SME_UPDATE_ADDITIONAL_IES:
2022 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302023 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002024 msg->bodyptr = NULL;
2025 break;
2026 case eWNI_SME_MODIFY_ADDITIONAL_IES:
2027 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302028 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002029 msg->bodyptr = NULL;
2030 break;
2031#ifdef QCA_HT_2040_COEX
2032 case eWNI_SME_SET_HT_2040_MODE:
2033 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302034 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002035 msg->bodyptr = NULL;
2036 break;
2037#endif
2038 case SIR_HAL_SOC_SET_HW_MODE_RESP:
2039 lim_process_set_hw_mode_resp(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302040 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002041 msg->bodyptr = NULL;
2042 break;
2043 case SIR_HAL_SOC_HW_MODE_TRANS_IND:
2044 lim_process_hw_mode_trans_ind(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302045 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002046 msg->bodyptr = NULL;
2047 break;
2048 case SIR_HAL_SOC_DUAL_MAC_CFG_RESP:
2049 lim_process_dual_mac_cfg_resp(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302050 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002051 msg->bodyptr = NULL;
2052 break;
2053 case eWNI_SME_SET_IE_REQ:
2054 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302055 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002056 msg->bodyptr = NULL;
2057 break;
Sandeep Puligillae0875662016-02-12 16:09:21 -08002058 case eWNI_SME_HT40_OBSS_SCAN_IND:
2059 lim_process_sme_obss_scan_ind(mac_ctx, msg);
2060 qdf_mem_free(msg->bodyptr);
Archana Ramachandrana20ef812015-11-13 16:12:13 -08002061 break;
2062 case SIR_HAL_SOC_ANTENNA_MODE_RESP:
2063 lim_process_set_antenna_resp(mac_ctx, msg->bodyptr);
2064 qdf_mem_free((void *)msg->bodyptr);
Sandeep Puligillae0875662016-02-12 16:09:21 -08002065 msg->bodyptr = NULL;
2066 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002067 default:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302068 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002069 msg->bodyptr = NULL;
2070 /* Unwanted messages */
2071 /* Log error */
2072 lim_log(mac_ctx, LOGE,
2073 FL("Discarding unexpected message received %X"),
2074 msg->type);
2075 lim_print_msg_name(mac_ctx, LOGE, msg->type);
2076 break;
2077
2078 } /* switch (msg->type) */
2079} /*** end lim_process_messages() ***/
2080
2081/**
2082 * lim_process_deferred_message_queue
2083 *
2084 ***FUNCTION:
2085 * This function is called by LIM while exiting from Learn
2086 * mode. This function fetches messages posted to the LIM
2087 * deferred message queue limDeferredMsgQ.
2088 *
2089 ***LOGIC:
2090 *
2091 ***ASSUMPTIONS:
2092 * NA
2093 *
2094 ***NOTE:
2095 * NA
2096 *
2097 * @param pMac - Pointer to Global MAC structure
2098 * @return None
2099 */
2100
2101void lim_process_deferred_message_queue(tpAniSirGlobal pMac)
2102{
2103 tSirMsgQ limMsg = { 0, 0, 0 };
2104
2105 tSirMsgQ *readMsg;
2106 uint16_t size;
2107
2108 /*
2109 ** check any deferred messages need to be processed
2110 **/
2111 size = pMac->lim.gLimDeferredMsgQ.size;
2112 if (size > 0) {
2113 while ((readMsg = lim_read_deferred_msg_q(pMac)) != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302114 qdf_mem_copy((uint8_t *) &limMsg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002115 (uint8_t *) readMsg, sizeof(tSirMsgQ));
2116 size--;
2117 lim_process_messages(pMac, &limMsg);
2118
2119 if ((lim_is_system_in_scan_state(pMac))
2120 || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac))
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +05302121 || (pMac->lim.gLimSystemInScanLearnMode)
2122 || pMac->lim.gLimAddtsSent)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002123 break;
2124 }
2125 }
2126} /*** end lim_process_deferred_message_queue() ***/
2127
2128/**
2129 * lim_process_normal_hdd_msg() - Process the message and defer if needed
2130 * @mac_ctx : Pointer to Global MAC structure
2131 * @msg : The message need to be processed
2132 * @rsp_reqd: whether return result to hdd
2133 *
2134 * This function checks the current lim state and decide whether the message
2135 * passed will be deferred or not.
2136 *
2137 * Return: None
2138 */
2139static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx, tSirMsgQ *msg,
2140 uint8_t rsp_reqd)
2141{
2142 bool defer_msg = true;
2143
2144 /* Added For BT-AMP Support */
2145 if ((mac_ctx->lim.gLimSystemRole == eLIM_AP_ROLE)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002146 || (mac_ctx->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)) {
2147 /*
2148 * This check is required only for the AP and in 2 cases.
2149 * 1. If we are in learn mode and we receive any of these
2150 * messages, you have to come out of scan and process the
2151 * message, hence dont defer the message here. In handler,
2152 * these message could be defered till we actually come out of
2153 * scan mode.
2154 * 2. If radar is detected, you might have to defer all of
2155 * these messages except Stop BSS request/ Switch channel
2156 * request. This decision is also made inside its handler.
2157 *
2158 * Please be careful while using the flag defer_msg. Possibly
2159 * you might end up in an infinite loop.
2160 */
2161 if ((msg->type == eWNI_SME_START_BSS_REQ) ||
2162 (msg->type == eWNI_SME_STOP_BSS_REQ) ||
2163 (msg->type == eWNI_SME_SWITCH_CHL_IND))
2164 defer_msg = false;
2165 }
2166
2167 if (((mac_ctx->lim.gLimAddtsSent) ||
2168 (lim_is_system_in_scan_state(mac_ctx))) && defer_msg) {
2169 /*
2170 * System is in DFS (Learn) mode or awaiting addts response or
2171 * if radar is detected, Defer processsing this message
2172 */
2173 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
2174#ifdef WLAN_DEBUG
2175 mac_ctx->lim.numSme++;
2176#endif
2177 lim_log_session_states(mac_ctx);
2178 /* Release body */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302179 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002180 msg->bodyptr = NULL;
2181 }
2182 } else {
2183 /*
2184 * These messages are from HDD.Since these requests may also be
2185 * generated internally within LIM module, need to distinquish
2186 * and send response to host
2187 */
2188 if (rsp_reqd)
2189 mac_ctx->lim.gLimRspReqd = true;
2190#ifdef WLAN_DEBUG
2191 mac_ctx->lim.numSme++;
2192#endif
2193 if (lim_process_sme_req_messages(mac_ctx, msg)) {
2194 /*
2195 * Release body. limProcessSmeReqMessage consumed the
2196 * buffer. We can free it.
2197 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302198 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002199 msg->bodyptr = NULL;
2200 }
2201 }
2202}
2203
2204void
2205handle_ht_capabilityand_ht_info(struct sAniSirGlobal *pMac,
2206 tpPESession psessionEntry)
2207{
2208 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2209 tSirMacHTParametersInfo macHTParametersInfo;
2210 tSirMacHTInfoField1 macHTInfoField1;
2211 tSirMacHTInfoField2 macHTInfoField2;
2212 tSirMacHTInfoField3 macHTInfoField3;
2213 uint32_t cfgValue;
2214 uint8_t *ptr;
2215
2216 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) !=
2217 eSIR_SUCCESS) {
2218 lim_log(pMac, LOGP,
2219 FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
2220 return;
2221 }
2222 ptr = (uint8_t *) &macHTCapabilityInfo;
2223 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2224 pMac->lim.gHTLsigTXOPProtection =
2225 (uint8_t) macHTCapabilityInfo.lsigTXOPProtection;
2226 pMac->lim.gHTMIMOPSState =
2227 (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2228 pMac->lim.gHTGreenfield = (uint8_t) macHTCapabilityInfo.greenField;
2229 pMac->lim.gHTMaxAmsduLength =
2230 (uint8_t) macHTCapabilityInfo.maximalAMSDUsize;
2231 pMac->lim.gHTShortGI20Mhz = (uint8_t) macHTCapabilityInfo.shortGI20MHz;
2232 pMac->lim.gHTShortGI40Mhz = (uint8_t) macHTCapabilityInfo.shortGI40MHz;
2233 pMac->lim.gHTPSMPSupport = (uint8_t) macHTCapabilityInfo.psmp;
2234 pMac->lim.gHTDsssCckRate40MHzSupport =
2235 (uint8_t) macHTCapabilityInfo.dsssCckMode40MHz;
2236
2237 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) !=
2238 eSIR_SUCCESS) {
2239 lim_log(pMac, LOGP,
2240 FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
2241 return;
2242 }
2243 ptr = (uint8_t *) &macHTParametersInfo;
2244 *ptr = (uint8_t) (cfgValue & 0xff);
2245 pMac->lim.gHTAMpduDensity = (uint8_t) macHTParametersInfo.mpduDensity;
2246 pMac->lim.gHTMaxRxAMpduFactor =
2247 (uint8_t) macHTParametersInfo.maxRxAMPDUFactor;
2248
2249 /* Get HT IE Info */
2250 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) !=
2251 eSIR_SUCCESS) {
2252 lim_log(pMac, LOGP,
2253 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
2254 return;
2255 }
2256 ptr = (uint8_t *) &macHTInfoField1;
2257 *((uint8_t *) ptr) = (uint8_t) (cfgValue & 0xff);
2258 pMac->lim.gHTServiceIntervalGranularity =
2259 (uint8_t) macHTInfoField1.serviceIntervalGranularity;
2260 pMac->lim.gHTControlledAccessOnly =
2261 (uint8_t) macHTInfoField1.controlledAccessOnly;
2262 pMac->lim.gHTRifsMode = (uint8_t) macHTInfoField1.rifsMode;
2263
2264 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) !=
2265 eSIR_SUCCESS) {
2266 lim_log(pMac, LOGP,
2267 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
2268 return;
2269 }
2270 ptr = (uint8_t *) &macHTInfoField2;
2271 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2272 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2273
2274 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) !=
2275 eSIR_SUCCESS) {
2276 lim_log(pMac, LOGP,
2277 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
2278 return;
2279 }
2280 ptr = (uint8_t *) &macHTInfoField3;
2281 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2282 pMac->lim.gHTPCOActive = (uint8_t) macHTInfoField3.pcoActive;
2283 pMac->lim.gHTPCOPhase = (uint8_t) macHTInfoField3.pcoPhase;
2284 pMac->lim.gHTSecondaryBeacon =
2285 (uint8_t) macHTInfoField3.secondaryBeacon;
2286 pMac->lim.gHTDualCTSProtection =
2287 (uint8_t) macHTInfoField3.dualCTSProtection;
2288 pMac->lim.gHTSTBCBasicMCS = (uint8_t) macHTInfoField3.basicSTBCMCS;
2289
2290 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2291 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2292 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2293 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2294 */
2295 if (psessionEntry != NULL) {
2296 psessionEntry->htCapability =
2297 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2298 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2299 (uint8_t) macHTInfoField3.lsigTXOPProtectionFullSupport;
Sandeep Puligillae0875662016-02-12 16:09:21 -08002300 lim_init_obss_params(pMac, psessionEntry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002301 }
2302}
2303
2304void lim_log_session_states(tpAniSirGlobal mac_ctx)
2305{
2306#ifdef WLAN_DEBUG
2307 int i;
2308
2309 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
2310 if (mac_ctx->lim.gpSession[i].valid) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05302311 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002312 FL("sysRole(%d) Session (%d)"),
2313 mac_ctx->lim.gLimSystemRole, i);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05302314 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002315 FL("SME: Curr %s,Prev %s,MLM: Curr %s,Prev %s"),
2316 lim_sme_state_str(
2317 mac_ctx->lim.gpSession[i].limSmeState),
2318 lim_sme_state_str(
2319 mac_ctx->lim.gpSession[i].limPrevSmeState),
2320 lim_mlm_state_str(
2321 mac_ctx->lim.gpSession[i].limMlmState),
2322 lim_mlm_state_str(
2323 mac_ctx->lim.gpSession[i].limPrevMlmState));
2324 }
2325 }
2326#endif
2327}