blob: 1c8cffd4f6f436526280c853792b89970dd315ba [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singheef5c992016-01-27 13:41:54 +05302 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -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/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080031/*
Jeff Johnson295189b2012-06-20 16:38:30 -070032 * This file limProcessSmeReqMessages.cc contains the code
33 * for processing SME request messages.
34 * Author: Chandra Modumudi
35 * Date: 02/11/02
36 * History:-
37 * Date Modified by Modification Information
38 * --------------------------------------------------------------------
39 *
40 */
41
42#include "palTypes.h"
43#include "wniApi.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053044#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "cfgApi.h"
46#include "sirApi.h"
47#include "schApi.h"
48#include "utilsApi.h"
49#include "limTypes.h"
50#include "limUtils.h"
51#include "limAssocUtils.h"
52#include "limSecurityUtils.h"
53#include "limSerDesUtils.h"
54#include "limSmeReqUtils.h"
55#include "limIbssPeerMgmt.h"
56#include "limAdmitControl.h"
57#include "dphHashTable.h"
58#include "limSendMessages.h"
59#include "limApi.h"
60#include "wmmApsd.h"
61
Abhishek Singh00b71972016-01-07 10:51:04 +053062#ifdef WLAN_FEATURE_RMC
63#include "limRMC.h"
64#endif
65
Jeff Johnson295189b2012-06-20 16:38:30 -070066#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070067
68#if defined WLAN_FEATURE_VOWIFI
69#include "rrmApi.h"
70#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080071#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
72#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073#endif
74
75#if defined WLAN_FEATURE_VOWIFI_11R
76#include <limFT.h>
77#endif
78
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080079#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070080/* These are the min/max tx power (non virtual rates) range
81 supported by prima hardware */
Sandeep Puligilla33ccf332013-12-19 16:06:42 +053082#define MIN_TX_PWR_CAP 8
83#define MAX_TX_PWR_CAP 22
Jeff Johnson295189b2012-06-20 16:38:30 -070084
85#endif
86
Sushant Kaushike3ca61c2015-03-19 18:33:25 +053087#define JOIN_FAILURE_TIMEOUT 1000 // in msecs
Viral Modid86bde22012-12-10 13:09:21 -080088/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
89 * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency,
Sunil Ravi24fd3aa2013-01-21 22:12:06 -080090 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
91 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080092 */
Viral Modid440e682013-03-06 02:25:31 -080093#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
94#define JOIN_NOA_DURATION 2000 // in msecs
95#define OEM_DATA_NOA_DURATION 60 // in msecs
96#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070097
Gopichand Nakkala096a1052012-12-21 07:05:34 -080098#define CONV_MS_TO_US 1024 //conversion factor from ms to us
99
Jeff Johnson295189b2012-06-20 16:38:30 -0700100// SME REQ processing function templates
101static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
102static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
103static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -0800104static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700105static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
106static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
107static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
108static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
109static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
110static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
111static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
112
Jeff Johnson295189b2012-06-20 16:38:30 -0700113void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
114
Jeff Johnson295189b2012-06-20 16:38:30 -0700115extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700116
Jeff Johnson295189b2012-06-20 16:38:30 -0700117
Jeff Johnson295189b2012-06-20 16:38:30 -0700118#ifdef BACKGROUND_SCAN_ENABLED
119
120// start the background scan timers if it hasn't already started
121static void
122__limBackgroundScanInitiate(tpAniSirGlobal pMac)
123{
124 if (pMac->lim.gLimBackgroundScanStarted)
125 return;
126
127 //make sure timer is created first
128 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
129 {
130 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700131 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700132 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700133 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700134 pMac->lim.gLimBackgroundScanStarted = true;
135 pMac->lim.gLimBackgroundScanChannelId = 0;
136 }
137}
138
139#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700140
141// determine if a fresh scan request must be issued or not
142/*
143* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
144* If one of the sessions is not in one of the above states, then PE does not do fresh scan
145* If no session exists (scanning very first time), then PE will always do fresh scan if SME
146* asks it to do that.
147*/
148static tANI_U8
149__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
150{
151
152 tANI_U8 validState = TRUE;
153 int i;
154
155 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
156 {
Sushant Kaushik59e6f362015-08-11 15:41:00 +0530157 limLog(pMac, LOG1, FL("setting fresh scan as false. sme state is %d"),
158 pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 return FALSE;
160 }
161 for(i =0; i < pMac->lim.maxBssId; i++)
162 {
163
164 if(pMac->lim.gpSession[i].valid == TRUE)
165 {
166 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
167 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
168 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
169
170 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
171 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
172 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
173 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700174 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
175 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
176 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
177 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 ))
179 {
180 validState = FALSE;
Sushant Kaushik59e6f362015-08-11 15:41:00 +0530181 limLog(pMac, LOG1, FL("setting fresh scan as false."
182 "bssType is %d system role is %d, smestate is %d"),
183 pMac->lim.gpSession[i].bssType,
184 pMac->lim.gpSession[i].limSystemRole,
185 pMac->lim.gpSession[i].limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700186 break;
187 }
188
189 }
190 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530191 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700192
193 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
194 return TRUE;
195
196 return FALSE;
197}
198
Jeff Johnson295189b2012-06-20 16:38:30 -0700199
200
201/**
202 * __limIsSmeAssocCnfValid()
203 *
204 *FUNCTION:
205 * This function is called by limProcessLmmMessages() upon
206 * receiving SME_ASSOC_CNF.
207 *
208 *LOGIC:
209 * Message validity checks are performed in this function
210 *
211 *ASSUMPTIONS:
212 *
213 *NOTE:
214 *
215 * @param pMeasReq Pointer to Received ASSOC_CNF message
216 * @return true When received SME_ASSOC_CNF is formatted
217 * correctly
218 * false otherwise
219 */
220
221inline static tANI_U8
222__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
223{
224 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
225 return false;
226 else
227 return true;
228} /*** end __limIsSmeAssocCnfValid() ***/
229
230
231/**
232 * __limGetSmeJoinReqSizeForAlloc()
233 *
234 *FUNCTION:
235 * This function is called in various places to get IE length
236 * from tSirBssDescription structure
237 * number being scanned.
238 *
239 *PARAMS:
240 *
241 *LOGIC:
242 *
243 *ASSUMPTIONS:
244 * NA
245 *
246 *NOTE:
247 * NA
248 *
249 * @param pBssDescr
250 * @return Total IE length
251 */
252
253static tANI_U16
254__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
255{
256 tANI_U16 len = 0;
257
258 if (!pBuf)
259 return len;
260
261 pBuf += sizeof(tANI_U16);
262 len = limGetU16( pBuf );
263 return (len + sizeof( tANI_U16 ));
264} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
265
266
267/**----------------------------------------------------------------
268\fn __limIsDeferedMsgForLearn
269
270\brief Has role only if 11h is enabled. Not used on STA side.
271 Defers the message if SME is in learn state and brings
272 the LIM back to normal mode.
273
274\param pMac
275\param pMsg - Pointer to message posted from SME to LIM.
276\return TRUE - If defered
277 FALSE - Otherwise
278------------------------------------------------------------------*/
279static tANI_BOOLEAN
280__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
281{
282 if (limIsSystemInScanState(pMac))
283 {
284 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
285 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700286 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 return eANI_BOOLEAN_FALSE;
288 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700289 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 pMsg->type);)
291
292 /** Send finish scan req to HAL only if LIM is not waiting for any response
293 * from HAL like init scan rsp, start scan rsp etc.
294 */
295 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
296 {
297 //Set the resume channel to Any valid channel (invalid).
298 //This will instruct HAL to set it to any previous valid channel.
299 peSetResumeChannel(pMac, 0, 0);
300 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
301 }
302
303 return eANI_BOOLEAN_TRUE;
304 }
305 return eANI_BOOLEAN_FALSE;
306}
307
308/**----------------------------------------------------------------
309\fn __limIsDeferedMsgForRadar
310
311\brief Has role only if 11h is enabled. Not used on STA side.
312 Defers the message if radar is detected.
313
314\param pMac
315\param pMsg - Pointer to message posted from SME to LIM.
316\return TRUE - If defered
317 FALSE - Otherwise
318------------------------------------------------------------------*/
319static tANI_BOOLEAN
320__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
321{
322 /** fRadarDetCurOperChan will be set only if we detect radar in current
323 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700324 //TODO: Need to take care radar detection.
325 //if (LIM_IS_RADAR_DETECTED(pMac))
326 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 {
328 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
329 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700330 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 return eANI_BOOLEAN_FALSE;
332 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700333 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 pMsg->type);)
335 return eANI_BOOLEAN_TRUE;
336 }
337 return eANI_BOOLEAN_FALSE;
338}
339
340
341/**
342 * __limProcessSmeStartReq()
343 *
344 *FUNCTION:
345 * This function is called to process SME_START_REQ message
346 * from HDD or upper layer application.
347 *
348 *LOGIC:
349 *
350 *ASSUMPTIONS:
351 *
352 *NOTE:
353 *
354 * @param pMac Pointer to Global MAC structure
355 * @param *pMsgBuf A pointer to the SME message buffer
356 * @return None
357 */
358
359static void
360__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
361{
362 tSirResultCodes retCode = eSIR_SME_SUCCESS;
363 tANI_U8 smesessionId;
364 tANI_U16 smetransactionId;
365
366
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530367 limLog(pMac, LOG1, FL("Received SME_START_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700368
369 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
370
371 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
372 {
373 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
374
Jeff Johnsone7245742012-09-05 17:12:55 -0700375 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
377 /// By default do not return after first scan match
378 pMac->lim.gLimReturnAfterFirstMatch = 0;
379
380 /// Initialize MLM state machine
381 limInitMlm(pMac);
382
383 /// By default return unique scan results
384 pMac->lim.gLimReturnUniqueResults = true;
385 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700386#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
387 pMac->lim.gLimSmeLfrScanResultLength = 0;
388#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700389
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
391 {
392 /*
393 * Need to indicate new BSSs found during background scanning to
394 * host. Update this parameter at CFG
395 */
396 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
397 != eSIR_SUCCESS)
398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700399 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
401 }
402 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404 else
405 {
406 /**
407 * Should not have received eWNI_SME_START_REQ in states
408 * other than OFFLINE. Return response to host and
409 * log error
410 */
Sushant Kaushik1b645382014-10-13 16:39:36 +0530411 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %d"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
413 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
414 }
415 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
416} /*** end __limProcessSmeStartReq() ***/
417
418
419/** -------------------------------------------------------------
420\fn __limProcessSmeSysReadyInd
421\brief handles the notification from HDD. PE just forwards this message to HAL.
422\param tpAniSirGlobal pMac
423\param tANI_U32* pMsgBuf
424\return TRUE-Posting to HAL failed, so PE will consume the buffer.
425\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
426 -------------------------------------------------------------*/
427static tANI_BOOLEAN
428__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
429{
430 tSirMsgQ msg;
431
432 msg.type = WDA_SYS_READY_IND;
433 msg.reserved = 0;
434 msg.bodyptr = pMsgBuf;
435 msg.bodyval = 0;
436
Jeff Johnson92751692013-03-06 16:00:33 -0800437 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 {
Jeff Johnson92751692013-03-06 16:00:33 -0800439 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700441 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700442 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700443
Jeff Johnson92751692013-03-06 16:00:33 -0800444 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700446 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 return eANI_BOOLEAN_TRUE;
448 }
449 return eANI_BOOLEAN_FALSE;
450}
451
Jeff Johnsone7245742012-09-05 17:12:55 -0700452#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
Jeff Johnsone7245742012-09-05 17:12:55 -0700454tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
455{
456 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
457 {
458 switch(secondaryChanOffset)
459 {
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
461 return primarychanNum;
462 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
463 return primarychanNum + 2;
464 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
465 return primarychanNum - 2;
466 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
467 return primarychanNum + 6;
468 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
469 return primarychanNum + 2;
470 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
471 return primarychanNum - 2;
472 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
473 return primarychanNum - 6;
474 default :
475 return eSIR_CFG_INVALID_ID;
476 }
477 }
478 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
479 {
480 switch(secondaryChanOffset)
481 {
482 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
483 return primarychanNum + 2;
484 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
485 return primarychanNum - 2;
486 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
487 return primarychanNum;
488 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
489 return primarychanNum + 2;
490 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
491 return primarychanNum - 2;
492 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
493 return primarychanNum + 2;
494 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
495 return primarychanNum - 2;
496 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
497 return primarychanNum + 2;
498 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
499 return primarychanNum - 2;
500 default :
501 return eSIR_CFG_INVALID_ID;
502 }
503 }
504 return primarychanNum;
505}
506
507#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700508/**
509 * __limHandleSmeStartBssRequest()
510 *
511 *FUNCTION:
512 * This function is called to process SME_START_BSS_REQ message
513 * from HDD or upper layer application.
514 *
515 *LOGIC:
516 *
517 *ASSUMPTIONS:
518 *
519 *NOTE:
520 *
521 * @param pMac Pointer to Global MAC structure
522 * @param *pMsgBuf A pointer to the SME message buffer
523 * @return None
524 */
525
526static void
527__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
528{
529 tANI_U16 size;
530 tANI_U32 val = 0;
531 tSirRetStatus retStatus;
532 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700533 tLimMlmStartReq *pMlmStartReq = NULL;
534 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 tSirResultCodes retCode = eSIR_SME_SUCCESS;
536 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 tANI_U8 sessionId;
538 tpPESession psessionEntry = NULL;
539 tANI_U8 smesessionId;
540 tANI_U16 smetransactionId;
541
542#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
543 //Since the session is not created yet, sending NULL. The response should have the correct state.
544 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
545#endif //FEATURE_WLAN_DIAG_SUPPORT
546
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530547 limLog(pMac, LOG1, FL("Received SME_START_BSS_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700548
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530549 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
551 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
552 {
553 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
554
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530555 pSmeStartBssReq = vos_mem_malloc(size);
556 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530558 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 /// Send failure response to host
560 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
561 goto end;
562 }
563
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530564 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700565
566 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
567 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
568 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700569 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 retCode = eSIR_SME_INVALID_PARAMETERS;
571 goto free;
572 }
573#if 0
574 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700575 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
577#endif
578
579 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530580 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
582 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700583 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
585 psessionEntry = NULL;
586 goto free;
587 }
588 else
589 {
590 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
591 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700592 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
594 goto free;
595 }
596
597 }
598
599 /* Store the session related parameters in newly created session */
600 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
601
602 /* Store PE sessionId in session Table */
603 psessionEntry->peSessionId = sessionId;
604
605 /* Store SME session Id in sessionTable */
606 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
607
608 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
609
610 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
611
612 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530613 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 (tANI_U8 *)&pSmeStartBssReq->ssId,
615 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530616
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530620
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
622
623 /* Store the channel number in session Table */
624 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
625
626 /*Store Persona */
627 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700628 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 psessionEntry->pePersona);
630
631 /*Update the phymode*/
632 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
633
634 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
635 psessionEntry->currentOperChannel );
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530636
637#ifdef WLAN_FEATURE_AP_HT40_24G
638 /*Store Overlapping BSS Scan Parameters IEs to session table */
639 if (pSmeStartBssReq->apHT40_24GEnabled)
640 {
641 limInitOBSSScanParams(pMac, psessionEntry);
642 }
643#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 /* Store the dot 11 mode in to the session Table*/
645
646 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700647 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
648#ifdef WLAN_FEATURE_11AC
649 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700650 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
651 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700652#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800653
654 psessionEntry->txLdpcIniFeatureEnabled =
655 pSmeStartBssReq->txLdpcIniFeatureEnabled;
656
Chet Lanctot8cecea22014-02-11 19:09:36 -0800657#ifdef WLAN_FEATURE_11W
658 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
659 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
660#endif
661
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530662 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 (void*)&pSmeStartBssReq->operationalRateSet,
664 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530665 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 (void*)&pSmeStartBssReq->extendedRateSet,
667 sizeof(tSirMacRateSet));
668
669 switch(pSmeStartBssReq->bssType)
670 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 case eSIR_INFRA_AP_MODE:
672 psessionEntry->limSystemRole = eLIM_AP_ROLE;
673 psessionEntry->privacy = pSmeStartBssReq->privacy;
674 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
675 psessionEntry->authType = pSmeStartBssReq->authType;
676 /* Store the DTIM period */
677 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
678 /*Enable/disable UAPSD*/
679 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
680 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
681 {
682 psessionEntry->proxyProbeRspEn = 0;
683 }
684 else
685 {
686 /* To detect PBC overlap in SAP WPS mode, Host handles
687 * Probe Requests.
688 */
689 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
690 {
691 psessionEntry->proxyProbeRspEn = 1;
692 }
693 else
694 {
695 psessionEntry->proxyProbeRspEn = 0;
696 }
697 }
698 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
699 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
krunal soni45b9eb62014-03-26 12:54:25 -0700700 limGetShortSlotFromPhyMode(pMac, psessionEntry,
701 psessionEntry->gLimPhyMode,
702 &psessionEntry->shortSlotTimeSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 case eSIR_IBSS_MODE:
705 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
krunal soni45b9eb62014-03-26 12:54:25 -0700706 limGetShortSlotFromPhyMode(pMac, psessionEntry,
707 psessionEntry->gLimPhyMode,
708 &psessionEntry->shortSlotTimeSupported);
Abhishek Singhd5c31272014-03-07 14:46:50 +0530709 /* In WPA-NONE case we wont get the privacy bit in ibss config
710 * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED
711 * on basis of Encryption type in csrRoamSetBssConfigCfg. So
712 * get the privacy info from WNI_CFG_PRIVACY_ENABLED
713 */
714 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val)
715 != eSIR_SUCCESS)
716 limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED"
717 " failed"));
718 psessionEntry->privacy =(tANI_U8) val;
krunal sonie9002db2013-11-25 14:24:17 -0800719 psessionEntry->isCoalesingInIBSSAllowed =
720 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 break;
722
723 case eSIR_BTAMP_AP_MODE:
724 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
725 break;
726
727 case eSIR_BTAMP_STA_MODE:
728 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
729 break;
730
731 /* There is one more mode called auto mode. which is used no where */
732
733 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
734
735
736 default:
737 //not used anywhere...used in scan function
738 break;
739 }
740
741 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
742 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 )
745 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530746 psessionEntry->parsedAssocReq = vos_mem_malloc(
747 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
748 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530750 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
752 goto free;
753 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530754 vos_mem_set(psessionEntry->parsedAssocReq,
755 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
756 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 }
758
759 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
760 if (pSmeStartBssReq->channelId)
761 {
762 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
764 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
765 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700766 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700767 FL("cbMode %u"), pSmeStartBssReq->cbMode);
768#ifdef WLAN_FEATURE_11AC
769 if(psessionEntry->vhtCapability)
770 {
771 tANI_U32 centerChan;
772 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700773
Jeff Johnsone7245742012-09-05 17:12:55 -0700774 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
775 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700777 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700778 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700779 }
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530780
Abhishek Singh921926b2014-02-13 17:21:01 +0530781 if(channelNumber <= RF_CHAN_14 &&
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530782 chanWidth != eHT_CHANNEL_WIDTH_20MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700783 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530784 chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
Abhishek Singh921926b2014-02-13 17:21:01 +0530785 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
786 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700788
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530789 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ ||
790 chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
Abhishek Singh921926b2014-02-13 17:21:01 +0530791 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530792 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
793 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
794 != eSIR_SUCCESS)
795 {
796 limLog(pMac, LOGP, FL("could not set "
797 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
798 retCode = eSIR_LOGP_EXCEPTION;
799 goto free;
800 }
801 }
802 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
803 {
804 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
805 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
806 != eSIR_SUCCESS)
807 {
808 limLog(pMac, LOGP, FL("could not set "
809 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
810 retCode = eSIR_LOGP_EXCEPTION;
811 goto free;
812 }
813
814 centerChan = limGetCenterChannel( pMac, channelNumber,
815 pSmeStartBssReq->cbMode,
816 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700817 if(centerChan != eSIR_CFG_INVALID_ID)
818 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530819 limLog(pMac, LOGW, FL("***Center Channel for "
820 "80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700821 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530822 if (cfgSetInt(pMac,
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530823 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
824 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700825 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530826 limLog(pMac, LOGP, FL("could not set "
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530827 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700828 retCode = eSIR_LOGP_EXCEPTION;
829 goto free;
830 }
831 }
832 }
833
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530834 /* All the translation is done by now for gVhtChannelWidth
835 * from .ini file to the actual values as defined in spec.
836 * So, grabing the spec value which is
837 * updated in .dat file by the above logic */
838 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
839 &chanWidth) != eSIR_SUCCESS)
840 {
841 limLog(pMac, LOGP,
842 FL("Unable to retrieve Channel Width from CFG"));
843 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700844 /*For Sta+p2p-Go concurrency
845 vhtTxChannelWidthSet is used for storing p2p-GO channel width
846 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
847 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
848 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700849 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700850 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700851 }
852 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
853#endif
854 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700855 else
856 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700857 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 retCode = eSIR_SME_INVALID_PARAMETERS;
859 goto free;
860 }
861
862 // Delete pre-auth list if any
863 limDeletePreAuthList(pMac);
864
865 // Delete IBSS peer BSSdescription list if any
866 //limIbssDelete(pMac); sep 26 review
867
868
869
870#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
871 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 limInitMlm(pMac);
873#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700874
Jeff Johnsone7245742012-09-05 17:12:55 -0700875 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700876
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 /* keep the RSN/WPA IE information in PE Session Entry
878 * later will be using this to check when received (Re)Assoc req
879 * */
880 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
881
Jeff Johnson295189b2012-06-20 16:38:30 -0700882
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 //Taken care for only softAP case rest need to be done
884 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
885 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
886 /*each byte will have the following info
887 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
888 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530889 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700891 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700892 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
893 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700894
895 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530896 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
897 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530899 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
901 goto free;
902 }
903
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530904 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700905
906 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530907 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700908 (tANI_U8 *) &pSmeStartBssReq->ssId,
909 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
911 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700912
913
914 pMlmStartReq->bssType = psessionEntry->bssType;
915
916 /* Fill PE session Id from the session Table */
917 pMlmStartReq->sessionId = psessionEntry->peSessionId;
918
919 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700920 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 )
922 {
923 //len = sizeof(tSirMacAddr);
924 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
925 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700926 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700927
928 /* Copy the BSSId from sessionTable to mlmStartReq struct */
929 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
930 }
931
932 else // ibss mode
933 {
934 pMac->lim.gLimIbssCoalescingHappened = false;
935
936 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
937 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700938 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 retCode = eSIR_LOGP_EXCEPTION;
940 goto free;
941 }
942
943 if(!autoGenBssId)
944 {
945 // We're not auto generating BSSID. Instead, get it from session entry
946 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
947
948 if(pMlmStartReq->bssId[0] & 0x01)
949 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700950 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700951 autoGenBssId = TRUE;
952 }
953 }
954
955 if( autoGenBssId )
956 { //if BSSID is not any uc id. then use locally generated BSSID.
957 //Autogenerate the BSSID
958 limGetRandomBssid( pMac, pMlmStartReq->bssId);
959 pMlmStartReq->bssId[0]= 0x02;
960
961 /* Copy randomly generated BSSID to the session Table */
962 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
963 }
964 }
965 /* store the channel num in mlmstart req structure */
966 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
967 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
968 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
969
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
971 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
972 pMlmStartReq->wps_state = psessionEntry->wps_state;
973
974 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 {
976 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700977 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700978 pMlmStartReq->dtimPeriod = (tANI_U8)val;
979 }
980
981 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700982 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700983 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
984
985 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700986 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
988
989 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530990 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 sizeof(tSirMacRateSet));
992
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 // Now populate the 11n related parameters
994 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700995 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 //
997 // FIXME_GEN4 - Determine the appropriate defaults...
998 //
999 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
1000 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -07001001 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07001002
1003 /* sep26 review */
1004 psessionEntry->limRFBand = limGetRFBand(channelNumber);
1005
1006 // Initialize 11h Enable Flag
1007 psessionEntry->lim11hEnable = 0;
1008 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
1009 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
1010 {
1011 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001012 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 psessionEntry->lim11hEnable = val;
1014 }
1015
1016 if (!psessionEntry->lim11hEnable)
1017 {
1018 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001019 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001020 }
1021
Jeff Johnson295189b2012-06-20 16:38:30 -07001022 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1023 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001024 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001025
1026 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1027 return;
1028 }
1029 else
1030 {
1031
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001032 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1034 goto end;
1035 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1036
1037free:
Jeff Johnsonace91102013-04-05 08:03:18 -07001038 if ((psessionEntry != NULL) &&
1039 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
1040 {
1041 psessionEntry->pLimStartBssReq = NULL;
1042 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301043 vos_mem_free( pSmeStartBssReq);
1044 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001045
1046end:
1047
1048 /* This routine should return the sme sessionId and SME transaction Id */
1049 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1050
1051 if(NULL != psessionEntry)
1052 {
1053 peDeleteSession(pMac,psessionEntry);
1054 psessionEntry = NULL;
1055 }
1056 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1057} /*** end __limHandleSmeStartBssRequest() ***/
1058
1059
1060/**--------------------------------------------------------------
1061\fn __limProcessSmeStartBssReq
1062
1063\brief Wrapper for the function __limHandleSmeStartBssRequest
1064 This message will be defered until softmac come out of
1065 scan mode or if we have detected radar on the current
1066 operating channel.
1067\param pMac
1068\param pMsg
1069
1070\return TRUE - If we consumed the buffer
1071 FALSE - If have defered the message.
1072 ---------------------------------------------------------------*/
1073static tANI_BOOLEAN
1074__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1075{
1076 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1077 __limIsDeferedMsgForRadar(pMac, pMsg))
1078 {
1079 /**
1080 * If message defered, buffer is not consumed yet.
1081 * So return false
1082 */
1083 return eANI_BOOLEAN_FALSE;
1084 }
1085
1086 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1087 return eANI_BOOLEAN_TRUE;
1088}
1089
1090
1091/**
1092 * limGetRandomBssid()
1093 *
1094 * FUNCTION:This function is called to process generate the random number for bssid
1095 * This function is called to process SME_SCAN_REQ message
1096 * from HDD or upper layer application.
1097 *
1098 * LOGIC:
1099 *
1100 * ASSUMPTIONS:
1101 *
1102 * NOTE:
1103 * 1. geneartes the unique random number for bssid in ibss
1104 *
1105 * @param pMac Pointer to Global MAC structure
1106 * @param *data Pointer to bssid buffer
1107 * @return None
1108 */
1109void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1110{
1111 tANI_U32 random[2] ;
1112 random[0] = tx_time_get();
1113 random[0] |= (random[0] << 15) ;
1114 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301115 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001116}
1117
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301118static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1119 tpSirSmeScanReq pScanReq)
1120{
1121 tSirScanOffloadReq *pScanOffloadReq;
1122 tANI_U8 *p;
1123 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301124 tANI_U16 i, len;
1125 tSirRetStatus rc = eSIR_SUCCESS;
1126
1127 /* The tSirScanOffloadReq will reserve the space for first channel,
1128 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1129 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1130 pScanReq->uIEFieldLen;
1131
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301132 pScanOffloadReq = vos_mem_malloc(len);
1133 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301134 {
1135 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301136 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301137 return eHAL_STATUS_FAILURE;
1138 }
1139
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301140 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301141
1142 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1143 msg.bodyptr = pScanOffloadReq;
1144 msg.bodyval = 0;
1145
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301146 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301147 (tANI_U8*) pScanReq->bssId,
1148 sizeof(tSirMacAddr));
1149
1150 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1151 {
1152 limLog(pMac, LOGE,
1153 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301154 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301155 return eHAL_STATUS_FAILURE;
1156 }
1157
1158 pScanOffloadReq->numSsid = pScanReq->numSsid;
1159 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1160 {
1161 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301162 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301163 (tANI_U8 *) pScanReq->ssId[i].ssId,
1164 pScanOffloadReq->ssId[i].length);
1165 }
1166
1167 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301168 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301169 (tANI_U8 *) pScanReq->selfMacAddr,
1170 sizeof(tSirMacAddr));
1171 pScanOffloadReq->bssType = pScanReq->bssType;
1172 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1173 pScanOffloadReq->scanType = pScanReq->scanType;
1174 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1175 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1176 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1177 pScanOffloadReq->sessionId = pScanReq->sessionId;
1178 pScanOffloadReq->channelList.numChannels =
1179 pScanReq->channelList.numChannels;
1180 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1181 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1182 p[i] = pScanReq->channelList.channelNumber[i];
1183
1184 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1185 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301186 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301187 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1188 pScanOffloadReq->uIEFieldLen);
1189
1190 rc = wdaPostCtrlMsg(pMac, &msg);
1191 if (rc != eSIR_SUCCESS)
1192 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001193 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301194 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301195 return eHAL_STATUS_FAILURE;
1196 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301197 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301198
1199 return eHAL_STATUS_SUCCESS;
1200}
Jeff Johnson295189b2012-06-20 16:38:30 -07001201
1202/**
1203 * __limProcessSmeScanReq()
1204 *
1205 *FUNCTION:
1206 * This function is called to process SME_SCAN_REQ message
1207 * from HDD or upper layer application.
1208 *
1209 *LOGIC:
1210 *
1211 *ASSUMPTIONS:
1212 *
1213 *NOTE:
1214 * 1. Periodic scanning should be requesting to return unique
1215 * scan results.
1216 *
1217 * @param pMac Pointer to Global MAC structure
1218 * @param *pMsgBuf A pointer to the SME message buffer
1219 * @return None
1220 */
1221
Viral Modid440e682013-03-06 02:25:31 -08001222static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001223__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1224{
1225 tANI_U32 len;
1226 tLimMlmScanReq *pMlmScanReq;
1227 tpSirSmeScanReq pScanReq;
1228 tANI_U8 i = 0;
1229
Sushant Kaushikb97a0082015-08-31 12:36:45 +05301230#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1232#endif //FEATURE_WLAN_DIAG_SUPPORT
1233
1234 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301235 limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d"
1236 "first %d fresh %d unique %d type %s (%d)"
1237 " mode %s (%d)rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 pScanReq->channelList.numChannels,
1239 pScanReq->minChannelTime,
1240 pScanReq->maxChannelTime,
1241 pScanReq->uIEFieldLen,
1242 pScanReq->returnAfterFirstMatch,
1243 pScanReq->returnFreshResults,
1244 pScanReq->returnUniqueResults,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301245 lim_ScanTypetoString(pScanReq->scanType),
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001246 pScanReq->scanType,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301247 lim_BackgroundScanModetoString(pScanReq->backgroundScanMode),
1248 pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001249
1250 /* Since scan req always requires a response, we will overwrite response required here.
1251 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1252 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1253 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1254 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1255 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1256 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1257 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1258 * the global flag gLimRspReqd to TRUE here.
1259 */
1260 pMac->lim.gLimRspReqd = TRUE;
1261
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301262 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1264
Abhishek Singhdaf95742015-10-13 14:53:21 +05301265 /* Check if scan req is not valid or link is already suspended*/
1266 if (!limIsSmeScanReqValid(pMac, pScanReq) || limIsLinkSuspended(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001267 {
Abhishek Singhdaf95742015-10-13 14:53:21 +05301268 limLog(pMac, LOGE,
1269 FL("Received SME_SCAN_REQ with invalid params or link is suspended %d"),
1270 limIsLinkSuspended(pMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001271
1272 if (pMac->lim.gLimRspReqd)
1273 {
1274 pMac->lim.gLimRspReqd = false;
1275
1276 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1277
1278 } // if (pMac->lim.gLimRspReqd)
1279
1280 return;
1281 }
1282
1283 //if scan is disabled then return as invalid scan request.
1284 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1285 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1286 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301287 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1288 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001289 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 return;
1291 }
1292
1293
1294 /**
1295 * If scan request is received in idle, joinFailed
1296 * states or in link established state (in STA role)
1297 * or in normal state (in STA-in-IBSS/AP role) with
1298 * 'return fresh scan results' request from HDD or
1299 * it is periodic background scanning request,
1300 * trigger fresh scan request to MLM
1301 */
1302 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1303 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301304 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1305 {
1306 // Discard previously cached scan results
1307 limReInitScanResults(pMac);
1308 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001309
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301310 pMac->lim.gLim24Band11dScanDone = 0;
1311 pMac->lim.gLim50Band11dScanDone = 0;
1312 pMac->lim.gLimReturnAfterFirstMatch =
1313 pScanReq->returnAfterFirstMatch;
1314 pMac->lim.gLimBackgroundScanMode =
1315 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001316
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301317 pMac->lim.gLimReturnUniqueResults =
1318 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1319 /* De-activate Heartbeat timers for connected sessions while
1320 * scan is in progress if the system is in Active mode *
1321 * AND it is not a ROAMING ("background") scan */
1322 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1323 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1324 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1325 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1326 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001327 for(i=0;i<pMac->lim.maxBssId;i++)
1328 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301329 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1330 (pMac->lim.gpSession[i].valid == TRUE) &&
1331 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1332 {
1333 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1334 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301336 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001337
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301338 if (pMac->fScanOffload)
1339 {
1340 if (eHAL_STATUS_SUCCESS !=
1341 limSendHalStartScanOffloadReq(pMac, pScanReq))
1342 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301343 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301344 limSendSmeScanRsp(pMac,
1345 offsetof(tSirSmeScanRsp, bssDescription[0]),
1346 eSIR_SME_INVALID_PARAMETERS,
1347 pScanReq->sessionId,
1348 pScanReq->transactionId);
1349 return;
1350 }
1351 }
1352 else
1353 {
1354
1355 /*Change Global SME state */
1356 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301357 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301358 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1359 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1360 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1361
1362 if (pScanReq->channelList.numChannels == 0)
1363 {
1364 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301365
1366 limLog(pMac, LOG1,
1367 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301368 // Scan all channels
1369 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1371 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301372 pMlmScanReq = vos_mem_malloc(len);
1373 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301374 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301375 // Log error
1376 limLog(pMac, LOGP,
1377 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001378
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301379 if (pMac->lim.gLimRspReqd)
1380 {
1381 pMac->lim.gLimRspReqd = false;
1382
1383 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1384 eSIR_SME_RESOURCES_UNAVAILABLE,
1385 pScanReq->sessionId,
1386 pScanReq->transactionId);
1387 }
1388
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301389 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301390 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301392 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301393 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001394
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301395 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1396 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 pMlmScanReq->channelList.channelNumber,
1398 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301399 {
1400 /**
1401 * Could not get Valid channel list from CFG.
1402 * Log error.
1403 */
1404 limLog(pMac, LOGP,
1405 FL("could not retrieve Valid channel list"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301406
1407 if (pMac->lim.gLimRspReqd)
1408 {
1409 pMac->lim.gLimRspReqd = false;
1410
1411 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1412 eSIR_SME_INVALID_PARAMETERS,
1413 pScanReq->sessionId,
1414 pScanReq->transactionId);
1415 }
Abhishek Singh2b055852015-10-07 14:14:13 +05301416 vos_mem_free(pMlmScanReq);
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301417 return;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301418 }
1419 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301420
1421 //Ignore DFS channels if DFS scan is disabled
1422 if(pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED)
1423 {
1424 tANI_U8 numChan = 0;
1425 tANI_U8 channel_state;
1426 tANI_U8 *chan_ptr = pMlmScanReq->channelList.channelNumber;
1427
1428 limLog(pMac, LOG1,
1429 FL("Ignore DFS channels from valid channel list"));
1430
1431 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1432 pMlmScanReq->channelList.channelNumber,
1433 pMlmScanReq->channelList.numChannels);
1434
1435 //Filter DFS channels
1436 for (i = 0; i < cfg_len; i++)
1437 {
1438 channel_state =
1439 vos_nv_getChannelEnabledState(*(chan_ptr + i));
1440
1441 //Allow channel if not DFS
1442 if(channel_state != NV_CHANNEL_DFS)
1443 {
1444 *(chan_ptr + numChan) = *(chan_ptr + i);
1445 numChan++;
1446 }
1447 }
1448 pMlmScanReq->channelList.numChannels = (tANI_U8) numChan;
1449
1450 limLog(pMac, LOG1, FL("No of valid channels %d, No of"
1451 "channels after filtering %d"), cfg_len, numChan);
1452
1453 limLog(pMac, LOG1, FL("Channel list after filtering: "));
1454
1455 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1456 pMlmScanReq->channelList.channelNumber,
1457 pMlmScanReq->channelList.numChannels);
1458 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301459 }
1460 else
1461 {
1462 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1463 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1464 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001465
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301466 pMlmScanReq = vos_mem_malloc(len);
1467 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301468 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301469 // Log error
1470 limLog(pMac, LOGP,
1471 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001472
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301473 if (pMac->lim.gLimRspReqd)
1474 {
1475 pMac->lim.gLimRspReqd = false;
1476
1477 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1478 eSIR_SME_RESOURCES_UNAVAILABLE,
1479 pScanReq->sessionId,
1480 pScanReq->transactionId);
1481 }
1482
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301483 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301484 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001485
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301486 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301487 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301488 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301489 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001490
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301491 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1492 pScanReq->channelList.channelNumber,
1493 pScanReq->channelList.numChannels);
1494 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001495
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301496 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1497 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1498 if(pScanReq->uIEFieldLen)
1499 {
1500 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1501 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1502 pScanReq->uIEFieldLen);
1503 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001504
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301505 pMlmScanReq->bssType = pScanReq->bssType;
1506 vos_mem_copy( pMlmScanReq->bssId,
1507 pScanReq->bssId,
1508 sizeof(tSirMacAddr));
1509 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001510
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301511 i = 0;
1512 while (i < pMlmScanReq->numSsid)
1513 {
1514 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 (tANI_U8 *) &pScanReq->ssId[i],
1516 pScanReq->ssId[i].length + 1);
1517
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301518 i++;
1519 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001520
Jeff Johnson295189b2012-06-20 16:38:30 -07001521
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301522 pMlmScanReq->scanType = pScanReq->scanType;
1523 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05301524 if (pMac->miracast_mode)
1525 {
1526 pMlmScanReq->minChannelTime = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST;
1527 pMlmScanReq->maxChannelTime = DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
1528 }
1529 else
1530 {
1531 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1532 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1533 }
1534
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301535 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1536 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1537 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1538 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001539
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301540 //Store the smeSessionID and transaction ID for later use.
1541 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1542 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001543
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301544 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301545 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301546 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1547 }
1548 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001549
1550 else
1551 {
1552 /// In all other cases return 'cached' scan results
1553 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1554 {
1555 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1556
1557 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001558#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1559 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001561 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1562 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1563 {
1564 limSendSmeLfrScanRsp(pMac, scanRspLen,
1565 eSIR_SME_SUCCESS,
1566 pScanReq->sessionId,
1567 pScanReq->transactionId);
1568 }
1569 else
1570 {
1571 scanRspLen = sizeof(tSirSmeScanRsp) +
1572 pMac->lim.gLimSmeLfrScanResultLength -
1573 sizeof(tSirBssDescription);
1574 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1575 pScanReq->sessionId, pScanReq->transactionId);
1576 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 }
1578 else
1579 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001580#endif
1581 if (pMac->lim.gLimSmeScanResultLength == 0)
1582 {
1583 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1584 pScanReq->sessionId, pScanReq->transactionId);
1585 }
1586 else
1587 {
1588 scanRspLen = sizeof(tSirSmeScanRsp) +
1589 pMac->lim.gLimSmeScanResultLength -
1590 sizeof(tSirBssDescription);
1591 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1592 pScanReq->sessionId, pScanReq->transactionId);
1593 }
1594#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001596#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301597 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001598
1599 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1600 {
1601 // Discard previously cached scan results
1602 limReInitScanResults(pMac);
1603 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001604#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1605 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1606 {
1607 // Discard previously cached scan results
1608 limReInitLfrScanResults(pMac);
1609 }
1610#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001611
1612 } // if (pMac->lim.gLimRspReqd)
1613 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1614
Jeff Johnson295189b2012-06-20 16:38:30 -07001615#ifdef BACKGROUND_SCAN_ENABLED
1616 // start background scans if needed
1617 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1618 __limBackgroundScanInitiate(pMac);
1619#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001620
1621} /*** end __limProcessSmeScanReq() ***/
1622
Jeff Johnsone7245742012-09-05 17:12:55 -07001623#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001624
Jeff Johnsone7245742012-09-05 17:12:55 -07001625static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1626{
1627 tpSirOemDataReq pOemDataReq;
1628 tLimMlmOemDataReq* pMlmOemDataReq;
1629
1630 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1631
1632 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301633 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1634 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001635 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301636 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001637 return;
1638 }
1639
1640 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301641 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001642
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301643 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1644 sizeof(tSirMacAddr));
1645 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1646 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001647
1648 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1649 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1650
1651 return;
1652
1653} /*** end __limProcessSmeOemDataReq() ***/
1654
1655#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001656
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301657/**
1658 * __limProcessClearDfsChannelList()
1659 *
1660 *FUNCTION:
1661 *Clear DFS channel list when country is changed/aquired.
1662.*This message is sent from SME.
1663 *
1664 *LOGIC:
1665 *
1666 *ASSUMPTIONS:
1667 *
1668 *NOTE:
1669 *
1670 * @param pMac Pointer to Global MAC structure
1671 * @param *pMsgBuf A pointer to the SME message buffer
1672 * @return None
1673 */
1674static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1675 tpSirMsgQ pMsg)
1676{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301677 vos_mem_set( &pMac->lim.dfschannelList,
1678 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301679}
Jeff Johnson295189b2012-06-20 16:38:30 -07001680
1681/**
1682 * __limProcessSmeJoinReq()
1683 *
1684 *FUNCTION:
1685 * This function is called to process SME_JOIN_REQ message
1686 * from HDD or upper layer application.
1687 *
1688 *LOGIC:
1689 *
1690 *ASSUMPTIONS:
1691 *
1692 *NOTE:
1693 *
1694 * @param pMac Pointer to Global MAC structure
1695 * @param *pMsgBuf A pointer to the SME message buffer
1696 * @return None
1697 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001698static void
1699__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1700{
1701 // tANI_U8 *pBuf;
1702 //tANI_U32 len;
1703// tSirMacAddr currentBssId;
1704 tpSirSmeJoinReq pSmeJoinReq = NULL;
1705 tLimMlmJoinReq *pMlmJoinReq;
1706 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1707 tANI_U32 val = 0;
1708 tANI_U16 nSize;
1709 tANI_U8 sessionId;
1710 tpPESession psessionEntry = NULL;
1711 tANI_U8 smesessionId;
1712 tANI_U16 smetransactionId;
1713 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301714 tANI_U16 ieLen;
1715 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001716
1717#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1718 //Not sending any session, since it is not created yet. The response whould have correct state.
1719 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1720#endif //FEATURE_WLAN_DIAG_SUPPORT
1721
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301722 limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001723
1724#ifdef WLAN_FEATURE_VOWIFI
1725 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1726 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1727 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1728 * like not honoring power constraint on 1st association after driver loading. */
1729 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001730 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1732 val = 0;
1733#endif /* WLAN_FEATURE_VOWIFI */
1734
1735 /**
1736 * Expect Join request in idle state.
1737 * Reassociate request is expected in link established state.
1738 */
1739
1740 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1741 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1742 {
1743 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301744
1745 pSmeJoinReq = vos_mem_malloc(nSize);
1746 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301748 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1749 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1751 goto end;
1752 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301753 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001754
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1756 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1757 {
1758 /// Received invalid eWNI_SME_JOIN_REQ
1759 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301760 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1761 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001762 retCode = eSIR_SME_INVALID_PARAMETERS;
1763 goto end;
1764 }
1765
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301766 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001767
1768 /* check for the existence of start BSS session */
1769#ifdef FIXME_GEN6
1770 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1771 {
1772 if(peValidateBtJoinRequest(pMac)!= TRUE)
1773 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301774 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1775 "not present::SME_JOIN_REQ in unexpected state"),
1776 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1778 psessionEntry = NULL;
1779 goto end;
1780 }
1781 }
1782
1783#endif
1784
1785
1786 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1787 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301788 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
Sushant Kaushik1b645382014-10-13 16:39:36 +05301789 MAC_ADDRESS_STR" in limSmeState = %d"),sessionId,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301790 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1791 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001792
1793 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1794 {
1795 // Received eWNI_SME_JOIN_REQ for same
1796 // BSS as currently associated.
1797 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301798 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1799 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001800 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301801 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1802 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 goto end;
1804 }
1805 else
1806 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301807 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1808 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001809 retCode = eSIR_SME_REFUSED;
1810 psessionEntry = NULL;
1811 goto end;
1812 }
1813 }
1814 else /* Session Entry does not exist for given BSSId */
1815 {
1816 /* Try to Create a new session */
1817 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1818 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001819 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1821 goto end;
1822 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301823 else
1824 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1825 sessionId);
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301826 }
1827
1828 if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){
1829 if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){
1830 psessionEntry->is11Gonly = true;
1831 }
1832 }
1833
krunal soni5afa96c2013-09-06 22:19:02 -07001834 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001835
Jeff Johnson295189b2012-06-20 16:38:30 -07001836 /* Store Session related parameters */
1837 /* Store PE session Id in session Table */
1838 psessionEntry->peSessionId = sessionId;
1839
1840 /* store the smejoin req handle in session table */
1841 psessionEntry->pLimJoinReq = pSmeJoinReq;
1842
1843 /* Store SME session Id in sessionTable */
1844 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1845
1846 /* Store SME transaction Id in session Table */
1847 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1848
1849 /* Store beaconInterval */
1850 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1851
1852 /* Copying of bssId is already done, while creating session */
1853 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1854 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1855 psessionEntry->bssType = pSmeJoinReq->bsstype;
1856
1857 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301858 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1859 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301860 psessionEntry->bOSENAssociation = pSmeJoinReq->bOSENAssociation;
Abhishek Singheef5c992016-01-27 13:41:54 +05301861 psessionEntry->bWPSAssociation = pSmeJoinReq->bWPSAssociation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001862
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301863 /* Store vendor specfic IE for CISCO AP */
1864 ieLen = (pSmeJoinReq->bssDescription.length +
1865 sizeof( pSmeJoinReq->bssDescription.length ) -
1866 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1867
1868 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1869 SIR_MAC_CISCO_OUI_SIZE,
1870 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1871
1872 if ( NULL != vendorIE )
1873 {
1874 limLog(pMac, LOGE,
1875 FL("DUT is trying to connect to Cisco AP"));
1876 psessionEntry->isCiscoVendorAP = TRUE;
1877 }
1878 else
1879 {
1880 psessionEntry->isCiscoVendorAP = FALSE;
1881 }
1882
Jeff Johnson295189b2012-06-20 16:38:30 -07001883 /* Copy the dot 11 mode in to the session table */
1884
1885 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1886 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001887#ifdef WLAN_FEATURE_11AC
1888 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001889 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001890 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001891 if (psessionEntry->vhtCapability )
1892 {
1893 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1894
1895 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001896 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001897 psessionEntry->txBFIniFeatureEnabled);
1898
1899 if( psessionEntry->txBFIniFeatureEnabled )
1900 {
1901 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1902 != eSIR_SUCCESS)
1903 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301904 limLog(pMac, LOGP, FL("could not set "
1905 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001906 retCode = eSIR_LOGP_EXCEPTION;
1907 goto end;
1908 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001909 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301910 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1911 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001912
1913 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001914 != eSIR_SUCCESS)
1915 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301916 limLog(pMac, LOGP, FL("could not set "
1917 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001918 retCode = eSIR_LOGP_EXCEPTION;
1919 goto end;
1920 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301921
1922 if ( FALSE == pMac->isMuBfsessionexist )
1923 psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001924 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301925
1926 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1927 "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d",
1928 pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee);
1929
1930 if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee)
1931 != eSIR_SUCCESS)
1932 {
1933 limLog(pMac, LOGE, FL("could not set "
1934 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
1935 retCode = eSIR_LOGP_EXCEPTION;
1936 goto end;
1937 }
1938
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001939 }
1940
Jeff Johnsone7245742012-09-05 17:12:55 -07001941#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001942
1943 /*Phy mode*/
1944 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1945
Abhishek Singhca6ec5d2015-06-24 13:13:27 +05301946 handleHTCapabilityandHTInfo(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 /* Copy The channel Id to the session Table */
1948 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001949 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1950 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1951 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001952
Chet Lanctot186b5732013-03-18 10:26:30 -07001953 /* Record if management frames need to be protected */
1954#ifdef WLAN_FEATURE_11W
1955 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1956 {
1957 psessionEntry->limRmfEnabled = 1;
1958 }
1959 else
1960 {
1961 psessionEntry->limRmfEnabled = 0;
1962 }
1963#endif
1964
krunal soni8d13b092013-07-19 13:23:29 -07001965#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1966 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1967#endif
1968
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 /*Store Persona */
1970 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1971 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301972 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1973 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001974
1975 /* Copy the SSID from smejoinreq to session entry */
1976 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301977 vos_mem_copy( psessionEntry->ssId.ssId,
1978 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1979
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001980 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301981 // which inturn is dependent on the profile the user wants to connect
1982 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001983#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301984 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001985#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001986#ifdef FEATURE_WLAN_ESE
1987 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001988#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001989#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301990 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001991#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301992
Jeff Johnson43971f52012-07-17 12:26:56 -07001993#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301994 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001995#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301996 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001997
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301998 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302000 psessionEntry->limSystemRole = eLIM_STA_ROLE;
2001 }
2002 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
2003 {
2004 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
2005 }
2006 else
2007 {
2008 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05302009 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
2010 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302011 retCode = eSIR_SME_INVALID_PARAMETERS;
2012 goto end;
2013 }
2014
2015 if (pSmeJoinReq->addIEScan.length)
2016 {
2017 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07002018 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
2019 }
2020
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302021 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302023 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
2025 }
2026
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302028 pMlmJoinReq = vos_mem_malloc(val);
2029 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302031 limLog(pMac, LOGP, FL("call to AllocateMemory "
2032 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 return;
2034 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302035 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002036
2037 /* PE SessionId is stored as a part of JoinReq*/
2038 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
2039
2040 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
2041 != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302042 {
2043 limLog(pMac, LOGE, FL("could not retrieve JoinFailureTimer value "
2044 "setting it to default value"));
2045 pMlmJoinReq->joinFailureTimeout = JOIN_FAILURE_TIMEOUT;
2046 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002047
2048 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302049 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302051 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 sizeof(tSirMacRateSet));
2053 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302054 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 sizeof(tSirMacRateSet));
2056
2057 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
2058
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
2060
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302061 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
2063 psessionEntry->pLimJoinReq->bssDescription.length + 2);
2064
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07002066 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002067
Jeff Johnsone7245742012-09-05 17:12:55 -07002068 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302069 localPowerConstraint = regMax;
Jeff Johnsone7245742012-09-05 17:12:55 -07002070 limExtractApCapability( pMac,
2071 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
2072 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
2073 &psessionEntry->limCurrentBssQosCaps,
2074 &psessionEntry->limCurrentBssPropCap,
2075 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002076 , &localPowerConstraint,
2077 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302078 );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302079
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002080#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002081 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07002082#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302083 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002084#endif
Sushant Kaushikece4b562015-04-09 18:27:33 +05302085 if (!psessionEntry->maxTxPower)
2086 {
2087 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power"
2088 "is zero. Setting it to default value %d"),
2089 TX_POWER_DEFAULT);
2090 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2091 }
2092
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302093 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2094 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05302095 " max tx = %d", regMax, localPowerConstraint,
2096 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002097
2098 if (pMac->lim.gLimCurrentBssUapsd)
2099 {
2100 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302101 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2102 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002103
2104 // resetting the dynamic uapsd mask
2105 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
2106 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
2107 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002108
2109 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
2110
2111 // Initialize 11h Enable Flag
2112 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
2113 {
2114 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302115 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002116 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302117 psessionEntry->lim11hEnable = 1;
2118 }
2119 else
2120 psessionEntry->lim11hEnable = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 }
2122 else
2123 psessionEntry->lim11hEnable = 0;
2124
2125 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2126 pMac->lim.gLimIbssCoalescingHappened = false;
2127
Jeff Johnsone7245742012-09-05 17:12:55 -07002128 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2129 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2130 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002131
Abhishek Singh57aebef2014-02-03 18:47:44 +05302132 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2133 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2134 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2135 psessionEntry->currentOperChannel,
2136 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002137
2138 /* Indicate whether spectrum management is enabled*/
2139 psessionEntry->spectrumMgtEnabled =
2140 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302141
2142 /* Enable the spectrum management if this is a DFS channel */
2143 if (psessionEntry->countryInfoPresent &&
2144 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2145 {
2146 psessionEntry->spectrumMgtEnabled = TRUE;
2147 }
2148
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302149 limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
2150 "SM"), pMlmJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 /* Issue LIM_MLM_JOIN_REQ to MLM */
2152 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2153 return;
2154
2155 }
2156 else
2157 {
2158 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302159 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
Sushant Kaushik1b645382014-10-13 16:39:36 +05302160 "in state %d"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2162 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2163 psessionEntry = NULL;
2164 goto end;
2165
2166 }
2167
2168end:
2169 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2170
2171 if(pSmeJoinReq)
2172 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302173 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 pSmeJoinReq = NULL;
2175 if (NULL != psessionEntry)
2176 {
2177 psessionEntry->pLimJoinReq = NULL;
2178 }
2179 }
2180
2181 if(retCode != eSIR_SME_SUCCESS)
2182 {
2183 if(NULL != psessionEntry)
2184 {
2185 peDeleteSession(pMac,psessionEntry);
2186 psessionEntry = NULL;
2187 }
2188 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302189 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2190 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2192} /*** end __limProcessSmeJoinReq() ***/
2193
2194
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002195#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002196tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002197{
2198 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302199 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002200 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2202 maxTxPower = txPower;
2203 else if (txPower < MIN_TX_PWR_CAP)
2204 maxTxPower = MIN_TX_PWR_CAP;
2205 else
2206 maxTxPower = MAX_TX_PWR_CAP;
2207
2208 return (maxTxPower);
2209}
2210#endif
2211
Jeff Johnson295189b2012-06-20 16:38:30 -07002212/**
2213 * __limProcessSmeReassocReq()
2214 *
2215 *FUNCTION:
2216 * This function is called to process SME_REASSOC_REQ message
2217 * from HDD or upper layer application.
2218 *
2219 *LOGIC:
2220 *
2221 *ASSUMPTIONS:
2222 *
2223 *NOTE:
2224 *
2225 * @param pMac Pointer to Global MAC structure
2226 * @param *pMsgBuf A pointer to the SME message buffer
2227 * @return None
2228 */
2229
2230static void
2231__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2232{
2233 tANI_U16 caps;
2234 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002235 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 tLimMlmReassocReq *pMlmReassocReq;
2237 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2238 tpPESession psessionEntry = NULL;
2239 tANI_U8 sessionId;
2240 tANI_U8 smeSessionId;
2241 tANI_U16 transactionId;
2242 tPowerdBm localPowerConstraint = 0, regMax = 0;
2243 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002244 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002245
2246
Abhishek Singh127a8442014-12-15 17:31:27 +05302247 limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002249 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302250 pReassocReq = vos_mem_malloc(nSize);
2251 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 {
2253 // Log error
2254 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302255 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002256
2257 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2258 goto end;
2259 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302260 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2262 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2263 (!limIsSmeJoinReqValid(pMac,
2264 (tpSirSmeJoinReq) pReassocReq)))
2265 {
2266 /// Received invalid eWNI_SME_REASSOC_REQ
2267 // Log the event
2268 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002269 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002270
2271 retCode = eSIR_SME_INVALID_PARAMETERS;
2272 goto end;
2273 }
2274
2275 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2276 {
2277 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002278 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 retCode = eSIR_SME_INVALID_PARAMETERS;
2280 goto end;
2281 }
2282
Sushant Kaushikb97a0082015-08-31 12:36:45 +05302283#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Deepthi Gowri639d5042015-11-16 20:23:39 +05302284 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry,
2285 eSIR_SUCCESS, eSIR_SUCCESS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002286#endif //FEATURE_WLAN_DIAG_SUPPORT
2287 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2288
2289 /* Store the reassoc handle in the session Table.. 23rd sep review */
2290 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302291 psessionEntry->dot11mode = pReassocReq->dot11mode;
2292 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002293
2294 /**
2295 * Reassociate request is expected
2296 * in link established state only.
2297 */
2298
2299 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2300 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002301#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2303 {
2304 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002305 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 psessionEntry->peSessionId);
2307
2308 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302309 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2311 {
2312 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2313 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002314 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 retCode = eSIR_SME_INVALID_PARAMETERS;
2316 goto end;
2317 }
2318
2319 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2320 return;
2321 }
2322#endif
2323 /// Should not have received eWNI_SME_REASSOC_REQ
2324 // Log the event
2325 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302326 FL("received unexpected SME_REASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 psessionEntry->limSmeState);
2328 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2329
2330 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2331 goto end;
2332 }
2333
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302334 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2336 sizeof(tSirMacAddr));
2337
2338 psessionEntry->limReassocChannelId =
2339 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2340
Jeff Johnsone7245742012-09-05 17:12:55 -07002341 psessionEntry->reAssocHtSupportedChannelWidthSet =
2342 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2343 psessionEntry->reAssocHtRecommendedTxWidthSet =
2344 psessionEntry->reAssocHtSupportedChannelWidthSet;
2345 psessionEntry->reAssocHtSecondaryChannelOffset =
2346 psessionEntry->pLimReAssocReq->cbMode;
2347
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 psessionEntry->limReassocBssCaps =
2349 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2351 localPowerConstraint = regMax;
2352 limExtractApCapability( pMac,
2353 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2354 limGetIElenFromBssDescription(
2355 &psessionEntry->pLimReAssocReq->bssDescription),
2356 &psessionEntry->limReassocBssQosCaps,
2357 &psessionEntry->limReassocBssPropCap,
2358 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002359 , &localPowerConstraint,
2360 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 );
2362
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302363 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Sushant Kaushikece4b562015-04-09 18:27:33 +05302364 if (!psessionEntry->maxTxPower)
2365 {
2366 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power "
2367 "is zero. Setting it to default value %d"),
2368 TX_POWER_DEFAULT);
2369 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2370 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002371#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302372 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2373 "= %d, max tx = %d", regMax, localPowerConstraint,
2374 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002375#endif
2376 {
2377 #if 0
2378 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2379 &cfgLen) != eSIR_SUCCESS)
2380 {
2381 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002382 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 }
2384 #endif//TO SUPPORT BT-AMP
2385
2386 /* Copy the SSID from sessio entry to local variable */
2387 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302388 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002389 psessionEntry->ssId.ssId,
2390 psessionEntry->ssId.length);
2391 #endif
2392 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302393 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002394 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2395
2396 }
2397
2398 if (pMac->lim.gLimCurrentBssUapsd)
2399 {
2400 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302401 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2402 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 }
2404
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302405 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2406 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 {
2408 // Log error
2409 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302410 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002411
2412 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2413 goto end;
2414 }
2415
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302416 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002417 psessionEntry->limReAssocbssId,
2418 sizeof(tSirMacAddr));
2419
2420 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2421 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2422 != eSIR_SUCCESS)
2423 {
2424 /**
2425 * Could not get ReassocFailureTimeout value
2426 * from CFG. Log error.
2427 */
2428 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002429 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 }
2431
2432 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2433 {
2434 /**
2435 * Could not get Capabilities value
2436 * from CFG. Log error.
2437 */
2438 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002439 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002440 }
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05302441
2442 lim_update_caps_info_for_bss(pMac, &caps,
2443 pReassocReq->bssDescription.capabilityInfo);
2444
2445 limLog(pMac, LOG1, FL("Capabilities info Reassoc: 0x%X"), caps);
2446
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 pMlmReassocReq->capabilityInfo = caps;
2448
2449 /* Update PE sessionId*/
2450 pMlmReassocReq->sessionId = sessionId;
2451
2452 /* If telescopic beaconing is enabled, set listen interval to
2453 WNI_CFG_TELE_BCN_MAX_LI */
2454 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2455 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002456 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002457
2458 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2459
2460 if(teleBcnEn)
2461 {
2462 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2463 eSIR_SUCCESS)
2464 {
2465 /**
2466 * Could not get ListenInterval value
2467 * from CFG. Log error.
2468 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002469 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 }
2471 }
2472 else
2473 {
2474 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2475 {
2476 /**
2477 * Could not get ListenInterval value
2478 * from CFG. Log error.
2479 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002480 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 }
2482 }
2483
2484 /* Delete all BA sessions before Re-Assoc.
2485 * BA frames are class 3 frames and the session
2486 * is lost upon disassociation and reassociation.
2487 */
2488
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302489 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2490 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002491
2492 pMlmReassocReq->listenInterval = (tANI_U16) val;
2493
2494 /* Indicate whether spectrum management is enabled*/
2495 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2496
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302497 /* Enable the spectrum management if this is a DFS channel */
2498 if (psessionEntry->countryInfoPresent &&
2499 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2500 {
2501 psessionEntry->spectrumMgtEnabled = TRUE;
2502 }
2503
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2505 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2506
Jeff Johnsone7245742012-09-05 17:12:55 -07002507 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002508
2509 limPostMlmMessage(pMac,
2510 LIM_MLM_REASSOC_REQ,
2511 (tANI_U32 *) pMlmReassocReq);
2512 return;
2513
2514end:
2515 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302516 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002517
2518 if (psessionEntry)
2519 {
2520 // error occurred after we determined the session so extract
2521 // session and transaction info from there
2522 smeSessionId = psessionEntry->smeSessionId;
2523 transactionId = psessionEntry->transactionId;
2524 }
2525 else
2526 {
2527 // error occurred before or during the time we determined the session
2528 // so extract the session and transaction info from the message
2529 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2530 }
2531
2532 /// Send Reassoc failure response to host
2533 /// (note psessionEntry may be NULL, but that's OK)
2534 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2535 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2536 psessionEntry, smeSessionId, transactionId);
2537
2538} /*** end __limProcessSmeReassocReq() ***/
2539
2540
2541tANI_BOOLEAN sendDisassocFrame = 1;
2542/**
2543 * __limProcessSmeDisassocReq()
2544 *
2545 *FUNCTION:
2546 * This function is called to process SME_DISASSOC_REQ message
2547 * from HDD or upper layer application.
2548 *
2549 *LOGIC:
2550 *
2551 *ASSUMPTIONS:
2552 *
2553 *NOTE:
2554 *
2555 * @param pMac Pointer to Global MAC structure
2556 * @param *pMsgBuf A pointer to the SME message buffer
2557 * @return None
2558 */
2559
2560static void
2561__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2562{
2563 tANI_U16 disassocTrigger, reasonCode;
2564 tLimMlmDisassocReq *pMlmDisassocReq;
2565 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002566 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 tSirSmeDisassocReq smeDisassocReq;
2568 tpPESession psessionEntry = NULL;
2569 tANI_U8 sessionId;
2570 tANI_U8 smesessionId;
2571 tANI_U16 smetransactionId;
2572
Jeff Johnson295189b2012-06-20 16:38:30 -07002573
Jeff Johnson43971f52012-07-17 12:26:56 -07002574 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002575 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002576 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 return;
2578 }
2579
Jeff Johnson43971f52012-07-17 12:26:56 -07002580 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002581
Jeff Johnson43971f52012-07-17 12:26:56 -07002582 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002583
Jeff Johnson43971f52012-07-17 12:26:56 -07002584 if ( (eSIR_FAILURE == status) ||
2585 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 {
2587 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002588 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002589
2590 if (pMac->lim.gLimRspReqd)
2591 {
2592 pMac->lim.gLimRspReqd = false;
2593
2594 retCode = eSIR_SME_INVALID_PARAMETERS;
2595 disassocTrigger = eLIM_HOST_DISASSOC;
2596 goto sendDisassoc;
2597 }
2598
2599 return;
2600 }
2601
Jeff Johnson295189b2012-06-20 16:38:30 -07002602 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2603 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302604 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2605 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 retCode = eSIR_SME_INVALID_PARAMETERS;
2607 disassocTrigger = eLIM_HOST_DISASSOC;
2608 goto sendDisassoc;
2609
2610 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302611 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2612 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2613 smesessionId,psessionEntry->limSystemRole,
2614 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2615 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002616
2617#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2618 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2619#endif //FEATURE_WLAN_DIAG_SUPPORT
2620
2621 /* Update SME session Id and SME transaction ID*/
2622
2623 psessionEntry->smeSessionId = smesessionId;
2624 psessionEntry->transactionId = smetransactionId;
2625
2626 switch (psessionEntry->limSystemRole)
2627 {
2628 case eLIM_STA_ROLE:
2629 case eLIM_BT_AMP_STA_ROLE:
2630 switch (psessionEntry->limSmeState)
2631 {
2632 case eLIM_SME_ASSOCIATED_STATE:
2633 case eLIM_SME_LINK_EST_STATE:
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05302634 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2635 "limSmeState: %d "),psessionEntry->limSmeState);
2636
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2638 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002639#ifdef FEATURE_WLAN_TDLS
2640 /* Delete all TDLS peers connected before leaving BSS*/
2641 limDeleteTDLSPeers(pMac, psessionEntry);
2642#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002643 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 break;
2645
2646 case eLIM_SME_WT_DEAUTH_STATE:
2647 /* PE shall still process the DISASSOC_REQ and proceed with
2648 * link tear down even if it had already sent a DEAUTH_IND to
2649 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2650 * its been set when PE entered WT_DEAUTH_STATE.
2651 */
2652 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002653 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302654 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2655 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 break;
2657
2658 case eLIM_SME_WT_DISASSOC_STATE:
2659 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2660 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2661 * PE can continue processing DISASSOC_REQ and send the response instead
2662 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2663 * for disassoc frame.
2664 *
2665 * It will send a disassoc, which is ok. However, we can use the global flag
2666 * sendDisassoc to not send disassoc frame.
2667 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302668 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2669 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002670 break;
2671
2672 case eLIM_SME_JOIN_FAILURE_STATE: {
2673 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302674 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2675 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 if (pMac->lim.gLimRspReqd) {
2677 retCode = eSIR_SME_SUCCESS;
2678 disassocTrigger = eLIM_HOST_DISASSOC;
2679 goto sendDisassoc;
2680 }
2681 }break;
2682 default:
2683 /**
2684 * STA is not currently associated.
2685 * Log error and send response to host
2686 */
2687 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302688 FL("received unexpected SME_DISASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 psessionEntry->limSmeState);
2690 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2691
2692 if (pMac->lim.gLimRspReqd)
2693 {
2694 if (psessionEntry->limSmeState !=
2695 eLIM_SME_WT_ASSOC_STATE)
2696 pMac->lim.gLimRspReqd = false;
2697
2698 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2699 disassocTrigger = eLIM_HOST_DISASSOC;
2700 goto sendDisassoc;
2701 }
2702
2703 return;
2704 }
2705
2706 break;
2707
2708 case eLIM_AP_ROLE:
2709 case eLIM_BT_AMP_AP_ROLE:
2710 // Fall through
2711 break;
2712
2713 case eLIM_STA_IN_IBSS_ROLE:
2714 default: // eLIM_UNKNOWN_ROLE
2715 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002716 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 psessionEntry->limSystemRole);
2718
2719 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2720 disassocTrigger = eLIM_HOST_DISASSOC;
2721 goto sendDisassoc;
2722 } // end switch (pMac->lim.gLimSystemRole)
2723
Edhar, Mahesh Kumar03cf7ff2015-11-26 17:59:29 +05302724 disassocTrigger = eLIM_HOST_DISASSOC;
2725 reasonCode = smeDisassocReq.reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002726
2727 if (smeDisassocReq.doNotSendOverTheAir)
2728 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302729 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 sendDisassocFrame = 0;
2731 }
2732 // Trigger Disassociation frame to peer MAC entity
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302733 limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger"
2734 " : %d, reasonCode : %d"),
2735 disassocTrigger, reasonCode);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302736 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2737 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002738 {
2739 // Log error
2740 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302741 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002742
2743 return;
2744 }
2745
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302746 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002747 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2748 sizeof(tSirMacAddr));
2749
2750 pMlmDisassocReq->reasonCode = reasonCode;
2751 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2752
2753 /* Update PE session ID*/
2754 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002755
2756 limPostMlmMessage(pMac,
2757 LIM_MLM_DISASSOC_REQ,
2758 (tANI_U32 *) pMlmDisassocReq);
2759 return;
2760
2761sendDisassoc:
2762 if (psessionEntry)
2763 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2764 retCode,
2765 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002766 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 else
2768 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2769 retCode,
2770 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002771 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002772
2773
2774} /*** end __limProcessSmeDisassocReq() ***/
2775
2776
2777/** -----------------------------------------------------------------
2778 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2779
2780 This function is called to process SME_DISASSOC_CNF message
2781 from HDD or upper layer application.
2782
2783 \param pMac - global mac structure
2784 \param pStaDs - station dph hash node
2785 \return none
2786 \sa
2787 ----------------------------------------------------------------- */
2788static void
2789__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2790{
2791 tSirSmeDisassocCnf smeDisassocCnf;
2792 tANI_U16 aid;
2793 tpDphHashNode pStaDs;
2794 tSirRetStatus status = eSIR_SUCCESS;
2795 tpPESession psessionEntry;
2796 tANI_U8 sessionId;
2797
2798
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302799 limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002800
2801 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2802
2803 if (status == eSIR_FAILURE)
2804 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002805 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 return;
2807 }
2808
2809 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2810 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002811 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 return;
2813 }
2814
2815 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2816 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302817 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 return;
2819 }
2820
2821#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2822 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2823 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2824 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2825 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2826#endif //FEATURE_WLAN_DIAG_SUPPORT
2827
2828 switch (psessionEntry->limSystemRole)
2829 {
2830 case eLIM_STA_ROLE:
2831 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2832 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2833 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2834 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2835 {
2836 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302837 FL("received unexp SME_DISASSOC_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002838 psessionEntry->limSmeState);
2839 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2840 return;
2841 }
2842 break;
2843
2844 case eLIM_AP_ROLE:
2845 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002847
2848 case eLIM_STA_IN_IBSS_ROLE:
2849 default: // eLIM_UNKNOWN_ROLE
2850 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002851 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002852 psessionEntry->limSystemRole);
2853
2854 return;
2855 }
2856
2857
2858 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2859 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002860 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 )
2862 {
2863 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2864 if (pStaDs == NULL)
2865 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302866 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2867 "does not have context, addr= "MAC_ADDRESS_STR),
2868 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 return;
2870 }
Wu Gao742b7352015-10-16 19:10:40 +08002871
2872 if(aid != smeDisassocCnf.assocId)
2873 {
2874 PELOGE(limLog(pMac, LOGE, FL("same peerMacAddr but assocId is different "
2875 "aid=%d, assocId=%d, addr= "MAC_ADDRESS_STR),
2876 aid, smeDisassocCnf.assocId, MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
2877 return;
2878 }
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05302879 /*
2880 * If MlM state is either of del_sta or del_bss state, then no need to
2881 * go ahead and clean up further as there must be some cleanup in
2882 * progress from upper layer disassoc/deauth request.
2883 */
2884 if((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
2885 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
2886 {
2887 limLog(pMac, LOGE, FL("No need to cleanup for addr:"MAC_ADDRESS_STR
2888 "as Mlm state is %d"),
2889 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr),
2890 pStaDs->mlmStaContext.mlmState);
2891 return;
2892 }
2893
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002894 /* Delete FT session if there exists one */
2895 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002896 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002897
2898 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002899 }
2900
2901 return;
2902}
2903
2904
2905/**
2906 * __limProcessSmeDeauthReq()
2907 *
2908 *FUNCTION:
2909 * This function is called to process SME_DEAUTH_REQ message
2910 * from HDD or upper layer application.
2911 *
2912 *LOGIC:
2913 *
2914 *ASSUMPTIONS:
2915 *
2916 *NOTE:
2917 *
2918 * @param pMac Pointer to Global MAC structure
2919 * @param *pMsgBuf A pointer to the SME message buffer
2920 * @return None
2921 */
2922
2923static void
2924__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2925{
2926 tANI_U16 deauthTrigger, reasonCode;
2927 tLimMlmDeauthReq *pMlmDeauthReq;
2928 tSirSmeDeauthReq smeDeauthReq;
2929 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2930 tSirRetStatus status = eSIR_SUCCESS;
2931 tpPESession psessionEntry;
2932 tANI_U8 sessionId; //PE sessionId
2933 tANI_U8 smesessionId;
2934 tANI_U16 smetransactionId;
2935
Jeff Johnson295189b2012-06-20 16:38:30 -07002936
2937 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2939
2940 //We need to get a session first but we don't even know if the message is correct.
2941 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2942 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002943 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002944 retCode = eSIR_SME_INVALID_PARAMETERS;
2945 deauthTrigger = eLIM_HOST_DEAUTH;
2946 goto sendDeauth;
2947
2948 }
2949
2950 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2951 {
Sachin Ahuja42354142015-01-06 19:48:35 +05302952 PELOGE(limLog(pMac, LOGE,FL
2953 ("received invalid SME_DEAUTH_REQ message"));)
2954 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002955
Sachin Ahuja42354142015-01-06 19:48:35 +05302956 retCode = eSIR_SME_INVALID_PARAMETERS;
2957 deauthTrigger = eLIM_HOST_DEAUTH;
2958 goto sendDeauth;
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302960 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2961 "Systemrole %d with reasoncode %u in limSmestate %d from "
2962 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2963 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2964 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002965#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2966 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2967#endif //FEATURE_WLAN_DIAG_SUPPORT
2968
2969 /* Update SME session ID and Transaction ID */
2970 psessionEntry->smeSessionId = smesessionId;
2971 psessionEntry->transactionId = smetransactionId;
2972
2973
2974 switch (psessionEntry->limSystemRole)
2975 {
2976 case eLIM_STA_ROLE:
2977 case eLIM_BT_AMP_STA_ROLE:
2978
2979 switch (psessionEntry->limSmeState)
2980 {
2981 case eLIM_SME_ASSOCIATED_STATE:
2982 case eLIM_SME_LINK_EST_STATE:
2983 case eLIM_SME_WT_ASSOC_STATE:
2984 case eLIM_SME_JOIN_FAILURE_STATE:
2985 case eLIM_SME_IDLE_STATE:
2986 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2987 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002988 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002989
2990 // Send Deauthentication request to MLM below
2991
2992 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302993 case eLIM_SME_WT_DEAUTH_STATE:
2994 /*
2995 * PE Recieved a Deauth frame. Normally it gets
2996 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2997 * means host is also trying to disconnect.
2998 * PE can continue processing DEAUTH_REQ and send
2999 * the response instead of failing the request.
3000 * SME will anyway ignore DEAUTH_IND that was sent
3001 * for deauth frame.
3002 */
3003 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
3004 "SME_WT_DEAUTH_STATE. "));
3005 break;
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05303006 case eLIM_SME_WT_DISASSOC_STATE:
3007 /*
3008 * PE Recieved a Disassoc frame. Normally it gets
3009 * DISASSOC_CNF but it received DEAUTH_REQ. This means
3010 * host is also trying to disconnect.
3011 */
3012 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
3013 "SME_WT_DISASSOC_STATE. "));
3014 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 default:
3016 /**
3017 * STA is not in a state to deauthenticate with
3018 * peer. Log error and send response to host.
3019 */
3020 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303021 FL("received unexp SME_DEAUTH_REQ in state %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303022 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3024
3025 if (pMac->lim.gLimRspReqd)
3026 {
3027 pMac->lim.gLimRspReqd = false;
3028
3029 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
3030 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08003031 /**
3032 *here we received deauth request from AP so sme state is
3033 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
3034 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
3035 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
3036 so the below condition captures the state where delSta
3037 not done and firmware still in connected state.
3038 */
3039 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
3040 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
3041 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
3042 {
3043 retCode = eSIR_SME_DEAUTH_STATUS;
3044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 goto sendDeauth;
3046 }
3047
3048 return;
3049 }
3050
3051 break;
3052
3053 case eLIM_STA_IN_IBSS_ROLE:
Abhishek Singh92fbac22015-03-24 17:57:36 +05303054 limLog(pMac, LOGE,FL("Deauth not allowed in IBSS"));
3055 if (pMac->lim.gLimRspReqd)
3056 {
3057 pMac->lim.gLimRspReqd = false;
3058 retCode = eSIR_SME_INVALID_PARAMETERS;
3059 deauthTrigger = eLIM_HOST_DEAUTH;
3060 goto sendDeauth;
3061 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003062 return;
3063
3064 case eLIM_AP_ROLE:
3065 // Fall through
3066
3067 break;
3068
3069 default:
3070 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303071 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303072 psessionEntry->limSystemRole);
Abhishek Singh92fbac22015-03-24 17:57:36 +05303073 if (pMac->lim.gLimRspReqd)
3074 {
3075 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07003076
Abhishek Singh92fbac22015-03-24 17:57:36 +05303077 retCode = eSIR_SME_INVALID_PARAMETERS;
3078 deauthTrigger = eLIM_HOST_DEAUTH;
3079 goto sendDeauth;
3080 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003081 return;
Abhishek Singh92fbac22015-03-24 17:57:36 +05303082
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 } // end switch (pMac->lim.gLimSystemRole)
3084
3085 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
3086 {
3087 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303088 limLog(pMac, LOG1,
3089 FL("Deauthentication is triggered by Link Monitoring"));
3090 limLog(pMac, LOG1,
3091 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
3092 limLog(pMac, LOG1,
3093 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003094 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
3095 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
3096 }
3097 else
3098 {
3099 deauthTrigger = eLIM_HOST_DEAUTH;
3100 reasonCode = smeDeauthReq.reasonCode;
3101 }
3102
3103 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303104 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
3105 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003106 {
3107 // Log error
Abhishek Singh92fbac22015-03-24 17:57:36 +05303108 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303109 FL("call to AllocateMemory failed for mlmDeauthReq"));
Abhishek Singh92fbac22015-03-24 17:57:36 +05303110 if (pMac->lim.gLimRspReqd)
3111 {
3112 pMac->lim.gLimRspReqd = false;
3113 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3114 deauthTrigger = eLIM_HOST_DEAUTH;
3115 goto sendDeauth;
3116 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 return;
3118 }
3119
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303120 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
3122 sizeof(tSirMacAddr));
3123
3124 pMlmDeauthReq->reasonCode = reasonCode;
3125 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07003126
3127 /* Update PE session Id*/
3128 pMlmDeauthReq->sessionId = sessionId;
3129
3130 limPostMlmMessage(pMac,
3131 LIM_MLM_DEAUTH_REQ,
3132 (tANI_U32 *) pMlmDeauthReq);
3133 return;
3134
3135sendDeauth:
3136 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
3137 retCode,
3138 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003140 smesessionId, smetransactionId);
3141} /*** end __limProcessSmeDeauthReq() ***/
3142
3143
3144
3145/**
3146 * __limProcessSmeSetContextReq()
3147 *
3148 *FUNCTION:
3149 * This function is called to process SME_SETCONTEXT_REQ message
3150 * from HDD or upper layer application.
3151 *
3152 *LOGIC:
3153 *
3154 *ASSUMPTIONS:
3155 *
3156 *NOTE:
3157 *
3158 * @param pMac Pointer to Global MAC structure
3159 * @param *pMsgBuf A pointer to the SME message buffer
3160 * @return None
3161 */
3162
3163static void
3164__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3165{
3166 tpSirSmeSetContextReq pSetContextReq;
3167 tLimMlmSetKeysReq *pMlmSetKeysReq;
3168 tpPESession psessionEntry;
3169 tANI_U8 sessionId; //PE sessionID
3170 tANI_U8 smesessionId;
3171 tANI_U16 smetransactionId;
3172
3173
3174 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003175 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003176
3177
3178 if(pMsgBuf == NULL)
3179 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003180 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003181 return;
3182 }
3183
3184 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303185
3186 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3187 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003188 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303189 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 return;
3191 }
3192
3193 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3194 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3195 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003196 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003197 goto end;
3198 }
3199
3200 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3201 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003202 PELOGE(limLog(pMac, LOGE, FL("numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS"), pSetContextReq->keyMaterial.numKeys);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003203 limSendSmeSetContextRsp(pMac,
3204 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003205 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003206 eSIR_SME_INVALID_PARAMETERS,NULL,
3207 smesessionId,smetransactionId);
3208
3209 goto end;
3210 }
3211
3212
3213 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3214 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003215 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003216 limSendSmeSetContextRsp(pMac,
3217 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003218 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 eSIR_SME_INVALID_PARAMETERS,NULL,
3220 smesessionId,smetransactionId);
3221
3222 goto end;
3223 }
3224
3225#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3226 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3227#endif //FEATURE_WLAN_DIAG_SUPPORT
3228
3229
3230 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3231 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3232 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3233 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3234 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3235 {
3236 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303237 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3238 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 {
3240 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303241 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003242 goto end;
3243 }
Abhishek Singhb25e8442015-06-23 14:28:05 +05303244 vos_mem_zero(pMlmSetKeysReq,sizeof(tLimMlmSetKeysReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3246 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3247 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3248 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003249 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 goto end;
3251 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303252 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003253 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3254 sizeof(tSirMacAddr));
3255
Jeff Johnson295189b2012-06-20 16:38:30 -07003256
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303257 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003258 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3259 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3260
3261 pMlmSetKeysReq->sessionId = sessionId;
3262#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3263 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003264 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003265#endif
3266
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3268 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3269 {
3270 if(pSetContextReq->keyMaterial.key[0].keyLength)
3271 {
3272 tANI_U8 keyId;
3273 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303274 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003275 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3276 }
3277 else {
3278 tANI_U32 i;
3279 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3280 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303281 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003282 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3283 }
3284 }
3285 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003286
3287 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 }
3289 else
3290 {
3291 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303292 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 psessionEntry->limSystemRole,
3294 psessionEntry->limSmeState);
3295 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3296
3297 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003299 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3300 smesessionId,
3301 smetransactionId);
3302 }
3303
3304end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303305 vos_mem_zero(pSetContextReq,
3306 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303307 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 return;
3309} /*** end __limProcessSmeSetContextReq() ***/
3310
3311/**
3312 * __limProcessSmeRemoveKeyReq()
3313 *
3314 *FUNCTION:
3315 * This function is called to process SME_REMOVEKEY_REQ message
3316 * from HDD or upper layer application.
3317 *
3318 *LOGIC:
3319 *
3320 *ASSUMPTIONS:
3321 *
3322 *NOTE:
3323 *
3324 * @param pMac Pointer to Global MAC structure
3325 * @param *pMsgBuf A pointer to the SME message buffer
3326 * @return None
3327 */
3328
3329static void
3330__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3331{
3332 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3333 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3334 tpPESession psessionEntry;
3335 tANI_U8 sessionId; //PE sessionID
3336 tANI_U8 smesessionId;
3337 tANI_U16 smetransactionId;
3338
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303339 limLog(pMac, LOG1,
3340 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003341
3342 if(pMsgBuf == NULL)
3343 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003344 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 return;
3346 }
3347
3348
3349 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3350
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303351 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3352 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003353 {
3354 //Log error
3355 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303356 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003357
3358 return;
3359 }
3360
3361 if ((limRemoveKeyReqSerDes(pMac,
3362 pRemoveKeyReq,
3363 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3364 {
3365 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003366 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003367
3368 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3369
3370 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3371 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003372 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003373 //goto end;
3374 }
3375
3376 limSendSmeRemoveKeyRsp(pMac,
3377 pRemoveKeyReq->peerMacAddr,
3378 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3379 smesessionId,smetransactionId);
3380
3381 goto end;
3382 }
3383
3384 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3385 {
3386 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003387 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003388 limSendSmeRemoveKeyRsp(pMac,
3389 pRemoveKeyReq->peerMacAddr,
3390 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3391 smesessionId, smetransactionId);
3392 goto end;
3393 }
3394
3395
3396 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3397 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3398 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3399 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3400 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3401 {
3402 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303403 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3404 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003405 {
3406 // Log error
3407 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303408 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003409
3410 goto end;
3411 }
3412
3413 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3414 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3415 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3416 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3417
3418 /* Update PE session Id */
3419 pMlmRemoveKeyReq->sessionId = sessionId;
3420
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303421 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3423 sizeof(tSirMacAddr));
3424
3425
3426 limPostMlmMessage(pMac,
3427 LIM_MLM_REMOVEKEY_REQ,
3428 (tANI_U32 *) pMlmRemoveKeyReq);
3429 }
3430 else
3431 {
3432 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303433 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 psessionEntry->limSystemRole,
3435 psessionEntry->limSmeState);
3436 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3437
3438 limSendSmeRemoveKeyRsp(pMac,
3439 pRemoveKeyReq->peerMacAddr,
3440 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3441 smesessionId,smetransactionId);
3442 }
3443
3444end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303445 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003446} /*** end __limProcessSmeRemoveKeyReq() ***/
3447
Jeff Johnson295189b2012-06-20 16:38:30 -07003448void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3449{
3450 tSirMsgQ mmhMsg;
3451 tpSmeGetScanChnRsp pSirSmeRsp;
3452 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303453 tANI_U8 sessionId;
3454 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003455
3456 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3457 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003458 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 pMac->lim.scanChnInfo.numChnInfo);
3460 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3461 }
3462
Abhishek Singh525045c2014-12-15 17:18:45 +05303463 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003464 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303465 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003466
3467 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303468 pSirSmeRsp = vos_mem_malloc(len);
3469 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003470 {
3471 /// Buffer not available. Log error
3472 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303473 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003474
3475 return;
3476 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303477 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003478
Jeff Johnson295189b2012-06-20 16:38:30 -07003479 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3480 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303481
3482 if (pMac->fScanOffload)
3483 {
3484 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3485 pSirSmeRsp->sessionId = sessionId;
3486 }
3487 else
3488 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003489
3490 if(pMac->lim.scanChnInfo.numChnInfo)
3491 {
3492 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303493 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3494 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 }
3496 //Clear the list
3497 limRessetScanChannelInfo(pMac);
3498
3499 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3500 mmhMsg.bodyptr = pSirSmeRsp;
3501 mmhMsg.bodyval = 0;
3502
3503 pMac->lim.gLimRspReqd = false;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303504 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003505 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3506}
3507
3508
Jeff Johnson295189b2012-06-20 16:38:30 -07003509void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3510{
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05303511 tSirSmeGetAssocSTAsReq getAssocSTAsReq = {0};
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 tpDphHashNode pStaDs = NULL;
3513 tpPESession psessionEntry = NULL;
3514 tSap_Event sapEvent;
3515 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3516 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3517 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3518 tANI_U8 assocId = 0;
3519 tANI_U8 staCount = 0;
3520
3521 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3522 {
3523 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003524 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303525 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003526 }
3527
3528 switch (getAssocSTAsReq.modId)
3529 {
3530/**
3531 case VOS_MODULE_ID_HAL:
3532 wdaPostCtrlMsg( pMac, &msgQ );
3533 return;
3534
3535 case VOS_MODULE_ID_TL:
3536 Post msg TL
3537 return;
3538*/
3539 case VOS_MODULE_ID_PE:
3540 default:
3541 break;
3542 }
3543
Jeff Johnson1250df42012-12-10 14:31:52 -08003544 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003545 // Find PE session Entry
3546 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3547 {
3548 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003549 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003550 goto limAssocStaEnd;
3551 }
3552
3553 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3554 {
3555 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303556 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303557 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003558 goto limAssocStaEnd;
3559 }
3560
3561 // Retrieve values obtained in the request message
3562 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3563 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3564
3565 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3566 {
3567 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3568
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303569 if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 continue;
3571
3572 if (pStaDs->valid)
3573 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303574 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3575 (tANI_U8 *)&pStaDs->staAddr,
3576 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003577 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3578 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3579
Kiet Lamb1233192013-11-28 13:38:20 +05303580 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003581 (tANI_U8 *)&pStaDs->supportedRates,
3582 sizeof(tSirSupportedRates));
3583 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3584 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3585 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3586
Jeff Johnson295189b2012-06-20 16:38:30 -07003587 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003588 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3589 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003590 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3591 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3592
3593 pAssocStasTemp++;
3594 staCount++;
3595 }
3596 }
3597
3598limAssocStaEnd:
3599 // Call hdd callback with sap event to send the list of associated stations from PE
3600 if (pSapEventCallback != NULL)
3601 {
3602 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3603 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3604 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3605 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3606 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3607 }
3608}
3609
3610
3611/**
3612 * limProcessSmeGetWPSPBCSessions
3613 *
3614 *FUNCTION:
3615 * This function is called when query the WPS PBC overlap message is received
3616 *
3617 *LOGIC:
3618 * This function parses get WPS PBC overlap information message and call callback to pass
3619 * WPS PBC overlap information back to hdd.
3620 *ASSUMPTIONS:
3621 *
3622 *
3623 *NOTE:
3624 *
3625 * @param pMac Pointer to Global MAC structure
3626 * @param pMsgBuf A pointer to WPS PBC overlap query message
3627*
3628 * @return None
3629 */
3630void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3631{
3632 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3633 tpPESession psessionEntry = NULL;
3634 tSap_Event sapEvent;
3635 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3636 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3637 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3638
3639 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3640
3641 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3642 {
3643 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003644 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303645 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003646 }
3647
Jeff Johnson1250df42012-12-10 14:31:52 -08003648 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003649 // Find PE session Entry
3650 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3651 {
3652 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003653 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003654 goto limGetWPSPBCSessionsEnd;
3655 }
3656
3657 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3658 {
3659 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303660 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003661 psessionEntry->limSystemRole);
3662 goto limGetWPSPBCSessionsEnd;
3663 }
3664
Jeff Johnson1250df42012-12-10 14:31:52 -08003665 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003666 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3667 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3668
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303669 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 { //This is GetWpsSession call
3671
3672 limGetWPSPBCSessions(pMac,
3673 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3674 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3675 }
3676 else
3677 {
3678 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3679 /* don't have to inform the HDD/Host */
3680 return;
3681 }
3682
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003683 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3685
3686 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3687
3688limGetWPSPBCSessionsEnd:
3689 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303690
3691 if (NULL != pSapEventCallback)
3692 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07003693}
3694
Jeff Johnson295189b2012-06-20 16:38:30 -07003695
3696
3697/**
3698 * __limCounterMeasures()
3699 *
3700 * FUNCTION:
3701 * This function is called to "implement" MIC counter measure
3702 * and is *temporary* only
3703 *
3704 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3705 * we don't do the proper STA disassoc sequence since the
3706 * BSS will be stoped anyway
3707 *
3708 *ASSUMPTIONS:
3709 *
3710 *NOTE:
3711 *
3712 * @param pMac Pointer to Global MAC structure
3713 * @return None
3714 */
3715
3716static void
3717__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3718{
3719 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303720 /* If PMF is enabled then don't send broadcast disassociation */
3721 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3722 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3723 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3724#ifdef WLAN_FEATURE_11W
3725 && !psessionEntry->limRmfEnabled
3726#endif
3727 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003728 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003729
Jeff Johnson295189b2012-06-20 16:38:30 -07003730};
3731
3732
Jeff Johnson295189b2012-06-20 16:38:30 -07003733void
3734limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3735{
3736 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3737 tpPESession psessionEntry;
3738 tANI_U8 sessionId; //PE sessionId
3739
3740 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3741 {
3742 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003743 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003744 return;
3745 }
3746
3747 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3748 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003749 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 return;
3751 }
3752
3753 if ( tkipCntrMeasReq.bEnable )
3754 {
3755 __limCounterMeasures( pMac, psessionEntry );
3756 }
3757
3758 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3759}
Jeff Johnson295189b2012-06-20 16:38:30 -07003760
3761
3762static void
3763__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3764{
3765 tSirSmeStopBssReq stopBssReq;
3766 tSirRetStatus status;
3767 tLimSmeStates prevState;
3768 tANI_U8 sessionId; //PE sessionId
3769 tpPESession psessionEntry;
3770 tANI_U8 smesessionId;
3771 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303772 tANI_U8 i = 0;
3773 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003774
3775 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3776
3777
3778
3779 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3780 !limIsSmeStopBssReqValid(pMsgBuf))
3781 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003782 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003783 /// Send Stop BSS response to host
3784 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3785 return;
3786 }
3787
3788
3789 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3790 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003791 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003792 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3793 return;
3794 }
3795
3796#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3797 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3798#endif //FEATURE_WLAN_DIAG_SUPPORT
3799
3800
3801 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3802 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3803 {
3804 /**
3805 * Should not have received STOP_BSS_REQ in states
3806 * other than 'normal' state or on STA in Infrastructure
3807 * mode. Log error and return response to host.
3808 */
3809 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303810 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3812 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3813 /// Send Stop BSS response to host
3814 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3815 return;
3816 }
3817
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3819 {
3820 limWPSPBCClose(pMac, psessionEntry);
3821 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003822 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003823
3824 prevState = psessionEntry->limSmeState;
3825
3826 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003827 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003828
3829 /* Update SME session Id and Transaction Id */
3830 psessionEntry->smeSessionId = smesessionId;
3831 psessionEntry->transactionId = smetransactionId;
3832
Abhishek Singh8944b222014-09-17 16:13:17 +05303833 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3834 * If PMF is enabled then don't send broadcast disassociation */
3835 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3836 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3837#ifdef WLAN_FEATURE_11W
3838 && !psessionEntry->limRmfEnabled
3839#endif
3840 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 {
3842 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3843 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3844 // Send disassoc all stations associated thru TKIP
3845 __limCounterMeasures(pMac,psessionEntry);
3846 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303847 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003848 }
3849
3850 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3851 pMac->lim.gLimIbssCoalescingHappened = false;
3852
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303853 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3854 {
3855 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3856 if (NULL == pStaDs)
3857 continue;
3858 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3859 if(eSIR_SUCCESS == status)
3860 {
3861 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3862 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3863 }
3864 else
3865 {
3866 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3867 VOS_ASSERT(0) ;
3868 }
3869 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 /* send a delBss to HAL and wait for a response */
3871 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3872
3873 if (status != eSIR_SUCCESS)
3874 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003875 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 psessionEntry->limSmeState= prevState;
3877
Jeff Johnsone7245742012-09-05 17:12:55 -07003878 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003879
3880 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3881 }
3882}
3883
3884
3885/**--------------------------------------------------------------
3886\fn __limProcessSmeStopBssReq
3887
3888\brief Wrapper for the function __limHandleSmeStopBssRequest
3889 This message will be defered until softmac come out of
3890 scan mode. Message should be handled even if we have
3891 detected radar in the current operating channel.
3892\param pMac
3893\param pMsg
3894
3895\return TRUE - If we consumed the buffer
3896 FALSE - If have defered the message.
3897 ---------------------------------------------------------------*/
3898static tANI_BOOLEAN
3899__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3900{
3901 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3902 {
3903 /**
3904 * If message defered, buffer is not consumed yet.
3905 * So return false
3906 */
3907 return eANI_BOOLEAN_FALSE;
3908 }
3909 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3910 return eANI_BOOLEAN_TRUE;
3911} /*** end __limProcessSmeStopBssReq() ***/
3912
3913
3914void limProcessSmeDelBssRsp(
3915 tpAniSirGlobal pMac,
3916 tANI_U32 body,tpPESession psessionEntry)
3917{
3918
3919 (void) body;
3920 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3921 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003922 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003923 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3924 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3926 return;
3927}
3928
3929
Jeff Johnson295189b2012-06-20 16:38:30 -07003930/**---------------------------------------------------------------
3931\fn __limProcessSmeAssocCnfNew
3932\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3933\ in BTAMP AP.
3934\
3935\param pMac
3936\param msgType - message type
3937\param pMsgBuf - a pointer to the SME message buffer
3938\return None
3939------------------------------------------------------------------*/
3940
3941 void
3942__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3943{
3944 tSirSmeAssocCnf assocCnf;
3945 tpDphHashNode pStaDs = NULL;
3946 tpPESession psessionEntry= NULL;
3947 tANI_U8 sessionId;
3948
3949
3950 if(pMsgBuf == NULL)
3951 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003952 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 goto end;
3954 }
3955
3956 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3957 !__limIsSmeAssocCnfValid(&assocCnf))
3958 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003959 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 goto end;
3961 }
3962
3963 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3964 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003965 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003966 goto end;
3967 }
3968
3969 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3970 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3971 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303972 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303973 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003974 goto end;
3975 }
3976
3977 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3978
3979 if (pStaDs == NULL)
3980 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303981 limLog(pMac, LOGE,
3982 FL("Received invalid message %X due to no STA context, "
3983 "for aid %d, peer "),
3984 msgType, assocCnf.aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003985 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3986
3987 /*
3988 ** send a DISASSOC_IND message to WSM to make sure
3989 ** the state in WSM and LIM is the same
3990 **/
3991 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3992 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3993 goto end;
3994 }
3995 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303996 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 (tANI_U8 *) assocCnf.peerMacAddr,
3998 sizeof(tSirMacAddr)) ) ||
3999 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4000 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4001 (msgType != eWNI_SME_ASSOC_CNF)) ||
4002 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004003 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07004004 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304005 limLog(pMac, LOGE,
4006 FL("Received invalid message %X due to peerMacAddr mismatched "
4007 "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
4008 "StaD mlmState : %d"),
4009 msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4011 goto end;
4012 }
4013
4014 /*
4015 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4016 ** has been received
4017 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004018 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4020
4021 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4022 {
4023 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4024 * when it had received Assoc Request frame. Now, PE just needs to send
4025 * Association Response frame to the requesting BTAMP-STA.
4026 */
4027 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004028 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4030 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4031 goto end;
4032 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4033 else
4034 {
4035 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4036 /*Since the HAL sta entry is created for denied STA we need to remove this HAL entry.So to do that set updateContext to 1*/
4037 if(!pStaDs->mlmStaContext.updateContext)
4038 pStaDs->mlmStaContext.updateContext = 1;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304039 limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
4040 assocCnf.statusCode, pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 limRejectAssociation(pMac, pStaDs->staAddr,
4042 pStaDs->mlmStaContext.subType,
4043 true, pStaDs->mlmStaContext.authType,
4044 pStaDs->assocId, true,
4045 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004046 }
4047
4048end:
4049 if((psessionEntry != NULL) && (pStaDs != NULL))
4050 {
4051 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4052 {
4053 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4054 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304055 vos_mem_free(((tpSirAssocReq)
4056 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004057 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4058 }
4059
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304060 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4062 }
4063 }
4064
4065} /*** end __limProcessSmeAssocCnfNew() ***/
4066
4067
Jeff Johnson295189b2012-06-20 16:38:30 -07004068
4069
4070static void
4071__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4072{
4073 tpDphHashNode pStaDs;
4074 tSirMacAddr peerMac;
4075 tpSirAddtsReq pSirAddts;
4076 tANI_U32 timeout;
4077 tpPESession psessionEntry;
4078 tANI_U8 sessionId; //PE sessionId
4079 tANI_U8 smesessionId;
4080 tANI_U16 smetransactionId;
4081
4082
4083 if(pMsgBuf == NULL)
4084 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004085 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004086 return;
4087 }
4088
4089 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4090
4091 pSirAddts = (tpSirAddtsReq) pMsgBuf;
4092
4093 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
4094 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004095 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004096 return;
4097 }
4098#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4099 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
4100#endif //FEATURE_WLAN_DIAG_SUPPORT
4101
4102
4103
4104 /* if sta
4105 * - verify assoc state
4106 * - send addts request to ap
4107 * - wait for addts response from ap
4108 * if ap, just ignore with error log
4109 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304110 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004111 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304113 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07004114
4115 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
4116 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004117 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004118 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4119 smesessionId,smetransactionId);
4120 return;
4121 }
4122
Jeff Johnson295189b2012-06-20 16:38:30 -07004123 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4124
4125 if(pStaDs == NULL)
4126 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004127 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004128 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4129 smesessionId,smetransactionId);
4130 return;
4131 }
4132
4133 if ((! pStaDs->valid) ||
4134 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
4135 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004136 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004137 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4138 smesessionId,smetransactionId);
4139 return;
4140 }
4141
4142 pSirAddts->req.wsmTspecPresent = 0;
4143 pSirAddts->req.wmeTspecPresent = 0;
4144 pSirAddts->req.lleTspecPresent = 0;
4145
4146 if ((pStaDs->wsmEnabled) &&
4147 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
4148 pSirAddts->req.wsmTspecPresent = 1;
4149 else if (pStaDs->wmeEnabled)
4150 pSirAddts->req.wmeTspecPresent = 1;
4151 else if (pStaDs->lleEnabled)
4152 pSirAddts->req.lleTspecPresent = 1;
4153 else
4154 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004155 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4157 smesessionId,smetransactionId);
4158 return;
4159 }
4160
4161 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4162 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4163 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004164 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 psessionEntry->limSmeState);
4166 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4167 smesessionId,smetransactionId);
4168 return;
4169 }
4170
4171 if (pMac->lim.gLimAddtsSent)
4172 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004173 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004174 pMac->lim.gLimAddtsReq.req.dialogToken,
4175 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4176 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4177 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4178 smesessionId,smetransactionId);
4179 return;
4180 }
4181
4182 #if 0
4183 val = sizeof(tSirMacAddr);
4184 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4185 {
4186 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004187 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004188 return;
4189 }
4190 #endif
4191 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4192
4193 // save the addts request
4194 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304195 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004196
4197 // ship out the message now
4198 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4199 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304200 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004201
4202 // start a timer to wait for the response
4203 if (pSirAddts->timeout)
4204 timeout = pSirAddts->timeout;
4205 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4206 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004207 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 WNI_CFG_ADDTS_RSP_TIMEOUT);
4209 return;
4210 }
4211
4212 timeout = SYS_MS_TO_TICKS(timeout);
4213 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4214 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004215 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004216 return;
4217 }
4218 pMac->lim.gLimAddtsRspTimerCount++;
4219 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4220 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4221 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004222 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 return;
4224 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004225 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004226
4227 //add the sessionId to the timer object
4228 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4229 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4230 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004231 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 return;
4233 }
4234 return;
4235}
4236
4237
4238static void
4239__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4240{
4241 tSirMacAddr peerMacAddr;
4242 tANI_U8 ac;
4243 tSirMacTSInfo *pTsinfo;
4244 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4245 tpDphHashNode pStaDs = NULL;
4246 tpPESession psessionEntry;
4247 tANI_U8 sessionId;
4248 tANI_U32 status = eSIR_SUCCESS;
4249 tANI_U8 smesessionId;
4250 tANI_U16 smetransactionId;
4251
4252 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4253
4254 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4255 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004256 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004257 status = eSIR_FAILURE;
4258 goto end;
4259 }
4260#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4261 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4262#endif //FEATURE_WLAN_DIAG_SUPPORT
4263
4264
4265 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4266 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004267 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004268 status = eSIR_FAILURE;
4269 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4270 return;
4271 }
4272
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304273 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4274 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4275 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004276
4277 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4278 psessionEntry);
4279
4280 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4281
4282 /* We've successfully send DELTS frame to AP. Update the
4283 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4284 * is no longer trigger enabled or delivery enabled
4285 */
4286 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4287
4288 /* We're deleting the TSPEC, so this particular AC is no longer
4289 * admitted. PE needs to downgrade the EDCA
4290 * parameters(for the AC for which TS is being deleted) to the
4291 * next best AC for which ACM is not enabled, and send the
4292 * updated values to HAL.
4293 */
4294 ac = upToAc(pTsinfo->traffic.userPrio);
4295
4296 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4297 {
4298 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4299 }
4300 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4301 {
4302 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4303 }
4304 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4305 {
4306 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4307 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4308 }
4309
4310 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4311
4312 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4313 if (pStaDs != NULL)
4314 {
4315 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4316 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4317 else
4318 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4319 status = eSIR_SUCCESS;
4320 }
4321 else
4322 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004323 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004324 status = eSIR_FAILURE;
4325 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004326#ifdef FEATURE_WLAN_ESE
4327#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004328 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4329#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004330 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004331#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004332#endif
4333
4334 // send an sme response back
4335 end:
4336 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4337}
4338
4339
4340void
4341limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4342{
4343 //fetch the sessionEntry based on the sessionId
4344 tpPESession psessionEntry;
4345 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4346 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004347 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004348 return;
4349 }
4350
4351 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4352 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004353 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004354 pMac->lim.gLimAddtsSent = false;
4355 return;
4356 }
4357
4358 if (! pMac->lim.gLimAddtsSent)
4359 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004360 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004361 return;
4362 }
4363
4364 if (param != pMac->lim.gLimAddtsRspTimerCount)
4365 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004366 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004367 param, pMac->lim.gLimAddtsRspTimerCount);
4368 return;
4369 }
4370
4371 // this a real response timeout
4372 pMac->lim.gLimAddtsSent = false;
4373 pMac->lim.gLimAddtsRspTimerCount++;
4374
4375 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4376 psessionEntry->smeSessionId, psessionEntry->transactionId);
4377}
4378
4379
4380/**
4381 * __limProcessSmeStatsRequest()
4382 *
4383 *FUNCTION:
4384 *
4385 *
4386 *NOTE:
4387 *
4388 * @param pMac Pointer to Global MAC structure
4389 * @param *pMsgBuf A pointer to the SME message buffer
4390 * @return None
4391 */
4392static void
4393__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4394{
4395 tpAniGetStatsReq pStatsReq;
4396 tSirMsgQ msgQ;
4397 tpPESession psessionEntry;
4398 tANI_U8 sessionId;
4399
4400
4401 if(pMsgBuf == NULL)
4402 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004403 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 return;
4405 }
4406
4407 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4408
4409 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004411 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304412 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004413 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004414 return;
4415 }
4416
4417
4418
4419 switch(pStatsReq->msgType)
4420 {
4421 //Add Lim stats here. and send reqsponse.
4422
4423 //HAL maintained Stats.
4424 case eWNI_SME_STA_STAT_REQ:
4425 msgQ.type = WDA_STA_STAT_REQ;
4426 break;
4427 case eWNI_SME_AGGR_STAT_REQ:
4428 msgQ.type = WDA_AGGR_STAT_REQ;
4429 break;
4430 case eWNI_SME_GLOBAL_STAT_REQ:
4431 msgQ.type = WDA_GLOBAL_STAT_REQ;
4432 break;
4433 case eWNI_SME_STAT_SUMM_REQ:
4434 msgQ.type = WDA_STAT_SUMM_REQ;
4435 break;
4436 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004437 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304438 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004439 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 return;
4441 }
4442
Jeff Johnson295189b2012-06-20 16:38:30 -07004443 msgQ.reserved = 0;
4444 msgQ.bodyptr = pMsgBuf;
4445 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004446 if(NULL == psessionEntry)
4447 {
4448 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4449 }
4450 else
4451 {
4452 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4453 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004454 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004455 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304456 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004457 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 return;
4459 }
4460
4461 return;
4462}
4463
4464
4465/**
4466 * __limProcessSmeGetStatisticsRequest()
4467 *
4468 *FUNCTION:
4469 *
4470 *
4471 *NOTE:
4472 *
4473 * @param pMac Pointer to Global MAC structure
4474 * @param *pMsgBuf A pointer to the SME message buffer
4475 * @return None
4476 */
4477static void
4478__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4479{
4480 tpAniGetPEStatsReq pPEStatsReq;
4481 tSirMsgQ msgQ;
4482
4483 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4484
4485 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4486
4487 msgQ.type = WDA_GET_STATISTICS_REQ;
4488
Jeff Johnson295189b2012-06-20 16:38:30 -07004489 msgQ.reserved = 0;
4490 msgQ.bodyptr = pMsgBuf;
4491 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004492 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004493
4494 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304495 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004496 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004497 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 return;
4499 }
4500
4501 return;
4502}
4503
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004504#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004505/**
4506 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4507 *
4508 *NOTE:
4509 *
4510 * @param pMac Pointer to Global MAC structure
4511 * @param *pMsgBuf A pointer to the SME message buffer
4512 * @return None
4513 */
4514static void
4515__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4516{
4517 tSirMsgQ msgQ;
4518
4519 msgQ.type = WDA_TSM_STATS_REQ;
4520 msgQ.reserved = 0;
4521 msgQ.bodyptr = pMsgBuf;
4522 msgQ.bodyval = 0;
4523 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4524
4525 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4526 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004527 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004528 limLog(pMac, LOGP, "Unable to forward request");
4529 return;
4530 }
4531}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004532#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004533
4534
Jeff Johnson295189b2012-06-20 16:38:30 -07004535
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004536#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004537/**
4538 * __limProcessSmeGetRoamRssiRequest()
4539 *
4540 *FUNCTION:
4541 *
4542 *
4543 *NOTE:
4544 *
4545 * @param pMac Pointer to Global MAC structure
4546 * @param *pMsgBuf A pointer to the SME message buffer
4547 * @return None
4548 */
4549static void
4550__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4551{
4552 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4553 tSirMsgQ msgQ;
4554
4555 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4556 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4557
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004558 msgQ.reserved = 0;
4559 msgQ.bodyptr = pMsgBuf;
4560 msgQ.bodyval = 0;
4561 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4562
4563 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304564 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004565 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004566 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004567 return;
4568 }
4569
4570 return;
4571}
4572#endif
4573
4574
Jeff Johnson295189b2012-06-20 16:38:30 -07004575static void
4576__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4577{
4578 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4579 tpPESession psessionEntry;
4580 tANI_U8 sessionId; //PE sessionID
4581
4582 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004583 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004584
4585 if(pMsgBuf == NULL)
4586 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004587 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 return;
4589 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004590
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304591 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4592 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004593 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304594 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 return;
4596 }
4597
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004598 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004599 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004600 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004601 goto end;
4602 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004603
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4605 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004606 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 goto end;
4608 }
4609
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304610 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004611
Jeff Johnson295189b2012-06-20 16:38:30 -07004612 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004613 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004614
4615end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304616 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004617 return;
4618} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4619
4620static void
4621__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4622{
4623 tpSirUpdateParams pUpdateParams;
4624 tpPESession psessionEntry;
4625
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304626 limLog(pMac, LOG1,
4627 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004628
4629 if(pMsgBuf == NULL)
4630 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004631 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004632 return;
4633 }
4634
4635 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4636
4637 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4638 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004639 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 pUpdateParams->sessionId);
4641 return;
4642 }
4643
4644 /* Update the session entry */
4645 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4646
4647 /* Update beacon */
4648 schSetFixedBeaconFields(pMac, psessionEntry);
4649 limSendBeaconInd(pMac, psessionEntry);
4650
4651 return;
4652} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4653
4654static void
4655__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4656{
4657 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4658 tpPESession psessionEntry;
4659 tANI_U8 sessionId; //PE sessionID
4660
4661 if(pMsgBuf == NULL)
4662 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004663 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 return;
4665 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304666
4667 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4668 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004669 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304670 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004671 return;
4672 }
4673
4674 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4675 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004676 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004677 goto end;
4678 }
4679
4680 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4681 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004682 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004683 goto end;
4684 }
4685
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304686 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4687 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004688
4689 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4690
4691 psessionEntry->pLimStartBssReq->privacy = 1;
4692 psessionEntry->privacy = 1;
4693
4694 schSetFixedBeaconFields(pMac, psessionEntry);
4695 limSendBeaconInd(pMac, psessionEntry);
4696
4697end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304698 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004699 return;
4700} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4701
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004702/*
4703Update the beacon Interval dynamically if beaconInterval is different in MCC
4704*/
4705static void
4706__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4707{
4708 tpSirChangeBIParams pChangeBIParams;
4709 tpPESession psessionEntry;
4710 tANI_U8 sessionId = 0;
4711 tUpdateBeaconParams beaconParams;
4712
4713 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004714 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004715
4716 if(pMsgBuf == NULL)
4717 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004718 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004719 return;
4720 }
4721
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304722 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004723 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4724
4725 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4726 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004727 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004728 return;
4729 }
4730
4731 /*Update sessionEntry Beacon Interval*/
4732 if(psessionEntry->beaconParams.beaconInterval !=
4733 pChangeBIParams->beaconInterval )
4734 {
4735 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4736 }
4737
4738 /*Update sch beaconInterval*/
4739 if(pMac->sch.schObject.gSchBeaconInterval !=
4740 pChangeBIParams->beaconInterval )
4741 {
4742 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4743
4744 PELOG1(limLog(pMac, LOG1,
4745 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4746
4747 /* Update beacon */
4748 schSetFixedBeaconFields(pMac, psessionEntry);
4749
Sunil Ravib96f7b52013-05-22 21:40:05 -07004750 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004751 //Set change in beacon Interval
4752 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004753 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004754 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4755 }
4756
4757 return;
4758} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4759
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304760/** -------------------------------------------------------------
4761\fn
4762\brief handles indication message from HDD to update HT mode
4763\param tpAniSirGlobal pMac
4764\param tANI_U32 pMsgBuf
4765\return None
4766-------------------------------------------------------------*/
4767#ifdef WLAN_FEATURE_AP_HT40_24G
4768static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4769{
4770 tpSirSetHT2040Mode pSetHT2040Mode;
4771 tpPESession psessionEntry;
4772 tANI_U8 sessionId = 0;
4773 tUpdateVHTOpMode *pHtOpMode = NULL;
4774 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004775
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304776 PELOG1(limLog(pMac, LOGRW,
4777 FL("received Set HT 20/40 mode message")););
4778
4779 if(pMsgBuf == NULL)
4780 {
4781 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4782 return;
4783 }
4784
4785 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4786
4787 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4788 &sessionId)) == NULL)
4789 {
4790 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4791 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4792 return;
4793 }
4794
4795 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4796 pSetHT2040Mode->cbMode);
4797
4798 /*Update sessionEntry HT related fields*/
4799 switch(pSetHT2040Mode->cbMode)
4800 {
4801 case PHY_SINGLE_CHANNEL_CENTERED:
4802 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4803 psessionEntry->htRecommendedTxWidthSet = 0;
4804 break;
4805 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4806 psessionEntry->htSecondaryChannelOffset =
4807 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4808 psessionEntry->htRecommendedTxWidthSet = 1;
4809 break;
4810 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4811 psessionEntry->htSecondaryChannelOffset =
4812 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4813 psessionEntry->htRecommendedTxWidthSet = 1;
4814 break;
4815 default:
4816 limLog(pMac, LOGE,FL("Invalid cbMode"));
4817 return;
4818 }
4819
4820 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4821 " htSecondaryChannelOffset: %d"
4822 " htRecommendedTxWidthSet :%d"),
4823 pSetHT2040Mode->cbMode,
4824 psessionEntry->htSecondaryChannelOffset,
4825 psessionEntry->htRecommendedTxWidthSet);
4826
4827 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4828
4829 /* Update beacon */
4830 schSetFixedBeaconFields(pMac, psessionEntry);
4831 limSendBeaconInd(pMac, psessionEntry);
4832
4833 /* Update OP Mode */
4834 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4835 if ( NULL == pHtOpMode )
4836 {
4837 limLog(pMac, LOGE,
4838 FL("Not able to allocate memory for setting OP mode"));
4839 return;
4840 }
4841
4842 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4843 PHY_SINGLE_CHANNEL_CENTERED)?
4844 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4845
4846 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4847 * operating mode for all connected STA.
4848 */
4849
4850 pHtOpMode->staId = psessionEntry->staId;
4851
4852 msg.type = WDA_UPDATE_OP_MODE;
4853 msg.reserved = 0;
4854 msg.bodyptr = pHtOpMode;
4855
4856 if (!VOS_IS_STATUS_SUCCESS(
4857 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4858 {
4859 limLog(pMac, LOGE,
4860 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4861 vos_mem_free(pHtOpMode);
4862 return;
4863 }
4864
4865 limLog(pMac, LOGW,
4866 FL("Notifed FW about OP mode: %d for staId=%d"),
4867 pHtOpMode->opMode, pHtOpMode->staId);
4868
4869 return;
4870}
4871#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004872
4873/** -------------------------------------------------------------
4874\fn limProcessSmeDelBaPeerInd
4875\brief handles indication message from HDD to send delete BA request
4876\param tpAniSirGlobal pMac
4877\param tANI_U32 pMsgBuf
4878\return None
4879-------------------------------------------------------------*/
4880void
4881limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4882{
4883 tANI_U16 assocId =0;
4884 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4885 tpDphHashNode pSta;
4886 tpPESession psessionEntry;
4887 tANI_U8 sessionId;
4888
4889
4890
4891 if(NULL == pSmeDelBAPeerInd)
4892 return;
4893
4894 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4895 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004896 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 return;
4898 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004899 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004900 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4901
4902 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4903 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4904 pSta,
4905 pSmeDelBAPeerInd->baDirection,
4906 pSmeDelBAPeerInd->baTID,
4907 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4908 {
4909 limLog( pMac, LOGW,
4910 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4911 if (pSta)
4912 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4913 }
4914}
4915
4916// --------------------------------------------------------------------
4917/**
4918 * __limProcessReportMessage
4919 *
4920 * FUNCTION: Processes the next received Radio Resource Management message
4921 *
4922 * LOGIC:
4923 *
4924 * ASSUMPTIONS:
4925 *
4926 * NOTE:
4927 *
4928 * @param None
4929 * @return None
4930 */
4931
4932void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4933{
4934#ifdef WLAN_FEATURE_VOWIFI
4935 switch (pMsg->type)
4936 {
4937 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4938 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4939 break;
4940 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4941 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004942#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004943 tpSirBeaconReportXmitInd pBcnReport=NULL;
4944 tpPESession psessionEntry=NULL;
4945 tANI_U8 sessionId;
Padma, Santhosh Kumar20d45a12016-04-05 13:11:00 +05304946 tpEsePEContext pEseContext = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004947
4948 if(pMsg->bodyptr == NULL)
4949 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004950 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004951 return;
4952 }
4953 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4954 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4955 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004956 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004957 return;
4958 }
Padma, Santhosh Kumar20d45a12016-04-05 13:11:00 +05304959
4960 pEseContext = &psessionEntry->eseContext;
4961
4962 if (psessionEntry->isESEconnection && pEseContext->curMeasReq.isValid)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004963 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004964 else
4965#endif
4966 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4967 }
4968 break;
4969 }
4970#endif
4971}
4972
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004973#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004974// --------------------------------------------------------------------
4975/**
4976 * limSendSetMaxTxPowerReq
4977 *
4978 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4979 *
4980 * LOGIC:
4981 *
4982 * ASSUMPTIONS:
4983 *
4984 * NOTE:
4985 *
4986 * @param txPower txPower to be set.
4987 * @param pSessionEntry session entry.
4988 * @return None
4989 */
4990tSirRetStatus
4991limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4992{
4993 tpMaxTxPowerParams pMaxTxParams = NULL;
4994 tSirRetStatus retCode = eSIR_SUCCESS;
4995 tSirMsgQ msgQ;
4996
4997 if( pSessionEntry == NULL )
4998 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004999 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005000 return eSIR_FAILURE;
5001 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305002
5003 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
5004 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005005 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005006 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 return eSIR_MEM_ALLOC_FAILED;
5008
5009 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005010#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305011 limLog( pMac, LOG1,
5012 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005013#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07005014 if( pMaxTxParams == NULL )
5015 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305016 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07005017 return eSIR_FAILURE;
5018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305020 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
5021 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005022
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005023 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
5024 msgQ.bodyptr = pMaxTxParams;
5025 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305026 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005027 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
5028 retCode = wdaPostCtrlMsg(pMac, &msgQ);
5029 if (eSIR_SUCCESS != retCode)
5030 {
5031 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305032 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005033 }
5034 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005035}
5036#endif
5037
5038/**
5039 * __limProcessSmeAddStaSelfReq()
5040 *
5041 *FUNCTION:
5042 * This function is called to process SME_ADD_STA_SELF_REQ message
5043 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
5044 *
5045 *LOGIC:
5046 *
5047 *ASSUMPTIONS:
5048 *
5049 *NOTE:
5050 *
5051 * @param pMac Pointer to Global MAC structure
5052 * @param *pMsgBuf A pointer to the SME message buffer
5053 * @return None
5054 */
5055
5056static void
5057__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5058{
5059 tSirMsgQ msg;
5060 tpAddStaSelfParams pAddStaSelfParams;
5061 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
5062
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305063 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
5064 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005065 {
5066 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
5067 return;
5068 }
5069
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305070 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07005071 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005072 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
5073 msg.reserved = 0;
5074 msg.bodyptr = pAddStaSelfParams;
5075 msg.bodyval = 0;
5076
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005077 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005078 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005079
5080 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5081 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005082 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005083 }
5084 return;
5085} /*** end __limProcessAddStaSelfReq() ***/
5086
5087
5088/**
5089 * __limProcessSmeDelStaSelfReq()
5090 *
5091 *FUNCTION:
5092 * This function is called to process SME_DEL_STA_SELF_REQ message
5093 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
5094 *
5095 *LOGIC:
5096 *
5097 *ASSUMPTIONS:
5098 *
5099 *NOTE:
5100 *
5101 * @param pMac Pointer to Global MAC structure
5102 * @param *pMsgBuf A pointer to the SME message buffer
5103 * @return None
5104 */
5105
5106static void
5107__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5108{
5109 tSirMsgQ msg;
5110 tpDelStaSelfParams pDelStaSelfParams;
5111 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
5112
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305113 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
5114 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005115 {
5116 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
5117 return;
5118 }
5119
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305120 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005121
5122 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
5123 msg.reserved = 0;
5124 msg.bodyptr = pDelStaSelfParams;
5125 msg.bodyval = 0;
5126
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05305127 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_DEL_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005128 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005129
5130 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5131 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005132 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005133 }
5134 return;
5135} /*** end __limProcessSmeDelStaSelfReq() ***/
5136
5137
Jeff Johnson295189b2012-06-20 16:38:30 -07005138/**
5139 * __limProcessSmeRegisterMgmtFrameReq()
5140 *
5141 *FUNCTION:
5142 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
5143 * from SME. It Register this information within PE.
5144 *
5145 *LOGIC:
5146 *
5147 *ASSUMPTIONS:
5148 *
5149 *NOTE:
5150 *
5151 * @param pMac Pointer to Global MAC structure
5152 * @param *pMsgBuf A pointer to the SME message buffer
5153 * @return None
5154 */
5155static void
5156__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5157{
5158 VOS_STATUS vosStatus;
5159 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5160 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005161 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305162 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005163 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305164 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005165
Jeff Johnsond13512a2012-07-17 11:42:19 -07005166 /* First check whether entry exists already*/
5167
5168 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5169 (vos_list_node_t**)&pLimMgmtRegistration);
5170
5171 while(pLimMgmtRegistration != NULL)
5172 {
5173 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5174 {
5175 if(pSmeReq->matchLen)
5176 {
5177 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5178 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305179 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005180 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5181 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005182 /* found match! */
5183 match = VOS_TRUE;
5184 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005185 }
5186 }
5187 }
5188 else
5189 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005190 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005191 match = VOS_TRUE;
5192 break;
5193 }
5194 }
5195 vosStatus = vos_list_peek_next (
5196 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5197 (vos_list_node_t*) pLimMgmtRegistration,
5198 (vos_list_node_t**) &pNext );
5199
5200 pLimMgmtRegistration = pNext;
5201 pNext = NULL;
5202
5203 }
5204
5205 if (match)
5206 {
5207 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5208 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305209 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005210 }
5211
Jeff Johnson295189b2012-06-20 16:38:30 -07005212 if(pSmeReq->registerFrame)
5213 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305214 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5215 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005216 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305217 vos_mem_set((void*)pLimMgmtRegistration,
5218 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005219 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5220 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5221 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5222 if(pSmeReq->matchLen)
5223 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305224 vos_mem_copy(pLimMgmtRegistration->matchData,
5225 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005226 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005227 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5228 &pLimMgmtRegistration->node);
5229 }
5230 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005231
5232 return;
5233} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005234
5235static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005236__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005237{
5238 tpP2pPsParams pMsgNoA;
5239 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005240
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305241 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5242 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005243 {
5244 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005245 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005246 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005247 }
5248
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305249 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005250 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5251 pMsgNoA->opp_ps = 0;
5252 pMsgNoA->ctWindow = 0;
5253 pMsgNoA->duration = 0;
5254 pMsgNoA->interval = 0;
5255 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005256
Vinay Malekal62757362012-12-17 12:15:51 -08005257 /* Below params used for Single Shot NOA - so assign proper values */
5258 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005259 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005260
Viral Modid86bde22012-12-10 13:09:21 -08005261 /* Start Insert NOA timer
5262 * If insert NOA req fails or NOA rsp fails or start NOA indication doesn't come from FW due to GO session deletion
Viral Modid440e682013-03-06 02:25:31 -08005263 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5264 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005265 */
5266 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5267 == TX_TIMER_ERROR)
5268 {
5269 /// Could not activate Insert NOA timer.
5270 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005271 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005272
5273 // send the scan response back with status failure and do not even call insert NOA
5274 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305275 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005276 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005277 }
5278
Viral Modid440e682013-03-06 02:25:31 -08005279 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5280
Viral Modid86bde22012-12-10 13:09:21 -08005281 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5282 msg.reserved = 0;
5283 msg.bodyptr = pMsgNoA;
5284 msg.bodyval = 0;
5285
5286 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5287 {
5288 /* In this failure case, timer is already started, so its expiration will take care of sending scan response */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005289 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005290 /* Deactivate the NOA timer in failure case */
5291 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5292 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005293 }
Viral Modid440e682013-03-06 02:25:31 -08005294 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005295
Viral Modid440e682013-03-06 02:25:31 -08005296error:
5297 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5298 * worrying about the NOA
5299 */
5300 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5301 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005302 return FALSE;
5303
5304}
5305
Viral Modid440e682013-03-06 02:25:31 -08005306static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5307{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005308 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005309 pMac->lim.gDeferMsgTypeForNOA = msgType;
5310 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5311}
5312
5313static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5314{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005315 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005316 pMac->lim.gDeferMsgTypeForNOA = 0;
5317 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5318 {
5319 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305320 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005321 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5322 }
5323}
5324
5325static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305326tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5327 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005328{
5329 tANI_U32 noaDuration = 0;
5330
5331 switch (msgType)
5332 {
5333 case eWNI_SME_SCAN_REQ:
5334 {
5335 tANI_U32 val;
5336 tANI_U8 i;
5337 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5338 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5339 {
5340 /*
5341 * Could not get max channel value
5342 * from CFG. Log error.
5343 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005344 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005345
5346 /* use a default value of 110ms */
5347 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5348 }
5349
5350 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5351 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5352
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305353 if (pMac->miracast_mode) {
5354 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5355 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5356 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005357 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5358 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5359 */
5360 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305361 } else {
5362 /* Use min + max channel time to calculate the total duration of scan */
5363 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005364 }
5365 }
5366
5367 /* Adding an overhead of 20ms to account for the scan messaging delays */
5368 noaDuration += SCAN_MESSAGING_OVERHEAD;
5369 noaDuration *= CONV_MS_TO_US;
5370
5371 break;
5372 }
5373
5374 case eWNI_SME_OEM_DATA_REQ:
5375 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5376 break;
5377
5378 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5379 {
5380 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5381 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5382 break;
5383 }
5384
5385 case eWNI_SME_JOIN_REQ:
5386 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5387 break;
5388
5389 default:
5390 noaDuration = 0;
5391 break;
5392
5393 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005394 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005395 return noaDuration;
5396}
5397
5398void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5399{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305400 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005401
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005402 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005403 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5404 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5405 {
5406 switch (pMac->lim.gDeferMsgTypeForNOA)
5407 {
5408 case eWNI_SME_SCAN_REQ:
5409 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5410 break;
5411 case eWNI_SME_OEM_DATA_REQ:
5412 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5413 break;
5414 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305415 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5416 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5417 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5418 */
5419 if (FALSE == bufConsumed)
5420 {
5421 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5422 }
Viral Modid440e682013-03-06 02:25:31 -08005423 break;
5424 case eWNI_SME_JOIN_REQ:
5425 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5426 break;
5427 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005428 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005429 break;
5430 }
5431 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5432 }
5433 else
5434 {
5435 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005436 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005437 }
5438}
Jeff Johnson295189b2012-06-20 16:38:30 -07005439
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305440static void
5441__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5442{
5443 tpSirResetAPCapsChange pResetCapsChange;
5444 tpPESession psessionEntry;
5445 tANI_U8 sessionId = 0;
5446 if (pMsgBuf == NULL)
5447 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005448 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305449 return;
5450 }
5451
5452 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5453 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5454 if (psessionEntry == NULL)
5455 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005456 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305457 return;
5458 }
5459
5460 psessionEntry->limSentCapsChangeNtf = false;
5461 return;
5462}
5463
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305464static void
5465__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5466{
5467 tSirMsgQ msg;
5468 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5469 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5470
5471 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5472 if ( NULL == pSpoofMacAddrParams )
5473 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305474 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305475 return;
5476 }
5477
5478 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5479
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305480 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5481
5482 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5483 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5484
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305485 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5486 msg.reserved = 0;
5487 msg.bodyptr = pSpoofMacAddrParams;
5488 msg.bodyval = 0;
5489
5490 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5491 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5492
5493 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5494 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305495 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305496 vos_mem_free(pSpoofMacAddrParams);
5497 }
5498 return;
5499}
5500
Jeff Johnson295189b2012-06-20 16:38:30 -07005501/**
Abhishek Singh7d624e12015-11-30 14:29:27 +05305502 * lim_register_mgmt_frame_ind_cb() - Save the Management frame
5503 * indication callback in PE.
5504 * @pMac: Mac pointer
5505 * @pMsgBuf: Msg pointer containing the callback
5506 *
5507 * This function is used save the Management frame
5508 * indication callback in PE.
5509 *
5510 * Return: None
5511 */
5512static void lim_register_mgmt_frame_ind_cb(tpAniSirGlobal pMac,
5513 tANI_U32 *msg_buf)
5514{
5515 struct sir_sme_mgmt_frame_cb_req *sme_req =
5516 (struct sir_sme_mgmt_frame_cb_req *)msg_buf;
5517
5518 if (NULL == msg_buf)
5519 {
5520 limLog(pMac, LOGE, FL("msg_buf is null"));
5521 return;
5522 }
5523 if (sme_req->callback)
5524 pMac->mgmt_frame_ind_cb =
5525 (sir_mgmt_frame_ind_callback)sme_req->callback;
5526 else
5527 limLog(pMac, LOGE, FL("sme_req->callback is null"));
5528}
5529
5530/**
Jeff Johnson295189b2012-06-20 16:38:30 -07005531 * limProcessSmeReqMessages()
5532 *
5533 *FUNCTION:
5534 * This function is called by limProcessMessageQueue(). This
5535 * function processes SME request messages from HDD or upper layer
5536 * application.
5537 *
5538 *LOGIC:
5539 *
5540 *ASSUMPTIONS:
5541 *
5542 *NOTE:
5543 *
5544 * @param pMac Pointer to Global MAC structure
5545 * @param msgType Indicates the SME message type
5546 * @param *pMsgBuf A pointer to the SME message buffer
5547 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5548 * FALSE - if pMsgBuf is not to be freed.
5549 */
5550
5551tANI_BOOLEAN
5552limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5553{
5554 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5555 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005556 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305557 tANI_BOOLEAN isPassiveScan = FALSE;
5558
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005559 PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005560 limMsgStr(pMsg->type), pMsg->type,
5561 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5562 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5563
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005564 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005565 /* Special handling of some SME Req msgs where we have an existing GO session and
5566 * want to insert NOA before processing those msgs. These msgs will be processed later when
5567 * start event happens
5568 */
5569 switch (pMsg->type)
5570 {
5571 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305572 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5573 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005574 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005575
5576 /* If scan is disabled return from here
5577 */
5578 if (pMac->lim.fScanDisabled)
5579 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005580 if (pMsg->type == eWNI_SME_SCAN_REQ)
5581 {
5582 limSendSmeScanRsp(pMac,
5583 offsetof(tSirSmeScanRsp,bssDescription[0]),
5584 eSIR_SME_INVALID_PARAMETERS,
5585 pScanReq->sessionId,
5586 pScanReq->transactionId);
5587
5588 bufConsumed = TRUE;
5589 }
5590 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5591 {
5592 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5593 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5594 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5595
5596 /*
5597 * limRemainOnChnRsp will free the buffer this change is to
5598 * avoid "double free"
5599 */
5600 bufConsumed = FALSE;
5601 }
5602
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305603 limLog(pMac, LOGE,
5604 FL("Error: Scan Disabled."
5605 " Return with error status for SME Message %s(%d)"),
5606 limMsgStr(pMsg->type), pMsg->type);
5607
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005608 return bufConsumed;
5609 }
5610 /*
5611 * Do not add BREAK here
5612 */
5613 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005614 case eWNI_SME_JOIN_REQ:
5615 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5616 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5617 {
5618 tANI_U32 noaDuration;
5619 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305620 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005621 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5622 return bufConsumed;
5623 }
5624 }
5625 /* If no insert NOA required then execute the code below */
5626
Jeff Johnson295189b2012-06-20 16:38:30 -07005627 switch (pMsg->type)
5628 {
5629 case eWNI_SME_START_REQ:
5630 __limProcessSmeStartReq(pMac, pMsgBuf);
5631 break;
5632
5633 case eWNI_SME_SYS_READY_IND:
5634 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5635 break;
5636
Jeff Johnson295189b2012-06-20 16:38:30 -07005637 case eWNI_SME_START_BSS_REQ:
5638 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5639 break;
5640
5641 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005642 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005643 break;
5644
Jeff Johnsone7245742012-09-05 17:12:55 -07005645#ifdef FEATURE_OEM_DATA_SUPPORT
5646 case eWNI_SME_OEM_DATA_REQ:
5647 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005648 break;
5649#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5651 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5652 break;
5653
5654 case eWNI_SME_UPDATE_NOA:
5655 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5656 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305657 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5658 __limProcessClearDfsChannelList(pMac, pMsg);
5659 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005660 case eWNI_SME_JOIN_REQ:
5661 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005662 break;
5663
5664 case eWNI_SME_AUTH_REQ:
5665 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5666
5667 break;
5668
5669 case eWNI_SME_REASSOC_REQ:
5670 __limProcessSmeReassocReq(pMac, pMsgBuf);
5671
5672 break;
5673
5674 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5675 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5676
5677 break;
5678
5679 case eWNI_SME_DISASSOC_REQ:
5680 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5681
5682 break;
5683
5684 case eWNI_SME_DISASSOC_CNF:
5685 case eWNI_SME_DEAUTH_CNF:
5686 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5687
5688 break;
5689
5690 case eWNI_SME_DEAUTH_REQ:
5691 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5692
5693 break;
5694
Jeff Johnson295189b2012-06-20 16:38:30 -07005695
5696
5697 case eWNI_SME_SETCONTEXT_REQ:
5698 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5699
5700 break;
5701
5702 case eWNI_SME_REMOVEKEY_REQ:
5703 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5704
5705 break;
5706
5707 case eWNI_SME_STOP_BSS_REQ:
5708 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5709 break;
5710
5711 case eWNI_SME_ASSOC_CNF:
5712 case eWNI_SME_REASSOC_CNF:
5713 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305714 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005715 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305716 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005717 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5718 break;
5719
5720 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305721 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005722 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5723 break;
5724
5725 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305726 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005727 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5728 break;
5729
5730 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305731 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005732 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5733 break;
5734
5735 case eWNI_SME_STA_STAT_REQ:
5736 case eWNI_SME_AGGR_STAT_REQ:
5737 case eWNI_SME_GLOBAL_STAT_REQ:
5738 case eWNI_SME_STAT_SUMM_REQ:
5739 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5740 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5741 bufConsumed = FALSE;
5742 break;
5743 case eWNI_SME_GET_STATISTICS_REQ:
5744 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5745 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5746 bufConsumed = FALSE;
5747 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005748#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005749 case eWNI_SME_GET_ROAM_RSSI_REQ:
5750 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5751 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5752 bufConsumed = FALSE;
5753 break;
5754#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005755#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005756 case eWNI_SME_GET_TSM_STATS_REQ:
5757 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5758 bufConsumed = FALSE;
5759 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005760#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005761 case eWNI_SME_DEL_BA_PEER_IND:
5762 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5763 break;
5764 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5765 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5766 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005767 case eWNI_SME_GET_ASSOC_STAS_REQ:
5768 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5769 break;
5770 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5771 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5772 break;
5773
5774 case eWNI_SME_HIDE_SSID_REQ:
5775 __limProcessSmeHideSSID(pMac, pMsgBuf);
5776 break;
5777 case eWNI_SME_UPDATE_APWPSIE_REQ:
5778 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5779 break;
5780 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5781 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5782 break;
5783
5784 case eWNI_SME_SET_APWPARSNIEs_REQ:
5785 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5786 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005787
5788 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5789 //Update the beaconInterval
5790 __limProcessSmeChangeBI(pMac, pMsgBuf );
5791 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05305792
5793#ifdef WLAN_FEATURE_AP_HT40_24G
5794 case eWNI_SME_SET_HT_2040_MODE:
5795 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
5796 break;
5797#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005798
5799#if defined WLAN_FEATURE_VOWIFI
5800 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5801 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5802 __limProcessReportMessage(pMac, pMsg);
5803 break;
5804#endif
5805
5806#if defined WLAN_FEATURE_VOWIFI_11R
5807 case eWNI_SME_FT_PRE_AUTH_REQ:
5808 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5809 break;
5810 case eWNI_SME_FT_UPDATE_KEY:
5811 limProcessFTUpdateKey(pMac, pMsgBuf);
5812 break;
5813
5814 case eWNI_SME_FT_AGGR_QOS_REQ:
5815 limProcessFTAggrQosReq(pMac, pMsgBuf);
5816 break;
5817#endif
5818
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005819#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5820 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005821 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5822 break;
5823#endif
5824 case eWNI_SME_ADD_STA_SELF_REQ:
5825 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5826 break;
5827 case eWNI_SME_DEL_STA_SELF_REQ:
5828 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5829 break;
5830
Jeff Johnson295189b2012-06-20 16:38:30 -07005831 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5832 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5833 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005834#ifdef FEATURE_WLAN_TDLS
5835 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5836 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5837 break;
5838 case eWNI_SME_TDLS_ADD_STA_REQ:
5839 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5840 break;
5841 case eWNI_SME_TDLS_DEL_STA_REQ:
5842 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5843 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305844 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5845 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5846 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05305847// tdlsoffchan
5848 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
5849 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
5850 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005851#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305852 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5853 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5854 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005855
schang86c22c42013-03-13 18:41:24 -07005856 case eWNI_SME_SET_TX_POWER_REQ:
5857 limSendSetTxPowerReq(pMac, pMsgBuf);
5858 break ;
5859
Abhishek Singh00b71972016-01-07 10:51:04 +05305860#ifdef WLAN_FEATURE_RMC
5861 case eWNI_SME_ENABLE_RMC_REQ:
5862 limProcessRMCMessages(pMac, eLIM_RMC_ENABLE_REQ, pMsgBuf);
5863 break ;
5864
5865 case eWNI_SME_DISABLE_RMC_REQ:
5866 limProcessRMCMessages(pMac, eLIM_RMC_DISABLE_REQ, pMsgBuf);
5867 break ;
5868#endif /* WLAN_FEATURE_RMC */
5869
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305870 case eWNI_SME_MAC_SPOOF_ADDR_IND:
5871 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
5872 break ;
Abhishek Singh7d624e12015-11-30 14:29:27 +05305873 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
5874 lim_register_mgmt_frame_ind_cb(pMac, pMsgBuf);
5875 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 default:
5877 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5878 pMsg->bodyptr = NULL;
5879 break;
5880 } // switch (msgType)
5881
5882 return bufConsumed;
5883} /*** end limProcessSmeReqMessages() ***/