blob: 7b16ae7f9ac23b2fe3a6a36f75dcf0155fc88363 [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"
54#ifdef WLAN_FEATURE_VOWIFI_11R
55#include "lim_ft_defs.h"
56#endif
57#include "lim_session.h"
58#include "lim_send_messages.h"
59
60#if defined WLAN_FEATURE_VOWIFI
61#include "rrm_api.h"
62#endif
63
64#if defined WLAN_FEATURE_VOWIFI_11R
65#include "lim_ft.h"
66#endif
67
Anurag Chouhan6d760662016-02-20 16:05:43 +053068#include "qdf_types.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080069#include "cds_packet.h"
70#include "cdf_memory.h"
71
72void lim_log_session_states(tpAniSirGlobal pMac);
73static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx,
74 struct sSirMsgQ *msg, uint8_t rsp_reqd);
75
76/**
77 * lim_process_dual_mac_cfg_resp() - Process set dual mac config response
78 * @mac: Global MAC pointer
79 * @body: Set dual mac config response in sir_dual_mac_config_resp format
80 *
81 * Process the set dual mac config response and post the message
82 * to SME to process this further and release the active
83 * command list
84 *
85 * Return: None
86 */
87static void lim_process_dual_mac_cfg_resp(tpAniSirGlobal mac, void *body)
88{
89 struct sir_dual_mac_config_resp *resp, *param;
90 uint32_t len, fail_resp = 0;
91 tSirMsgQ msg;
92
93 resp = (struct sir_dual_mac_config_resp *)body;
94 if (!resp) {
95 lim_log(mac, LOGE, FL("Set dual mac cfg param is NULL"));
96 fail_resp = 1;
97 /* Not returning here. If possible, let us proceed
98 * and send fail response to SME
99 */
100 }
101
102 len = sizeof(*param);
103
104 param = cdf_mem_malloc(len);
105 if (!param) {
106 lim_log(mac, LOGE, FL("Fail to allocate memory"));
107 /* Memory allocation for param failed.
108 * Cannot send fail status back to SME
109 */
110 return;
111 }
112
113 if (fail_resp) {
114 lim_log(mac, LOGE, FL("Send fail status to SME"));
115 param->status = SET_HW_MODE_STATUS_ECANCELED;
116 } else {
117 param->status = resp->status;
118 /*
119 * TODO: Update this HW mode info in any UMAC params, if needed
120 */
121 }
122
123 msg.type = eWNI_SME_SET_DUAL_MAC_CFG_RESP;
124 msg.bodyptr = param;
125 msg.bodyval = 0;
126 lim_log(mac, LOG1, FL("Send eWNI_SME_SET_DUAL_MAC_CFG_RESP to SME"));
127 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
128 return;
129}
130
131/**
132 * lim_process_set_hw_mode_resp() - Process set HW mode response
133 * @mac: Global MAC pointer
134 * @body: Set HW mode response in sir_set_hw_mode_resp format
135 *
136 * Process the set HW mode response and post the message
137 * to SME to process this further and release the active
138 * command list
139 *
140 * Return: None
141 */
142static void lim_process_set_hw_mode_resp(tpAniSirGlobal mac, void *body)
143{
144 struct sir_set_hw_mode_resp *resp, *param;
145 uint32_t len, i, fail_resp = 0;
146 tSirMsgQ msg;
147
148 resp = (struct sir_set_hw_mode_resp *)body;
149 if (!resp) {
150 lim_log(mac, LOGE, FL("Set HW mode param is NULL"));
151 fail_resp = 1;
152 /* Not returning here. If possible, let us proceed
153 * and send fail response to SME */
154 }
155
156 len = sizeof(*param);
157
158 param = cdf_mem_malloc(len);
159 if (!param) {
160 lim_log(mac, LOGE, FL("Fail to allocate memory"));
161 /* Memory allocation for param failed.
162 * Cannot send fail status back to SME
163 */
164 return;
165 }
166
167 if (fail_resp) {
168 lim_log(mac, LOGE, FL("Send fail status to SME"));
169 param->status = SET_HW_MODE_STATUS_ECANCELED;
170 param->cfgd_hw_mode_index = 0;
171 param->num_vdev_mac_entries = 0;
172 } else {
173 param->status = resp->status;
174 param->cfgd_hw_mode_index = resp->cfgd_hw_mode_index;
175 param->num_vdev_mac_entries = resp->num_vdev_mac_entries;
176
177 for (i = 0; i < resp->num_vdev_mac_entries; i++) {
178 param->vdev_mac_map[i].vdev_id =
179 resp->vdev_mac_map[i].vdev_id;
180 param->vdev_mac_map[i].mac_id =
181 resp->vdev_mac_map[i].mac_id;
182 }
183 /*
184 * TODO: Update this HW mode info in any UMAC params, if needed
185 */
186 }
187
188 msg.type = eWNI_SME_SET_HW_MODE_RESP;
189 msg.bodyptr = param;
190 msg.bodyval = 0;
191 lim_log(mac, LOGE, FL("Send eWNI_SME_SET_HW_MODE_RESP to SME"));
192 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
193 return;
194}
195
196/**
197 * lim_process_hw_mode_trans_ind() - Process set HW mode transition indication
198 * @mac: Global MAC pointer
199 * @body: Set HW mode response in sir_hw_mode_trans_ind format
200 *
201 * Process the set HW mode transition indication and post the message
202 * to SME to invoke the HDD callback
203 * command list
204 *
205 * Return: None
206 */
207static void lim_process_hw_mode_trans_ind(tpAniSirGlobal mac, void *body)
208{
209 struct sir_hw_mode_trans_ind *ind, *param;
210 uint32_t len, i;
211 tSirMsgQ msg;
212
213 ind = (struct sir_hw_mode_trans_ind *)body;
214 if (!ind) {
215 lim_log(mac, LOGE, FL("Set HW mode trans ind param is NULL"));
216 return;
217 }
218
219 len = sizeof(*param);
220
221 param = cdf_mem_malloc(len);
222 if (!param) {
223 lim_log(mac, LOGE, FL("Fail to allocate memory"));
224 return;
225 }
226
227 param->old_hw_mode_index = ind->old_hw_mode_index;
228 param->new_hw_mode_index = ind->new_hw_mode_index;
229 param->num_vdev_mac_entries = ind->num_vdev_mac_entries;
230
231 for (i = 0; i < ind->num_vdev_mac_entries; i++) {
232 param->vdev_mac_map[i].vdev_id =
233 ind->vdev_mac_map[i].vdev_id;
234 param->vdev_mac_map[i].mac_id =
235 ind->vdev_mac_map[i].mac_id;
236 }
237
238 /* TODO: Update this HW mode info in any UMAC params, if needed */
239
240 msg.type = eWNI_SME_HW_MODE_TRANS_IND;
241 msg.bodyptr = param;
242 msg.bodyval = 0;
243 lim_log(mac, LOGE, FL("Send eWNI_SME_HW_MODE_TRANS_IND to SME"));
244 lim_sys_process_mmh_msg_api(mac, &msg, ePROT);
245 return;
246}
247
248/** -------------------------------------------------------------
249 \fn def_msg_decision
250 \brief The function decides whether to defer a message or not in limProcessMessage function
251 \param tpAniSirGlobal pMac
252 \param tSirMsgQ limMsg
253 \param tSirMacTspecIE *ppInfo
254 \return none
255 -------------------------------------------------------------*/
256
257uint8_t static def_msg_decision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
258{
259
260/* this function should not changed */
261 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) {
262 /* Defer processsing this message */
263 if (lim_defer_msg(pMac, limMsg) != TX_SUCCESS) {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530264 CDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800265 FL("Unable to Defer Msg"));
266 lim_log_session_states(pMac);
267 lim_handle_defer_msg_error(pMac, limMsg);
268 }
269 return true;
270 }
271 /* When defer is requested then defer all the messages except HAL responses. */
272 if ((!lim_is_system_in_scan_state(pMac))
273 && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac))
274 && !pMac->lim.gLimSystemInScanLearnMode) {
275 if ((limMsg->type != WMA_ADD_BSS_RSP)
276 && (limMsg->type != WMA_DELETE_BSS_RSP)
277 && (limMsg->type != WMA_ADD_STA_RSP)
278 && (limMsg->type != WMA_DELETE_STA_RSP)
279 && (limMsg->type != WMA_SET_BSSKEY_RSP)
280 && (limMsg->type != WMA_SET_STAKEY_RSP)
281 && (limMsg->type != WMA_SET_STA_BCASTKEY_RSP)
282 && (limMsg->type != WMA_AGGR_QOS_RSP)
283 && (limMsg->type != WMA_SET_MIMOPS_RSP)
284 && (limMsg->type != WMA_SWITCH_CHANNEL_RSP)
285 && (limMsg->type != WMA_P2P_NOA_ATTR_IND)
286 && (limMsg->type != WMA_P2P_NOA_START_IND) &&
287#ifdef FEATURE_OEM_DATA_SUPPORT
288 (limMsg->type != WMA_START_OEM_DATA_RSP) &&
289#endif
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +0530290 (limMsg->type != WMA_ADD_TS_RSP) &&
Hanumantha Reddy Pothulab8340212016-01-12 11:16:06 +0530291 /*
292 * LIM won't process any defer queue commands if gLimAddtsSent is
293 * set to TRUE. gLimAddtsSent will be set TRUE to while sending
294 * ADDTS REQ. Say, when deferring is enabled, if
295 * SIR_LIM_ADDTS_RSP_TIMEOUT is posted (because of not receiving ADDTS
296 * RSP) then this command will be added to defer queue and as
297 * gLimAddtsSent is set TRUE LIM will never process any commands from
298 * defer queue, including SIR_LIM_ADDTS_RSP_TIMEOUT. Hence allowing
299 * SIR_LIM_ADDTS_RSP_TIMEOUT command to be processed with deferring
300 * enabled, so that this will be processed immediately and sets
301 * gLimAddtsSent to FALSE.
302 */
303 (limMsg->type != SIR_LIM_ADDTS_RSP_TIMEOUT) &&
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +0530304 /* Allow processing of RX frames while awaiting reception
305 * of ADD TS response over the air. This logic particularly
306 * handles the case when host sends ADD BA request to FW
307 * after ADD TS request is sent over the air and
308 * ADD TS response received over the air */
309 !(limMsg->type == SIR_BB_XPORT_MGMT_MSG &&
310 pMac->lim.gLimAddtsSent)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800311 PELOG1(lim_log
312 (pMac, LOG1,
313 FL
314 ("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode"),
315 lim_msg_str(limMsg->type));
316 )
317 /* Defer processsing this message */
318 if (lim_defer_msg(pMac, limMsg) != TX_SUCCESS) {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530319 CDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800320 FL("Unable to Defer Msg"));
321 lim_log_session_states(pMac);
322 lim_handle_defer_msg_error(pMac, limMsg);
323
324 }
325 return true;
326 }
327 }
328 return false;
329}
330
331#ifdef FEATURE_WLAN_EXTSCAN
332static void
333__lim_pno_match_fwd_bcn_probepsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info,
334 tSirProbeRespBeacon *frame, uint32_t ie_len,
335 uint32_t msg_type)
336{
337 struct pno_match_found *result;
338 uint8_t *body;
339 tSirMsgQ mmh_msg;
340 tpSirMacMgmtHdr hdr;
341 uint32_t num_results = 1, len, i;
342
343 /* Upon receiving every matched beacon, bss info is forwarded to the
344 * the upper layer, hence num_results is set to 1 */
345 len = sizeof(*result) + (num_results * sizeof(tSirWifiScanResult)) +
346 ie_len;
347
348 result = cdf_mem_malloc(len);
349 if (NULL == result) {
350 lim_log(pmac, LOGE, FL("Memory allocation failed"));
351 return;
352 }
353 hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
354 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
355 cdf_mem_zero(result, sizeof(*result) + ie_len);
356
357 /* Received frame does not have request id, hence set 0 */
358 result->request_id = 0;
359 result->more_data = 0;
360 result->num_results = num_results;
361
362 for (i = 0; i < result->num_results; i++) {
363 result->ap[i].ts = cdf_mc_timer_get_system_time();
364 result->ap[i].beaconPeriod = frame->beaconInterval;
365 result->ap[i].capability =
366 lim_get_u16((uint8_t *) &frame->capabilityInfo);
367 result->ap[i].channel = WMA_GET_RX_CH(rx_pkt_info);
Deepak Dhamdhere68929ec2015-08-05 15:16:35 -0700368 result->ap[i].rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800369 result->ap[i].rtt = 0;
370 result->ap[i].rtt_sd = 0;
371 result->ap[i].ieLength = ie_len;
372 cdf_mem_copy((uint8_t *) &result->ap[i].ssid[0],
373 (uint8_t *) frame->ssId.ssId, frame->ssId.length);
374 result->ap[i].ssid[frame->ssId.length] = '\0';
375 cdf_mem_copy((uint8_t *) &result->ap[i].bssid,
376 (uint8_t *) hdr->bssId,
377 sizeof(tSirMacAddr));
378 /* Copy IE fields */
379 cdf_mem_copy((uint8_t *) &result->ap[i].ieData,
380 body + SIR_MAC_B_PR_SSID_OFFSET, ie_len);
381 }
382
383 mmh_msg.type = msg_type;
384 mmh_msg.bodyptr = result;
385 mmh_msg.bodyval = 0;
386 lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT);
387}
388
389
390static void
391__lim_ext_scan_forward_bcn_probe_rsp(tpAniSirGlobal pmac, uint8_t *rx_pkt_info,
392 tSirProbeRespBeacon *frame,
393 uint32_t ie_len,
394 uint32_t msg_type)
395{
396 tpSirWifiFullScanResultEvent result;
397 uint8_t *body;
398 tSirMsgQ mmh_msg;
399 tpSirMacMgmtHdr hdr;
400
401 result = cdf_mem_malloc(sizeof(*result) + ie_len);
402 if (NULL == result) {
403 lim_log(pmac, LOGE, FL("Memory allocation failed"));
404 return;
405 }
406 hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
407 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
408 cdf_mem_zero(result, sizeof(*result) + ie_len);
409
410 /* Received frame does not have request id, hence set 0 */
411 result->requestId = 0;
412
413 result->moreData = 0;
414 result->ap.ts = cdf_mc_timer_get_system_time();
415 result->ap.beaconPeriod = frame->beaconInterval;
416 result->ap.capability =
417 lim_get_u16((uint8_t *) &frame->capabilityInfo);
418 result->ap.channel = WMA_GET_RX_CH(rx_pkt_info);
Deepak Dhamdhere68929ec2015-08-05 15:16:35 -0700419 result->ap.rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800420 result->ap.rtt = 0;
421 result->ap.rtt_sd = 0;
422 result->ap.ieLength = ie_len;
423
424 cdf_mem_copy((uint8_t *) &result->ap.ssid[0],
425 (uint8_t *) frame->ssId.ssId, frame->ssId.length);
426 result->ap.ssid[frame->ssId.length] = '\0';
427 cdf_mem_copy((uint8_t *) &result->ap.bssid.bytes,
428 (uint8_t *) hdr->bssId,
Anurag Chouhan6d760662016-02-20 16:05:43 +0530429 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430 /* Copy IE fields */
431 cdf_mem_copy((uint8_t *) &result->ap.ieData,
432 body + SIR_MAC_B_PR_SSID_OFFSET, ie_len);
433
434 mmh_msg.type = msg_type;
435 mmh_msg.bodyptr = result;
436 mmh_msg.bodyval = 0;
437 lim_sys_process_mmh_msg_api(pmac, &mmh_msg, ePROT);
438}
439
440static void
441__lim_process_ext_scan_beacon_probe_rsp(tpAniSirGlobal pmac,
442 uint8_t *rx_pkt_info,
443 uint8_t sub_type)
444{
445 tSirProbeRespBeacon *frame;
446 uint8_t *body;
447 uint32_t frm_len;
448 tSirRetStatus status;
449
450 frm_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
451 if (frm_len <= SIR_MAC_B_PR_SSID_OFFSET) {
452 lim_log(pmac, LOGP,
453 FL("RX packet has invalid length %d"), frm_len);
454 return;
455 }
456
457 frame = cdf_mem_malloc(sizeof(*frame));
458 if (NULL == frame) {
459 lim_log(pmac, LOGE, FL("Memory allocation failed"));
460 return;
461 }
462
463 if (sub_type == SIR_MAC_MGMT_BEACON) {
464 lim_log(pmac, LOG2, FL("Beacon due to ExtScan/epno"));
465 status = sir_convert_beacon_frame2_struct(pmac,
466 (uint8_t *)rx_pkt_info,
467 frame);
468 } else if (sub_type == SIR_MAC_MGMT_PROBE_RSP) {
469 lim_log(pmac, LOG2, FL("Probe Rsp due to ExtScan/epno"));
470 body = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
471 status = sir_convert_probe_frame2_struct(pmac, body,
472 frm_len, frame);
473 } else {
474 cdf_mem_free(frame);
475 return;
476 }
477
478 if (status != eSIR_SUCCESS) {
479 lim_log(pmac, LOGE, FL("Frame parsing failed"));
480 cdf_mem_free(frame);
481 return;
482 }
483
484 if (WMA_IS_EXTSCAN_SCAN_SRC(rx_pkt_info))
485 __lim_ext_scan_forward_bcn_probe_rsp(pmac, rx_pkt_info, frame,
486 (frm_len - SIR_MAC_B_PR_SSID_OFFSET),
487 eWNI_SME_EXTSCAN_FULL_SCAN_RESULT_IND);
488
489 if (WMA_IS_EPNO_SCAN_SRC(rx_pkt_info))
490 __lim_pno_match_fwd_bcn_probepsp(pmac, rx_pkt_info, frame,
491 (frm_len - SIR_MAC_B_PR_SSID_OFFSET),
492 eWNI_SME_EPNO_NETWORK_FOUND_IND);
493
494 cdf_mem_free(frame);
495}
496#endif
497
498/*
499 * Beacon Handling Cases:
500 * during scanning, when no session is active:
501 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
502 * during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
503 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
504 * during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
505 * handled by lim_handle_frames_in_scan_state before __lim_handle_beacon call is invoked.
506 * Not scanning, no session:
507 * there should not be any beacon coming, if coming, should be dropped.
508 * Not Scanning,
509 */
510static void
511__lim_handle_beacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg,
512 tpPESession psessionEntry)
513{
514 /* checking for global SME state... */
515 uint8_t *pRxPacketInfo;
516 lim_get_b_dfrom_rx_packet(pMac, pMsg->bodyptr,
Anurag Chouhanffb21542016-02-17 14:33:03 +0530517 (uint32_t **) &pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800518
519 /* This function should not be called if beacon is received in scan state. */
520 /* So not doing any checks for the global state. */
521
522 if (psessionEntry == NULL) {
523 sch_beacon_process(pMac, pRxPacketInfo, NULL);
524 } else if ((psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
525 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)) {
526 sch_beacon_process(pMac, pRxPacketInfo, psessionEntry);
527 } else
528 lim_process_beacon_frame(pMac, pRxPacketInfo, psessionEntry);
529
530 return;
531}
532
533/**
534 * lim_defer_msg()
535 *
536 ***FUNCTION:
537 * This function is called to defer the messages received
538 * during Learn mode
539 *
540 ***LOGIC:
541 * NA
542 *
543 ***ASSUMPTIONS:
544 * NA
545 *
546 ***NOTE:
547 * NA
548 *
549 * @param pMac - Pointer to Global MAC structure
550 * @param pMsg of type tSirMsgQ - Pointer to the message structure
551 * @return None
552 */
553
554uint32_t lim_defer_msg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
555{
556 uint32_t retCode = TX_SUCCESS;
557
558 retCode = lim_write_deferred_msg_q(pMac, pMsg);
559
560 if (retCode == TX_SUCCESS) {
561 MTRACE(mac_trace_msg_rx
562 (pMac, NO_SESSION,
563 LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));
564 )
565 } else {
566 lim_log(pMac, LOGE, FL("Dropped lim message (0x%X)"),
567 pMsg->type);
568 MTRACE(mac_trace_msg_rx
569 (pMac, NO_SESSION,
570 LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));
571 )
572 }
573
574 return retCode;
575} /*** end lim_defer_msg() ***/
576
577/**
578 * lim_handle_unknown_a2_index_frames() - This function handles Unknown Unicast
579 * (A2 Index) packets
580 * @mac_ctx: Pointer to the Global Mac Context.
581 * @rx_pkt_buffer: Pointer to the packet Buffer descriptor.
582 * @session_entry: Pointer to the PE Session Entry.
583 *
584 * This routine will handle public action frames.
585 *
586 * Return: None.
587 */
588static void lim_handle_unknown_a2_index_frames(tpAniSirGlobal mac_ctx,
589 void *rx_pkt_buffer, tpPESession session_entry)
590{
591#ifdef FEATURE_WLAN_TDLS
592 tpSirMacDataHdr3a mac_hdr;
593#endif
594 if (LIM_IS_P2P_DEVICE_ROLE(session_entry))
595 lim_process_action_frame_no_session(mac_ctx,
596 (uint8_t *) rx_pkt_buffer);
597#ifdef FEATURE_WLAN_TDLS
598 mac_hdr = WMA_GET_RX_MPDUHEADER3A(rx_pkt_buffer);
599
600 if (lim_is_group_addr(mac_hdr->addr2)) {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530601 CDF_TRACE(QDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO_HIGH,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800602 FL("Ignoring A2 Invalid Packet received for MC/BC:"));
603 lim_print_mac_addr(mac_ctx, mac_hdr->addr2, LOG2);
604 return;
605 }
Anurag Chouhan6d760662016-02-20 16:05:43 +0530606 CDF_TRACE(QDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800607 FL("type=0x%x, subtype=0x%x"),
608 mac_hdr->fc.type, mac_hdr->fc.subType);
609 /* Currently only following type and subtype are handled.
610 * If there are more combinations, then add switch-case
611 * statements.
612 */
613 if (LIM_IS_STA_ROLE(session_entry) &&
614 (mac_hdr->fc.type == SIR_MAC_MGMT_FRAME) &&
615 (mac_hdr->fc.subType == SIR_MAC_MGMT_ACTION))
616 lim_process_action_frame(mac_ctx, rx_pkt_buffer, session_entry);
617#endif
618 return;
619}
620
621/**
622 * lim_check_mgmt_registered_frames() - This function handles registered
623 * management frames.
624 *
625 * @mac_ctx: Pointer to the Global Mac Context.
626 * @buff_desc: Pointer to the packet Buffer descriptor.
627 * @session_entry: Pointer to the PE Session Entry.
628 *
629 * This function is called to process to check if received frame match with
630 * any of the registered frame from HDD. If yes pass this frame to SME.
631 *
632 * Return: True or False for Match or Mismatch respectively.
633 */
634static bool
635lim_check_mgmt_registered_frames(tpAniSirGlobal mac_ctx, uint8_t *buff_desc,
636 tpPESession session_entry)
637{
638 tSirMacFrameCtl fc;
639 tpSirMacMgmtHdr hdr;
640 uint8_t *body;
641 struct mgmt_frm_reg_info *mgmt_frame = NULL;
642 struct mgmt_frm_reg_info *next_frm = NULL;
643 uint16_t frm_type;
644 uint16_t frm_len;
645 uint8_t type, sub_type;
646 bool match = false;
Anurag Chouhanffb21542016-02-17 14:33:03 +0530647 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800648
649 hdr = WMA_GET_RX_MAC_HEADER(buff_desc);
650 fc = hdr->fc;
651 frm_type = (fc.type << 2) | (fc.subType << 4);
652 body = WMA_GET_RX_MPDU_DATA(buff_desc);
653 frm_len = WMA_GET_RX_PAYLOAD_LEN(buff_desc);
654
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530655 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +0530656 qdf_list_peek_front(&mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
657 (qdf_list_node_t **) &mgmt_frame);
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530658 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800659
660 while (mgmt_frame != NULL) {
661 type = (mgmt_frame->frameType >> 2) & 0x03;
662 sub_type = (mgmt_frame->frameType >> 4) & 0x0f;
663 if ((type == SIR_MAC_MGMT_FRAME)
664 && (fc.type == SIR_MAC_MGMT_FRAME)
665 && (sub_type == SIR_MAC_MGMT_RESERVED15)) {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530666 CDF_TRACE(QDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO_HIGH,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800667 FL
668 ("rcvd frm match for SIR_MAC_MGMT_RESERVED15"));
669 match = true;
670 break;
671 }
672 if (mgmt_frame->frameType == frm_type) {
673 if (mgmt_frame->matchLen <= 0) {
674 match = true;
675 break;
676 }
677 if (mgmt_frame->matchLen <= frm_len &&
678 cdf_mem_compare(mgmt_frame->matchData, body,
679 mgmt_frame->matchLen)) {
680 /* found match! */
681 match = true;
682 break;
683 }
684 }
685
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530686 qdf_mutex_acquire(&mac_ctx->lim.lim_frame_register_lock);
Anurag Chouhanffb21542016-02-17 14:33:03 +0530687 qdf_status =
688 qdf_list_peek_next(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800689 &mac_ctx->lim.gLimMgmtFrameRegistratinQueue,
Anurag Chouhanffb21542016-02-17 14:33:03 +0530690 (qdf_list_node_t *) mgmt_frame,
691 (qdf_list_node_t **) &next_frm);
Anurag Chouhana37b5b72016-02-21 14:53:42 +0530692 qdf_mutex_release(&mac_ctx->lim.lim_frame_register_lock);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800693 mgmt_frame = next_frm;
694 next_frm = NULL;
695 }
696
697 if (match) {
Anurag Chouhan6d760662016-02-20 16:05:43 +0530698 CDF_TRACE(QDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800699 FL("rcvd frame match with registered frame params"));
700 /* Indicate this to SME */
701 lim_send_sme_mgmt_frame_ind(mac_ctx, hdr->fc.subType,
702 (uint8_t *) hdr,
703 WMA_GET_RX_PAYLOAD_LEN(buff_desc) +
704 sizeof(tSirMacMgmtHdr), mgmt_frame->sessionId,
705 WMA_GET_RX_CH(buff_desc), session_entry, 0);
706
707 if ((type == SIR_MAC_MGMT_FRAME)
708 && (fc.type == SIR_MAC_MGMT_FRAME)
709 && (sub_type == SIR_MAC_MGMT_RESERVED15))
710 /* These packets needs to be processed by PE/SME
711 * as well as HDD.If it returns true here,
712 * the packet is forwarded to HDD only.
713 */
714 match = false;
715 }
716
717 return match;
718}
719
720/**
721 * lim_handle80211_frames()
722 *
723 ***FUNCTION:
724 * This function is called to process 802.11 frames
725 * received by LIM.
726 *
727 ***LOGIC:
728 * NA
729 *
730 ***ASSUMPTIONS:
731 * NA
732 *
733 ***NOTE:
734 * NA
735 *
736 * @param pMac - Pointer to Global MAC structure
737 * @param pMsg of type tSirMsgQ - Pointer to the message structure
738 * @return None
739 */
740
741static void
742lim_handle80211_frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, uint8_t *pDeferMsg)
743{
744 uint8_t *pRxPacketInfo = NULL;
745 tSirMacFrameCtl fc;
746 tpSirMacMgmtHdr pHdr = NULL;
747 tpPESession psessionEntry = NULL;
748 uint8_t sessionId;
749 tAniBool isFrmFt = false;
750
751 *pDeferMsg = false;
752 lim_get_b_dfrom_rx_packet(pMac, limMsg->bodyptr,
Anurag Chouhanffb21542016-02-17 14:33:03 +0530753 (uint32_t **) &pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800754
755 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
756 isFrmFt = WMA_GET_RX_FT_DONE(pRxPacketInfo);
757 fc = pHdr->fc;
758
759#ifdef WLAN_DUMP_MGMTFRAMES
760 lim_log(pMac, LOGE,
761 FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
762 fc.protVer, fc.type, fc.subType,
763 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Anurag Chouhan6d760662016-02-20 16:05:43 +0530764 CDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, CDF_TRACE_LEVEL_ERROR, pHdr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800765 WMA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
766#endif
767 if (pMac->fEnableDebugLog & 0x1) {
768 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
769 (fc.subType != SIR_MAC_MGMT_PROBE_REQ) &&
770 (fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
771 (fc.subType != SIR_MAC_MGMT_BEACON)) {
772 lim_log(pMac, LOGE,
773 FL("RX MGMT - Type %hu, SubType %hu, seq num[%d]"),
774 fc.type,
775 fc.subType,
776 ((pHdr->seqControl.seqNumHi <<
777 HIGH_SEQ_NUM_OFFSET) |
778 pHdr->seqControl.seqNumLo));
779 }
780 }
781#ifdef FEATURE_WLAN_EXTSCAN
782 if (WMA_IS_EXTSCAN_SCAN_SRC(pRxPacketInfo) ||
783 WMA_IS_EPNO_SCAN_SRC(pRxPacketInfo)) {
784 if (fc.subType == SIR_MAC_MGMT_BEACON ||
785 fc.subType == SIR_MAC_MGMT_PROBE_RSP) {
786 __lim_process_ext_scan_beacon_probe_rsp(pMac,
787 pRxPacketInfo,
788 fc.subType);
789 } else {
790 lim_log(pMac, LOGE,
791 FL("Wrong frameType %d, Subtype %d for %d"),
792 fc.type, fc.subType,
793 WMA_GET_SCAN_SRC(pRxPacketInfo));
794 }
795 goto end;
796 }
797#endif
798 if (WMA_GET_OFFLOADSCANLEARN(pRxPacketInfo)) {
799 if (fc.subType == SIR_MAC_MGMT_BEACON) {
800 lim_log(pMac, LOG2, FL("Learning scan beacon"));
801 __lim_handle_beacon(pMac, limMsg, NULL);
802 } else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP) {
803 lim_log(pMac, LOG2, FL("Learning scan probe rsp"));
804 lim_process_probe_rsp_frame_no_session(pMac, pRxPacketInfo);
805 } else {
806 lim_log(pMac, LOGE,
807 FL("Wrong frame Type %d, Subtype %d for LFR"),
808 fc.type, fc.subType);
809 }
810 goto end;
811 }
812 /* Added For BT-AMP Support */
Anurag Chouhanffb21542016-02-17 14:33:03 +0530813 psessionEntry = pe_find_session_by_bssid(pMac, pHdr->bssId,
814 &sessionId);
815 if (psessionEntry == NULL) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800816#ifdef WLAN_FEATURE_VOWIFI_11R
817 if (fc.subType == SIR_MAC_MGMT_AUTH) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800818 lim_log(pMac, LOG1,
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700819 FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800820 fc.protVer, fc.type, fc.subType,
821 WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
822 lim_print_mac_addr(pMac, pHdr->bssId, LOG1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800823 if (lim_process_auth_frame_no_session
824 (pMac, pRxPacketInfo,
825 limMsg->bodyptr) == eSIR_SUCCESS) {
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700826 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800827 }
828 }
829#endif
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700830 /* Public action frame can be received from non-assoc stations*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800831 if ((fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
832 (fc.subType != SIR_MAC_MGMT_BEACON) &&
833 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700834 && (fc.subType != SIR_MAC_MGMT_ACTION)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800835
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700836 psessionEntry = pe_find_session_by_peer_sta(pMac,
837 pHdr->sa, &sessionId);
838 if (psessionEntry == NULL) {
839 lim_log(pMac, LOG3,
840 FL("session does not exist for bssId"));
841 lim_print_mac_addr(pMac, pHdr->sa, LOG3);
842 goto end;
843 } else {
844 lim_log(pMac, LOG3,
845 "SessionId:%d exists for given Bssid",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800846 psessionEntry->peSessionId);
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700847 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800848 }
849 /* For p2p resp frames search for valid session with DA as */
850 /* BSSID will be SA and session will be present with DA only */
851 if (fc.subType == SIR_MAC_MGMT_ACTION) {
852 psessionEntry =
853 pe_find_session_by_bssid(pMac, pHdr->da, &sessionId);
854 }
855 }
856
857 /* Check if frame is registered by HDD */
858 if (lim_check_mgmt_registered_frames(pMac, pRxPacketInfo, psessionEntry)) {
859 lim_log(pMac, LOG1, FL("Received frame is passed to SME"));
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700860 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800861 }
862
863 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION) { /* Received Frame with non-zero Protocol Version */
864 lim_log(pMac, LOGE,
865 FL("Unexpected frame with protVersion %d received"),
866 fc.protVer);
867 lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
868 (void *)limMsg->bodyptr);
869#ifdef WLAN_DEBUG
870 pMac->lim.numProtErr++;
871#endif
Vidyullatha Kanchanapally3554e4e2015-08-12 12:43:18 -0700872 goto end;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800873 }
874
875/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
876
877#ifdef WLAN_DEBUG
878 pMac->lim.numMAC[fc.type][fc.subType]++;
879#endif
880
881 switch (fc.type) {
882 case SIR_MAC_MGMT_FRAME:
883 {
884 /* Received Management frame */
885 switch (fc.subType) {
886 case SIR_MAC_MGMT_ASSOC_REQ:
887 /* Make sure the role supports Association */
888 if (LIM_IS_BT_AMP_AP_ROLE(psessionEntry) ||
889 LIM_IS_AP_ROLE(psessionEntry))
890 lim_process_assoc_req_frame(pMac,
891 pRxPacketInfo,
892 LIM_ASSOC,
893 psessionEntry);
894 else {
895 /* Unwanted messages - Log error */
896 lim_log(pMac, LOGE,
897 FL
898 ("unexpected message received %X"),
899 limMsg->type);
900 lim_print_msg_name(pMac, LOGE,
901 limMsg->type);
902 }
903 break;
904
905 case SIR_MAC_MGMT_ASSOC_RSP:
906 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
907 LIM_ASSOC,
908 psessionEntry);
909 break;
910
911 case SIR_MAC_MGMT_REASSOC_REQ:
912 /* Make sure the role supports Reassociation */
913 if (LIM_IS_BT_AMP_AP_ROLE(psessionEntry) ||
914 LIM_IS_AP_ROLE(psessionEntry)) {
915 lim_process_assoc_req_frame(pMac,
916 pRxPacketInfo,
917 LIM_REASSOC,
918 psessionEntry);
919 } else {
920 /* Unwanted messages - Log error */
921 lim_log(pMac, LOGE,
922 FL
923 ("unexpected message received %X"),
924 limMsg->type);
925 lim_print_msg_name(pMac, LOGE,
926 limMsg->type);
927 }
928 break;
929
930 case SIR_MAC_MGMT_REASSOC_RSP:
931 lim_process_assoc_rsp_frame(pMac, pRxPacketInfo,
932 LIM_REASSOC,
933 psessionEntry);
934 break;
935
936 case SIR_MAC_MGMT_PROBE_REQ:
937 lim_process_probe_req_frame_multiple_bss(pMac,
938 pRxPacketInfo,
939 psessionEntry);
940 break;
941
942 case SIR_MAC_MGMT_PROBE_RSP:
943 if (psessionEntry == NULL)
944 lim_process_probe_rsp_frame_no_session(pMac,
945 pRxPacketInfo);
946 else
947 lim_process_probe_rsp_frame(pMac,
948 pRxPacketInfo,
949 psessionEntry);
950 break;
951
952 case SIR_MAC_MGMT_BEACON:
953 __lim_handle_beacon(pMac, limMsg, psessionEntry);
954 break;
955
956 case SIR_MAC_MGMT_DISASSOC:
957 lim_process_disassoc_frame(pMac, pRxPacketInfo,
958 psessionEntry);
959 break;
960
961 case SIR_MAC_MGMT_AUTH:
962 lim_process_auth_frame(pMac, pRxPacketInfo,
963 psessionEntry);
964 break;
965
966 case SIR_MAC_MGMT_DEAUTH:
967 lim_process_deauth_frame(pMac, pRxPacketInfo,
968 psessionEntry);
969 break;
970
971 case SIR_MAC_MGMT_ACTION:
972 if (psessionEntry == NULL)
973 lim_process_action_frame_no_session(pMac,
974 pRxPacketInfo);
975 else {
976 if (WMA_GET_RX_UNKNOWN_UCAST
977 (pRxPacketInfo))
978 lim_handle_unknown_a2_index_frames
979 (pMac, pRxPacketInfo,
980 psessionEntry);
981 else
982 lim_process_action_frame(pMac,
983 pRxPacketInfo,
984 psessionEntry);
985 }
986 break;
987 default:
988 /* Received Management frame of 'reserved' subtype */
989 break;
990 } /* switch (fc.subType) */
991
992 }
993 break;
994 case SIR_MAC_DATA_FRAME:
995 {
996 }
997 break;
998 default:
999 /* Received frame of type 'reserved' */
1000 break;
1001
1002 } /* switch (fc.type) */
1003
1004end:
1005 lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo,
1006 (void *)limMsg->bodyptr);
1007 return;
1008} /*** end lim_handle80211_frames() ***/
1009
1010/**
1011 * lim_send_stop_scan_offload_req()
1012 *
1013 ***FUNCTION:
1014 * This function will be called to abort the ongoing offloaded scan
1015 * request.
1016 *
1017 *
1018 ***NOTE:
1019 *
1020 * @param pMac Pointer to Global MAC structure
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301021 * @return QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001022 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301023QDF_STATUS lim_send_stop_scan_offload_req(tpAniSirGlobal pMac,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001024 uint8_t SessionId, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001025{
1026 tSirMsgQ msg;
1027 tSirRetStatus rc = eSIR_SUCCESS;
1028 tAbortScanParams *pAbortScanParams;
1029
1030 pAbortScanParams = cdf_mem_malloc(sizeof(tAbortScanParams));
1031 if (NULL == pAbortScanParams) {
1032 lim_log(pMac, LOGP,
1033 FL("Memory allocation failed for AbortScanParams"));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301034 return QDF_STATUS_E_NOMEM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001035 }
1036
1037 pAbortScanParams->SessionId = SessionId;
1038 pAbortScanParams->scan_id = scan_id;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001039 pAbortScanParams->scan_requestor_id = scan_requestor_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001040 msg.type = WMA_STOP_SCAN_OFFLOAD_REQ;
1041 msg.bodyptr = pAbortScanParams;
1042 msg.bodyval = 0;
1043
1044 rc = wma_post_ctrl_msg(pMac, &msg);
1045 if (rc != eSIR_SUCCESS) {
1046 lim_log(pMac, LOGE, FL("wma_post_ctrl_msg() return failure"));
1047 cdf_mem_free(pAbortScanParams);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301048 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001049 }
1050
1051 lim_log(pMac, LOG1, FL("Abort ongoing offload scan."));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301052 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001053
1054}
1055
1056/**
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001057 * lim_process_abort_scan_ind() - abort the scan which is presently being run
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001058 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001059 * @mac_ctx: Pointer to Global MAC structure
1060 * @session_id: PE session
1061 * @scan_id: Scan ID from the scan request
1062 * @scan_requesor_id: Entity requesting the scan
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001063 *
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001064 * @return: None
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065 */
1066void lim_process_abort_scan_ind(tpAniSirGlobal mac_ctx,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001067 uint8_t session_id, uint32_t scan_id, uint32_t scan_requestor_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001068{
1069#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001070 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
1071 NULL, 0, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001072#endif
1073
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001074 lim_log(mac_ctx, LOG2, FL("scan_id %d, scan_requestor_id 0x%x"),
1075 scan_id, scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001076
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001077 /* send stop scan cmd to firmware */
1078 lim_send_stop_scan_offload_req(mac_ctx, session_id, scan_id,
1079 scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001080 return;
1081}
1082
1083/**
1084 * lim_message_processor() - Process messages from LIM.
1085 *
1086 * @mac_ctx: Pointer to the Global Mac Context.
1087 * @msg: Received LIM message.
1088 *
1089 * Wrapper function for lim_process_messages when handling messages received by
1090 * LIM.Could either defer messages or process them.
1091 *
1092 * Return: None.
1093 */
1094void lim_message_processor(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1095{
1096 if (eLIM_MLM_OFFLINE_STATE == mac_ctx->lim.gLimMlmState) {
1097 pe_free_msg(mac_ctx, msg);
1098 return;
1099 }
1100
1101 if (!def_msg_decision(mac_ctx, msg)) {
1102 lim_process_messages(mac_ctx, msg);
1103 /* process deferred message queue if allowed */
1104 if ((!(mac_ctx->lim.gLimAddtsSent)) &&
1105 (!(lim_is_system_in_scan_state(mac_ctx))) &&
1106 (true == GET_LIM_PROCESS_DEFD_MESGS(mac_ctx)))
1107 lim_process_deferred_message_queue(mac_ctx);
1108 }
1109}
1110
1111#ifdef FEATURE_OEM_DATA_SUPPORT
1112
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301113void lim_oem_data_rsp_handle_resume_link_rsp(tpAniSirGlobal pMac, QDF_STATUS status,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001114 uint32_t *mlmOemDataRsp)
1115{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301116 if (status != QDF_STATUS_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001117 lim_log(pMac, LOGE,
1118 FL
1119 ("OEM Data Rsp failed to get the response for resume link"));
1120 }
1121
1122 if (NULL != pMac->lim.gpLimMlmOemDataReq) {
1123 cdf_mem_free(pMac->lim.gpLimMlmOemDataReq);
1124 pMac->lim.gpLimMlmOemDataReq = NULL;
1125 }
1126 /* "Failure" status doesn't mean that Oem Data Rsp did not happen */
1127 /* and hence we need to respond to upper layers. Only Resume link is failed, but */
1128 /* we got the oem data response already. */
1129 /* Post the meessage to MLM */
1130 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1131 (uint32_t *) (mlmOemDataRsp));
1132
1133 return;
1134}
1135
1136void lim_process_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *body)
1137{
1138 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1139
1140 /* Process all the messages for the lim queue */
1141 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1142
1143 mlmOemDataRsp = (tpLimMlmOemDataRsp) body;
1144
1145 PELOG1(lim_log
1146 (pMac, LOG1, FL("%s: sending oem data response msg to sme"),
1147 __func__);
1148 )
1149 lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF,
1150 (uint32_t *) (mlmOemDataRsp));
1151
1152 return;
1153}
1154
1155#endif
1156
1157/**
1158 * lim_process_messages() - Process messages from upper layers.
1159 *
1160 * @mac_ctx: Pointer to the Global Mac Context.
1161 * @msg: Received message.
1162 *
1163 * Return: None.
1164 */
1165void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
1166{
1167#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1168 uint8_t vdev_id = 0;
1169 tUpdateBeaconParams beacon_params;
1170#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1171 uint8_t i;
1172 uint8_t p2p_go_exists = 0;
1173 tpPESession session_entry = NULL;
1174 uint8_t defer_msg = false;
1175 tLinkStateParams *link_state_param;
1176 uint16_t pkt_len = 0;
1177 cds_pkt_t *body_ptr = NULL;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301178 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001179 tSirMsgQ new_msg;
1180 tSirSmeScanAbortReq *req_msg = NULL;
1181 uint8_t session_id;
1182 uint32_t scan_id;
1183
1184#ifdef FEATURE_WLAN_TDLS
1185 tSirTdlsInd *tdls_ind = NULL;
1186 tpDphHashNode sta_ds = NULL;
1187 tTdlsLinkEstablishParams *tdls_link_params = NULL;
1188#endif
1189 tSirMbMsgP2p *p2p_msg = NULL;
1190 if (ANI_DRIVER_TYPE(mac_ctx) == eDRIVER_TYPE_MFG) {
1191 cdf_mem_free(msg->bodyptr);
1192 msg->bodyptr = NULL;
1193 return;
1194 }
1195 if (msg == NULL) {
1196 lim_log(mac_ctx, LOGE, FL("Message pointer is Null"));
1197 CDF_ASSERT(0);
1198 return;
1199 }
1200#ifdef WLAN_DEBUG
1201 mac_ctx->lim.numTot++;
1202#endif
1203 MTRACE(mac_trace_msg_rx(mac_ctx, NO_SESSION,
1204 LIM_TRACE_MAKE_RXMSG(msg->type, LIM_MSG_PROCESSED));)
1205
1206 switch (msg->type) {
1207
1208 case SIR_LIM_UPDATE_BEACON:
1209 lim_update_beacon(mac_ctx);
1210 break;
1211 case SIR_CFG_PARAM_UPDATE_IND:
1212 if (!lim_is_system_in_scan_state(mac_ctx)) {
1213 lim_handle_cf_gparam_update(mac_ctx, msg->bodyval);
1214 break;
1215 }
1216 /* System is in DFS (Learn) mode.
1217 * Defer processsing this message
1218 */
1219 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
1220 if (!(mac_ctx->lim.deferredMsgCnt & 0xF))
Anurag Chouhan6d760662016-02-20 16:05:43 +05301221 CDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001222 FL("Unable to Defer Msg"));
1223 lim_log_session_states(mac_ctx);
1224 lim_print_msg_name(mac_ctx, LOGE, msg->type);
1225 }
1226 break;
1227#ifdef FEATURE_OEM_DATA_SUPPORT
1228 case WMA_START_OEM_DATA_RSP:
1229 lim_process_oem_data_rsp(mac_ctx, msg->bodyptr);
1230 msg->bodyptr = NULL;
1231 break;
1232#endif
1233 case WMA_SWITCH_CHANNEL_RSP:
1234 lim_process_switch_channel_rsp(mac_ctx, msg->bodyptr);
1235 msg->bodyptr = NULL;
1236 break;
1237#ifdef ANI_SIR_IBSS_PEER_CACHING
1238 case WMA_IBSS_STA_ADD:
1239 lim_ibss_sta_add(mac_ctx, msg->bodyptr);
1240 break;
1241#endif
1242 case SIR_BB_XPORT_MGMT_MSG:
1243 /* These messages are from Peer MAC entity. */
1244#ifdef WLAN_DEBUG
1245 mac_ctx->lim.numBbt++;
1246#endif
1247 /* The original msg which we were deferring have the
1248 * bodyPointer point to 'BD' instead of 'cds pkt'. If we
1249 * don't make a copy of msg, then overwrite the
1250 * msg->bodyPointer and next time when we try to
1251 * process the msg, we will try to use 'BD' as
1252 * 'cds Pkt' which will cause a crash
1253 */
1254 if (msg->bodyptr == NULL) {
1255 lim_log(mac_ctx, LOGE, FL("Message bodyptr is Null"));
1256 CDF_ASSERT(0);
1257 break;
1258 }
1259 cdf_mem_copy((uint8_t *) &new_msg,
1260 (uint8_t *) msg, sizeof(tSirMsgQ));
1261 body_ptr = (cds_pkt_t *) new_msg.bodyptr;
1262 cds_pkt_get_packet_length(body_ptr, &pkt_len);
1263
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301264 qdf_status = wma_ds_peek_rx_packet_info(body_ptr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001265 (void **) &new_msg.bodyptr, false);
1266
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301267 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001268 cds_pkt_return_packet(body_ptr);
1269 break;
1270 }
1271
Anurag Chouhanffb21542016-02-17 14:33:03 +05301272 if (WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr))
1273 lim_log(mac_ctx, LOG1, FL("roamCandidateInd %d"),
1274 WMA_GET_ROAMCANDIDATEIND(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001275
Anurag Chouhanffb21542016-02-17 14:33:03 +05301276 if (WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr))
1277 lim_log(mac_ctx, LOG1, FL("offloadScanLearn %d"),
1278 WMA_GET_OFFLOADSCANLEARN(new_msg.bodyptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001279
1280 lim_handle80211_frames(mac_ctx, &new_msg, &defer_msg);
1281
1282 if (defer_msg == true) {
Anurag Chouhan6d760662016-02-20 16:05:43 +05301283 CDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001284 FL("Defer Msg type=%x"), msg->type);
1285 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
Anurag Chouhan6d760662016-02-20 16:05:43 +05301286 CDF_TRACE(QDF_MODULE_ID_PE, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001287 FL("Unable to Defer Msg"));
1288 lim_log_session_states(mac_ctx);
1289 cds_pkt_return_packet(body_ptr);
1290 }
1291 } else
1292 /* PE is not deferring this 802.11 frame so we need to
1293 * call cds_pkt_return. Asumption here is when Rx mgmt
1294 * frame processing is done, cds packet could be
1295 * freed here.
1296 */
1297 cds_pkt_return_packet(body_ptr);
1298 break;
1299 case eWNI_SME_SCAN_REQ:
1300 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
1301 case eWNI_SME_DISASSOC_REQ:
1302 case eWNI_SME_DEAUTH_REQ:
1303#ifdef FEATURE_OEM_DATA_SUPPORT
1304 case eWNI_SME_OEM_DATA_REQ:
1305#endif
1306#ifdef FEATURE_WLAN_TDLS
1307 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1308 case eWNI_SME_TDLS_ADD_STA_REQ:
1309 case eWNI_SME_TDLS_DEL_STA_REQ:
1310 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
1311#endif
1312 case eWNI_SME_RESET_AP_CAPS_CHANGED:
1313 case eWNI_SME_SET_HW_MODE_REQ:
1314 case eWNI_SME_SET_DUAL_MAC_CFG_REQ:
1315 /* These messages are from HDD. Need to respond to HDD */
1316 lim_process_normal_hdd_msg(mac_ctx, msg, true);
1317 break;
1318
1319 case eWNI_SME_SCAN_ABORT_IND:
1320 req_msg = msg->bodyptr;
1321 if (req_msg) {
1322 session_id = req_msg->sessionId;
1323 scan_id = req_msg->scan_id;
1324 lim_process_abort_scan_ind(mac_ctx, session_id,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001325 scan_id, USER_SCAN_REQUESTOR_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001326 cdf_mem_free((void *)msg->bodyptr);
1327 msg->bodyptr = NULL;
1328 }
1329 break;
1330 case eWNI_SME_SYS_READY_IND:
1331 case eWNI_SME_JOIN_REQ:
1332 case eWNI_SME_REASSOC_REQ:
1333 case eWNI_SME_START_BSS_REQ:
1334 case eWNI_SME_STOP_BSS_REQ:
1335 case eWNI_SME_SWITCH_CHL_IND:
1336 case eWNI_SME_SETCONTEXT_REQ:
1337 case eWNI_SME_DISASSOC_CNF:
1338 case eWNI_SME_DEAUTH_CNF:
1339 case eWNI_SME_ASSOC_CNF:
1340 case eWNI_SME_ADDTS_REQ:
1341 case eWNI_SME_DELTS_REQ:
1342 case eWNI_SME_GET_ASSOC_STAS_REQ:
1343 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1344 case eWNI_SME_UPDATE_APWPSIE_REQ:
1345 case eWNI_SME_HIDE_SSID_REQ:
1346 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1347 case eWNI_SME_SET_APWPARSNIEs_REQ:
1348 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
1349#if defined WLAN_FEATURE_VOWIFI
1350 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1351 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1352#endif
1353#if defined FEATURE_WLAN_ESE
1354 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
1355#endif
1356#ifdef WLAN_FEATURE_VOWIFI_11R
1357 case eWNI_SME_FT_UPDATE_KEY:
1358 case eWNI_SME_FT_PRE_AUTH_REQ:
1359 case eWNI_SME_FT_AGGR_QOS_REQ:
1360#endif
1361 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1362 case eWNI_SME_UPDATE_NOA:
1363 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
1364 case eWNI_SME_GET_STATISTICS_REQ:
1365#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
1366 case eWNI_SME_GET_TSM_STATS_REQ:
1367#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Abhishek Singh7996eb72015-12-30 17:24:02 +05301368 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
Abhishek Singh518323d2015-10-19 17:42:01 +05301369 case eWNI_SME_EXT_CHANGE_CHANNEL:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370 /* These messages are from HDD.No need to respond to HDD */
1371 lim_process_normal_hdd_msg(mac_ctx, msg, false);
1372 break;
1373
1374 case eWNI_PMC_SMPS_STATE_IND:
1375 if (msg->bodyptr) {
1376 cdf_mem_free(msg->bodyptr);
1377 msg->bodyptr = NULL;
1378 }
1379 break;
1380 case eWNI_SME_SEND_ACTION_FRAME_IND:
1381 lim_send_p2p_action_frame(mac_ctx, msg);
1382 cdf_mem_free(msg->bodyptr);
1383 msg->bodyptr = NULL;
1384 break;
1385 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1386 p2p_msg = (tSirMbMsgP2p *) msg->bodyptr;
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -07001387 lim_process_abort_scan_ind(mac_ctx, p2p_msg->sessionId,
1388 p2p_msg->scan_id, ROC_SCAN_REQUESTOR_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001389 cdf_mem_free(msg->bodyptr);
1390 msg->bodyptr = NULL;
1391 break;
1392 case SIR_HAL_P2P_NOA_START_IND:
1393 session_entry = &mac_ctx->lim.gpSession[0];
1394 lim_log(mac_ctx, LOG1, "LIM received NOA start %x", msg->type);
1395
1396 /* Since insert NOA is done and NOA start msg received,
1397 * we should deactivate the Insert NOA timer
1398 */
1399 lim_deactivate_and_change_timer(mac_ctx,
1400 eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1401
1402 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1403 session_entry = &mac_ctx->lim.gpSession[i];
1404 if ((session_entry != NULL) && (session_entry->valid) &&
Anurag Chouhan6d760662016-02-20 16:05:43 +05301405 (session_entry->pePersona == QDF_P2P_GO_MODE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001406 /* Save P2P NOA start attribute for Go persona*/
1407 p2p_go_exists = 1;
1408 cdf_mem_copy(&session_entry->p2pGoPsNoaStartInd,
1409 msg->bodyptr, sizeof(tSirP2PNoaStart));
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301410 qdf_status =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001411 session_entry->p2pGoPsNoaStartInd.status;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301412 if (qdf_status != QDF_STATUS_SUCCESS)
Anurag Chouhan6d760662016-02-20 16:05:43 +05301413 CDF_TRACE(QDF_MODULE_ID_PE, LOGW,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001414 FL(
1415 "GO NOA start status %d by FW"),
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301416 qdf_status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001417 break;
1418 }
1419 }
1420
1421 if (p2p_go_exists == 0)
Anurag Chouhan6d760662016-02-20 16:05:43 +05301422 CDF_TRACE(QDF_MODULE_ID_PE, LOGW,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001423 FL(
1424 "GO is removed by the time NOA start recvd"));
1425
1426 /* We received the NOA start indication. Now we can send down
1427 * the SME request which requires off-channel operation */
1428 lim_process_regd_defd_sme_req_after_noa_start(mac_ctx);
1429 cdf_mem_free(msg->bodyptr);
1430 msg->bodyptr = NULL;
1431 break;
1432#ifdef FEATURE_WLAN_TDLS
1433 case SIR_HAL_TDLS_IND:
1434 tdls_ind = (tpSirTdlsInd) msg->bodyptr;
1435 session_entry = pe_find_session_by_sta_id(mac_ctx,
1436 tdls_ind->staIdx, &session_id);
1437 if (session_entry == NULL) {
1438 lim_log(mac_ctx, LOG1,
1439 FL("No session exist for given bssId"));
1440 cdf_mem_free(msg->bodyptr);
1441 msg->bodyptr = NULL;
1442 return;
1443 }
1444 sta_ds = dph_get_hash_entry(mac_ctx, tdls_ind->assocId,
1445 &session_entry->dph.dphHashTable);
1446 if (sta_ds == NULL) {
1447 lim_log(mac_ctx, LOG1,
1448 FL("No sta_ds exist for given staId"));
1449 cdf_mem_free(msg->bodyptr);
1450 msg->bodyptr = NULL;
1451 return;
1452 }
1453
1454 if (STA_ENTRY_TDLS_PEER == sta_ds->staType) {
1455 lim_log(mac_ctx, LOGE,
1456 FL("rcvd TDLS IND from FW with RC %d "),
1457 tdls_ind->reasonCode);
1458 lim_send_sme_tdls_del_sta_ind(mac_ctx, sta_ds,
1459 session_entry, tdls_ind->reasonCode);
1460 }
1461 cdf_mem_free(msg->bodyptr);
1462 msg->bodyptr = NULL;
1463 break;
1464#endif
1465 case SIR_HAL_P2P_NOA_ATTR_IND:
1466 session_entry = &mac_ctx->lim.gpSession[0];
1467 lim_log(mac_ctx, LOG1, FL("Received message Noa_ATTR %x"),
1468 msg->type);
1469 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1470 session_entry = &mac_ctx->lim.gpSession[i];
1471 if ((session_entry != NULL) && (session_entry->valid)
1472 && (session_entry->pePersona ==
Anurag Chouhan6d760662016-02-20 16:05:43 +05301473 QDF_P2P_GO_MODE)) { /* Save P2P attr for Go */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001474 cdf_mem_copy(
1475 &session_entry->p2pGoPsUpdate,
1476 msg->bodyptr,
1477 sizeof(tSirP2PNoaAttr));
1478 lim_log(mac_ctx, LOG2,
1479 FL("bssId"
1480 MAC_ADDRESS_STR
1481 " ctWin=%d oppPsFlag=%d"),
1482 MAC_ADDR_ARRAY(
1483 session_entry->bssId),
1484 session_entry->p2pGoPsUpdate.ctWin,
1485 session_entry->p2pGoPsUpdate.oppPsFlag);
1486 lim_log(mac_ctx, LOG2,
1487 FL
1488 (" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
1489 session_entry->p2pGoPsUpdate.uNoa1IntervalCnt,
1490 session_entry->p2pGoPsUpdate.uNoa1Duration,
1491 session_entry->p2pGoPsUpdate.uNoa1Interval,
1492 session_entry->p2pGoPsUpdate.uNoa1StartTime);
1493 break;
1494 }
1495 }
1496 cdf_mem_free(msg->bodyptr);
1497 msg->bodyptr = NULL;
1498 break;
1499 case WMA_MISSED_BEACON_IND:
1500 lim_ps_offload_handle_missed_beacon_ind(mac_ctx, msg);
1501 cdf_mem_free(msg->bodyptr);
1502 msg->bodyptr = NULL;
1503 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001504 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1505 lim_process_sme_req_messages(mac_ctx, msg);
1506 break;
1507#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001508 case WMA_TSM_STATS_RSP:
1509#ifdef FEATURE_WLAN_ESE_UPLOAD
1510 lim_send_sme_pe_ese_tsm_rsp(mac_ctx,
1511 (tAniGetTsmStatsRsp *) msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001512#endif /* FEATURE_WLAN_ESE_UPLOAD */
1513 break;
1514#endif
1515 case WMA_ADD_TS_RSP:
1516 lim_process_hal_add_ts_rsp(mac_ctx, msg);
1517 break;
1518 case SIR_LIM_DEL_TS_IND:
1519 lim_process_del_ts_ind(mac_ctx, msg);
1520 break;
1521 case SIR_LIM_BEACON_GEN_IND:
1522 if (mac_ctx->lim.gLimSystemRole != eLIM_AP_ROLE)
1523 sch_process_pre_beacon_ind(mac_ctx, msg);
1524 break;
1525 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1526 lim_delete_sta_context(mac_ctx, msg);
1527 break;
1528 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1529 case SIR_LIM_JOIN_FAIL_TIMEOUT:
1530 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
1531 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1532 case SIR_LIM_AUTH_RSP_TIMEOUT:
1533 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1534 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1535#ifdef WLAN_FEATURE_VOWIFI_11R
1536 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1537#endif
1538 case SIR_LIM_REMAIN_CHN_TIMEOUT:
1539 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
1540 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1541 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
1542 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
1543 /* These timeout messages are handled by MLM sub module */
1544 lim_process_mlm_req_messages(mac_ctx, msg);
1545 break;
1546 case SIR_LIM_HEART_BEAT_TIMEOUT:
1547 /** check if heart beat failed, even if one Beacon
1548 * is rcvd within the Heart Beat interval continue
1549 * normal processing
1550 */
1551 if (NULL == msg->bodyptr)
1552 lim_log(mac_ctx, LOGE,
1553 FL("Can't Process HB TO - bodyptr is Null"));
1554 else {
1555 session_entry = (tpPESession) msg->bodyptr;
1556 lim_log(mac_ctx, LOGE,
1557 FL
1558 ("SIR_LIM_HEART_BEAT_TIMEOUT, Session %d"),
1559 ((tpPESession) msg->bodyptr)->peSessionId);
1560 limResetHBPktCount(session_entry);
1561 lim_handle_heart_beat_timeout_for_session(mac_ctx,
1562 session_entry);
1563 }
1564 break;
1565 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1566 lim_handle_heart_beat_failure_timeout(mac_ctx);
1567 break;
1568 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1569 mac_ctx->lim.gLimDisassocFrameCredit = 0;
1570 break;
1571 case SIR_LIM_CNF_WAIT_TIMEOUT:
1572 /* Does not receive CNF or dummy packet */
1573 lim_handle_cnf_wait_timeout(mac_ctx, (uint16_t) msg->bodyval);
1574 break;
1575 case SIR_LIM_RETRY_INTERRUPT_MSG:
1576 /* Message from ISR upon TFP's max retry limit interrupt */
1577 break;
1578 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1579 /* Message from ISR upon SP's Invalid session key interrupt */
1580 break;
1581 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1582 /* Message from ISR upon SP's Invalid key ID interrupt */
1583 break;
1584 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1585 /* Message from ISR upon SP's Replay threshold interrupt */
1586 break;
1587 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1588 lim_process_channel_switch_timeout(mac_ctx);
1589 break;
1590 case SIR_LIM_QUIET_TIMEOUT:
1591 lim_process_quiet_timeout(mac_ctx);
1592 break;
1593 case SIR_LIM_QUIET_BSS_TIMEOUT:
1594 lim_process_quiet_bss_timeout(mac_ctx);
1595 break;
1596 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1597 lim_handle_update_olbc_cache(mac_ctx);
1598 break;
1599#ifdef FEATURE_WLAN_TDLS
1600 case SIR_HAL_TDLS_SHOULD_DISCOVER:
1601 case SIR_HAL_TDLS_SHOULD_TEARDOWN:
1602 case SIR_HAL_TDLS_PEER_DISCONNECTED:
Anurag Chouhan6d760662016-02-20 16:05:43 +05301603 CDF_TRACE(QDF_MODULE_ID_PE, CDF_TRACE_LEVEL_INFO,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001604 ("%s received tdls event: 0x%x"), __func__, msg->type);
1605 lim_send_sme_tdls_event_notify(mac_ctx, msg->type,
1606 (void *)msg->bodyptr);
1607 break;
1608#endif
1609 case WMA_ADD_BSS_RSP:
1610 lim_process_mlm_add_bss_rsp(mac_ctx, msg);
1611 break;
1612 case WMA_ADD_STA_RSP:
1613 lim_process_add_sta_rsp(mac_ctx, msg);
1614 break;
1615 case WMA_DELETE_STA_RSP:
1616 lim_process_mlm_del_sta_rsp(mac_ctx, msg);
1617 break;
1618 case WMA_DELETE_BSS_RSP:
1619 lim_handle_delete_bss_rsp(mac_ctx, msg);
1620 break;
1621 case WMA_CSA_OFFLOAD_EVENT:
1622 lim_handle_csa_offload_msg(mac_ctx, msg);
1623 break;
1624 case WMA_SET_BSSKEY_RSP:
1625 case WMA_SET_STA_BCASTKEY_RSP:
1626 lim_process_mlm_set_bss_key_rsp(mac_ctx, msg);
1627 break;
1628 case WMA_SET_STAKEY_RSP:
1629 lim_process_mlm_set_sta_key_rsp(mac_ctx, msg);
1630 break;
1631 case WMA_GET_STATISTICS_RSP:
1632 lim_send_sme_pe_statistics_rsp(mac_ctx, msg->type,
1633 (void *)msg->bodyptr);
1634 break;
1635 case WMA_SET_MIMOPS_RSP:
1636 case WMA_SET_TX_POWER_RSP:
1637 cdf_mem_free((void *)msg->bodyptr);
1638 msg->bodyptr = NULL;
1639 break;
1640 case WMA_SET_MAX_TX_POWER_RSP:
1641#if defined WLAN_FEATURE_VOWIFI
1642 rrm_set_max_tx_power_rsp(mac_ctx, msg);
1643#endif
1644 if (msg->bodyptr != NULL) {
1645 cdf_mem_free((void *)msg->bodyptr);
1646 msg->bodyptr = NULL;
1647 }
1648 break;
1649 case SIR_LIM_ADDR2_MISS_IND:
1650 lim_log(mac_ctx, LOGE,
1651 FL("Addr2 mismatch interrupt received %X"), msg->type);
1652 /* message from HAL indicating addr2 mismatch interrupt occurred
1653 * msg->bodyptr contains only pointer to 48-bit addr2 field
1654 */
1655 cdf_mem_free((void *)(msg->bodyptr));
1656 msg->bodyptr = NULL;
1657 break;
1658#ifdef WLAN_FEATURE_VOWIFI_11R
1659 case WMA_AGGR_QOS_RSP:
1660 lim_process_ft_aggr_qo_s_rsp(mac_ctx, msg);
1661 break;
1662#endif
1663 case WMA_SET_LINK_STATE_RSP:
1664 link_state_param = (tLinkStateParams *) msg->bodyptr;
1665#if defined WLAN_FEATURE_VOWIFI_11R
1666 session_entry = link_state_param->session;
1667 if (link_state_param->ft
1668#if defined WLAN_FEATURE_ROAM_OFFLOAD
1669 && !session_entry->bRoamSynchInProgress
1670#endif
1671 )
1672 lim_send_reassoc_req_with_ft_ies_mgmt_frame(mac_ctx,
1673 session_entry->pLimMlmReassocReq,
1674 session_entry);
1675#endif
1676 if (link_state_param->callback)
1677 link_state_param->callback(mac_ctx,
1678 link_state_param->callbackArg,
1679 link_state_param->status);
1680 cdf_mem_free((void *)(msg->bodyptr));
1681 msg->bodyptr = NULL;
1682 break;
1683 case eWNI_SME_SET_BCN_FILTER_REQ:
1684 session_id = (uint8_t) msg->bodyval;
1685 session_entry = &mac_ctx->lim.gpSession[session_id];
1686 if ((session_entry != NULL) &&
1687 (lim_send_beacon_filter_info(mac_ctx, session_entry) !=
1688 eSIR_SUCCESS))
1689 lim_log(mac_ctx, LOGE,
1690 FL("Failied to send Beacon Filter Info "));
1691 cdf_mem_free((void *)(msg->bodyptr));
1692 msg->bodyptr = NULL;
1693 break;
1694#ifdef FEATURE_WLAN_TDLS
1695 case WMA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
1696 tdls_link_params = (tTdlsLinkEstablishParams *) msg->bodyptr;
1697 session_entry = pe_find_session_by_sta_id(mac_ctx,
1698 tdls_link_params->staIdx, &session_id);
1699 if (session_entry == NULL) {
1700 lim_log(mac_ctx, LOGE,
1701 FL("session %u does not exist"), session_id);
1702 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP
1703 * message to SME with session id as zero and status
1704 * as FAILURE so, that message queued in SME queue
1705 * can be freed to prevent the SME cmd buffer leak
1706 */
1707 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx, 0,
1708 NULL, NULL, eSIR_FAILURE);
1709 } else {
1710 lim_send_sme_tdls_link_establish_req_rsp(mac_ctx,
1711 session_entry->smeSessionId, NULL, NULL,
1712 tdls_link_params->status);
1713 }
1714 cdf_mem_free((void *)(msg->bodyptr));
1715 msg->bodyptr = NULL;
1716 break;
1717#endif
1718 case WMA_RX_SCAN_EVENT:
1719 lim_process_rx_scan_event(mac_ctx, msg->bodyptr);
1720 break;
1721 case WMA_IBSS_PEER_INACTIVITY_IND:
1722 lim_process_ibss_peer_inactivity(mac_ctx, msg->bodyptr);
1723 cdf_mem_free((void *)(msg->bodyptr));
1724 msg->bodyptr = NULL;
1725 break;
1726 case WMA_DFS_RADAR_IND:
1727 lim_send_sme_dfs_event_notify(mac_ctx, msg->type,
1728 (void *)msg->bodyptr);
1729 /* msg->bodyptr will be freed up by SME/CSR */
1730 break;
1731 case WMA_DFS_BEACON_TX_SUCCESS_IND:
1732 lim_process_beacon_tx_success_ind(mac_ctx, msg->type,
1733 (void *)msg->bodyptr);
1734 cdf_mem_free((void *)msg->bodyptr);
1735 msg->bodyptr = NULL;
1736 break;
1737 case WMA_DISASSOC_TX_COMP:
1738 lim_disassoc_tx_complete_cnf(mac_ctx, msg->bodyval);
1739 break;
1740 case WMA_DEAUTH_TX_COMP:
1741 lim_deauth_tx_complete_cnf(mac_ctx, msg->bodyval);
1742 break;
1743#ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1744 case WMA_UPDATE_Q2Q_IE_IND:
1745 cdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams));
1746 beacon_params.paramChangeBitmap = 0;
1747 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
1748 vdev_id = ((uint8_t *)msg->bodyptr)[i];
1749 session_entry = pe_find_session_by_sme_session_id(
1750 mac_ctx, vdev_id);
1751 if (session_entry == NULL)
1752 continue;
1753 session_entry->sap_advertise_avoid_ch_ie =
1754 (uint8_t)msg->bodyval;
1755 /*
1756 * if message comes for DFS channel, no need to update:
1757 * 1) We wont have MCC with DFS channels. so no need to
1758 * add Q2Q IE
1759 * 2) We cannot end up in DFS channel SCC by channel
1760 * switch from non DFS MCC scenario, so no need to
1761 * remove Q2Q IE
1762 * 3) There is however a case where device start MCC and
1763 * then user modifies hostapd.conf and does SAP
1764 * restart, in such a case, beacon params will be
1765 * reset and thus will not contain Q2Q IE, by default
1766 */
1767 if (cds_get_channel_state(
1768 session_entry->currentOperChannel)
1769 != CHANNEL_STATE_DFS) {
1770 beacon_params.bssIdx = session_entry->bssIdx;
1771 beacon_params.beaconInterval =
1772 session_entry->beaconParams.beaconInterval;
1773 beacon_params.paramChangeBitmap |=
1774 PARAM_BCN_INTERVAL_CHANGED;
1775 sch_set_fixed_beacon_fields(mac_ctx,
1776 session_entry);
1777 lim_send_beacon_params(mac_ctx, &beacon_params,
1778 session_entry);
1779 }
1780 }
1781 cdf_mem_free(msg->bodyptr);
1782 msg->bodyptr = NULL;
1783 break;
1784#endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1785 case eWNI_SME_NSS_UPDATE_REQ:
1786 case eWNI_SME_DFS_BEACON_CHAN_SW_IE_REQ:
1787 lim_process_sme_req_messages(mac_ctx, msg);
1788 cdf_mem_free((void *)msg->bodyptr);
1789 msg->bodyptr = NULL;
1790 break;
1791 case eWNI_SME_CHANNEL_CHANGE_REQ:
1792 lim_process_sme_req_messages(mac_ctx, msg);
1793 cdf_mem_free((void *)msg->bodyptr);
1794 msg->bodyptr = NULL;
1795 break;
1796 case eWNI_SME_START_BEACON_REQ:
1797 lim_process_sme_req_messages(mac_ctx, msg);
1798 cdf_mem_free((void *)msg->bodyptr);
1799 msg->bodyptr = NULL;
1800 break;
1801 case eWNI_SME_UPDATE_ADDITIONAL_IES:
1802 lim_process_sme_req_messages(mac_ctx, msg);
1803 cdf_mem_free((void *)msg->bodyptr);
1804 msg->bodyptr = NULL;
1805 break;
1806 case eWNI_SME_MODIFY_ADDITIONAL_IES:
1807 lim_process_sme_req_messages(mac_ctx, msg);
1808 cdf_mem_free((void *)msg->bodyptr);
1809 msg->bodyptr = NULL;
1810 break;
1811#ifdef QCA_HT_2040_COEX
1812 case eWNI_SME_SET_HT_2040_MODE:
1813 lim_process_sme_req_messages(mac_ctx, msg);
1814 cdf_mem_free((void *)msg->bodyptr);
1815 msg->bodyptr = NULL;
1816 break;
1817#endif
1818 case SIR_HAL_SOC_SET_HW_MODE_RESP:
1819 lim_process_set_hw_mode_resp(mac_ctx, msg->bodyptr);
1820 cdf_mem_free((void *)msg->bodyptr);
1821 msg->bodyptr = NULL;
1822 break;
1823 case SIR_HAL_SOC_HW_MODE_TRANS_IND:
1824 lim_process_hw_mode_trans_ind(mac_ctx, msg->bodyptr);
1825 cdf_mem_free((void *)msg->bodyptr);
1826 msg->bodyptr = NULL;
1827 break;
1828 case SIR_HAL_SOC_DUAL_MAC_CFG_RESP:
1829 lim_process_dual_mac_cfg_resp(mac_ctx, msg->bodyptr);
1830 cdf_mem_free((void *)msg->bodyptr);
1831 msg->bodyptr = NULL;
1832 break;
1833 case eWNI_SME_SET_IE_REQ:
1834 lim_process_sme_req_messages(mac_ctx, msg);
1835 cdf_mem_free((void *)msg->bodyptr);
1836 msg->bodyptr = NULL;
1837 break;
1838 default:
1839 cdf_mem_free((void *)msg->bodyptr);
1840 msg->bodyptr = NULL;
1841 /* Unwanted messages */
1842 /* Log error */
1843 lim_log(mac_ctx, LOGE,
1844 FL("Discarding unexpected message received %X"),
1845 msg->type);
1846 lim_print_msg_name(mac_ctx, LOGE, msg->type);
1847 break;
1848
1849 } /* switch (msg->type) */
1850} /*** end lim_process_messages() ***/
1851
1852/**
1853 * lim_process_deferred_message_queue
1854 *
1855 ***FUNCTION:
1856 * This function is called by LIM while exiting from Learn
1857 * mode. This function fetches messages posted to the LIM
1858 * deferred message queue limDeferredMsgQ.
1859 *
1860 ***LOGIC:
1861 *
1862 ***ASSUMPTIONS:
1863 * NA
1864 *
1865 ***NOTE:
1866 * NA
1867 *
1868 * @param pMac - Pointer to Global MAC structure
1869 * @return None
1870 */
1871
1872void lim_process_deferred_message_queue(tpAniSirGlobal pMac)
1873{
1874 tSirMsgQ limMsg = { 0, 0, 0 };
1875
1876 tSirMsgQ *readMsg;
1877 uint16_t size;
1878
1879 /*
1880 ** check any deferred messages need to be processed
1881 **/
1882 size = pMac->lim.gLimDeferredMsgQ.size;
1883 if (size > 0) {
1884 while ((readMsg = lim_read_deferred_msg_q(pMac)) != NULL) {
1885 cdf_mem_copy((uint8_t *) &limMsg,
1886 (uint8_t *) readMsg, sizeof(tSirMsgQ));
1887 size--;
1888 lim_process_messages(pMac, &limMsg);
1889
1890 if ((lim_is_system_in_scan_state(pMac))
1891 || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac))
Hema Aparna Medicharla5e1f3022015-08-24 11:22:29 +05301892 || (pMac->lim.gLimSystemInScanLearnMode)
1893 || pMac->lim.gLimAddtsSent)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001894 break;
1895 }
1896 }
1897} /*** end lim_process_deferred_message_queue() ***/
1898
1899/**
1900 * lim_process_normal_hdd_msg() - Process the message and defer if needed
1901 * @mac_ctx : Pointer to Global MAC structure
1902 * @msg : The message need to be processed
1903 * @rsp_reqd: whether return result to hdd
1904 *
1905 * This function checks the current lim state and decide whether the message
1906 * passed will be deferred or not.
1907 *
1908 * Return: None
1909 */
1910static void lim_process_normal_hdd_msg(tpAniSirGlobal mac_ctx, tSirMsgQ *msg,
1911 uint8_t rsp_reqd)
1912{
1913 bool defer_msg = true;
1914
1915 /* Added For BT-AMP Support */
1916 if ((mac_ctx->lim.gLimSystemRole == eLIM_AP_ROLE)
1917 || (mac_ctx->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE)
1918 || (mac_ctx->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
1919 || (mac_ctx->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)) {
1920 /*
1921 * This check is required only for the AP and in 2 cases.
1922 * 1. If we are in learn mode and we receive any of these
1923 * messages, you have to come out of scan and process the
1924 * message, hence dont defer the message here. In handler,
1925 * these message could be defered till we actually come out of
1926 * scan mode.
1927 * 2. If radar is detected, you might have to defer all of
1928 * these messages except Stop BSS request/ Switch channel
1929 * request. This decision is also made inside its handler.
1930 *
1931 * Please be careful while using the flag defer_msg. Possibly
1932 * you might end up in an infinite loop.
1933 */
1934 if ((msg->type == eWNI_SME_START_BSS_REQ) ||
1935 (msg->type == eWNI_SME_STOP_BSS_REQ) ||
1936 (msg->type == eWNI_SME_SWITCH_CHL_IND))
1937 defer_msg = false;
1938 }
1939
1940 if (((mac_ctx->lim.gLimAddtsSent) ||
1941 (lim_is_system_in_scan_state(mac_ctx))) && defer_msg) {
1942 /*
1943 * System is in DFS (Learn) mode or awaiting addts response or
1944 * if radar is detected, Defer processsing this message
1945 */
1946 if (lim_defer_msg(mac_ctx, msg) != TX_SUCCESS) {
1947#ifdef WLAN_DEBUG
1948 mac_ctx->lim.numSme++;
1949#endif
1950 lim_log_session_states(mac_ctx);
1951 /* Release body */
1952 cdf_mem_free(msg->bodyptr);
1953 msg->bodyptr = NULL;
1954 }
1955 } else {
1956 /*
1957 * These messages are from HDD.Since these requests may also be
1958 * generated internally within LIM module, need to distinquish
1959 * and send response to host
1960 */
1961 if (rsp_reqd)
1962 mac_ctx->lim.gLimRspReqd = true;
1963#ifdef WLAN_DEBUG
1964 mac_ctx->lim.numSme++;
1965#endif
1966 if (lim_process_sme_req_messages(mac_ctx, msg)) {
1967 /*
1968 * Release body. limProcessSmeReqMessage consumed the
1969 * buffer. We can free it.
1970 */
1971 cdf_mem_free(msg->bodyptr);
1972 msg->bodyptr = NULL;
1973 }
1974 }
1975}
1976
1977void
1978handle_ht_capabilityand_ht_info(struct sAniSirGlobal *pMac,
1979 tpPESession psessionEntry)
1980{
1981 tSirMacHTCapabilityInfo macHTCapabilityInfo;
1982 tSirMacHTParametersInfo macHTParametersInfo;
1983 tSirMacHTInfoField1 macHTInfoField1;
1984 tSirMacHTInfoField2 macHTInfoField2;
1985 tSirMacHTInfoField3 macHTInfoField3;
1986 uint32_t cfgValue;
1987 uint8_t *ptr;
1988
1989 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) !=
1990 eSIR_SUCCESS) {
1991 lim_log(pMac, LOGP,
1992 FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
1993 return;
1994 }
1995 ptr = (uint8_t *) &macHTCapabilityInfo;
1996 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
1997 pMac->lim.gHTLsigTXOPProtection =
1998 (uint8_t) macHTCapabilityInfo.lsigTXOPProtection;
1999 pMac->lim.gHTMIMOPSState =
2000 (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2001 pMac->lim.gHTGreenfield = (uint8_t) macHTCapabilityInfo.greenField;
2002 pMac->lim.gHTMaxAmsduLength =
2003 (uint8_t) macHTCapabilityInfo.maximalAMSDUsize;
2004 pMac->lim.gHTShortGI20Mhz = (uint8_t) macHTCapabilityInfo.shortGI20MHz;
2005 pMac->lim.gHTShortGI40Mhz = (uint8_t) macHTCapabilityInfo.shortGI40MHz;
2006 pMac->lim.gHTPSMPSupport = (uint8_t) macHTCapabilityInfo.psmp;
2007 pMac->lim.gHTDsssCckRate40MHzSupport =
2008 (uint8_t) macHTCapabilityInfo.dsssCckMode40MHz;
2009
2010 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) !=
2011 eSIR_SUCCESS) {
2012 lim_log(pMac, LOGP,
2013 FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
2014 return;
2015 }
2016 ptr = (uint8_t *) &macHTParametersInfo;
2017 *ptr = (uint8_t) (cfgValue & 0xff);
2018 pMac->lim.gHTAMpduDensity = (uint8_t) macHTParametersInfo.mpduDensity;
2019 pMac->lim.gHTMaxRxAMpduFactor =
2020 (uint8_t) macHTParametersInfo.maxRxAMPDUFactor;
2021
2022 /* Get HT IE Info */
2023 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) !=
2024 eSIR_SUCCESS) {
2025 lim_log(pMac, LOGP,
2026 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
2027 return;
2028 }
2029 ptr = (uint8_t *) &macHTInfoField1;
2030 *((uint8_t *) ptr) = (uint8_t) (cfgValue & 0xff);
2031 pMac->lim.gHTServiceIntervalGranularity =
2032 (uint8_t) macHTInfoField1.serviceIntervalGranularity;
2033 pMac->lim.gHTControlledAccessOnly =
2034 (uint8_t) macHTInfoField1.controlledAccessOnly;
2035 pMac->lim.gHTRifsMode = (uint8_t) macHTInfoField1.rifsMode;
2036
2037 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) !=
2038 eSIR_SUCCESS) {
2039 lim_log(pMac, LOGP,
2040 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
2041 return;
2042 }
2043 ptr = (uint8_t *) &macHTInfoField2;
2044 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2045 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2046
2047 if (wlan_cfg_get_int(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) !=
2048 eSIR_SUCCESS) {
2049 lim_log(pMac, LOGP,
2050 FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
2051 return;
2052 }
2053 ptr = (uint8_t *) &macHTInfoField3;
2054 *((uint16_t *) ptr) = (uint16_t) (cfgValue & 0xffff);
2055 pMac->lim.gHTPCOActive = (uint8_t) macHTInfoField3.pcoActive;
2056 pMac->lim.gHTPCOPhase = (uint8_t) macHTInfoField3.pcoPhase;
2057 pMac->lim.gHTSecondaryBeacon =
2058 (uint8_t) macHTInfoField3.secondaryBeacon;
2059 pMac->lim.gHTDualCTSProtection =
2060 (uint8_t) macHTInfoField3.dualCTSProtection;
2061 pMac->lim.gHTSTBCBasicMCS = (uint8_t) macHTInfoField3.basicSTBCMCS;
2062
2063 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2064 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2065 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2066 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2067 */
2068 if (psessionEntry != NULL) {
2069 psessionEntry->htCapability =
2070 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2071 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2072 (uint8_t) macHTInfoField3.lsigTXOPProtectionFullSupport;
2073 }
2074}
2075
2076void lim_log_session_states(tpAniSirGlobal mac_ctx)
2077{
2078#ifdef WLAN_DEBUG
2079 int i;
2080
2081 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
2082 if (mac_ctx->lim.gpSession[i].valid) {
Anurag Chouhan6d760662016-02-20 16:05:43 +05302083 CDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002084 FL("sysRole(%d) Session (%d)"),
2085 mac_ctx->lim.gLimSystemRole, i);
Anurag Chouhan6d760662016-02-20 16:05:43 +05302086 CDF_TRACE(QDF_MODULE_ID_PE, LOG1,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002087 FL("SME: Curr %s,Prev %s,MLM: Curr %s,Prev %s"),
2088 lim_sme_state_str(
2089 mac_ctx->lim.gpSession[i].limSmeState),
2090 lim_sme_state_str(
2091 mac_ctx->lim.gpSession[i].limPrevSmeState),
2092 lim_mlm_state_str(
2093 mac_ctx->lim.gpSession[i].limMlmState),
2094 lim_mlm_state_str(
2095 mac_ctx->lim.gpSession[i].limPrevMlmState));
2096 }
2097 }
2098#endif
2099}