blob: 07b6b4371b1f1b60d1e5c2cec383ab3e7e390af3 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/**=========================================================================
43
44 \file smeApi.c
45
46 \brief Definitions for SME APIs
47
48 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
49
50 Qualcomm Confidential and Proprietary.
51
52 ========================================================================*/
53
54/*===========================================================================
55
56 EDIT HISTORY FOR FILE
57
58
59 This section contains comments describing changes made to the module.
60 Notice that changes are listed in reverse chronological order.
61
62
63
64 when who what, where, why
65---------- --- --------------------------------------------------------
6606/03/10 js Added support to hostapd driven
67 * deauth/disassoc/mic failure
68
69===========================================================================*/
70
71/*--------------------------------------------------------------------------
72 Include Files
73 ------------------------------------------------------------------------*/
74
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76#include "smsDebug.h"
77#include "sme_Api.h"
78#include "csrInsideApi.h"
79#include "smeInside.h"
80#include "csrInternal.h"
81#include "wlan_qct_wda.h"
82#include "halMsgApi.h"
83
Jeff Johnson295189b2012-06-20 16:38:30 -070084#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070085
86
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
89
90#include <wlan_qct_pal_api.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070091
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080092#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053093#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080094
Jeff Johnson295189b2012-06-20 16:38:30 -070095// TxMB Functions
96extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
97 tANI_U32 size, tSmeCmd **ppCmd );
98extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
99extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -0700100extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
101extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
102extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
103extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
105extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700106
107static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
108static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
109
110eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
111
112eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
113
114eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
115
116eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
117
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700118#ifdef FEATURE_WLAN_LFR
119tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
120#endif
121
Chet Lanctot186b5732013-03-18 10:26:30 -0700122#ifdef WLAN_FEATURE_11W
123eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
124 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
125#endif
126
Jeff Johnson295189b2012-06-20 16:38:30 -0700127//Internal SME APIs
128eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
129{
130 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
131
132 if(psSme)
133 {
134 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
135 {
136 status = eHAL_STATUS_SUCCESS;
137 }
138 }
139
140 return (status);
141}
142
143
144eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
145{
146 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
147
148 if(psSme)
149 {
150 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
151 {
152 status = eHAL_STATUS_SUCCESS;
153 }
154 }
155
156 return (status);
157}
158
159
160
161static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
162{
163 eHalStatus status;
164 tSmeCmd *pCmd;
165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
167 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdActiveList)))
168 {
169 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdPendingList)))
170 {
171 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdFreeList)))
172 {
173 status = palAllocateMemory(pMac->hHdd, (void **)&pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
174 if(HAL_STATUS_SUCCESS(status))
175 {
176 tANI_U32 c;
177
178 palZeroMemory(pMac->hHdd, pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
179 pMac->sme.pSmeCmdBufAddr = pCmd;
180 for(c = 0; c < pMac->sme.totalSmeCmd; c++)
181 {
182 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd[c].Link, LL_ACCESS_LOCK);
183 }
184 }
185 }
186 }
187 }
188
189 return (status);
190}
191
192
193void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
194{
195 pCmd->command = eSmeNoCommand;
196 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
197}
198
199
200
201static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
202{
203 tListElem *pEntry;
204 tSmeCmd *pCommand;
205
206 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
207 {
208 //TODO: base on command type to call release functions
209 //reinitialize different command types so they can be reused
210 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
211 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
212 }
213}
214
215static void purgeSmeCmdList(tpAniSirGlobal pMac)
216{
217 //release any out standing commands back to free command list
218 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
219 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
220}
221
222void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
223{
224 //release any out standing commands back to free command list
225 tListElem *pEntry, *pNext;
226 tSmeCmd *pCommand;
227 tDblLinkList *pList = &pMac->sme.smeCmdPendingList;
228 tDblLinkList localList;
229
230 vos_mem_zero(&localList, sizeof(tDblLinkList));
231 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
232 {
233 smsLog(pMac, LOGE, FL(" failed to open list"));
234 return;
235 }
236
237 csrLLLock(pList);
238 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
239 while(pEntry != NULL)
240 {
241 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
242 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
243 if(pCommand->sessionId == sessionId)
244 {
245 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
246 {
247 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
248 }
249 }
250 pEntry = pNext;
251 }
252 csrLLUnlock(pList);
253
254 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
255 {
256 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
257 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
258 }
259 csrLLClose(&localList);
260
261}
262
263
264static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
265{
266 eHalStatus status = eHAL_STATUS_SUCCESS;
267
268 purgeSmeCmdList(pMac);
269 csrLLClose(&pMac->sme.smeCmdPendingList);
270 csrLLClose(&pMac->sme.smeCmdActiveList);
271 csrLLClose(&pMac->sme.smeCmdFreeList);
272
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800273 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
274 if(status != eHAL_STATUS_SUCCESS)
275 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800276 smsLog(pMac, LOGE,
277 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800278 goto done;
279 }
280
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 if(NULL != pMac->sme.pSmeCmdBufAddr)
282 {
283 status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr);
284 pMac->sme.pSmeCmdBufAddr = NULL;
285 }
286
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800287 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
288 if(status != eHAL_STATUS_SUCCESS)
289 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800290 smsLog(pMac, LOGE,
291 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800292 }
293done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 return (status);
295}
296
297
298void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
299{
300#ifdef WLAN_DEBUG
301 switch( pCmd->command )
302 {
303 case eSmeCommandScan:
304 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
305 break;
306
307 case eSmeCommandRoam:
308 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
309 break;
310
311 case eSmeCommandWmStatusChange:
312 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
313 break;
314
315 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800316 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
318 break;
319
320 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800321 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
323 break;
324
325 default:
326 break;
327 }
328#endif //#ifdef WLAN_DEBUG
329}
330
331tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
332{
333 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
334 tListElem *pEntry;
335
336 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
337
338 // If we can get another MS Msg buffer, then we are ok. Just link
339 // the entry onto the linked list. (We are using the linked list
340 // to keep track of tfhe message buffers).
341 if ( pEntry )
342 {
343 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
344 }
345 else {
346 int idx = 1;
347
348 //Cannot change pRetCmd here since it needs to return later.
349 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
350 if( pEntry )
351 {
352 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
353 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800354 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
356 if(pTempCmd)
357 {
358 if( eSmeCsrCommandMask & pTempCmd->command )
359 {
360 //CSR command is stuck. See what the reason code is for that command
361 dumpCsrCommandInfo(pMac, pTempCmd);
362 }
363 } //if(pTempCmd)
364
365 //dump what is in the pending queue
366 csrLLLock(&pMac->sme.smeCmdPendingList);
367 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
368 while(pEntry)
369 {
370 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800371 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 idx++, pTempCmd->command );
373 if( eSmeCsrCommandMask & pTempCmd->command )
374 {
375 //CSR command is stuck. See what the reason code is for that command
376 dumpCsrCommandInfo(pMac, pTempCmd);
377 }
378 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
379 }
380 csrLLUnlock(&pMac->sme.smeCmdPendingList);
381
382 //There may be some more command in CSR's own pending queue
383 csrLLLock(&pMac->roam.roamCmdPendingList);
384 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
385 while(pEntry)
386 {
387 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800388 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 idx++, pTempCmd->command );
390 dumpCsrCommandInfo(pMac, pTempCmd);
391 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
392 }
393 csrLLUnlock(&pMac->roam.roamCmdPendingList);
394 }
395
396 return( pRetCmd );
397}
398
399
400void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
401{
402 if ( fHighPriority )
403 {
404 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
405 }
406 else
407 {
408 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
409 }
410
411 // process the command queue...
412 smeProcessPendingQueue( pMac );
413
414 return;
415}
416
417
418static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
419{
420 eSmeCommandType pmcCommand = eSmeNoCommand;
421 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
422 tPmcState pmcState;
423 eHalStatus status;
424
425 do
426 {
427 pmcState = pmcGetPmcState(pMac);
428
429 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
430 if( !HAL_STATUS_SUCCESS(status) )
431 {
432 //PMC state is not right for the command, drop it
433 return ( eSmeDropCommand );
434 }
435 if( fFullPowerNeeded ) break;
436 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
437 ( eSmeCommandDelTs == pCommand->command ) );
438 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700439#ifdef FEATURE_OEM_DATA_SUPPORT
440 fFullPowerNeeded = (pmcState == IMPS &&
441 eSmeCommandOemDataReq == pCommand->command);
442 if(fFullPowerNeeded) break;
443#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 fFullPowerNeeded = (pmcState == IMPS &&
445 eSmeCommandRemainOnChannel == pCommand->command);
446 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 } while(0);
448
449 if( fFullPowerNeeded )
450 {
451 switch( pmcState )
452 {
453 case IMPS:
454 case STANDBY:
455 pmcCommand = eSmeCommandExitImps;
456 break;
457
458 case BMPS:
459 pmcCommand = eSmeCommandExitBmps;
460 break;
461
462 case UAPSD:
463 pmcCommand = eSmeCommandExitUapsd;
464 break;
465
466 case WOWL:
467 pmcCommand = eSmeCommandExitWowl;
468 break;
469
470 default:
471 break;
472 }
473 }
474
475 return ( pmcCommand );
476}
477
478
479//For commands that need to do extra cleanup.
480static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
481{
482 if( eSmePmcCommandMask & pCommand->command )
483 {
484 pmcAbortCommand( pMac, pCommand, fStopping );
485 }
486 else if ( eSmeCsrCommandMask & pCommand->command )
487 {
488 csrAbortCommand( pMac, pCommand, fStopping );
489 }
490 else
491 {
492 switch( pCommand->command )
493 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 case eSmeCommandRemainOnChannel:
495 if (NULL != pCommand->u.remainChlCmd.callback)
496 {
497 remainOnChanCallback callback =
498 pCommand->u.remainChlCmd.callback;
499 /* process the msg */
500 if( callback )
501 {
502 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
503 eCSR_SCAN_ABORT );
504 }
505 }
506 smeReleaseCommand( pMac, pCommand );
507 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 default:
509 smeReleaseCommand( pMac, pCommand );
510 break;
511 }
512 }
513}
514
515
516
517tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
518{
519 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
520 eHalStatus status = eHAL_STATUS_SUCCESS;
521 tListElem *pEntry;
522 tSmeCmd *pCommand;
523 eSmeCommandType pmcCommand = eSmeNoCommand;
524
525 // if the ActiveList is empty, then nothing is active so we can process a
526 // pending command...
527 //alwasy lock active list before locking pending list
528 csrLLLock( &pMac->sme.smeCmdActiveList );
529 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
530 {
531 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
532 {
533 //Peek the command
534 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
535 if( pEntry )
536 {
537 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
538 //We cannot execute any command in wait-for-key state until setKey is through.
539 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
540 {
541 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
542 {
543 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800544 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 return ( eANI_BOOLEAN_FALSE );
546 }
547 }
548 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
549 if( eSmeDropCommand == pmcCommand )
550 {
551 //This command is not ok for current PMC state
552 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
553 {
554 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
555 }
556 csrLLUnlock( &pMac->sme.smeCmdActiveList );
557 //tell caller to continue
558 return (eANI_BOOLEAN_TRUE);
559 }
560 else if( eSmeNoCommand != pmcCommand )
561 {
562 tExitBmpsInfo exitBmpsInfo;
563 void *pv = NULL;
564 tANI_U32 size = 0;
565 tSmeCmd *pPmcCmd = NULL;
566
567 if( eSmeCommandExitBmps == pmcCommand )
568 {
569 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
570 pv = (void *)&exitBmpsInfo;
571 size = sizeof(tExitBmpsInfo);
572 }
573 //pmcCommand has to be one of the exit power save command
574 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
575 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
576 {
577 //Force this command to wake up the chip
578 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
579 csrLLUnlock( &pMac->sme.smeCmdActiveList );
580 fContinue = pmcProcessCommand( pMac, pPmcCmd );
581 if( fContinue )
582 {
583 //The command failed, remove it
584 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
585 {
586 pmcReleaseCommand( pMac, pPmcCmd );
587 }
588 }
589 }
590 else
591 {
592 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800593 smsLog( pMac, LOGE, FL( "Cannot issue command(0x%X) to wake up the chip. Status = %d"), pmcCommand, status );
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 //Let it retry
595 fContinue = eANI_BOOLEAN_TRUE;
596 }
597 return fContinue;
598 }
599 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
600 {
601 // we can reuse the pCommand
602
603 // Insert the command onto the ActiveList...
604 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
605
606 // .... and process the command.
607
608 switch ( pCommand->command )
609 {
610
611 case eSmeCommandScan:
612 csrLLUnlock( &pMac->sme.smeCmdActiveList );
613 status = csrProcessScanCommand( pMac, pCommand );
614 break;
615
616 case eSmeCommandRoam:
617 csrLLUnlock( &pMac->sme.smeCmdActiveList );
618 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800619 if(!HAL_STATUS_SUCCESS(status))
620 {
621 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
622 &pCommand->Link, LL_ACCESS_LOCK ) )
623 {
624 csrReleaseCommandRoam( pMac, pCommand );
625 }
626 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 break;
628
629 case eSmeCommandWmStatusChange:
630 csrLLUnlock( &pMac->sme.smeCmdActiveList );
631 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
632 break;
633
634 case eSmeCommandSetKey:
635 csrLLUnlock( &pMac->sme.smeCmdActiveList );
636 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
637 if(!HAL_STATUS_SUCCESS(status))
638 {
639 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
640 &pCommand->Link, LL_ACCESS_LOCK ) )
641 {
642 csrReleaseCommandSetKey( pMac, pCommand );
643 }
644 }
645 break;
646
647 case eSmeCommandRemoveKey:
648 csrLLUnlock( &pMac->sme.smeCmdActiveList );
649 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
650 if(!HAL_STATUS_SUCCESS(status))
651 {
652 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
653 &pCommand->Link, LL_ACCESS_LOCK ) )
654 {
655 csrReleaseCommandRemoveKey( pMac, pCommand );
656 }
657 }
658 break;
659
660 case eSmeCommandAddStaSession:
661 csrLLUnlock( &pMac->sme.smeCmdActiveList );
662 csrProcessAddStaSessionCommand( pMac, pCommand );
663 break;
664 case eSmeCommandDelStaSession:
665 csrLLUnlock( &pMac->sme.smeCmdActiveList );
666 csrProcessDelStaSessionCommand( pMac, pCommand );
667 break;
668
Jeff Johnsone7245742012-09-05 17:12:55 -0700669#ifdef FEATURE_OEM_DATA_SUPPORT
670 case eSmeCommandOemDataReq:
671 csrLLUnlock(&pMac->sme.smeCmdActiveList);
672 oemData_ProcessOemDataReqCommand(pMac, pCommand);
673 break;
674#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 case eSmeCommandRemainOnChannel:
676 csrLLUnlock(&pMac->sme.smeCmdActiveList);
677 p2pProcessRemainOnChannelCmd(pMac, pCommand);
678 break;
679 case eSmeCommandNoAUpdate:
680 csrLLUnlock( &pMac->sme.smeCmdActiveList );
681 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case eSmeCommandEnterImps:
683 case eSmeCommandExitImps:
684 case eSmeCommandEnterBmps:
685 case eSmeCommandExitBmps:
686 case eSmeCommandEnterUapsd:
687 case eSmeCommandExitUapsd:
688 case eSmeCommandEnterWowl:
689 case eSmeCommandExitWowl:
690 csrLLUnlock( &pMac->sme.smeCmdActiveList );
691 fContinue = pmcProcessCommand( pMac, pCommand );
692 if( fContinue )
693 {
694 //The command failed, remove it
695 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
696 &pCommand->Link, LL_ACCESS_LOCK ) )
697 {
698 pmcReleaseCommand( pMac, pCommand );
699 }
700 }
701 break;
702
703 //Treat standby differently here because caller may not be able to handle
704 //the failure so we do our best here
705 case eSmeCommandEnterStandby:
706 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
707 {
708 //It can continue
709 csrLLUnlock( &pMac->sme.smeCmdActiveList );
710 fContinue = pmcProcessCommand( pMac, pCommand );
711 if( fContinue )
712 {
713 //The command failed, remove it
714 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
715 &pCommand->Link, LL_ACCESS_LOCK ) )
716 {
717 pmcReleaseCommand( pMac, pCommand );
718 }
719 }
720 }
721 else
722 {
723 //Need to issue a disconnect first before processing this command
724 tSmeCmd *pNewCmd;
725
726 //We need to re-run the command
727 fContinue = eANI_BOOLEAN_TRUE;
728 //Pull off the standby command first
729 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
730 &pCommand->Link, LL_ACCESS_NOLOCK ) )
731 {
732 csrLLUnlock( &pMac->sme.smeCmdActiveList );
733 //Need to call CSR function here because the disconnect command
734 //is handled by CSR
735 pNewCmd = csrGetCommandBuffer( pMac );
736 if( NULL != pNewCmd )
737 {
738 //Put the standby command to the head of the pending list first
739 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
740 LL_ACCESS_LOCK );
741 pNewCmd->command = eSmeCommandRoam;
742 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
743 //Put the disassoc command before the standby command
744 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
745 LL_ACCESS_LOCK );
746 }
747 else
748 {
749 //Continue the command here
750 fContinue = pmcProcessCommand( pMac, pCommand );
751 if( fContinue )
752 {
753 //The command failed, remove it
754 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
755 &pCommand->Link, LL_ACCESS_LOCK ) )
756 {
757 pmcReleaseCommand( pMac, pCommand );
758 }
759 }
760 }
761 }
762 else
763 {
764 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800765 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 VOS_ASSERT(0);
767 }
768 }
769 break;
770
771 case eSmeCommandAddTs:
772 case eSmeCommandDelTs:
773 csrLLUnlock( &pMac->sme.smeCmdActiveList );
774#ifndef WLAN_MDM_CODE_REDUCTION_OPT
775 fContinue = qosProcessCommand( pMac, pCommand );
776 if( fContinue )
777 {
778 //The command failed, remove it
779 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
780 &pCommand->Link, LL_ACCESS_NOLOCK ) )
781 {
782//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
783 qosReleaseCommand( pMac, pCommand );
784//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
785 }
786 }
787#endif
788 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800789#ifdef FEATURE_WLAN_TDLS
790 case eSmeCommandTdlsSendMgmt:
791 case eSmeCommandTdlsAddPeer:
792 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530793 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800794#ifdef FEATURE_WLAN_TDLS_INTERNAL
795 case eSmeCommandTdlsDiscovery:
796 case eSmeCommandTdlsLinkSetup:
797 case eSmeCommandTdlsLinkTear:
798 case eSmeCommandTdlsEnterUapsd:
799 case eSmeCommandTdlsExitUapsd:
800#endif
801 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800802 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800803 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800804
805 csrLLUnlock( &pMac->sme.smeCmdActiveList );
806 status = csrTdlsProcessCmd( pMac, pCommand );
807 }
808 break ;
809#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700810
811 default:
812 //something is wrong
813 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800814 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
816 csrLLUnlock( &pMac->sme.smeCmdActiveList );
817 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
818 smeReleaseCommand( pMac, pCommand );
819 status = eHAL_STATUS_FAILURE;
820 break;
821 }
822 if(!HAL_STATUS_SUCCESS(status))
823 {
824 fContinue = eANI_BOOLEAN_TRUE;
825 }
826 }//if(pEntry)
827 else
828 {
829 //This is odd. Some one else pull off the command.
830 csrLLUnlock( &pMac->sme.smeCmdActiveList );
831 }
832 }
833 else
834 {
835 csrLLUnlock( &pMac->sme.smeCmdActiveList );
836 }
837 }
838 else
839 {
840 //No command waiting
841 csrLLUnlock( &pMac->sme.smeCmdActiveList );
842 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
843 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
844 {
845 tANI_U32 nTime = 0;
846
847 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
848 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
849 {
850 csrScanStartIdleScanTimer(pMac, nTime);
851 }
852 }
853 }
854 }
855 else {
856 csrLLUnlock( &pMac->sme.smeCmdActiveList );
857 }
858
859 return ( fContinue );
860}
861
862void smeProcessPendingQueue( tpAniSirGlobal pMac )
863{
864 while( smeProcessCommand( pMac ) );
865}
866
867
868tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
869{
870 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
871 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
872}
873
874
875
876//Global APIs
877
878/*--------------------------------------------------------------------------
879
880 \brief sme_Open() - Initialze all SME modules and put them at idle state
881
882 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
883 successfully return, all modules are at idle state ready to start.
884
885 smeOpen must be called before any other SME APIs can be involved.
886 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -0800887 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 \param hHal - The handle returned by macOpen.
889
890 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
891
892 Other status means SME is failed to be initialized
893 \sa
894
895 --------------------------------------------------------------------------*/
896eHalStatus sme_Open(tHalHandle hHal)
897{
898 eHalStatus status = eHAL_STATUS_FAILURE;
899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
900
901 do {
902 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -0700903 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
905 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800906 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 status = eHAL_STATUS_FAILURE;
908 break;
909 }
910
911 status = ccmOpen(hHal);
912 if ( ! HAL_STATUS_SUCCESS( status ) ) {
913 smsLog( pMac, LOGE,
914 "ccmOpen failed during initialization with status=%d", status );
915 break;
916 }
917
918 status = csrOpen(pMac);
919 if ( ! HAL_STATUS_SUCCESS( status ) ) {
920 smsLog( pMac, LOGE,
921 "csrOpen failed during initialization with status=%d", status );
922 break;
923 }
924
925 status = pmcOpen(hHal);
926 if ( ! HAL_STATUS_SUCCESS( status ) ) {
927 smsLog( pMac, LOGE,
928 "pmcOpen failed during initialization with status=%d", status );
929 break;
930 }
931
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700932#ifdef FEATURE_WLAN_TDLS
933 pMac->isTdlsPowerSaveProhibited = 0;
934#endif
935
Jeff Johnson295189b2012-06-20 16:38:30 -0700936#ifndef WLAN_MDM_CODE_REDUCTION_OPT
937 status = sme_QosOpen(pMac);
938 if ( ! HAL_STATUS_SUCCESS( status ) ) {
939 smsLog( pMac, LOGE,
940 "Qos open failed during initialization with status=%d", status );
941 break;
942 }
943
944 status = btcOpen(pMac);
945 if ( ! HAL_STATUS_SUCCESS( status ) ) {
946 smsLog( pMac, LOGE,
947 "btcOpen open failed during initialization with status=%d", status );
948 break;
949 }
950#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700951#ifdef FEATURE_OEM_DATA_SUPPORT
952 status = oemData_OemDataReqOpen(pMac);
953 if ( ! HAL_STATUS_SUCCESS( status ) ) {
954 smsLog(pMac, LOGE,
955 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
956 break;
957 }
958#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700959
960 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
961 break;
962
Jeff Johnson295189b2012-06-20 16:38:30 -0700963 {
964 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
965 if ( NULL == pvosGCtx ){
966 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
967 status = eHAL_STATUS_FAILURE;
968 break;
969 }
970
971 status = WLANSAP_Open( pvosGCtx );
972 if ( ! HAL_STATUS_SUCCESS( status ) ) {
973 smsLog( pMac, LOGE,
974 "WLANSAP_Open open failed during initialization with status=%d", status );
975 break;
976 }
977 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700978#if defined WLAN_FEATURE_VOWIFI
979 status = rrmOpen(pMac);
980 if ( ! HAL_STATUS_SUCCESS( status ) ) {
981 smsLog( pMac, LOGE,
982 "rrmOpen open failed during initialization with status=%d", status );
983 break;
984 }
985#endif
986
987#if defined WLAN_FEATURE_VOWIFI_11R
988 sme_FTOpen(pMac);
989#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700991
992 }while (0);
993
994 return status;
995}
996
Jeff Johnson295189b2012-06-20 16:38:30 -0700997/*--------------------------------------------------------------------------
998
999 \brief sme_set11dinfo() - Set the 11d information about valid channels
1000 and there power using information from nvRAM
1001 This function is called only for AP.
1002
Srinivas Girigowdade697412013-02-14 16:31:48 -08001003 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001004
1005 \param hHal - The handle returned by macOpen.
1006 \Param pSmeConfigParams - a pointer to a caller allocated object of
1007 typedef struct _smeConfigParams.
1008
1009 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1010
1011 Other status means SME is failed to update the config parameters.
1012 \sa
1013--------------------------------------------------------------------------*/
1014
1015eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1016{
1017 eHalStatus status = eHAL_STATUS_FAILURE;
1018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1019
1020 if (NULL == pSmeConfigParams ) {
1021 smsLog( pMac, LOGE,
1022 "Empty config param structure for SME, nothing to update");
1023 return status;
1024 }
1025
1026 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1027 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001028 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 status );
1030 }
1031 return status;
1032}
1033
1034/*--------------------------------------------------------------------------
1035
1036 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1037
Srinivas Girigowdade697412013-02-14 16:31:48 -08001038 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001039
1040 \param hHal - The handle returned by HostapdAdapter.
1041 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1042
1043 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1044
1045 Other status means, failed to get the current regulatory domain.
1046 \sa
1047--------------------------------------------------------------------------*/
1048
1049eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1050{
1051 eHalStatus status = eHAL_STATUS_FAILURE;
1052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1053
1054 if (NULL == domainIdSoftAp ) {
1055 smsLog( pMac, LOGE, "Uninitialized domain Id");
1056 return status;
1057 }
1058
1059 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1060 status = eHAL_STATUS_SUCCESS;
1061
1062 return status;
1063}
1064
1065
1066eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1067{
1068 eHalStatus status = eHAL_STATUS_FAILURE;
1069 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1070
1071 if (NULL == apCntryCode ) {
1072 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1073 return status;
1074 }
1075
1076 status = csrSetRegInfo(hHal, apCntryCode );
1077 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001078 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 status );
1080 }
1081 return status;
1082}
1083
Jeff Johnson295189b2012-06-20 16:38:30 -07001084#ifdef FEATURE_WLAN_SCAN_PNO
1085/*--------------------------------------------------------------------------
1086
1087 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1088
1089 It is used at driver start up to inform RIVA of the default channel
1090 configuration.
1091
Srinivas Girigowdade697412013-02-14 16:31:48 -08001092 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001093
1094 \param hHal - The handle returned by macOpen.
1095
1096 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1097
1098 Other status means SME is failed to update the channel config.
1099 \sa
1100
1101 --------------------------------------------------------------------------*/
1102eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1103{
1104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1105
1106 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1107 &pMac->scan.base20MHzChannels, FALSE);
1108 return eHAL_STATUS_SUCCESS;
1109}
1110#endif // FEATURE_WLAN_SCAN_PNLO
1111
1112/*--------------------------------------------------------------------------
1113
1114 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1115
1116 The function updates some configuration for modules in SME, CCM, CSR, etc
1117 during SMEs close open sequence.
1118
1119 Modules inside SME apply the new configuration at the next transaction.
1120
Srinivas Girigowdade697412013-02-14 16:31:48 -08001121 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001122
1123 \param hHal - The handle returned by macOpen.
1124 \Param pSmeConfigParams - a pointer to a caller allocated object of
1125 typedef struct _smeConfigParams.
1126
1127 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1128
1129 Other status means SME is failed to update the config parameters.
1130 \sa
1131
1132 --------------------------------------------------------------------------*/
1133eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1134{
1135 eHalStatus status = eHAL_STATUS_FAILURE;
1136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1137
1138 if (NULL == pSmeConfigParams ) {
1139 smsLog( pMac, LOGE,
1140 "Empty config param structure for SME, nothing to update");
1141 return status;
1142 }
1143
1144 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1145
1146 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001147 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001148 status );
1149 }
1150#if defined WLAN_FEATURE_P2P_INTERNAL
1151 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1152
1153 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001154 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001155 status );
1156 }
1157#endif
1158#if defined WLAN_FEATURE_VOWIFI
1159 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1160
1161 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001162 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001163 status );
1164 }
1165#endif
1166 //For SOC, CFG is set before start
1167 //We don't want to apply global CFG in connect state because that may cause some side affect
1168 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 csrIsAllSessionDisconnected( pMac) )
1170 {
1171 csrSetGlobalCfgs(pMac);
1172 }
1173
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301174 /* update the directed scan offload setting */
1175 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1176
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 return status;
1178}
1179
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301180#ifdef WLAN_FEATURE_GTK_OFFLOAD
1181void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1182 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1183{
1184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1185
1186 if (NULL == pMac)
1187 {
1188 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1189 "%s: pMac is null", __func__);
1190 return ;
1191 }
1192 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1193 {
1194 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1195 "%s: HDD callback is null", __func__);
1196 return ;
1197 }
1198 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1199 pGtkOffloadGetInfoRsp);
1200}
1201#endif
1202
Jeff Johnson295189b2012-06-20 16:38:30 -07001203/* ---------------------------------------------------------------------------
1204 \fn sme_ChangeConfigParams
1205 \brief The SME API exposed for HDD to provide config params to SME during
1206 SMEs stop -> start sequence.
1207
1208 If HDD changed the domain that will cause a reset. This function will
1209 provide the new set of 11d information for the new domain. Currrently this
1210 API provides info regarding 11d only at reset but we can extend this for
1211 other params (PMC, QoS) which needs to be initialized again at reset.
1212
Srinivas Girigowdade697412013-02-14 16:31:48 -08001213 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001214
1215 \param hHal - The handle returned by macOpen.
1216
1217 \Param
1218 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1219 currently provides 11d related information like Country code,
1220 Regulatory domain, valid channel list, Tx power per channel, a
1221 list with active/passive scan allowed per valid channel.
1222
1223 \return eHalStatus
1224 ---------------------------------------------------------------------------*/
1225eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1226 tCsrUpdateConfigParam *pUpdateConfigParam)
1227{
1228 eHalStatus status = eHAL_STATUS_FAILURE;
1229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1230
1231 if (NULL == pUpdateConfigParam ) {
1232 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001233 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 return status;
1235 }
1236
1237 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1238
1239 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001240 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001241 status );
1242 }
1243
1244 return status;
1245
1246}
1247
1248/*--------------------------------------------------------------------------
1249
1250 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1251 that the NIC is ready tio run.
1252
1253 The function is called by HDD at the end of initialization stage so PE/HAL can
1254 enable the NIC to running state.
1255
Srinivas Girigowdade697412013-02-14 16:31:48 -08001256 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001257 \param hHal - The handle returned by macOpen.
1258
1259 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1260 successfully.
1261
1262 Other status means SME failed to send the message to PE.
1263 \sa
1264
1265 --------------------------------------------------------------------------*/
1266eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1267{
1268 tSirSmeReadyReq Msg;
1269 eHalStatus status = eHAL_STATUS_FAILURE;
1270 tPmcPowerState powerState;
1271 tPmcSwitchState hwWlanSwitchState;
1272 tPmcSwitchState swWlanSwitchState;
1273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1274
1275 do
1276 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001277
1278 Msg.messageType = eWNI_SME_SYS_READY_IND;
1279 Msg.length = sizeof( tSirSmeReadyReq );
1280
1281 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1282 {
1283 status = eHAL_STATUS_SUCCESS;
1284 }
1285 else
1286 {
1287 smsLog( pMac, LOGE,
1288 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1289 break;
1290 }
1291
1292 status = pmcQueryPowerState( hHal, &powerState,
1293 &hwWlanSwitchState, &swWlanSwitchState );
1294 if ( ! HAL_STATUS_SUCCESS( status ) )
1295 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001296 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 status );
1298 break;
1299 }
1300
1301 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1302 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1303 {
1304 status = csrReady(pMac);
1305 if ( ! HAL_STATUS_SUCCESS( status ) )
1306 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001307 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 break;
1309 }
1310 status = pmcReady(hHal);
1311 if ( ! HAL_STATUS_SUCCESS( status ) )
1312 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001313 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 break;
1315 }
1316#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1317 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1318 {
1319 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001320 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001321 break;
1322 }
1323#endif
1324
1325#if defined WLAN_FEATURE_VOWIFI
1326 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1327 {
1328 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001329 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 break;
1331 }
1332#endif
1333 }
1334 pMac->sme.state = SME_STATE_READY;
1335 } while( 0 );
1336
1337 return status;
1338}
1339
1340/*--------------------------------------------------------------------------
1341
1342 \brief sme_Start() - Put all SME modules at ready state.
1343
1344 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1345 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001346 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 \param hHal - The handle returned by macOpen.
1348
1349 \return eHAL_STATUS_SUCCESS - SME is ready.
1350
1351 Other status means SME is failed to start
1352 \sa
1353
1354 --------------------------------------------------------------------------*/
1355eHalStatus sme_Start(tHalHandle hHal)
1356{
1357 eHalStatus status = eHAL_STATUS_FAILURE;
1358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1359
1360 do
1361 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 status = csrStart(pMac);
1363 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001364 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 status );
1366 break;
1367 }
1368
1369 status = pmcStart(hHal);
1370 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001371 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001372 status );
1373 break;
1374 }
1375
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1377 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001378 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 status );
1380 break;
1381 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001382 pMac->sme.state = SME_STATE_START;
1383 }while (0);
1384
1385 return status;
1386}
1387
1388
1389#ifdef WLAN_FEATURE_PACKET_FILTERING
1390/******************************************************************************
1391*
1392* Name: sme_PCFilterMatchCountResponseHandler
1393*
1394* Description:
1395* Invoke Packet Coalescing Filter Match Count callback routine
1396*
1397* Parameters:
1398* hHal - HAL handle for device
1399* pMsg - Pointer to tRcvFltPktMatchRsp structure
1400*
1401* Returns: eHalStatus
1402*
1403******************************************************************************/
1404eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1405{
1406 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1407 eHalStatus status = eHAL_STATUS_SUCCESS;
1408 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1409
1410 if (NULL == pMsg)
1411 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001412 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 status = eHAL_STATUS_FAILURE;
1414 }
1415 else
1416 {
1417 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001418 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
1420 /* Call Packet Coalescing Filter Match Count callback routine. */
1421 if (pMac->pmc.FilterMatchCountCB != NULL)
1422 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1423 pRcvFltPktMatchRsp);
1424
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001425 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001426 pRcvFltPktMatchRsp->status);
1427
1428 pMac->pmc.FilterMatchCountCB = NULL;
1429 pMac->pmc.FilterMatchCountCBContext = NULL;
1430 }
1431
1432 return(status);
1433}
1434#endif // WLAN_FEATURE_PACKET_FILTERING
1435
1436
Chet Lanctot186b5732013-03-18 10:26:30 -07001437#ifdef WLAN_FEATURE_11W
1438/*------------------------------------------------------------------
1439 *
1440 * Handle the unprotected management frame indication from LIM and
1441 * forward it to HDD.
1442 *
1443 *------------------------------------------------------------------*/
1444
1445eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1446 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1447{
1448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1449 eHalStatus status = eHAL_STATUS_SUCCESS;
1450 tCsrRoamInfo pRoamInfo = {0};
1451 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1452
1453 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1454 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1455 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1456
1457 /* forward the mgmt frame to HDD */
1458 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1459
1460 return status;
1461}
1462#endif
1463
1464
Jeff Johnson295189b2012-06-20 16:38:30 -07001465/*--------------------------------------------------------------------------
1466
1467 \brief sme_ProcessMsg() - The main message processor for SME.
1468
1469 The function is called by a message dispatcher when to process a message
1470 targeted for SME.
1471
Srinivas Girigowdade697412013-02-14 16:31:48 -08001472 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 \param hHal - The handle returned by macOpen.
1474 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1475
1476 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1477
1478 Other status means SME failed to process the message to HAL.
1479 \sa
1480
1481 --------------------------------------------------------------------------*/
1482eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1483{
1484 eHalStatus status = eHAL_STATUS_FAILURE;
1485 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1486
1487 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001488 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 return status;
1490 }
1491
1492 status = sme_AcquireGlobalLock( &pMac->sme );
1493 if ( HAL_STATUS_SUCCESS( status ) )
1494 {
1495 if( SME_IS_START(pMac) )
1496 {
1497 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1498 case eWNI_PMC_ENTER_BMPS_RSP:
1499 case eWNI_PMC_EXIT_BMPS_RSP:
1500 case eWNI_PMC_EXIT_BMPS_IND:
1501 case eWNI_PMC_ENTER_IMPS_RSP:
1502 case eWNI_PMC_EXIT_IMPS_RSP:
1503 case eWNI_PMC_SMPS_STATE_IND:
1504 case eWNI_PMC_ENTER_UAPSD_RSP:
1505 case eWNI_PMC_EXIT_UAPSD_RSP:
1506 case eWNI_PMC_ENTER_WOWL_RSP:
1507 case eWNI_PMC_EXIT_WOWL_RSP:
1508 //PMC
1509 if (pMsg->bodyptr)
1510 {
1511 pmcMessageProcessor(hHal, pMsg->bodyptr);
1512 status = eHAL_STATUS_SUCCESS;
1513 vos_mem_free( pMsg->bodyptr );
1514 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001515 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 }
1517 break;
1518
1519 case WNI_CFG_SET_CNF:
1520 case WNI_CFG_DNLD_CNF:
1521 case WNI_CFG_GET_RSP:
1522 case WNI_CFG_ADD_GRP_ADDR_CNF:
1523 case WNI_CFG_DEL_GRP_ADDR_CNF:
1524 //CCM
1525 if (pMsg->bodyptr)
1526 {
1527 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1528 status = eHAL_STATUS_SUCCESS;
1529 vos_mem_free( pMsg->bodyptr );
1530 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001531 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001532 }
1533 break;
1534
1535 case eWNI_SME_ADDTS_RSP:
1536 case eWNI_SME_DELTS_RSP:
1537 case eWNI_SME_DELTS_IND:
1538#ifdef WLAN_FEATURE_VOWIFI_11R
1539 case eWNI_SME_FT_AGGR_QOS_RSP:
1540#endif
1541 //QoS
1542 if (pMsg->bodyptr)
1543 {
1544#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1545 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1546 vos_mem_free( pMsg->bodyptr );
1547#endif
1548 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001549 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 }
1551 break;
1552#if defined WLAN_FEATURE_VOWIFI
1553 case eWNI_SME_NEIGHBOR_REPORT_IND:
1554 case eWNI_SME_BEACON_REPORT_REQ_IND:
1555#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001556 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001557#endif
1558 if ( pMsg->bodyptr )
1559 {
1560 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
1561 vos_mem_free( pMsg->bodyptr );
1562 }
1563 else
1564 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001565 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 }
1567 break;
1568#endif
1569
Jeff Johnsone7245742012-09-05 17:12:55 -07001570#ifdef FEATURE_OEM_DATA_SUPPORT
1571 //Handle the eWNI_SME_OEM_DATA_RSP:
1572 case eWNI_SME_OEM_DATA_RSP:
1573 if(pMsg->bodyptr)
1574 {
1575 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1576 vos_mem_free(pMsg->bodyptr);
1577 }
1578 else
1579 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001580 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001581 }
1582 smeProcessPendingQueue( pMac );
1583 break;
1584#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001585
1586 case eWNI_SME_ADD_STA_SELF_RSP:
1587 if(pMsg->bodyptr)
1588 {
1589 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1590 vos_mem_free(pMsg->bodyptr);
1591 }
1592 else
1593 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001594 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 }
1596 break;
1597 case eWNI_SME_DEL_STA_SELF_RSP:
1598 if(pMsg->bodyptr)
1599 {
1600 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1601 vos_mem_free(pMsg->bodyptr);
1602 }
1603 else
1604 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001605 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 }
1607 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 case eWNI_SME_REMAIN_ON_CHN_RSP:
1609 if(pMsg->bodyptr)
1610 {
1611 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1612 vos_mem_free(pMsg->bodyptr);
1613 }
1614 else
1615 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001616 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 }
1618 break;
1619 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1620 if(pMsg->bodyptr)
1621 {
1622 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1623 vos_mem_free(pMsg->bodyptr);
1624 }
1625 else
1626 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001627 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RDY_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 }
1629 break;
1630 case eWNI_SME_MGMT_FRM_IND:
1631 if(pMsg->bodyptr)
1632 {
1633 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1634 vos_mem_free(pMsg->bodyptr);
1635 }
1636 else
1637 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001638 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 }
1640 break;
1641 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1642 if(pMsg->bodyptr)
1643 {
1644 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1645 vos_mem_free(pMsg->bodyptr);
1646 }
1647 else
1648 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001649 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 }
1651 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 case eWNI_SME_COEX_IND:
1653 if(pMsg->bodyptr)
1654 {
1655 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1656 vos_mem_free(pMsg->bodyptr);
1657 }
1658 else
1659 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001660 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 }
1662 break;
1663
1664#ifdef FEATURE_WLAN_SCAN_PNO
1665 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1666 if(pMsg->bodyptr)
1667 {
1668 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1669 vos_mem_free(pMsg->bodyptr);
1670 }
1671 else
1672 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001673 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 }
1675 break;
1676#endif // FEATURE_WLAN_SCAN_PNO
1677
1678 case eWNI_SME_TX_PER_HIT_IND:
1679 if (pMac->sme.pTxPerHitCallback)
1680 {
1681 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1682 }
1683 break;
1684
1685 case eWNI_SME_CHANGE_COUNTRY_CODE:
1686 if(pMsg->bodyptr)
1687 {
1688 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1689 vos_mem_free(pMsg->bodyptr);
1690 }
1691 else
1692 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001693 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 }
1695 break;
1696
1697#ifdef WLAN_FEATURE_PACKET_FILTERING
1698 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1699 if(pMsg->bodyptr)
1700 {
1701 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1702 vos_mem_free(pMsg->bodyptr);
1703 }
1704 else
1705 {
1706 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001707 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001708 }
1709 break;
1710#endif // WLAN_FEATURE_PACKET_FILTERING
1711 case eWNI_SME_PRE_SWITCH_CHL_IND:
1712 {
1713 status = sme_HandlePreChannelSwitchInd(pMac);
1714 break;
1715 }
1716
1717 case eWNI_SME_POST_SWITCH_CHL_IND:
1718 {
1719 status = sme_HandlePostChannelSwitchInd(pMac);
1720 break;
1721 }
1722
1723#ifdef WLAN_WAKEUP_EVENTS
1724 case eWNI_SME_WAKE_REASON_IND:
1725 if(pMsg->bodyptr)
1726 {
1727 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1728 vos_mem_free(pMsg->bodyptr);
1729 }
1730 else
1731 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001732 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001733 }
1734 break;
1735#endif // WLAN_WAKEUP_EVENTS
1736
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001737#ifdef FEATURE_WLAN_TDLS
1738 /*
1739 * command rescived from PE, SME tdls msg processor shall be called
1740 * to process commands recieved from PE
1741 */
1742 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1743 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001744 case eWNI_SME_TDLS_DEL_STA_RSP:
1745 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001746 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001747 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301748 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301749#ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP
1750 case eWNI_SME_TDLS_AP_DISAPPEAR_IND:
1751#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001752#ifdef FEATURE_WLAN_TDLS_INTERNAL
1753 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1754 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1755 case eWNI_SME_TDLS_LINK_START_RSP:
1756 case eWNI_SME_TDLS_LINK_START_IND:
1757 case eWNI_SME_TDLS_TEARDOWN_RSP:
1758 case eWNI_SME_TDLS_TEARDOWN_IND:
1759 case eWNI_SME_ADD_TDLS_PEER_IND:
1760 case eWNI_SME_DELETE_TDLS_PEER_IND:
1761#endif
1762 {
1763 if (pMsg->bodyptr)
1764 {
1765 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1766 vos_mem_free( pMsg->bodyptr );
1767 }
1768 else
1769 {
1770 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001771 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001772 }
1773 break;
1774 }
1775#endif
1776
Chet Lanctot186b5732013-03-18 10:26:30 -07001777#ifdef WLAN_FEATURE_11W
1778 case eWNI_SME_UNPROT_MGMT_FRM_IND:
1779 if (pMsg->bodyptr)
1780 {
1781 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
1782 vos_mem_free(pMsg->bodyptr);
1783 }
1784 else
1785 {
1786 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
1787 }
1788 break;
1789#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001790#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1791 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
1792 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
1793 break;
1794#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07001795
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301796#ifdef WLAN_FEATURE_GTK_OFFLOAD
1797 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
1798 if (pMsg->bodyptr)
1799 {
1800 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
1801 vos_mem_free(pMsg->bodyptr);
1802 }
1803 else
1804 {
1805 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
1806 }
1807 break ;
1808#endif
Leo Chang9056f462013-08-01 19:21:11 -07001809
1810#ifdef FEATURE_WLAN_LPHB
1811 /* LPHB timeout indication arrived, send IND to client */
1812 case eWNI_SME_LPHB_WAIT_TIMEOUT_IND:
1813 if (pMac->sme.pLphbWaitTimeoutCb)
1814 {
1815 pMac->sme.pLphbWaitTimeoutCb(pMac->pAdapter, pMsg->bodyptr);
1816 }
1817 vos_mem_free(pMsg->bodyptr);
1818
1819 break;
1820#endif /* FEATURE_WLAN_LPHB */
1821
Jeff Johnson295189b2012-06-20 16:38:30 -07001822 default:
1823
1824 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
1825 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
1826 {
1827 //CSR
1828 if (pMsg->bodyptr)
1829 {
1830 status = csrMsgProcessor(hHal, pMsg->bodyptr);
1831 vos_mem_free( pMsg->bodyptr );
1832 }
1833 else
1834 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001835 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001836 }
1837 }
1838 else
1839 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001840 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 pMsg->type);
1842 if (pMsg->bodyptr)
1843 {
1844 vos_mem_free( pMsg->bodyptr );
1845 }
1846 }
1847 }//switch
1848 } //SME_IS_START
1849 else
1850 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001851 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 if (pMsg->bodyptr)
1853 {
1854 vos_mem_free( pMsg->bodyptr );
1855 }
1856 }
1857 sme_ReleaseGlobalLock( &pMac->sme );
1858 }
1859 else
1860 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001861 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 if (pMsg->bodyptr)
1863 {
1864 vos_mem_free( pMsg->bodyptr );
1865 }
1866 }
1867
1868 return status;
1869}
1870
1871
1872//No need to hold the global lock here because this function can only be called
1873//after sme_Stop.
1874v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
1875{
1876 if( pMsg )
1877 {
1878 if (pMsg->bodyptr)
1879 {
1880 vos_mem_free( pMsg->bodyptr );
1881 }
1882 }
1883
1884}
1885
1886
1887/*--------------------------------------------------------------------------
1888
1889 \brief sme_Stop() - Stop all SME modules and put them at idle state
1890
1891 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
1892 return, all modules are at idle state ready to start.
1893
Srinivas Girigowdade697412013-02-14 16:31:48 -08001894 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 \param hHal - The handle returned by macOpen
1896
1897 \return eHAL_STATUS_SUCCESS - SME is stopped.
1898
1899 Other status means SME is failed to stop but caller should still
1900 consider SME is stopped.
1901 \sa
1902
1903 --------------------------------------------------------------------------*/
1904eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
1905{
1906 eHalStatus status = eHAL_STATUS_FAILURE;
1907 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1908 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1909
Jeff Johnson295189b2012-06-20 16:38:30 -07001910 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1911 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001912 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 status );
1914 fail_status = status;
1915 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001916
1917 p2pStop(hHal);
1918
1919 if(pmcFlag)
1920 {
1921 status = pmcStop(hHal);
1922 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001923 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 status );
1925 fail_status = status;
1926 }
1927 }
1928
1929 status = csrStop(pMac);
1930 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001931 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 status );
1933 fail_status = status;
1934 }
1935
1936 ccmStop(hHal);
1937
1938 purgeSmeCmdList(pMac);
1939
1940 if (!HAL_STATUS_SUCCESS( fail_status )) {
1941 status = fail_status;
1942 }
1943
1944 pMac->sme.state = SME_STATE_STOP;
1945
1946 return status;
1947}
1948
1949/*--------------------------------------------------------------------------
1950
1951 \brief sme_Close() - Release all SME modules and their resources.
1952
1953 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
1954 return, all modules are at closed state.
1955
1956 No SME APIs can be involved after smeClose except smeOpen.
1957 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001958 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 \param hHal - The handle returned by macOpen
1960
1961 \return eHAL_STATUS_SUCCESS - SME is successfully close.
1962
1963 Other status means SME is failed to be closed but caller still cannot
1964 call any other SME functions except smeOpen.
1965 \sa
1966
1967 --------------------------------------------------------------------------*/
1968eHalStatus sme_Close(tHalHandle hHal)
1969{
1970 eHalStatus status = eHAL_STATUS_FAILURE;
1971 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1972 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1973
1974 status = csrClose(pMac);
1975 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001976 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 status );
1978 fail_status = status;
1979 }
1980
Jeff Johnson295189b2012-06-20 16:38:30 -07001981 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1982 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001983 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 status );
1985 fail_status = status;
1986 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001987
1988#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1989 status = btcClose(hHal);
1990 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001991 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 status );
1993 fail_status = status;
1994 }
1995
1996 status = sme_QosClose(pMac);
1997 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001998 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 status );
2000 fail_status = status;
2001 }
2002#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002003#ifdef FEATURE_OEM_DATA_SUPPORT
2004 status = oemData_OemDataReqClose(hHal);
2005 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002006 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002007 status );
2008 fail_status = status;
2009 }
2010#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002011
2012 status = ccmClose(hHal);
2013 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002014 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 status );
2016 fail_status = status;
2017 }
2018
2019 status = pmcClose(hHal);
2020 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002021 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 status );
2023 fail_status = status;
2024 }
2025#if defined WLAN_FEATURE_VOWIFI
2026 status = rrmClose(hHal);
2027 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002028 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 status );
2030 fail_status = status;
2031 }
2032#endif
2033
2034#if defined WLAN_FEATURE_VOWIFI_11R
2035 sme_FTClose(hHal);
2036#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002038
2039 freeSmeCmdList(pMac);
2040
2041 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2042 {
2043 fail_status = eHAL_STATUS_FAILURE;
2044 }
2045
2046 if (!HAL_STATUS_SUCCESS( fail_status )) {
2047 status = fail_status;
2048 }
2049
2050 pMac->sme.state = SME_STATE_STOP;
2051
2052 return status;
2053}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002054#ifdef FEATURE_WLAN_LFR
2055tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2056{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002057#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002058 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2059 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2060 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2061 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2062 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2063 return eANI_BOOLEAN_FALSE;
2064 default:
2065 return eANI_BOOLEAN_TRUE;
2066 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002067#else
2068 /*
2069 * TODO: always return TRUE for now until
2070 * we figure out why we could be stuck in
2071 * one of the roaming states forever.
2072 */
2073 return eANI_BOOLEAN_TRUE;
2074#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002075}
2076#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002077/* ---------------------------------------------------------------------------
2078 \fn sme_ScanRequest
2079 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002080 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002081 \param pScanRequestID - pointer to an object to get back the request ID
2082 \param callback - a callback function that scan calls upon finish, will not
2083 be called if csrScanRequest returns error
2084 \param pContext - a pointer passed in for the callback
2085 \return eHalStatus
2086 ---------------------------------------------------------------------------*/
2087eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2088 tANI_U32 *pScanRequestID,
2089 csrScanCompleteCallback callback, void *pContext)
2090{
2091 eHalStatus status = eHAL_STATUS_FAILURE;
2092 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2093
2094 smsLog(pMac, LOG2, FL("enter"));
2095 do
2096 {
2097 if(pMac->scan.fScanEnable)
2098 {
2099 status = sme_AcquireGlobalLock( &pMac->sme );
2100 if ( HAL_STATUS_SUCCESS( status ) )
2101 {
2102 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002103#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002104 if(csrIsScanAllowed(pMac))
2105 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002106#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002107 status = csrScanRequest( hHal, sessionId, pscanReq,
2108 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002109#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002110 }
2111 else
2112 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002113 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2114 pMac->roam.neighborRoamInfo.neighborRoamState,
2115 pMac->roam.curSubState[sessionId]);
2116 /*HandOff is in progress. So schedule this scan later*/
2117 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002118 }
2119#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 }
2121
2122 sme_ReleaseGlobalLock( &pMac->sme );
2123 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002124 else
2125 {
2126 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002129 else
2130 {
2131 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2132 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 } while( 0 );
2134
2135 return (status);
2136
2137
2138}
2139
2140/* ---------------------------------------------------------------------------
2141 \fn sme_ScanGetResult
2142 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002143 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 \param pFilter - If pFilter is NULL, all cached results are returned
2145 \param phResult - an object for the result.
2146 \return eHalStatus
2147 ---------------------------------------------------------------------------*/
2148eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2149 tScanResultHandle *phResult)
2150{
2151 eHalStatus status = eHAL_STATUS_FAILURE;
2152 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2153
2154 smsLog(pMac, LOG2, FL("enter"));
2155 status = sme_AcquireGlobalLock( &pMac->sme );
2156 if ( HAL_STATUS_SUCCESS( status ) )
2157 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002158 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 sme_ReleaseGlobalLock( &pMac->sme );
2160 }
2161 smsLog(pMac, LOG2, FL("exit status %d"), status);
2162
2163 return (status);
2164}
2165
2166
2167/* ---------------------------------------------------------------------------
2168 \fn sme_ScanFlushResult
2169 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002170 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 \return eHalStatus
2172 ---------------------------------------------------------------------------*/
2173eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2174{
2175 eHalStatus status = eHAL_STATUS_FAILURE;
2176 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2177
2178 status = sme_AcquireGlobalLock( &pMac->sme );
2179 if ( HAL_STATUS_SUCCESS( status ) )
2180 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002181 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 sme_ReleaseGlobalLock( &pMac->sme );
2183 }
2184
2185 return (status);
2186}
2187
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002188eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2189{
2190 eHalStatus status = eHAL_STATUS_FAILURE;
2191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2192
2193 status = sme_AcquireGlobalLock( &pMac->sme );
2194 if ( HAL_STATUS_SUCCESS( status ) )
2195 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302196 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002197 sme_ReleaseGlobalLock( &pMac->sme );
2198 }
2199
2200 return (status);
2201}
Jeff Johnson295189b2012-06-20 16:38:30 -07002202
2203/* ---------------------------------------------------------------------------
2204 \fn sme_ScanResultGetFirst
2205 \brief a wrapper function to request CSR to returns the first element of
2206 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002207 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 \param hScanResult - returned from csrScanGetResult
2209 \return tCsrScanResultInfo * - NULL if no result
2210 ---------------------------------------------------------------------------*/
2211tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2212 tScanResultHandle hScanResult)
2213{
2214 eHalStatus status = eHAL_STATUS_FAILURE;
2215 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2216 tCsrScanResultInfo *pRet = NULL;
2217
2218 status = sme_AcquireGlobalLock( &pMac->sme );
2219 if ( HAL_STATUS_SUCCESS( status ) )
2220 {
2221 pRet = csrScanResultGetFirst( pMac, hScanResult );
2222 sme_ReleaseGlobalLock( &pMac->sme );
2223 }
2224
2225 return (pRet);
2226}
2227
2228
2229/* ---------------------------------------------------------------------------
2230 \fn sme_ScanResultGetNext
2231 \brief a wrapper function to request CSR to returns the next element of
2232 scan result. It can be called without calling csrScanResultGetFirst
2233 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002234 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 \param hScanResult - returned from csrScanGetResult
2236 \return Null if no result or reach the end
2237 ---------------------------------------------------------------------------*/
2238tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2239 tScanResultHandle hScanResult)
2240{
2241 eHalStatus status = eHAL_STATUS_FAILURE;
2242 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2243 tCsrScanResultInfo *pRet = NULL;
2244
2245 status = sme_AcquireGlobalLock( &pMac->sme );
2246 if ( HAL_STATUS_SUCCESS( status ) )
2247 {
2248 pRet = csrScanResultGetNext( pMac, hScanResult );
2249 sme_ReleaseGlobalLock( &pMac->sme );
2250 }
2251
2252 return (pRet);
2253}
2254
2255
2256/* ---------------------------------------------------------------------------
2257 \fn sme_ScanSetBGScanparams
2258 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002259 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 \param pScanReq - BG scan request structure
2261 \return eHalStatus
2262 ---------------------------------------------------------------------------*/
2263eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2264{
2265 eHalStatus status = eHAL_STATUS_FAILURE;
2266 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2267
2268 if( NULL != pScanReq )
2269 {
2270 status = sme_AcquireGlobalLock( &pMac->sme );
2271 if ( HAL_STATUS_SUCCESS( status ) )
2272 {
2273 status = csrScanSetBGScanparams( hHal, pScanReq );
2274 sme_ReleaseGlobalLock( &pMac->sme );
2275 }
2276 }
2277
2278 return (status);
2279}
2280
2281
2282/* ---------------------------------------------------------------------------
2283 \fn sme_ScanResultPurge
2284 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2285 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002286 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 \param hScanResult - returned from csrScanGetResult. hScanResult is
2288 considered gone by
2289 calling this function and even before this function reutrns.
2290 \return eHalStatus
2291 ---------------------------------------------------------------------------*/
2292eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2293{
2294 eHalStatus status = eHAL_STATUS_FAILURE;
2295 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2296
2297 status = sme_AcquireGlobalLock( &pMac->sme );
2298 if ( HAL_STATUS_SUCCESS( status ) )
2299 {
2300 status = csrScanResultPurge( hHal, hScanResult );
2301 sme_ReleaseGlobalLock( &pMac->sme );
2302 }
2303
2304 return (status);
2305}
2306
2307/* ---------------------------------------------------------------------------
2308 \fn sme_ScanGetPMKIDCandidateList
2309 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002310 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002311 \param pPmkidList - caller allocated buffer point to an array of
2312 tPmkidCandidateInfo
2313 \param pNumItems - pointer to a variable that has the number of
2314 tPmkidCandidateInfo allocated when retruning, this is
2315 either the number needed or number of items put into
2316 pPmkidList
2317 \return eHalStatus - when fail, it usually means the buffer allocated is not
2318 big enough and pNumItems
2319 has the number of tPmkidCandidateInfo.
2320 \Note: pNumItems is a number of tPmkidCandidateInfo,
2321 not sizeof(tPmkidCandidateInfo) * something
2322 ---------------------------------------------------------------------------*/
2323eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2324 tPmkidCandidateInfo *pPmkidList,
2325 tANI_U32 *pNumItems )
2326{
2327 eHalStatus status = eHAL_STATUS_FAILURE;
2328 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2329
2330 status = sme_AcquireGlobalLock( &pMac->sme );
2331 if ( HAL_STATUS_SUCCESS( status ) )
2332 {
2333 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2334 sme_ReleaseGlobalLock( &pMac->sme );
2335 }
2336
2337 return (status);
2338}
2339
2340/*----------------------------------------------------------------------------
2341 \fn sme_RoamRegisterLinkQualityIndCallback
2342
2343 \brief
2344 a wrapper function to allow HDD to register a callback handler with CSR for
2345 link quality indications.
2346
2347 Only one callback may be registered at any time.
2348 In order to deregister the callback, a NULL cback may be provided.
2349
2350 Registration happens in the task context of the caller.
2351
2352 \param callback - Call back being registered
2353 \param pContext - user data
2354
2355 DEPENDENCIES: After CSR open
2356
2357 \return eHalStatus
2358-----------------------------------------------------------------------------*/
2359eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2360 csrRoamLinkQualityIndCallback callback,
2361 void *pContext)
2362{
2363 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2364}
2365
2366/* ---------------------------------------------------------------------------
2367 \fn sme_RoamRegisterCallback
2368 \brief a wrapper function to allow HDD to register a callback with CSR.
2369 Unlike scan, roam has one callback for all the roam requests
2370 \param callback - a callback function that roam calls upon when state changes
2371 \param pContext - a pointer passed in for the callback
2372 \return eHalStatus
2373 ---------------------------------------------------------------------------*/
2374eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2375 csrRoamCompleteCallback callback,
2376 void *pContext)
2377{
2378 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2379}
2380
2381eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2382{
2383 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2384 return pMac->roam.configParam.phyMode;
2385}
2386
2387/* ---------------------------------------------------------------------------
2388 \fn sme_RoamConnect
2389 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002390 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 \param sessionId - the sessionId returned by sme_OpenSession.
2392 \param pProfile - description of the network to which to connect
2393 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2394 from csrScanGetResult
2395 \param pRoamId - to get back the request ID
2396 \return eHalStatus
2397 ---------------------------------------------------------------------------*/
2398eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2399 tANI_U32 *pRoamId)
2400{
2401 eHalStatus status = eHAL_STATUS_FAILURE;
2402 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2403
2404 smsLog(pMac, LOG2, FL("enter"));
2405 status = sme_AcquireGlobalLock( &pMac->sme );
2406 if ( HAL_STATUS_SUCCESS( status ) )
2407 {
2408 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2409 {
2410 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2411 }
2412 else
2413 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002414 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 status = eHAL_STATUS_INVALID_PARAMETER;
2416 }
2417 sme_ReleaseGlobalLock( &pMac->sme );
2418 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002419 else
2420 {
2421 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2422 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002423
2424 return (status);
2425}
2426
2427/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302428
2429 \fn sme_SetPhyMode
2430
2431 \brief Changes the PhyMode.
2432
2433 \param hHal - The handle returned by macOpen.
2434
2435 \param phyMode new phyMode which is to set
2436
2437 \return eHalStatus SUCCESS.
2438
2439 -------------------------------------------------------------------------------*/
2440eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2441{
2442 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2443
2444 if (NULL == pMac)
2445 {
2446 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2447 "%s: invalid context", __func__);
2448 return eHAL_STATUS_FAILURE;
2449 }
2450
2451 pMac->roam.configParam.phyMode = phyMode;
2452 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2453 pMac->roam.configParam.phyMode,
2454 pMac->roam.configParam.ProprietaryRatesEnabled);
2455
2456 return eHAL_STATUS_SUCCESS;
2457}
2458
2459/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 \fn sme_RoamReassoc
2461 \brief a wrapper function to request CSR to inititiate a re-association
2462 \param pProfile - can be NULL to join the currently connected AP. In that
2463 case modProfileFields should carry the modified field(s) which could trigger
2464 reassoc
2465 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2466 that might need modification dynamically once STA is up & running and this
2467 could trigger a reassoc
2468 \param pRoamId - to get back the request ID
2469 \return eHalStatus
2470 -------------------------------------------------------------------------------*/
2471eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2472 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002473 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002474{
2475 eHalStatus status = eHAL_STATUS_FAILURE;
2476 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2477
2478 smsLog(pMac, LOG2, FL("enter"));
2479 status = sme_AcquireGlobalLock( &pMac->sme );
2480 if ( HAL_STATUS_SUCCESS( status ) )
2481 {
2482 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2483 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002484 if((NULL == pProfile) && (fForce == 1))
2485 {
2486 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2487 /* to force the AP initiate fresh 802.1x authentication need to clear
2488 * the PMKID cache for that set the following boolean. this is needed
2489 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2490 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002491 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2492 }
2493 else
2494 {
2495 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2496 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 }
2498 else
2499 {
2500 status = eHAL_STATUS_INVALID_PARAMETER;
2501 }
2502 sme_ReleaseGlobalLock( &pMac->sme );
2503 }
2504
2505 return (status);
2506}
2507
2508/* ---------------------------------------------------------------------------
2509 \fn sme_RoamConnectToLastProfile
2510 \brief a wrapper function to request CSR to disconnect and reconnect with
2511 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002512 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002513 \return eHalStatus. It returns fail if currently connected
2514 ---------------------------------------------------------------------------*/
2515eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2516{
2517 eHalStatus status = eHAL_STATUS_FAILURE;
2518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2519
2520 status = sme_AcquireGlobalLock( &pMac->sme );
2521 if ( HAL_STATUS_SUCCESS( status ) )
2522 {
2523 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2524 {
2525 status = csrRoamConnectToLastProfile( pMac, sessionId );
2526 }
2527 else
2528 {
2529 status = eHAL_STATUS_INVALID_PARAMETER;
2530 }
2531 sme_ReleaseGlobalLock( &pMac->sme );
2532 }
2533
2534 return (status);
2535}
2536
2537/* ---------------------------------------------------------------------------
2538 \fn sme_RoamDisconnect
2539 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002540 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002541 \param reason -- To indicate the reason for disconnecting. Currently, only
2542 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2543 \return eHalStatus
2544 ---------------------------------------------------------------------------*/
2545eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2546{
2547 eHalStatus status = eHAL_STATUS_FAILURE;
2548 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2549
2550 smsLog(pMac, LOG2, FL("enter"));
2551 status = sme_AcquireGlobalLock( &pMac->sme );
2552 if ( HAL_STATUS_SUCCESS( status ) )
2553 {
2554 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2555 {
2556 status = csrRoamDisconnect( pMac, sessionId, reason );
2557 }
2558 else
2559 {
2560 status = eHAL_STATUS_INVALID_PARAMETER;
2561 }
2562 sme_ReleaseGlobalLock( &pMac->sme );
2563 }
2564
2565 return (status);
2566}
2567
Jeff Johnson295189b2012-06-20 16:38:30 -07002568/* ---------------------------------------------------------------------------
2569 \fn sme_RoamStopBss
2570 \brief To stop BSS for Soft AP. This is an asynchronous API.
2571 \param hHal - Global structure
2572 \param sessionId - sessionId of SoftAP
2573 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2574 -------------------------------------------------------------------------------*/
2575eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2576{
2577 eHalStatus status = eHAL_STATUS_FAILURE;
2578 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2579
2580 smsLog(pMac, LOG2, FL("enter"));
2581 status = sme_AcquireGlobalLock( &pMac->sme );
2582 if ( HAL_STATUS_SUCCESS( status ) )
2583 {
2584 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2585 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302586 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 }
2588 else
2589 {
2590 status = eHAL_STATUS_INVALID_PARAMETER;
2591 }
2592 sme_ReleaseGlobalLock( &pMac->sme );
2593 }
2594
2595 return (status);
2596}
2597
2598/* ---------------------------------------------------------------------------
2599 \fn sme_RoamDisconnectSta
2600 \brief To disassociate a station. This is an asynchronous API.
2601 \param hHal - Global structure
2602 \param sessionId - sessionId of SoftAP
2603 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2604 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2605 -------------------------------------------------------------------------------*/
2606eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2607 tANI_U8 *pPeerMacAddr)
2608{
2609 eHalStatus status = eHAL_STATUS_FAILURE;
2610 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2611
2612 if ( NULL == pMac )
2613 {
2614 VOS_ASSERT(0);
2615 return status;
2616 }
2617
2618 status = sme_AcquireGlobalLock( &pMac->sme );
2619 if ( HAL_STATUS_SUCCESS( status ) )
2620 {
2621 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2622 {
2623 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302624 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002625 }
2626 else
2627 {
2628 status = eHAL_STATUS_INVALID_PARAMETER;
2629 }
2630 sme_ReleaseGlobalLock( &pMac->sme );
2631 }
2632
2633 return (status);
2634}
2635
2636/* ---------------------------------------------------------------------------
2637 \fn sme_RoamDeauthSta
2638 \brief To disassociate a station. This is an asynchronous API.
2639 \param hHal - Global structure
2640 \param sessionId - sessionId of SoftAP
2641 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2642 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2643 -------------------------------------------------------------------------------*/
2644eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2645 tANI_U8 *pPeerMacAddr)
2646{
2647 eHalStatus status = eHAL_STATUS_FAILURE;
2648 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2649
2650 if ( NULL == pMac )
2651 {
2652 VOS_ASSERT(0);
2653 return status;
2654 }
2655
2656 status = sme_AcquireGlobalLock( &pMac->sme );
2657 if ( HAL_STATUS_SUCCESS( status ) )
2658 {
2659 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2660 {
2661 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302662 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002663 }
2664 else
2665 {
2666 status = eHAL_STATUS_INVALID_PARAMETER;
2667 }
2668 sme_ReleaseGlobalLock( &pMac->sme );
2669 }
2670
2671 return (status);
2672}
2673
2674/* ---------------------------------------------------------------------------
2675 \fn sme_RoamTKIPCounterMeasures
2676 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2677 \param sessionId - sessionId of SoftAP
2678 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2679 \return eHalStatus
2680 -------------------------------------------------------------------------------*/
2681eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2682 tANI_BOOLEAN bEnable)
2683{
2684 eHalStatus status = eHAL_STATUS_FAILURE;
2685 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2686
2687 if ( NULL == pMac )
2688 {
2689 VOS_ASSERT(0);
2690 return status;
2691 }
2692
2693 status = sme_AcquireGlobalLock( &pMac->sme );
2694 if ( HAL_STATUS_SUCCESS( status ) )
2695 {
2696 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2697 {
2698 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2699 }
2700 else
2701 {
2702 status = eHAL_STATUS_INVALID_PARAMETER;
2703 }
2704 sme_ReleaseGlobalLock( &pMac->sme );
2705 }
2706
2707 return (status);
2708}
2709
2710/* ---------------------------------------------------------------------------
2711 \fn sme_RoamGetAssociatedStas
2712 \brief To probe the list of associated stations from various modules of CORE stack.
2713 \This is an asynchronous API.
2714 \param sessionId - sessionId of SoftAP
2715 \param modId - Module from whom list of associtated stations is to be probed.
2716 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2717 \param pUsrContext - Opaque HDD context
2718 \param pfnSapEventCallback - Sap event callback in HDD
2719 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2720 \return eHalStatus
2721 -------------------------------------------------------------------------------*/
2722eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2723 VOS_MODULE_ID modId, void *pUsrContext,
2724 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2725{
2726 eHalStatus status = eHAL_STATUS_FAILURE;
2727 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2728
2729 if ( NULL == pMac )
2730 {
2731 VOS_ASSERT(0);
2732 return status;
2733 }
2734
2735 status = sme_AcquireGlobalLock( &pMac->sme );
2736 if ( HAL_STATUS_SUCCESS( status ) )
2737 {
2738 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2739 {
2740 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2741 }
2742 else
2743 {
2744 status = eHAL_STATUS_INVALID_PARAMETER;
2745 }
2746 sme_ReleaseGlobalLock( &pMac->sme );
2747 }
2748
2749 return (status);
2750}
2751
2752/* ---------------------------------------------------------------------------
2753 \fn sme_RoamGetWpsSessionOverlap
2754 \brief To get the WPS PBC session overlap information.
2755 \This is an asynchronous API.
2756 \param sessionId - sessionId of SoftAP
2757 \param pUsrContext - Opaque HDD context
2758 \param pfnSapEventCallback - Sap event callback in HDD
2759 \pRemoveMac - pointer to Mac address which needs to be removed from session
2760 \return eHalStatus
2761 -------------------------------------------------------------------------------*/
2762eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
2763 void *pUsrContext, void
2764 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
2765{
2766 eHalStatus status = eHAL_STATUS_FAILURE;
2767 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2768
2769 if ( NULL == pMac )
2770 {
2771 VOS_ASSERT(0);
2772 return status;
2773 }
2774
2775 status = sme_AcquireGlobalLock( &pMac->sme );
2776 if ( HAL_STATUS_SUCCESS( status ) )
2777 {
2778 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2779 {
2780 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
2781 }
2782 else
2783 {
2784 status = eHAL_STATUS_INVALID_PARAMETER;
2785 }
2786 sme_ReleaseGlobalLock( &pMac->sme );
2787 }
2788
2789 return (status);
2790}
2791
Jeff Johnson295189b2012-06-20 16:38:30 -07002792
2793/* ---------------------------------------------------------------------------
2794 \fn sme_RoamGetConnectState
2795 \brief a wrapper function to request CSR to return the current connect state
2796 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08002797 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 \return eHalStatus
2799 ---------------------------------------------------------------------------*/
2800eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
2801{
2802 eHalStatus status = eHAL_STATUS_FAILURE;
2803 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2804
2805 status = sme_AcquireGlobalLock( &pMac->sme );
2806 if ( HAL_STATUS_SUCCESS( status ) )
2807 {
2808 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2809 {
2810 status = csrRoamGetConnectState( pMac, sessionId, pState );
2811 }
2812 else
2813 {
2814 status = eHAL_STATUS_INVALID_PARAMETER;
2815 }
2816 sme_ReleaseGlobalLock( &pMac->sme );
2817 }
2818
2819 return (status);
2820}
2821
2822/* ---------------------------------------------------------------------------
2823 \fn sme_RoamGetConnectProfile
2824 \brief a wrapper function to request CSR to return the current connect
2825 profile. Caller must call csrRoamFreeConnectProfile after it is done
2826 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002827 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002828 \param pProfile - pointer to a caller allocated structure
2829 tCsrRoamConnectedProfile
2830 \return eHalStatus. Failure if not connected
2831 ---------------------------------------------------------------------------*/
2832eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
2833 tCsrRoamConnectedProfile *pProfile)
2834{
2835 eHalStatus status = eHAL_STATUS_FAILURE;
2836 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2837
2838 status = sme_AcquireGlobalLock( &pMac->sme );
2839 if ( HAL_STATUS_SUCCESS( status ) )
2840 {
2841 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2842 {
2843 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
2844 }
2845 else
2846 {
2847 status = eHAL_STATUS_INVALID_PARAMETER;
2848 }
2849 sme_ReleaseGlobalLock( &pMac->sme );
2850 }
2851
2852 return (status);
2853}
2854
2855/* ---------------------------------------------------------------------------
2856 \fn sme_RoamFreeConnectProfile
2857 \brief a wrapper function to request CSR to free and reinitialize the
2858 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002859 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002860 \param pProfile - pointer to a caller allocated structure
2861 tCsrRoamConnectedProfile
2862 \return eHalStatus.
2863 ---------------------------------------------------------------------------*/
2864eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
2865 tCsrRoamConnectedProfile *pProfile)
2866{
2867 eHalStatus status = eHAL_STATUS_FAILURE;
2868 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2869
2870 status = sme_AcquireGlobalLock( &pMac->sme );
2871 if ( HAL_STATUS_SUCCESS( status ) )
2872 {
2873 status = csrRoamFreeConnectProfile( pMac, pProfile );
2874 sme_ReleaseGlobalLock( &pMac->sme );
2875 }
2876
2877 return (status);
2878}
2879
2880/* ---------------------------------------------------------------------------
2881 \fn sme_RoamSetPMKIDCache
2882 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002883 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 \param pPMKIDCache - caller allocated buffer point to an array of
2885 tPmkidCacheInfo
2886 \param numItems - a variable that has the number of tPmkidCacheInfo
2887 allocated when retruning, this is either the number needed
2888 or number of items put into pPMKIDCache
2889 \return eHalStatus - when fail, it usually means the buffer allocated is not
2890 big enough and pNumItems has the number of
2891 tPmkidCacheInfo.
2892 \Note: pNumItems is a number of tPmkidCacheInfo,
2893 not sizeof(tPmkidCacheInfo) * something
2894 ---------------------------------------------------------------------------*/
2895eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
2896 tANI_U32 numItems )
2897{
2898 eHalStatus status = eHAL_STATUS_FAILURE;
2899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2900
2901 status = sme_AcquireGlobalLock( &pMac->sme );
2902 if ( HAL_STATUS_SUCCESS( status ) )
2903 {
2904 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2905 {
2906 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
2907 }
2908 else
2909 {
2910 status = eHAL_STATUS_INVALID_PARAMETER;
2911 }
2912 sme_ReleaseGlobalLock( &pMac->sme );
2913 }
2914
2915 return (status);
2916}
2917
2918/* ---------------------------------------------------------------------------
2919 \fn sme_RoamGetSecurityReqIE
2920 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
2921 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08002922 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002923 \param pLen - caller allocated memory that has the length of pBuf as input.
2924 Upon returned, *pLen has the needed or IE length in pBuf.
2925 \param pBuf - Caller allocated memory that contain the IE field, if any,
2926 upon return
2927 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2928 \return eHalStatus - when fail, it usually means the buffer allocated is not
2929 big enough
2930 ---------------------------------------------------------------------------*/
2931eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2932 tANI_U8 *pBuf, eCsrSecurityType secType)
2933{
2934 eHalStatus status = eHAL_STATUS_FAILURE;
2935 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2936
2937 status = sme_AcquireGlobalLock( &pMac->sme );
2938 if ( HAL_STATUS_SUCCESS( status ) )
2939 {
2940 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2941 {
2942 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
2943 }
2944 else
2945 {
2946 status = eHAL_STATUS_INVALID_PARAMETER;
2947 }
2948 sme_ReleaseGlobalLock( &pMac->sme );
2949 }
2950
2951 return (status);
2952}
2953
2954/* ---------------------------------------------------------------------------
2955 \fn sme_RoamGetSecurityRspIE
2956 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
2957 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08002958 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 \param pLen - caller allocated memory that has the length of pBuf as input.
2960 Upon returned, *pLen has the needed or IE length in pBuf.
2961 \param pBuf - Caller allocated memory that contain the IE field, if any,
2962 upon return
2963 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2964 \return eHalStatus - when fail, it usually means the buffer allocated is not
2965 big enough
2966 ---------------------------------------------------------------------------*/
2967eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2968 tANI_U8 *pBuf, eCsrSecurityType secType)
2969{
2970 eHalStatus status = eHAL_STATUS_FAILURE;
2971 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2972
2973 status = sme_AcquireGlobalLock( &pMac->sme );
2974 if ( HAL_STATUS_SUCCESS( status ) )
2975 {
2976 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2977 {
2978 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
2979 }
2980 else
2981 {
2982 status = eHAL_STATUS_INVALID_PARAMETER;
2983 }
2984 sme_ReleaseGlobalLock( &pMac->sme );
2985 }
2986
2987 return (status);
2988
2989}
2990
2991
2992/* ---------------------------------------------------------------------------
2993 \fn sme_RoamGetNumPMKIDCache
2994 \brief a wrapper function to request CSR to return number of PMKID cache
2995 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08002996 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 \return tANI_U32 - the number of PMKID cache entries
2998 ---------------------------------------------------------------------------*/
2999tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3000{
3001 eHalStatus status = eHAL_STATUS_FAILURE;
3002 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3003 tANI_U32 numPmkidCache = 0;
3004
3005 status = sme_AcquireGlobalLock( &pMac->sme );
3006 if ( HAL_STATUS_SUCCESS( status ) )
3007 {
3008 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3009 {
3010 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3011 status = eHAL_STATUS_SUCCESS;
3012 }
3013 else
3014 {
3015 status = eHAL_STATUS_INVALID_PARAMETER;
3016 }
3017 sme_ReleaseGlobalLock( &pMac->sme );
3018 }
3019
3020 return (numPmkidCache);
3021}
3022
3023/* ---------------------------------------------------------------------------
3024 \fn sme_RoamGetPMKIDCache
3025 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003026 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003027 \param pNum - caller allocated memory that has the space of the number of
3028 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3029 needed or actually number in tPmkidCacheInfo.
3030 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3031 any, upon return
3032 \return eHalStatus - when fail, it usually means the buffer allocated is not
3033 big enough
3034 ---------------------------------------------------------------------------*/
3035eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3036 tPmkidCacheInfo *pPmkidCache)
3037{
3038 eHalStatus status = eHAL_STATUS_FAILURE;
3039 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3040
3041 status = sme_AcquireGlobalLock( &pMac->sme );
3042 if ( HAL_STATUS_SUCCESS( status ) )
3043 {
3044 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3045 {
3046 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3047 }
3048 else
3049 {
3050 status = eHAL_STATUS_INVALID_PARAMETER;
3051 }
3052 sme_ReleaseGlobalLock( &pMac->sme );
3053 }
3054
3055 return (status);
3056}
3057
3058
3059/* ---------------------------------------------------------------------------
3060 \fn sme_GetConfigParam
3061 \brief a wrapper function that HDD calls to get the global settings
3062 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003063 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 \param pParam - caller allocated memory
3065 \return eHalStatus
3066 ---------------------------------------------------------------------------*/
3067eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3068{
3069 eHalStatus status = eHAL_STATUS_FAILURE;
3070 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3071
3072 status = sme_AcquireGlobalLock( &pMac->sme );
3073 if ( HAL_STATUS_SUCCESS( status ) )
3074 {
3075 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3076 if (status != eHAL_STATUS_SUCCESS)
3077 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003078 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003079 sme_ReleaseGlobalLock( &pMac->sme );
3080 return status;
3081 }
3082#if defined WLAN_FEATURE_P2P_INTERNAL
3083 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3084 if (status != eHAL_STATUS_SUCCESS)
3085 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003086 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003087 sme_ReleaseGlobalLock( &pMac->sme );
3088 return status;
3089 }
3090#endif
3091 sme_ReleaseGlobalLock( &pMac->sme );
3092 }
3093
3094 return (status);
3095}
3096
3097/* ---------------------------------------------------------------------------
3098 \fn sme_CfgSetInt
3099 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003100 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003101 \param cfgId - Configuration Parameter ID (type) for STA.
3102 \param ccmValue - The information related to Configuration Parameter ID
3103 which needs to be saved in CFG
3104 \param callback - To be registered by CSR with CCM. Once the CFG done with
3105 saving the information in the database, it notifies CCM &
3106 then the callback will be invoked to notify.
3107 \param toBeSaved - To save the request for future reference
3108 \return eHalStatus
3109 ---------------------------------------------------------------------------*/
3110eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3111 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3112{
3113 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3114}
3115
3116/* ---------------------------------------------------------------------------
3117 \fn sme_CfgSetStr
3118 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003119 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003120 \param cfgId - Configuration Parameter ID (type) for STA.
3121 \param pStr - Pointer to the byte array which carries the information needs
3122 to be saved in CFG
3123 \param length - Length of the data to be saved
3124 \param callback - To be registered by CSR with CCM. Once the CFG done with
3125 saving the information in the database, it notifies CCM &
3126 then the callback will be invoked to notify.
3127 \param toBeSaved - To save the request for future reference
3128 \return eHalStatus
3129 ---------------------------------------------------------------------------*/
3130eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3131 tANI_U32 length, tCcmCfgSetCallback callback,
3132 eAniBoolean toBeSaved)
3133{
3134 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3135}
3136
3137/* ---------------------------------------------------------------------------
3138 \fn sme_GetModifyProfileFields
3139 \brief HDD or SME - QOS calls this function to get the current values of
3140 connected profile fields, changing which can cause reassoc.
3141 This function must be called after CFG is downloaded and STA is in connected
3142 state. Also, make sure to call this function to get the current profile
3143 fields before calling the reassoc. So that pModifyProfileFields will have
3144 all the latest values plus the one(s) has been updated as part of reassoc
3145 request.
3146 \param pModifyProfileFields - pointer to the connected profile fields
3147 changing which can cause reassoc
3148
3149 \return eHalStatus
3150 -------------------------------------------------------------------------------*/
3151eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3152 tCsrRoamModifyProfileFields * pModifyProfileFields)
3153{
3154 eHalStatus status = eHAL_STATUS_FAILURE;
3155 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3156
3157 status = sme_AcquireGlobalLock( &pMac->sme );
3158 if ( HAL_STATUS_SUCCESS( status ) )
3159 {
3160 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3161 {
3162 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3163 }
3164 else
3165 {
3166 status = eHAL_STATUS_INVALID_PARAMETER;
3167 }
3168 sme_ReleaseGlobalLock( &pMac->sme );
3169 }
3170
3171 return (status);
3172}
3173
3174/*--------------------------------------------------------------------------
3175 \fn sme_SetConfigPowerSave
3176 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3177 For BMPS related configuration, this function also updates the CFG
3178 and sends a message to FW to pick up the new values. Note: Calling
3179 this function only updates the configuration and does not enable
3180 the specified power save mode.
3181 \param hHal - The handle returned by macOpen.
3182 \param psMode - Power Saving mode being modified
3183 \param pConfigParams - a pointer to a caller allocated object of type
3184 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3185 \return eHalStatus
3186 --------------------------------------------------------------------------*/
3187eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3188 void *pConfigParams)
3189{
3190 eHalStatus status = eHAL_STATUS_FAILURE;
3191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3192
3193 if (NULL == pConfigParams ) {
3194 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3195 "nothing to update");
3196 return eHAL_STATUS_FAILURE;
3197 }
3198
3199 status = sme_AcquireGlobalLock( &pMac->sme );
3200 if ( HAL_STATUS_SUCCESS( status ) )
3201 {
3202 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3203 sme_ReleaseGlobalLock( &pMac->sme );
3204 }
3205
3206 return (status);
3207}
3208
3209/*--------------------------------------------------------------------------
3210 \fn sme_GetConfigPowerSave
3211 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3212 \param hHal - The handle returned by macOpen.
3213 \param psMode - Power Saving mode
3214 \param pConfigParams - a pointer to a caller allocated object of type
3215 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3216 \return eHalStatus
3217 --------------------------------------------------------------------------*/
3218eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3219 void *pConfigParams)
3220{
3221 eHalStatus status = eHAL_STATUS_FAILURE;
3222 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3223
3224 if (NULL == pConfigParams ) {
3225 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3226 "nothing to update");
3227 return eHAL_STATUS_FAILURE;
3228 }
3229
3230 status = sme_AcquireGlobalLock( &pMac->sme );
3231 if ( HAL_STATUS_SUCCESS( status ) )
3232 {
3233 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3234 sme_ReleaseGlobalLock( &pMac->sme );
3235 }
3236
3237 return (status);
3238}
3239
3240/* ---------------------------------------------------------------------------
3241 \fn sme_SignalPowerEvent
3242 \brief Signals to PMC that a power event has occurred. Used for putting
3243 the chip into deep sleep mode.
3244 \param hHal - The handle returned by macOpen.
3245 \param event - the event that has occurred
3246 \return eHalStatus
3247 ---------------------------------------------------------------------------*/
3248eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3249{
3250 eHalStatus status = eHAL_STATUS_FAILURE;
3251 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3252
3253 status = sme_AcquireGlobalLock( &pMac->sme );
3254 if ( HAL_STATUS_SUCCESS( status ) )
3255 {
3256 status = pmcSignalPowerEvent(hHal, event);
3257 sme_ReleaseGlobalLock( &pMac->sme );
3258 }
3259
3260 return (status);
3261}
3262
3263/* ---------------------------------------------------------------------------
3264 \fn sme_EnablePowerSave
3265 \brief Enables one of the power saving modes.
3266 \param hHal - The handle returned by macOpen.
3267 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3268 while the chip is operating in Full Power, PMC will start
3269 a timer that will try to put the chip in BMPS mode after
3270 expiry.
3271 \return eHalStatus
3272 ---------------------------------------------------------------------------*/
3273eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3274{
3275 eHalStatus status = eHAL_STATUS_FAILURE;
3276 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3277
3278 status = sme_AcquireGlobalLock( &pMac->sme );
3279 if ( HAL_STATUS_SUCCESS( status ) )
3280 {
3281 status = pmcEnablePowerSave(hHal, psMode);
3282 sme_ReleaseGlobalLock( &pMac->sme );
3283 }
3284
3285 return (status);
3286}
3287
3288/* ---------------------------------------------------------------------------
3289 \fn sme_DisablePowerSave
3290 \brief Disables one of the power saving modes.
3291 \param hHal - The handle returned by macOpen.
3292 \param psMode - The power saving mode to disable. Disabling does not imply
3293 that device will be brought out of the current PS mode. This
3294 is purely a configuration API.
3295 \return eHalStatus
3296 ---------------------------------------------------------------------------*/
3297eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3298{
3299 eHalStatus status = eHAL_STATUS_FAILURE;
3300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3301
3302 status = sme_AcquireGlobalLock( &pMac->sme );
3303 if ( HAL_STATUS_SUCCESS( status ) )
3304 {
3305 status = pmcDisablePowerSave(hHal, psMode);
3306 sme_ReleaseGlobalLock( &pMac->sme );
3307 }
3308
3309 return (status);
3310 }
3311
3312/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303313+ \fn sme_SetHostPowerSave
3314+ \brief Enables BMPS logic to be controlled by User level apps
3315+ \param hHal - The handle returned by macOpen.
3316+ \param psMode - The power saving mode to disable. Disabling does not imply
3317+ that device will be brought out of the current PS mode. This
3318+ is purely a configuration API.
3319+ \return eHalStatus
3320+ ---------------------------------------------------------------------------*/
3321eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3322{
3323 eHalStatus status = eHAL_STATUS_FAILURE;
3324 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3325
3326 pMac->pmc.isHostPsEn = psMode;
3327
3328 return (status);
3329}
3330
3331/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 \fn sme_StartAutoBmpsTimer
3333 \brief Starts a timer that periodically polls all the registered
3334 module for entry into Bmps mode. This timer is started only if BMPS is
3335 enabled and whenever the device is in full power.
3336 \param hHal - The handle returned by macOpen.
3337 \return eHalStatus
3338 ---------------------------------------------------------------------------*/
3339eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3340{
3341 eHalStatus status = eHAL_STATUS_FAILURE;
3342 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3343
3344 status = sme_AcquireGlobalLock( &pMac->sme );
3345 if ( HAL_STATUS_SUCCESS( status ) )
3346 {
3347 status = pmcStartAutoBmpsTimer(hHal);
3348 sme_ReleaseGlobalLock( &pMac->sme );
3349 }
3350
3351 return (status);
3352}
3353/* ---------------------------------------------------------------------------
3354 \fn sme_StopAutoBmpsTimer
3355 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3356 Stopping the timer does not cause a device state change. Only the timer
3357 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3358 \param hHal - The handle returned by macOpen.
3359 \return eHalStatus
3360 ---------------------------------------------------------------------------*/
3361eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3362{
3363 eHalStatus status = eHAL_STATUS_FAILURE;
3364 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3365
3366 status = sme_AcquireGlobalLock( &pMac->sme );
3367 if ( HAL_STATUS_SUCCESS( status ) )
3368 {
3369 status = pmcStopAutoBmpsTimer(hHal);
3370 sme_ReleaseGlobalLock( &pMac->sme );
3371 }
3372
3373 return (status);
3374}
3375/* ---------------------------------------------------------------------------
3376 \fn sme_QueryPowerState
3377 \brief Returns the current power state of the device.
3378 \param hHal - The handle returned by macOpen.
3379 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3380 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3381 \return eHalStatus
3382 ---------------------------------------------------------------------------*/
3383eHalStatus sme_QueryPowerState (
3384 tHalHandle hHal,
3385 tPmcPowerState *pPowerState,
3386 tPmcSwitchState *pSwWlanSwitchState)
3387{
3388 eHalStatus status = eHAL_STATUS_FAILURE;
3389 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3390
3391 status = sme_AcquireGlobalLock( &pMac->sme );
3392 if ( HAL_STATUS_SUCCESS( status ) )
3393 {
3394 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3395 sme_ReleaseGlobalLock( &pMac->sme );
3396 }
3397
3398 return (status);
3399}
3400
3401/* ---------------------------------------------------------------------------
3402 \fn sme_IsPowerSaveEnabled
3403 \brief Checks if the device is able to enter a particular power save mode
3404 This does not imply that the device is in a particular PS mode
3405 \param hHal - The handle returned by macOpen.
3406 \param psMode - the power saving mode
3407 \return eHalStatus
3408 ---------------------------------------------------------------------------*/
3409tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3410{
3411 eHalStatus status = eHAL_STATUS_FAILURE;
3412 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3413 tANI_BOOLEAN result = false;
3414
3415 status = sme_AcquireGlobalLock( &pMac->sme );
3416 if ( HAL_STATUS_SUCCESS( status ) )
3417 {
3418 result = pmcIsPowerSaveEnabled(hHal, psMode);
3419 sme_ReleaseGlobalLock( &pMac->sme );
3420 return result;
3421 }
3422
3423 return false;
3424}
3425
3426/* ---------------------------------------------------------------------------
3427 \fn sme_RequestFullPower
3428 \brief Request that the device be brought to full power state. When the
3429 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3430 is enabled. On timer expiry PMC will attempt to put the device in
3431 BMPS mode if following holds true:
3432 - BMPS mode is enabled
3433 - Polling of all modules through the Power Save Check routine passes
3434 - STA is associated to an access point
3435 \param hHal - The handle returned by macOpen.
3436 \param - callbackRoutine Callback routine invoked in case of success/failure
3437 \return eHalStatus - status
3438 eHAL_STATUS_SUCCESS - device brought to full power state
3439 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3440 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3441 ---------------------------------------------------------------------------*/
3442eHalStatus sme_RequestFullPower (
3443 tHalHandle hHal,
3444 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3445 void *callbackContext,
3446 tRequestFullPowerReason fullPowerReason)
3447{
3448 eHalStatus status = eHAL_STATUS_FAILURE;
3449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3450
3451 status = sme_AcquireGlobalLock( &pMac->sme );
3452 if ( HAL_STATUS_SUCCESS( status ) )
3453 {
3454 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3455 sme_ReleaseGlobalLock( &pMac->sme );
3456 }
3457
3458 return (status);
3459}
3460
3461/* ---------------------------------------------------------------------------
3462 \fn sme_RequestBmps
3463 \brief Request that the device be put in BMPS state. Request will be
3464 accepted only if BMPS mode is enabled and power save check routine
3465 passes.
3466 \param hHal - The handle returned by macOpen.
3467 \param - callbackRoutine Callback routine invoked in case of success/failure
3468 \return eHalStatus
3469 eHAL_STATUS_SUCCESS - device is in BMPS state
3470 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3471 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3472 ---------------------------------------------------------------------------*/
3473eHalStatus sme_RequestBmps (
3474 tHalHandle hHal,
3475 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3476 void *callbackContext)
3477{
3478 eHalStatus status = eHAL_STATUS_FAILURE;
3479 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3480
3481 status = sme_AcquireGlobalLock( &pMac->sme );
3482 if ( HAL_STATUS_SUCCESS( status ) )
3483 {
3484 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3485 sme_ReleaseGlobalLock( &pMac->sme );
3486 }
3487
3488 return (status);
3489}
3490
3491
3492/* ---------------------------------------------------------------------------
3493 \fn sme_SetDHCPTillPowerActiveFlag
3494 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3495 entry by PMC
3496 \param hHal - The handle returned by macOpen.
3497 ---------------------------------------------------------------------------*/
3498void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3499{
3500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3501
3502 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3503 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3504}
3505
3506
3507/* ---------------------------------------------------------------------------
3508 \fn sme_StartUapsd
3509 \brief Request that the device be put in UAPSD state. If the device is in
3510 Full Power it will be put in BMPS mode first and then into UAPSD
3511 mode.
3512 \param hHal - The handle returned by macOpen.
3513 \param - callbackRoutine Callback routine invoked in case of success/failure
3514 eHAL_STATUS_SUCCESS - device is in UAPSD state
3515 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3516 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3517 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3518 \return eHalStatus
3519 ---------------------------------------------------------------------------*/
3520eHalStatus sme_StartUapsd (
3521 tHalHandle hHal,
3522 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3523 void *callbackContext)
3524{
3525 eHalStatus status = eHAL_STATUS_FAILURE;
3526 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3527
3528 status = sme_AcquireGlobalLock( &pMac->sme );
3529 if ( HAL_STATUS_SUCCESS( status ) )
3530 {
3531 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3532 sme_ReleaseGlobalLock( &pMac->sme );
3533 }
3534
3535 return (status);
3536 }
3537
3538/* ---------------------------------------------------------------------------
3539 \fn sme_StopUapsd
3540 \brief Request that the device be put out of UAPSD state. Device will be
3541 put in in BMPS state after stop UAPSD completes.
3542 \param hHal - The handle returned by macOpen.
3543 \return eHalStatus
3544 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3545 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3546 ---------------------------------------------------------------------------*/
3547eHalStatus sme_StopUapsd (tHalHandle hHal)
3548{
3549 eHalStatus status = eHAL_STATUS_FAILURE;
3550 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3551
3552 status = sme_AcquireGlobalLock( &pMac->sme );
3553 if ( HAL_STATUS_SUCCESS( status ) )
3554 {
3555 status = pmcStopUapsd(hHal);
3556 sme_ReleaseGlobalLock( &pMac->sme );
3557 }
3558
3559 return (status);
3560}
3561
3562/* ---------------------------------------------------------------------------
3563 \fn sme_RequestStandby
3564 \brief Request that the device be put in standby. It is HDD's responsibility
3565 to bring the chip to full power and do a disassoc before calling
3566 this API.
3567 \param hHal - The handle returned by macOpen.
3568 \param - callbackRoutine Callback routine invoked in case of success/failure
3569 \return eHalStatus
3570 eHAL_STATUS_SUCCESS - device is in Standby mode
3571 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3572 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3573 ---------------------------------------------------------------------------*/
3574eHalStatus sme_RequestStandby (
3575 tHalHandle hHal,
3576 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3577 void *callbackContext)
3578{
3579 eHalStatus status = eHAL_STATUS_FAILURE;
3580 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3581
3582 smsLog( pMac, LOG1, FL("") );
3583 status = sme_AcquireGlobalLock( &pMac->sme );
3584 if ( HAL_STATUS_SUCCESS( status ) )
3585 {
3586 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3587 sme_ReleaseGlobalLock( &pMac->sme );
3588 }
3589
3590 return (status);
3591}
3592
3593/* ---------------------------------------------------------------------------
3594 \fn sme_RegisterPowerSaveCheck
3595 \brief Register a power save check routine that is called whenever
3596 the device is about to enter one of the power save modes.
3597 \param hHal - The handle returned by macOpen.
3598 \param checkRoutine - Power save check routine to be registered
3599 \return eHalStatus
3600 eHAL_STATUS_SUCCESS - successfully registered
3601 eHAL_STATUS_FAILURE - not successfully registered
3602 ---------------------------------------------------------------------------*/
3603eHalStatus sme_RegisterPowerSaveCheck (
3604 tHalHandle hHal,
3605 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3606{
3607 eHalStatus status = eHAL_STATUS_FAILURE;
3608 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3609
3610 status = sme_AcquireGlobalLock( &pMac->sme );
3611 if ( HAL_STATUS_SUCCESS( status ) )
3612 {
3613 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3614 sme_ReleaseGlobalLock( &pMac->sme );
3615 }
3616
3617 return (status);
3618}
3619
3620/* ---------------------------------------------------------------------------
3621 \fn sme_DeregisterPowerSaveCheck
3622 \brief Deregister a power save check routine
3623 \param hHal - The handle returned by macOpen.
3624 \param checkRoutine - Power save check routine to be deregistered
3625 \return eHalStatus
3626 eHAL_STATUS_SUCCESS - successfully deregistered
3627 eHAL_STATUS_FAILURE - not successfully deregistered
3628 ---------------------------------------------------------------------------*/
3629eHalStatus sme_DeregisterPowerSaveCheck (
3630 tHalHandle hHal,
3631 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3632{
3633 eHalStatus status = eHAL_STATUS_FAILURE;
3634 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3635
3636 status = sme_AcquireGlobalLock( &pMac->sme );
3637 if ( HAL_STATUS_SUCCESS( status ) )
3638 {
3639 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3640 sme_ReleaseGlobalLock( &pMac->sme );
3641 }
3642
3643 return (status);
3644}
3645
3646/* ---------------------------------------------------------------------------
3647 \fn sme_RegisterDeviceStateUpdateInd
3648 \brief Register a callback routine that is called whenever
3649 the device enters a new device state (Full Power, BMPS, UAPSD)
3650 \param hHal - The handle returned by macOpen.
3651 \param callbackRoutine - Callback routine to be registered
3652 \param callbackContext - Cookie to be passed back during callback
3653 \return eHalStatus
3654 eHAL_STATUS_SUCCESS - successfully registered
3655 eHAL_STATUS_FAILURE - not successfully registered
3656 ---------------------------------------------------------------------------*/
3657eHalStatus sme_RegisterDeviceStateUpdateInd (
3658 tHalHandle hHal,
3659 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3660 void *callbackContext)
3661{
3662 eHalStatus status = eHAL_STATUS_FAILURE;
3663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3664
3665 status = sme_AcquireGlobalLock( &pMac->sme );
3666 if ( HAL_STATUS_SUCCESS( status ) )
3667 {
3668 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3669 sme_ReleaseGlobalLock( &pMac->sme );
3670 }
3671
3672 return (status);
3673}
3674
3675/* ---------------------------------------------------------------------------
3676 \fn sme_DeregisterDeviceStateUpdateInd
3677 \brief Deregister a routine that was registered for device state changes
3678 \param hHal - The handle returned by macOpen.
3679 \param callbackRoutine - Callback routine to be deregistered
3680 \return eHalStatus
3681 eHAL_STATUS_SUCCESS - successfully deregistered
3682 eHAL_STATUS_FAILURE - not successfully deregistered
3683 ---------------------------------------------------------------------------*/
3684eHalStatus sme_DeregisterDeviceStateUpdateInd (
3685 tHalHandle hHal,
3686 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3687{
3688 eHalStatus status = eHAL_STATUS_FAILURE;
3689 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3690
3691 status = sme_AcquireGlobalLock( &pMac->sme );
3692 if ( HAL_STATUS_SUCCESS( status ) )
3693 {
3694 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3695 sme_ReleaseGlobalLock( &pMac->sme );
3696 }
3697
3698 return (status);
3699}
3700
3701/* ---------------------------------------------------------------------------
3702 \fn sme_WowlAddBcastPattern
3703 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3704 do a pattern match on these patterns when Wowl is enabled during BMPS
3705 mode. Note that Firmware performs the pattern matching only on
3706 broadcast frames and while Libra is in BMPS mode.
3707 \param hHal - The handle returned by macOpen.
3708 \param pattern - Pattern to be added
3709 \return eHalStatus
3710 eHAL_STATUS_FAILURE Cannot add pattern
3711 eHAL_STATUS_SUCCESS Request accepted.
3712 ---------------------------------------------------------------------------*/
3713eHalStatus sme_WowlAddBcastPattern (
3714 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003715 tpSirWowlAddBcastPtrn pattern,
3716 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003717{
3718 eHalStatus status = eHAL_STATUS_FAILURE;
3719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3720 status = sme_AcquireGlobalLock( &pMac->sme );
3721 if ( HAL_STATUS_SUCCESS( status ) )
3722 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003723 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003724 sme_ReleaseGlobalLock( &pMac->sme );
3725 }
3726
3727 return (status);
3728}
3729
3730/* ---------------------------------------------------------------------------
3731 \fn sme_WowlDelBcastPattern
3732 \brief Delete a pattern that was added for Pattern Byte Matching.
3733 \param hHal - The handle returned by macOpen.
3734 \param pattern - Pattern to be deleted
3735 \return eHalStatus
3736 eHAL_STATUS_FAILURE Cannot delete pattern
3737 eHAL_STATUS_SUCCESS Request accepted.
3738 ---------------------------------------------------------------------------*/
3739eHalStatus sme_WowlDelBcastPattern (
3740 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003741 tpSirWowlDelBcastPtrn pattern,
3742 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003743{
3744 eHalStatus status = eHAL_STATUS_FAILURE;
3745 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3746 status = sme_AcquireGlobalLock( &pMac->sme );
3747 if ( HAL_STATUS_SUCCESS( status ) )
3748 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003749 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 sme_ReleaseGlobalLock( &pMac->sme );
3751 }
3752
3753 return (status);
3754}
3755
3756/* ---------------------------------------------------------------------------
3757 \fn sme_EnterWowl
3758 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
3759 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
3760 SME will will cache the information that WOWL has been enabled and
3761 attempt to put the device in BMPS. On entry into BMPS, SME will
3762 enable the WOWL mode.
3763 Note 1: If we exit BMPS mode (someone requests full power), we
3764 will NOT resume WOWL when we go back to BMPS again. Request for full
3765 power (while in WOWL mode) means disable WOWL and go to full power.
3766 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
3767 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
3768 are required. Currently there is no requirement or use case to support
3769 UAPSD and WOWL at the same time.
3770
3771 \param hHal - The handle returned by macOpen.
3772 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
3773 Used for success/failure notification by SME
3774 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
3775 at the time of callback.
3776 \param wakeReasonIndCB - Callback routine provided by HDD.
3777 Used for Wake Reason Indication by SME
3778 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
3779 at the time of callback.
3780 \return eHalStatus
3781 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
3782 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
3783 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
3784 BMPS mode is entered.
3785 ---------------------------------------------------------------------------*/
3786eHalStatus sme_EnterWowl (
3787 tHalHandle hHal,
3788 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
3789 void *enterWowlCallbackContext,
3790#ifdef WLAN_WAKEUP_EVENTS
3791 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
3792 void *wakeIndicationCBContext,
3793#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003794 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003795{
3796 eHalStatus status = eHAL_STATUS_FAILURE;
3797 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3798 status = sme_AcquireGlobalLock( &pMac->sme );
3799 if ( HAL_STATUS_SUCCESS( status ) )
3800 {
3801 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
3802#ifdef WLAN_WAKEUP_EVENTS
3803 wakeIndicationCB, wakeIndicationCBContext,
3804#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003805 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 sme_ReleaseGlobalLock( &pMac->sme );
3807 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 return (status);
3809}
3810/* ---------------------------------------------------------------------------
3811 \fn sme_ExitWowl
3812 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
3813 SME will initiate exit from WoWLAN mode and device will be put in BMPS
3814 mode.
3815 \param hHal - The handle returned by macOpen.
3816 \return eHalStatus
3817 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
3818 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
3819 ---------------------------------------------------------------------------*/
3820eHalStatus sme_ExitWowl (tHalHandle hHal)
3821{
3822 eHalStatus status = eHAL_STATUS_FAILURE;
3823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3824 status = sme_AcquireGlobalLock( &pMac->sme );
3825 if ( HAL_STATUS_SUCCESS( status ) )
3826 {
3827 status = pmcExitWowl (hHal);
3828 sme_ReleaseGlobalLock( &pMac->sme );
3829 }
3830
3831 return (status);
3832}
3833
3834/* ---------------------------------------------------------------------------
3835
3836 \fn sme_RoamSetKey
3837
3838 \brief To set encryption key. This function should be called only when connected
3839 This is an asynchronous API.
3840
3841 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
3842
3843 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3844
3845 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3846
3847 FAILURE or RESOURCES The API finished and failed.
3848
3849 -------------------------------------------------------------------------------*/
3850eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
3851{
3852 eHalStatus status = eHAL_STATUS_FAILURE;
3853 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3854 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003855 tANI_U32 i;
3856 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003857
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003858 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
3859 {
3860 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
3861 return eHAL_STATUS_FAILURE;
3862 }
3863
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 status = sme_AcquireGlobalLock( &pMac->sme );
3865 if ( HAL_STATUS_SUCCESS( status ) )
3866 {
3867 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3868 if(pRoamId)
3869 {
3870 *pRoamId = roamId;
3871 }
3872
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003873 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07003874
3875 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003876 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003877
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003878 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003879
3880 pSession = CSR_GET_SESSION(pMac, sessionId);
3881
Jeff Johnson32d95a32012-09-10 13:15:23 -07003882 if(!pSession)
3883 {
3884 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08003885 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003886 return eHAL_STATUS_FAILURE;
3887 }
3888
Jeff Johnson295189b2012-06-20 16:38:30 -07003889 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
3890 {
3891 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
3892 {
3893 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
3894 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
3895 {
3896 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3897 }
3898 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
3899 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
3900 {
3901 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3902 }
3903 }
3904 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003905
3906 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
3907 sme_ReleaseGlobalLock( &pMac->sme );
3908 }
3909
3910 return (status);
3911}
3912
3913
3914/* ---------------------------------------------------------------------------
3915
3916 \fn sme_RoamRemoveKey
3917
3918 \brief To set encryption key. This is an asynchronous API.
3919
3920 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
3921
3922 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3923
3924 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3925
3926 FAILURE or RESOURCES The API finished and failed.
3927
3928 -------------------------------------------------------------------------------*/
3929eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
3930 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
3931{
3932 eHalStatus status = eHAL_STATUS_FAILURE;
3933 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3934 tANI_U32 roamId;
3935
3936 status = sme_AcquireGlobalLock( &pMac->sme );
3937 if ( HAL_STATUS_SUCCESS( status ) )
3938 {
3939 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3940 if(pRoamId)
3941 {
3942 *pRoamId = roamId;
3943 }
3944 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
3945 sme_ReleaseGlobalLock( &pMac->sme );
3946 }
3947
3948 return (status);
3949}
3950
3951/* ---------------------------------------------------------------------------
3952 \fn sme_GetRssi
3953 \brief a wrapper function that client calls to register a callback to get RSSI
3954
3955 \param callback - SME sends back the requested stats using the callback
3956 \param staId - The station ID for which the stats is requested for
3957 \param pContext - user context to be passed back along with the callback
3958 \param pVosContext - vos context
3959 \return eHalStatus
3960 ---------------------------------------------------------------------------*/
3961eHalStatus sme_GetRssi(tHalHandle hHal,
3962 tCsrRssiCallback callback,
3963 tANI_U8 staId, tCsrBssid bssId,
3964 void *pContext, void* pVosContext)
3965{
3966 eHalStatus status = eHAL_STATUS_FAILURE;
3967 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3968
3969 status = sme_AcquireGlobalLock( &pMac->sme );
3970 if ( HAL_STATUS_SUCCESS( status ) )
3971 {
3972 status = csrGetRssi( pMac, callback,
3973 staId, bssId, pContext, pVosContext);
3974 sme_ReleaseGlobalLock( &pMac->sme );
3975 }
3976 return (status);
3977}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003978#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3979/* ---------------------------------------------------------------------------
3980 \fn sme_GetRoamRssi
3981 \brief a wrapper function that client calls to register a callback to get Roam RSSI
3982
3983 \param callback - SME sends back the requested stats using the callback
3984 \param staId - The station ID for which the stats is requested for
3985 \param pContext - user context to be passed back along with the callback
3986 \param pVosContext - vos context
3987 \return eHalStatus
3988 ---------------------------------------------------------------------------*/
3989eHalStatus sme_GetRoamRssi(tHalHandle hHal,
3990 tCsrRssiCallback callback,
3991 tANI_U8 staId, tCsrBssid bssId,
3992 void *pContext, void* pVosContext)
3993{
3994 eHalStatus status = eHAL_STATUS_FAILURE;
3995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3996
3997 status = sme_AcquireGlobalLock( &pMac->sme );
3998 if ( HAL_STATUS_SUCCESS( status ) )
3999 {
4000 status = csrGetRoamRssi( pMac, callback,
4001 staId, bssId, pContext, pVosContext);
4002 sme_ReleaseGlobalLock( &pMac->sme );
4003 }
4004 return (status);
4005}
4006#endif
4007
Jeff Johnson295189b2012-06-20 16:38:30 -07004008
4009/* ---------------------------------------------------------------------------
4010 \fn sme_GetStatistics
4011 \brief a wrapper function that client calls to register a callback to get
4012 different PHY level statistics from CSR.
4013
4014 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4015 \param statsMask - The different category/categories of stats requester is looking for
4016 \param callback - SME sends back the requested stats using the callback
4017 \param periodicity - If requester needs periodic update in millisec, 0 means
4018 it's an one time request
4019 \param cache - If requester is happy with cached stats
4020 \param staId - The station ID for which the stats is requested for
4021 \param pContext - user context to be passed back along with the callback
4022 \return eHalStatus
4023 ---------------------------------------------------------------------------*/
4024eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4025 tANI_U32 statsMask,
4026 tCsrStatsCallback callback,
4027 tANI_U32 periodicity, tANI_BOOLEAN cache,
4028 tANI_U8 staId, void *pContext)
4029{
4030 eHalStatus status = eHAL_STATUS_FAILURE;
4031 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4032
4033 status = sme_AcquireGlobalLock( &pMac->sme );
4034 if ( HAL_STATUS_SUCCESS( status ) )
4035 {
4036 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4037 periodicity, cache, staId, pContext);
4038 sme_ReleaseGlobalLock( &pMac->sme );
4039 }
4040
4041 return (status);
4042
4043}
4044
4045/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304046 \fn smeGetTLSTAState
4047 \helper function to get the TL STA State whenever the function is called.
4048
4049 \param staId - The staID to be passed to the TL
4050 to get the relevant TL STA State
4051 \return the state as tANI_U16
4052 ---------------------------------------------------------------------------*/
4053tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4054{
4055 tANI_U16 tlSTAState = TL_INIT_STATE;
4056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4057 eHalStatus status = eHAL_STATUS_FAILURE;
4058
4059 status = sme_AcquireGlobalLock( &pMac->sme );
4060 if ( HAL_STATUS_SUCCESS( status ) )
4061 {
4062 tlSTAState = csrGetTLSTAState( pMac, staId);
4063 sme_ReleaseGlobalLock( &pMac->sme );
4064 }
4065
4066 return tlSTAState;
4067}
4068
4069/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004070
4071 \fn sme_GetCountryCode
4072
4073 \brief To return the current country code. If no country code is applied, default country code is
4074 used to fill the buffer.
4075 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4076 This is a synchronous API.
4077
4078 \param pBuf - pointer to a caller allocated buffer for returned country code.
4079
4080 \param pbLen For input, this parameter indicates how big is the buffer.
4081 Upon return, this parameter has the number of bytes for country. If pBuf
4082 doesn't have enough space, this function returns
4083 fail status and this parameter contains the number that is needed.
4084
4085 \return eHalStatus SUCCESS.
4086
4087 FAILURE or RESOURCES The API finished and failed.
4088
4089 -------------------------------------------------------------------------------*/
4090eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4091{
4092 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4093
4094 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4095}
4096
4097
4098/* ---------------------------------------------------------------------------
4099
4100 \fn sme_SetCountryCode
4101
4102 \brief To change the current/default country code.
4103 If 11d supported is turned off, an error is return.
4104 This is a synchronous API.
4105
4106 \param pCountry - pointer to a caller allocated buffer for the country code.
4107
4108 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4109 whether a reset is required.
4110
4111 \return eHalStatus SUCCESS.
4112
4113 FAILURE or RESOURCES The API finished and failed.
4114
4115 -------------------------------------------------------------------------------*/
4116eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4117{
4118 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4119
4120 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4121}
4122
4123
4124/* ---------------------------------------------------------------------------
4125 \fn sme_ResetCountryCodeInformation
4126 \brief this function is to reset the country code current being used back to EEPROM default
4127 this includes channel list and power setting. This is a synchronous API.
4128 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4129 a restart is needed to apply the change
4130 \return eHalStatus
4131 -------------------------------------------------------------------------------*/
4132eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4133{
4134 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4135
4136 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4137}
4138
4139
4140/* ---------------------------------------------------------------------------
4141 \fn sme_GetSupportedCountryCode
4142 \brief this function is to get a list of the country code current being supported
4143 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4144 this has the country code list. 3 bytes for each country code. This may be NULL if
4145 caller wants to know the needed byte count.
4146 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4147 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4148 \return eHalStatus
4149 -------------------------------------------------------------------------------*/
4150eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4151{
4152 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4153
4154 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4155}
4156
4157
4158/* ---------------------------------------------------------------------------
4159 \fn sme_GetCurrentRegulatoryDomain
4160 \brief this function is to get the current regulatory domain. This is a synchronous API.
4161 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4162 SME. The function fails if 11d support is turned off.
4163 \param pDomain - Caller allocated buffer to return the current domain.
4164 \return eHalStatus SUCCESS.
4165
4166 FAILURE or RESOURCES The API finished and failed.
4167 -------------------------------------------------------------------------------*/
4168eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4169{
4170 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4171 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4172
4173 if( pDomain )
4174 {
4175 if( csrIs11dSupported( pMac ) )
4176 {
4177 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4178 status = eHAL_STATUS_SUCCESS;
4179 }
4180 else
4181 {
4182 status = eHAL_STATUS_FAILURE;
4183 }
4184 }
4185
4186 return ( status );
4187}
4188
4189
4190/* ---------------------------------------------------------------------------
4191 \fn sme_SetRegulatoryDomain
4192 \brief this function is to set the current regulatory domain.
4193 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4194 SME. This is a synchronous API.
4195 \param domainId - indicate the domain (defined in the driver) needs to set to.
4196 See v_REGDOMAIN_t for definition
4197 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4198 a restart is needed to apply the change
4199 \return eHalStatus
4200 -------------------------------------------------------------------------------*/
4201eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4202{
4203 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4204
4205 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4206}
4207
4208
4209/* ---------------------------------------------------------------------------
4210
4211 \fn sme_GetRegulatoryDomainForCountry
4212
4213 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4214
4215 \param pCountry - pointer to a caller allocated buffer for input country code.
4216
4217 \param pDomainId Upon successful return, it is the domain that country belongs to.
4218 If it is NULL, returning success means that the country code is known.
4219
4220 \return eHalStatus SUCCESS.
4221
4222 FAILURE or RESOURCES The API finished and failed.
4223
4224 -------------------------------------------------------------------------------*/
4225eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4226{
4227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4228
4229 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4230}
4231
4232
4233
4234
4235/* ---------------------------------------------------------------------------
4236
4237 \fn sme_GetSupportedRegulatoryDomains
4238
4239 \brief To return a list of supported regulatory domains. This is a synchronous API.
4240
4241 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4242
4243 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4244 Upon return, this parameter has the number for supported domains. If pDomains
4245 doesn't have enough space for all the supported domains, this function returns
4246 fail status and this parameter contains the number that is needed.
4247
4248 \return eHalStatus SUCCESS.
4249
4250 FAILURE or RESOURCES The API finished and failed.
4251
4252 -------------------------------------------------------------------------------*/
4253eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4254{
4255 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4256
4257 //We support all domains for now
4258 if( pNumDomains )
4259 {
4260 if( NUM_REG_DOMAINS <= *pNumDomains )
4261 {
4262 status = eHAL_STATUS_SUCCESS;
4263 }
4264 *pNumDomains = NUM_REG_DOMAINS;
4265 }
4266 if( HAL_STATUS_SUCCESS( status ) )
4267 {
4268 if( pDomains )
4269 {
4270 pDomains[0] = REGDOMAIN_FCC;
4271 pDomains[1] = REGDOMAIN_ETSI;
4272 pDomains[2] = REGDOMAIN_JAPAN;
4273 pDomains[3] = REGDOMAIN_WORLD;
4274 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4275 pDomains[5] = REGDOMAIN_APAC;
4276 pDomains[6] = REGDOMAIN_KOREA;
4277 pDomains[7] = REGDOMAIN_HI_5GHZ;
4278 pDomains[8] = REGDOMAIN_NO_5GHZ;
4279 }
4280 else
4281 {
4282 status = eHAL_STATUS_INVALID_PARAMETER;
4283 }
4284 }
4285
4286 return ( status );
4287}
4288
4289
4290//some support functions
4291tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4292{
4293 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4294
4295 return ( csrIs11dSupported( pMac ) );
4296}
4297
4298
4299tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4300{
4301 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4302
4303 return ( csrIs11hSupported( pMac ) );
4304}
4305
4306
4307tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4308{
4309 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4310
4311 return ( csrIsWmmSupported( pMac ) );
4312}
4313
4314//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4315eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4316{
4317 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4318
4319 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4320}
4321
4322/* ---------------------------------------------------------------------------
4323
4324 \fn sme_ChangeCountryCode
4325
4326 \brief Change Country code from upperlayer during WLAN driver operation.
4327 This is a synchronous API.
4328
4329 \param hHal - The handle returned by macOpen.
4330
4331 \param pCountry New Country Code String
4332
4333 \return eHalStatus SUCCESS.
4334
4335 FAILURE or RESOURCES The API finished and failed.
4336
4337 -------------------------------------------------------------------------------*/
4338eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4339 tSmeChangeCountryCallback callback,
4340 tANI_U8 *pCountry,
4341 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304342 void* pVosContext,
4343 tAniBool countryFromUserSpace )
Jeff Johnson295189b2012-06-20 16:38:30 -07004344{
4345 eHalStatus status = eHAL_STATUS_FAILURE;
4346 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4347 vos_msg_t msg;
4348 tAniChangeCountryCodeReq *pMsg;
4349
4350 status = sme_AcquireGlobalLock( &pMac->sme );
4351 if ( HAL_STATUS_SUCCESS( status ) )
4352 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004353 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004354 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4355 if ( !HAL_STATUS_SUCCESS(status) )
4356 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004357 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004358 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004359 return status;
4360 }
4361
4362 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4363 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4364 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304365 pMsg->countryFromUserSpace = countryFromUserSpace;
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 pMsg->changeCCCallback = callback;
4367 pMsg->pDevContext = pContext;
4368 pMsg->pVosContext = pVosContext;
4369
4370 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4371 msg.bodyptr = pMsg;
4372 msg.reserved = 0;
4373
4374 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4375 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004376 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 palFreeMemory(pMac->hHdd, (void *)pMsg);
4378 status = eHAL_STATUS_FAILURE;
4379 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004380 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 sme_ReleaseGlobalLock( &pMac->sme );
4382 }
4383
4384 return (status);
4385}
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05304386/* ---------------------------------------------------------------------------
4387
4388 \fn sme_DHCPStartInd
4389
4390 \brief API to signal the FW about the DHCP Start event.
4391
4392 \param hHal - HAL handle for device.
4393
4394 \param device_mode - mode(AP,SAP etc) of the device.
4395
4396 \param macAddr - MAC address of the device.
4397
4398 \return eHalStatus SUCCESS.
4399
4400 FAILURE or RESOURCES The API finished and failed.
4401 --------------------------------------------------------------------------*/
4402eHalStatus sme_DHCPStartInd( tHalHandle hHal,
4403 tANI_U8 device_mode,
4404 tANI_U8 *macAddr )
4405{
4406 eHalStatus status;
4407 VOS_STATUS vosStatus;
4408 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4409 vos_msg_t vosMessage;
4410 tAniDHCPInd *pMsg;
4411
4412 status = sme_AcquireGlobalLock(&pMac->sme);
4413 if ( eHAL_STATUS_SUCCESS == status)
4414 {
4415 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
4416 if (NULL == pMsg)
4417 {
4418 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4419 "%s: Not able to allocate memory for dhcp start", __func__);
4420 sme_ReleaseGlobalLock( &pMac->sme );
4421 return eHAL_STATUS_FAILURE;
4422 }
4423 pMsg->msgType = WDA_DHCP_START_IND;
4424 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
4425 pMsg->device_mode = device_mode;
4426 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
4427
4428 vosMessage.type = WDA_DHCP_START_IND;
4429 vosMessage.bodyptr = pMsg;
4430 vosMessage.reserved = 0;
4431
4432 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
4433 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
4434 {
4435 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4436 "%s: Post DHCP Start MSG fail", __func__);
4437 vos_mem_free(pMsg);
4438 status = eHAL_STATUS_FAILURE;
4439 }
4440 sme_ReleaseGlobalLock( &pMac->sme );
4441 }
4442 return (status);
4443}
4444/* ---------------------------------------------------------------------------
4445 \fn sme_DHCPStopInd
4446
4447 \brief API to signal the FW about the DHCP complete event.
4448
4449 \param hHal - HAL handle for device.
4450
4451 \param device_mode - mode(AP, SAP etc) of the device.
4452
4453 \param macAddr - MAC address of the device.
4454
4455 \return eHalStatus SUCCESS.
4456 FAILURE or RESOURCES The API finished and failed.
4457 --------------------------------------------------------------------------*/
4458eHalStatus sme_DHCPStopInd( tHalHandle hHal,
4459 tANI_U8 device_mode,
4460 tANI_U8 *macAddr )
4461{
4462 eHalStatus status;
4463 VOS_STATUS vosStatus;
4464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4465 vos_msg_t vosMessage;
4466 tAniDHCPInd *pMsg;
4467
4468 status = sme_AcquireGlobalLock(&pMac->sme);
4469 if ( eHAL_STATUS_SUCCESS == status)
4470 {
4471 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
4472 if (NULL == pMsg)
4473 {
4474 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4475 "%s: Not able to allocate memory for dhcp stop", __func__);
4476 sme_ReleaseGlobalLock( &pMac->sme );
4477 return eHAL_STATUS_FAILURE;
4478 }
4479
4480 pMsg->msgType = WDA_DHCP_STOP_IND;
4481 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
4482 pMsg->device_mode = device_mode;
4483 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
4484
4485 vosMessage.type = WDA_DHCP_STOP_IND;
4486 vosMessage.bodyptr = pMsg;
4487 vosMessage.reserved = 0;
4488
4489 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
4490 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
4491 {
4492 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4493 "%s: Post DHCP Stop MSG fail", __func__);
4494 vos_mem_free(pMsg);
4495 status = eHAL_STATUS_FAILURE;
4496 }
4497
4498 sme_ReleaseGlobalLock( &pMac->sme );
4499 }
4500 return (status);
4501}
4502
Jeff Johnson295189b2012-06-20 16:38:30 -07004503
4504/* ---------------------------------------------------------------------------
4505 \fn sme_BtcSignalBtEvent
4506 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4507 BT event type and the current operating mode of Libra (full power,
4508 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4509 would be employed.
4510 \param hHal - The handle returned by macOpen.
4511 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4512 Caller owns the memory and is responsible for freeing it.
4513 \return VOS_STATUS
4514 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4515 if BTC execution mode is set to BTC_WLAN_ONLY
4516 or BTC_PTA_ONLY.
4517 VOS_STATUS_SUCCESS BT Event passed to HAL
4518 ---------------------------------------------------------------------------*/
4519VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4520{
4521 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4522#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4524
4525 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4526 {
4527 status = btcSignalBTEvent (hHal, pBtEvent);
4528 sme_ReleaseGlobalLock( &pMac->sme );
4529 }
4530#endif
4531 return (status);
4532}
4533
4534/* ---------------------------------------------------------------------------
4535 \fn sme_BtcSetConfig
4536 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4537 This function should be invoked only after CFG download has completed.
4538 Calling it after sme_HDDReadyInd is recommended.
4539 \param hHal - The handle returned by macOpen.
4540 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4541 Caller owns the memory and is responsible for freeing it.
4542 \return VOS_STATUS
4543 VOS_STATUS_E_FAILURE Config not passed to HAL.
4544 VOS_STATUS_SUCCESS Config passed to HAL
4545 ---------------------------------------------------------------------------*/
4546VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4547{
4548 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4549#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4550 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4551 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4552 {
4553 status = btcSetConfig (hHal, pSmeBtcConfig);
4554 sme_ReleaseGlobalLock( &pMac->sme );
4555 }
4556#endif
4557 return (status);
4558}
4559
4560/* ---------------------------------------------------------------------------
4561 \fn sme_BtcGetConfig
4562 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4563 \param hHal - The handle returned by macOpen.
4564 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4565 tSmeBtcConfig. Caller owns the memory and is responsible
4566 for freeing it.
4567 \return VOS_STATUS
4568 VOS_STATUS_E_FAILURE - failure
4569 VOS_STATUS_SUCCESS success
4570 ---------------------------------------------------------------------------*/
4571VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4572{
4573 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4574#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4575 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4576
4577 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4578 {
4579 status = btcGetConfig (hHal, pSmeBtcConfig);
4580 sme_ReleaseGlobalLock( &pMac->sme );
4581 }
4582#endif
4583 return (status);
4584}
4585/* ---------------------------------------------------------------------------
4586 \fn sme_SetCfgPrivacy
4587 \brief API to set configure privacy parameters
4588 \param hHal - The handle returned by macOpen.
4589 \param pProfile - Pointer CSR Roam profile.
4590 \param fPrivacy - This parameter indicates status of privacy
4591
4592 \return void
4593 ---------------------------------------------------------------------------*/
4594void sme_SetCfgPrivacy( tHalHandle hHal,
4595 tCsrRoamProfile *pProfile,
4596 tANI_BOOLEAN fPrivacy
4597 )
4598{
4599 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4600 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4601 {
4602 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4603 sme_ReleaseGlobalLock( &pMac->sme );
4604 }
4605}
4606
4607#if defined WLAN_FEATURE_VOWIFI
4608/* ---------------------------------------------------------------------------
4609 \fn sme_NeighborReportRequest
4610 \brief API to request neighbor report.
4611 \param hHal - The handle returned by macOpen.
4612 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4613 tRrmNeighborReq. Caller owns the memory and is responsible
4614 for freeing it.
4615 \return VOS_STATUS
4616 VOS_STATUS_E_FAILURE - failure
4617 VOS_STATUS_SUCCESS success
4618 ---------------------------------------------------------------------------*/
4619VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4620 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4621{
4622 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4623 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4624
4625 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4626 {
4627 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4628 sme_ReleaseGlobalLock( &pMac->sme );
4629 }
4630
4631 return (status);
4632}
4633#endif
4634
4635//The following are debug APIs to support direct read/write register/memory
4636//They are placed in SME because HW cannot be access when in LOW_POWER state
4637//AND not connected. The knowledge and synchronization is done in SME
4638
4639//sme_DbgReadRegister
4640//Caller needs to validate the input values
4641VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4642{
4643 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4644 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 tPmcPowerState PowerState;
4646 tANI_U32 sessionId = 0;
4647
4648 /* 1) To make Quarky work in FTM mode **************************************/
4649
4650 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4651 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004652 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 {
4654 return VOS_STATUS_SUCCESS;
4655 }
4656 return VOS_STATUS_E_FAILURE;
4657 }
4658
4659 /* 2) NON FTM mode driver *************************************************/
4660
4661 /* Acquire SME global lock */
4662 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4663 {
4664 return VOS_STATUS_E_FAILURE;
4665 }
4666
4667 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4668 {
4669 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4670 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4671 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004672 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004673 {
4674 status = VOS_STATUS_SUCCESS;
4675 }
4676 else
4677 {
4678 status = VOS_STATUS_E_FAILURE;
4679 }
4680 }
4681 else
4682 {
4683 status = VOS_STATUS_E_FAILURE;
4684 }
4685 }
4686
4687 /* This is a hack for Qualky/pttWniSocket
4688 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4689 if ( VOS_STATUS_SUCCESS != status )
4690 {
4691 *pRegValue = 0xDEADBEEF;
4692 status = VOS_STATUS_SUCCESS;
4693 }
4694
4695 /* Release SME global lock */
4696 sme_ReleaseGlobalLock(&pMac->sme);
4697
4698 return (status);
4699}
4700
4701
4702//sme_DbgWriteRegister
4703//Caller needs to validate the input values
4704VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4705{
4706 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4707 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004708 tPmcPowerState PowerState;
4709 tANI_U32 sessionId = 0;
4710
4711 /* 1) To make Quarky work in FTM mode **************************************/
4712
4713 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4714 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004715 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004716 {
4717 return VOS_STATUS_SUCCESS;
4718 }
4719 return VOS_STATUS_E_FAILURE;
4720 }
4721
4722 /* 2) NON FTM mode driver *************************************************/
4723
4724 /* Acquire SME global lock */
4725 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4726 {
4727 return VOS_STATUS_E_FAILURE;
4728 }
4729
4730 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4731 {
4732 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4733 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4734 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004735 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004736 {
4737 status = VOS_STATUS_SUCCESS;
4738 }
4739 else
4740 {
4741 status = VOS_STATUS_E_FAILURE;
4742 }
4743 }
4744 else
4745 {
4746 status = VOS_STATUS_E_FAILURE;
4747 }
4748 }
4749
4750 /* Release SME global lock */
4751 sme_ReleaseGlobalLock(&pMac->sme);
4752
4753 return (status);
4754}
4755
4756
4757
4758//sme_DbgReadMemory
4759//Caller needs to validate the input values
4760//pBuf caller allocated buffer has the length of nLen
4761VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4762{
4763 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4764 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004765 tPmcPowerState PowerState;
4766 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004767 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4768 tANI_U32 arg1 = memAddr;
4769 tANI_U32 arg2 = nLen/4;
4770 tANI_U32 arg3 = 4;
4771 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 /* 1) To make Quarky work in FTM mode **************************************/
4773
4774 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4775 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004776 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004777 {
4778 return VOS_STATUS_SUCCESS;
4779 }
4780 return VOS_STATUS_E_FAILURE;
4781 }
4782
4783 /* 2) NON FTM mode driver *************************************************/
4784
4785 /* Acquire SME global lock */
4786 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4787 {
4788 return VOS_STATUS_E_FAILURE;
4789 }
4790
4791 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4792 {
4793 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4794 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4795 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004796 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 {
4798 status = VOS_STATUS_SUCCESS;
4799 }
4800 else
4801 {
4802 status = VOS_STATUS_E_FAILURE;
4803 }
4804 }
4805 else
4806 {
4807 status = VOS_STATUS_E_FAILURE;
4808 }
4809 }
4810
4811 /* This is a hack for Qualky/pttWniSocket
4812 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4813 if (VOS_STATUS_SUCCESS != status)
4814 {
4815 vos_mem_set(pBuf, nLen, 0xCD);
4816 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004817 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 }
4819
4820 /* Release SME lock */
4821 sme_ReleaseGlobalLock(&pMac->sme);
4822
4823 return (status);
4824}
4825
4826
4827//sme_DbgWriteMemory
4828//Caller needs to validate the input values
4829VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4830{
4831 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4832 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 tPmcPowerState PowerState;
4834 tANI_U32 sessionId = 0;
4835
4836 /* 1) To make Quarky work in FTM mode **************************************/
4837
4838 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4839 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004840 {
4841 return VOS_STATUS_SUCCESS;
4842 }
4843 return VOS_STATUS_E_FAILURE;
4844 }
4845
4846 /* 2) NON FTM mode driver *************************************************/
4847
4848 /* Acquire SME global lock */
4849 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4850 {
4851 return VOS_STATUS_E_FAILURE;
4852 }
4853
4854 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4855 {
4856 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4857 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4858 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07004860 {
4861 status = VOS_STATUS_SUCCESS;
4862 }
4863 else
4864 {
4865 status = VOS_STATUS_E_FAILURE;
4866 }
4867 }
4868 else
4869 {
4870 status = VOS_STATUS_E_FAILURE;
4871 }
4872 }
4873
4874 /* Release Global lock */
4875 sme_ReleaseGlobalLock(&pMac->sme);
4876
4877 return (status);
4878}
4879
4880
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004881void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07004882{
4883#ifdef WLAN_DEBUG
4884 // Verify against current log level
4885 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
4886 return;
4887 else
4888 {
4889 va_list marker;
4890
4891 va_start( marker, pString ); /* Initialize variable arguments. */
4892
4893 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
4894
4895 va_end( marker ); /* Reset variable arguments. */
4896 }
4897#endif
4898}
Jeff Johnson295189b2012-06-20 16:38:30 -07004899
Jeff Johnson295189b2012-06-20 16:38:30 -07004900/* ---------------------------------------------------------------------------
4901 \fn sme_GetWcnssWlanCompiledVersion
4902 \brief This API returns the version of the WCNSS WLAN API with
4903 which the HOST driver was built
4904 \param hHal - The handle returned by macOpen.
4905 \param pVersion - Points to the Version structure to be filled
4906 \return VOS_STATUS
4907 VOS_STATUS_E_INVAL - failure
4908 VOS_STATUS_SUCCESS success
4909 ---------------------------------------------------------------------------*/
4910VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
4911 tSirVersionType *pVersion)
4912{
4913 VOS_STATUS status = VOS_STATUS_SUCCESS;
4914 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4915 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4916
4917 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4918 {
4919 if( pVersion != NULL )
4920 {
4921 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
4922 }
4923 else
4924 {
4925 status = VOS_STATUS_E_INVAL;
4926 }
4927 sme_ReleaseGlobalLock( &pMac->sme );
4928 }
4929
4930 return (status);
4931}
4932
4933
4934/* ---------------------------------------------------------------------------
4935 \fn sme_GetWcnssWlanReportedVersion
4936 \brief This API returns the version of the WCNSS WLAN API with
4937 which the WCNSS driver reports it was built
4938 \param hHal - The handle returned by macOpen.
4939 \param pVersion - Points to the Version structure to be filled
4940 \return VOS_STATUS
4941 VOS_STATUS_E_INVAL - failure
4942 VOS_STATUS_SUCCESS success
4943 ---------------------------------------------------------------------------*/
4944VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
4945 tSirVersionType *pVersion)
4946{
4947 VOS_STATUS status = VOS_STATUS_SUCCESS;
4948 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4949 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4950
4951 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4952 {
4953 if( pVersion != NULL )
4954 {
4955 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
4956 }
4957 else
4958 {
4959 status = VOS_STATUS_E_INVAL;
4960 }
4961 sme_ReleaseGlobalLock( &pMac->sme );
4962 }
4963
4964 return (status);
4965}
4966
4967
4968/* ---------------------------------------------------------------------------
4969 \fn sme_GetWcnssSoftwareVersion
4970 \brief This API returns the version string of the WCNSS driver
4971 \param hHal - The handle returned by macOpen.
4972 \param pVersion - Points to the Version string buffer to be filled
4973 \param versionBufferSize - THe size of the Version string buffer
4974 \return VOS_STATUS
4975 VOS_STATUS_E_INVAL - failure
4976 VOS_STATUS_SUCCESS success
4977 ---------------------------------------------------------------------------*/
4978VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
4979 tANI_U8 *pVersion,
4980 tANI_U32 versionBufferSize)
4981{
4982 VOS_STATUS status = VOS_STATUS_SUCCESS;
4983 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4984 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4985
4986 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4987 {
4988 if( pVersion != NULL )
4989 {
4990 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
4991 versionBufferSize);
4992 }
4993 else
4994 {
4995 status = VOS_STATUS_E_INVAL;
4996 }
4997 sme_ReleaseGlobalLock( &pMac->sme );
4998 }
4999
5000 return (status);
5001}
5002
5003
5004/* ---------------------------------------------------------------------------
5005 \fn sme_GetWcnssHardwareVersion
5006 \brief This API returns the version string of the WCNSS hardware
5007 \param hHal - The handle returned by macOpen.
5008 \param pVersion - Points to the Version string buffer to be filled
5009 \param versionBufferSize - THe size of the Version string buffer
5010 \return VOS_STATUS
5011 VOS_STATUS_E_INVAL - failure
5012 VOS_STATUS_SUCCESS success
5013 ---------------------------------------------------------------------------*/
5014VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5015 tANI_U8 *pVersion,
5016 tANI_U32 versionBufferSize)
5017{
5018 VOS_STATUS status = VOS_STATUS_SUCCESS;
5019 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5020 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5021
5022 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5023 {
5024 if( pVersion != NULL )
5025 {
5026 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5027 versionBufferSize);
5028 }
5029 else
5030 {
5031 status = VOS_STATUS_E_INVAL;
5032 }
5033 sme_ReleaseGlobalLock( &pMac->sme );
5034 }
5035
5036 return (status);
5037}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005038
Jeff Johnson295189b2012-06-20 16:38:30 -07005039
5040#ifdef FEATURE_WLAN_WAPI
5041/* ---------------------------------------------------------------------------
5042 \fn sme_RoamSetBKIDCache
5043 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5044 candidate list.
5045 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5046 it is opened (by calling halOpen).
5047 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5048 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5049 when retruning, this is the number of items put into pBKIDCache
5050 \return eHalStatus - when fail, it usually means the buffer allocated is not
5051 big enough and pNumItems has the number of tBkidCacheInfo.
5052 ---------------------------------------------------------------------------*/
5053eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5054 tANI_U32 numItems )
5055{
5056 eHalStatus status = eHAL_STATUS_FAILURE;
5057 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5058
5059 status = sme_AcquireGlobalLock( &pMac->sme );
5060 if ( HAL_STATUS_SUCCESS( status ) )
5061 {
5062 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5063 sme_ReleaseGlobalLock( &pMac->sme );
5064 }
5065
5066 return (status);
5067}
5068
5069/* ---------------------------------------------------------------------------
5070 \fn sme_RoamGetBKIDCache
5071 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5072 BKID cache.
5073 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5074 it is opened (by calling halOpen).
5075 \param pNum - caller allocated memory that has the space of the number of
5076 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5077 in SME cache.
5078 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5079 upon return
5080 \return eHalStatus - when fail, it usually means the buffer allocated is not
5081 big enough.
5082 ---------------------------------------------------------------------------*/
5083eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5084 tBkidCacheInfo *pBkidCache)
5085{
5086 eHalStatus status = eHAL_STATUS_FAILURE;
5087 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5088
5089 status = sme_AcquireGlobalLock( &pMac->sme );
5090 if ( HAL_STATUS_SUCCESS( status ) )
5091 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005092 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005093 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5094 sme_ReleaseGlobalLock( &pMac->sme );
5095 }
5096
5097 return (status);
5098}
5099
5100/* ---------------------------------------------------------------------------
5101 \fn sme_RoamGetNumBKIDCache
5102 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5103 number of BKID cache entries.
5104 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5105 it is opened (by calling halOpen).
5106 \return tANI_U32 - the number of BKID cache entries.
5107 ---------------------------------------------------------------------------*/
5108tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5109{
5110 eHalStatus status = eHAL_STATUS_FAILURE;
5111 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5112 tANI_U32 numBkidCache = 0;
5113
5114 status = sme_AcquireGlobalLock( &pMac->sme );
5115 if ( HAL_STATUS_SUCCESS( status ) )
5116 {
5117 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5118 sme_ReleaseGlobalLock( &pMac->sme );
5119 }
5120
5121 return (numBkidCache);
5122}
5123
5124/* ---------------------------------------------------------------------------
5125 \fn sme_ScanGetBKIDCandidateList
5126 \brief a wrapper function to return the BKID candidate list
5127 \param pBkidList - caller allocated buffer point to an array of
5128 tBkidCandidateInfo
5129 \param pNumItems - pointer to a variable that has the number of
5130 tBkidCandidateInfo allocated when retruning, this is
5131 either the number needed or number of items put into
5132 pPmkidList
5133 \return eHalStatus - when fail, it usually means the buffer allocated is not
5134 big enough and pNumItems
5135 has the number of tBkidCandidateInfo.
5136 \Note: pNumItems is a number of tBkidCandidateInfo,
5137 not sizeof(tBkidCandidateInfo) * something
5138 ---------------------------------------------------------------------------*/
5139eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5140 tBkidCandidateInfo *pBkidList,
5141 tANI_U32 *pNumItems )
5142{
5143 eHalStatus status = eHAL_STATUS_FAILURE;
5144 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5145
5146 status = sme_AcquireGlobalLock( &pMac->sme );
5147 if ( HAL_STATUS_SUCCESS( status ) )
5148 {
5149 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5150 sme_ReleaseGlobalLock( &pMac->sme );
5151 }
5152
5153 return (status);
5154}
5155#endif /* FEATURE_WLAN_WAPI */
5156
Jeff Johnsone7245742012-09-05 17:12:55 -07005157#ifdef FEATURE_OEM_DATA_SUPPORT
5158
5159/*****************************************************************************
5160 OEM DATA related modifications and function additions
5161 *****************************************************************************/
5162
5163/* ---------------------------------------------------------------------------
5164 \fn sme_getOemDataRsp
5165 \brief a wrapper function to obtain the OEM DATA RSP
5166 \param pOemDataRsp - A pointer to the response object
5167 \param pContext - a pointer passed in for the callback
5168 \return eHalStatus
5169 ---------------------------------------------------------------------------*/
5170eHalStatus sme_getOemDataRsp(tHalHandle hHal,
5171 tOemDataRsp **pOemDataRsp)
5172{
5173 eHalStatus status = eHAL_STATUS_SUCCESS;
5174 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5175
5176 do
5177 {
5178 //acquire the lock for the sme object
5179 status = sme_AcquireGlobalLock(&pMac->sme);
5180
5181 if(!HAL_STATUS_SUCCESS(status))
5182 {
5183 break;
5184 }
5185
5186 if(pMac->oemData.pOemDataRsp != NULL)
5187 {
5188 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5189 }
5190 else
5191 {
5192 status = eHAL_STATUS_FAILURE;
5193 }
5194
5195 //release the lock for the sme object
5196 sme_ReleaseGlobalLock( &pMac->sme );
5197
5198 } while(0);
5199
5200 return status;
5201}
5202
5203/* ---------------------------------------------------------------------------
5204 \fn sme_OemDataReq
5205 \brief a wrapper function for OEM DATA REQ
5206 \param sessionId - session id to be used.
5207 \param pOemDataReqId - pointer to an object to get back the request ID
5208 \param callback - a callback function that is called upon finish
5209 \param pContext - a pointer passed in for the callback
5210 \return eHalStatus
5211 ---------------------------------------------------------------------------*/
5212eHalStatus sme_OemDataReq(tHalHandle hHal,
5213 tANI_U8 sessionId,
5214 tOemDataReqConfig *pOemDataReqConfig,
5215 tANI_U32 *pOemDataReqID,
5216 oemData_OemDataReqCompleteCallback callback,
5217 void *pContext)
5218{
5219 eHalStatus status = eHAL_STATUS_SUCCESS;
5220 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5221
5222 do
5223 {
5224 //acquire the lock for the sme object
5225 status = sme_AcquireGlobalLock(&pMac->sme);
5226 if(HAL_STATUS_SUCCESS(status))
5227 {
5228 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5229
5230 if(pOemDataReqID)
5231 {
5232 *pOemDataReqID = lOemDataReqId;
5233 }
5234 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005235 {
5236 sme_ReleaseGlobalLock( &pMac->sme );
5237 return eHAL_STATUS_FAILURE;
5238 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005239
5240 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5241
5242 //release the lock for the sme object
5243 sme_ReleaseGlobalLock( &pMac->sme );
5244 }
5245 } while(0);
5246
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005247 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005248
5249 return(status);
5250}
5251
5252#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005253
5254/*--------------------------------------------------------------------------
5255
5256 \brief sme_OpenSession() - Open a session for scan/roam operation.
5257
5258 This is a synchronous API.
5259
5260
5261 \param hHal - The handle returned by macOpen.
5262 \param callback - A pointer to the function caller specifies for roam/connect status indication
5263 \param pContext - The context passed with callback
5264 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5265 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5266
5267 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5268
5269 Other status means SME is failed to open the session.
5270 eHAL_STATUS_RESOURCES - no more session available.
5271 \sa
5272
5273 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005274eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
5275 void *pContext, tANI_U8 *pSelfMacAddr,
5276 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005277{
5278 eHalStatus status;
5279 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5280
5281 if( NULL == pbSessionId )
5282 {
5283 status = eHAL_STATUS_INVALID_PARAMETER;
5284 }
5285 else
5286 {
5287 status = sme_AcquireGlobalLock( &pMac->sme );
5288 if ( HAL_STATUS_SUCCESS( status ) )
5289 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005290 status = csrRoamOpenSession(pMac, callback, pContext,
5291 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005292
5293 sme_ReleaseGlobalLock( &pMac->sme );
5294 }
5295 }
5296
5297 return ( status );
5298}
5299
5300
5301/*--------------------------------------------------------------------------
5302
5303 \brief sme_CloseSession() - Open a session for scan/roam operation.
5304
5305 This is a synchronous API.
5306
5307
5308 \param hHal - The handle returned by macOpen.
5309
5310 \param sessionId - A previous opened session's ID.
5311
5312 \return eHAL_STATUS_SUCCESS - session is closed.
5313
5314 Other status means SME is failed to open the session.
5315 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5316 \sa
5317
5318 --------------------------------------------------------------------------*/
5319eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5320 csrRoamSessionCloseCallback callback, void *pContext)
5321{
5322 eHalStatus status;
5323 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5324
5325 status = sme_AcquireGlobalLock( &pMac->sme );
5326 if ( HAL_STATUS_SUCCESS( status ) )
5327 {
5328 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5329 callback, pContext );
5330
5331 sme_ReleaseGlobalLock( &pMac->sme );
5332 }
5333
5334 return ( status );
5335}
5336
Jeff Johnson295189b2012-06-20 16:38:30 -07005337/* ---------------------------------------------------------------------------
5338
5339 \fn sme_RoamUpdateAPWPSIE
5340
5341 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5342 This is an asynchronous API.
5343
5344 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5345
5346 \return eHalStatus – SUCCESS –
5347
5348 FAILURE or RESOURCES – The API finished and failed.
5349
5350 -------------------------------------------------------------------------------*/
5351eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5352{
5353
5354 eHalStatus status = eHAL_STATUS_FAILURE;
5355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5356
5357 status = sme_AcquireGlobalLock( &pMac->sme );
5358 if ( HAL_STATUS_SUCCESS( status ) )
5359 {
5360
5361 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5362
5363 sme_ReleaseGlobalLock( &pMac->sme );
5364 }
5365
5366 return (status);
5367}
5368/* ---------------------------------------------------------------------------
5369
5370 \fn sme_RoamUpdateAPWPARSNIEs
5371
5372 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5373 This is an asynchronous API.
5374
5375 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5376
5377 \return eHalStatus – SUCCESS –
5378
5379 FAILURE or RESOURCES – The API finished and failed.
5380
5381 -------------------------------------------------------------------------------*/
5382eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5383{
5384
5385 eHalStatus status = eHAL_STATUS_FAILURE;
5386 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5387
5388 status = sme_AcquireGlobalLock( &pMac->sme );
5389 if ( HAL_STATUS_SUCCESS( status ) )
5390 {
5391
5392 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5393
5394 sme_ReleaseGlobalLock( &pMac->sme );
5395 }
5396
5397 return (status);
5398}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005399/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005400
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005401 \fn sme_ChangeMCCBeaconInterval
5402
5403 \brief To update P2P-GO beaconInterval. This function should be called after
5404 disassociating all the station is done
5405 This is an asynchronous API.
5406
5407 \param
5408
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005409 \return eHalStatus SUCCESS
5410 FAILURE or RESOURCES
5411 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005412
5413 -------------------------------------------------------------------------------*/
5414eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5415{
5416 eHalStatus status = eHAL_STATUS_FAILURE;
5417 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5418
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005419 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005420 status = sme_AcquireGlobalLock( &pMac->sme );
5421 if ( HAL_STATUS_SUCCESS( status ) )
5422 {
5423 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5424 sme_ReleaseGlobalLock( &pMac->sme );
5425 }
5426 return (status);
5427}
Jeff Johnson295189b2012-06-20 16:38:30 -07005428
5429/*-------------------------------------------------------------------------------*
5430
5431 \fn sme_sendBTAmpEvent
5432
5433 \brief to receive the coex priorty request from BT-AMP PAL
5434 and send the BT_AMP link state to HAL
5435
5436 \param btAmpEvent - btAmpEvent
5437
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005438 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005439
5440 FAILURE: API failed
5441
5442-------------------------------------------------------------------------------*/
5443
5444eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5445{
5446 vos_msg_t msg;
5447 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5448 eHalStatus status = eHAL_STATUS_FAILURE;
5449
5450 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5451 if (NULL == ptrSmeBtAmpEvent)
5452 {
5453 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005454 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005455 return status;
5456 }
5457
5458 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5459 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5460 msg.reserved = 0;
5461 msg.bodyptr = ptrSmeBtAmpEvent;
5462
5463 //status = halFW_SendBTAmpEventMesg(pMac, event);
5464
5465 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5466 {
5467 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005468 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005469 vos_mem_free(ptrSmeBtAmpEvent);
5470 return status;
5471 }
5472
5473 return eHAL_STATUS_SUCCESS;
5474
5475}
5476
5477/* ---------------------------------------------------------------------------
5478 \fn sme_SetHostOffload
5479 \brief API to set the host offload feature.
5480 \param hHal - The handle returned by macOpen.
5481 \param pRequest - Pointer to the offload request.
5482 \return eHalStatus
5483 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005484eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5485 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005486{
5487 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005488 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005489
5490 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5491 {
5492#ifdef WLAN_NS_OFFLOAD
5493 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5494 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005495 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005496 }
5497 else
5498#endif //WLAN_NS_OFFLOAD
5499 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005500 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005501 }
5502 sme_ReleaseGlobalLock( &pMac->sme );
5503 }
5504
5505 return (status);
5506}
5507
5508#ifdef WLAN_FEATURE_GTK_OFFLOAD
5509/* ---------------------------------------------------------------------------
5510 \fn sme_SetGTKOffload
5511 \brief API to set GTK offload information.
5512 \param hHal - The handle returned by macOpen.
5513 \param pRequest - Pointer to the GTK offload request.
5514 \return eHalStatus
5515 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005516eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5517 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005518{
5519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5520 eHalStatus status;
5521
5522 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5523 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005524 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005525 sme_ReleaseGlobalLock( &pMac->sme );
5526 }
5527
5528 return (status);
5529}
5530
5531/* ---------------------------------------------------------------------------
5532 \fn sme_GetGTKOffload
5533 \brief API to get GTK offload information.
5534 \param hHal - The handle returned by macOpen.
5535 \param pRequest - Pointer to the GTK offload response.
5536 \return eHalStatus
5537 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005538eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5539 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005540{
5541 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5542 eHalStatus status;
5543
5544 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5545 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005546 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005547 sme_ReleaseGlobalLock( &pMac->sme );
5548 }
5549
5550 return (status);
5551}
5552#endif // WLAN_FEATURE_GTK_OFFLOAD
5553
5554/* ---------------------------------------------------------------------------
5555 \fn sme_SetKeepAlive
5556 \brief API to set the Keep Alive feature.
5557 \param hHal - The handle returned by macOpen.
5558 \param pRequest - Pointer to the Keep Alive request.
5559 \return eHalStatus
5560 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005561eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5562 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005563{
5564 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5565 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005566 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5567 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005568 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 sme_ReleaseGlobalLock( &pMac->sme );
5570 }
5571
5572 return (status);
5573}
5574
5575#ifdef FEATURE_WLAN_SCAN_PNO
5576/* ---------------------------------------------------------------------------
5577 \fn sme_SetPreferredNetworkList
5578 \brief API to set the Preferred Network List Offload feature.
5579 \param hHal - The handle returned by macOpen.
5580 \param pRequest - Pointer to the offload request.
5581 \return eHalStatus
5582 ---------------------------------------------------------------------------*/
5583eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5584{
5585 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5586 eHalStatus status;
5587
5588 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5589 {
5590 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5591 sme_ReleaseGlobalLock( &pMac->sme );
5592 }
5593
5594 return (status);
5595}
5596
5597eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5598{
5599 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5600 eHalStatus status;
5601
5602 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5603 {
5604 pmcSetRssiFilter(hHal, rssiThreshold);
5605 sme_ReleaseGlobalLock( &pMac->sme );
5606 }
5607
5608 return (status);
5609}
5610
5611#endif // FEATURE_WLAN_SCAN_PNO
5612
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005613eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005614{
5615 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5616 eHalStatus status;
5617
5618 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5619 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005620 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005621 sme_ReleaseGlobalLock( &pMac->sme );
5622 }
5623
5624 return (status);
5625}
5626
5627/* ---------------------------------------------------------------------------
5628 \fn sme_AbortMacScan
5629 \brief API to cancel MAC scan.
5630 \param hHal - The handle returned by macOpen.
5631 \return VOS_STATUS
5632 VOS_STATUS_E_FAILURE - failure
5633 VOS_STATUS_SUCCESS success
5634 ---------------------------------------------------------------------------*/
5635eHalStatus sme_AbortMacScan(tHalHandle hHal)
5636{
5637 eHalStatus status;
5638 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5639
5640 status = sme_AcquireGlobalLock( &pMac->sme );
5641 if ( HAL_STATUS_SUCCESS( status ) )
5642 {
5643 status = csrScanAbortMacScan(pMac);
5644
5645 sme_ReleaseGlobalLock( &pMac->sme );
5646 }
5647
5648 return ( status );
5649}
5650
5651/* ----------------------------------------------------------------------------
5652 \fn sme_GetOperationChannel
5653 \brief API to get current channel on which STA is parked
5654 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005655 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005656 \returns eHAL_STATUS_SUCCESS
5657 eHAL_STATUS_FAILURE
5658-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005659eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005660{
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5662 tCsrRoamSession *pSession;
5663
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005664 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005665 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005666 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005667
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005668 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5669 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005670 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005671 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5672 {
5673 *pChannel =pSession->connectedProfile.operationChannel;
5674 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005675 }
5676 }
5677 return eHAL_STATUS_FAILURE;
5678}// sme_GetOperationChannel ends here
5679
Jeff Johnson295189b2012-06-20 16:38:30 -07005680/* ---------------------------------------------------------------------------
5681
5682 \fn sme_RegisterMgtFrame
5683
5684 \brief To register managment frame of specified type and subtype.
5685 \param frameType - type of the frame that needs to be passed to HDD.
5686 \param matchData - data which needs to be matched before passing frame
5687 to HDD.
5688 \param matchDataLen - Length of matched data.
5689 \return eHalStatus
5690 -------------------------------------------------------------------------------*/
5691eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5692 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5693{
5694 eHalStatus status = eHAL_STATUS_SUCCESS;
5695 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5696
5697 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5698 {
5699 tSirRegisterMgmtFrame *pMsg;
5700 tANI_U16 len;
5701 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005702
5703 if(!pSession)
5704 {
5705 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005706 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005707 return eHAL_STATUS_FAILURE;
5708 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005709
5710 if( !pSession->sessionActive )
5711 {
5712 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005713 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005714 sme_ReleaseGlobalLock( &pMac->sme );
5715 return eHAL_STATUS_FAILURE;
5716 }
5717
5718 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5719
5720 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5721 if(HAL_STATUS_SUCCESS(status))
5722 {
5723 palZeroMemory(pMac->hHdd, pMsg, len);
5724 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5725 pMsg->length = len;
5726 pMsg->sessionId = sessionId;
5727 pMsg->registerFrame = VOS_TRUE;
5728 pMsg->frameType = frameType;
5729 pMsg->matchLen = matchLen;
5730 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5731 status = palSendMBMessage(pMac->hHdd, pMsg);
5732 }
5733 sme_ReleaseGlobalLock( &pMac->sme );
5734 }
5735 return status;
5736}
5737
5738/* ---------------------------------------------------------------------------
5739
5740 \fn sme_DeregisterMgtFrame
5741
5742 \brief To De-register managment frame of specified type and subtype.
5743 \param frameType - type of the frame that needs to be passed to HDD.
5744 \param matchData - data which needs to be matched before passing frame
5745 to HDD.
5746 \param matchDataLen - Length of matched data.
5747 \return eHalStatus
5748 -------------------------------------------------------------------------------*/
5749eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5750 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5751{
5752 eHalStatus status = eHAL_STATUS_SUCCESS;
5753 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5754
5755 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5756 {
5757 tSirRegisterMgmtFrame *pMsg;
5758 tANI_U16 len;
5759 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005760
5761 if(!pSession)
5762 {
5763 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005764 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005765 return eHAL_STATUS_FAILURE;
5766 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005767
5768 if( !pSession->sessionActive )
5769 {
5770 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005771 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005772 sme_ReleaseGlobalLock( &pMac->sme );
5773 return eHAL_STATUS_FAILURE;
5774 }
5775
5776 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5777
5778 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5779 if(HAL_STATUS_SUCCESS(status))
5780 {
5781 palZeroMemory(pMac->hHdd, pMsg, len);
5782 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5783 pMsg->length = len;
5784 pMsg->registerFrame = VOS_FALSE;
5785 pMsg->frameType = frameType;
5786 pMsg->matchLen = matchLen;
5787 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5788 status = palSendMBMessage(pMac->hHdd, pMsg);
5789 }
5790 sme_ReleaseGlobalLock( &pMac->sme );
5791 }
5792 return status;
5793}
5794
5795/* ---------------------------------------------------------------------------
5796 \fn sme_RemainOnChannel
5797 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
5798 \param hHal - The handle returned by macOpen.
5799 \param pRequest - channel
5800 \param duration - duration in ms
5801 \param callback - HDD registered callback to process reaminOnChannelRsp
5802 \param context - HDD Callback param
5803 \return eHalStatus
5804 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005805eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
5806 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05305807 remainOnChanCallback callback,
5808 void *pContext,
5809 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07005810{
5811 eHalStatus status = eHAL_STATUS_SUCCESS;
5812 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5813
5814 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5815 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05305816 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
5817 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07005818#ifdef WLAN_FEATURE_P2P_INTERNAL
5819 , eP2PRemainOnChnReasonUnknown
5820#endif
5821 );
5822 sme_ReleaseGlobalLock( &pMac->sme );
5823 }
5824 return(status);
5825}
5826
5827/* ---------------------------------------------------------------------------
5828 \fn sme_ReportProbeReq
5829 \brief API to enable/disable forwarding of probeReq to apps in p2p.
5830 \param hHal - The handle returned by macOpen.
5831 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
5832 \return eHalStatus
5833 ---------------------------------------------------------------------------*/
5834
5835#ifndef WLAN_FEATURE_CONCURRENT_P2P
5836eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
5837{
5838 eHalStatus status = eHAL_STATUS_SUCCESS;
5839 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5840
5841 do
5842 {
5843 //acquire the lock for the sme object
5844 status = sme_AcquireGlobalLock(&pMac->sme);
5845 if(HAL_STATUS_SUCCESS(status))
5846 {
5847 /* call set in context */
5848 pMac->p2pContext.probeReqForwarding = flag;
5849 //release the lock for the sme object
5850 sme_ReleaseGlobalLock( &pMac->sme );
5851 }
5852 } while(0);
5853
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005854 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005855
5856 return(status);
5857}
5858
5859/* ---------------------------------------------------------------------------
5860 \fn sme_updateP2pIe
5861 \brief API to set the P2p Ie in p2p context
5862 \param hHal - The handle returned by macOpen.
5863 \param p2pIe - Ptr to p2pIe from HDD.
5864 \param p2pIeLength: length of p2pIe
5865 \return eHalStatus
5866 ---------------------------------------------------------------------------*/
5867
5868eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
5869{
5870 eHalStatus status = eHAL_STATUS_SUCCESS;
5871 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5872
5873 //acquire the lock for the sme object
5874 status = sme_AcquireGlobalLock(&pMac->sme);
5875 if(HAL_STATUS_SUCCESS(status))
5876 {
5877 if(NULL != pMac->p2pContext.probeRspIe){
5878 vos_mem_free(pMac->p2pContext.probeRspIe);
5879 pMac->p2pContext.probeRspIeLength = 0;
5880 }
5881
5882 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
5883 if (NULL == pMac->p2pContext.probeRspIe)
5884 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005885 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005886 pMac->p2pContext.probeRspIeLength = 0;
5887 status = eHAL_STATUS_FAILURE;
5888 }
5889 else
5890 {
5891 pMac->p2pContext.probeRspIeLength = p2pIeLength;
5892
5893 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
5894 pMac->p2pContext.probeRspIe,
5895 pMac->p2pContext.probeRspIeLength );
5896 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
5897 p2pIeLength);
5898 }
5899
5900 //release the lock for the sme object
5901 sme_ReleaseGlobalLock( &pMac->sme );
5902 }
5903
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005904 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005905
5906 return(status);
5907}
5908#endif
5909
5910/* ---------------------------------------------------------------------------
5911 \fn sme_sendAction
5912 \brief API to send action frame from supplicant.
5913 \param hHal - The handle returned by macOpen.
5914 \return eHalStatus
5915 ---------------------------------------------------------------------------*/
5916
5917eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07005918 const tANI_U8 *pBuf, tANI_U32 len,
5919 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07005920{
5921 eHalStatus status = eHAL_STATUS_SUCCESS;
5922 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5923
5924 //acquire the lock for the sme object
5925 status = sme_AcquireGlobalLock(&pMac->sme);
5926 if(HAL_STATUS_SUCCESS(status))
5927 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005928 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07005929 //release the lock for the sme object
5930 sme_ReleaseGlobalLock( &pMac->sme );
5931 }
5932
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005933 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005934
5935 return(status);
5936}
5937
5938eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
5939{
5940 eHalStatus status = eHAL_STATUS_SUCCESS;
5941 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5942
5943 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5944 {
5945 status = p2pCancelRemainOnChannel (hHal, sessionId);
5946 sme_ReleaseGlobalLock( &pMac->sme );
5947 }
5948 return(status);
5949}
5950
5951//Power Save Related
5952eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
5953{
5954 eHalStatus status = eHAL_STATUS_SUCCESS;
5955 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5956
5957 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5958 {
5959 status = p2pSetPs (hHal, data);
5960 sme_ReleaseGlobalLock( &pMac->sme );
5961 }
5962 return(status);
5963}
5964
Jeff Johnson295189b2012-06-20 16:38:30 -07005965
5966/* ---------------------------------------------------------------------------
5967
5968 \fn sme_ConfigureRxpFilter
5969
5970 \brief
5971 SME will pass this request to lower mac to set/reset the filter on RXP for
5972 multicast & broadcast traffic.
5973
5974 \param
5975
5976 hHal - The handle returned by macOpen.
5977
5978 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
5979 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
5980 on this param. In future we can use this as a mask to set various types of
5981 filters as suggested below:
5982 FILTER_ALL_MULTICAST:
5983 FILTER_ALL_BROADCAST:
5984 FILTER_ALL_MULTICAST_BROADCAST:
5985
5986
5987 \return eHalStatus
5988
5989
5990--------------------------------------------------------------------------- */
5991eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
5992 tpSirWlanSetRxpFilters wlanRxpFilterParam)
5993{
5994 eHalStatus status = eHAL_STATUS_SUCCESS;
5995 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5996 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5997 vos_msg_t vosMessage;
5998
5999 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6000 {
6001 /* serialize the req through MC thread */
6002 vosMessage.bodyptr = wlanRxpFilterParam;
6003 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6004 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6005 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6006 {
6007 status = eHAL_STATUS_FAILURE;
6008 }
6009 sme_ReleaseGlobalLock( &pMac->sme );
6010 }
6011 return(status);
6012}
6013
Jeff Johnson295189b2012-06-20 16:38:30 -07006014/* ---------------------------------------------------------------------------
6015
6016 \fn sme_ConfigureSuspendInd
6017
6018 \brief
6019 SME will pass this request to lower mac to Indicate that the wlan needs to
6020 be suspended
6021
6022 \param
6023
6024 hHal - The handle returned by macOpen.
6025
6026 wlanSuspendParam- Depicts the wlan suspend params
6027
6028
6029 \return eHalStatus
6030
6031
6032--------------------------------------------------------------------------- */
6033eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
6034 tpSirWlanSuspendParam wlanSuspendParam)
6035{
6036 eHalStatus status = eHAL_STATUS_SUCCESS;
6037 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6038 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6039 vos_msg_t vosMessage;
6040
6041 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6042 {
6043 /* serialize the req through MC thread */
6044 vosMessage.bodyptr = wlanSuspendParam;
6045 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6046 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6047 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6048 {
6049 status = eHAL_STATUS_FAILURE;
6050 }
6051 sme_ReleaseGlobalLock( &pMac->sme );
6052 }
6053 return(status);
6054}
6055
6056/* ---------------------------------------------------------------------------
6057
6058 \fn sme_ConfigureResumeReq
6059
6060 \brief
6061 SME will pass this request to lower mac to Indicate that the wlan needs to
6062 be Resumed
6063
6064 \param
6065
6066 hHal - The handle returned by macOpen.
6067
6068 wlanResumeParam- Depicts the wlan resume params
6069
6070
6071 \return eHalStatus
6072
6073
6074--------------------------------------------------------------------------- */
6075eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
6076 tpSirWlanResumeParam wlanResumeParam)
6077{
6078 eHalStatus status = eHAL_STATUS_SUCCESS;
6079 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6080 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6081 vos_msg_t vosMessage;
6082
6083 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6084 {
6085 /* serialize the req through MC thread */
6086 vosMessage.bodyptr = wlanResumeParam;
6087 vosMessage.type = WDA_WLAN_RESUME_REQ;
6088 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6089 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6090 {
6091 status = eHAL_STATUS_FAILURE;
6092 }
6093 sme_ReleaseGlobalLock( &pMac->sme );
6094 }
6095 return(status);
6096}
6097
Jeff Johnson295189b2012-06-20 16:38:30 -07006098/* ---------------------------------------------------------------------------
6099
6100 \fn sme_GetInfraSessionId
6101
6102 \brief To get the session ID for infra session, if connected
6103 This is a synchronous API.
6104
6105 \param hHal - The handle returned by macOpen.
6106
6107 \return sessionid, -1 if infra session is not connected
6108
6109 -------------------------------------------------------------------------------*/
6110tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
6111{
6112 eHalStatus status = eHAL_STATUS_FAILURE;
6113 tANI_S8 sessionid = -1;
6114 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6115
6116 status = sme_AcquireGlobalLock( &pMac->sme );
6117 if ( HAL_STATUS_SUCCESS( status ) )
6118 {
6119
6120 sessionid = csrGetInfraSessionId( pMac);
6121
6122 sme_ReleaseGlobalLock( &pMac->sme );
6123 }
6124
6125 return (sessionid);
6126}
6127
6128/* ---------------------------------------------------------------------------
6129
6130 \fn sme_GetInfraOperationChannel
6131
6132 \brief To get the operating channel for infra session, if connected
6133 This is a synchronous API.
6134
6135 \param hHal - The handle returned by macOpen.
6136 \param sessionId - the sessionId returned by sme_OpenSession.
6137
6138 \return operating channel, 0 if infra session is not connected
6139
6140 -------------------------------------------------------------------------------*/
6141tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
6142{
6143 eHalStatus status = eHAL_STATUS_FAILURE;
6144 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6145 tANI_U8 channel = 0;
6146 status = sme_AcquireGlobalLock( &pMac->sme );
6147 if ( HAL_STATUS_SUCCESS( status ) )
6148 {
6149
6150 channel = csrGetInfraOperationChannel( pMac, sessionId);
6151
6152 sme_ReleaseGlobalLock( &pMac->sme );
6153 }
6154
6155 return (channel);
6156}
6157
6158//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
6159//If other BSS is not up or not connected it will return 0
6160tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
6161{
6162 eHalStatus status = eHAL_STATUS_FAILURE;
6163 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6164 tANI_U8 channel = 0;
6165 status = sme_AcquireGlobalLock( &pMac->sme );
6166 if ( HAL_STATUS_SUCCESS( status ) )
6167 {
6168
6169 channel = csrGetConcurrentOperationChannel( pMac );
6170 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006171 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07006172 sme_ReleaseGlobalLock( &pMac->sme );
6173 }
6174
6175 return (channel);
6176}
6177
6178#ifdef FEATURE_WLAN_SCAN_PNO
6179/******************************************************************************
6180*
6181* Name: sme_PreferredNetworkFoundInd
6182*
6183* Description:
6184* Invoke Preferred Network Found Indication
6185*
6186* Parameters:
6187* hHal - HAL handle for device
6188* pMsg - found network description
6189*
6190* Returns: eHalStatus
6191*
6192******************************************************************************/
6193eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
6194{
6195 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6196 eHalStatus status = eHAL_STATUS_SUCCESS;
6197 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07006198 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
6199 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006200
6201 if (NULL == pMsg)
6202 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006203 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006204 status = eHAL_STATUS_FAILURE;
6205 }
6206 else
6207 {
6208 if (pPrefNetworkFoundInd->ssId.length > 0)
6209 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07006210 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
6211 pPrefNetworkFoundInd->ssId.length);
6212 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
6213 dumpSsId[ssIdLength] = 0;
6214 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
6215 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07006216
Srikant Kuppa066904f2013-05-07 13:56:02 -07006217 //Save the frame to scan result
6218 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
6219 {
6220 //we may have a frame
6221 status = csrScanSavePreferredNetworkFound(pMac,
6222 pPrefNetworkFoundInd);
6223 if (!HAL_STATUS_SUCCESS(status))
6224 {
6225 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
6226 }
6227 }
6228 else
6229 {
6230 smsLog(pMac, LOGE, FL(" not enough data length %d needed %d"),
6231 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07006232 }
6233
Srikant Kuppa066904f2013-05-07 13:56:02 -07006234 /* Call Preferred Netowrk Found Indication callback routine. */
6235 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
6236 {
6237 pMac->pmc.prefNetwFoundCB(
6238 pMac->pmc.preferredNetworkFoundIndCallbackContext,
6239 pPrefNetworkFoundInd);
6240 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006241 }
6242 else
6243 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006244 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006245 status = eHAL_STATUS_FAILURE;
6246 }
6247 }
6248
6249
6250 return(status);
6251}
6252
6253#endif // FEATURE_WLAN_SCAN_PNO
6254
6255
6256eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
6257{
6258 eHalStatus status = eHAL_STATUS_FAILURE;
6259 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6260
6261 status = sme_AcquireGlobalLock( &pMac->sme );
6262 if ( HAL_STATUS_SUCCESS( status ) )
6263 {
6264 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6265 sme_ReleaseGlobalLock( &pMac->sme );
6266 }
6267
6268 return (status);
6269}
6270
6271
6272/* ---------------------------------------------------------------------------
6273
6274 \fn sme_SetTxPerTracking
6275
6276 \brief Set Tx PER tracking configuration parameters
6277
6278 \param hHal - The handle returned by macOpen.
6279 \param pTxPerTrackingConf - Tx PER configuration parameters
6280
6281 \return eHalStatus
6282
6283 -------------------------------------------------------------------------------*/
6284eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6285 void (*pCallbackfn) (void *pCallbackContext),
6286 void *pCallbackContext,
6287 tpSirTxPerTrackingParam pTxPerTrackingParam)
6288{
6289 vos_msg_t msg;
6290 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6291 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6292
6293 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6294 {
6295 pMac->sme.pTxPerHitCallback = pCallbackfn;
6296 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6297 sme_ReleaseGlobalLock( &pMac->sme );
6298 }
6299
6300 // free this memory in failure case or WDA request callback function
6301 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6302 if (NULL == pTxPerTrackingParamReq)
6303 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006304 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for tSirTxPerTrackingParam", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006305 return eHAL_STATUS_FAILURE;
6306 }
6307
6308 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
6309 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6310 msg.reserved = 0;
6311 msg.bodyptr = pTxPerTrackingParamReq;
6312
6313 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6314 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006315 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_TX_PER_TRACKING_REQ message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006316 vos_mem_free(pTxPerTrackingParamReq);
6317 return eHAL_STATUS_FAILURE;
6318 }
6319
6320 return eHAL_STATUS_SUCCESS;
6321}
6322
6323/* ---------------------------------------------------------------------------
6324
6325 \fn sme_HandleChangeCountryCode
6326
6327 \brief Change Country code, Reg Domain and channel list
6328
6329 \details Country Code Priority
6330 0 = 11D > Configured Country > NV
6331 1 = Configured Country > 11D > NV
6332 If Supplicant country code is priority than 11d is disabled.
6333 If 11D is enabled, we update the country code after every scan.
6334 Hence when Supplicant country code is priority, we don't need 11D info.
6335 Country code from Supplicant is set as current courtry code.
6336 User can send reset command XX (instead of country code) to reset the
6337 country code to default values which is read from NV.
6338 In case of reset, 11D is enabled and default NV code is Set as current country code
6339 If 11D is priority,
6340 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6341
6342 \param pMac - The handle returned by macOpen.
6343 \param pMsgBuf - MSG Buffer
6344
6345 \return eHalStatus
6346
6347 -------------------------------------------------------------------------------*/
6348eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6349{
6350 eHalStatus status = eHAL_STATUS_SUCCESS;
6351 tAniChangeCountryCodeReq *pMsg;
6352 v_REGDOMAIN_t domainIdIoctl;
6353 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6354 static uNvTables nvTables;
6355 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6356
6357
6358 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6359 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6360 {
6361 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6362
6363 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6364
6365 /* read the country code from NV and use it */
6366 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6367 {
6368 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6369 }
6370 else
6371 {
6372 status = eHAL_STATUS_FAILURE;
6373 return status;
6374 }
6375 }
6376 else
6377 {
6378 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05306379 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
6380 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07006381 {
6382 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6383 }
6384 }
6385
6386 /* WEXT set country code means
6387 * 11D should be supported?
6388 * 11D Channel should be enforced?
6389 * 11D Country code should be matched?
6390 * 11D Reg Domian should be matched?
6391 * Country string changed */
6392 if(pMac->roam.configParam.Is11dSupportEnabled &&
6393 pMac->roam.configParam.fEnforce11dChannels &&
6394 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6395 pMac->roam.configParam.fEnforceDefaultDomain &&
6396 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6397 {
6398 /* All 11D related options are already enabled
6399 * Country string is not changed
6400 * Do not need do anything for country code change request */
6401 return eHAL_STATUS_SUCCESS;
6402 }
6403
6404 /* Set Current Country code and Current Regulatory domain */
6405 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6406 if(eHAL_STATUS_SUCCESS != status)
6407 {
6408 /* Supplicant country code failed. So give 11D priority */
6409 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6410 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6411 return status;
6412 }
6413
Jeff Johnson295189b2012-06-20 16:38:30 -07006414 /* overwrite the defualt country code */
6415 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6416
6417 /* Get Domain ID from country code */
6418 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6419 if ( status != eHAL_STATUS_SUCCESS )
6420 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006421 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006422 return status;
6423 }
6424
6425 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6426
6427 if ( status != eHAL_STATUS_SUCCESS )
6428 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006429 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006430 return status;
6431 }
6432
6433 /* set to default domain ID */
6434 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6435
6436 /* get the channels based on new cc */
6437 status = csrInitGetChannels( pMac );
6438
6439 if ( status != eHAL_STATUS_SUCCESS )
6440 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006441 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006442 return status;
6443 }
6444
6445 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006446 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006447 if( pMsg->changeCCCallback )
6448 {
6449 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6450 }
6451
6452 return eHAL_STATUS_SUCCESS;
6453}
6454
6455#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006456eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006457{
6458 tpSirRcvFltMcAddrList pRequestBuf;
6459 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006460 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006461 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006462
6463 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05306464 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006465 pMulticastAddrs->ulMulticastAddrCnt,
6466 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006467
6468 /*
6469 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006470 */
6471 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6472 csrIsConnStateInfra(pMac, sessionId))
6473 {
6474 pSession = CSR_GET_SESSION( pMac, sessionId );
6475 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006476
6477 if(pSession == NULL )
6478 {
6479 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006480 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006481 return eHAL_STATUS_FAILURE;
6482 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006483
Jeff Johnson295189b2012-06-20 16:38:30 -07006484 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6485 if (NULL == pRequestBuf)
6486 {
6487 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006488 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006489 return eHAL_STATUS_FAILED_ALLOC;
6490 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006491
6492 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6493 {
6494 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6495 "indication as we are not connected", __func__);
6496 vos_mem_free(pRequestBuf);
6497 return eHAL_STATUS_FAILURE;
6498 }
6499
Jeff Johnson295189b2012-06-20 16:38:30 -07006500 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6501
Jeff Johnsone7245742012-09-05 17:12:55 -07006502 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6503 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6504 sizeof(tSirMacAddr));
6505
Jeff Johnson295189b2012-06-20 16:38:30 -07006506 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6507 msg.reserved = 0;
6508 msg.bodyptr = pRequestBuf;
6509 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6510 {
6511 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006512 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006513 vos_mem_free(pRequestBuf);
6514 return eHAL_STATUS_FAILURE;
6515 }
6516
6517 return eHAL_STATUS_SUCCESS;
6518}
6519
Jeff Johnsone7245742012-09-05 17:12:55 -07006520eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6521 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006522{
6523 tpSirRcvPktFilterCfgType pRequestBuf;
6524 v_SINT_t allocSize;
6525 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006526 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6527 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006528 v_U8_t idx=0;
6529
6530 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006531 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006532 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6533
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006534 allocSize = sizeof(tSirRcvPktFilterCfgType);
6535
Jeff Johnson295189b2012-06-20 16:38:30 -07006536 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006537
6538 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006539 {
6540 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006541 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006542 return eHAL_STATUS_FAILED_ALLOC;
6543 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006544
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006545 if( NULL == pSession )
6546 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006547 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006548 vos_mem_free(pRequestBuf);
6549 return eHAL_STATUS_FAILURE;
6550 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006551
6552 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6553 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006554 sizeof(tSirMacAddr));
6555
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006556 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6557
Jeff Johnson295189b2012-06-20 16:38:30 -07006558 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6559 msg.reserved = 0;
6560 msg.bodyptr = pRequestBuf;
6561
6562 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6563 "FT %d FID %d ",
6564 pRequestBuf->filterType, pRequestBuf->filterId);
6565
6566 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6567 "params %d CT %d",
6568 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6569
6570 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6571 {
6572
6573 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006574 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006575 pRequestBuf->paramsData[idx].protocolLayer,
6576 pRequestBuf->paramsData[idx].cmpFlag);
6577
6578 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006579 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006580 pRequestBuf->paramsData[idx].dataOffset,
6581 pRequestBuf->paramsData[idx].dataLength);
6582
6583 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006584 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006585 pRequestBuf->paramsData[idx].compareData[0],
6586 pRequestBuf->paramsData[idx].compareData[1],
6587 pRequestBuf->paramsData[idx].compareData[2],
6588 pRequestBuf->paramsData[idx].compareData[3],
6589 pRequestBuf->paramsData[idx].compareData[4],
6590 pRequestBuf->paramsData[idx].compareData[5]);
6591
6592 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006593 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006594 pRequestBuf->paramsData[idx].dataMask[0],
6595 pRequestBuf->paramsData[idx].dataMask[1],
6596 pRequestBuf->paramsData[idx].dataMask[2],
6597 pRequestBuf->paramsData[idx].dataMask[3],
6598 pRequestBuf->paramsData[idx].dataMask[4],
6599 pRequestBuf->paramsData[idx].dataMask[5]);
6600
6601 }
6602
6603 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6604 {
6605 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006606 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006607 vos_mem_free(pRequestBuf);
6608 return eHAL_STATUS_FAILURE;
6609 }
6610
6611 return eHAL_STATUS_SUCCESS;
6612}
6613
6614eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6615 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006616 void *callbackContext,
6617 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006618{
6619 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6620 eHalStatus status;
6621
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006622 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006623
6624 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6625 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006626 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006627 sme_ReleaseGlobalLock( &pMac->sme );
6628 }
6629
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006630 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006631
6632 return (status);
6633}
6634
Jeff Johnsone7245742012-09-05 17:12:55 -07006635eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6636 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006637{
6638 tpSirRcvFltPktClearParam pRequestBuf;
6639 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006640 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6641 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006642
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006643 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006644 pRcvFltPktClearParam->filterId);
6645
6646 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006647 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006648 {
6649 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6650 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006651 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006652 return eHAL_STATUS_FAILED_ALLOC;
6653 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006654 if( NULL == pSession )
6655 {
6656 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006657 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006658 vos_mem_free(pRequestBuf);
6659 return eHAL_STATUS_FAILURE;
6660 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006661
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006662 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6663 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006664 sizeof(tSirMacAddr));
6665
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006666 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6667
Jeff Johnson295189b2012-06-20 16:38:30 -07006668 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6669 msg.reserved = 0;
6670 msg.bodyptr = pRequestBuf;
6671 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6672 {
6673 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006674 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006675 vos_mem_free(pRequestBuf);
6676 return eHAL_STATUS_FAILURE;
6677 }
6678
6679 return eHAL_STATUS_SUCCESS;
6680}
6681#endif // WLAN_FEATURE_PACKET_FILTERING
6682
6683/* ---------------------------------------------------------------------------
6684 \fn sme_PreChannelSwitchIndFullPowerCB
6685 \brief call back function for the PMC full power request because of pre
6686 channel switch.
6687 \param callbackContext
6688 \param status
6689 ---------------------------------------------------------------------------*/
6690void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6691 eHalStatus status)
6692{
6693 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6694 tSirMbMsg *pMsg;
6695 tANI_U16 msgLen;
6696
6697 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6698 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6699 if(HAL_STATUS_SUCCESS(status))
6700 {
6701 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6702 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6703 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6704 status = palSendMBMessage(pMac->hHdd, pMsg);
6705 }
6706
6707 return;
6708}
6709
6710/* ---------------------------------------------------------------------------
6711 \fn sme_HandlePreChannelSwitchInd
6712 \brief Processes the indcation from PE for pre-channel switch.
6713 \param hHal
6714 \- The handle returned by macOpen. return eHalStatus
6715 ---------------------------------------------------------------------------*/
6716eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6717{
6718 eHalStatus status = eHAL_STATUS_FAILURE;
6719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6720 status = sme_AcquireGlobalLock( &pMac->sme );
6721 if ( HAL_STATUS_SUCCESS( status ) )
6722 {
6723 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6724 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6725 sme_ReleaseGlobalLock( &pMac->sme );
6726 }
6727
6728 return (status);
6729}
6730
6731/* ---------------------------------------------------------------------------
6732 \fn sme_HandlePostChannelSwitchInd
6733 \brief Processes the indcation from PE for post-channel switch.
6734 \param hHal
6735 \- The handle returned by macOpen. return eHalStatus
6736 ---------------------------------------------------------------------------*/
6737eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6738{
6739 eHalStatus status = eHAL_STATUS_FAILURE;
6740 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6741
6742 status = sme_AcquireGlobalLock( &pMac->sme );
6743 if ( HAL_STATUS_SUCCESS( status ) )
6744 {
6745 status = pmcRequestBmps(hHal, NULL, NULL);
6746 sme_ReleaseGlobalLock( &pMac->sme );
6747 }
6748
6749 return (status);
6750}
6751
6752/* ---------------------------------------------------------------------------
6753
6754 \fn sme_IsChannelValid
6755
6756 \brief To check if the channel is valid for currently established domain
6757 This is a synchronous API.
6758
6759 \param hHal - The handle returned by macOpen.
6760 \param channel - channel to verify
6761
6762 \return TRUE/FALSE, TRUE if channel is valid
6763
6764 -------------------------------------------------------------------------------*/
6765tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6766{
6767 eHalStatus status = eHAL_STATUS_FAILURE;
6768 tANI_BOOLEAN valid = FALSE;
6769 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6770
6771 status = sme_AcquireGlobalLock( &pMac->sme );
6772 if ( HAL_STATUS_SUCCESS( status ) )
6773 {
6774
6775 valid = csrRoamIsChannelValid( pMac, channel);
6776
6777 sme_ReleaseGlobalLock( &pMac->sme );
6778 }
6779
6780 return (valid);
6781}
6782
6783/* ---------------------------------------------------------------------------
6784 \fn sme_SetFreqBand
6785 \brief Used to set frequency band.
6786 \param hHal
6787 \eBand band value to be configured
6788 \- return eHalStatus
6789 -------------------------------------------------------------------------*/
6790eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
6791{
6792 eHalStatus status = eHAL_STATUS_FAILURE;
6793 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6794
6795 status = sme_AcquireGlobalLock( &pMac->sme );
6796 if ( HAL_STATUS_SUCCESS( status ) )
6797 {
6798 status = csrSetBand(hHal, eBand);
6799 sme_ReleaseGlobalLock( &pMac->sme );
6800 }
6801 return status;
6802}
6803
6804/* ---------------------------------------------------------------------------
6805 \fn sme_GetFreqBand
6806 \brief Used to get the current band settings.
6807 \param hHal
6808 \pBand pointer to hold band value
6809 \- return eHalStatus
6810 -------------------------------------------------------------------------*/
6811eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
6812{
6813 eHalStatus status = eHAL_STATUS_FAILURE;
6814 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6815
6816 status = sme_AcquireGlobalLock( &pMac->sme );
6817 if ( HAL_STATUS_SUCCESS( status ) )
6818 {
6819 *pBand = csrGetCurrentBand( hHal );
6820 sme_ReleaseGlobalLock( &pMac->sme );
6821 }
6822 return status;
6823}
6824
6825#ifdef WLAN_WAKEUP_EVENTS
6826/******************************************************************************
6827 \fn sme_WakeReasonIndCallback
6828
6829 \brief
6830 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
6831
6832 \param hHal - HAL handle for device
6833 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
6834
6835 \return eHalStatus
6836******************************************************************************/
6837eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
6838{
6839 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6840 eHalStatus status = eHAL_STATUS_SUCCESS;
6841 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
6842
6843 if (NULL == pMsg)
6844 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006845 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006846 status = eHAL_STATUS_FAILURE;
6847 }
6848 else
6849 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006850 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07006851
6852 /* Call Wake Reason Indication callback routine. */
6853 if (pMac->pmc.wakeReasonIndCB != NULL)
6854 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
6855
6856 pMac->pmc.wakeReasonIndCB = NULL;
6857 pMac->pmc.wakeReasonIndCBContext = NULL;
6858
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006859 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07006860 }
6861
6862 return(status);
6863}
6864#endif // WLAN_WAKEUP_EVENTS
6865
6866
6867/* ---------------------------------------------------------------------------
6868
6869 \fn sme_SetMaxTxPower
6870
6871 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
6872 not persist over reboots.
6873
6874 \param hHal
6875 \param pBssid BSSID to set the power cap for
6876 \param pBssid pSelfMacAddress self MAC Address
6877 \param pBssid power to set in dB
6878 \- return eHalStatus
6879
6880 -------------------------------------------------------------------------------*/
6881eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
6882 tSirMacAddr pSelfMacAddress, v_S7_t dB)
6883{
6884 vos_msg_t msg;
6885 tpMaxTxPowerParams pMaxTxParams = NULL;
6886
6887 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
6888 if (NULL == pMaxTxParams)
6889 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006890 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for pMaxTxParams", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006891 return eHAL_STATUS_FAILURE;
6892 }
6893
6894 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
6895 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
6896 SIR_MAC_ADDR_LENGTH);
6897 pMaxTxParams->power = dB;
6898
6899 msg.type = WDA_SET_MAX_TX_POWER_REQ;
6900 msg.reserved = 0;
6901 msg.bodyptr = pMaxTxParams;
6902
6903 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6904 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006905 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006906 vos_mem_free(pMaxTxParams);
6907 return eHAL_STATUS_FAILURE;
6908 }
6909
6910 return eHAL_STATUS_SUCCESS;
6911}
6912
Jeff Johnson295189b2012-06-20 16:38:30 -07006913/* ---------------------------------------------------------------------------
6914
schang86c22c42013-03-13 18:41:24 -07006915 \fn sme_SetTxPower
6916
6917 \brief Set Transmit Power dynamically. Note: this setting will
6918 not persist over reboots.
6919
6920 \param hHal
6921 \param sessionId Target Session ID
6922 \param mW power to set in mW
6923 \- return eHalStatus
6924
6925 -------------------------------------------------------------------------------*/
6926eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
6927{
6928
6929 eHalStatus status = eHAL_STATUS_FAILURE;
6930 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6931
6932 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
6933 status = sme_AcquireGlobalLock(&pMac->sme);
6934 if (HAL_STATUS_SUCCESS(status))
6935 {
6936 status = csrSetTxPower(pMac, sessionId, mW);
6937 sme_ReleaseGlobalLock(&pMac->sme);
6938 }
6939 return status;
6940}
6941
6942/* ---------------------------------------------------------------------------
6943
Jeff Johnson295189b2012-06-20 16:38:30 -07006944 \fn sme_HideSSID
6945
6946 \brief hide/show SSID dynamically. Note: this setting will
6947 not persist over reboots.
6948
6949 \param hHal
6950 \param sessionId
6951 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
6952 \- return eHalStatus
6953
6954 -------------------------------------------------------------------------------*/
6955eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
6956{
6957 eHalStatus status = eHAL_STATUS_SUCCESS;
6958 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6959 tANI_U16 len;
6960
6961 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6962 {
6963 tpSirUpdateParams pMsg;
6964 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006965
6966 if(!pSession)
6967 {
6968 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006969 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006970 return eHAL_STATUS_FAILURE;
6971 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006972
6973 if( !pSession->sessionActive )
6974 VOS_ASSERT(0);
6975
6976 /* Create the message and send to lim */
6977 len = sizeof(tSirUpdateParams);
6978 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
6979 if(HAL_STATUS_SUCCESS(status))
6980 {
6981 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
6982 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
6983 pMsg->length = len;
6984 /* Data starts from here */
6985 pMsg->sessionId = sessionId;
6986 pMsg->ssidHidden = ssidHidden;
6987 status = palSendMBMessage(pMac->hHdd, pMsg);
6988 }
6989 sme_ReleaseGlobalLock( &pMac->sme );
6990 }
6991 return status;
6992}
Jeff Johnson295189b2012-06-20 16:38:30 -07006993
6994/* ---------------------------------------------------------------------------
6995
6996 \fn sme_SetTmLevel
6997 \brief Set Thermal Mitigation Level to RIVA
6998 \param hHal - The handle returned by macOpen.
6999 \param newTMLevel - new Thermal Mitigation Level
7000 \param tmMode - Thermal Mitigation handle mode, default 0
7001 \return eHalStatus
7002 ---------------------------------------------------------------------------*/
7003eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
7004{
7005 eHalStatus status = eHAL_STATUS_SUCCESS;
7006 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7007 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7008 vos_msg_t vosMessage;
7009 tAniSetTmLevelReq *setTmLevelReq = NULL;
7010
7011 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7012 {
7013 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
7014 if(NULL == setTmLevelReq)
7015 {
7016 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007017 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007018 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07007019 return eHAL_STATUS_FAILURE;
7020 }
7021
7022 setTmLevelReq->tmMode = tmMode;
7023 setTmLevelReq->newTmLevel = newTMLevel;
7024
7025 /* serialize the req through MC thread */
7026 vosMessage.bodyptr = setTmLevelReq;
7027 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
7028 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7029 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7030 {
7031 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007032 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007033 vos_mem_free(setTmLevelReq);
7034 status = eHAL_STATUS_FAILURE;
7035 }
7036 sme_ReleaseGlobalLock( &pMac->sme );
7037 }
7038 return(status);
7039}
7040
7041/*---------------------------------------------------------------------------
7042
7043 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
7044 Host and FW.
7045
7046 \param hHal - HAL handle for device
7047
7048 \return NONE
7049
7050---------------------------------------------------------------------------*/
7051void sme_featureCapsExchange( tHalHandle hHal)
7052{
7053 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
7054 WDA_featureCapsExchange(vosContext);
7055}
Jeff Johnsond13512a2012-07-17 11:42:19 -07007056
Yathish9f22e662012-12-10 14:21:35 -08007057/*---------------------------------------------------------------------------
7058
7059 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
7060 in Host.
7061
7062 \param hHal - HAL handle for device
7063
7064 \return NONE
7065
7066---------------------------------------------------------------------------*/
7067void sme_disableFeatureCapablity(tANI_U8 feature_index)
7068{
7069 WDA_disableCapablityFeature(feature_index);
7070}
7071
7072
Jeff Johnsond13512a2012-07-17 11:42:19 -07007073
7074/* ---------------------------------------------------------------------------
7075
7076 \fn sme_GetDefaultCountryCode
7077
7078 \brief Get the default country code from NV
7079
7080 \param hHal
7081 \param pCountry
7082 \- return eHalStatus
7083
7084 -------------------------------------------------------------------------------*/
7085eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
7086{
7087 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7088 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
7089}
7090
7091/* ---------------------------------------------------------------------------
7092
7093 \fn sme_GetCurrentCountryCode
7094
7095 \brief Get the current country code
7096
7097 \param hHal
7098 \param pCountry
7099 \- return eHalStatus
7100
7101 -------------------------------------------------------------------------------*/
7102eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
7103{
7104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7105 return csrGetCurrentCountryCode(pMac, pCountry);
7106}
7107
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007108/* ---------------------------------------------------------------------------
7109 \fn sme_transportDebug
7110 \brief Dynamically monitoring Transport channels
7111 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07007112 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08007113 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007114 \param toggleStallDetect Enable stall detect feature
7115 This feature will take effect to data performance
7116 Not integrate till fully verification
7117 \- return NONE
7118 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07007119void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007120{
schang6295e542013-03-12 15:31:23 -07007121 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7122
7123 if (NULL == pMac)
7124 {
7125 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7126 "%s: invalid context", __func__);
7127 return;
7128 }
7129 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07007130}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007131
Kiran4a17ebe2013-01-31 10:43:43 -08007132/* ---------------------------------------------------------------------------
7133 \fn sme_ResetPowerValuesFor5G
7134 \brief Reset the power values for 5G band with NV power values.
7135 \param hHal - HAL handle for device
7136 \- return NONE
7137 -------------------------------------------------------------------------*/
7138void sme_ResetPowerValuesFor5G (tHalHandle hHal)
7139{
7140 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
7141 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
7142 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
7143}
7144
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007145#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
7146/* ---------------------------------------------------------------------------
7147 \fn sme_UpdateRoamPrefer5GHz
7148 \brief enable/disable Roam prefer 5G runtime option
7149 This function is called through dynamic setConfig callback function
7150 to configure the Roam prefer 5G runtime option
7151 \param hHal - HAL handle for device
7152 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
7153 \- return Success or failure
7154 -------------------------------------------------------------------------*/
7155
7156eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
7157{
7158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007159 eHalStatus status = eHAL_STATUS_SUCCESS;
7160
7161 status = sme_AcquireGlobalLock( &pMac->sme );
7162 if ( HAL_STATUS_SUCCESS( status ) )
7163 {
7164 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7165 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
7166 pMac->roam.configParam.nRoamPrefer5GHz,
7167 nRoamPrefer5GHz);
7168 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
7169 sme_ReleaseGlobalLock( &pMac->sme );
7170 }
7171
7172 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007173}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007174
7175/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007176 \fn sme_setRoamIntraBand
7177 \brief enable/disable Intra band roaming
7178 This function is called through dynamic setConfig callback function
7179 to configure the intra band roaming
7180 \param hHal - HAL handle for device
7181 \param nRoamIntraBand Enable/Disable Intra band roaming
7182 \- return Success or failure
7183 -------------------------------------------------------------------------*/
7184eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
7185{
7186 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7187 eHalStatus status = eHAL_STATUS_SUCCESS;
7188
7189 status = sme_AcquireGlobalLock( &pMac->sme );
7190 if ( HAL_STATUS_SUCCESS( status ) )
7191 {
7192 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7193 "%s: gRoamIntraBand is changed from %d to %d", __func__,
7194 pMac->roam.configParam.nRoamIntraBand,
7195 nRoamIntraBand);
7196 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
7197 sme_ReleaseGlobalLock( &pMac->sme );
7198 }
7199
7200 return status ;
7201}
7202
7203/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007204 \fn sme_UpdateRoamScanNProbes
7205 \brief function to update roam scan N probes
7206 This function is called through dynamic setConfig callback function
7207 to update roam scan N probes
7208 \param hHal - HAL handle for device
7209 \param nProbes number of probe requests to be sent out
7210 \- return Success or failure
7211 -------------------------------------------------------------------------*/
7212eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
7213{
7214 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7215 eHalStatus status = eHAL_STATUS_SUCCESS;
7216
7217 status = sme_AcquireGlobalLock( &pMac->sme );
7218 if ( HAL_STATUS_SUCCESS( status ) )
7219 {
7220 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7221 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
7222 pMac->roam.configParam.nProbes,
7223 nProbes);
7224 pMac->roam.configParam.nProbes = nProbes;
7225 sme_ReleaseGlobalLock( &pMac->sme );
7226 }
7227#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7228 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7229 {
7230 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7231 REASON_NPROBES_CHANGED);
7232 }
7233#endif
7234 return status ;
7235}
7236
7237/* ---------------------------------------------------------------------------
7238 \fn sme_UpdateRoamScanHomeAwayTime
7239 \brief function to update roam scan Home away time
7240 This function is called through dynamic setConfig callback function
7241 to update roam scan home away time
7242 \param hHal - HAL handle for device
7243 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007244 \param bSendOffloadCmd If TRUE then send offload command to firmware
7245 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007246 \- return Success or failure
7247 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007248eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
7249 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007250{
7251 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7252 eHalStatus status = eHAL_STATUS_SUCCESS;
7253
7254 status = sme_AcquireGlobalLock( &pMac->sme );
7255 if ( HAL_STATUS_SUCCESS( status ) )
7256 {
7257 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7258 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
7259 pMac->roam.configParam.nRoamScanHomeAwayTime,
7260 nRoamScanHomeAwayTime);
7261 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
7262 sme_ReleaseGlobalLock( &pMac->sme );
7263 }
7264
7265#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007266 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007267 {
7268 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7269 REASON_HOME_AWAY_TIME_CHANGED);
7270 }
7271#endif
7272 return status;
7273}
7274
7275
7276/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007277 \fn sme_getRoamIntraBand
7278 \brief get Intra band roaming
7279 \param hHal - HAL handle for device
7280 \- return Success or failure
7281 -------------------------------------------------------------------------*/
7282v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
7283{
7284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7285 return pMac->roam.configParam.nRoamIntraBand;
7286}
7287
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007288/* ---------------------------------------------------------------------------
7289 \fn sme_getRoamScanNProbes
7290 \brief get N Probes
7291 \param hHal - HAL handle for device
7292 \- return Success or failure
7293 -------------------------------------------------------------------------*/
7294v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
7295{
7296 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7297 return pMac->roam.configParam.nProbes;
7298}
7299
7300/* ---------------------------------------------------------------------------
7301 \fn sme_getRoamScanHomeAwayTime
7302 \brief get Roam scan home away time
7303 \param hHal - HAL handle for device
7304 \- return Success or failure
7305 -------------------------------------------------------------------------*/
7306v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
7307{
7308 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7309 return pMac->roam.configParam.nRoamScanHomeAwayTime;
7310}
7311
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007312
7313/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007314 \fn sme_UpdateImmediateRoamRssiDiff
7315 \brief Update nImmediateRoamRssiDiff
7316 This function is called through dynamic setConfig callback function
7317 to configure nImmediateRoamRssiDiff
7318 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
7319 \param hHal - HAL handle for device
7320 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
7321 candidate and current AP.
7322 \- return Success or failure
7323 -------------------------------------------------------------------------*/
7324
7325eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
7326{
7327 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007328 eHalStatus status = eHAL_STATUS_SUCCESS;
7329
7330 status = sme_AcquireGlobalLock( &pMac->sme );
7331 if ( HAL_STATUS_SUCCESS( status ) )
7332 {
7333 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7334 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
7335 nImmediateRoamRssiDiff,
7336 pMac->roam.configParam.nImmediateRoamRssiDiff,
7337 pMac->roam.neighborRoamInfo.neighborRoamState);
7338 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
7339 sme_ReleaseGlobalLock( &pMac->sme );
7340 }
7341
7342 return status ;
7343}
7344
7345/* ---------------------------------------------------------------------------
7346 \fn sme_UpdateRoamRssiDiff
7347 \brief Update RoamRssiDiff
7348 This function is called through dynamic setConfig callback function
7349 to configure RoamRssiDiff
7350 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
7351 \param hHal - HAL handle for device
7352 \param RoamRssiDiff - minimum rssi difference between potential
7353 candidate and current AP.
7354 \- return Success or failure
7355 -------------------------------------------------------------------------*/
7356
7357eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
7358{
7359 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7360 eHalStatus status = eHAL_STATUS_SUCCESS;
7361
7362 status = sme_AcquireGlobalLock( &pMac->sme );
7363 if ( HAL_STATUS_SUCCESS( status ) )
7364 {
7365 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7366 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
7367 RoamRssiDiff,
7368 pMac->roam.configParam.RoamRssiDiff,
7369 pMac->roam.neighborRoamInfo.neighborRoamState);
7370 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
7371 sme_ReleaseGlobalLock( &pMac->sme );
7372 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007373#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7374 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7375 {
7376 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
7377 }
7378#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007379 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007380}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007381
7382/*--------------------------------------------------------------------------
7383 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
7384 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7385 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007386 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007387 \param hHal - The handle returned by macOpen.
7388 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
7389 Other status means SME is failed to update isFastTransitionEnabled.
7390 \sa
7391 --------------------------------------------------------------------------*/
7392eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
7393 v_BOOL_t isFastTransitionEnabled)
7394{
7395 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007396 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007397
Srinivas Girigowdade697412013-02-14 16:31:48 -08007398 status = sme_AcquireGlobalLock( &pMac->sme );
7399 if ( HAL_STATUS_SUCCESS( status ) )
7400 {
7401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7402 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
7403 pMac->roam.configParam.isFastTransitionEnabled,
7404 isFastTransitionEnabled);
7405 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
7406 sme_ReleaseGlobalLock( &pMac->sme );
7407 }
7408
7409 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007410}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007411
7412/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007413 \fn sme_SetRoamScanControl
7414 \brief Set roam scan control
7415 This function is called to set roam scan control
7416 if roam scan control is set to 0, roaming scan cache is cleared
7417 any value other than 0 is treated as invalid value
7418 \param hHal - HAL handle for device
7419 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7420 Other status means SME failure to update
7421 -------------------------------------------------------------------------*/
7422eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
7423{
7424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7425 eHalStatus status = eHAL_STATUS_SUCCESS;
7426
7427 status = sme_AcquireGlobalLock( &pMac->sme );
7428 if ( HAL_STATUS_SUCCESS( status ) )
7429 {
7430 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7431 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
7432 roamScanControl,
7433 pMac->roam.configParam.nRoamScanControl,
7434 pMac->roam.neighborRoamInfo.neighborRoamState);
7435 pMac->roam.configParam.nRoamScanControl = roamScanControl;
7436 if ( 0 == roamScanControl)
7437 {
7438 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7439 "LFR runtime successfully cleared roam scan cache");
7440 csrFlushBgScanRoamChannelList(pMac);
7441#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7442 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7443 {
7444 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
7445 }
7446#endif
7447 }
7448 sme_ReleaseGlobalLock( &pMac->sme );
7449 }
7450 return status ;
7451}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007452#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
7453
7454#ifdef FEATURE_WLAN_LFR
7455/*--------------------------------------------------------------------------
7456 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
7457 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7458 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007459 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007460 \param hHal - The handle returned by macOpen.
7461 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
7462 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
7463 \sa
7464 --------------------------------------------------------------------------*/
7465eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007466 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007467{
7468 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7469
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007470 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
7471 {
7472 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7473 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7474 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7475 isFastRoamIniFeatureEnabled);
7476 return eHAL_STATUS_SUCCESS;
7477 }
7478
Srinivas Girigowdade697412013-02-14 16:31:48 -08007479 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7480 "%s: FastRoamEnabled is changed from %d to %d", __func__,
7481 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7482 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007483 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007484 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007485
7486 if(TRUE == isFastRoamIniFeatureEnabled)
7487 {
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007488 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7489 }
7490 else
7491 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007492 /* CCX also depend on FW Monitoring.
7493 Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007494#ifdef FEATURE_WLAN_CCX
7495 if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007496#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007497 {
7498 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Srinivas Girigowdade697412013-02-14 16:31:48 -08007499 "%s: Turn off FW Monitoring", __func__);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007500 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7501 }
7502 }
7503
7504 return eHAL_STATUS_SUCCESS;
7505}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07007506
7507#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7508/*--------------------------------------------------------------------------
7509 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
7510 This is a synchronuous call
7511 \param hHal - The handle returned by macOpen.
7512 \return eHAL_STATUS_SUCCESS
7513 Other status means SME is failed
7514 \sa
7515 --------------------------------------------------------------------------*/
7516
7517eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
7518 v_BOOL_t bFastRoamInConIniFeatureEnabled)
7519{
7520
7521 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7522 eHalStatus status = eHAL_STATUS_SUCCESS;
7523
7524 status = sme_AcquireGlobalLock( &pMac->sme );
7525 if ( HAL_STATUS_SUCCESS( status ) )
7526 {
7527 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
7528 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
7529 {
7530 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
7531 }
7532 sme_ReleaseGlobalLock( &pMac->sme );
7533 }
7534
7535 return status;
7536}
7537#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007538#endif /* FEATURE_WLAN_LFR */
7539
7540#ifdef FEATURE_WLAN_CCX
7541/*--------------------------------------------------------------------------
7542 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
7543 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7544 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007545 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007546 \param hHal - The handle returned by macOpen.
7547 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
7548 Other status means SME is failed to update isCcxIniFeatureEnabled.
7549 \sa
7550 --------------------------------------------------------------------------*/
7551
7552eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007553 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007554{
7555 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7556
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007557 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
7558 {
7559 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7560 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7561 pMac->roam.configParam.isCcxIniFeatureEnabled,
7562 isCcxIniFeatureEnabled);
7563 return eHAL_STATUS_SUCCESS;
7564 }
7565
Srinivas Girigowdade697412013-02-14 16:31:48 -08007566 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7567 "%s: CcxEnabled is changed from %d to %d", __func__,
7568 pMac->roam.configParam.isCcxIniFeatureEnabled,
7569 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007570 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007571 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007572
7573 if(TRUE == isCcxIniFeatureEnabled)
7574 {
7575 sme_UpdateFastTransitionEnabled(hHal, TRUE);
7576 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7577 }
7578 else
7579 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007580 /* LFR also depend on FW Monitoring.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007581 Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */
7582#ifdef FEATURE_WLAN_LFR
7583 if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled)
7584#endif
7585 {
7586 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7587 "%s: Turn off FW Monitoring/Fast Transition", __func__);
7588 sme_UpdateFastTransitionEnabled(hHal, FALSE);
7589 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7590 }
7591 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007592#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7593 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7594 {
7595 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
7596 }
7597#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007598 return eHAL_STATUS_SUCCESS;
7599}
7600#endif /* FEATURE_WLAN_CCX */
7601
7602/*--------------------------------------------------------------------------
7603 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7604 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7605 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007606 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007607 \param hHal - The handle returned by macOpen.
7608 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7609 Other status means SME is failed to update fEnableFwRssiMonitoring.
7610 \sa
7611 --------------------------------------------------------------------------*/
7612
7613eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7614 v_BOOL_t fEnableFwRssiMonitoring)
7615{
7616 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7617
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007618 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7619 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7620 {
7621 halStatus = eHAL_STATUS_FAILURE;
7622 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007623 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007624 }
7625
7626 return (halStatus);
7627}
7628
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007629#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08007630/*--------------------------------------------------------------------------
7631 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7632 This is a synchronous call
7633 \param hHal - The handle returned by macOpen.
7634 \return eHAL_STATUS_SUCCESS - SME update config successful.
7635 Other status means SME is failed to update
7636 \sa
7637 --------------------------------------------------------------------------*/
7638eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7639 v_U8_t neighborLookupRssiThreshold)
7640{
7641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7642 eHalStatus status = eHAL_STATUS_SUCCESS;
7643
7644 status = sme_AcquireGlobalLock( &pMac->sme );
7645 if ( HAL_STATUS_SUCCESS( status ) )
7646 {
7647 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7648 if (HAL_STATUS_SUCCESS(status))
7649 {
7650 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7651 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7652 neighborLookupRssiThreshold,
7653 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7654 pMac->roam.neighborRoamInfo.neighborRoamState);
7655 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7656 neighborLookupRssiThreshold;
7657 }
7658 sme_ReleaseGlobalLock( &pMac->sme );
7659 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007660 return status;
7661}
7662
7663/*--------------------------------------------------------------------------
7664 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
7665 This is a synchronous call
7666 \param hHal - The handle returned by macOpen.
7667 \return eHAL_STATUS_SUCCESS - SME update config successful.
7668 Other status means SME is failed to update
7669 \sa
7670 --------------------------------------------------------------------------*/
7671eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
7672 v_U8_t neighborReassocRssiThreshold)
7673{
7674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7675 eHalStatus status = eHAL_STATUS_SUCCESS;
7676
7677 status = sme_AcquireGlobalLock( &pMac->sme );
7678 if ( HAL_STATUS_SUCCESS( status ) )
7679 {
7680 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7681 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7682 neighborReassocRssiThreshold,
7683 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7684 pMac->roam.neighborRoamInfo.neighborRoamState);
7685 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7686 neighborReassocRssiThreshold;
7687 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7688 neighborReassocRssiThreshold;
7689 sme_ReleaseGlobalLock( &pMac->sme );
7690 }
7691
7692 return status ;
7693}
7694
7695
7696/*--------------------------------------------------------------------------
7697 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7698 This is a synchronous call
7699 \param hHal - The handle returned by macOpen.
7700 \return eHAL_STATUS_SUCCESS - SME update config successful.
7701 Other status means SME is failed to update
7702 \sa
7703 --------------------------------------------------------------------------*/
7704v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7705{
7706 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7707 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7708}
7709
7710/*--------------------------------------------------------------------------
7711 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7712 This is a synchronous call
7713 \param hHal - The handle returned by macOpen.
7714 \return eHAL_STATUS_SUCCESS - SME update config successful.
7715 Other status means SME is failed to update
7716 \sa
7717 --------------------------------------------------------------------------*/
7718eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7719 v_U16_t neighborScanResultsRefreshPeriod)
7720{
7721 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7722 eHalStatus status = eHAL_STATUS_SUCCESS;
7723
7724 status = sme_AcquireGlobalLock( &pMac->sme );
7725 if ( HAL_STATUS_SUCCESS( status ) )
7726 {
7727 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7728 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7729 neighborScanResultsRefreshPeriod,
7730 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7731 pMac->roam.neighborRoamInfo.neighborRoamState);
7732 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7733 neighborScanResultsRefreshPeriod;
7734 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7735 neighborScanResultsRefreshPeriod;
7736
7737 sme_ReleaseGlobalLock( &pMac->sme );
7738 }
7739
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007740#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7741 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7742 {
7743 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7744 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
7745 }
7746#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007747 return status ;
7748}
7749
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007750#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7751/*--------------------------------------------------------------------------
7752 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
7753 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7754 gRoamScanOffloadEnabled.
7755 This is a synchronous call
7756 \param hHal - The handle returned by macOpen.
7757 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7758 Other status means SME is failed to update.
7759 \sa
7760 --------------------------------------------------------------------------*/
7761
7762eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
7763 v_BOOL_t nRoamScanOffloadEnabled)
7764{
7765 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7766 eHalStatus status = eHAL_STATUS_SUCCESS;
7767
7768 status = sme_AcquireGlobalLock( &pMac->sme );
7769 if ( HAL_STATUS_SUCCESS( status ) )
7770 {
7771 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7772 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
7773 pMac->roam.configParam.isRoamOffloadScanEnabled,
7774 nRoamScanOffloadEnabled);
7775 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
7776 sme_ReleaseGlobalLock( &pMac->sme );
7777 }
7778
7779 return status ;
7780}
7781#endif
7782
Srinivas Girigowdade697412013-02-14 16:31:48 -08007783/*--------------------------------------------------------------------------
7784 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7785 This is a synchronous call
7786 \param hHal - The handle returned by macOpen.
7787 \return v_U16_t - Neighbor scan results refresh period value
7788 \sa
7789 --------------------------------------------------------------------------*/
7790v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7791{
7792 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7793 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7794}
7795
7796/*--------------------------------------------------------------------------
7797 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7798 This is a synchronuous call
7799 \param hHal - The handle returned by macOpen.
7800 \return eHAL_STATUS_SUCCESS - SME update config successful.
7801 Other status means SME is failed to update
7802 \sa
7803 --------------------------------------------------------------------------*/
7804v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7805{
7806 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7807 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7808}
7809
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007810/* ---------------------------------------------------------------------------
7811 \fn sme_UpdateEmptyScanRefreshPeriod
7812 \brief Update nEmptyScanRefreshPeriod
7813 This function is called through dynamic setConfig callback function
7814 to configure nEmptyScanRefreshPeriod
7815 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7816 \param hHal - HAL handle for device
7817 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7818 \- return Success or failure
7819 -------------------------------------------------------------------------*/
7820
7821eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
7822{
7823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7824 eHalStatus status = eHAL_STATUS_SUCCESS;
7825
7826 status = sme_AcquireGlobalLock( &pMac->sme );
7827 if ( HAL_STATUS_SUCCESS( status ) )
7828 {
7829 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7830 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
7831 nEmptyScanRefreshPeriod,
7832 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
7833 pMac->roam.neighborRoamInfo.neighborRoamState);
7834 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7835 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7836 sme_ReleaseGlobalLock( &pMac->sme );
7837 }
7838
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007839#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7840 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7841 {
7842 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7843 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
7844 }
7845#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007846 return status ;
7847}
7848
7849/* ---------------------------------------------------------------------------
7850 \fn sme_setNeighborScanMinChanTime
7851 \brief Update nNeighborScanMinChanTime
7852 This function is called through dynamic setConfig callback function
7853 to configure gNeighborScanChannelMinTime
7854 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
7855 \param hHal - HAL handle for device
7856 \param nNeighborScanMinChanTime - Channel minimum dwell time
7857 \- return Success or failure
7858 -------------------------------------------------------------------------*/
7859eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
7860{
7861 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7862 eHalStatus status = eHAL_STATUS_SUCCESS;
7863
7864 status = sme_AcquireGlobalLock( &pMac->sme );
7865 if ( HAL_STATUS_SUCCESS( status ) )
7866 {
7867 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7868 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
7869 nNeighborScanMinChanTime,
7870 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
7871 pMac->roam.neighborRoamInfo.neighborRoamState);
7872 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
7873 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
7874 sme_ReleaseGlobalLock( &pMac->sme );
7875 }
7876
7877 return status ;
7878}
7879
7880/* ---------------------------------------------------------------------------
7881 \fn sme_setNeighborScanMaxChanTime
7882 \brief Update nNeighborScanMaxChanTime
7883 This function is called through dynamic setConfig callback function
7884 to configure gNeighborScanChannelMaxTime
7885 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
7886 \param hHal - HAL handle for device
7887 \param nNeighborScanMinChanTime - Channel maximum dwell time
7888 \- return Success or failure
7889 -------------------------------------------------------------------------*/
7890eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
7891{
7892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7893 eHalStatus status = eHAL_STATUS_SUCCESS;
7894
7895 status = sme_AcquireGlobalLock( &pMac->sme );
7896 if ( HAL_STATUS_SUCCESS( status ) )
7897 {
7898 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7899 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
7900 nNeighborScanMaxChanTime,
7901 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
7902 pMac->roam.neighborRoamInfo.neighborRoamState);
7903 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
7904 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
7905 sme_ReleaseGlobalLock( &pMac->sme );
7906 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007907#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7908 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7909 {
7910 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7911 REASON_SCAN_CH_TIME_CHANGED);
7912 }
7913#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007914
7915 return status ;
7916}
7917
7918/* ---------------------------------------------------------------------------
7919 \fn sme_getNeighborScanMinChanTime
7920 \brief get neighbor scan min channel time
7921 \param hHal - The handle returned by macOpen.
7922 \return v_U16_t - channel min time value
7923 -------------------------------------------------------------------------*/
7924v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
7925{
7926 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7927 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
7928}
7929
7930/* ---------------------------------------------------------------------------
7931 \fn sme_getNeighborScanMaxChanTime
7932 \brief get neighbor scan max channel time
7933 \param hHal - The handle returned by macOpen.
7934 \return v_U16_t - channel max time value
7935 -------------------------------------------------------------------------*/
7936v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
7937{
7938 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7939 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
7940}
7941
7942/* ---------------------------------------------------------------------------
7943 \fn sme_setNeighborScanPeriod
7944 \brief Update nNeighborScanPeriod
7945 This function is called through dynamic setConfig callback function
7946 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007947 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007948 \param hHal - HAL handle for device
7949 \param nNeighborScanPeriod - neighbor scan period
7950 \- return Success or failure
7951 -------------------------------------------------------------------------*/
7952eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
7953{
7954 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7955 eHalStatus status = eHAL_STATUS_SUCCESS;
7956
7957 status = sme_AcquireGlobalLock( &pMac->sme );
7958 if ( HAL_STATUS_SUCCESS( status ) )
7959 {
7960 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7961 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
7962 nNeighborScanPeriod,
7963 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
7964 pMac->roam.neighborRoamInfo.neighborRoamState);
7965 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
7966 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
7967 sme_ReleaseGlobalLock( &pMac->sme );
7968 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007969#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7970 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7971 {
7972 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7973 REASON_SCAN_HOME_TIME_CHANGED);
7974 }
7975#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007976
7977 return status ;
7978}
7979
7980/* ---------------------------------------------------------------------------
7981 \fn sme_getNeighborScanPeriod
7982 \brief get neighbor scan period
7983 \param hHal - The handle returned by macOpen.
7984 \return v_U16_t - neighbor scan period
7985 -------------------------------------------------------------------------*/
7986v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
7987{
7988 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7989 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
7990}
7991
7992#endif
7993
Srinivas Girigowdade697412013-02-14 16:31:48 -08007994#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007995
Srinivas Girigowdade697412013-02-14 16:31:48 -08007996/*--------------------------------------------------------------------------
7997 \brief sme_getRoamRssiDiff() - get Roam rssi diff
7998 This is a synchronous call
7999 \param hHal - The handle returned by macOpen.
8000 \return v_U16_t - Rssi diff value
8001 \sa
8002 --------------------------------------------------------------------------*/
8003v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
8004{
8005 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8006 return pMac->roam.configParam.RoamRssiDiff;
8007}
8008
8009/*--------------------------------------------------------------------------
8010 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
8011 This is a synchronous call
8012 \param hHal - The handle returned by macOpen.
8013 \return eHAL_STATUS_SUCCESS - SME update config successful.
8014 Other status means SME is failed to update
8015 \sa
8016 --------------------------------------------------------------------------*/
8017eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
8018 tANI_U8 numChannels)
8019{
8020 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8021 eHalStatus status = eHAL_STATUS_SUCCESS;
8022 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008023 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08008024 tANI_U8 newChannelList[128] = {0};
8025 tANI_U8 i = 0, j = 0;
8026
8027 status = sme_AcquireGlobalLock( &pMac->sme );
8028 if ( HAL_STATUS_SUCCESS( status ) )
8029 {
8030 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
8031 {
8032 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
8033 {
8034 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
8035 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
8036 }
8037 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008038 csrFlushBgScanRoamChannelList(pMac);
8039 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Srinivas Girigowdade697412013-02-14 16:31:48 -08008040 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
8041
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008042 if ( HAL_STATUS_SUCCESS( status ))
Srinivas Girigowdade697412013-02-14 16:31:48 -08008043 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008044 sme_SetRoamScanControl(hHal, 1);
8045 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08008046 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008047 j = 0;
8048 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
8049 {
8050 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
8051 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
8052 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008053 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008054
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008055 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8056 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
8057 newChannelList, oldChannelList,
8058 pMac->roam.neighborRoamInfo.neighborRoamState);
8059 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008060 sme_ReleaseGlobalLock( &pMac->sme );
8061 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008062#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8063 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8064 {
8065 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
8066 }
8067#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008068
8069 return status ;
8070}
8071
8072/*--------------------------------------------------------------------------
8073 \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list
8074 based on country revision number
8075 This is a synchronous call
8076 \param hHal - The handle returned by macOpen.
8077 \return eHAL_STATUS_SUCCESS - SME update config successful.
8078 Other status means SME is failed to update
8079 \sa
8080 --------------------------------------------------------------------------*/
8081eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal,
8082 tANI_U8 Revision)
8083{
8084 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8085 eHalStatus status = eHAL_STATUS_SUCCESS;
8086
8087 status = sme_AcquireGlobalLock( &pMac->sme );
8088 if ( HAL_STATUS_SUCCESS( status ) )
8089 {
8090 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8091 "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d",
8092 "KR", Revision, "KR",
8093 pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision,
8094 pMac->roam.neighborRoamInfo.neighborRoamState);
8095 csr_SetRevision(pMac, Revision);
8096 csrInitCountryValidChannelList(pMac, Revision);
8097 sme_ReleaseGlobalLock( &pMac->sme );
8098 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008099#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8100 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8101 {
8102 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_VALID_CHANNEL_LIST_CHANGED);
8103 }
8104#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008105
8106 return status ;
8107}
8108
8109
8110/*--------------------------------------------------------------------------
8111 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
8112 This is a synchronous call
8113 \param hHal - The handle returned by macOpen.
8114 \return eHAL_STATUS_SUCCESS - SME update config successful.
8115 Other status means SME is failed to update
8116 \sa
8117 --------------------------------------------------------------------------*/
8118eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
8119 eCsrBand eBand)
8120{
8121 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8122 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
8123}
8124
8125/*--------------------------------------------------------------------------
8126 \brief sme_getRoamScanChannelList() - get roam scan channel list
8127 This is a synchronous call
8128 \param hHal - The handle returned by macOpen.
8129 \return eHAL_STATUS_SUCCESS - SME update config successful.
8130 Other status means SME is failed to update
8131 \sa
8132 --------------------------------------------------------------------------*/
8133eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
8134 tANI_U8 *pNumChannels)
8135{
8136 int i = 0;
8137 tANI_U8 *pOutPtr = pChannelList;
8138 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8139 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
8140 eHalStatus status = eHAL_STATUS_SUCCESS;
8141
8142 status = sme_AcquireGlobalLock( &pMac->sme );
8143 if ( HAL_STATUS_SUCCESS( status ) )
8144 {
8145 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
8146 {
8147 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
8148 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008149 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08008150 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008151 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08008152 }
8153
8154 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
8155 for (i = 0; i < (*pNumChannels); i++)
8156 {
8157 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
8158 }
8159 pOutPtr[i] = '\0';
8160 sme_ReleaseGlobalLock( &pMac->sme );
8161 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008162 return status ;
8163}
8164
8165/*--------------------------------------------------------------------------
8166 \brief sme_GetCountryRevision() - get Country revision index
8167 This is a synchronous call
8168 \param hHal - The handle returned by macOpen.
8169 \return eHAL_STATUS_SUCCESS - SME update config successful.
8170 Other status means SME is failed to update
8171 \sa
8172 --------------------------------------------------------------------------*/
8173eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision)
8174{
8175 /* this is valid for Country KR only now */
8176 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8177 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
8178 eHalStatus status = eHAL_STATUS_SUCCESS;
8179
8180 *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision;
8181
8182 return status;
8183}
8184
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008185/*--------------------------------------------------------------------------
8186 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
8187 This is a synchronuous call
8188 \param hHal - The handle returned by macOpen.
8189 \return TRUE (1) - if the CCX feature is enabled
8190 FALSE (0) - if feature is disabled (compile or runtime)
8191 \sa
8192 --------------------------------------------------------------------------*/
8193tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08008194{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008195#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08008196 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008197 return pMac->roam.configParam.isCcxIniFeatureEnabled;
8198#else
8199 return eANI_BOOLEAN_FALSE;
8200#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008201}
8202
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008203/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008204 \brief sme_GetRoamScanControl() - get scan control
8205 This is a synchronous call
8206 \param hHal - The handle returned by macOpen.
8207 \return v_BOOL_t - Enabled(1)/Disabled(0)
8208 \sa
8209 --------------------------------------------------------------------------*/
8210v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
8211{
8212 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8213 return pMac->roam.configParam.nRoamScanControl;
8214}
8215#endif
8216
8217/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008218 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
8219 This is a synchronuous call
8220 \param hHal - The handle returned by macOpen.
8221 \return TRUE (1) - if the feature is enabled
8222 FALSE (0) - if feature is disabled (compile or runtime)
8223 \sa
8224 --------------------------------------------------------------------------*/
8225tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
8226{
8227#ifdef FEATURE_WLAN_LFR
8228 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8229 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
8230#else
8231 return eANI_BOOLEAN_FALSE;
8232#endif
8233}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008234
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008235/*--------------------------------------------------------------------------
8236 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
8237 This is a synchronuous call
8238 \param hHal - The handle returned by macOpen.
8239 \return TRUE (1) - if the feature is enabled
8240 FALSE (0) - if feature is disabled (compile or runtime)
8241 \sa
8242 --------------------------------------------------------------------------*/
8243tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
8244{
8245#ifdef WLAN_FEATURE_VOWIFI_11R
8246 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8247 return pMac->roam.configParam.isFastTransitionEnabled;
8248#else
8249 return eANI_BOOLEAN_FALSE;
8250#endif
8251}
8252
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008253
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008254/* ---------------------------------------------------------------------------
8255 \fn sme_IsFeatureSupportedByFW
8256 \brief Check if an feature is enabled by FW
8257
8258 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
8259 \- return 1/0 (TRUE/FALSE)
8260 -------------------------------------------------------------------------*/
8261tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
8262{
8263 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
8264}
8265#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05308266
8267/* ---------------------------------------------------------------------------
8268 \fn sme_SendTdlsMgmtFrame
8269 \brief API to send TDLS management frames.
8270
8271 \param peerMac - peer's Mac Adress.
8272 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
8273 \- return VOS_STATUS_SUCCES
8274 -------------------------------------------------------------------------*/
8275VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
8276 tANI_U8 sessionId,
8277 tSirMacAddr peerMac,
8278 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
8279{
8280 eHalStatus status = eHAL_STATUS_SUCCESS;
8281 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8282
8283 status = sme_AcquireGlobalLock( &pMac->sme );
8284
8285 if ( HAL_STATUS_SUCCESS( status ) )
8286 {
8287 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
8288 sme_ReleaseGlobalLock( &pMac->sme );
8289 }
8290 return status ;
8291}
8292
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008293/* ---------------------------------------------------------------------------
8294 \fn sme_SendTdlsMgmtFrame
8295 \brief API to send TDLS management frames.
8296
8297 \param peerMac - peer's Mac Adress.
8298 \param frame_type - Type of TDLS mgmt frame to be sent.
8299 \param dialog - dialog token used in the frame.
8300 \param status - status to be incuded in the frame.
8301 \param buf - additional IEs to be included
8302 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08008303 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008304 \- return VOS_STATUS_SUCCES
8305 -------------------------------------------------------------------------*/
8306VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08008307 tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008308{
8309 eHalStatus status = eHAL_STATUS_SUCCESS;
8310 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
8311 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8312
8313 status = sme_AcquireGlobalLock( &pMac->sme );
8314 if ( HAL_STATUS_SUCCESS( status ) )
8315 {
8316 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8317 sendTdlsReq.frameType = frame_type;
8318 sendTdlsReq.buf = buf;
8319 sendTdlsReq.len = len;
8320 sendTdlsReq.dialog = dialog;
8321 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08008322 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008323
8324 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
8325
8326 sme_ReleaseGlobalLock( &pMac->sme );
8327 }
8328
8329 return status ;
8330
8331}
8332/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08008333 \fn sme_ChangeTdlsPeerSta
8334 \brief API to Update TDLS peer sta parameters.
8335
8336 \param peerMac - peer's Mac Adress.
8337 \param staParams - Peer Station Parameters
8338 \- return VOS_STATUS_SUCCES
8339 -------------------------------------------------------------------------*/
8340VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
8341 tCsrStaParams *pstaParams)
8342{
8343 eHalStatus status = eHAL_STATUS_SUCCESS;
8344 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8345
8346 status = sme_AcquireGlobalLock( &pMac->sme );
8347 if ( HAL_STATUS_SUCCESS( status ) )
8348 {
8349 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
8350
8351 sme_ReleaseGlobalLock( &pMac->sme );
8352 }
8353
8354 return status ;
8355
8356}
8357
8358/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008359 \fn sme_AddTdlsPeerSta
8360 \brief API to Add TDLS peer sta entry.
8361
8362 \param peerMac - peer's Mac Adress.
8363 \- return VOS_STATUS_SUCCES
8364 -------------------------------------------------------------------------*/
8365VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8366{
8367 eHalStatus status = eHAL_STATUS_SUCCESS;
8368 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8369
8370 status = sme_AcquireGlobalLock( &pMac->sme );
8371 if ( HAL_STATUS_SUCCESS( status ) )
8372 {
8373 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
8374
8375 sme_ReleaseGlobalLock( &pMac->sme );
8376 }
8377
8378 return status ;
8379
8380}
8381/* ---------------------------------------------------------------------------
8382 \fn sme_DeleteTdlsPeerSta
8383 \brief API to Delete TDLS peer sta entry.
8384
8385 \param peerMac - peer's Mac Adress.
8386 \- return VOS_STATUS_SUCCES
8387 -------------------------------------------------------------------------*/
8388VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8389{
8390 eHalStatus status = eHAL_STATUS_SUCCESS;
8391 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8392
8393 status = sme_AcquireGlobalLock( &pMac->sme );
8394 if ( HAL_STATUS_SUCCESS( status ) )
8395 {
8396 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
8397
8398 sme_ReleaseGlobalLock( &pMac->sme );
8399 }
8400
8401 return status ;
8402
8403}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07008404/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07008405 \fn sme_SetTdlsPowerSaveProhibited
8406 \API to set/reset the isTdlsPowerSaveProhibited.
8407
8408 \- return void
8409 -------------------------------------------------------------------------*/
8410void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
8411{
8412 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8413
8414 pMac->isTdlsPowerSaveProhibited = val;
8415 return;
8416}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008417#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05308418/* ---------------------------------------------------------------------------
8419 \fn sme_IsPmcBmps
8420 \API to Check if PMC state is BMPS.
8421
8422 \- return v_BOOL_t
8423 -------------------------------------------------------------------------*/
8424v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
8425{
8426 return (BMPS == pmcGetPmcState(hHal));
8427}
8428
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008429#ifdef FEATURE_WLAN_TDLS_INTERNAL
8430/*
8431 * SME API to start TDLS discovery Procedure
8432 */
8433VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8434{
8435 VOS_STATUS status = VOS_STATUS_SUCCESS;
8436 tCsrTdlsDisRequest disReq = {{0}} ;
8437 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8438 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
8439
8440 return status ;
8441
8442}
8443
8444/*
8445 * Process TDLS discovery results
8446 */
8447v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
8448 tSmeTdlsDisResult *disResult, v_U8_t listType)
8449{
8450 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
8451 tSirTdlsPeerInfo *peerInfo = NULL ;
8452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8453 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
8454 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
8455 tListElem *pEntry = NULL ;
8456 v_U8_t peerCnt = 0 ;
8457
8458 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008459 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008460 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
8461 while(pEntry)
8462 {
8463 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
8464 tdlsPeerStaLink) ;
8465 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
8466
8467 switch(listType)
8468 {
8469 case TDLS_SETUP_LIST:
8470 {
8471 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
8472 {
8473 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8474 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8475 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8476 peerCnt++ ;
8477 }
8478 break ;
8479 }
8480 case TDLS_DIS_LIST:
8481 {
8482 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8483 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8484 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8485 peerCnt++ ;
8486 break ;
8487 }
8488 default:
8489 {
8490 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008491 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008492 break ;
8493 }
8494 }
8495
8496 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
8497 }
8498
8499 return peerCnt ;
8500
8501}
8502
8503/*
8504 * SME API to start TDLS link setup Procedure.
8505 */
8506VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8507{
8508 VOS_STATUS status = VOS_STATUS_SUCCESS;
8509 tCsrTdlsSetupRequest setupReq = {{0}} ;
8510 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8511 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
8512 return status ;
8513
8514}
8515
8516/*
8517 * SME API to start TDLS link Teardown Procedure.
8518 */
8519VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8520{
8521 VOS_STATUS status = VOS_STATUS_SUCCESS;
8522 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
8523 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8524 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
8525 return status ;
8526
8527}
8528
8529#endif /* FEATURE_WLAN_TDLS */
8530
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07008531eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
8532{
8533 eHalStatus status = eHAL_STATUS_FAILURE;
8534 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8535
8536 smsLog(pMac, LOG2, FL("enter"));
8537 status = sme_AcquireGlobalLock( &pMac->sme );
8538 if ( HAL_STATUS_SUCCESS( status ) )
8539 {
8540 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
8541 sme_ReleaseGlobalLock( &pMac->sme );
8542 }
8543 smsLog(pMac, LOG2, FL("exit status %d"), status);
8544
8545 return (status);
8546}
8547
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07008548/*
8549 * SME API to enable/disable WLAN driver initiated SSR
8550 */
8551void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
8552{
8553 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8554 eHalStatus status = eHAL_STATUS_SUCCESS;
8555
8556 status = sme_AcquireGlobalLock(&pMac->sme);
8557 if (HAL_STATUS_SUCCESS(status))
8558 {
8559 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8560 "SSR level is changed %d", enableSSR);
8561 /* not serializing this messsage, as this is only going
8562 * to set a variable in WDA/WDI
8563 */
8564 WDA_SetEnableSSR(enableSSR);
8565 sme_ReleaseGlobalLock(&pMac->sme);
8566 }
8567 return;
8568}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07008569
8570/*
8571 * SME API to determine the channel bonding mode
8572 */
8573VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
8574{
8575 tSmeConfigParams smeConfig;
8576 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8577
8578 if (
8579#ifdef WLAN_FEATURE_11AC
8580 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
8581 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
8582#endif
8583 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
8584 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
8585 )
8586 {
8587 return VOS_STATUS_SUCCESS;
8588 }
8589
8590 /* If channel bonding mode is not required */
8591 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
8592 return VOS_STATUS_SUCCESS;
8593 }
8594
8595 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
8596 sme_GetConfigParam(pMac, &smeConfig);
8597
8598#ifdef WLAN_FEATURE_11AC
8599 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
8600 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
8601 {
8602 if ( channel== 36 || channel == 52 || channel == 100 ||
8603 channel == 116 || channel == 149 )
8604 {
8605 smeConfig.csrConfig.channelBondingMode5GHz =
8606 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
8607 }
8608 else if ( channel == 40 || channel == 56 || channel == 104 ||
8609 channel == 120 || channel == 153 )
8610 {
8611 smeConfig.csrConfig.channelBondingMode5GHz =
8612 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
8613 }
8614 else if ( channel == 44 || channel == 60 || channel == 108 ||
8615 channel == 124 || channel == 157 )
8616 {
8617 smeConfig.csrConfig.channelBondingMode5GHz =
8618 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
8619 }
8620 else if ( channel == 48 || channel == 64 || channel == 112 ||
8621 channel == 128 || channel == 161 )
8622 {
8623 smeConfig.csrConfig.channelBondingMode5GHz =
8624 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
8625 }
8626 else if ( channel == 165 )
8627 {
8628 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8629 }
8630 }
8631#endif
8632
8633 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
8634 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
8635 {
8636 if ( channel== 40 || channel == 48 || channel == 56 ||
8637 channel == 64 || channel == 104 || channel == 112 ||
8638 channel == 120 || channel == 128 || channel == 136 ||
8639 channel == 144 || channel == 153 || channel == 161 )
8640 {
8641 smeConfig.csrConfig.channelBondingMode5GHz = 1;
8642 }
8643 else if ( channel== 36 || channel == 44 || channel == 52 ||
8644 channel == 60 || channel == 100 || channel == 108 ||
8645 channel == 116 || channel == 124 || channel == 132 ||
8646 channel == 140 || channel == 149 || channel == 157 )
8647 {
8648 smeConfig.csrConfig.channelBondingMode5GHz = 2;
8649 }
8650 else if ( channel == 165 )
8651 {
8652 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8653 }
8654 }
8655 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8656 "cbmode selected=%ld\n", smeConfig.csrConfig.channelBondingMode5GHz);
8657
8658 sme_UpdateConfig (pMac, &smeConfig);
8659 return VOS_STATUS_SUCCESS;
8660}
8661
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07008662/*--------------------------------------------------------------------------
8663
8664 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
8665 \param hHal - The handle returned by macOpen.
8666 \param currDeviceMode - Current operating device mode.
8667 --------------------------------------------------------------------------*/
8668
8669void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
8670{
8671 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8672 pMac->sme.currDeviceMode = currDeviceMode;
8673 return;
8674}
8675
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07008676#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8677/*--------------------------------------------------------------------------
8678 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
8679 from CSR.
8680 This is a synchronous call
8681 \param hHal - The handle returned by macOpen
8682 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
8683 BSSID, channel etc.)
8684 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
8685 Other status means SME is failed to send the request.
8686 \sa
8687 --------------------------------------------------------------------------*/
8688
8689eHalStatus sme_HandoffRequest(tHalHandle hHal,
8690 tCsrHandoffRequest *pHandoffInfo)
8691{
8692 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8693 eHalStatus status = eHAL_STATUS_SUCCESS;
8694
8695 status = sme_AcquireGlobalLock( &pMac->sme );
8696 if ( HAL_STATUS_SUCCESS( status ) )
8697 {
8698 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8699 "%s: invoked", __func__);
8700 status = csrHandoffRequest(pMac, pHandoffInfo);
8701 sme_ReleaseGlobalLock( &pMac->sme );
8702 }
8703
8704 return status ;
8705}
8706#endif
8707
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07008708/*
8709 * SME API to check if there is any infra station or
8710 * P2P client is connected
8711 */
8712VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
8713{
8714 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8715 if(csrIsInfraConnected(pMac))
8716 {
8717 return VOS_STATUS_SUCCESS;
8718 }
8719 return VOS_STATUS_E_FAILURE;
8720}
8721
Leo Chang9056f462013-08-01 19:21:11 -07008722
8723#ifdef FEATURE_WLAN_LPHB
8724/* ---------------------------------------------------------------------------
8725 \fn sme_LPHBConfigReq
8726 \API to make configuration LPHB within FW.
8727 \param hHal - The handle returned by macOpen
8728 \param lphdReq - LPHB request argument by client
8729 \param pCallbackfn - LPHB timeout notification callback function pointer
8730 \- return Configuration message posting status, SUCCESS or Fail
8731 -------------------------------------------------------------------------*/
8732eHalStatus sme_LPHBConfigReq
8733(
8734 tHalHandle hHal,
8735 tSirLPHBReq *lphdReq,
8736 void (*pCallbackfn)(void *pAdapter, void *indParam)
8737)
8738{
8739 eHalStatus status = eHAL_STATUS_SUCCESS;
8740 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8741 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8742 vos_msg_t vosMessage;
8743
8744 status = sme_AcquireGlobalLock(&pMac->sme);
8745 if (eHAL_STATUS_SUCCESS == status)
8746 {
8747 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
8748 (NULL == pCallbackfn) &&
8749 (NULL == pMac->sme.pLphbWaitTimeoutCb))
8750 {
8751 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8752 "%s: Indication Call back did not registered", __func__);
8753 sme_ReleaseGlobalLock(&pMac->sme);
8754 return eHAL_STATUS_FAILURE;
8755 }
8756 else if (NULL != pCallbackfn)
8757 {
8758 pMac->sme.pLphbWaitTimeoutCb = pCallbackfn;
8759 }
8760
8761 /* serialize the req through MC thread */
8762 vosMessage.bodyptr = lphdReq;
8763 vosMessage.type = WDA_LPHB_CONF_REQ;
8764 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
8765 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
8766 {
8767 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8768 "%s: Post Config LPHB MSG fail", __func__);
8769 status = eHAL_STATUS_FAILURE;
8770 }
8771 sme_ReleaseGlobalLock(&pMac->sme);
8772 }
8773
8774 return(status);
8775}
8776#endif /* FEATURE_WLAN_LPHB */
8777