blob: 27d6a41597608144dc866e0f8e182c4cf3ee84f2 [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
Krishna Kumaar Natarajanb7f9a352016-03-18 11:40:07 -0700806 if (pMac->sap.SapDfsInfo.is_dfs_cac_timer_running) {
807 psessionEntry = pe_find_session_by_bssid(pMac,
808 pHdr->bssId, &sessionId);
809 if (psessionEntry &&
810 (QDF_SAP_MODE == psessionEntry->pePersona)) {
811 lim_log(pMac, LOG1,
812 FL("CAC timer running - drop the frame"));
813 goto end;
814 }
815 }
816
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800817#ifdef WLAN_DUMP_MGMTFRAMES
818 lim_log(pMac, LOGE,
819 FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
820 fc.protVer, fc.type, fc.subType,
821 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530822 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, pHdr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800823 WMA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
824#endif
825 if (pMac->fEnableDebugLog & 0x1) {
826 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
827 (fc.subType != SIR_MAC_MGMT_PROBE_REQ) &&
828 (fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
829 (fc.subType != SIR_MAC_MGMT_BEACON)) {
830 lim_log(pMac, LOGE,
831 FL("RX MGMT - Type %hu, SubType %hu, seq num[%d]"),
832 fc.type,
833 fc.subType,
834 ((pHdr->seqControl.seqNumHi <<
835 HIGH_SEQ_NUM_OFFSET) |
836 pHdr->seqControl.seqNumLo));
837 }
838 }
839#ifdef FEATURE_WLAN_EXTSCAN
840 if (WMA_IS_EXTSCAN_SCAN_SRC(pRxPacketInfo) ||
841 WMA_IS_EPNO_SCAN_SRC(pRxPacketInfo)) {
842 if (fc.subType == SIR_MAC_MGMT_BEACON ||
843 fc.subType == SIR_MAC_MGMT_PROBE_RSP) {
844 __lim_process_ext_scan_beacon_probe_rsp(pMac,
845 pRxPacketInfo,
846 fc.subType);
847 } else {
848 lim_log(pMac, LOGE,
849 FL("Wrong frameType %d, Subtype %d for %d"),
850 fc.type, fc.subType,
851 WMA_GET_SCAN_SRC(pRxPacketInfo));
852 }
853 goto end;
854 }
855#endif
856 if (WMA_GET_OFFLOADSCANLEARN(pRxPacketInfo)) {
857 if (fc.subType == SIR_MAC_MGMT_BEACON) {
858 lim_log(pMac, LOG2, FL("Learning scan beacon"));
859 __lim_handle_beacon(pMac, limMsg, NULL);
860 } else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP) {
861 lim_log(pMac, LOG2, FL("Learning scan probe rsp"));
862 lim_process_probe_rsp_frame_no_session(pMac, pRxPacketInfo);
863 } else {
864 lim_log(pMac, LOGE,
865 FL("Wrong frame Type %d, Subtype %d for LFR"),
866 fc.type, fc.subType);
867 }
868 goto end;
869 }
870 /* Added For BT-AMP Support */
Anurag Chouhanffb21542016-02-17 14:33:03 +0530871 psessionEntry = pe_find_session_by_bssid(pMac, pHdr->bssId,
872 &sessionId);
873 if (psessionEntry == NULL) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800874 if (fc.subType == SIR_MAC_MGMT_AUTH) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800875 lim_log(pMac, LOG1,
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700876 FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800877 fc.protVer, fc.type, fc.subType,
878 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
879 lim_print_mac_addr(pMac, pHdr->bssId, LOG1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800880 if (lim_process_auth_frame_no_session
881 (pMac, pRxPacketInfo,
882 limMsg->bodyptr) == eSIR_SUCCESS) {
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700883 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800884 }
885 }
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700886 /* Public action frame can be received from non-assoc stations*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800887 if ((fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
888 (fc.subType != SIR_MAC_MGMT_BEACON) &&
889 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700890 && (fc.subType != SIR_MAC_MGMT_ACTION)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800891
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700892 psessionEntry = pe_find_session_by_peer_sta(pMac,
893 pHdr->sa, &sessionId);
894 if (psessionEntry == NULL) {
895 lim_log(pMac, LOG3,
896 FL("session does not exist for bssId"));
897 lim_print_mac_addr(pMac, pHdr->sa, LOG3);
898 goto end;
899 } else {
900 lim_log(pMac, LOG3,
901 "SessionId:%d exists for given Bssid",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800902 psessionEntry->peSessionId);
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700903 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800904 }
905 /* For p2p resp frames search for valid session with DA as */
906 /* BSSID will be SA and session will be present with DA only */
907 if (fc.subType == SIR_MAC_MGMT_ACTION) {
908 psessionEntry =
909 pe_find_session_by_bssid(pMac, pHdr->da, &sessionId);
910 }
911 }
912
913 /* Check if frame is registered by HDD */
914 if (lim_check_mgmt_registered_frames(pMac, pRxPacketInfo, psessionEntry)) {
915 lim_log(pMac, LOG1, FL("Received frame is passed to SME"));
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700916 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800917 }
918
919 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION) { /* Received Frame with non-zero Protocol Version */
920 lim_log(pMac, LOGE,
921 FL("Unexpected frame with protVersion %d received"),
922 fc.protVer);
923 lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
924 (void *)limMsg->bodyptr);
925#ifdef WLAN_DEBUG
926 pMac->lim.numProtErr++;
927#endif
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700928 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800929 }
930
931/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
932
933#ifdef WLAN_DEBUG
934 pMac->lim.numMAC[fc.type][fc.subType]++;
935#endif
936
937 switch (fc.type) {
938 case SIR_MAC_MGMT_FRAME:
939 {
940 /* Received Management frame */
941 switch (fc.subType) {
942 case SIR_MAC_MGMT_ASSOC_REQ:
943 /* Make sure the role supports Association */
Rajeev Kumarcf835a02016-04-15 15:01:31 -0700944 if (LIM_IS_AP_ROLE(psessionEntry))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800945 lim_process_assoc_req_frame(pMac,
946 pRxPacketInfo,
947 LIM_ASSOC,
948 psessionEntry);
949 else {
950 /* Unwanted messages - Log error */
951 lim_log(pMac, LOGE,
952 FL
953 ("unexpected message received %X"),
954 limMsg->type);
955 lim_print_msg_name(pMac, LOGE,
956 limMsg->type);
957 }
958 break;
959
960 case SIR_MAC_MGMT_ASSOC_RSP:
961 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
962 LIM_ASSOC,
963 psessionEntry);
964 break;
965
966 case SIR_MAC_MGMT_REASSOC_REQ:
967 /* Make sure the role supports Reassociation */
Rajeev Kumarcf835a02016-04-15 15:01:31 -0700968 if (LIM_IS_AP_ROLE(psessionEntry)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800969 lim_process_assoc_req_frame(pMac,
970 pRxPacketInfo,
971 LIM_REASSOC,
972 psessionEntry);
973 } else {
974 /* Unwanted messages - Log error */
975 lim_log(pMac, LOGE,
976 FL
977 ("unexpected message received %X"),
978 limMsg->type);
979 lim_print_msg_name(pMac, LOGE,
980 limMsg->type);
981 }
982 break;
983
984 case SIR_MAC_MGMT_REASSOC_RSP:
985 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
986 LIM_REASSOC,
987 psessionEntry);
988 break;
989
990 case SIR_MAC_MGMT_PROBE_REQ:
991 lim_process_probe_req_frame_multiple_bss(pMac,
992 pRxPacketInfo,
993 psessionEntry);
994 break;
995
996 case SIR_MAC_MGMT_PROBE_RSP:
997 if (psessionEntry == NULL)
998 lim_process_probe_rsp_frame_no_session(pMac,
999 pRxPacketInfo);
1000 else
1001 lim_process_probe_rsp_frame(pMac,
1002 pRxPacketInfo,
1003 psessionEntry);
1004 break;
1005
1006 case SIR_MAC_MGMT_BEACON:
1007 __lim_handle_beacon(pMac, limMsg, psessionEntry);
1008 break;
1009
1010 case SIR_MAC_MGMT_DISASSOC:
1011 lim_process_disassoc_frame(pMac, pRxPacketInfo,
1012 psessionEntry);
1013 break;
1014
1015 case SIR_MAC_MGMT_AUTH:
1016 lim_process_auth_frame(pMac, pRxPacketInfo,
1017 psessionEntry);
1018 break;
1019
1020 case SIR_MAC_MGMT_DEAUTH:
1021 lim_process_deauth_frame(pMac, pRxPacketInfo,
1022 psessionEntry);
1023 break;
1024
1025 case SIR_MAC_MGMT_ACTION:
1026 if (psessionEntry == NULL)
1027 lim_process_action_frame_no_session(pMac,
1028 pRxPacketInfo);
1029 else {
1030 if (WMA_GET_RX_UNKNOWN_UCAST
1031 (pRxPacketInfo))
1032 lim_handle_unknown_a2_index_frames
1033 (pMac, pRxPacketInfo,
1034 psessionEntry);
1035 else
1036 lim_process_action_frame(pMac,
1037 pRxPacketInfo,
1038 psessionEntry);
1039 }
1040 break;
1041 default:
1042 /* Received Management frame of 'reserved' subtype */
1043 break;
1044 } /* switch (fc.subType) */
1045
1046 }
1047 break;
1048 case SIR_MAC_DATA_FRAME:
1049 {
1050 }
1051 break;
1052 default:
1053 /* Received frame of type 'reserved' */
1054 break;
1055
1056 } /* switch (fc.type) */
1057
1058end:
1059 lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
1060 (void *)limMsg->bodyptr);
1061 return;
1062} /*** end lim_handle80211_frames() ***/
1063
1064/**
1065 * lim_send_stop_scan_offload_req()
1066 *
1067 ***FUNCTION:
1068 * This function will be called to abort the ongoing offloaded scan
1069 * request.
1070 *
1071 *
1072 ***NOTE:
1073 *
1074 * @param pMac Pointer to Global MAC structure
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301075 * @return QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001076 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301077QDF_STATUS lim_send_stop_scan_offload_req(tpAniSirGlobal pMac,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001078 uint8_t SessionId, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001079{
1080 tSirMsgQ msg;
1081 tSirRetStatus rc = eSIR_SUCCESS;
1082 tAbortScanParams *pAbortScanParams;
1083
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301084 pAbortScanParams = qdf_mem_malloc(sizeof(tAbortScanParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001085 if (NULL == pAbortScanParams) {
1086 lim_log(pMac, LOGP,
1087 FL("Memory allocation failed for AbortScanParams"));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301088 return QDF_STATUS_E_NOMEM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001089 }
1090
1091 pAbortScanParams->SessionId = SessionId;
1092 pAbortScanParams->scan_id = scan_id;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001093 pAbortScanParams->scan_requestor_id = scan_requestor_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001094 msg.type = WMA_STOP_SCAN_OFFLOAD_REQ;
1095 msg.bodyptr = pAbortScanParams;
1096 msg.bodyval = 0;
1097
1098 rc = wma_post_ctrl_msg(pMac, &msg);
1099 if (rc != eSIR_SUCCESS) {
1100 lim_log(pMac, LOGE, FL("wma_post_ctrl_msg() return failure"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301101 qdf_mem_free(pAbortScanParams);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301102 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001103 }
1104
1105 lim_log(pMac, LOG1, FL("Abort ongoing offload scan."));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301106 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001107
1108}
1109
1110/**
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001111 * lim_process_abort_scan_ind() - abort the scan which is presently being run
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001112 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001113 * @mac_ctx: Pointer to Global MAC structure
1114 * @session_id: PE session
1115 * @scan_id: Scan ID from the scan request
1116 * @scan_requesor_id: Entity requesting the scan
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001117 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001118 * @return: None
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001119 */
1120void lim_process_abort_scan_ind(tpAniSirGlobal mac_ctx,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001121 uint8_t session_id, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001122{
1123#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001124 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
1125 NULL, 0, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001126#endif
1127
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001128 lim_log(mac_ctx, LOG2, FL("scan_id %d, scan_requestor_id 0x%x"),
1129 scan_id, scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001130
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001131 /* send stop scan cmd to firmware */
1132 lim_send_stop_scan_offload_req(mac_ctx, session_id, scan_id,
1133 scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001134 return;
1135}
1136
1137/**
1138 * lim_message_processor() - Process messages from LIM.
1139 *
1140 * @mac_ctx: Pointer to the Global Mac Context.
1141 * @msg: Received LIM message.
1142 *
1143 * Wrapper function for lim_process_messages when handling messages received by
1144 * LIM.Could either defer messages or process them.
1145 *
1146 * Return: None.
1147 */
1148void lim_message_processor(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1149{
1150 if (eLIM_MLM_OFFLINE_STATE == mac_ctx->lim.gLimMlmState) {
1151 pe_free_msg(mac_ctx, msg);
1152 return;
1153 }
1154
1155 if (!def_msg_decision(mac_ctx, msg)) {
1156 lim_process_messages(mac_ctx, msg);
1157 /* process deferred message queue if allowed */
1158 if ((!(mac_ctx->lim.gLimAddtsSent)) &&
1159 (!(lim_is_system_in_scan_state(mac_ctx))) &&
1160 (true == GET_LIM_PROCESS_DEFD_MESGS(mac_ctx)))
1161 lim_process_deferred_message_queue(mac_ctx);
1162 }
1163}
1164
1165#ifdef FEATURE_OEM_DATA_SUPPORT
1166
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301167void lim_oem_data_rsp_handle_resume_link_rsp(tpAniSirGlobal pMac, QDF_STATUS status,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001168 uint32_t *mlmOemDataRsp)
1169{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301170 if (status != QDF_STATUS_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001171 lim_log(pMac, LOGE,
1172 FL
1173 ("OEM Data Rsp failed to get the response for resume link"));
1174 }
1175
1176 if (NULL != pMac->lim.gpLimMlmOemDataReq) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301177 qdf_mem_free(pMac->lim.gpLimMlmOemDataReq);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001178 pMac->lim.gpLimMlmOemDataReq = NULL;
1179 }
1180 /* "Failure" status doesn't mean that Oem Data Rsp did not happen */
1181 /* and hence we need to respond to upper layers. Only Resume link is failed, but */
1182 /* we got the oem data response already. */
1183 /* Post the meessage to MLM */
1184 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1185 (uint32_t *) (mlmOemDataRsp));
1186
1187 return;
1188}
1189
1190void lim_process_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *body)
1191{
1192 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1193
1194 /* Process all the messages for the lim queue */
1195 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1196
1197 mlmOemDataRsp = (tpLimMlmOemDataRsp) body;
1198
1199 PELOG1(lim_log
1200 (pMac, LOG1, FL("%s: sending oem data response msg to sme"),
1201 __func__);
1202 )
1203 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1204 (uint32_t *) (mlmOemDataRsp));
1205
1206 return;
1207}
1208
1209#endif
1210
Sandeep Puligillae0875662016-02-12 16:09:21 -08001211static void lim_process_sme_obss_scan_ind(tpAniSirGlobal mac_ctx,
1212 struct sSirMsgQ *msg)
1213{
1214 struct sPESession *session;
1215 uint8_t session_id;
1216 struct sme_obss_ht40_scanind_msg *ht40_scanind;
1217
1218 ht40_scanind = (struct sme_obss_ht40_scanind_msg *)msg->bodyptr;
1219 session = pe_find_session_by_bssid(mac_ctx,
1220 ht40_scanind->mac_addr.bytes, &session_id);
1221 if (session == NULL) {
1222 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1223 "OBSS Scan not started: session id is NULL");
1224 return;
1225 }
1226 if (session->htSupportedChannelWidthSet ==
1227 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
1228 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1229 "OBSS Scan Start Req: session id %d"
1230 "htSupportedChannelWidthSet %d",
1231 session->peSessionId,
1232 session->htSupportedChannelWidthSet);
1233 lim_send_ht40_obss_scanind(mac_ctx, session);
1234 } else {
1235 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1236 "OBSS Scan not started: channel width - %d session %d",
1237 session->htSupportedChannelWidthSet,
1238 session->peSessionId);
1239 }
1240 return;
1241}
1242
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001243/**
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301244 * lim_handle_hw_mode_change_on_csa() - Do HW mode change on CSA for STA mode
1245 * @mac_ctx: Global MAC context
1246 * @msg: Received message
1247 *
1248 * Checks if hw mode change is required for the new channel.
1249 * If MCC upgrade is required, this function will start the opportunistic
1250 * timer and the caller will invoke the other APIs to perform vdev restart on
1251 * the new channel.
1252 *
1253 * If DBS downgrade is required, this function will initiate the hw mode
1254 * change and vdev restart will happen on the new channel after getting hw
1255 * mode response
1256 *
1257 * Return: QDF_STATUS_SUCCESS if processing of csa params (and hence vdev
1258 * restart) needs to happen or if no hw mode change is required,
1259 * QDF_STATUS_E_FAILURE otherwise.
1260 */
1261static QDF_STATUS lim_handle_hw_mode_change_on_csa(tpAniSirGlobal mac_ctx,
1262 tpSirMsgQ msg)
1263{
1264 tpPESession session_entry;
1265 struct csa_offload_params *csa_params =
1266 (struct csa_offload_params *) (msg->bodyptr);
1267 tpDphHashNode sta_ds = NULL;
1268 uint8_t session_id;
1269 uint16_t aid = 0;
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301270 QDF_STATUS status = QDF_STATUS_E_FAILURE;
1271
1272 lim_log(mac_ctx, LOG1, FL("handle hw mode change for csa"));
1273
1274 if (!csa_params) {
1275 lim_log(mac_ctx, LOGE, FL("limMsgQ body ptr is NULL"));
1276 /* qdf_mem_free() can handle NULL values */
1277 goto err;
1278 }
1279
1280 session_entry = pe_find_session_by_bssid(mac_ctx,
1281 csa_params->bssId, &session_id);
1282 if (!session_entry) {
1283 lim_log(mac_ctx, LOGE, FL("Session does not exist"));
1284 goto err;
1285 }
1286
1287 sta_ds = dph_lookup_hash_entry(mac_ctx, session_entry->bssId, &aid,
1288 &session_entry->dph.dphHashTable);
1289
1290 if (!sta_ds) {
1291 lim_log(mac_ctx, LOGE, FL("sta_ds does not exist"));
1292 goto err;
1293 }
1294
Krunal Soniee572472016-02-11 11:48:53 -08001295 status = cds_handle_hw_mode_change_on_csa(session_entry->smeSessionId,
1296 csa_params->channel, csa_params->bssId,
1297 &session_entry->saved_csa_params, csa_params,
1298 sizeof(session_entry->saved_csa_params));
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301299
Krunal Soniee572472016-02-11 11:48:53 -08001300 if (QDF_IS_STATUS_SUCCESS(status))
1301 return status;
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301302
1303err:
1304 qdf_mem_free(csa_params);
1305 return status;
1306}
1307
1308/**
1309 * lim_handle_hw_mode_change_on_csa_event() - Handle hw mode change on csa
1310 * @mac_ctx: Pointer to the Global Mac Context
1311 * @msg: Received message
1312 *
1313 * Checks if a hw mode change is required for the received csa event. Processes
1314 * csa params and do vdev restart immediately if the there is no need for a hw
1315 * mode change or if MCC upgrade is required
1316 *
1317 * Return: None
1318 */
1319static void lim_handle_hw_mode_change_on_csa_event(tpAniSirGlobal mac_ctx,
1320 tpSirMsgQ msg)
1321{
1322 QDF_STATUS qdf_status;
1323
1324 lim_log(mac_ctx, LOG1, FL("lim received csa offload event"));
1325 if (mac_ctx->policy_manager_enabled &&
1326 wma_is_hw_dbs_capable() == true) {
1327 /* Check if a hw mode change is required */
1328 qdf_status = lim_handle_hw_mode_change_on_csa(mac_ctx,
1329 msg);
1330 /* Process csa params and do vdev restart immediately if
1331 * there is no need for a hw mode change or if MCC upgrade is
1332 * required.
1333 */
1334 if (QDF_IS_STATUS_SUCCESS(qdf_status))
1335 lim_handle_csa_offload_msg(mac_ctx, msg);
1336 } else {
1337 lim_handle_csa_offload_msg(mac_ctx, msg);
1338 }
1339}
1340
1341/**
1342 * lim_handle_csa_event_post_dbs_downgrade() - Process csa event post dbs
1343 * downgrade
1344 * @mac_ctx: Pointer to the Global Mac Context
1345 * @msg: Received message
1346 *
1347 * Process the csa event to do vdev restart on the new channel after the dbs
1348 * downgrade. If there was a DBS downgrade as part of the event
1349 * WMA_CSA_OFFLOAD_EVENT, SIR_LIM_CSA_POST_HW_MODE_CHANGE will be received after
1350 * receiving the set hw mode response, where this processing will happen.
1351 *
1352 * Return: None
1353 */
1354static void lim_handle_csa_event_post_dbs_downgrade(tpAniSirGlobal mac_ctx,
1355 tpSirMsgQ msg)
1356{
1357 tSirMsgQ csa_msg;
1358 tpPESession session_entry;
1359
1360 struct sir_saved_csa_params *buf =
1361 (struct sir_saved_csa_params *)msg->bodyptr;
1362
1363 /* Null check for 'msg' already done before coming here in the caller */
1364
1365 session_entry = pe_find_session_by_sme_session_id(mac_ctx,
1366 buf->session_id);
1367 if (!session_entry) {
1368 lim_log(mac_ctx, LOGE, FL("Invalid session id:%d"),
1369 buf->session_id);
1370 return;
1371 }
1372
1373 lim_log(mac_ctx, LOG1,
1374 FL("received csa offload event post hw change for %pM"),
1375 session_entry->saved_csa_params.bssId);
1376
1377 csa_msg.bodyptr = qdf_mem_malloc(
1378 sizeof(struct csa_offload_params));
1379 if (!csa_msg.bodyptr) {
1380 lim_log(mac_ctx, LOGE, FL("malloc failed for csa msg"));
1381 goto clean_msg_body;
1382 }
1383
1384 qdf_mem_copy((void *)csa_msg.bodyptr,
1385 (void *)&session_entry->saved_csa_params,
1386 sizeof(struct csa_offload_params));
1387 /* If there was a DBS downgrade as part of the event
1388 * WMA_CSA_OFFLOAD_EVENT, SIR_LIM_CSA_POST_HW_MODE_CHANGE will
1389 * be received after receiving the set hw mode response.
1390 */
1391 lim_handle_csa_offload_msg(mac_ctx, &csa_msg);
1392clean_msg_body:
1393 if (msg->bodyptr)
1394 qdf_mem_free(msg->bodyptr);
1395}
1396
1397/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001398 * lim_process_messages() - Process messages from upper layers.
1399 *
1400 * @mac_ctx: Pointer to the Global Mac Context.
1401 * @msg: Received message.
1402 *
1403 * Return: None.
1404 */
1405void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1406{
1407#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1408 uint8_t vdev_id = 0;
1409 tUpdateBeaconParams beacon_params;
1410#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1411 uint8_t i;
1412 uint8_t p2p_go_exists = 0;
1413 tpPESession session_entry = NULL;
1414 uint8_t defer_msg = false;
1415 tLinkStateParams *link_state_param;
1416 uint16_t pkt_len = 0;
1417 cds_pkt_t *body_ptr = NULL;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301418 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001419 tSirMsgQ new_msg;
1420 tSirSmeScanAbortReq *req_msg = NULL;
1421 uint8_t session_id;
1422 uint32_t scan_id;
1423
1424#ifdef FEATURE_WLAN_TDLS
1425 tSirTdlsInd *tdls_ind = NULL;
1426 tpDphHashNode sta_ds = NULL;
1427 tTdlsLinkEstablishParams *tdls_link_params = NULL;
1428#endif
1429 tSirMbMsgP2p *p2p_msg = NULL;
1430 if (ANI_DRIVER_TYPE(mac_ctx) == eDRIVER_TYPE_MFG) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301431 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001432 msg->bodyptr = NULL;
1433 return;
1434 }
1435 if (msg == NULL) {
1436 lim_log(mac_ctx, LOGE, FL("Message pointer is Null"));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301437 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001438 return;
1439 }
1440#ifdef WLAN_DEBUG
1441 mac_ctx->lim.numTot++;
1442#endif
1443 MTRACE(mac_trace_msg_rx(mac_ctx, NO_SESSION,
1444 LIM_TRACE_MAKE_RXMSG(msg->type, LIM_MSG_PROCESSED));)
1445
1446 switch (msg->type) {
1447
1448 case SIR_LIM_UPDATE_BEACON:
1449 lim_update_beacon(mac_ctx);
1450 break;
1451 case SIR_CFG_PARAM_UPDATE_IND:
1452 if (!lim_is_system_in_scan_state(mac_ctx)) {
1453 lim_handle_cf_gparam_update(mac_ctx, msg->bodyval);
1454 break;
1455 }
1456 /* System is in DFS (Learn) mode.
1457 * Defer processsing this message
1458 */
1459 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
1460 if (!(mac_ctx->lim.deferredMsgCnt & 0xF))
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301461 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001462 FL("Unable to Defer Msg"));
1463 lim_log_session_states(mac_ctx);
1464 lim_print_msg_name(mac_ctx, LOGE, msg->type);
1465 }
1466 break;
1467#ifdef FEATURE_OEM_DATA_SUPPORT
1468 case WMA_START_OEM_DATA_RSP:
1469 lim_process_oem_data_rsp(mac_ctx, msg->bodyptr);
1470 msg->bodyptr = NULL;
1471 break;
1472#endif
1473 case WMA_SWITCH_CHANNEL_RSP:
1474 lim_process_switch_channel_rsp(mac_ctx, msg->bodyptr);
1475 msg->bodyptr = NULL;
1476 break;
1477#ifdef ANI_SIR_IBSS_PEER_CACHING
1478 case WMA_IBSS_STA_ADD:
1479 lim_ibss_sta_add(mac_ctx, msg->bodyptr);
1480 break;
1481#endif
1482 case SIR_BB_XPORT_MGMT_MSG:
1483 /* These messages are from Peer MAC entity. */
1484#ifdef WLAN_DEBUG
1485 mac_ctx->lim.numBbt++;
1486#endif
1487 /* The original msg which we were deferring have the
1488 * bodyPointer point to 'BD' instead of 'cds pkt'. If we
1489 * don't make a copy of msg, then overwrite the
1490 * msg->bodyPointer and next time when we try to
1491 * process the msg, we will try to use 'BD' as
1492 * 'cds Pkt' which will cause a crash
1493 */
1494 if (msg->bodyptr == NULL) {
1495 lim_log(mac_ctx, LOGE, FL("Message bodyptr is Null"));
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301496 QDF_ASSERT(0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001497 break;
1498 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301499 qdf_mem_copy((uint8_t *) &new_msg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001500 (uint8_t *) msg, sizeof(tSirMsgQ));
1501 body_ptr = (cds_pkt_t *) new_msg.bodyptr;
1502 cds_pkt_get_packet_length(body_ptr, &pkt_len);
1503
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301504 qdf_status = wma_ds_peek_rx_packet_info(body_ptr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001505 (void **) &new_msg.bodyptr, false);
1506
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301507 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001508 cds_pkt_return_packet(body_ptr);
1509 break;
1510 }
1511
Anurag Chouhanffb21542016-02-17 14:33:03 +05301512 if (WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr))
1513 lim_log(mac_ctx, LOG1, FL("roamCandidateInd %d"),
1514 WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001515
Anurag Chouhanffb21542016-02-17 14:33:03 +05301516 if (WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr))
1517 lim_log(mac_ctx, LOG1, FL("offloadScanLearn %d"),
1518 WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001519
1520 lim_handle80211_frames(mac_ctx, &new_msg, &defer_msg);
1521
1522 if (defer_msg == true) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301523 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001524 FL("Defer Msg type=%x"), msg->type);
1525 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301526 QDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001527 FL("Unable to Defer Msg"));
1528 lim_log_session_states(mac_ctx);
1529 cds_pkt_return_packet(body_ptr);
1530 }
1531 } else
1532 /* PE is not deferring this 802.11 frame so we need to
1533 * call cds_pkt_return. Asumption here is when Rx mgmt
1534 * frame processing is done, cds packet could be
1535 * freed here.
1536 */
1537 cds_pkt_return_packet(body_ptr);
1538 break;
1539 case eWNI_SME_SCAN_REQ:
1540 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
1541 case eWNI_SME_DISASSOC_REQ:
1542 case eWNI_SME_DEAUTH_REQ:
1543#ifdef FEATURE_OEM_DATA_SUPPORT
1544 case eWNI_SME_OEM_DATA_REQ:
1545#endif
1546#ifdef FEATURE_WLAN_TDLS
1547 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1548 case eWNI_SME_TDLS_ADD_STA_REQ:
1549 case eWNI_SME_TDLS_DEL_STA_REQ:
1550 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
1551#endif
1552 case eWNI_SME_RESET_AP_CAPS_CHANGED:
1553 case eWNI_SME_SET_HW_MODE_REQ:
1554 case eWNI_SME_SET_DUAL_MAC_CFG_REQ:
Archana Ramachandrana20ef812015-11-13 16:12:13 -08001555 case eWNI_SME_SET_ANTENNA_MODE_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001556 /* These messages are from HDD. Need to respond to HDD */
1557 lim_process_normal_hdd_msg(mac_ctx, msg, true);
1558 break;
1559
1560 case eWNI_SME_SCAN_ABORT_IND:
1561 req_msg = msg->bodyptr;
1562 if (req_msg) {
1563 session_id = req_msg->sessionId;
1564 scan_id = req_msg->scan_id;
1565 lim_process_abort_scan_ind(mac_ctx, session_id,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001566 scan_id, USER_SCAN_REQUESTOR_ID);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301567 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001568 msg->bodyptr = NULL;
1569 }
1570 break;
1571 case eWNI_SME_SYS_READY_IND:
1572 case eWNI_SME_JOIN_REQ:
1573 case eWNI_SME_REASSOC_REQ:
1574 case eWNI_SME_START_BSS_REQ:
1575 case eWNI_SME_STOP_BSS_REQ:
1576 case eWNI_SME_SWITCH_CHL_IND:
1577 case eWNI_SME_SETCONTEXT_REQ:
1578 case eWNI_SME_DISASSOC_CNF:
1579 case eWNI_SME_DEAUTH_CNF:
1580 case eWNI_SME_ASSOC_CNF:
1581 case eWNI_SME_ADDTS_REQ:
1582 case eWNI_SME_DELTS_REQ:
1583 case eWNI_SME_GET_ASSOC_STAS_REQ:
1584 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1585 case eWNI_SME_UPDATE_APWPSIE_REQ:
1586 case eWNI_SME_HIDE_SSID_REQ:
1587 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1588 case eWNI_SME_SET_APWPARSNIEs_REQ:
1589 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001590 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1591 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001592#if defined FEATURE_WLAN_ESE
1593 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
1594#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001595 case eWNI_SME_FT_UPDATE_KEY:
1596 case eWNI_SME_FT_PRE_AUTH_REQ:
1597 case eWNI_SME_FT_AGGR_QOS_REQ:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001598 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1599 case eWNI_SME_UPDATE_NOA:
1600 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
1601 case eWNI_SME_GET_STATISTICS_REQ:
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001602#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001603 case eWNI_SME_GET_TSM_STATS_REQ:
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001604#endif /* FEATURE_WLAN_ESE */
Abhishek Singh7996eb72015-12-30 17:24:02 +05301605 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
Abhishek Singh518323d2015-10-19 17:42:01 +05301606 case eWNI_SME_EXT_CHANGE_CHANNEL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001607 /* These messages are from HDD.No need to respond to HDD */
1608 lim_process_normal_hdd_msg(mac_ctx, msg, false);
1609 break;
1610
1611 case eWNI_PMC_SMPS_STATE_IND:
1612 if (msg->bodyptr) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301613 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001614 msg->bodyptr = NULL;
1615 }
1616 break;
1617 case eWNI_SME_SEND_ACTION_FRAME_IND:
1618 lim_send_p2p_action_frame(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301619 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001620 msg->bodyptr = NULL;
1621 break;
1622 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1623 p2p_msg = (tSirMbMsgP2p *) msg->bodyptr;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001624 lim_process_abort_scan_ind(mac_ctx, p2p_msg->sessionId,
1625 p2p_msg->scan_id, ROC_SCAN_REQUESTOR_ID);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301626 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001627 msg->bodyptr = NULL;
1628 break;
1629 case SIR_HAL_P2P_NOA_START_IND:
1630 session_entry = &mac_ctx->lim.gpSession[0];
1631 lim_log(mac_ctx, LOG1, "LIM received NOA start %x", msg->type);
1632
1633 /* Since insert NOA is done and NOA start msg received,
1634 * we should deactivate the Insert NOA timer
1635 */
1636 lim_deactivate_and_change_timer(mac_ctx,
1637 eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1638
1639 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1640 session_entry = &mac_ctx->lim.gpSession[i];
1641 if ((session_entry != NULL) && (session_entry->valid) &&
Anurag Chouhan6d760662016-02-20 16:05:43 +05301642 (session_entry->pePersona == QDF_P2P_GO_MODE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001643 /* Save P2P NOA start attribute for Go persona*/
1644 p2p_go_exists = 1;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301645 qdf_mem_copy(&session_entry->p2pGoPsNoaStartInd,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001646 msg->bodyptr, sizeof(tSirP2PNoaStart));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301647 qdf_status =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001648 session_entry->p2pGoPsNoaStartInd.status;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301649 if (qdf_status != QDF_STATUS_SUCCESS)
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 NOA start status %d by FW"),
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301653 qdf_status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001654 break;
1655 }
1656 }
1657
1658 if (p2p_go_exists == 0)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301659 QDF_TRACE(QDF_MODULE_ID_PE, LOGW,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001660 FL(
1661 "GO is removed by the time NOA start recvd"));
1662
1663 /* We received the NOA start indication. Now we can send down
1664 * the SME request which requires off-channel operation */
1665 lim_process_regd_defd_sme_req_after_noa_start(mac_ctx);
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 break;
1669#ifdef FEATURE_WLAN_TDLS
1670 case SIR_HAL_TDLS_IND:
1671 tdls_ind = (tpSirTdlsInd) msg->bodyptr;
1672 session_entry = pe_find_session_by_sta_id(mac_ctx,
1673 tdls_ind->staIdx, &session_id);
1674 if (session_entry == NULL) {
1675 lim_log(mac_ctx, LOG1,
1676 FL("No session exist for given bssId"));
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 sta_ds = dph_get_hash_entry(mac_ctx, tdls_ind->assocId,
1682 &session_entry->dph.dphHashTable);
1683 if (sta_ds == NULL) {
1684 lim_log(mac_ctx, LOG1,
1685 FL("No sta_ds exist for given staId"));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301686 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001687 msg->bodyptr = NULL;
1688 return;
1689 }
1690
1691 if (STA_ENTRY_TDLS_PEER == sta_ds->staType) {
1692 lim_log(mac_ctx, LOGE,
1693 FL("rcvd TDLS IND from FW with RC %d "),
1694 tdls_ind->reasonCode);
1695 lim_send_sme_tdls_del_sta_ind(mac_ctx, sta_ds,
1696 session_entry, tdls_ind->reasonCode);
1697 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301698 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001699 msg->bodyptr = NULL;
1700 break;
1701#endif
1702 case SIR_HAL_P2P_NOA_ATTR_IND:
1703 session_entry = &mac_ctx->lim.gpSession[0];
1704 lim_log(mac_ctx, LOG1, FL("Received message Noa_ATTR %x"),
1705 msg->type);
1706 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1707 session_entry = &mac_ctx->lim.gpSession[i];
1708 if ((session_entry != NULL) && (session_entry->valid)
1709 && (session_entry->pePersona ==
Anurag Chouhan6d760662016-02-20 16:05:43 +05301710 QDF_P2P_GO_MODE)) { /* Save P2P attr for Go */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301711 qdf_mem_copy(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001712 &session_entry->p2pGoPsUpdate,
1713 msg->bodyptr,
1714 sizeof(tSirP2PNoaAttr));
1715 lim_log(mac_ctx, LOG2,
1716 FL("bssId"
1717 MAC_ADDRESS_STR
1718 " ctWin=%d oppPsFlag=%d"),
1719 MAC_ADDR_ARRAY(
1720 session_entry->bssId),
1721 session_entry->p2pGoPsUpdate.ctWin,
1722 session_entry->p2pGoPsUpdate.oppPsFlag);
1723 lim_log(mac_ctx, LOG2,
1724 FL
1725 (" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
1726 session_entry->p2pGoPsUpdate.uNoa1IntervalCnt,
1727 session_entry->p2pGoPsUpdate.uNoa1Duration,
1728 session_entry->p2pGoPsUpdate.uNoa1Interval,
1729 session_entry->p2pGoPsUpdate.uNoa1StartTime);
1730 break;
1731 }
1732 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301733 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001734 msg->bodyptr = NULL;
1735 break;
1736 case WMA_MISSED_BEACON_IND:
1737 lim_ps_offload_handle_missed_beacon_ind(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301738 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001739 msg->bodyptr = NULL;
1740 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001741 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1742 lim_process_sme_req_messages(mac_ctx, msg);
1743 break;
1744#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001745 case WMA_TSM_STATS_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001746 lim_send_sme_pe_ese_tsm_rsp(mac_ctx,
1747 (tAniGetTsmStatsRsp *) msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001748 break;
1749#endif
1750 case WMA_ADD_TS_RSP:
1751 lim_process_hal_add_ts_rsp(mac_ctx, msg);
1752 break;
1753 case SIR_LIM_DEL_TS_IND:
1754 lim_process_del_ts_ind(mac_ctx, msg);
1755 break;
1756 case SIR_LIM_BEACON_GEN_IND:
1757 if (mac_ctx->lim.gLimSystemRole != eLIM_AP_ROLE)
1758 sch_process_pre_beacon_ind(mac_ctx, msg);
1759 break;
1760 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1761 lim_delete_sta_context(mac_ctx, msg);
1762 break;
1763 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1764 case SIR_LIM_JOIN_FAIL_TIMEOUT:
1765 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
1766 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1767 case SIR_LIM_AUTH_RSP_TIMEOUT:
1768 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1769 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001770 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001771 case SIR_LIM_REMAIN_CHN_TIMEOUT:
1772 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
1773 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1774 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
1775 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +05301776 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001777 /* These timeout messages are handled by MLM sub module */
1778 lim_process_mlm_req_messages(mac_ctx, msg);
1779 break;
1780 case SIR_LIM_HEART_BEAT_TIMEOUT:
1781 /** check if heart beat failed, even if one Beacon
1782 * is rcvd within the Heart Beat interval continue
1783 * normal processing
1784 */
1785 if (NULL == msg->bodyptr)
1786 lim_log(mac_ctx, LOGE,
1787 FL("Can't Process HB TO - bodyptr is Null"));
1788 else {
1789 session_entry = (tpPESession) msg->bodyptr;
1790 lim_log(mac_ctx, LOGE,
1791 FL
1792 ("SIR_LIM_HEART_BEAT_TIMEOUT, Session %d"),
1793 ((tpPESession) msg->bodyptr)->peSessionId);
1794 limResetHBPktCount(session_entry);
1795 lim_handle_heart_beat_timeout_for_session(mac_ctx,
1796 session_entry);
1797 }
1798 break;
1799 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1800 lim_handle_heart_beat_failure_timeout(mac_ctx);
1801 break;
1802 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1803 mac_ctx->lim.gLimDisassocFrameCredit = 0;
1804 break;
1805 case SIR_LIM_CNF_WAIT_TIMEOUT:
1806 /* Does not receive CNF or dummy packet */
1807 lim_handle_cnf_wait_timeout(mac_ctx, (uint16_t) msg->bodyval);
1808 break;
1809 case SIR_LIM_RETRY_INTERRUPT_MSG:
1810 /* Message from ISR upon TFP's max retry limit interrupt */
1811 break;
1812 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1813 /* Message from ISR upon SP's Invalid session key interrupt */
1814 break;
1815 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1816 /* Message from ISR upon SP's Invalid key ID interrupt */
1817 break;
1818 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1819 /* Message from ISR upon SP's Replay threshold interrupt */
1820 break;
1821 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1822 lim_process_channel_switch_timeout(mac_ctx);
1823 break;
1824 case SIR_LIM_QUIET_TIMEOUT:
1825 lim_process_quiet_timeout(mac_ctx);
1826 break;
1827 case SIR_LIM_QUIET_BSS_TIMEOUT:
1828 lim_process_quiet_bss_timeout(mac_ctx);
1829 break;
1830 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1831 lim_handle_update_olbc_cache(mac_ctx);
1832 break;
1833#ifdef FEATURE_WLAN_TDLS
1834 case SIR_HAL_TDLS_SHOULD_DISCOVER:
1835 case SIR_HAL_TDLS_SHOULD_TEARDOWN:
1836 case SIR_HAL_TDLS_PEER_DISCONNECTED:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05301837 QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001838 ("%s received tdls event: 0x%x"), __func__, msg->type);
1839 lim_send_sme_tdls_event_notify(mac_ctx, msg->type,
1840 (void *)msg->bodyptr);
1841 break;
1842#endif
1843 case WMA_ADD_BSS_RSP:
1844 lim_process_mlm_add_bss_rsp(mac_ctx, msg);
1845 break;
1846 case WMA_ADD_STA_RSP:
1847 lim_process_add_sta_rsp(mac_ctx, msg);
1848 break;
1849 case WMA_DELETE_STA_RSP:
1850 lim_process_mlm_del_sta_rsp(mac_ctx, msg);
1851 break;
1852 case WMA_DELETE_BSS_RSP:
1853 lim_handle_delete_bss_rsp(mac_ctx, msg);
1854 break;
1855 case WMA_CSA_OFFLOAD_EVENT:
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05301856 lim_handle_hw_mode_change_on_csa_event(mac_ctx, msg);
1857 break;
1858 case SIR_LIM_CSA_POST_HW_MODE_CHANGE:
1859 lim_handle_csa_event_post_dbs_downgrade(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001860 break;
1861 case WMA_SET_BSSKEY_RSP:
1862 case WMA_SET_STA_BCASTKEY_RSP:
1863 lim_process_mlm_set_bss_key_rsp(mac_ctx, msg);
1864 break;
1865 case WMA_SET_STAKEY_RSP:
1866 lim_process_mlm_set_sta_key_rsp(mac_ctx, msg);
1867 break;
1868 case WMA_GET_STATISTICS_RSP:
1869 lim_send_sme_pe_statistics_rsp(mac_ctx, msg->type,
1870 (void *)msg->bodyptr);
1871 break;
1872 case WMA_SET_MIMOPS_RSP:
1873 case WMA_SET_TX_POWER_RSP:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301874 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001875 msg->bodyptr = NULL;
1876 break;
1877 case WMA_SET_MAX_TX_POWER_RSP:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001878 rrm_set_max_tx_power_rsp(mac_ctx, msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001879 if (msg->bodyptr != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301880 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001881 msg->bodyptr = NULL;
1882 }
1883 break;
1884 case SIR_LIM_ADDR2_MISS_IND:
1885 lim_log(mac_ctx, LOGE,
1886 FL("Addr2 mismatch interrupt received %X"), msg->type);
1887 /* message from HAL indicating addr2 mismatch interrupt occurred
1888 * msg->bodyptr contains only pointer to 48-bit addr2 field
1889 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301890 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001891 msg->bodyptr = NULL;
1892 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001893 case WMA_AGGR_QOS_RSP:
1894 lim_process_ft_aggr_qo_s_rsp(mac_ctx, msg);
1895 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001896 case WMA_SET_LINK_STATE_RSP:
1897 link_state_param = (tLinkStateParams *) msg->bodyptr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001898 session_entry = link_state_param->session;
1899 if (link_state_param->ft
1900#if defined WLAN_FEATURE_ROAM_OFFLOAD
1901 && !session_entry->bRoamSynchInProgress
1902#endif
1903 )
1904 lim_send_reassoc_req_with_ft_ies_mgmt_frame(mac_ctx,
1905 session_entry->pLimMlmReassocReq,
1906 session_entry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001907 if (link_state_param->callback)
1908 link_state_param->callback(mac_ctx,
1909 link_state_param->callbackArg,
1910 link_state_param->status);
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 case eWNI_SME_SET_BCN_FILTER_REQ:
1915 session_id = (uint8_t) msg->bodyval;
1916 session_entry = &mac_ctx->lim.gpSession[session_id];
1917 if ((session_entry != NULL) &&
1918 (lim_send_beacon_filter_info(mac_ctx, session_entry) !=
1919 eSIR_SUCCESS))
1920 lim_log(mac_ctx, LOGE,
1921 FL("Failied to send Beacon Filter Info "));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301922 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001923 msg->bodyptr = NULL;
1924 break;
1925#ifdef FEATURE_WLAN_TDLS
1926 case WMA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
1927 tdls_link_params = (tTdlsLinkEstablishParams *) msg->bodyptr;
1928 session_entry = pe_find_session_by_sta_id(mac_ctx,
1929 tdls_link_params->staIdx, &session_id);
1930 if (session_entry == NULL) {
1931 lim_log(mac_ctx, LOGE,
1932 FL("session %u does not exist"), session_id);
1933 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP
1934 * message to SME with session id as zero and status
1935 * as FAILURE so, that message queued in SME queue
1936 * can be freed to prevent the SME cmd buffer leak
1937 */
1938 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx, 0,
1939 NULL, NULL, eSIR_FAILURE);
1940 } else {
1941 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx,
1942 session_entry->smeSessionId, NULL, NULL,
1943 tdls_link_params->status);
1944 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301945 qdf_mem_free((void *)(msg->bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001946 msg->bodyptr = NULL;
1947 break;
1948#endif
1949 case WMA_RX_SCAN_EVENT:
1950 lim_process_rx_scan_event(mac_ctx, msg->bodyptr);
1951 break;
1952 case WMA_IBSS_PEER_INACTIVITY_IND:
1953 lim_process_ibss_peer_inactivity(mac_ctx, 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_DFS_RADAR_IND:
1958 lim_send_sme_dfs_event_notify(mac_ctx, msg->type,
1959 (void *)msg->bodyptr);
1960 /* msg->bodyptr will be freed up by SME/CSR */
1961 break;
1962 case WMA_DFS_BEACON_TX_SUCCESS_IND:
1963 lim_process_beacon_tx_success_ind(mac_ctx, msg->type,
1964 (void *)msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301965 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001966 msg->bodyptr = NULL;
1967 break;
1968 case WMA_DISASSOC_TX_COMP:
1969 lim_disassoc_tx_complete_cnf(mac_ctx, msg->bodyval);
1970 break;
1971 case WMA_DEAUTH_TX_COMP:
1972 lim_deauth_tx_complete_cnf(mac_ctx, msg->bodyval);
1973 break;
1974#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1975 case WMA_UPDATE_Q2Q_IE_IND:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301976 qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001977 beacon_params.paramChangeBitmap = 0;
1978 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1979 vdev_id = ((uint8_t *)msg->bodyptr)[i];
1980 session_entry = pe_find_session_by_sme_session_id(
1981 mac_ctx, vdev_id);
1982 if (session_entry == NULL)
1983 continue;
1984 session_entry->sap_advertise_avoid_ch_ie =
1985 (uint8_t)msg->bodyval;
1986 /*
1987 * if message comes for DFS channel, no need to update:
1988 * 1) We wont have MCC with DFS channels. so no need to
1989 * add Q2Q IE
1990 * 2) We cannot end up in DFS channel SCC by channel
1991 * switch from non DFS MCC scenario, so no need to
1992 * remove Q2Q IE
1993 * 3) There is however a case where device start MCC and
1994 * then user modifies hostapd.conf and does SAP
1995 * restart, in such a case, beacon params will be
1996 * reset and thus will not contain Q2Q IE, by default
1997 */
1998 if (cds_get_channel_state(
1999 session_entry->currentOperChannel)
2000 != CHANNEL_STATE_DFS) {
2001 beacon_params.bssIdx = session_entry->bssIdx;
2002 beacon_params.beaconInterval =
2003 session_entry->beaconParams.beaconInterval;
2004 beacon_params.paramChangeBitmap |=
2005 PARAM_BCN_INTERVAL_CHANGED;
2006 sch_set_fixed_beacon_fields(mac_ctx,
2007 session_entry);
2008 lim_send_beacon_params(mac_ctx, &beacon_params,
2009 session_entry);
2010 }
2011 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302012 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002013 msg->bodyptr = NULL;
2014 break;
2015#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
2016 case eWNI_SME_NSS_UPDATE_REQ:
2017 case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ:
2018 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302019 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002020 msg->bodyptr = NULL;
2021 break;
2022 case eWNI_SME_CHANNEL_CHANGE_REQ:
2023 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302024 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002025 msg->bodyptr = NULL;
2026 break;
2027 case eWNI_SME_START_BEACON_REQ:
2028 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302029 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002030 msg->bodyptr = NULL;
2031 break;
2032 case eWNI_SME_UPDATE_ADDITIONAL_IES:
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 case eWNI_SME_MODIFY_ADDITIONAL_IES:
2038 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302039 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002040 msg->bodyptr = NULL;
2041 break;
2042#ifdef QCA_HT_2040_COEX
2043 case eWNI_SME_SET_HT_2040_MODE:
2044 lim_process_sme_req_messages(mac_ctx, msg);
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#endif
2049 case SIR_HAL_SOC_SET_HW_MODE_RESP:
2050 lim_process_set_hw_mode_resp(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302051 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002052 msg->bodyptr = NULL;
2053 break;
2054 case SIR_HAL_SOC_HW_MODE_TRANS_IND:
2055 lim_process_hw_mode_trans_ind(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302056 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002057 msg->bodyptr = NULL;
2058 break;
2059 case SIR_HAL_SOC_DUAL_MAC_CFG_RESP:
2060 lim_process_dual_mac_cfg_resp(mac_ctx, msg->bodyptr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302061 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002062 msg->bodyptr = NULL;
2063 break;
2064 case eWNI_SME_SET_IE_REQ:
2065 lim_process_sme_req_messages(mac_ctx, msg);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302066 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002067 msg->bodyptr = NULL;
2068 break;
Sandeep Puligillae0875662016-02-12 16:09:21 -08002069 case eWNI_SME_HT40_OBSS_SCAN_IND:
2070 lim_process_sme_obss_scan_ind(mac_ctx, msg);
2071 qdf_mem_free(msg->bodyptr);
Archana Ramachandrana20ef812015-11-13 16:12:13 -08002072 break;
2073 case SIR_HAL_SOC_ANTENNA_MODE_RESP:
2074 lim_process_set_antenna_resp(mac_ctx, msg->bodyptr);
2075 qdf_mem_free((void *)msg->bodyptr);
Sandeep Puligillae0875662016-02-12 16:09:21 -08002076 msg->bodyptr = NULL;
2077 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002078 default:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302079 qdf_mem_free((void *)msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002080 msg->bodyptr = NULL;
2081 /* Unwanted messages */
2082 /* Log error */
2083 lim_log(mac_ctx, LOGE,
2084 FL("Discarding unexpected message received %X"),
2085 msg->type);
2086 lim_print_msg_name(mac_ctx, LOGE, msg->type);
2087 break;
2088
2089 } /* switch (msg->type) */
2090} /*** end lim_process_messages() ***/
2091
2092/**
2093 * lim_process_deferred_message_queue
2094 *
2095 ***FUNCTION:
2096 * This function is called by LIM while exiting from Learn
2097 * mode. This function fetches messages posted to the LIM
2098 * deferred message queue limDeferredMsgQ.
2099 *
2100 ***LOGIC:
2101 *
2102 ***ASSUMPTIONS:
2103 * NA
2104 *
2105 ***NOTE:
2106 * NA
2107 *
2108 * @param pMac - Pointer to Global MAC structure
2109 * @return None
2110 */
2111
2112void lim_process_deferred_message_queue(tpAniSirGlobal pMac)
2113{
2114 tSirMsgQ limMsg = { 0, 0, 0 };
2115
2116 tSirMsgQ *readMsg;
2117 uint16_t size;
2118
2119 /*
2120 ** check any deferred messages need to be processed
2121 **/
2122 size = pMac->lim.gLimDeferredMsgQ.size;
2123 if (size > 0) {
2124 while ((readMsg = lim_read_deferred_msg_q(pMac)) != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302125 qdf_mem_copy((uint8_t *) &limMsg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002126 (uint8_t *) readMsg, sizeof(tSirMsgQ));
2127 size--;
2128 lim_process_messages(pMac, &limMsg);
2129
2130 if ((lim_is_system_in_scan_state(pMac))
2131 || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac))
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +05302132 || (pMac->lim.gLimSystemInScanLearnMode)
2133 || pMac->lim.gLimAddtsSent)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002134 break;
2135 }
2136 }
2137} /*** end lim_process_deferred_message_queue() ***/
2138
2139/**
2140 * lim_process_normal_hdd_msg() - Process the message and defer if needed
2141 * @mac_ctx : Pointer to Global MAC structure
2142 * @msg : The message need to be processed
2143 * @rsp_reqd: whether return result to hdd
2144 *
2145 * This function checks the current lim state and decide whether the message
2146 * passed will be deferred or not.
2147 *
2148 * Return: None
2149 */
2150static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx, tSirMsgQ *msg,
2151 uint8_t rsp_reqd)
2152{
2153 bool defer_msg = true;
2154
2155 /* Added For BT-AMP Support */
2156 if ((mac_ctx->lim.gLimSystemRole == eLIM_AP_ROLE)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002157 || (mac_ctx->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)) {
2158 /*
2159 * This check is required only for the AP and in 2 cases.
2160 * 1. If we are in learn mode and we receive any of these
2161 * messages, you have to come out of scan and process the
2162 * message, hence dont defer the message here. In handler,
2163 * these message could be defered till we actually come out of
2164 * scan mode.
2165 * 2. If radar is detected, you might have to defer all of
2166 * these messages except Stop BSS request/ Switch channel
2167 * request. This decision is also made inside its handler.
2168 *
2169 * Please be careful while using the flag defer_msg. Possibly
2170 * you might end up in an infinite loop.
2171 */
2172 if ((msg->type == eWNI_SME_START_BSS_REQ) ||
2173 (msg->type == eWNI_SME_STOP_BSS_REQ) ||
2174 (msg->type == eWNI_SME_SWITCH_CHL_IND))
2175 defer_msg = false;
2176 }
2177
2178 if (((mac_ctx->lim.gLimAddtsSent) ||
2179 (lim_is_system_in_scan_state(mac_ctx))) && defer_msg) {
2180 /*
2181 * System is in DFS (Learn) mode or awaiting addts response or
2182 * if radar is detected, Defer processsing this message
2183 */
2184 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
2185#ifdef WLAN_DEBUG
2186 mac_ctx->lim.numSme++;
2187#endif
2188 lim_log_session_states(mac_ctx);
2189 /* Release body */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302190 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002191 msg->bodyptr = NULL;
2192 }
2193 } else {
2194 /*
2195 * These messages are from HDD.Since these requests may also be
2196 * generated internally within LIM module, need to distinquish
2197 * and send response to host
2198 */
2199 if (rsp_reqd)
2200 mac_ctx->lim.gLimRspReqd = true;
2201#ifdef WLAN_DEBUG
2202 mac_ctx->lim.numSme++;
2203#endif
2204 if (lim_process_sme_req_messages(mac_ctx, msg)) {
2205 /*
2206 * Release body. limProcessSmeReqMessage consumed the
2207 * buffer. We can free it.
2208 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302209 qdf_mem_free(msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002210 msg->bodyptr = NULL;
2211 }
2212 }
2213}
2214
2215void
2216handle_ht_capabilityand_ht_info(struct sAniSirGlobal *pMac,
2217 tpPESession psessionEntry)
2218{
2219 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2220 tSirMacHTParametersInfo macHTParametersInfo;
2221 tSirMacHTInfoField1 macHTInfoField1;
2222 tSirMacHTInfoField2 macHTInfoField2;
2223 tSirMacHTInfoField3 macHTInfoField3;
2224 uint32_t cfgValue;
2225 uint8_t *ptr;
2226
2227 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) !=
2228 eSIR_SUCCESS) {
2229 lim_log(pMac, LOGP,
2230 FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
2231 return;
2232 }
2233 ptr = (uint8_t *) &macHTCapabilityInfo;
2234 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2235 pMac->lim.gHTLsigTXOPProtection =
2236 (uint8_t) macHTCapabilityInfo.lsigTXOPProtection;
2237 pMac->lim.gHTMIMOPSState =
2238 (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2239 pMac->lim.gHTGreenfield = (uint8_t) macHTCapabilityInfo.greenField;
2240 pMac->lim.gHTMaxAmsduLength =
2241 (uint8_t) macHTCapabilityInfo.maximalAMSDUsize;
2242 pMac->lim.gHTShortGI20Mhz = (uint8_t) macHTCapabilityInfo.shortGI20MHz;
2243 pMac->lim.gHTShortGI40Mhz = (uint8_t) macHTCapabilityInfo.shortGI40MHz;
2244 pMac->lim.gHTPSMPSupport = (uint8_t) macHTCapabilityInfo.psmp;
2245 pMac->lim.gHTDsssCckRate40MHzSupport =
2246 (uint8_t) macHTCapabilityInfo.dsssCckMode40MHz;
2247
2248 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) !=
2249 eSIR_SUCCESS) {
2250 lim_log(pMac, LOGP,
2251 FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
2252 return;
2253 }
2254 ptr = (uint8_t *) &macHTParametersInfo;
2255 *ptr = (uint8_t) (cfgValue & 0xff);
2256 pMac->lim.gHTAMpduDensity = (uint8_t) macHTParametersInfo.mpduDensity;
2257 pMac->lim.gHTMaxRxAMpduFactor =
2258 (uint8_t) macHTParametersInfo.maxRxAMPDUFactor;
2259
2260 /* Get HT IE Info */
2261 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) !=
2262 eSIR_SUCCESS) {
2263 lim_log(pMac, LOGP,
2264 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
2265 return;
2266 }
2267 ptr = (uint8_t *) &macHTInfoField1;
2268 *((uint8_t *) ptr) = (uint8_t) (cfgValue & 0xff);
2269 pMac->lim.gHTServiceIntervalGranularity =
2270 (uint8_t) macHTInfoField1.serviceIntervalGranularity;
2271 pMac->lim.gHTControlledAccessOnly =
2272 (uint8_t) macHTInfoField1.controlledAccessOnly;
2273 pMac->lim.gHTRifsMode = (uint8_t) macHTInfoField1.rifsMode;
2274
2275 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) !=
2276 eSIR_SUCCESS) {
2277 lim_log(pMac, LOGP,
2278 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
2279 return;
2280 }
2281 ptr = (uint8_t *) &macHTInfoField2;
2282 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2283 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2284
2285 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) !=
2286 eSIR_SUCCESS) {
2287 lim_log(pMac, LOGP,
2288 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
2289 return;
2290 }
2291 ptr = (uint8_t *) &macHTInfoField3;
2292 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2293 pMac->lim.gHTPCOActive = (uint8_t) macHTInfoField3.pcoActive;
2294 pMac->lim.gHTPCOPhase = (uint8_t) macHTInfoField3.pcoPhase;
2295 pMac->lim.gHTSecondaryBeacon =
2296 (uint8_t) macHTInfoField3.secondaryBeacon;
2297 pMac->lim.gHTDualCTSProtection =
2298 (uint8_t) macHTInfoField3.dualCTSProtection;
2299 pMac->lim.gHTSTBCBasicMCS = (uint8_t) macHTInfoField3.basicSTBCMCS;
2300
2301 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2302 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2303 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2304 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2305 */
2306 if (psessionEntry != NULL) {
2307 psessionEntry->htCapability =
2308 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2309 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2310 (uint8_t) macHTInfoField3.lsigTXOPProtectionFullSupport;
Sandeep Puligillae0875662016-02-12 16:09:21 -08002311 lim_init_obss_params(pMac, psessionEntry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002312 }
2313}
2314
2315void lim_log_session_states(tpAniSirGlobal mac_ctx)
2316{
2317#ifdef WLAN_DEBUG
2318 int i;
2319
2320 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
2321 if (mac_ctx->lim.gpSession[i].valid) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05302322 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002323 FL("sysRole(%d) Session (%d)"),
2324 mac_ctx->lim.gLimSystemRole, i);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05302325 QDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002326 FL("SME: Curr %s,Prev %s,MLM: Curr %s,Prev %s"),
2327 lim_sme_state_str(
2328 mac_ctx->lim.gpSession[i].limSmeState),
2329 lim_sme_state_str(
2330 mac_ctx->lim.gpSession[i].limPrevSmeState),
2331 lim_mlm_state_str(
2332 mac_ctx->lim.gpSession[i].limMlmState),
2333 lim_mlm_state_str(
2334 mac_ctx->lim.gpSession[i].limPrevMlmState));
2335 }
2336 }
2337#endif
2338}