blob: d2d10ff490b5a016581ec6df79dfff67915121f4 [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
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080093
Jeff Johnson295189b2012-06-20 16:38:30 -070094// TxMB Functions
95extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
96 tANI_U32 size, tSmeCmd **ppCmd );
97extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
98extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070099extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
100extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
101extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
102extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
103extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700105
106static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
107static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
108
109eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
110
111eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
112
113eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
114
115eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
116
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700117#ifdef FEATURE_WLAN_LFR
118tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
119#endif
120
Chet Lanctot186b5732013-03-18 10:26:30 -0700121#ifdef WLAN_FEATURE_11W
122eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
123 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
124#endif
125
Jeff Johnson295189b2012-06-20 16:38:30 -0700126//Internal SME APIs
127eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
128{
129 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
130
131 if(psSme)
132 {
133 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
134 {
135 status = eHAL_STATUS_SUCCESS;
136 }
137 }
138
139 return (status);
140}
141
142
143eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
144{
145 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
146
147 if(psSme)
148 {
149 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
150 {
151 status = eHAL_STATUS_SUCCESS;
152 }
153 }
154
155 return (status);
156}
157
158
159
160static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
161{
162 eHalStatus status;
163 tSmeCmd *pCmd;
164
165 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
166 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdActiveList)))
167 {
168 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdPendingList)))
169 {
170 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdFreeList)))
171 {
172 status = palAllocateMemory(pMac->hHdd, (void **)&pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
173 if(HAL_STATUS_SUCCESS(status))
174 {
175 tANI_U32 c;
176
177 palZeroMemory(pMac->hHdd, pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
178 pMac->sme.pSmeCmdBufAddr = pCmd;
179 for(c = 0; c < pMac->sme.totalSmeCmd; c++)
180 {
181 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd[c].Link, LL_ACCESS_LOCK);
182 }
183 }
184 }
185 }
186 }
187
188 return (status);
189}
190
191
192void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
193{
194 pCmd->command = eSmeNoCommand;
195 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
196}
197
198
199
200static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
201{
202 tListElem *pEntry;
203 tSmeCmd *pCommand;
204
205 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
206 {
207 //TODO: base on command type to call release functions
208 //reinitialize different command types so they can be reused
209 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
210 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
211 }
212}
213
214static void purgeSmeCmdList(tpAniSirGlobal pMac)
215{
216 //release any out standing commands back to free command list
217 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
218 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
219}
220
221void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
222{
223 //release any out standing commands back to free command list
224 tListElem *pEntry, *pNext;
225 tSmeCmd *pCommand;
226 tDblLinkList *pList = &pMac->sme.smeCmdPendingList;
227 tDblLinkList localList;
228
229 vos_mem_zero(&localList, sizeof(tDblLinkList));
230 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
231 {
232 smsLog(pMac, LOGE, FL(" failed to open list"));
233 return;
234 }
235
236 csrLLLock(pList);
237 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
238 while(pEntry != NULL)
239 {
240 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
241 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
242 if(pCommand->sessionId == sessionId)
243 {
244 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
245 {
246 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
247 }
248 }
249 pEntry = pNext;
250 }
251 csrLLUnlock(pList);
252
253 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
254 {
255 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
256 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
257 }
258 csrLLClose(&localList);
259
260}
261
262
263static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
264{
265 eHalStatus status = eHAL_STATUS_SUCCESS;
266
267 purgeSmeCmdList(pMac);
268 csrLLClose(&pMac->sme.smeCmdPendingList);
269 csrLLClose(&pMac->sme.smeCmdActiveList);
270 csrLLClose(&pMac->sme.smeCmdFreeList);
271
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800272 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
273 if(status != eHAL_STATUS_SUCCESS)
274 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800275 smsLog(pMac, LOGE,
276 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800277 goto done;
278 }
279
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 if(NULL != pMac->sme.pSmeCmdBufAddr)
281 {
282 status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr);
283 pMac->sme.pSmeCmdBufAddr = NULL;
284 }
285
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800286 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
287 if(status != eHAL_STATUS_SUCCESS)
288 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800289 smsLog(pMac, LOGE,
290 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800291 }
292done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 return (status);
294}
295
296
297void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
298{
299#ifdef WLAN_DEBUG
300 switch( pCmd->command )
301 {
302 case eSmeCommandScan:
303 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
304 break;
305
306 case eSmeCommandRoam:
307 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
308 break;
309
310 case eSmeCommandWmStatusChange:
311 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
312 break;
313
314 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800315 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
317 break;
318
319 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800320 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
322 break;
323
324 default:
325 break;
326 }
327#endif //#ifdef WLAN_DEBUG
328}
329
330tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
331{
332 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
333 tListElem *pEntry;
334
335 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
336
337 // If we can get another MS Msg buffer, then we are ok. Just link
338 // the entry onto the linked list. (We are using the linked list
339 // to keep track of tfhe message buffers).
340 if ( pEntry )
341 {
342 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
343 }
344 else {
345 int idx = 1;
346
347 //Cannot change pRetCmd here since it needs to return later.
348 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
349 if( pEntry )
350 {
351 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
352 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800353 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
355 if(pTempCmd)
356 {
357 if( eSmeCsrCommandMask & pTempCmd->command )
358 {
359 //CSR command is stuck. See what the reason code is for that command
360 dumpCsrCommandInfo(pMac, pTempCmd);
361 }
362 } //if(pTempCmd)
363
364 //dump what is in the pending queue
365 csrLLLock(&pMac->sme.smeCmdPendingList);
366 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
367 while(pEntry)
368 {
369 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800370 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 idx++, pTempCmd->command );
372 if( eSmeCsrCommandMask & pTempCmd->command )
373 {
374 //CSR command is stuck. See what the reason code is for that command
375 dumpCsrCommandInfo(pMac, pTempCmd);
376 }
377 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
378 }
379 csrLLUnlock(&pMac->sme.smeCmdPendingList);
380
381 //There may be some more command in CSR's own pending queue
382 csrLLLock(&pMac->roam.roamCmdPendingList);
383 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
384 while(pEntry)
385 {
386 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800387 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 idx++, pTempCmd->command );
389 dumpCsrCommandInfo(pMac, pTempCmd);
390 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
391 }
392 csrLLUnlock(&pMac->roam.roamCmdPendingList);
393 }
394
395 return( pRetCmd );
396}
397
398
399void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
400{
401 if ( fHighPriority )
402 {
403 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
404 }
405 else
406 {
407 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
408 }
409
410 // process the command queue...
411 smeProcessPendingQueue( pMac );
412
413 return;
414}
415
416
417static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
418{
419 eSmeCommandType pmcCommand = eSmeNoCommand;
420 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
421 tPmcState pmcState;
422 eHalStatus status;
423
424 do
425 {
426 pmcState = pmcGetPmcState(pMac);
427
428 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
429 if( !HAL_STATUS_SUCCESS(status) )
430 {
431 //PMC state is not right for the command, drop it
432 return ( eSmeDropCommand );
433 }
434 if( fFullPowerNeeded ) break;
435 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
436 ( eSmeCommandDelTs == pCommand->command ) );
437 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700438#ifdef FEATURE_OEM_DATA_SUPPORT
439 fFullPowerNeeded = (pmcState == IMPS &&
440 eSmeCommandOemDataReq == pCommand->command);
441 if(fFullPowerNeeded) break;
442#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 fFullPowerNeeded = (pmcState == IMPS &&
444 eSmeCommandRemainOnChannel == pCommand->command);
445 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 } while(0);
447
448 if( fFullPowerNeeded )
449 {
450 switch( pmcState )
451 {
452 case IMPS:
453 case STANDBY:
454 pmcCommand = eSmeCommandExitImps;
455 break;
456
457 case BMPS:
458 pmcCommand = eSmeCommandExitBmps;
459 break;
460
461 case UAPSD:
462 pmcCommand = eSmeCommandExitUapsd;
463 break;
464
465 case WOWL:
466 pmcCommand = eSmeCommandExitWowl;
467 break;
468
469 default:
470 break;
471 }
472 }
473
474 return ( pmcCommand );
475}
476
477
478//For commands that need to do extra cleanup.
479static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
480{
481 if( eSmePmcCommandMask & pCommand->command )
482 {
483 pmcAbortCommand( pMac, pCommand, fStopping );
484 }
485 else if ( eSmeCsrCommandMask & pCommand->command )
486 {
487 csrAbortCommand( pMac, pCommand, fStopping );
488 }
489 else
490 {
491 switch( pCommand->command )
492 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eSmeCommandRemainOnChannel:
494 if (NULL != pCommand->u.remainChlCmd.callback)
495 {
496 remainOnChanCallback callback =
497 pCommand->u.remainChlCmd.callback;
498 /* process the msg */
499 if( callback )
500 {
501 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
502 eCSR_SCAN_ABORT );
503 }
504 }
505 smeReleaseCommand( pMac, pCommand );
506 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 default:
508 smeReleaseCommand( pMac, pCommand );
509 break;
510 }
511 }
512}
513
514
515
516tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
517{
518 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
519 eHalStatus status = eHAL_STATUS_SUCCESS;
520 tListElem *pEntry;
521 tSmeCmd *pCommand;
522 eSmeCommandType pmcCommand = eSmeNoCommand;
523
524 // if the ActiveList is empty, then nothing is active so we can process a
525 // pending command...
526 //alwasy lock active list before locking pending list
527 csrLLLock( &pMac->sme.smeCmdActiveList );
528 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
529 {
530 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
531 {
532 //Peek the command
533 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
534 if( pEntry )
535 {
536 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
537 //We cannot execute any command in wait-for-key state until setKey is through.
538 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
539 {
540 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
541 {
542 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800543 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 return ( eANI_BOOLEAN_FALSE );
545 }
546 }
547 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
548 if( eSmeDropCommand == pmcCommand )
549 {
550 //This command is not ok for current PMC state
551 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
552 {
553 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
554 }
555 csrLLUnlock( &pMac->sme.smeCmdActiveList );
556 //tell caller to continue
557 return (eANI_BOOLEAN_TRUE);
558 }
559 else if( eSmeNoCommand != pmcCommand )
560 {
561 tExitBmpsInfo exitBmpsInfo;
562 void *pv = NULL;
563 tANI_U32 size = 0;
564 tSmeCmd *pPmcCmd = NULL;
565
566 if( eSmeCommandExitBmps == pmcCommand )
567 {
568 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
569 pv = (void *)&exitBmpsInfo;
570 size = sizeof(tExitBmpsInfo);
571 }
572 //pmcCommand has to be one of the exit power save command
573 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
574 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
575 {
576 //Force this command to wake up the chip
577 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
578 csrLLUnlock( &pMac->sme.smeCmdActiveList );
579 fContinue = pmcProcessCommand( pMac, pPmcCmd );
580 if( fContinue )
581 {
582 //The command failed, remove it
583 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
584 {
585 pmcReleaseCommand( pMac, pPmcCmd );
586 }
587 }
588 }
589 else
590 {
591 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800592 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 -0700593 //Let it retry
594 fContinue = eANI_BOOLEAN_TRUE;
595 }
596 return fContinue;
597 }
598 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
599 {
600 // we can reuse the pCommand
601
602 // Insert the command onto the ActiveList...
603 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
604
605 // .... and process the command.
606
607 switch ( pCommand->command )
608 {
609
610 case eSmeCommandScan:
611 csrLLUnlock( &pMac->sme.smeCmdActiveList );
612 status = csrProcessScanCommand( pMac, pCommand );
613 break;
614
615 case eSmeCommandRoam:
616 csrLLUnlock( &pMac->sme.smeCmdActiveList );
617 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800618 if(!HAL_STATUS_SUCCESS(status))
619 {
620 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
621 &pCommand->Link, LL_ACCESS_LOCK ) )
622 {
623 csrReleaseCommandRoam( pMac, pCommand );
624 }
625 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 break;
627
628 case eSmeCommandWmStatusChange:
629 csrLLUnlock( &pMac->sme.smeCmdActiveList );
630 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
631 break;
632
633 case eSmeCommandSetKey:
634 csrLLUnlock( &pMac->sme.smeCmdActiveList );
635 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
636 if(!HAL_STATUS_SUCCESS(status))
637 {
638 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
639 &pCommand->Link, LL_ACCESS_LOCK ) )
640 {
641 csrReleaseCommandSetKey( pMac, pCommand );
642 }
643 }
644 break;
645
646 case eSmeCommandRemoveKey:
647 csrLLUnlock( &pMac->sme.smeCmdActiveList );
648 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
649 if(!HAL_STATUS_SUCCESS(status))
650 {
651 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
652 &pCommand->Link, LL_ACCESS_LOCK ) )
653 {
654 csrReleaseCommandRemoveKey( pMac, pCommand );
655 }
656 }
657 break;
658
659 case eSmeCommandAddStaSession:
660 csrLLUnlock( &pMac->sme.smeCmdActiveList );
661 csrProcessAddStaSessionCommand( pMac, pCommand );
662 break;
663 case eSmeCommandDelStaSession:
664 csrLLUnlock( &pMac->sme.smeCmdActiveList );
665 csrProcessDelStaSessionCommand( pMac, pCommand );
666 break;
667
Jeff Johnsone7245742012-09-05 17:12:55 -0700668#ifdef FEATURE_OEM_DATA_SUPPORT
669 case eSmeCommandOemDataReq:
670 csrLLUnlock(&pMac->sme.smeCmdActiveList);
671 oemData_ProcessOemDataReqCommand(pMac, pCommand);
672 break;
673#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case eSmeCommandRemainOnChannel:
675 csrLLUnlock(&pMac->sme.smeCmdActiveList);
676 p2pProcessRemainOnChannelCmd(pMac, pCommand);
677 break;
678 case eSmeCommandNoAUpdate:
679 csrLLUnlock( &pMac->sme.smeCmdActiveList );
680 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case eSmeCommandEnterImps:
682 case eSmeCommandExitImps:
683 case eSmeCommandEnterBmps:
684 case eSmeCommandExitBmps:
685 case eSmeCommandEnterUapsd:
686 case eSmeCommandExitUapsd:
687 case eSmeCommandEnterWowl:
688 case eSmeCommandExitWowl:
689 csrLLUnlock( &pMac->sme.smeCmdActiveList );
690 fContinue = pmcProcessCommand( pMac, pCommand );
691 if( fContinue )
692 {
693 //The command failed, remove it
694 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
695 &pCommand->Link, LL_ACCESS_LOCK ) )
696 {
697 pmcReleaseCommand( pMac, pCommand );
698 }
699 }
700 break;
701
702 //Treat standby differently here because caller may not be able to handle
703 //the failure so we do our best here
704 case eSmeCommandEnterStandby:
705 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
706 {
707 //It can continue
708 csrLLUnlock( &pMac->sme.smeCmdActiveList );
709 fContinue = pmcProcessCommand( pMac, pCommand );
710 if( fContinue )
711 {
712 //The command failed, remove it
713 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
714 &pCommand->Link, LL_ACCESS_LOCK ) )
715 {
716 pmcReleaseCommand( pMac, pCommand );
717 }
718 }
719 }
720 else
721 {
722 //Need to issue a disconnect first before processing this command
723 tSmeCmd *pNewCmd;
724
725 //We need to re-run the command
726 fContinue = eANI_BOOLEAN_TRUE;
727 //Pull off the standby command first
728 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
729 &pCommand->Link, LL_ACCESS_NOLOCK ) )
730 {
731 csrLLUnlock( &pMac->sme.smeCmdActiveList );
732 //Need to call CSR function here because the disconnect command
733 //is handled by CSR
734 pNewCmd = csrGetCommandBuffer( pMac );
735 if( NULL != pNewCmd )
736 {
737 //Put the standby command to the head of the pending list first
738 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
739 LL_ACCESS_LOCK );
740 pNewCmd->command = eSmeCommandRoam;
741 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
742 //Put the disassoc command before the standby command
743 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
744 LL_ACCESS_LOCK );
745 }
746 else
747 {
748 //Continue the command here
749 fContinue = pmcProcessCommand( pMac, pCommand );
750 if( fContinue )
751 {
752 //The command failed, remove it
753 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
754 &pCommand->Link, LL_ACCESS_LOCK ) )
755 {
756 pmcReleaseCommand( pMac, pCommand );
757 }
758 }
759 }
760 }
761 else
762 {
763 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800764 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 VOS_ASSERT(0);
766 }
767 }
768 break;
769
770 case eSmeCommandAddTs:
771 case eSmeCommandDelTs:
772 csrLLUnlock( &pMac->sme.smeCmdActiveList );
773#ifndef WLAN_MDM_CODE_REDUCTION_OPT
774 fContinue = qosProcessCommand( pMac, pCommand );
775 if( fContinue )
776 {
777 //The command failed, remove it
778 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
779 &pCommand->Link, LL_ACCESS_NOLOCK ) )
780 {
781//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
782 qosReleaseCommand( pMac, pCommand );
783//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
784 }
785 }
786#endif
787 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800788#ifdef FEATURE_WLAN_TDLS
789 case eSmeCommandTdlsSendMgmt:
790 case eSmeCommandTdlsAddPeer:
791 case eSmeCommandTdlsDelPeer:
792#ifdef FEATURE_WLAN_TDLS_INTERNAL
793 case eSmeCommandTdlsDiscovery:
794 case eSmeCommandTdlsLinkSetup:
795 case eSmeCommandTdlsLinkTear:
796 case eSmeCommandTdlsEnterUapsd:
797 case eSmeCommandTdlsExitUapsd:
798#endif
799 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800800 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800801 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800802
803 csrLLUnlock( &pMac->sme.smeCmdActiveList );
804 status = csrTdlsProcessCmd( pMac, pCommand );
805 }
806 break ;
807#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700808
809 default:
810 //something is wrong
811 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800812 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
814 csrLLUnlock( &pMac->sme.smeCmdActiveList );
815 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
816 smeReleaseCommand( pMac, pCommand );
817 status = eHAL_STATUS_FAILURE;
818 break;
819 }
820 if(!HAL_STATUS_SUCCESS(status))
821 {
822 fContinue = eANI_BOOLEAN_TRUE;
823 }
824 }//if(pEntry)
825 else
826 {
827 //This is odd. Some one else pull off the command.
828 csrLLUnlock( &pMac->sme.smeCmdActiveList );
829 }
830 }
831 else
832 {
833 csrLLUnlock( &pMac->sme.smeCmdActiveList );
834 }
835 }
836 else
837 {
838 //No command waiting
839 csrLLUnlock( &pMac->sme.smeCmdActiveList );
840 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
841 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
842 {
843 tANI_U32 nTime = 0;
844
845 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
846 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
847 {
848 csrScanStartIdleScanTimer(pMac, nTime);
849 }
850 }
851 }
852 }
853 else {
854 csrLLUnlock( &pMac->sme.smeCmdActiveList );
855 }
856
857 return ( fContinue );
858}
859
860void smeProcessPendingQueue( tpAniSirGlobal pMac )
861{
862 while( smeProcessCommand( pMac ) );
863}
864
865
866tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
867{
868 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
869 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
870}
871
872
873
874//Global APIs
875
876/*--------------------------------------------------------------------------
877
878 \brief sme_Open() - Initialze all SME modules and put them at idle state
879
880 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
881 successfully return, all modules are at idle state ready to start.
882
883 smeOpen must be called before any other SME APIs can be involved.
884 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -0800885 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 \param hHal - The handle returned by macOpen.
887
888 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
889
890 Other status means SME is failed to be initialized
891 \sa
892
893 --------------------------------------------------------------------------*/
894eHalStatus sme_Open(tHalHandle hHal)
895{
896 eHalStatus status = eHAL_STATUS_FAILURE;
897 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
898
899 do {
900 pMac->sme.state = SME_STATE_STOP;
901 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
902 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800903 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 status = eHAL_STATUS_FAILURE;
905 break;
906 }
907
908 status = ccmOpen(hHal);
909 if ( ! HAL_STATUS_SUCCESS( status ) ) {
910 smsLog( pMac, LOGE,
911 "ccmOpen failed during initialization with status=%d", status );
912 break;
913 }
914
915 status = csrOpen(pMac);
916 if ( ! HAL_STATUS_SUCCESS( status ) ) {
917 smsLog( pMac, LOGE,
918 "csrOpen failed during initialization with status=%d", status );
919 break;
920 }
921
922 status = pmcOpen(hHal);
923 if ( ! HAL_STATUS_SUCCESS( status ) ) {
924 smsLog( pMac, LOGE,
925 "pmcOpen failed during initialization with status=%d", status );
926 break;
927 }
928
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700929#ifdef FEATURE_WLAN_TDLS
930 pMac->isTdlsPowerSaveProhibited = 0;
931#endif
932
Jeff Johnson295189b2012-06-20 16:38:30 -0700933#ifndef WLAN_MDM_CODE_REDUCTION_OPT
934 status = sme_QosOpen(pMac);
935 if ( ! HAL_STATUS_SUCCESS( status ) ) {
936 smsLog( pMac, LOGE,
937 "Qos open failed during initialization with status=%d", status );
938 break;
939 }
940
941 status = btcOpen(pMac);
942 if ( ! HAL_STATUS_SUCCESS( status ) ) {
943 smsLog( pMac, LOGE,
944 "btcOpen open failed during initialization with status=%d", status );
945 break;
946 }
947#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700948#ifdef FEATURE_OEM_DATA_SUPPORT
949 status = oemData_OemDataReqOpen(pMac);
950 if ( ! HAL_STATUS_SUCCESS( status ) ) {
951 smsLog(pMac, LOGE,
952 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
953 break;
954 }
955#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700956
957 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
958 break;
959
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 {
961 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
962 if ( NULL == pvosGCtx ){
963 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
964 status = eHAL_STATUS_FAILURE;
965 break;
966 }
967
968 status = WLANSAP_Open( pvosGCtx );
969 if ( ! HAL_STATUS_SUCCESS( status ) ) {
970 smsLog( pMac, LOGE,
971 "WLANSAP_Open open failed during initialization with status=%d", status );
972 break;
973 }
974 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700975#if defined WLAN_FEATURE_VOWIFI
976 status = rrmOpen(pMac);
977 if ( ! HAL_STATUS_SUCCESS( status ) ) {
978 smsLog( pMac, LOGE,
979 "rrmOpen open failed during initialization with status=%d", status );
980 break;
981 }
982#endif
983
984#if defined WLAN_FEATURE_VOWIFI_11R
985 sme_FTOpen(pMac);
986#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700988
989 }while (0);
990
991 return status;
992}
993
Jeff Johnson295189b2012-06-20 16:38:30 -0700994/*--------------------------------------------------------------------------
995
996 \brief sme_set11dinfo() - Set the 11d information about valid channels
997 and there power using information from nvRAM
998 This function is called only for AP.
999
Srinivas Girigowdade697412013-02-14 16:31:48 -08001000 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001001
1002 \param hHal - The handle returned by macOpen.
1003 \Param pSmeConfigParams - a pointer to a caller allocated object of
1004 typedef struct _smeConfigParams.
1005
1006 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1007
1008 Other status means SME is failed to update the config parameters.
1009 \sa
1010--------------------------------------------------------------------------*/
1011
1012eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1013{
1014 eHalStatus status = eHAL_STATUS_FAILURE;
1015 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1016
1017 if (NULL == pSmeConfigParams ) {
1018 smsLog( pMac, LOGE,
1019 "Empty config param structure for SME, nothing to update");
1020 return status;
1021 }
1022
1023 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1024 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001025 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 status );
1027 }
1028 return status;
1029}
1030
1031/*--------------------------------------------------------------------------
1032
1033 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1034
Srinivas Girigowdade697412013-02-14 16:31:48 -08001035 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001036
1037 \param hHal - The handle returned by HostapdAdapter.
1038 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1039
1040 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1041
1042 Other status means, failed to get the current regulatory domain.
1043 \sa
1044--------------------------------------------------------------------------*/
1045
1046eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1047{
1048 eHalStatus status = eHAL_STATUS_FAILURE;
1049 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1050
1051 if (NULL == domainIdSoftAp ) {
1052 smsLog( pMac, LOGE, "Uninitialized domain Id");
1053 return status;
1054 }
1055
1056 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1057 status = eHAL_STATUS_SUCCESS;
1058
1059 return status;
1060}
1061
1062
1063eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1064{
1065 eHalStatus status = eHAL_STATUS_FAILURE;
1066 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1067
1068 if (NULL == apCntryCode ) {
1069 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1070 return status;
1071 }
1072
1073 status = csrSetRegInfo(hHal, apCntryCode );
1074 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001075 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001076 status );
1077 }
1078 return status;
1079}
1080
Jeff Johnson295189b2012-06-20 16:38:30 -07001081#ifdef FEATURE_WLAN_SCAN_PNO
1082/*--------------------------------------------------------------------------
1083
1084 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1085
1086 It is used at driver start up to inform RIVA of the default channel
1087 configuration.
1088
Srinivas Girigowdade697412013-02-14 16:31:48 -08001089 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001090
1091 \param hHal - The handle returned by macOpen.
1092
1093 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1094
1095 Other status means SME is failed to update the channel config.
1096 \sa
1097
1098 --------------------------------------------------------------------------*/
1099eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1100{
1101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1102
1103 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1104 &pMac->scan.base20MHzChannels, FALSE);
1105 return eHAL_STATUS_SUCCESS;
1106}
1107#endif // FEATURE_WLAN_SCAN_PNLO
1108
1109/*--------------------------------------------------------------------------
1110
1111 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1112
1113 The function updates some configuration for modules in SME, CCM, CSR, etc
1114 during SMEs close open sequence.
1115
1116 Modules inside SME apply the new configuration at the next transaction.
1117
Srinivas Girigowdade697412013-02-14 16:31:48 -08001118 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001119
1120 \param hHal - The handle returned by macOpen.
1121 \Param pSmeConfigParams - a pointer to a caller allocated object of
1122 typedef struct _smeConfigParams.
1123
1124 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1125
1126 Other status means SME is failed to update the config parameters.
1127 \sa
1128
1129 --------------------------------------------------------------------------*/
1130eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1131{
1132 eHalStatus status = eHAL_STATUS_FAILURE;
1133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1134
1135 if (NULL == pSmeConfigParams ) {
1136 smsLog( pMac, LOGE,
1137 "Empty config param structure for SME, nothing to update");
1138 return status;
1139 }
1140
1141 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1142
1143 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001144 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 status );
1146 }
1147#if defined WLAN_FEATURE_P2P_INTERNAL
1148 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1149
1150 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001151 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001152 status );
1153 }
1154#endif
1155#if defined WLAN_FEATURE_VOWIFI
1156 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1157
1158 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001159 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 status );
1161 }
1162#endif
1163 //For SOC, CFG is set before start
1164 //We don't want to apply global CFG in connect state because that may cause some side affect
1165 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001166 csrIsAllSessionDisconnected( pMac) )
1167 {
1168 csrSetGlobalCfgs(pMac);
1169 }
1170
1171 return status;
1172}
1173
1174/* ---------------------------------------------------------------------------
1175 \fn sme_ChangeConfigParams
1176 \brief The SME API exposed for HDD to provide config params to SME during
1177 SMEs stop -> start sequence.
1178
1179 If HDD changed the domain that will cause a reset. This function will
1180 provide the new set of 11d information for the new domain. Currrently this
1181 API provides info regarding 11d only at reset but we can extend this for
1182 other params (PMC, QoS) which needs to be initialized again at reset.
1183
Srinivas Girigowdade697412013-02-14 16:31:48 -08001184 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001185
1186 \param hHal - The handle returned by macOpen.
1187
1188 \Param
1189 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1190 currently provides 11d related information like Country code,
1191 Regulatory domain, valid channel list, Tx power per channel, a
1192 list with active/passive scan allowed per valid channel.
1193
1194 \return eHalStatus
1195 ---------------------------------------------------------------------------*/
1196eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1197 tCsrUpdateConfigParam *pUpdateConfigParam)
1198{
1199 eHalStatus status = eHAL_STATUS_FAILURE;
1200 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1201
1202 if (NULL == pUpdateConfigParam ) {
1203 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001204 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 return status;
1206 }
1207
1208 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1209
1210 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001211 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 status );
1213 }
1214
1215 return status;
1216
1217}
1218
1219/*--------------------------------------------------------------------------
1220
1221 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1222 that the NIC is ready tio run.
1223
1224 The function is called by HDD at the end of initialization stage so PE/HAL can
1225 enable the NIC to running state.
1226
Srinivas Girigowdade697412013-02-14 16:31:48 -08001227 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 \param hHal - The handle returned by macOpen.
1229
1230 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1231 successfully.
1232
1233 Other status means SME failed to send the message to PE.
1234 \sa
1235
1236 --------------------------------------------------------------------------*/
1237eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1238{
1239 tSirSmeReadyReq Msg;
1240 eHalStatus status = eHAL_STATUS_FAILURE;
1241 tPmcPowerState powerState;
1242 tPmcSwitchState hwWlanSwitchState;
1243 tPmcSwitchState swWlanSwitchState;
1244 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1245
1246 do
1247 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001248
1249 Msg.messageType = eWNI_SME_SYS_READY_IND;
1250 Msg.length = sizeof( tSirSmeReadyReq );
1251
1252 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1253 {
1254 status = eHAL_STATUS_SUCCESS;
1255 }
1256 else
1257 {
1258 smsLog( pMac, LOGE,
1259 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1260 break;
1261 }
1262
1263 status = pmcQueryPowerState( hHal, &powerState,
1264 &hwWlanSwitchState, &swWlanSwitchState );
1265 if ( ! HAL_STATUS_SUCCESS( status ) )
1266 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001267 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 status );
1269 break;
1270 }
1271
1272 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1273 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1274 {
1275 status = csrReady(pMac);
1276 if ( ! HAL_STATUS_SUCCESS( status ) )
1277 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001278 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 break;
1280 }
1281 status = pmcReady(hHal);
1282 if ( ! HAL_STATUS_SUCCESS( status ) )
1283 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001284 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 break;
1286 }
1287#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1288 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1289 {
1290 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001291 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 break;
1293 }
1294#endif
1295
1296#if defined WLAN_FEATURE_VOWIFI
1297 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1298 {
1299 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001300 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 break;
1302 }
1303#endif
1304 }
1305 pMac->sme.state = SME_STATE_READY;
1306 } while( 0 );
1307
1308 return status;
1309}
1310
1311/*--------------------------------------------------------------------------
1312
1313 \brief sme_Start() - Put all SME modules at ready state.
1314
1315 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1316 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001317 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 \param hHal - The handle returned by macOpen.
1319
1320 \return eHAL_STATUS_SUCCESS - SME is ready.
1321
1322 Other status means SME is failed to start
1323 \sa
1324
1325 --------------------------------------------------------------------------*/
1326eHalStatus sme_Start(tHalHandle hHal)
1327{
1328 eHalStatus status = eHAL_STATUS_FAILURE;
1329 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1330
1331 do
1332 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 status = csrStart(pMac);
1334 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001335 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 status );
1337 break;
1338 }
1339
1340 status = pmcStart(hHal);
1341 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001342 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 status );
1344 break;
1345 }
1346
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1348 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001349 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 status );
1351 break;
1352 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 pMac->sme.state = SME_STATE_START;
1354 }while (0);
1355
1356 return status;
1357}
1358
1359
1360#ifdef WLAN_FEATURE_PACKET_FILTERING
1361/******************************************************************************
1362*
1363* Name: sme_PCFilterMatchCountResponseHandler
1364*
1365* Description:
1366* Invoke Packet Coalescing Filter Match Count callback routine
1367*
1368* Parameters:
1369* hHal - HAL handle for device
1370* pMsg - Pointer to tRcvFltPktMatchRsp structure
1371*
1372* Returns: eHalStatus
1373*
1374******************************************************************************/
1375eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1376{
1377 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1378 eHalStatus status = eHAL_STATUS_SUCCESS;
1379 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1380
1381 if (NULL == pMsg)
1382 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001383 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 status = eHAL_STATUS_FAILURE;
1385 }
1386 else
1387 {
1388 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001389 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001390
1391 /* Call Packet Coalescing Filter Match Count callback routine. */
1392 if (pMac->pmc.FilterMatchCountCB != NULL)
1393 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1394 pRcvFltPktMatchRsp);
1395
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001396 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 pRcvFltPktMatchRsp->status);
1398
1399 pMac->pmc.FilterMatchCountCB = NULL;
1400 pMac->pmc.FilterMatchCountCBContext = NULL;
1401 }
1402
1403 return(status);
1404}
1405#endif // WLAN_FEATURE_PACKET_FILTERING
1406
1407
Chet Lanctot186b5732013-03-18 10:26:30 -07001408#ifdef WLAN_FEATURE_11W
1409/*------------------------------------------------------------------
1410 *
1411 * Handle the unprotected management frame indication from LIM and
1412 * forward it to HDD.
1413 *
1414 *------------------------------------------------------------------*/
1415
1416eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1417 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1418{
1419 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1420 eHalStatus status = eHAL_STATUS_SUCCESS;
1421 tCsrRoamInfo pRoamInfo = {0};
1422 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1423
1424 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1425 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1426 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1427
1428 /* forward the mgmt frame to HDD */
1429 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1430
1431 return status;
1432}
1433#endif
1434
1435
Jeff Johnson295189b2012-06-20 16:38:30 -07001436/*--------------------------------------------------------------------------
1437
1438 \brief sme_ProcessMsg() - The main message processor for SME.
1439
1440 The function is called by a message dispatcher when to process a message
1441 targeted for SME.
1442
Srinivas Girigowdade697412013-02-14 16:31:48 -08001443 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 \param hHal - The handle returned by macOpen.
1445 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1446
1447 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1448
1449 Other status means SME failed to process the message to HAL.
1450 \sa
1451
1452 --------------------------------------------------------------------------*/
1453eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1454{
1455 eHalStatus status = eHAL_STATUS_FAILURE;
1456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1457
1458 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001459 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 return status;
1461 }
1462
1463 status = sme_AcquireGlobalLock( &pMac->sme );
1464 if ( HAL_STATUS_SUCCESS( status ) )
1465 {
1466 if( SME_IS_START(pMac) )
1467 {
1468 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1469 case eWNI_PMC_ENTER_BMPS_RSP:
1470 case eWNI_PMC_EXIT_BMPS_RSP:
1471 case eWNI_PMC_EXIT_BMPS_IND:
1472 case eWNI_PMC_ENTER_IMPS_RSP:
1473 case eWNI_PMC_EXIT_IMPS_RSP:
1474 case eWNI_PMC_SMPS_STATE_IND:
1475 case eWNI_PMC_ENTER_UAPSD_RSP:
1476 case eWNI_PMC_EXIT_UAPSD_RSP:
1477 case eWNI_PMC_ENTER_WOWL_RSP:
1478 case eWNI_PMC_EXIT_WOWL_RSP:
1479 //PMC
1480 if (pMsg->bodyptr)
1481 {
1482 pmcMessageProcessor(hHal, pMsg->bodyptr);
1483 status = eHAL_STATUS_SUCCESS;
1484 vos_mem_free( pMsg->bodyptr );
1485 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001486 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 }
1488 break;
1489
1490 case WNI_CFG_SET_CNF:
1491 case WNI_CFG_DNLD_CNF:
1492 case WNI_CFG_GET_RSP:
1493 case WNI_CFG_ADD_GRP_ADDR_CNF:
1494 case WNI_CFG_DEL_GRP_ADDR_CNF:
1495 //CCM
1496 if (pMsg->bodyptr)
1497 {
1498 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1499 status = eHAL_STATUS_SUCCESS;
1500 vos_mem_free( pMsg->bodyptr );
1501 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001502 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001503 }
1504 break;
1505
1506 case eWNI_SME_ADDTS_RSP:
1507 case eWNI_SME_DELTS_RSP:
1508 case eWNI_SME_DELTS_IND:
1509#ifdef WLAN_FEATURE_VOWIFI_11R
1510 case eWNI_SME_FT_AGGR_QOS_RSP:
1511#endif
1512 //QoS
1513 if (pMsg->bodyptr)
1514 {
1515#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1516 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1517 vos_mem_free( pMsg->bodyptr );
1518#endif
1519 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001520 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 }
1522 break;
1523#if defined WLAN_FEATURE_VOWIFI
1524 case eWNI_SME_NEIGHBOR_REPORT_IND:
1525 case eWNI_SME_BEACON_REPORT_REQ_IND:
1526#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001527 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001528#endif
1529 if ( pMsg->bodyptr )
1530 {
1531 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
1532 vos_mem_free( pMsg->bodyptr );
1533 }
1534 else
1535 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001536 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 }
1538 break;
1539#endif
1540
Jeff Johnsone7245742012-09-05 17:12:55 -07001541#ifdef FEATURE_OEM_DATA_SUPPORT
1542 //Handle the eWNI_SME_OEM_DATA_RSP:
1543 case eWNI_SME_OEM_DATA_RSP:
1544 if(pMsg->bodyptr)
1545 {
1546 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1547 vos_mem_free(pMsg->bodyptr);
1548 }
1549 else
1550 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001551 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001552 }
1553 smeProcessPendingQueue( pMac );
1554 break;
1555#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001556
1557 case eWNI_SME_ADD_STA_SELF_RSP:
1558 if(pMsg->bodyptr)
1559 {
1560 status = csrProcessAddStaSessionRsp(pMac, 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 rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 }
1567 break;
1568 case eWNI_SME_DEL_STA_SELF_RSP:
1569 if(pMsg->bodyptr)
1570 {
1571 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1572 vos_mem_free(pMsg->bodyptr);
1573 }
1574 else
1575 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001576 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 }
1578 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001579 case eWNI_SME_REMAIN_ON_CHN_RSP:
1580 if(pMsg->bodyptr)
1581 {
1582 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1583 vos_mem_free(pMsg->bodyptr);
1584 }
1585 else
1586 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001587 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 }
1589 break;
1590 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1591 if(pMsg->bodyptr)
1592 {
1593 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1594 vos_mem_free(pMsg->bodyptr);
1595 }
1596 else
1597 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001598 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 -07001599 }
1600 break;
1601 case eWNI_SME_MGMT_FRM_IND:
1602 if(pMsg->bodyptr)
1603 {
1604 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1605 vos_mem_free(pMsg->bodyptr);
1606 }
1607 else
1608 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001609 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001610 }
1611 break;
1612 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1613 if(pMsg->bodyptr)
1614 {
1615 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1616 vos_mem_free(pMsg->bodyptr);
1617 }
1618 else
1619 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001620 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 }
1622 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 case eWNI_SME_COEX_IND:
1624 if(pMsg->bodyptr)
1625 {
1626 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1627 vos_mem_free(pMsg->bodyptr);
1628 }
1629 else
1630 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001631 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 }
1633 break;
1634
1635#ifdef FEATURE_WLAN_SCAN_PNO
1636 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1637 if(pMsg->bodyptr)
1638 {
1639 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1640 vos_mem_free(pMsg->bodyptr);
1641 }
1642 else
1643 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001644 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 }
1646 break;
1647#endif // FEATURE_WLAN_SCAN_PNO
1648
1649 case eWNI_SME_TX_PER_HIT_IND:
1650 if (pMac->sme.pTxPerHitCallback)
1651 {
1652 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1653 }
1654 break;
1655
1656 case eWNI_SME_CHANGE_COUNTRY_CODE:
1657 if(pMsg->bodyptr)
1658 {
1659 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1660 vos_mem_free(pMsg->bodyptr);
1661 }
1662 else
1663 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001664 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 }
1666 break;
1667
1668#ifdef WLAN_FEATURE_PACKET_FILTERING
1669 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1670 if(pMsg->bodyptr)
1671 {
1672 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1673 vos_mem_free(pMsg->bodyptr);
1674 }
1675 else
1676 {
1677 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001678 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 }
1680 break;
1681#endif // WLAN_FEATURE_PACKET_FILTERING
1682 case eWNI_SME_PRE_SWITCH_CHL_IND:
1683 {
1684 status = sme_HandlePreChannelSwitchInd(pMac);
1685 break;
1686 }
1687
1688 case eWNI_SME_POST_SWITCH_CHL_IND:
1689 {
1690 status = sme_HandlePostChannelSwitchInd(pMac);
1691 break;
1692 }
1693
1694#ifdef WLAN_WAKEUP_EVENTS
1695 case eWNI_SME_WAKE_REASON_IND:
1696 if(pMsg->bodyptr)
1697 {
1698 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1699 vos_mem_free(pMsg->bodyptr);
1700 }
1701 else
1702 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001703 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 }
1705 break;
1706#endif // WLAN_WAKEUP_EVENTS
1707
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001708#ifdef FEATURE_WLAN_TDLS
1709 /*
1710 * command rescived from PE, SME tdls msg processor shall be called
1711 * to process commands recieved from PE
1712 */
1713 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1714 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001715 case eWNI_SME_TDLS_DEL_STA_RSP:
1716 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001717 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001718 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001719#ifdef FEATURE_WLAN_TDLS_INTERNAL
1720 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1721 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1722 case eWNI_SME_TDLS_LINK_START_RSP:
1723 case eWNI_SME_TDLS_LINK_START_IND:
1724 case eWNI_SME_TDLS_TEARDOWN_RSP:
1725 case eWNI_SME_TDLS_TEARDOWN_IND:
1726 case eWNI_SME_ADD_TDLS_PEER_IND:
1727 case eWNI_SME_DELETE_TDLS_PEER_IND:
1728#endif
1729 {
1730 if (pMsg->bodyptr)
1731 {
1732 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1733 vos_mem_free( pMsg->bodyptr );
1734 }
1735 else
1736 {
1737 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001738 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001739 }
1740 break;
1741 }
1742#endif
1743
Chet Lanctot186b5732013-03-18 10:26:30 -07001744#ifdef WLAN_FEATURE_11W
1745 case eWNI_SME_UNPROT_MGMT_FRM_IND:
1746 if (pMsg->bodyptr)
1747 {
1748 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
1749 vos_mem_free(pMsg->bodyptr);
1750 }
1751 else
1752 {
1753 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
1754 }
1755 break;
1756#endif
1757
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 default:
1759
1760 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
1761 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
1762 {
1763 //CSR
1764 if (pMsg->bodyptr)
1765 {
1766 status = csrMsgProcessor(hHal, pMsg->bodyptr);
1767 vos_mem_free( pMsg->bodyptr );
1768 }
1769 else
1770 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001771 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 }
1773 }
1774 else
1775 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001776 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 pMsg->type);
1778 if (pMsg->bodyptr)
1779 {
1780 vos_mem_free( pMsg->bodyptr );
1781 }
1782 }
1783 }//switch
1784 } //SME_IS_START
1785 else
1786 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001787 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001788 if (pMsg->bodyptr)
1789 {
1790 vos_mem_free( pMsg->bodyptr );
1791 }
1792 }
1793 sme_ReleaseGlobalLock( &pMac->sme );
1794 }
1795 else
1796 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001797 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 if (pMsg->bodyptr)
1799 {
1800 vos_mem_free( pMsg->bodyptr );
1801 }
1802 }
1803
1804 return status;
1805}
1806
1807
1808//No need to hold the global lock here because this function can only be called
1809//after sme_Stop.
1810v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
1811{
1812 if( pMsg )
1813 {
1814 if (pMsg->bodyptr)
1815 {
1816 vos_mem_free( pMsg->bodyptr );
1817 }
1818 }
1819
1820}
1821
1822
1823/*--------------------------------------------------------------------------
1824
1825 \brief sme_Stop() - Stop all SME modules and put them at idle state
1826
1827 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
1828 return, all modules are at idle state ready to start.
1829
Srinivas Girigowdade697412013-02-14 16:31:48 -08001830 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 \param hHal - The handle returned by macOpen
1832
1833 \return eHAL_STATUS_SUCCESS - SME is stopped.
1834
1835 Other status means SME is failed to stop but caller should still
1836 consider SME is stopped.
1837 \sa
1838
1839 --------------------------------------------------------------------------*/
1840eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
1841{
1842 eHalStatus status = eHAL_STATUS_FAILURE;
1843 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1845
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1847 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001848 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 status );
1850 fail_status = status;
1851 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001852
1853 p2pStop(hHal);
1854
1855 if(pmcFlag)
1856 {
1857 status = pmcStop(hHal);
1858 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001859 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001860 status );
1861 fail_status = status;
1862 }
1863 }
1864
1865 status = csrStop(pMac);
1866 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001867 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 status );
1869 fail_status = status;
1870 }
1871
1872 ccmStop(hHal);
1873
1874 purgeSmeCmdList(pMac);
1875
1876 if (!HAL_STATUS_SUCCESS( fail_status )) {
1877 status = fail_status;
1878 }
1879
1880 pMac->sme.state = SME_STATE_STOP;
1881
1882 return status;
1883}
1884
1885/*--------------------------------------------------------------------------
1886
1887 \brief sme_Close() - Release all SME modules and their resources.
1888
1889 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
1890 return, all modules are at closed state.
1891
1892 No SME APIs can be involved after smeClose except smeOpen.
1893 smeClose must be called before macClose.
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 successfully close.
1898
1899 Other status means SME is failed to be closed but caller still cannot
1900 call any other SME functions except smeOpen.
1901 \sa
1902
1903 --------------------------------------------------------------------------*/
1904eHalStatus sme_Close(tHalHandle hHal)
1905{
1906 eHalStatus status = eHAL_STATUS_FAILURE;
1907 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1908 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1909
1910 status = csrClose(pMac);
1911 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001912 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 status );
1914 fail_status = status;
1915 }
1916
Jeff Johnson295189b2012-06-20 16:38:30 -07001917 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1918 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001919 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 status );
1921 fail_status = status;
1922 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001923
1924#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1925 status = btcClose(hHal);
1926 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001927 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 status );
1929 fail_status = status;
1930 }
1931
1932 status = sme_QosClose(pMac);
1933 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001934 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 status );
1936 fail_status = status;
1937 }
1938#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001939#ifdef FEATURE_OEM_DATA_SUPPORT
1940 status = oemData_OemDataReqClose(hHal);
1941 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001942 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07001943 status );
1944 fail_status = status;
1945 }
1946#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001947
1948 status = ccmClose(hHal);
1949 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001950 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 status );
1952 fail_status = status;
1953 }
1954
1955 status = pmcClose(hHal);
1956 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001957 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 status );
1959 fail_status = status;
1960 }
1961#if defined WLAN_FEATURE_VOWIFI
1962 status = rrmClose(hHal);
1963 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001964 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001965 status );
1966 fail_status = status;
1967 }
1968#endif
1969
1970#if defined WLAN_FEATURE_VOWIFI_11R
1971 sme_FTClose(hHal);
1972#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07001974
1975 freeSmeCmdList(pMac);
1976
1977 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
1978 {
1979 fail_status = eHAL_STATUS_FAILURE;
1980 }
1981
1982 if (!HAL_STATUS_SUCCESS( fail_status )) {
1983 status = fail_status;
1984 }
1985
1986 pMac->sme.state = SME_STATE_STOP;
1987
1988 return status;
1989}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001990#ifdef FEATURE_WLAN_LFR
1991tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
1992{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07001993#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001994 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
1995 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
1996 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
1997 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
1998 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
1999 return eANI_BOOLEAN_FALSE;
2000 default:
2001 return eANI_BOOLEAN_TRUE;
2002 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002003#else
2004 /*
2005 * TODO: always return TRUE for now until
2006 * we figure out why we could be stuck in
2007 * one of the roaming states forever.
2008 */
2009 return eANI_BOOLEAN_TRUE;
2010#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002011}
2012#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002013/* ---------------------------------------------------------------------------
2014 \fn sme_ScanRequest
2015 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002016 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 \param pScanRequestID - pointer to an object to get back the request ID
2018 \param callback - a callback function that scan calls upon finish, will not
2019 be called if csrScanRequest returns error
2020 \param pContext - a pointer passed in for the callback
2021 \return eHalStatus
2022 ---------------------------------------------------------------------------*/
2023eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2024 tANI_U32 *pScanRequestID,
2025 csrScanCompleteCallback callback, void *pContext)
2026{
2027 eHalStatus status = eHAL_STATUS_FAILURE;
2028 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2029
2030 smsLog(pMac, LOG2, FL("enter"));
2031 do
2032 {
2033 if(pMac->scan.fScanEnable)
2034 {
2035 status = sme_AcquireGlobalLock( &pMac->sme );
2036 if ( HAL_STATUS_SUCCESS( status ) )
2037 {
2038 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002039#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002040 if(csrIsScanAllowed(pMac))
2041 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002042#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002043 status = csrScanRequest( hHal, sessionId, pscanReq,
2044 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002045#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002046 }
2047 else
2048 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002049 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2050 pMac->roam.neighborRoamInfo.neighborRoamState,
2051 pMac->roam.curSubState[sessionId]);
2052 /*HandOff is in progress. So schedule this scan later*/
2053 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002054 }
2055#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 }
2057
2058 sme_ReleaseGlobalLock( &pMac->sme );
2059 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002060 else
2061 {
2062 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2063 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002065 else
2066 {
2067 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2068 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 } while( 0 );
2070
2071 return (status);
2072
2073
2074}
2075
2076/* ---------------------------------------------------------------------------
2077 \fn sme_ScanGetResult
2078 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002079 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 \param pFilter - If pFilter is NULL, all cached results are returned
2081 \param phResult - an object for the result.
2082 \return eHalStatus
2083 ---------------------------------------------------------------------------*/
2084eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2085 tScanResultHandle *phResult)
2086{
2087 eHalStatus status = eHAL_STATUS_FAILURE;
2088 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2089
2090 smsLog(pMac, LOG2, FL("enter"));
2091 status = sme_AcquireGlobalLock( &pMac->sme );
2092 if ( HAL_STATUS_SUCCESS( status ) )
2093 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002094 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 sme_ReleaseGlobalLock( &pMac->sme );
2096 }
2097 smsLog(pMac, LOG2, FL("exit status %d"), status);
2098
2099 return (status);
2100}
2101
2102
2103/* ---------------------------------------------------------------------------
2104 \fn sme_ScanFlushResult
2105 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002106 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 \return eHalStatus
2108 ---------------------------------------------------------------------------*/
2109eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2110{
2111 eHalStatus status = eHAL_STATUS_FAILURE;
2112 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2113
2114 status = sme_AcquireGlobalLock( &pMac->sme );
2115 if ( HAL_STATUS_SUCCESS( status ) )
2116 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002117 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 sme_ReleaseGlobalLock( &pMac->sme );
2119 }
2120
2121 return (status);
2122}
2123
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002124eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2125{
2126 eHalStatus status = eHAL_STATUS_FAILURE;
2127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2128
2129 status = sme_AcquireGlobalLock( &pMac->sme );
2130 if ( HAL_STATUS_SUCCESS( status ) )
2131 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302132 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002133 sme_ReleaseGlobalLock( &pMac->sme );
2134 }
2135
2136 return (status);
2137}
Jeff Johnson295189b2012-06-20 16:38:30 -07002138
2139/* ---------------------------------------------------------------------------
2140 \fn sme_ScanResultGetFirst
2141 \brief a wrapper function to request CSR to returns the first element of
2142 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002143 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 \param hScanResult - returned from csrScanGetResult
2145 \return tCsrScanResultInfo * - NULL if no result
2146 ---------------------------------------------------------------------------*/
2147tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2148 tScanResultHandle hScanResult)
2149{
2150 eHalStatus status = eHAL_STATUS_FAILURE;
2151 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2152 tCsrScanResultInfo *pRet = NULL;
2153
2154 status = sme_AcquireGlobalLock( &pMac->sme );
2155 if ( HAL_STATUS_SUCCESS( status ) )
2156 {
2157 pRet = csrScanResultGetFirst( pMac, hScanResult );
2158 sme_ReleaseGlobalLock( &pMac->sme );
2159 }
2160
2161 return (pRet);
2162}
2163
2164
2165/* ---------------------------------------------------------------------------
2166 \fn sme_ScanResultGetNext
2167 \brief a wrapper function to request CSR to returns the next element of
2168 scan result. It can be called without calling csrScanResultGetFirst
2169 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002170 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 \param hScanResult - returned from csrScanGetResult
2172 \return Null if no result or reach the end
2173 ---------------------------------------------------------------------------*/
2174tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2175 tScanResultHandle hScanResult)
2176{
2177 eHalStatus status = eHAL_STATUS_FAILURE;
2178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2179 tCsrScanResultInfo *pRet = NULL;
2180
2181 status = sme_AcquireGlobalLock( &pMac->sme );
2182 if ( HAL_STATUS_SUCCESS( status ) )
2183 {
2184 pRet = csrScanResultGetNext( pMac, hScanResult );
2185 sme_ReleaseGlobalLock( &pMac->sme );
2186 }
2187
2188 return (pRet);
2189}
2190
2191
2192/* ---------------------------------------------------------------------------
2193 \fn sme_ScanSetBGScanparams
2194 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002195 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 \param pScanReq - BG scan request structure
2197 \return eHalStatus
2198 ---------------------------------------------------------------------------*/
2199eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2200{
2201 eHalStatus status = eHAL_STATUS_FAILURE;
2202 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2203
2204 if( NULL != pScanReq )
2205 {
2206 status = sme_AcquireGlobalLock( &pMac->sme );
2207 if ( HAL_STATUS_SUCCESS( status ) )
2208 {
2209 status = csrScanSetBGScanparams( hHal, pScanReq );
2210 sme_ReleaseGlobalLock( &pMac->sme );
2211 }
2212 }
2213
2214 return (status);
2215}
2216
2217
2218/* ---------------------------------------------------------------------------
2219 \fn sme_ScanResultPurge
2220 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2221 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002222 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 \param hScanResult - returned from csrScanGetResult. hScanResult is
2224 considered gone by
2225 calling this function and even before this function reutrns.
2226 \return eHalStatus
2227 ---------------------------------------------------------------------------*/
2228eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2229{
2230 eHalStatus status = eHAL_STATUS_FAILURE;
2231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2232
2233 status = sme_AcquireGlobalLock( &pMac->sme );
2234 if ( HAL_STATUS_SUCCESS( status ) )
2235 {
2236 status = csrScanResultPurge( hHal, hScanResult );
2237 sme_ReleaseGlobalLock( &pMac->sme );
2238 }
2239
2240 return (status);
2241}
2242
2243/* ---------------------------------------------------------------------------
2244 \fn sme_ScanGetPMKIDCandidateList
2245 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002246 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 \param pPmkidList - caller allocated buffer point to an array of
2248 tPmkidCandidateInfo
2249 \param pNumItems - pointer to a variable that has the number of
2250 tPmkidCandidateInfo allocated when retruning, this is
2251 either the number needed or number of items put into
2252 pPmkidList
2253 \return eHalStatus - when fail, it usually means the buffer allocated is not
2254 big enough and pNumItems
2255 has the number of tPmkidCandidateInfo.
2256 \Note: pNumItems is a number of tPmkidCandidateInfo,
2257 not sizeof(tPmkidCandidateInfo) * something
2258 ---------------------------------------------------------------------------*/
2259eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2260 tPmkidCandidateInfo *pPmkidList,
2261 tANI_U32 *pNumItems )
2262{
2263 eHalStatus status = eHAL_STATUS_FAILURE;
2264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2265
2266 status = sme_AcquireGlobalLock( &pMac->sme );
2267 if ( HAL_STATUS_SUCCESS( status ) )
2268 {
2269 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2270 sme_ReleaseGlobalLock( &pMac->sme );
2271 }
2272
2273 return (status);
2274}
2275
2276/*----------------------------------------------------------------------------
2277 \fn sme_RoamRegisterLinkQualityIndCallback
2278
2279 \brief
2280 a wrapper function to allow HDD to register a callback handler with CSR for
2281 link quality indications.
2282
2283 Only one callback may be registered at any time.
2284 In order to deregister the callback, a NULL cback may be provided.
2285
2286 Registration happens in the task context of the caller.
2287
2288 \param callback - Call back being registered
2289 \param pContext - user data
2290
2291 DEPENDENCIES: After CSR open
2292
2293 \return eHalStatus
2294-----------------------------------------------------------------------------*/
2295eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2296 csrRoamLinkQualityIndCallback callback,
2297 void *pContext)
2298{
2299 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2300}
2301
2302/* ---------------------------------------------------------------------------
2303 \fn sme_RoamRegisterCallback
2304 \brief a wrapper function to allow HDD to register a callback with CSR.
2305 Unlike scan, roam has one callback for all the roam requests
2306 \param callback - a callback function that roam calls upon when state changes
2307 \param pContext - a pointer passed in for the callback
2308 \return eHalStatus
2309 ---------------------------------------------------------------------------*/
2310eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2311 csrRoamCompleteCallback callback,
2312 void *pContext)
2313{
2314 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2315}
2316
2317eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2318{
2319 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2320 return pMac->roam.configParam.phyMode;
2321}
2322
2323/* ---------------------------------------------------------------------------
2324 \fn sme_RoamConnect
2325 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002326 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 \param sessionId - the sessionId returned by sme_OpenSession.
2328 \param pProfile - description of the network to which to connect
2329 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2330 from csrScanGetResult
2331 \param pRoamId - to get back the request ID
2332 \return eHalStatus
2333 ---------------------------------------------------------------------------*/
2334eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2335 tANI_U32 *pRoamId)
2336{
2337 eHalStatus status = eHAL_STATUS_FAILURE;
2338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2339
2340 smsLog(pMac, LOG2, FL("enter"));
2341 status = sme_AcquireGlobalLock( &pMac->sme );
2342 if ( HAL_STATUS_SUCCESS( status ) )
2343 {
2344 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2345 {
2346 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2347 }
2348 else
2349 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002350 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 status = eHAL_STATUS_INVALID_PARAMETER;
2352 }
2353 sme_ReleaseGlobalLock( &pMac->sme );
2354 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002355 else
2356 {
2357 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002359
2360 return (status);
2361}
2362
2363/* ---------------------------------------------------------------------------
2364 \fn sme_RoamReassoc
2365 \brief a wrapper function to request CSR to inititiate a re-association
2366 \param pProfile - can be NULL to join the currently connected AP. In that
2367 case modProfileFields should carry the modified field(s) which could trigger
2368 reassoc
2369 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2370 that might need modification dynamically once STA is up & running and this
2371 could trigger a reassoc
2372 \param pRoamId - to get back the request ID
2373 \return eHalStatus
2374 -------------------------------------------------------------------------------*/
2375eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2376 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002377 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002378{
2379 eHalStatus status = eHAL_STATUS_FAILURE;
2380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2381
2382 smsLog(pMac, LOG2, FL("enter"));
2383 status = sme_AcquireGlobalLock( &pMac->sme );
2384 if ( HAL_STATUS_SUCCESS( status ) )
2385 {
2386 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2387 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002388 if((NULL == pProfile) && (fForce == 1))
2389 {
2390 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2391 /* to force the AP initiate fresh 802.1x authentication need to clear
2392 * the PMKID cache for that set the following boolean. this is needed
2393 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2394 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002395 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2396 }
2397 else
2398 {
2399 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2400 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 }
2402 else
2403 {
2404 status = eHAL_STATUS_INVALID_PARAMETER;
2405 }
2406 sme_ReleaseGlobalLock( &pMac->sme );
2407 }
2408
2409 return (status);
2410}
2411
2412/* ---------------------------------------------------------------------------
2413 \fn sme_RoamConnectToLastProfile
2414 \brief a wrapper function to request CSR to disconnect and reconnect with
2415 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002416 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002417 \return eHalStatus. It returns fail if currently connected
2418 ---------------------------------------------------------------------------*/
2419eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2420{
2421 eHalStatus status = eHAL_STATUS_FAILURE;
2422 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2423
2424 status = sme_AcquireGlobalLock( &pMac->sme );
2425 if ( HAL_STATUS_SUCCESS( status ) )
2426 {
2427 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2428 {
2429 status = csrRoamConnectToLastProfile( pMac, sessionId );
2430 }
2431 else
2432 {
2433 status = eHAL_STATUS_INVALID_PARAMETER;
2434 }
2435 sme_ReleaseGlobalLock( &pMac->sme );
2436 }
2437
2438 return (status);
2439}
2440
2441/* ---------------------------------------------------------------------------
2442 \fn sme_RoamDisconnect
2443 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002444 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002445 \param reason -- To indicate the reason for disconnecting. Currently, only
2446 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2447 \return eHalStatus
2448 ---------------------------------------------------------------------------*/
2449eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2450{
2451 eHalStatus status = eHAL_STATUS_FAILURE;
2452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2453
2454 smsLog(pMac, LOG2, FL("enter"));
2455 status = sme_AcquireGlobalLock( &pMac->sme );
2456 if ( HAL_STATUS_SUCCESS( status ) )
2457 {
2458 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2459 {
2460 status = csrRoamDisconnect( pMac, sessionId, reason );
2461 }
2462 else
2463 {
2464 status = eHAL_STATUS_INVALID_PARAMETER;
2465 }
2466 sme_ReleaseGlobalLock( &pMac->sme );
2467 }
2468
2469 return (status);
2470}
2471
Jeff Johnson295189b2012-06-20 16:38:30 -07002472/* ---------------------------------------------------------------------------
2473 \fn sme_RoamStopBss
2474 \brief To stop BSS for Soft AP. This is an asynchronous API.
2475 \param hHal - Global structure
2476 \param sessionId - sessionId of SoftAP
2477 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2478 -------------------------------------------------------------------------------*/
2479eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2480{
2481 eHalStatus status = eHAL_STATUS_FAILURE;
2482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2483
2484 smsLog(pMac, LOG2, FL("enter"));
2485 status = sme_AcquireGlobalLock( &pMac->sme );
2486 if ( HAL_STATUS_SUCCESS( status ) )
2487 {
2488 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2489 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302490 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002491 }
2492 else
2493 {
2494 status = eHAL_STATUS_INVALID_PARAMETER;
2495 }
2496 sme_ReleaseGlobalLock( &pMac->sme );
2497 }
2498
2499 return (status);
2500}
2501
2502/* ---------------------------------------------------------------------------
2503 \fn sme_RoamDisconnectSta
2504 \brief To disassociate a station. This is an asynchronous API.
2505 \param hHal - Global structure
2506 \param sessionId - sessionId of SoftAP
2507 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2508 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2509 -------------------------------------------------------------------------------*/
2510eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2511 tANI_U8 *pPeerMacAddr)
2512{
2513 eHalStatus status = eHAL_STATUS_FAILURE;
2514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2515
2516 if ( NULL == pMac )
2517 {
2518 VOS_ASSERT(0);
2519 return status;
2520 }
2521
2522 status = sme_AcquireGlobalLock( &pMac->sme );
2523 if ( HAL_STATUS_SUCCESS( status ) )
2524 {
2525 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2526 {
2527 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302528 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 }
2530 else
2531 {
2532 status = eHAL_STATUS_INVALID_PARAMETER;
2533 }
2534 sme_ReleaseGlobalLock( &pMac->sme );
2535 }
2536
2537 return (status);
2538}
2539
2540/* ---------------------------------------------------------------------------
2541 \fn sme_RoamDeauthSta
2542 \brief To disassociate a station. This is an asynchronous API.
2543 \param hHal - Global structure
2544 \param sessionId - sessionId of SoftAP
2545 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2546 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2547 -------------------------------------------------------------------------------*/
2548eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2549 tANI_U8 *pPeerMacAddr)
2550{
2551 eHalStatus status = eHAL_STATUS_FAILURE;
2552 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2553
2554 if ( NULL == pMac )
2555 {
2556 VOS_ASSERT(0);
2557 return status;
2558 }
2559
2560 status = sme_AcquireGlobalLock( &pMac->sme );
2561 if ( HAL_STATUS_SUCCESS( status ) )
2562 {
2563 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2564 {
2565 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302566 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 }
2568 else
2569 {
2570 status = eHAL_STATUS_INVALID_PARAMETER;
2571 }
2572 sme_ReleaseGlobalLock( &pMac->sme );
2573 }
2574
2575 return (status);
2576}
2577
2578/* ---------------------------------------------------------------------------
2579 \fn sme_RoamTKIPCounterMeasures
2580 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2581 \param sessionId - sessionId of SoftAP
2582 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2583 \return eHalStatus
2584 -------------------------------------------------------------------------------*/
2585eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2586 tANI_BOOLEAN bEnable)
2587{
2588 eHalStatus status = eHAL_STATUS_FAILURE;
2589 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2590
2591 if ( NULL == pMac )
2592 {
2593 VOS_ASSERT(0);
2594 return status;
2595 }
2596
2597 status = sme_AcquireGlobalLock( &pMac->sme );
2598 if ( HAL_STATUS_SUCCESS( status ) )
2599 {
2600 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2601 {
2602 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2603 }
2604 else
2605 {
2606 status = eHAL_STATUS_INVALID_PARAMETER;
2607 }
2608 sme_ReleaseGlobalLock( &pMac->sme );
2609 }
2610
2611 return (status);
2612}
2613
2614/* ---------------------------------------------------------------------------
2615 \fn sme_RoamGetAssociatedStas
2616 \brief To probe the list of associated stations from various modules of CORE stack.
2617 \This is an asynchronous API.
2618 \param sessionId - sessionId of SoftAP
2619 \param modId - Module from whom list of associtated stations is to be probed.
2620 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2621 \param pUsrContext - Opaque HDD context
2622 \param pfnSapEventCallback - Sap event callback in HDD
2623 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2624 \return eHalStatus
2625 -------------------------------------------------------------------------------*/
2626eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2627 VOS_MODULE_ID modId, void *pUsrContext,
2628 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2629{
2630 eHalStatus status = eHAL_STATUS_FAILURE;
2631 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2632
2633 if ( NULL == pMac )
2634 {
2635 VOS_ASSERT(0);
2636 return status;
2637 }
2638
2639 status = sme_AcquireGlobalLock( &pMac->sme );
2640 if ( HAL_STATUS_SUCCESS( status ) )
2641 {
2642 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2643 {
2644 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2645 }
2646 else
2647 {
2648 status = eHAL_STATUS_INVALID_PARAMETER;
2649 }
2650 sme_ReleaseGlobalLock( &pMac->sme );
2651 }
2652
2653 return (status);
2654}
2655
2656/* ---------------------------------------------------------------------------
2657 \fn sme_RoamGetWpsSessionOverlap
2658 \brief To get the WPS PBC session overlap information.
2659 \This is an asynchronous API.
2660 \param sessionId - sessionId of SoftAP
2661 \param pUsrContext - Opaque HDD context
2662 \param pfnSapEventCallback - Sap event callback in HDD
2663 \pRemoveMac - pointer to Mac address which needs to be removed from session
2664 \return eHalStatus
2665 -------------------------------------------------------------------------------*/
2666eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
2667 void *pUsrContext, void
2668 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
2669{
2670 eHalStatus status = eHAL_STATUS_FAILURE;
2671 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2672
2673 if ( NULL == pMac )
2674 {
2675 VOS_ASSERT(0);
2676 return status;
2677 }
2678
2679 status = sme_AcquireGlobalLock( &pMac->sme );
2680 if ( HAL_STATUS_SUCCESS( status ) )
2681 {
2682 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2683 {
2684 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
2685 }
2686 else
2687 {
2688 status = eHAL_STATUS_INVALID_PARAMETER;
2689 }
2690 sme_ReleaseGlobalLock( &pMac->sme );
2691 }
2692
2693 return (status);
2694}
2695
Jeff Johnson295189b2012-06-20 16:38:30 -07002696
2697/* ---------------------------------------------------------------------------
2698 \fn sme_RoamGetConnectState
2699 \brief a wrapper function to request CSR to return the current connect state
2700 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08002701 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 \return eHalStatus
2703 ---------------------------------------------------------------------------*/
2704eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
2705{
2706 eHalStatus status = eHAL_STATUS_FAILURE;
2707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2708
2709 status = sme_AcquireGlobalLock( &pMac->sme );
2710 if ( HAL_STATUS_SUCCESS( status ) )
2711 {
2712 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2713 {
2714 status = csrRoamGetConnectState( pMac, sessionId, pState );
2715 }
2716 else
2717 {
2718 status = eHAL_STATUS_INVALID_PARAMETER;
2719 }
2720 sme_ReleaseGlobalLock( &pMac->sme );
2721 }
2722
2723 return (status);
2724}
2725
2726/* ---------------------------------------------------------------------------
2727 \fn sme_RoamGetConnectProfile
2728 \brief a wrapper function to request CSR to return the current connect
2729 profile. Caller must call csrRoamFreeConnectProfile after it is done
2730 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002731 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002732 \param pProfile - pointer to a caller allocated structure
2733 tCsrRoamConnectedProfile
2734 \return eHalStatus. Failure if not connected
2735 ---------------------------------------------------------------------------*/
2736eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
2737 tCsrRoamConnectedProfile *pProfile)
2738{
2739 eHalStatus status = eHAL_STATUS_FAILURE;
2740 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2741
2742 status = sme_AcquireGlobalLock( &pMac->sme );
2743 if ( HAL_STATUS_SUCCESS( status ) )
2744 {
2745 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2746 {
2747 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
2748 }
2749 else
2750 {
2751 status = eHAL_STATUS_INVALID_PARAMETER;
2752 }
2753 sme_ReleaseGlobalLock( &pMac->sme );
2754 }
2755
2756 return (status);
2757}
2758
2759/* ---------------------------------------------------------------------------
2760 \fn sme_RoamFreeConnectProfile
2761 \brief a wrapper function to request CSR to free and reinitialize the
2762 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002763 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 \param pProfile - pointer to a caller allocated structure
2765 tCsrRoamConnectedProfile
2766 \return eHalStatus.
2767 ---------------------------------------------------------------------------*/
2768eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
2769 tCsrRoamConnectedProfile *pProfile)
2770{
2771 eHalStatus status = eHAL_STATUS_FAILURE;
2772 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2773
2774 status = sme_AcquireGlobalLock( &pMac->sme );
2775 if ( HAL_STATUS_SUCCESS( status ) )
2776 {
2777 status = csrRoamFreeConnectProfile( pMac, pProfile );
2778 sme_ReleaseGlobalLock( &pMac->sme );
2779 }
2780
2781 return (status);
2782}
2783
2784/* ---------------------------------------------------------------------------
2785 \fn sme_RoamSetPMKIDCache
2786 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002787 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002788 \param pPMKIDCache - caller allocated buffer point to an array of
2789 tPmkidCacheInfo
2790 \param numItems - a variable that has the number of tPmkidCacheInfo
2791 allocated when retruning, this is either the number needed
2792 or number of items put into pPMKIDCache
2793 \return eHalStatus - when fail, it usually means the buffer allocated is not
2794 big enough and pNumItems has the number of
2795 tPmkidCacheInfo.
2796 \Note: pNumItems is a number of tPmkidCacheInfo,
2797 not sizeof(tPmkidCacheInfo) * something
2798 ---------------------------------------------------------------------------*/
2799eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
2800 tANI_U32 numItems )
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 = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
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_RoamGetSecurityReqIE
2824 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
2825 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08002826 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 \param pLen - caller allocated memory that has the length of pBuf as input.
2828 Upon returned, *pLen has the needed or IE length in pBuf.
2829 \param pBuf - Caller allocated memory that contain the IE field, if any,
2830 upon return
2831 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2832 \return eHalStatus - when fail, it usually means the buffer allocated is not
2833 big enough
2834 ---------------------------------------------------------------------------*/
2835eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2836 tANI_U8 *pBuf, eCsrSecurityType secType)
2837{
2838 eHalStatus status = eHAL_STATUS_FAILURE;
2839 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2840
2841 status = sme_AcquireGlobalLock( &pMac->sme );
2842 if ( HAL_STATUS_SUCCESS( status ) )
2843 {
2844 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2845 {
2846 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
2847 }
2848 else
2849 {
2850 status = eHAL_STATUS_INVALID_PARAMETER;
2851 }
2852 sme_ReleaseGlobalLock( &pMac->sme );
2853 }
2854
2855 return (status);
2856}
2857
2858/* ---------------------------------------------------------------------------
2859 \fn sme_RoamGetSecurityRspIE
2860 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
2861 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08002862 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002863 \param pLen - caller allocated memory that has the length of pBuf as input.
2864 Upon returned, *pLen has the needed or IE length in pBuf.
2865 \param pBuf - Caller allocated memory that contain the IE field, if any,
2866 upon return
2867 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2868 \return eHalStatus - when fail, it usually means the buffer allocated is not
2869 big enough
2870 ---------------------------------------------------------------------------*/
2871eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2872 tANI_U8 *pBuf, eCsrSecurityType secType)
2873{
2874 eHalStatus status = eHAL_STATUS_FAILURE;
2875 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2876
2877 status = sme_AcquireGlobalLock( &pMac->sme );
2878 if ( HAL_STATUS_SUCCESS( status ) )
2879 {
2880 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2881 {
2882 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
2883 }
2884 else
2885 {
2886 status = eHAL_STATUS_INVALID_PARAMETER;
2887 }
2888 sme_ReleaseGlobalLock( &pMac->sme );
2889 }
2890
2891 return (status);
2892
2893}
2894
2895
2896/* ---------------------------------------------------------------------------
2897 \fn sme_RoamGetNumPMKIDCache
2898 \brief a wrapper function to request CSR to return number of PMKID cache
2899 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08002900 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002901 \return tANI_U32 - the number of PMKID cache entries
2902 ---------------------------------------------------------------------------*/
2903tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
2904{
2905 eHalStatus status = eHAL_STATUS_FAILURE;
2906 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2907 tANI_U32 numPmkidCache = 0;
2908
2909 status = sme_AcquireGlobalLock( &pMac->sme );
2910 if ( HAL_STATUS_SUCCESS( status ) )
2911 {
2912 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2913 {
2914 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
2915 status = eHAL_STATUS_SUCCESS;
2916 }
2917 else
2918 {
2919 status = eHAL_STATUS_INVALID_PARAMETER;
2920 }
2921 sme_ReleaseGlobalLock( &pMac->sme );
2922 }
2923
2924 return (numPmkidCache);
2925}
2926
2927/* ---------------------------------------------------------------------------
2928 \fn sme_RoamGetPMKIDCache
2929 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08002930 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002931 \param pNum - caller allocated memory that has the space of the number of
2932 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
2933 needed or actually number in tPmkidCacheInfo.
2934 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
2935 any, upon return
2936 \return eHalStatus - when fail, it usually means the buffer allocated is not
2937 big enough
2938 ---------------------------------------------------------------------------*/
2939eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
2940 tPmkidCacheInfo *pPmkidCache)
2941{
2942 eHalStatus status = eHAL_STATUS_FAILURE;
2943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2944
2945 status = sme_AcquireGlobalLock( &pMac->sme );
2946 if ( HAL_STATUS_SUCCESS( status ) )
2947 {
2948 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2949 {
2950 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
2951 }
2952 else
2953 {
2954 status = eHAL_STATUS_INVALID_PARAMETER;
2955 }
2956 sme_ReleaseGlobalLock( &pMac->sme );
2957 }
2958
2959 return (status);
2960}
2961
2962
2963/* ---------------------------------------------------------------------------
2964 \fn sme_GetConfigParam
2965 \brief a wrapper function that HDD calls to get the global settings
2966 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002967 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002968 \param pParam - caller allocated memory
2969 \return eHalStatus
2970 ---------------------------------------------------------------------------*/
2971eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
2972{
2973 eHalStatus status = eHAL_STATUS_FAILURE;
2974 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2975
2976 status = sme_AcquireGlobalLock( &pMac->sme );
2977 if ( HAL_STATUS_SUCCESS( status ) )
2978 {
2979 status = csrGetConfigParam(pMac, &pParam->csrConfig);
2980 if (status != eHAL_STATUS_SUCCESS)
2981 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002982 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002983 sme_ReleaseGlobalLock( &pMac->sme );
2984 return status;
2985 }
2986#if defined WLAN_FEATURE_P2P_INTERNAL
2987 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
2988 if (status != eHAL_STATUS_SUCCESS)
2989 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002990 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002991 sme_ReleaseGlobalLock( &pMac->sme );
2992 return status;
2993 }
2994#endif
2995 sme_ReleaseGlobalLock( &pMac->sme );
2996 }
2997
2998 return (status);
2999}
3000
3001/* ---------------------------------------------------------------------------
3002 \fn sme_CfgSetInt
3003 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003004 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003005 \param cfgId - Configuration Parameter ID (type) for STA.
3006 \param ccmValue - The information related to Configuration Parameter ID
3007 which needs to be saved in CFG
3008 \param callback - To be registered by CSR with CCM. Once the CFG done with
3009 saving the information in the database, it notifies CCM &
3010 then the callback will be invoked to notify.
3011 \param toBeSaved - To save the request for future reference
3012 \return eHalStatus
3013 ---------------------------------------------------------------------------*/
3014eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3015 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3016{
3017 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3018}
3019
3020/* ---------------------------------------------------------------------------
3021 \fn sme_CfgSetStr
3022 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003023 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003024 \param cfgId - Configuration Parameter ID (type) for STA.
3025 \param pStr - Pointer to the byte array which carries the information needs
3026 to be saved in CFG
3027 \param length - Length of the data to be saved
3028 \param callback - To be registered by CSR with CCM. Once the CFG done with
3029 saving the information in the database, it notifies CCM &
3030 then the callback will be invoked to notify.
3031 \param toBeSaved - To save the request for future reference
3032 \return eHalStatus
3033 ---------------------------------------------------------------------------*/
3034eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3035 tANI_U32 length, tCcmCfgSetCallback callback,
3036 eAniBoolean toBeSaved)
3037{
3038 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3039}
3040
3041/* ---------------------------------------------------------------------------
3042 \fn sme_GetModifyProfileFields
3043 \brief HDD or SME - QOS calls this function to get the current values of
3044 connected profile fields, changing which can cause reassoc.
3045 This function must be called after CFG is downloaded and STA is in connected
3046 state. Also, make sure to call this function to get the current profile
3047 fields before calling the reassoc. So that pModifyProfileFields will have
3048 all the latest values plus the one(s) has been updated as part of reassoc
3049 request.
3050 \param pModifyProfileFields - pointer to the connected profile fields
3051 changing which can cause reassoc
3052
3053 \return eHalStatus
3054 -------------------------------------------------------------------------------*/
3055eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3056 tCsrRoamModifyProfileFields * pModifyProfileFields)
3057{
3058 eHalStatus status = eHAL_STATUS_FAILURE;
3059 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3060
3061 status = sme_AcquireGlobalLock( &pMac->sme );
3062 if ( HAL_STATUS_SUCCESS( status ) )
3063 {
3064 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3065 {
3066 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3067 }
3068 else
3069 {
3070 status = eHAL_STATUS_INVALID_PARAMETER;
3071 }
3072 sme_ReleaseGlobalLock( &pMac->sme );
3073 }
3074
3075 return (status);
3076}
3077
3078/*--------------------------------------------------------------------------
3079 \fn sme_SetConfigPowerSave
3080 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3081 For BMPS related configuration, this function also updates the CFG
3082 and sends a message to FW to pick up the new values. Note: Calling
3083 this function only updates the configuration and does not enable
3084 the specified power save mode.
3085 \param hHal - The handle returned by macOpen.
3086 \param psMode - Power Saving mode being modified
3087 \param pConfigParams - a pointer to a caller allocated object of type
3088 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3089 \return eHalStatus
3090 --------------------------------------------------------------------------*/
3091eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3092 void *pConfigParams)
3093{
3094 eHalStatus status = eHAL_STATUS_FAILURE;
3095 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3096
3097 if (NULL == pConfigParams ) {
3098 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3099 "nothing to update");
3100 return eHAL_STATUS_FAILURE;
3101 }
3102
3103 status = sme_AcquireGlobalLock( &pMac->sme );
3104 if ( HAL_STATUS_SUCCESS( status ) )
3105 {
3106 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3107 sme_ReleaseGlobalLock( &pMac->sme );
3108 }
3109
3110 return (status);
3111}
3112
3113/*--------------------------------------------------------------------------
3114 \fn sme_GetConfigPowerSave
3115 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3116 \param hHal - The handle returned by macOpen.
3117 \param psMode - Power Saving mode
3118 \param pConfigParams - a pointer to a caller allocated object of type
3119 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3120 \return eHalStatus
3121 --------------------------------------------------------------------------*/
3122eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3123 void *pConfigParams)
3124{
3125 eHalStatus status = eHAL_STATUS_FAILURE;
3126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3127
3128 if (NULL == pConfigParams ) {
3129 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3130 "nothing to update");
3131 return eHAL_STATUS_FAILURE;
3132 }
3133
3134 status = sme_AcquireGlobalLock( &pMac->sme );
3135 if ( HAL_STATUS_SUCCESS( status ) )
3136 {
3137 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3138 sme_ReleaseGlobalLock( &pMac->sme );
3139 }
3140
3141 return (status);
3142}
3143
3144/* ---------------------------------------------------------------------------
3145 \fn sme_SignalPowerEvent
3146 \brief Signals to PMC that a power event has occurred. Used for putting
3147 the chip into deep sleep mode.
3148 \param hHal - The handle returned by macOpen.
3149 \param event - the event that has occurred
3150 \return eHalStatus
3151 ---------------------------------------------------------------------------*/
3152eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
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 status = pmcSignalPowerEvent(hHal, event);
3161 sme_ReleaseGlobalLock( &pMac->sme );
3162 }
3163
3164 return (status);
3165}
3166
3167/* ---------------------------------------------------------------------------
3168 \fn sme_EnablePowerSave
3169 \brief Enables one of the power saving modes.
3170 \param hHal - The handle returned by macOpen.
3171 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3172 while the chip is operating in Full Power, PMC will start
3173 a timer that will try to put the chip in BMPS mode after
3174 expiry.
3175 \return eHalStatus
3176 ---------------------------------------------------------------------------*/
3177eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3178{
3179 eHalStatus status = eHAL_STATUS_FAILURE;
3180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3181
3182 status = sme_AcquireGlobalLock( &pMac->sme );
3183 if ( HAL_STATUS_SUCCESS( status ) )
3184 {
3185 status = pmcEnablePowerSave(hHal, psMode);
3186 sme_ReleaseGlobalLock( &pMac->sme );
3187 }
3188
3189 return (status);
3190}
3191
3192/* ---------------------------------------------------------------------------
3193 \fn sme_DisablePowerSave
3194 \brief Disables one of the power saving modes.
3195 \param hHal - The handle returned by macOpen.
3196 \param psMode - The power saving mode to disable. Disabling does not imply
3197 that device will be brought out of the current PS mode. This
3198 is purely a configuration API.
3199 \return eHalStatus
3200 ---------------------------------------------------------------------------*/
3201eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3202{
3203 eHalStatus status = eHAL_STATUS_FAILURE;
3204 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3205
3206 status = sme_AcquireGlobalLock( &pMac->sme );
3207 if ( HAL_STATUS_SUCCESS( status ) )
3208 {
3209 status = pmcDisablePowerSave(hHal, psMode);
3210 sme_ReleaseGlobalLock( &pMac->sme );
3211 }
3212
3213 return (status);
3214 }
3215
3216/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303217+ \fn sme_SetHostPowerSave
3218+ \brief Enables BMPS logic to be controlled by User level apps
3219+ \param hHal - The handle returned by macOpen.
3220+ \param psMode - The power saving mode to disable. Disabling does not imply
3221+ that device will be brought out of the current PS mode. This
3222+ is purely a configuration API.
3223+ \return eHalStatus
3224+ ---------------------------------------------------------------------------*/
3225eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3226{
3227 eHalStatus status = eHAL_STATUS_FAILURE;
3228 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3229
3230 pMac->pmc.isHostPsEn = psMode;
3231
3232 return (status);
3233}
3234
3235/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003236 \fn sme_StartAutoBmpsTimer
3237 \brief Starts a timer that periodically polls all the registered
3238 module for entry into Bmps mode. This timer is started only if BMPS is
3239 enabled and whenever the device is in full power.
3240 \param hHal - The handle returned by macOpen.
3241 \return eHalStatus
3242 ---------------------------------------------------------------------------*/
3243eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3244{
3245 eHalStatus status = eHAL_STATUS_FAILURE;
3246 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3247
3248 status = sme_AcquireGlobalLock( &pMac->sme );
3249 if ( HAL_STATUS_SUCCESS( status ) )
3250 {
3251 status = pmcStartAutoBmpsTimer(hHal);
3252 sme_ReleaseGlobalLock( &pMac->sme );
3253 }
3254
3255 return (status);
3256}
3257/* ---------------------------------------------------------------------------
3258 \fn sme_StopAutoBmpsTimer
3259 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3260 Stopping the timer does not cause a device state change. Only the timer
3261 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3262 \param hHal - The handle returned by macOpen.
3263 \return eHalStatus
3264 ---------------------------------------------------------------------------*/
3265eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3266{
3267 eHalStatus status = eHAL_STATUS_FAILURE;
3268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3269
3270 status = sme_AcquireGlobalLock( &pMac->sme );
3271 if ( HAL_STATUS_SUCCESS( status ) )
3272 {
3273 status = pmcStopAutoBmpsTimer(hHal);
3274 sme_ReleaseGlobalLock( &pMac->sme );
3275 }
3276
3277 return (status);
3278}
3279/* ---------------------------------------------------------------------------
3280 \fn sme_QueryPowerState
3281 \brief Returns the current power state of the device.
3282 \param hHal - The handle returned by macOpen.
3283 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3284 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3285 \return eHalStatus
3286 ---------------------------------------------------------------------------*/
3287eHalStatus sme_QueryPowerState (
3288 tHalHandle hHal,
3289 tPmcPowerState *pPowerState,
3290 tPmcSwitchState *pSwWlanSwitchState)
3291{
3292 eHalStatus status = eHAL_STATUS_FAILURE;
3293 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3294
3295 status = sme_AcquireGlobalLock( &pMac->sme );
3296 if ( HAL_STATUS_SUCCESS( status ) )
3297 {
3298 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3299 sme_ReleaseGlobalLock( &pMac->sme );
3300 }
3301
3302 return (status);
3303}
3304
3305/* ---------------------------------------------------------------------------
3306 \fn sme_IsPowerSaveEnabled
3307 \brief Checks if the device is able to enter a particular power save mode
3308 This does not imply that the device is in a particular PS mode
3309 \param hHal - The handle returned by macOpen.
3310 \param psMode - the power saving mode
3311 \return eHalStatus
3312 ---------------------------------------------------------------------------*/
3313tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3314{
3315 eHalStatus status = eHAL_STATUS_FAILURE;
3316 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3317 tANI_BOOLEAN result = false;
3318
3319 status = sme_AcquireGlobalLock( &pMac->sme );
3320 if ( HAL_STATUS_SUCCESS( status ) )
3321 {
3322 result = pmcIsPowerSaveEnabled(hHal, psMode);
3323 sme_ReleaseGlobalLock( &pMac->sme );
3324 return result;
3325 }
3326
3327 return false;
3328}
3329
3330/* ---------------------------------------------------------------------------
3331 \fn sme_RequestFullPower
3332 \brief Request that the device be brought to full power state. When the
3333 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3334 is enabled. On timer expiry PMC will attempt to put the device in
3335 BMPS mode if following holds true:
3336 - BMPS mode is enabled
3337 - Polling of all modules through the Power Save Check routine passes
3338 - STA is associated to an access point
3339 \param hHal - The handle returned by macOpen.
3340 \param - callbackRoutine Callback routine invoked in case of success/failure
3341 \return eHalStatus - status
3342 eHAL_STATUS_SUCCESS - device brought to full power state
3343 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3344 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3345 ---------------------------------------------------------------------------*/
3346eHalStatus sme_RequestFullPower (
3347 tHalHandle hHal,
3348 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3349 void *callbackContext,
3350 tRequestFullPowerReason fullPowerReason)
3351{
3352 eHalStatus status = eHAL_STATUS_FAILURE;
3353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3354
3355 status = sme_AcquireGlobalLock( &pMac->sme );
3356 if ( HAL_STATUS_SUCCESS( status ) )
3357 {
3358 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3359 sme_ReleaseGlobalLock( &pMac->sme );
3360 }
3361
3362 return (status);
3363}
3364
3365/* ---------------------------------------------------------------------------
3366 \fn sme_RequestBmps
3367 \brief Request that the device be put in BMPS state. Request will be
3368 accepted only if BMPS mode is enabled and power save check routine
3369 passes.
3370 \param hHal - The handle returned by macOpen.
3371 \param - callbackRoutine Callback routine invoked in case of success/failure
3372 \return eHalStatus
3373 eHAL_STATUS_SUCCESS - device is in BMPS state
3374 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3375 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3376 ---------------------------------------------------------------------------*/
3377eHalStatus sme_RequestBmps (
3378 tHalHandle hHal,
3379 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3380 void *callbackContext)
3381{
3382 eHalStatus status = eHAL_STATUS_FAILURE;
3383 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3384
3385 status = sme_AcquireGlobalLock( &pMac->sme );
3386 if ( HAL_STATUS_SUCCESS( status ) )
3387 {
3388 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3389 sme_ReleaseGlobalLock( &pMac->sme );
3390 }
3391
3392 return (status);
3393}
3394
3395
3396/* ---------------------------------------------------------------------------
3397 \fn sme_SetDHCPTillPowerActiveFlag
3398 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3399 entry by PMC
3400 \param hHal - The handle returned by macOpen.
3401 ---------------------------------------------------------------------------*/
3402void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3403{
3404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3405
3406 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3407 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3408}
3409
3410
3411/* ---------------------------------------------------------------------------
3412 \fn sme_StartUapsd
3413 \brief Request that the device be put in UAPSD state. If the device is in
3414 Full Power it will be put in BMPS mode first and then into UAPSD
3415 mode.
3416 \param hHal - The handle returned by macOpen.
3417 \param - callbackRoutine Callback routine invoked in case of success/failure
3418 eHAL_STATUS_SUCCESS - device is in UAPSD state
3419 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3420 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3421 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3422 \return eHalStatus
3423 ---------------------------------------------------------------------------*/
3424eHalStatus sme_StartUapsd (
3425 tHalHandle hHal,
3426 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3427 void *callbackContext)
3428{
3429 eHalStatus status = eHAL_STATUS_FAILURE;
3430 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3431
3432 status = sme_AcquireGlobalLock( &pMac->sme );
3433 if ( HAL_STATUS_SUCCESS( status ) )
3434 {
3435 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3436 sme_ReleaseGlobalLock( &pMac->sme );
3437 }
3438
3439 return (status);
3440 }
3441
3442/* ---------------------------------------------------------------------------
3443 \fn sme_StopUapsd
3444 \brief Request that the device be put out of UAPSD state. Device will be
3445 put in in BMPS state after stop UAPSD completes.
3446 \param hHal - The handle returned by macOpen.
3447 \return eHalStatus
3448 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3449 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3450 ---------------------------------------------------------------------------*/
3451eHalStatus sme_StopUapsd (tHalHandle hHal)
3452{
3453 eHalStatus status = eHAL_STATUS_FAILURE;
3454 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3455
3456 status = sme_AcquireGlobalLock( &pMac->sme );
3457 if ( HAL_STATUS_SUCCESS( status ) )
3458 {
3459 status = pmcStopUapsd(hHal);
3460 sme_ReleaseGlobalLock( &pMac->sme );
3461 }
3462
3463 return (status);
3464}
3465
3466/* ---------------------------------------------------------------------------
3467 \fn sme_RequestStandby
3468 \brief Request that the device be put in standby. It is HDD's responsibility
3469 to bring the chip to full power and do a disassoc before calling
3470 this API.
3471 \param hHal - The handle returned by macOpen.
3472 \param - callbackRoutine Callback routine invoked in case of success/failure
3473 \return eHalStatus
3474 eHAL_STATUS_SUCCESS - device is in Standby mode
3475 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3476 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3477 ---------------------------------------------------------------------------*/
3478eHalStatus sme_RequestStandby (
3479 tHalHandle hHal,
3480 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3481 void *callbackContext)
3482{
3483 eHalStatus status = eHAL_STATUS_FAILURE;
3484 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3485
3486 smsLog( pMac, LOG1, FL("") );
3487 status = sme_AcquireGlobalLock( &pMac->sme );
3488 if ( HAL_STATUS_SUCCESS( status ) )
3489 {
3490 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3491 sme_ReleaseGlobalLock( &pMac->sme );
3492 }
3493
3494 return (status);
3495}
3496
3497/* ---------------------------------------------------------------------------
3498 \fn sme_RegisterPowerSaveCheck
3499 \brief Register a power save check routine that is called whenever
3500 the device is about to enter one of the power save modes.
3501 \param hHal - The handle returned by macOpen.
3502 \param checkRoutine - Power save check routine to be registered
3503 \return eHalStatus
3504 eHAL_STATUS_SUCCESS - successfully registered
3505 eHAL_STATUS_FAILURE - not successfully registered
3506 ---------------------------------------------------------------------------*/
3507eHalStatus sme_RegisterPowerSaveCheck (
3508 tHalHandle hHal,
3509 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3510{
3511 eHalStatus status = eHAL_STATUS_FAILURE;
3512 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3513
3514 status = sme_AcquireGlobalLock( &pMac->sme );
3515 if ( HAL_STATUS_SUCCESS( status ) )
3516 {
3517 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3518 sme_ReleaseGlobalLock( &pMac->sme );
3519 }
3520
3521 return (status);
3522}
3523
3524/* ---------------------------------------------------------------------------
3525 \fn sme_DeregisterPowerSaveCheck
3526 \brief Deregister a power save check routine
3527 \param hHal - The handle returned by macOpen.
3528 \param checkRoutine - Power save check routine to be deregistered
3529 \return eHalStatus
3530 eHAL_STATUS_SUCCESS - successfully deregistered
3531 eHAL_STATUS_FAILURE - not successfully deregistered
3532 ---------------------------------------------------------------------------*/
3533eHalStatus sme_DeregisterPowerSaveCheck (
3534 tHalHandle hHal,
3535 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3536{
3537 eHalStatus status = eHAL_STATUS_FAILURE;
3538 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3539
3540 status = sme_AcquireGlobalLock( &pMac->sme );
3541 if ( HAL_STATUS_SUCCESS( status ) )
3542 {
3543 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3544 sme_ReleaseGlobalLock( &pMac->sme );
3545 }
3546
3547 return (status);
3548}
3549
3550/* ---------------------------------------------------------------------------
3551 \fn sme_RegisterDeviceStateUpdateInd
3552 \brief Register a callback routine that is called whenever
3553 the device enters a new device state (Full Power, BMPS, UAPSD)
3554 \param hHal - The handle returned by macOpen.
3555 \param callbackRoutine - Callback routine to be registered
3556 \param callbackContext - Cookie to be passed back during callback
3557 \return eHalStatus
3558 eHAL_STATUS_SUCCESS - successfully registered
3559 eHAL_STATUS_FAILURE - not successfully registered
3560 ---------------------------------------------------------------------------*/
3561eHalStatus sme_RegisterDeviceStateUpdateInd (
3562 tHalHandle hHal,
3563 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3564 void *callbackContext)
3565{
3566 eHalStatus status = eHAL_STATUS_FAILURE;
3567 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3568
3569 status = sme_AcquireGlobalLock( &pMac->sme );
3570 if ( HAL_STATUS_SUCCESS( status ) )
3571 {
3572 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3573 sme_ReleaseGlobalLock( &pMac->sme );
3574 }
3575
3576 return (status);
3577}
3578
3579/* ---------------------------------------------------------------------------
3580 \fn sme_DeregisterDeviceStateUpdateInd
3581 \brief Deregister a routine that was registered for device state changes
3582 \param hHal - The handle returned by macOpen.
3583 \param callbackRoutine - Callback routine to be deregistered
3584 \return eHalStatus
3585 eHAL_STATUS_SUCCESS - successfully deregistered
3586 eHAL_STATUS_FAILURE - not successfully deregistered
3587 ---------------------------------------------------------------------------*/
3588eHalStatus sme_DeregisterDeviceStateUpdateInd (
3589 tHalHandle hHal,
3590 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3591{
3592 eHalStatus status = eHAL_STATUS_FAILURE;
3593 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3594
3595 status = sme_AcquireGlobalLock( &pMac->sme );
3596 if ( HAL_STATUS_SUCCESS( status ) )
3597 {
3598 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3599 sme_ReleaseGlobalLock( &pMac->sme );
3600 }
3601
3602 return (status);
3603}
3604
3605/* ---------------------------------------------------------------------------
3606 \fn sme_WowlAddBcastPattern
3607 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3608 do a pattern match on these patterns when Wowl is enabled during BMPS
3609 mode. Note that Firmware performs the pattern matching only on
3610 broadcast frames and while Libra is in BMPS mode.
3611 \param hHal - The handle returned by macOpen.
3612 \param pattern - Pattern to be added
3613 \return eHalStatus
3614 eHAL_STATUS_FAILURE Cannot add pattern
3615 eHAL_STATUS_SUCCESS Request accepted.
3616 ---------------------------------------------------------------------------*/
3617eHalStatus sme_WowlAddBcastPattern (
3618 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003619 tpSirWowlAddBcastPtrn pattern,
3620 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003621{
3622 eHalStatus status = eHAL_STATUS_FAILURE;
3623 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3624 status = sme_AcquireGlobalLock( &pMac->sme );
3625 if ( HAL_STATUS_SUCCESS( status ) )
3626 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003627 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 sme_ReleaseGlobalLock( &pMac->sme );
3629 }
3630
3631 return (status);
3632}
3633
3634/* ---------------------------------------------------------------------------
3635 \fn sme_WowlDelBcastPattern
3636 \brief Delete a pattern that was added for Pattern Byte Matching.
3637 \param hHal - The handle returned by macOpen.
3638 \param pattern - Pattern to be deleted
3639 \return eHalStatus
3640 eHAL_STATUS_FAILURE Cannot delete pattern
3641 eHAL_STATUS_SUCCESS Request accepted.
3642 ---------------------------------------------------------------------------*/
3643eHalStatus sme_WowlDelBcastPattern (
3644 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003645 tpSirWowlDelBcastPtrn pattern,
3646 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003647{
3648 eHalStatus status = eHAL_STATUS_FAILURE;
3649 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3650 status = sme_AcquireGlobalLock( &pMac->sme );
3651 if ( HAL_STATUS_SUCCESS( status ) )
3652 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003653 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003654 sme_ReleaseGlobalLock( &pMac->sme );
3655 }
3656
3657 return (status);
3658}
3659
3660/* ---------------------------------------------------------------------------
3661 \fn sme_EnterWowl
3662 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
3663 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
3664 SME will will cache the information that WOWL has been enabled and
3665 attempt to put the device in BMPS. On entry into BMPS, SME will
3666 enable the WOWL mode.
3667 Note 1: If we exit BMPS mode (someone requests full power), we
3668 will NOT resume WOWL when we go back to BMPS again. Request for full
3669 power (while in WOWL mode) means disable WOWL and go to full power.
3670 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
3671 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
3672 are required. Currently there is no requirement or use case to support
3673 UAPSD and WOWL at the same time.
3674
3675 \param hHal - The handle returned by macOpen.
3676 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
3677 Used for success/failure notification by SME
3678 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
3679 at the time of callback.
3680 \param wakeReasonIndCB - Callback routine provided by HDD.
3681 Used for Wake Reason Indication by SME
3682 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
3683 at the time of callback.
3684 \return eHalStatus
3685 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
3686 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
3687 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
3688 BMPS mode is entered.
3689 ---------------------------------------------------------------------------*/
3690eHalStatus sme_EnterWowl (
3691 tHalHandle hHal,
3692 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
3693 void *enterWowlCallbackContext,
3694#ifdef WLAN_WAKEUP_EVENTS
3695 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
3696 void *wakeIndicationCBContext,
3697#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003698 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003699{
3700 eHalStatus status = eHAL_STATUS_FAILURE;
3701 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3702 status = sme_AcquireGlobalLock( &pMac->sme );
3703 if ( HAL_STATUS_SUCCESS( status ) )
3704 {
3705 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
3706#ifdef WLAN_WAKEUP_EVENTS
3707 wakeIndicationCB, wakeIndicationCBContext,
3708#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003709 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 sme_ReleaseGlobalLock( &pMac->sme );
3711 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 return (status);
3713}
3714/* ---------------------------------------------------------------------------
3715 \fn sme_ExitWowl
3716 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
3717 SME will initiate exit from WoWLAN mode and device will be put in BMPS
3718 mode.
3719 \param hHal - The handle returned by macOpen.
3720 \return eHalStatus
3721 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
3722 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
3723 ---------------------------------------------------------------------------*/
3724eHalStatus sme_ExitWowl (tHalHandle hHal)
3725{
3726 eHalStatus status = eHAL_STATUS_FAILURE;
3727 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3728 status = sme_AcquireGlobalLock( &pMac->sme );
3729 if ( HAL_STATUS_SUCCESS( status ) )
3730 {
3731 status = pmcExitWowl (hHal);
3732 sme_ReleaseGlobalLock( &pMac->sme );
3733 }
3734
3735 return (status);
3736}
3737
3738/* ---------------------------------------------------------------------------
3739
3740 \fn sme_RoamSetKey
3741
3742 \brief To set encryption key. This function should be called only when connected
3743 This is an asynchronous API.
3744
3745 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
3746
3747 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3748
3749 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3750
3751 FAILURE or RESOURCES The API finished and failed.
3752
3753 -------------------------------------------------------------------------------*/
3754eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
3755{
3756 eHalStatus status = eHAL_STATUS_FAILURE;
3757 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3758 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 tANI_U32 i;
3760 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003761
3762 status = sme_AcquireGlobalLock( &pMac->sme );
3763 if ( HAL_STATUS_SUCCESS( status ) )
3764 {
3765 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3766 if(pRoamId)
3767 {
3768 *pRoamId = roamId;
3769 }
3770
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003771 smsLog(pMac, LOG2, FL("keyLength"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07003772
3773 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003774 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003775
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003776 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003777
3778 pSession = CSR_GET_SESSION(pMac, sessionId);
3779
Jeff Johnson32d95a32012-09-10 13:15:23 -07003780 if(!pSession)
3781 {
3782 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08003783 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003784 return eHAL_STATUS_FAILURE;
3785 }
3786
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
3788 {
3789 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
3790 {
3791 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
3792 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
3793 {
3794 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3795 }
3796 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
3797 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
3798 {
3799 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3800 }
3801 }
3802 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003803
3804 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
3805 sme_ReleaseGlobalLock( &pMac->sme );
3806 }
3807
3808 return (status);
3809}
3810
3811
3812/* ---------------------------------------------------------------------------
3813
3814 \fn sme_RoamRemoveKey
3815
3816 \brief To set encryption key. This is an asynchronous API.
3817
3818 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
3819
3820 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3821
3822 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3823
3824 FAILURE or RESOURCES The API finished and failed.
3825
3826 -------------------------------------------------------------------------------*/
3827eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
3828 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
3829{
3830 eHalStatus status = eHAL_STATUS_FAILURE;
3831 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3832 tANI_U32 roamId;
3833
3834 status = sme_AcquireGlobalLock( &pMac->sme );
3835 if ( HAL_STATUS_SUCCESS( status ) )
3836 {
3837 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3838 if(pRoamId)
3839 {
3840 *pRoamId = roamId;
3841 }
3842 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
3843 sme_ReleaseGlobalLock( &pMac->sme );
3844 }
3845
3846 return (status);
3847}
3848
3849/* ---------------------------------------------------------------------------
3850 \fn sme_GetRssi
3851 \brief a wrapper function that client calls to register a callback to get RSSI
3852
3853 \param callback - SME sends back the requested stats using the callback
3854 \param staId - The station ID for which the stats is requested for
3855 \param pContext - user context to be passed back along with the callback
3856 \param pVosContext - vos context
3857 \return eHalStatus
3858 ---------------------------------------------------------------------------*/
3859eHalStatus sme_GetRssi(tHalHandle hHal,
3860 tCsrRssiCallback callback,
3861 tANI_U8 staId, tCsrBssid bssId,
3862 void *pContext, void* pVosContext)
3863{
3864 eHalStatus status = eHAL_STATUS_FAILURE;
3865 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3866
3867 status = sme_AcquireGlobalLock( &pMac->sme );
3868 if ( HAL_STATUS_SUCCESS( status ) )
3869 {
3870 status = csrGetRssi( pMac, callback,
3871 staId, bssId, pContext, pVosContext);
3872 sme_ReleaseGlobalLock( &pMac->sme );
3873 }
3874 return (status);
3875}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003876#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3877/* ---------------------------------------------------------------------------
3878 \fn sme_GetRoamRssi
3879 \brief a wrapper function that client calls to register a callback to get Roam RSSI
3880
3881 \param callback - SME sends back the requested stats using the callback
3882 \param staId - The station ID for which the stats is requested for
3883 \param pContext - user context to be passed back along with the callback
3884 \param pVosContext - vos context
3885 \return eHalStatus
3886 ---------------------------------------------------------------------------*/
3887eHalStatus sme_GetRoamRssi(tHalHandle hHal,
3888 tCsrRssiCallback callback,
3889 tANI_U8 staId, tCsrBssid bssId,
3890 void *pContext, void* pVosContext)
3891{
3892 eHalStatus status = eHAL_STATUS_FAILURE;
3893 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3894
3895 status = sme_AcquireGlobalLock( &pMac->sme );
3896 if ( HAL_STATUS_SUCCESS( status ) )
3897 {
3898 status = csrGetRoamRssi( pMac, callback,
3899 staId, bssId, pContext, pVosContext);
3900 sme_ReleaseGlobalLock( &pMac->sme );
3901 }
3902 return (status);
3903}
3904#endif
3905
Jeff Johnson295189b2012-06-20 16:38:30 -07003906
3907/* ---------------------------------------------------------------------------
3908 \fn sme_GetStatistics
3909 \brief a wrapper function that client calls to register a callback to get
3910 different PHY level statistics from CSR.
3911
3912 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
3913 \param statsMask - The different category/categories of stats requester is looking for
3914 \param callback - SME sends back the requested stats using the callback
3915 \param periodicity - If requester needs periodic update in millisec, 0 means
3916 it's an one time request
3917 \param cache - If requester is happy with cached stats
3918 \param staId - The station ID for which the stats is requested for
3919 \param pContext - user context to be passed back along with the callback
3920 \return eHalStatus
3921 ---------------------------------------------------------------------------*/
3922eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
3923 tANI_U32 statsMask,
3924 tCsrStatsCallback callback,
3925 tANI_U32 periodicity, tANI_BOOLEAN cache,
3926 tANI_U8 staId, void *pContext)
3927{
3928 eHalStatus status = eHAL_STATUS_FAILURE;
3929 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3930
3931 status = sme_AcquireGlobalLock( &pMac->sme );
3932 if ( HAL_STATUS_SUCCESS( status ) )
3933 {
3934 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
3935 periodicity, cache, staId, pContext);
3936 sme_ReleaseGlobalLock( &pMac->sme );
3937 }
3938
3939 return (status);
3940
3941}
3942
3943/* ---------------------------------------------------------------------------
3944
3945 \fn sme_GetCountryCode
3946
3947 \brief To return the current country code. If no country code is applied, default country code is
3948 used to fill the buffer.
3949 If 11d supported is turned off, an error is return and the last applied/default country code is used.
3950 This is a synchronous API.
3951
3952 \param pBuf - pointer to a caller allocated buffer for returned country code.
3953
3954 \param pbLen For input, this parameter indicates how big is the buffer.
3955 Upon return, this parameter has the number of bytes for country. If pBuf
3956 doesn't have enough space, this function returns
3957 fail status and this parameter contains the number that is needed.
3958
3959 \return eHalStatus SUCCESS.
3960
3961 FAILURE or RESOURCES The API finished and failed.
3962
3963 -------------------------------------------------------------------------------*/
3964eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
3965{
3966 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3967
3968 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
3969}
3970
3971
3972/* ---------------------------------------------------------------------------
3973
3974 \fn sme_SetCountryCode
3975
3976 \brief To change the current/default country code.
3977 If 11d supported is turned off, an error is return.
3978 This is a synchronous API.
3979
3980 \param pCountry - pointer to a caller allocated buffer for the country code.
3981
3982 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
3983 whether a reset is required.
3984
3985 \return eHalStatus SUCCESS.
3986
3987 FAILURE or RESOURCES The API finished and failed.
3988
3989 -------------------------------------------------------------------------------*/
3990eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
3991{
3992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3993
3994 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
3995}
3996
3997
3998/* ---------------------------------------------------------------------------
3999 \fn sme_ResetCountryCodeInformation
4000 \brief this function is to reset the country code current being used back to EEPROM default
4001 this includes channel list and power setting. This is a synchronous API.
4002 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4003 a restart is needed to apply the change
4004 \return eHalStatus
4005 -------------------------------------------------------------------------------*/
4006eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4007{
4008 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4009
4010 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4011}
4012
4013
4014/* ---------------------------------------------------------------------------
4015 \fn sme_GetSupportedCountryCode
4016 \brief this function is to get a list of the country code current being supported
4017 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4018 this has the country code list. 3 bytes for each country code. This may be NULL if
4019 caller wants to know the needed byte count.
4020 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4021 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4022 \return eHalStatus
4023 -------------------------------------------------------------------------------*/
4024eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4025{
4026 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4027
4028 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4029}
4030
4031
4032/* ---------------------------------------------------------------------------
4033 \fn sme_GetCurrentRegulatoryDomain
4034 \brief this function is to get the current regulatory domain. This is a synchronous API.
4035 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4036 SME. The function fails if 11d support is turned off.
4037 \param pDomain - Caller allocated buffer to return the current domain.
4038 \return eHalStatus SUCCESS.
4039
4040 FAILURE or RESOURCES The API finished and failed.
4041 -------------------------------------------------------------------------------*/
4042eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4043{
4044 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4045 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4046
4047 if( pDomain )
4048 {
4049 if( csrIs11dSupported( pMac ) )
4050 {
4051 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4052 status = eHAL_STATUS_SUCCESS;
4053 }
4054 else
4055 {
4056 status = eHAL_STATUS_FAILURE;
4057 }
4058 }
4059
4060 return ( status );
4061}
4062
4063
4064/* ---------------------------------------------------------------------------
4065 \fn sme_SetRegulatoryDomain
4066 \brief this function is to set the current regulatory domain.
4067 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4068 SME. This is a synchronous API.
4069 \param domainId - indicate the domain (defined in the driver) needs to set to.
4070 See v_REGDOMAIN_t for definition
4071 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4072 a restart is needed to apply the change
4073 \return eHalStatus
4074 -------------------------------------------------------------------------------*/
4075eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4076{
4077 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4078
4079 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4080}
4081
4082
4083/* ---------------------------------------------------------------------------
4084
4085 \fn sme_GetRegulatoryDomainForCountry
4086
4087 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4088
4089 \param pCountry - pointer to a caller allocated buffer for input country code.
4090
4091 \param pDomainId Upon successful return, it is the domain that country belongs to.
4092 If it is NULL, returning success means that the country code is known.
4093
4094 \return eHalStatus SUCCESS.
4095
4096 FAILURE or RESOURCES The API finished and failed.
4097
4098 -------------------------------------------------------------------------------*/
4099eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4100{
4101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4102
4103 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4104}
4105
4106
4107
4108
4109/* ---------------------------------------------------------------------------
4110
4111 \fn sme_GetSupportedRegulatoryDomains
4112
4113 \brief To return a list of supported regulatory domains. This is a synchronous API.
4114
4115 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4116
4117 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4118 Upon return, this parameter has the number for supported domains. If pDomains
4119 doesn't have enough space for all the supported domains, this function returns
4120 fail status and this parameter contains the number that is needed.
4121
4122 \return eHalStatus SUCCESS.
4123
4124 FAILURE or RESOURCES The API finished and failed.
4125
4126 -------------------------------------------------------------------------------*/
4127eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4128{
4129 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4130
4131 //We support all domains for now
4132 if( pNumDomains )
4133 {
4134 if( NUM_REG_DOMAINS <= *pNumDomains )
4135 {
4136 status = eHAL_STATUS_SUCCESS;
4137 }
4138 *pNumDomains = NUM_REG_DOMAINS;
4139 }
4140 if( HAL_STATUS_SUCCESS( status ) )
4141 {
4142 if( pDomains )
4143 {
4144 pDomains[0] = REGDOMAIN_FCC;
4145 pDomains[1] = REGDOMAIN_ETSI;
4146 pDomains[2] = REGDOMAIN_JAPAN;
4147 pDomains[3] = REGDOMAIN_WORLD;
4148 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4149 pDomains[5] = REGDOMAIN_APAC;
4150 pDomains[6] = REGDOMAIN_KOREA;
4151 pDomains[7] = REGDOMAIN_HI_5GHZ;
4152 pDomains[8] = REGDOMAIN_NO_5GHZ;
4153 }
4154 else
4155 {
4156 status = eHAL_STATUS_INVALID_PARAMETER;
4157 }
4158 }
4159
4160 return ( status );
4161}
4162
4163
4164//some support functions
4165tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4166{
4167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4168
4169 return ( csrIs11dSupported( pMac ) );
4170}
4171
4172
4173tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4174{
4175 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4176
4177 return ( csrIs11hSupported( pMac ) );
4178}
4179
4180
4181tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4182{
4183 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4184
4185 return ( csrIsWmmSupported( pMac ) );
4186}
4187
4188//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4189eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4190{
4191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4192
4193 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4194}
4195
4196/* ---------------------------------------------------------------------------
4197
4198 \fn sme_ChangeCountryCode
4199
4200 \brief Change Country code from upperlayer during WLAN driver operation.
4201 This is a synchronous API.
4202
4203 \param hHal - The handle returned by macOpen.
4204
4205 \param pCountry New Country Code String
4206
4207 \return eHalStatus SUCCESS.
4208
4209 FAILURE or RESOURCES The API finished and failed.
4210
4211 -------------------------------------------------------------------------------*/
4212eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4213 tSmeChangeCountryCallback callback,
4214 tANI_U8 *pCountry,
4215 void *pContext,
4216 void* pVosContext )
4217{
4218 eHalStatus status = eHAL_STATUS_FAILURE;
4219 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4220 vos_msg_t msg;
4221 tAniChangeCountryCodeReq *pMsg;
4222
4223 status = sme_AcquireGlobalLock( &pMac->sme );
4224 if ( HAL_STATUS_SUCCESS( status ) )
4225 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004226 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004227 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4228 if ( !HAL_STATUS_SUCCESS(status) )
4229 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004230 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004231 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 return status;
4233 }
4234
4235 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4236 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4237 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
4238 pMsg->changeCCCallback = callback;
4239 pMsg->pDevContext = pContext;
4240 pMsg->pVosContext = pVosContext;
4241
4242 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4243 msg.bodyptr = pMsg;
4244 msg.reserved = 0;
4245
4246 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4247 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004248 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004249 palFreeMemory(pMac->hHdd, (void *)pMsg);
4250 status = eHAL_STATUS_FAILURE;
4251 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004252 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 sme_ReleaseGlobalLock( &pMac->sme );
4254 }
4255
4256 return (status);
4257}
4258
4259/* ---------------------------------------------------------------------------
4260 \fn sme_BtcSignalBtEvent
4261 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4262 BT event type and the current operating mode of Libra (full power,
4263 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4264 would be employed.
4265 \param hHal - The handle returned by macOpen.
4266 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4267 Caller owns the memory and is responsible for freeing it.
4268 \return VOS_STATUS
4269 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4270 if BTC execution mode is set to BTC_WLAN_ONLY
4271 or BTC_PTA_ONLY.
4272 VOS_STATUS_SUCCESS BT Event passed to HAL
4273 ---------------------------------------------------------------------------*/
4274VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4275{
4276 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4277#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4278 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4279
4280 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4281 {
4282 status = btcSignalBTEvent (hHal, pBtEvent);
4283 sme_ReleaseGlobalLock( &pMac->sme );
4284 }
4285#endif
4286 return (status);
4287}
4288
4289/* ---------------------------------------------------------------------------
4290 \fn sme_BtcSetConfig
4291 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4292 This function should be invoked only after CFG download has completed.
4293 Calling it after sme_HDDReadyInd is recommended.
4294 \param hHal - The handle returned by macOpen.
4295 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4296 Caller owns the memory and is responsible for freeing it.
4297 \return VOS_STATUS
4298 VOS_STATUS_E_FAILURE Config not passed to HAL.
4299 VOS_STATUS_SUCCESS Config passed to HAL
4300 ---------------------------------------------------------------------------*/
4301VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4302{
4303 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4304#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4306 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4307 {
4308 status = btcSetConfig (hHal, pSmeBtcConfig);
4309 sme_ReleaseGlobalLock( &pMac->sme );
4310 }
4311#endif
4312 return (status);
4313}
4314
4315/* ---------------------------------------------------------------------------
4316 \fn sme_BtcGetConfig
4317 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4318 \param hHal - The handle returned by macOpen.
4319 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4320 tSmeBtcConfig. Caller owns the memory and is responsible
4321 for freeing it.
4322 \return VOS_STATUS
4323 VOS_STATUS_E_FAILURE - failure
4324 VOS_STATUS_SUCCESS success
4325 ---------------------------------------------------------------------------*/
4326VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4327{
4328 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4329#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4330 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4331
4332 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4333 {
4334 status = btcGetConfig (hHal, pSmeBtcConfig);
4335 sme_ReleaseGlobalLock( &pMac->sme );
4336 }
4337#endif
4338 return (status);
4339}
4340/* ---------------------------------------------------------------------------
4341 \fn sme_SetCfgPrivacy
4342 \brief API to set configure privacy parameters
4343 \param hHal - The handle returned by macOpen.
4344 \param pProfile - Pointer CSR Roam profile.
4345 \param fPrivacy - This parameter indicates status of privacy
4346
4347 \return void
4348 ---------------------------------------------------------------------------*/
4349void sme_SetCfgPrivacy( tHalHandle hHal,
4350 tCsrRoamProfile *pProfile,
4351 tANI_BOOLEAN fPrivacy
4352 )
4353{
4354 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4355 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4356 {
4357 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4358 sme_ReleaseGlobalLock( &pMac->sme );
4359 }
4360}
4361
4362#if defined WLAN_FEATURE_VOWIFI
4363/* ---------------------------------------------------------------------------
4364 \fn sme_NeighborReportRequest
4365 \brief API to request neighbor report.
4366 \param hHal - The handle returned by macOpen.
4367 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4368 tRrmNeighborReq. Caller owns the memory and is responsible
4369 for freeing it.
4370 \return VOS_STATUS
4371 VOS_STATUS_E_FAILURE - failure
4372 VOS_STATUS_SUCCESS success
4373 ---------------------------------------------------------------------------*/
4374VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4375 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4376{
4377 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4379
4380 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4381 {
4382 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4383 sme_ReleaseGlobalLock( &pMac->sme );
4384 }
4385
4386 return (status);
4387}
4388#endif
4389
4390//The following are debug APIs to support direct read/write register/memory
4391//They are placed in SME because HW cannot be access when in LOW_POWER state
4392//AND not connected. The knowledge and synchronization is done in SME
4393
4394//sme_DbgReadRegister
4395//Caller needs to validate the input values
4396VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4397{
4398 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4399 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004400 tPmcPowerState PowerState;
4401 tANI_U32 sessionId = 0;
4402
4403 /* 1) To make Quarky work in FTM mode **************************************/
4404
4405 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4406 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004407 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004408 {
4409 return VOS_STATUS_SUCCESS;
4410 }
4411 return VOS_STATUS_E_FAILURE;
4412 }
4413
4414 /* 2) NON FTM mode driver *************************************************/
4415
4416 /* Acquire SME global lock */
4417 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4418 {
4419 return VOS_STATUS_E_FAILURE;
4420 }
4421
4422 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4423 {
4424 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4425 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4426 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004427 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 {
4429 status = VOS_STATUS_SUCCESS;
4430 }
4431 else
4432 {
4433 status = VOS_STATUS_E_FAILURE;
4434 }
4435 }
4436 else
4437 {
4438 status = VOS_STATUS_E_FAILURE;
4439 }
4440 }
4441
4442 /* This is a hack for Qualky/pttWniSocket
4443 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4444 if ( VOS_STATUS_SUCCESS != status )
4445 {
4446 *pRegValue = 0xDEADBEEF;
4447 status = VOS_STATUS_SUCCESS;
4448 }
4449
4450 /* Release SME global lock */
4451 sme_ReleaseGlobalLock(&pMac->sme);
4452
4453 return (status);
4454}
4455
4456
4457//sme_DbgWriteRegister
4458//Caller needs to validate the input values
4459VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4460{
4461 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4462 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 tPmcPowerState PowerState;
4464 tANI_U32 sessionId = 0;
4465
4466 /* 1) To make Quarky work in FTM mode **************************************/
4467
4468 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4469 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004470 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004471 {
4472 return VOS_STATUS_SUCCESS;
4473 }
4474 return VOS_STATUS_E_FAILURE;
4475 }
4476
4477 /* 2) NON FTM mode driver *************************************************/
4478
4479 /* Acquire SME global lock */
4480 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4481 {
4482 return VOS_STATUS_E_FAILURE;
4483 }
4484
4485 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4486 {
4487 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4488 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4489 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 {
4492 status = VOS_STATUS_SUCCESS;
4493 }
4494 else
4495 {
4496 status = VOS_STATUS_E_FAILURE;
4497 }
4498 }
4499 else
4500 {
4501 status = VOS_STATUS_E_FAILURE;
4502 }
4503 }
4504
4505 /* Release SME global lock */
4506 sme_ReleaseGlobalLock(&pMac->sme);
4507
4508 return (status);
4509}
4510
4511
4512
4513//sme_DbgReadMemory
4514//Caller needs to validate the input values
4515//pBuf caller allocated buffer has the length of nLen
4516VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4517{
4518 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004520 tPmcPowerState PowerState;
4521 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004522 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4523 tANI_U32 arg1 = memAddr;
4524 tANI_U32 arg2 = nLen/4;
4525 tANI_U32 arg3 = 4;
4526 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004527 /* 1) To make Quarky work in FTM mode **************************************/
4528
4529 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4530 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004531 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 {
4533 return VOS_STATUS_SUCCESS;
4534 }
4535 return VOS_STATUS_E_FAILURE;
4536 }
4537
4538 /* 2) NON FTM mode driver *************************************************/
4539
4540 /* Acquire SME global lock */
4541 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4542 {
4543 return VOS_STATUS_E_FAILURE;
4544 }
4545
4546 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4547 {
4548 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4549 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4550 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004551 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 {
4553 status = VOS_STATUS_SUCCESS;
4554 }
4555 else
4556 {
4557 status = VOS_STATUS_E_FAILURE;
4558 }
4559 }
4560 else
4561 {
4562 status = VOS_STATUS_E_FAILURE;
4563 }
4564 }
4565
4566 /* This is a hack for Qualky/pttWniSocket
4567 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4568 if (VOS_STATUS_SUCCESS != status)
4569 {
4570 vos_mem_set(pBuf, nLen, 0xCD);
4571 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004572 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 }
4574
4575 /* Release SME lock */
4576 sme_ReleaseGlobalLock(&pMac->sme);
4577
4578 return (status);
4579}
4580
4581
4582//sme_DbgWriteMemory
4583//Caller needs to validate the input values
4584VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4585{
4586 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4587 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 tPmcPowerState PowerState;
4589 tANI_U32 sessionId = 0;
4590
4591 /* 1) To make Quarky work in FTM mode **************************************/
4592
4593 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4594 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 {
4596 return VOS_STATUS_SUCCESS;
4597 }
4598 return VOS_STATUS_E_FAILURE;
4599 }
4600
4601 /* 2) NON FTM mode driver *************************************************/
4602
4603 /* Acquire SME global lock */
4604 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4605 {
4606 return VOS_STATUS_E_FAILURE;
4607 }
4608
4609 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4610 {
4611 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4612 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4613 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07004615 {
4616 status = VOS_STATUS_SUCCESS;
4617 }
4618 else
4619 {
4620 status = VOS_STATUS_E_FAILURE;
4621 }
4622 }
4623 else
4624 {
4625 status = VOS_STATUS_E_FAILURE;
4626 }
4627 }
4628
4629 /* Release Global lock */
4630 sme_ReleaseGlobalLock(&pMac->sme);
4631
4632 return (status);
4633}
4634
4635
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004636void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07004637{
4638#ifdef WLAN_DEBUG
4639 // Verify against current log level
4640 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
4641 return;
4642 else
4643 {
4644 va_list marker;
4645
4646 va_start( marker, pString ); /* Initialize variable arguments. */
4647
4648 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
4649
4650 va_end( marker ); /* Reset variable arguments. */
4651 }
4652#endif
4653}
Jeff Johnson295189b2012-06-20 16:38:30 -07004654
Jeff Johnson295189b2012-06-20 16:38:30 -07004655/* ---------------------------------------------------------------------------
4656 \fn sme_GetWcnssWlanCompiledVersion
4657 \brief This API returns the version of the WCNSS WLAN API with
4658 which the HOST driver was built
4659 \param hHal - The handle returned by macOpen.
4660 \param pVersion - Points to the Version structure to be filled
4661 \return VOS_STATUS
4662 VOS_STATUS_E_INVAL - failure
4663 VOS_STATUS_SUCCESS success
4664 ---------------------------------------------------------------------------*/
4665VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
4666 tSirVersionType *pVersion)
4667{
4668 VOS_STATUS status = VOS_STATUS_SUCCESS;
4669 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4670 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4671
4672 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4673 {
4674 if( pVersion != NULL )
4675 {
4676 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
4677 }
4678 else
4679 {
4680 status = VOS_STATUS_E_INVAL;
4681 }
4682 sme_ReleaseGlobalLock( &pMac->sme );
4683 }
4684
4685 return (status);
4686}
4687
4688
4689/* ---------------------------------------------------------------------------
4690 \fn sme_GetWcnssWlanReportedVersion
4691 \brief This API returns the version of the WCNSS WLAN API with
4692 which the WCNSS driver reports it was built
4693 \param hHal - The handle returned by macOpen.
4694 \param pVersion - Points to the Version structure to be filled
4695 \return VOS_STATUS
4696 VOS_STATUS_E_INVAL - failure
4697 VOS_STATUS_SUCCESS success
4698 ---------------------------------------------------------------------------*/
4699VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
4700 tSirVersionType *pVersion)
4701{
4702 VOS_STATUS status = VOS_STATUS_SUCCESS;
4703 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4704 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4705
4706 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4707 {
4708 if( pVersion != NULL )
4709 {
4710 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
4711 }
4712 else
4713 {
4714 status = VOS_STATUS_E_INVAL;
4715 }
4716 sme_ReleaseGlobalLock( &pMac->sme );
4717 }
4718
4719 return (status);
4720}
4721
4722
4723/* ---------------------------------------------------------------------------
4724 \fn sme_GetWcnssSoftwareVersion
4725 \brief This API returns the version string of the WCNSS driver
4726 \param hHal - The handle returned by macOpen.
4727 \param pVersion - Points to the Version string buffer to be filled
4728 \param versionBufferSize - THe size of the Version string buffer
4729 \return VOS_STATUS
4730 VOS_STATUS_E_INVAL - failure
4731 VOS_STATUS_SUCCESS success
4732 ---------------------------------------------------------------------------*/
4733VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
4734 tANI_U8 *pVersion,
4735 tANI_U32 versionBufferSize)
4736{
4737 VOS_STATUS status = VOS_STATUS_SUCCESS;
4738 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4739 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4740
4741 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4742 {
4743 if( pVersion != NULL )
4744 {
4745 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
4746 versionBufferSize);
4747 }
4748 else
4749 {
4750 status = VOS_STATUS_E_INVAL;
4751 }
4752 sme_ReleaseGlobalLock( &pMac->sme );
4753 }
4754
4755 return (status);
4756}
4757
4758
4759/* ---------------------------------------------------------------------------
4760 \fn sme_GetWcnssHardwareVersion
4761 \brief This API returns the version string of the WCNSS hardware
4762 \param hHal - The handle returned by macOpen.
4763 \param pVersion - Points to the Version string buffer to be filled
4764 \param versionBufferSize - THe size of the Version string buffer
4765 \return VOS_STATUS
4766 VOS_STATUS_E_INVAL - failure
4767 VOS_STATUS_SUCCESS success
4768 ---------------------------------------------------------------------------*/
4769VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
4770 tANI_U8 *pVersion,
4771 tANI_U32 versionBufferSize)
4772{
4773 VOS_STATUS status = VOS_STATUS_SUCCESS;
4774 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4775 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4776
4777 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4778 {
4779 if( pVersion != NULL )
4780 {
4781 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
4782 versionBufferSize);
4783 }
4784 else
4785 {
4786 status = VOS_STATUS_E_INVAL;
4787 }
4788 sme_ReleaseGlobalLock( &pMac->sme );
4789 }
4790
4791 return (status);
4792}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08004793
Jeff Johnson295189b2012-06-20 16:38:30 -07004794
4795#ifdef FEATURE_WLAN_WAPI
4796/* ---------------------------------------------------------------------------
4797 \fn sme_RoamSetBKIDCache
4798 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
4799 candidate list.
4800 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4801 it is opened (by calling halOpen).
4802 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
4803 \param numItems - a variable that has the number of tBkidCacheInfo allocated
4804 when retruning, this is the number of items put into pBKIDCache
4805 \return eHalStatus - when fail, it usually means the buffer allocated is not
4806 big enough and pNumItems has the number of tBkidCacheInfo.
4807 ---------------------------------------------------------------------------*/
4808eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
4809 tANI_U32 numItems )
4810{
4811 eHalStatus status = eHAL_STATUS_FAILURE;
4812 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4813
4814 status = sme_AcquireGlobalLock( &pMac->sme );
4815 if ( HAL_STATUS_SUCCESS( status ) )
4816 {
4817 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
4818 sme_ReleaseGlobalLock( &pMac->sme );
4819 }
4820
4821 return (status);
4822}
4823
4824/* ---------------------------------------------------------------------------
4825 \fn sme_RoamGetBKIDCache
4826 \brief The SME API exposed to HDD to allow HDD to request SME to return its
4827 BKID cache.
4828 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4829 it is opened (by calling halOpen).
4830 \param pNum - caller allocated memory that has the space of the number of
4831 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
4832 in SME cache.
4833 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
4834 upon return
4835 \return eHalStatus - when fail, it usually means the buffer allocated is not
4836 big enough.
4837 ---------------------------------------------------------------------------*/
4838eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
4839 tBkidCacheInfo *pBkidCache)
4840{
4841 eHalStatus status = eHAL_STATUS_FAILURE;
4842 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4843
4844 status = sme_AcquireGlobalLock( &pMac->sme );
4845 if ( HAL_STATUS_SUCCESS( status ) )
4846 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004847 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004848 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
4849 sme_ReleaseGlobalLock( &pMac->sme );
4850 }
4851
4852 return (status);
4853}
4854
4855/* ---------------------------------------------------------------------------
4856 \fn sme_RoamGetNumBKIDCache
4857 \brief The SME API exposed to HDD to allow HDD to request SME to return the
4858 number of BKID cache entries.
4859 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4860 it is opened (by calling halOpen).
4861 \return tANI_U32 - the number of BKID cache entries.
4862 ---------------------------------------------------------------------------*/
4863tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
4864{
4865 eHalStatus status = eHAL_STATUS_FAILURE;
4866 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4867 tANI_U32 numBkidCache = 0;
4868
4869 status = sme_AcquireGlobalLock( &pMac->sme );
4870 if ( HAL_STATUS_SUCCESS( status ) )
4871 {
4872 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
4873 sme_ReleaseGlobalLock( &pMac->sme );
4874 }
4875
4876 return (numBkidCache);
4877}
4878
4879/* ---------------------------------------------------------------------------
4880 \fn sme_ScanGetBKIDCandidateList
4881 \brief a wrapper function to return the BKID candidate list
4882 \param pBkidList - caller allocated buffer point to an array of
4883 tBkidCandidateInfo
4884 \param pNumItems - pointer to a variable that has the number of
4885 tBkidCandidateInfo allocated when retruning, this is
4886 either the number needed or number of items put into
4887 pPmkidList
4888 \return eHalStatus - when fail, it usually means the buffer allocated is not
4889 big enough and pNumItems
4890 has the number of tBkidCandidateInfo.
4891 \Note: pNumItems is a number of tBkidCandidateInfo,
4892 not sizeof(tBkidCandidateInfo) * something
4893 ---------------------------------------------------------------------------*/
4894eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
4895 tBkidCandidateInfo *pBkidList,
4896 tANI_U32 *pNumItems )
4897{
4898 eHalStatus status = eHAL_STATUS_FAILURE;
4899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4900
4901 status = sme_AcquireGlobalLock( &pMac->sme );
4902 if ( HAL_STATUS_SUCCESS( status ) )
4903 {
4904 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
4905 sme_ReleaseGlobalLock( &pMac->sme );
4906 }
4907
4908 return (status);
4909}
4910#endif /* FEATURE_WLAN_WAPI */
4911
Jeff Johnsone7245742012-09-05 17:12:55 -07004912#ifdef FEATURE_OEM_DATA_SUPPORT
4913
4914/*****************************************************************************
4915 OEM DATA related modifications and function additions
4916 *****************************************************************************/
4917
4918/* ---------------------------------------------------------------------------
4919 \fn sme_getOemDataRsp
4920 \brief a wrapper function to obtain the OEM DATA RSP
4921 \param pOemDataRsp - A pointer to the response object
4922 \param pContext - a pointer passed in for the callback
4923 \return eHalStatus
4924 ---------------------------------------------------------------------------*/
4925eHalStatus sme_getOemDataRsp(tHalHandle hHal,
4926 tOemDataRsp **pOemDataRsp)
4927{
4928 eHalStatus status = eHAL_STATUS_SUCCESS;
4929 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4930
4931 do
4932 {
4933 //acquire the lock for the sme object
4934 status = sme_AcquireGlobalLock(&pMac->sme);
4935
4936 if(!HAL_STATUS_SUCCESS(status))
4937 {
4938 break;
4939 }
4940
4941 if(pMac->oemData.pOemDataRsp != NULL)
4942 {
4943 *pOemDataRsp = pMac->oemData.pOemDataRsp;
4944 }
4945 else
4946 {
4947 status = eHAL_STATUS_FAILURE;
4948 }
4949
4950 //release the lock for the sme object
4951 sme_ReleaseGlobalLock( &pMac->sme );
4952
4953 } while(0);
4954
4955 return status;
4956}
4957
4958/* ---------------------------------------------------------------------------
4959 \fn sme_OemDataReq
4960 \brief a wrapper function for OEM DATA REQ
4961 \param sessionId - session id to be used.
4962 \param pOemDataReqId - pointer to an object to get back the request ID
4963 \param callback - a callback function that is called upon finish
4964 \param pContext - a pointer passed in for the callback
4965 \return eHalStatus
4966 ---------------------------------------------------------------------------*/
4967eHalStatus sme_OemDataReq(tHalHandle hHal,
4968 tANI_U8 sessionId,
4969 tOemDataReqConfig *pOemDataReqConfig,
4970 tANI_U32 *pOemDataReqID,
4971 oemData_OemDataReqCompleteCallback callback,
4972 void *pContext)
4973{
4974 eHalStatus status = eHAL_STATUS_SUCCESS;
4975 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4976
4977 do
4978 {
4979 //acquire the lock for the sme object
4980 status = sme_AcquireGlobalLock(&pMac->sme);
4981 if(HAL_STATUS_SUCCESS(status))
4982 {
4983 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
4984
4985 if(pOemDataReqID)
4986 {
4987 *pOemDataReqID = lOemDataReqId;
4988 }
4989 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004990 {
4991 sme_ReleaseGlobalLock( &pMac->sme );
4992 return eHAL_STATUS_FAILURE;
4993 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004994
4995 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
4996
4997 //release the lock for the sme object
4998 sme_ReleaseGlobalLock( &pMac->sme );
4999 }
5000 } while(0);
5001
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005002 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005003
5004 return(status);
5005}
5006
5007#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005008
5009/*--------------------------------------------------------------------------
5010
5011 \brief sme_OpenSession() - Open a session for scan/roam operation.
5012
5013 This is a synchronous API.
5014
5015
5016 \param hHal - The handle returned by macOpen.
5017 \param callback - A pointer to the function caller specifies for roam/connect status indication
5018 \param pContext - The context passed with callback
5019 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5020 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5021
5022 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5023
5024 Other status means SME is failed to open the session.
5025 eHAL_STATUS_RESOURCES - no more session available.
5026 \sa
5027
5028 --------------------------------------------------------------------------*/
5029eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext,
5030 tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId)
5031{
5032 eHalStatus status;
5033 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5034
5035 if( NULL == pbSessionId )
5036 {
5037 status = eHAL_STATUS_INVALID_PARAMETER;
5038 }
5039 else
5040 {
5041 status = sme_AcquireGlobalLock( &pMac->sme );
5042 if ( HAL_STATUS_SUCCESS( status ) )
5043 {
5044 status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId );
5045
5046 sme_ReleaseGlobalLock( &pMac->sme );
5047 }
5048 }
5049
5050 return ( status );
5051}
5052
5053
5054/*--------------------------------------------------------------------------
5055
5056 \brief sme_CloseSession() - Open a session for scan/roam operation.
5057
5058 This is a synchronous API.
5059
5060
5061 \param hHal - The handle returned by macOpen.
5062
5063 \param sessionId - A previous opened session's ID.
5064
5065 \return eHAL_STATUS_SUCCESS - session is closed.
5066
5067 Other status means SME is failed to open the session.
5068 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5069 \sa
5070
5071 --------------------------------------------------------------------------*/
5072eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5073 csrRoamSessionCloseCallback callback, void *pContext)
5074{
5075 eHalStatus status;
5076 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5077
5078 status = sme_AcquireGlobalLock( &pMac->sme );
5079 if ( HAL_STATUS_SUCCESS( status ) )
5080 {
5081 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5082 callback, pContext );
5083
5084 sme_ReleaseGlobalLock( &pMac->sme );
5085 }
5086
5087 return ( status );
5088}
5089
Jeff Johnson295189b2012-06-20 16:38:30 -07005090/* ---------------------------------------------------------------------------
5091
5092 \fn sme_RoamUpdateAPWPSIE
5093
5094 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5095 This is an asynchronous API.
5096
5097 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5098
5099 \return eHalStatus – SUCCESS –
5100
5101 FAILURE or RESOURCES – The API finished and failed.
5102
5103 -------------------------------------------------------------------------------*/
5104eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5105{
5106
5107 eHalStatus status = eHAL_STATUS_FAILURE;
5108 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5109
5110 status = sme_AcquireGlobalLock( &pMac->sme );
5111 if ( HAL_STATUS_SUCCESS( status ) )
5112 {
5113
5114 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5115
5116 sme_ReleaseGlobalLock( &pMac->sme );
5117 }
5118
5119 return (status);
5120}
5121/* ---------------------------------------------------------------------------
5122
5123 \fn sme_RoamUpdateAPWPARSNIEs
5124
5125 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5126 This is an asynchronous API.
5127
5128 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5129
5130 \return eHalStatus – SUCCESS –
5131
5132 FAILURE or RESOURCES – The API finished and failed.
5133
5134 -------------------------------------------------------------------------------*/
5135eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5136{
5137
5138 eHalStatus status = eHAL_STATUS_FAILURE;
5139 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5140
5141 status = sme_AcquireGlobalLock( &pMac->sme );
5142 if ( HAL_STATUS_SUCCESS( status ) )
5143 {
5144
5145 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5146
5147 sme_ReleaseGlobalLock( &pMac->sme );
5148 }
5149
5150 return (status);
5151}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005152/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005153
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005154 \fn sme_ChangeMCCBeaconInterval
5155
5156 \brief To update P2P-GO beaconInterval. This function should be called after
5157 disassociating all the station is done
5158 This is an asynchronous API.
5159
5160 \param
5161
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005162 \return eHalStatus SUCCESS
5163 FAILURE or RESOURCES
5164 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005165
5166 -------------------------------------------------------------------------------*/
5167eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5168{
5169 eHalStatus status = eHAL_STATUS_FAILURE;
5170 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5171
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005172 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005173 status = sme_AcquireGlobalLock( &pMac->sme );
5174 if ( HAL_STATUS_SUCCESS( status ) )
5175 {
5176 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5177 sme_ReleaseGlobalLock( &pMac->sme );
5178 }
5179 return (status);
5180}
Jeff Johnson295189b2012-06-20 16:38:30 -07005181
5182/*-------------------------------------------------------------------------------*
5183
5184 \fn sme_sendBTAmpEvent
5185
5186 \brief to receive the coex priorty request from BT-AMP PAL
5187 and send the BT_AMP link state to HAL
5188
5189 \param btAmpEvent - btAmpEvent
5190
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005191 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005192
5193 FAILURE: API failed
5194
5195-------------------------------------------------------------------------------*/
5196
5197eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5198{
5199 vos_msg_t msg;
5200 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5201 eHalStatus status = eHAL_STATUS_FAILURE;
5202
5203 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5204 if (NULL == ptrSmeBtAmpEvent)
5205 {
5206 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005207 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005208 return status;
5209 }
5210
5211 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5212 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5213 msg.reserved = 0;
5214 msg.bodyptr = ptrSmeBtAmpEvent;
5215
5216 //status = halFW_SendBTAmpEventMesg(pMac, event);
5217
5218 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5219 {
5220 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005221 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005222 vos_mem_free(ptrSmeBtAmpEvent);
5223 return status;
5224 }
5225
5226 return eHAL_STATUS_SUCCESS;
5227
5228}
5229
5230/* ---------------------------------------------------------------------------
5231 \fn sme_SetHostOffload
5232 \brief API to set the host offload feature.
5233 \param hHal - The handle returned by macOpen.
5234 \param pRequest - Pointer to the offload request.
5235 \return eHalStatus
5236 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005237eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5238 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005239{
5240 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005241 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005242
5243 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5244 {
5245#ifdef WLAN_NS_OFFLOAD
5246 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5247 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005248 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005249 }
5250 else
5251#endif //WLAN_NS_OFFLOAD
5252 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005253 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005254 }
5255 sme_ReleaseGlobalLock( &pMac->sme );
5256 }
5257
5258 return (status);
5259}
5260
5261#ifdef WLAN_FEATURE_GTK_OFFLOAD
5262/* ---------------------------------------------------------------------------
5263 \fn sme_SetGTKOffload
5264 \brief API to set GTK offload information.
5265 \param hHal - The handle returned by macOpen.
5266 \param pRequest - Pointer to the GTK offload request.
5267 \return eHalStatus
5268 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005269eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5270 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005271{
5272 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5273 eHalStatus status;
5274
5275 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5276 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005277 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005278 sme_ReleaseGlobalLock( &pMac->sme );
5279 }
5280
5281 return (status);
5282}
5283
5284/* ---------------------------------------------------------------------------
5285 \fn sme_GetGTKOffload
5286 \brief API to get GTK offload information.
5287 \param hHal - The handle returned by macOpen.
5288 \param pRequest - Pointer to the GTK offload response.
5289 \return eHalStatus
5290 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005291eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5292 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005293{
5294 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5295 eHalStatus status;
5296
5297 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5298 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005299 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005300 sme_ReleaseGlobalLock( &pMac->sme );
5301 }
5302
5303 return (status);
5304}
5305#endif // WLAN_FEATURE_GTK_OFFLOAD
5306
5307/* ---------------------------------------------------------------------------
5308 \fn sme_SetKeepAlive
5309 \brief API to set the Keep Alive feature.
5310 \param hHal - The handle returned by macOpen.
5311 \param pRequest - Pointer to the Keep Alive request.
5312 \return eHalStatus
5313 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005314eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5315 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005316{
5317 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5318 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005319 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5320 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005321 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005322 sme_ReleaseGlobalLock( &pMac->sme );
5323 }
5324
5325 return (status);
5326}
5327
5328#ifdef FEATURE_WLAN_SCAN_PNO
5329/* ---------------------------------------------------------------------------
5330 \fn sme_SetPreferredNetworkList
5331 \brief API to set the Preferred Network List Offload feature.
5332 \param hHal - The handle returned by macOpen.
5333 \param pRequest - Pointer to the offload request.
5334 \return eHalStatus
5335 ---------------------------------------------------------------------------*/
5336eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5337{
5338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5339 eHalStatus status;
5340
5341 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5342 {
5343 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5344 sme_ReleaseGlobalLock( &pMac->sme );
5345 }
5346
5347 return (status);
5348}
5349
5350eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5351{
5352 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5353 eHalStatus status;
5354
5355 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5356 {
5357 pmcSetRssiFilter(hHal, rssiThreshold);
5358 sme_ReleaseGlobalLock( &pMac->sme );
5359 }
5360
5361 return (status);
5362}
5363
5364#endif // FEATURE_WLAN_SCAN_PNO
5365
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005366eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005367{
5368 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5369 eHalStatus status;
5370
5371 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5372 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005373 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005374 sme_ReleaseGlobalLock( &pMac->sme );
5375 }
5376
5377 return (status);
5378}
5379
5380/* ---------------------------------------------------------------------------
5381 \fn sme_AbortMacScan
5382 \brief API to cancel MAC scan.
5383 \param hHal - The handle returned by macOpen.
5384 \return VOS_STATUS
5385 VOS_STATUS_E_FAILURE - failure
5386 VOS_STATUS_SUCCESS success
5387 ---------------------------------------------------------------------------*/
5388eHalStatus sme_AbortMacScan(tHalHandle hHal)
5389{
5390 eHalStatus status;
5391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5392
5393 status = sme_AcquireGlobalLock( &pMac->sme );
5394 if ( HAL_STATUS_SUCCESS( status ) )
5395 {
5396 status = csrScanAbortMacScan(pMac);
5397
5398 sme_ReleaseGlobalLock( &pMac->sme );
5399 }
5400
5401 return ( status );
5402}
5403
5404/* ----------------------------------------------------------------------------
5405 \fn sme_GetOperationChannel
5406 \brief API to get current channel on which STA is parked
5407 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005408 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005409 \returns eHAL_STATUS_SUCCESS
5410 eHAL_STATUS_FAILURE
5411-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005412eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005413{
Jeff Johnson295189b2012-06-20 16:38:30 -07005414 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5415 tCsrRoamSession *pSession;
5416
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005417 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005418 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005419 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005420
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005421 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5422 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005423 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005424 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5425 {
5426 *pChannel =pSession->connectedProfile.operationChannel;
5427 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005428 }
5429 }
5430 return eHAL_STATUS_FAILURE;
5431}// sme_GetOperationChannel ends here
5432
Jeff Johnson295189b2012-06-20 16:38:30 -07005433/* ---------------------------------------------------------------------------
5434
5435 \fn sme_RegisterMgtFrame
5436
5437 \brief To register managment frame of specified type and subtype.
5438 \param frameType - type of the frame that needs to be passed to HDD.
5439 \param matchData - data which needs to be matched before passing frame
5440 to HDD.
5441 \param matchDataLen - Length of matched data.
5442 \return eHalStatus
5443 -------------------------------------------------------------------------------*/
5444eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5445 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5446{
5447 eHalStatus status = eHAL_STATUS_SUCCESS;
5448 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5449
5450 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5451 {
5452 tSirRegisterMgmtFrame *pMsg;
5453 tANI_U16 len;
5454 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005455
5456 if(!pSession)
5457 {
5458 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005459 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005460 return eHAL_STATUS_FAILURE;
5461 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005462
5463 if( !pSession->sessionActive )
5464 {
5465 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005466 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005467 sme_ReleaseGlobalLock( &pMac->sme );
5468 return eHAL_STATUS_FAILURE;
5469 }
5470
5471 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5472
5473 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5474 if(HAL_STATUS_SUCCESS(status))
5475 {
5476 palZeroMemory(pMac->hHdd, pMsg, len);
5477 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5478 pMsg->length = len;
5479 pMsg->sessionId = sessionId;
5480 pMsg->registerFrame = VOS_TRUE;
5481 pMsg->frameType = frameType;
5482 pMsg->matchLen = matchLen;
5483 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5484 status = palSendMBMessage(pMac->hHdd, pMsg);
5485 }
5486 sme_ReleaseGlobalLock( &pMac->sme );
5487 }
5488 return status;
5489}
5490
5491/* ---------------------------------------------------------------------------
5492
5493 \fn sme_DeregisterMgtFrame
5494
5495 \brief To De-register managment frame of specified type and subtype.
5496 \param frameType - type of the frame that needs to be passed to HDD.
5497 \param matchData - data which needs to be matched before passing frame
5498 to HDD.
5499 \param matchDataLen - Length of matched data.
5500 \return eHalStatus
5501 -------------------------------------------------------------------------------*/
5502eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5503 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5504{
5505 eHalStatus status = eHAL_STATUS_SUCCESS;
5506 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5507
5508 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5509 {
5510 tSirRegisterMgmtFrame *pMsg;
5511 tANI_U16 len;
5512 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005513
5514 if(!pSession)
5515 {
5516 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005517 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005518 return eHAL_STATUS_FAILURE;
5519 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005520
5521 if( !pSession->sessionActive )
5522 {
5523 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005524 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005525 sme_ReleaseGlobalLock( &pMac->sme );
5526 return eHAL_STATUS_FAILURE;
5527 }
5528
5529 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5530
5531 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5532 if(HAL_STATUS_SUCCESS(status))
5533 {
5534 palZeroMemory(pMac->hHdd, pMsg, len);
5535 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5536 pMsg->length = len;
5537 pMsg->registerFrame = VOS_FALSE;
5538 pMsg->frameType = frameType;
5539 pMsg->matchLen = matchLen;
5540 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5541 status = palSendMBMessage(pMac->hHdd, pMsg);
5542 }
5543 sme_ReleaseGlobalLock( &pMac->sme );
5544 }
5545 return status;
5546}
5547
5548/* ---------------------------------------------------------------------------
5549 \fn sme_RemainOnChannel
5550 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
5551 \param hHal - The handle returned by macOpen.
5552 \param pRequest - channel
5553 \param duration - duration in ms
5554 \param callback - HDD registered callback to process reaminOnChannelRsp
5555 \param context - HDD Callback param
5556 \return eHalStatus
5557 ---------------------------------------------------------------------------*/
5558
5559eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
5560 tANI_U8 channel, tANI_U32 duration,
5561 remainOnChanCallback callback,
5562 void *pContext)
5563{
5564 eHalStatus status = eHAL_STATUS_SUCCESS;
5565 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5566
5567 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5568 {
5569 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext
5570#ifdef WLAN_FEATURE_P2P_INTERNAL
5571 , eP2PRemainOnChnReasonUnknown
5572#endif
5573 );
5574 sme_ReleaseGlobalLock( &pMac->sme );
5575 }
5576 return(status);
5577}
5578
5579/* ---------------------------------------------------------------------------
5580 \fn sme_ReportProbeReq
5581 \brief API to enable/disable forwarding of probeReq to apps in p2p.
5582 \param hHal - The handle returned by macOpen.
5583 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
5584 \return eHalStatus
5585 ---------------------------------------------------------------------------*/
5586
5587#ifndef WLAN_FEATURE_CONCURRENT_P2P
5588eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
5589{
5590 eHalStatus status = eHAL_STATUS_SUCCESS;
5591 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5592
5593 do
5594 {
5595 //acquire the lock for the sme object
5596 status = sme_AcquireGlobalLock(&pMac->sme);
5597 if(HAL_STATUS_SUCCESS(status))
5598 {
5599 /* call set in context */
5600 pMac->p2pContext.probeReqForwarding = flag;
5601 //release the lock for the sme object
5602 sme_ReleaseGlobalLock( &pMac->sme );
5603 }
5604 } while(0);
5605
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005606 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005607
5608 return(status);
5609}
5610
5611/* ---------------------------------------------------------------------------
5612 \fn sme_updateP2pIe
5613 \brief API to set the P2p Ie in p2p context
5614 \param hHal - The handle returned by macOpen.
5615 \param p2pIe - Ptr to p2pIe from HDD.
5616 \param p2pIeLength: length of p2pIe
5617 \return eHalStatus
5618 ---------------------------------------------------------------------------*/
5619
5620eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
5621{
5622 eHalStatus status = eHAL_STATUS_SUCCESS;
5623 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5624
5625 //acquire the lock for the sme object
5626 status = sme_AcquireGlobalLock(&pMac->sme);
5627 if(HAL_STATUS_SUCCESS(status))
5628 {
5629 if(NULL != pMac->p2pContext.probeRspIe){
5630 vos_mem_free(pMac->p2pContext.probeRspIe);
5631 pMac->p2pContext.probeRspIeLength = 0;
5632 }
5633
5634 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
5635 if (NULL == pMac->p2pContext.probeRspIe)
5636 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005637 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005638 pMac->p2pContext.probeRspIeLength = 0;
5639 status = eHAL_STATUS_FAILURE;
5640 }
5641 else
5642 {
5643 pMac->p2pContext.probeRspIeLength = p2pIeLength;
5644
5645 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
5646 pMac->p2pContext.probeRspIe,
5647 pMac->p2pContext.probeRspIeLength );
5648 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
5649 p2pIeLength);
5650 }
5651
5652 //release the lock for the sme object
5653 sme_ReleaseGlobalLock( &pMac->sme );
5654 }
5655
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005656 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005657
5658 return(status);
5659}
5660#endif
5661
5662/* ---------------------------------------------------------------------------
5663 \fn sme_sendAction
5664 \brief API to send action frame from supplicant.
5665 \param hHal - The handle returned by macOpen.
5666 \return eHalStatus
5667 ---------------------------------------------------------------------------*/
5668
5669eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07005670 const tANI_U8 *pBuf, tANI_U32 len,
5671 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07005672{
5673 eHalStatus status = eHAL_STATUS_SUCCESS;
5674 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5675
5676 //acquire the lock for the sme object
5677 status = sme_AcquireGlobalLock(&pMac->sme);
5678 if(HAL_STATUS_SUCCESS(status))
5679 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005680 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07005681 //release the lock for the sme object
5682 sme_ReleaseGlobalLock( &pMac->sme );
5683 }
5684
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005685 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005686
5687 return(status);
5688}
5689
5690eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
5691{
5692 eHalStatus status = eHAL_STATUS_SUCCESS;
5693 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5694
5695 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5696 {
5697 status = p2pCancelRemainOnChannel (hHal, sessionId);
5698 sme_ReleaseGlobalLock( &pMac->sme );
5699 }
5700 return(status);
5701}
5702
5703//Power Save Related
5704eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
5705{
5706 eHalStatus status = eHAL_STATUS_SUCCESS;
5707 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5708
5709 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5710 {
5711 status = p2pSetPs (hHal, data);
5712 sme_ReleaseGlobalLock( &pMac->sme );
5713 }
5714 return(status);
5715}
5716
Jeff Johnson295189b2012-06-20 16:38:30 -07005717
5718/* ---------------------------------------------------------------------------
5719
5720 \fn sme_ConfigureRxpFilter
5721
5722 \brief
5723 SME will pass this request to lower mac to set/reset the filter on RXP for
5724 multicast & broadcast traffic.
5725
5726 \param
5727
5728 hHal - The handle returned by macOpen.
5729
5730 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
5731 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
5732 on this param. In future we can use this as a mask to set various types of
5733 filters as suggested below:
5734 FILTER_ALL_MULTICAST:
5735 FILTER_ALL_BROADCAST:
5736 FILTER_ALL_MULTICAST_BROADCAST:
5737
5738
5739 \return eHalStatus
5740
5741
5742--------------------------------------------------------------------------- */
5743eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
5744 tpSirWlanSetRxpFilters wlanRxpFilterParam)
5745{
5746 eHalStatus status = eHAL_STATUS_SUCCESS;
5747 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5748 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5749 vos_msg_t vosMessage;
5750
5751 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5752 {
5753 /* serialize the req through MC thread */
5754 vosMessage.bodyptr = wlanRxpFilterParam;
5755 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
5756 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5757 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5758 {
5759 status = eHAL_STATUS_FAILURE;
5760 }
5761 sme_ReleaseGlobalLock( &pMac->sme );
5762 }
5763 return(status);
5764}
5765
Jeff Johnson295189b2012-06-20 16:38:30 -07005766/* ---------------------------------------------------------------------------
5767
5768 \fn sme_ConfigureSuspendInd
5769
5770 \brief
5771 SME will pass this request to lower mac to Indicate that the wlan needs to
5772 be suspended
5773
5774 \param
5775
5776 hHal - The handle returned by macOpen.
5777
5778 wlanSuspendParam- Depicts the wlan suspend params
5779
5780
5781 \return eHalStatus
5782
5783
5784--------------------------------------------------------------------------- */
5785eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
5786 tpSirWlanSuspendParam wlanSuspendParam)
5787{
5788 eHalStatus status = eHAL_STATUS_SUCCESS;
5789 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5790 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5791 vos_msg_t vosMessage;
5792
5793 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5794 {
5795 /* serialize the req through MC thread */
5796 vosMessage.bodyptr = wlanSuspendParam;
5797 vosMessage.type = WDA_WLAN_SUSPEND_IND;
5798 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5799 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5800 {
5801 status = eHAL_STATUS_FAILURE;
5802 }
5803 sme_ReleaseGlobalLock( &pMac->sme );
5804 }
5805 return(status);
5806}
5807
5808/* ---------------------------------------------------------------------------
5809
5810 \fn sme_ConfigureResumeReq
5811
5812 \brief
5813 SME will pass this request to lower mac to Indicate that the wlan needs to
5814 be Resumed
5815
5816 \param
5817
5818 hHal - The handle returned by macOpen.
5819
5820 wlanResumeParam- Depicts the wlan resume params
5821
5822
5823 \return eHalStatus
5824
5825
5826--------------------------------------------------------------------------- */
5827eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
5828 tpSirWlanResumeParam wlanResumeParam)
5829{
5830 eHalStatus status = eHAL_STATUS_SUCCESS;
5831 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5832 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5833 vos_msg_t vosMessage;
5834
5835 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5836 {
5837 /* serialize the req through MC thread */
5838 vosMessage.bodyptr = wlanResumeParam;
5839 vosMessage.type = WDA_WLAN_RESUME_REQ;
5840 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5841 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5842 {
5843 status = eHAL_STATUS_FAILURE;
5844 }
5845 sme_ReleaseGlobalLock( &pMac->sme );
5846 }
5847 return(status);
5848}
5849
Jeff Johnson295189b2012-06-20 16:38:30 -07005850/* ---------------------------------------------------------------------------
5851
5852 \fn sme_GetInfraSessionId
5853
5854 \brief To get the session ID for infra session, if connected
5855 This is a synchronous API.
5856
5857 \param hHal - The handle returned by macOpen.
5858
5859 \return sessionid, -1 if infra session is not connected
5860
5861 -------------------------------------------------------------------------------*/
5862tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
5863{
5864 eHalStatus status = eHAL_STATUS_FAILURE;
5865 tANI_S8 sessionid = -1;
5866 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5867
5868 status = sme_AcquireGlobalLock( &pMac->sme );
5869 if ( HAL_STATUS_SUCCESS( status ) )
5870 {
5871
5872 sessionid = csrGetInfraSessionId( pMac);
5873
5874 sme_ReleaseGlobalLock( &pMac->sme );
5875 }
5876
5877 return (sessionid);
5878}
5879
5880/* ---------------------------------------------------------------------------
5881
5882 \fn sme_GetInfraOperationChannel
5883
5884 \brief To get the operating channel for infra session, if connected
5885 This is a synchronous API.
5886
5887 \param hHal - The handle returned by macOpen.
5888 \param sessionId - the sessionId returned by sme_OpenSession.
5889
5890 \return operating channel, 0 if infra session is not connected
5891
5892 -------------------------------------------------------------------------------*/
5893tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
5894{
5895 eHalStatus status = eHAL_STATUS_FAILURE;
5896 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5897 tANI_U8 channel = 0;
5898 status = sme_AcquireGlobalLock( &pMac->sme );
5899 if ( HAL_STATUS_SUCCESS( status ) )
5900 {
5901
5902 channel = csrGetInfraOperationChannel( pMac, sessionId);
5903
5904 sme_ReleaseGlobalLock( &pMac->sme );
5905 }
5906
5907 return (channel);
5908}
5909
5910//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
5911//If other BSS is not up or not connected it will return 0
5912tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
5913{
5914 eHalStatus status = eHAL_STATUS_FAILURE;
5915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5916 tANI_U8 channel = 0;
5917 status = sme_AcquireGlobalLock( &pMac->sme );
5918 if ( HAL_STATUS_SUCCESS( status ) )
5919 {
5920
5921 channel = csrGetConcurrentOperationChannel( pMac );
5922 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005923 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07005924 sme_ReleaseGlobalLock( &pMac->sme );
5925 }
5926
5927 return (channel);
5928}
5929
5930#ifdef FEATURE_WLAN_SCAN_PNO
5931/******************************************************************************
5932*
5933* Name: sme_PreferredNetworkFoundInd
5934*
5935* Description:
5936* Invoke Preferred Network Found Indication
5937*
5938* Parameters:
5939* hHal - HAL handle for device
5940* pMsg - found network description
5941*
5942* Returns: eHalStatus
5943*
5944******************************************************************************/
5945eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
5946{
5947 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5948 eHalStatus status = eHAL_STATUS_SUCCESS;
5949 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
5950
5951 if (NULL == pMsg)
5952 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005953 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005954 status = eHAL_STATUS_FAILURE;
5955 }
5956 else
5957 {
5958 if (pPrefNetworkFoundInd->ssId.length > 0)
5959 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005960 smsLog(pMac, LOG1, "Preferred Network Found Indication in %s(), SSID=%s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005961 __func__, pPrefNetworkFoundInd->ssId.ssId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005962
5963
5964 /* Call Preferred Netowrk Found Indication callback routine. */
5965 if (pMac->pmc.prefNetwFoundCB != NULL)
5966 {
5967 pMac->pmc.prefNetwFoundCB(pMac->pmc.preferredNetworkFoundIndCallbackContext, pPrefNetworkFoundInd);
5968 }
5969
5970 }
5971 else
5972 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005973 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005974 status = eHAL_STATUS_FAILURE;
5975 }
5976 }
5977
5978
5979 return(status);
5980}
5981
5982#endif // FEATURE_WLAN_SCAN_PNO
5983
5984
5985eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
5986{
5987 eHalStatus status = eHAL_STATUS_FAILURE;
5988 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5989
5990 status = sme_AcquireGlobalLock( &pMac->sme );
5991 if ( HAL_STATUS_SUCCESS( status ) )
5992 {
5993 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
5994 sme_ReleaseGlobalLock( &pMac->sme );
5995 }
5996
5997 return (status);
5998}
5999
6000
6001/* ---------------------------------------------------------------------------
6002
6003 \fn sme_SetTxPerTracking
6004
6005 \brief Set Tx PER tracking configuration parameters
6006
6007 \param hHal - The handle returned by macOpen.
6008 \param pTxPerTrackingConf - Tx PER configuration parameters
6009
6010 \return eHalStatus
6011
6012 -------------------------------------------------------------------------------*/
6013eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6014 void (*pCallbackfn) (void *pCallbackContext),
6015 void *pCallbackContext,
6016 tpSirTxPerTrackingParam pTxPerTrackingParam)
6017{
6018 vos_msg_t msg;
6019 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6020 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6021
6022 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6023 {
6024 pMac->sme.pTxPerHitCallback = pCallbackfn;
6025 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6026 sme_ReleaseGlobalLock( &pMac->sme );
6027 }
6028
6029 // free this memory in failure case or WDA request callback function
6030 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6031 if (NULL == pTxPerTrackingParamReq)
6032 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006033 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 -07006034 return eHAL_STATUS_FAILURE;
6035 }
6036
6037 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
6038 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6039 msg.reserved = 0;
6040 msg.bodyptr = pTxPerTrackingParamReq;
6041
6042 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6043 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006044 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 -07006045 vos_mem_free(pTxPerTrackingParamReq);
6046 return eHAL_STATUS_FAILURE;
6047 }
6048
6049 return eHAL_STATUS_SUCCESS;
6050}
6051
6052/* ---------------------------------------------------------------------------
6053
6054 \fn sme_HandleChangeCountryCode
6055
6056 \brief Change Country code, Reg Domain and channel list
6057
6058 \details Country Code Priority
6059 0 = 11D > Configured Country > NV
6060 1 = Configured Country > 11D > NV
6061 If Supplicant country code is priority than 11d is disabled.
6062 If 11D is enabled, we update the country code after every scan.
6063 Hence when Supplicant country code is priority, we don't need 11D info.
6064 Country code from Supplicant is set as current courtry code.
6065 User can send reset command XX (instead of country code) to reset the
6066 country code to default values which is read from NV.
6067 In case of reset, 11D is enabled and default NV code is Set as current country code
6068 If 11D is priority,
6069 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6070
6071 \param pMac - The handle returned by macOpen.
6072 \param pMsgBuf - MSG Buffer
6073
6074 \return eHalStatus
6075
6076 -------------------------------------------------------------------------------*/
6077eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6078{
6079 eHalStatus status = eHAL_STATUS_SUCCESS;
6080 tAniChangeCountryCodeReq *pMsg;
6081 v_REGDOMAIN_t domainIdIoctl;
6082 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6083 static uNvTables nvTables;
6084 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6085
6086
6087 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6088 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6089 {
6090 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6091
6092 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6093
6094 /* read the country code from NV and use it */
6095 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6096 {
6097 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6098 }
6099 else
6100 {
6101 status = eHAL_STATUS_FAILURE;
6102 return status;
6103 }
6104 }
6105 else
6106 {
6107 /* if Supplicant country code has priority, disable 11d */
6108 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
6109 {
6110 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6111 }
6112 }
6113
6114 /* WEXT set country code means
6115 * 11D should be supported?
6116 * 11D Channel should be enforced?
6117 * 11D Country code should be matched?
6118 * 11D Reg Domian should be matched?
6119 * Country string changed */
6120 if(pMac->roam.configParam.Is11dSupportEnabled &&
6121 pMac->roam.configParam.fEnforce11dChannels &&
6122 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6123 pMac->roam.configParam.fEnforceDefaultDomain &&
6124 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6125 {
6126 /* All 11D related options are already enabled
6127 * Country string is not changed
6128 * Do not need do anything for country code change request */
6129 return eHAL_STATUS_SUCCESS;
6130 }
6131
6132 /* Set Current Country code and Current Regulatory domain */
6133 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6134 if(eHAL_STATUS_SUCCESS != status)
6135 {
6136 /* Supplicant country code failed. So give 11D priority */
6137 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6138 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6139 return status;
6140 }
6141
6142 /* purge current scan results
6143 if i don't do this than I still get old ap's (of different country code) as available (even if they are powered off).
6144 Looks like a bug in current scan sequence.
6145 */
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07006146 csrScanFlushResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07006147
6148 /* overwrite the defualt country code */
6149 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6150
6151 /* Get Domain ID from country code */
6152 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6153 if ( status != eHAL_STATUS_SUCCESS )
6154 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006155 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006156 return status;
6157 }
6158
6159 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6160
6161 if ( status != eHAL_STATUS_SUCCESS )
6162 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006163 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006164 return status;
6165 }
6166
6167 /* set to default domain ID */
6168 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6169
6170 /* get the channels based on new cc */
6171 status = csrInitGetChannels( pMac );
6172
6173 if ( status != eHAL_STATUS_SUCCESS )
6174 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006175 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006176 return status;
6177 }
6178
6179 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006180 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006181 if( pMsg->changeCCCallback )
6182 {
6183 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6184 }
6185
6186 return eHAL_STATUS_SUCCESS;
6187}
6188
6189#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006190eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006191{
6192 tpSirRcvFltMcAddrList pRequestBuf;
6193 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006194 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006195 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006196
6197 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006198 "ulMulticastAddrCnt=%d, multicastAddr[0]=%d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006199 pMulticastAddrs->ulMulticastAddrCnt,
6200 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006201
6202 /*
6203 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006204 */
6205 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6206 csrIsConnStateInfra(pMac, sessionId))
6207 {
6208 pSession = CSR_GET_SESSION( pMac, sessionId );
6209 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006210
6211 if(pSession == NULL )
6212 {
6213 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006214 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006215 return eHAL_STATUS_FAILURE;
6216 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006217
Jeff Johnson295189b2012-06-20 16:38:30 -07006218 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6219 if (NULL == pRequestBuf)
6220 {
6221 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006222 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006223 return eHAL_STATUS_FAILED_ALLOC;
6224 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006225
6226 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6227 {
6228 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6229 "indication as we are not connected", __func__);
6230 vos_mem_free(pRequestBuf);
6231 return eHAL_STATUS_FAILURE;
6232 }
6233
Jeff Johnson295189b2012-06-20 16:38:30 -07006234 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6235
Jeff Johnsone7245742012-09-05 17:12:55 -07006236 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6237 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6238 sizeof(tSirMacAddr));
6239
Jeff Johnson295189b2012-06-20 16:38:30 -07006240 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6241 msg.reserved = 0;
6242 msg.bodyptr = pRequestBuf;
6243 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6244 {
6245 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006246 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006247 vos_mem_free(pRequestBuf);
6248 return eHAL_STATUS_FAILURE;
6249 }
6250
6251 return eHAL_STATUS_SUCCESS;
6252}
6253
Jeff Johnsone7245742012-09-05 17:12:55 -07006254eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6255 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006256{
6257 tpSirRcvPktFilterCfgType pRequestBuf;
6258 v_SINT_t allocSize;
6259 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006260 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6261 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006262 v_U8_t idx=0;
6263
6264 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006265 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006266 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6267
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006268 allocSize = sizeof(tSirRcvPktFilterCfgType);
6269
Jeff Johnson295189b2012-06-20 16:38:30 -07006270 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006271
6272 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006273 {
6274 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006275 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006276 return eHAL_STATUS_FAILED_ALLOC;
6277 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006278
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006279 if( NULL == pSession )
6280 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006281 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006282 vos_mem_free(pRequestBuf);
6283 return eHAL_STATUS_FAILURE;
6284 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006285
6286 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6287 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006288 sizeof(tSirMacAddr));
6289
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006290 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6291
Jeff Johnson295189b2012-06-20 16:38:30 -07006292 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6293 msg.reserved = 0;
6294 msg.bodyptr = pRequestBuf;
6295
6296 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6297 "FT %d FID %d ",
6298 pRequestBuf->filterType, pRequestBuf->filterId);
6299
6300 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6301 "params %d CT %d",
6302 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6303
6304 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6305 {
6306
6307 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006308 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006309 pRequestBuf->paramsData[idx].protocolLayer,
6310 pRequestBuf->paramsData[idx].cmpFlag);
6311
6312 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006313 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006314 pRequestBuf->paramsData[idx].dataOffset,
6315 pRequestBuf->paramsData[idx].dataLength);
6316
6317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006318 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006319 pRequestBuf->paramsData[idx].compareData[0],
6320 pRequestBuf->paramsData[idx].compareData[1],
6321 pRequestBuf->paramsData[idx].compareData[2],
6322 pRequestBuf->paramsData[idx].compareData[3],
6323 pRequestBuf->paramsData[idx].compareData[4],
6324 pRequestBuf->paramsData[idx].compareData[5]);
6325
6326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006327 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006328 pRequestBuf->paramsData[idx].dataMask[0],
6329 pRequestBuf->paramsData[idx].dataMask[1],
6330 pRequestBuf->paramsData[idx].dataMask[2],
6331 pRequestBuf->paramsData[idx].dataMask[3],
6332 pRequestBuf->paramsData[idx].dataMask[4],
6333 pRequestBuf->paramsData[idx].dataMask[5]);
6334
6335 }
6336
6337 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6338 {
6339 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006340 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006341 vos_mem_free(pRequestBuf);
6342 return eHAL_STATUS_FAILURE;
6343 }
6344
6345 return eHAL_STATUS_SUCCESS;
6346}
6347
6348eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6349 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006350 void *callbackContext,
6351 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006352{
6353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6354 eHalStatus status;
6355
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006356 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006357
6358 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6359 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006360 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006361 sme_ReleaseGlobalLock( &pMac->sme );
6362 }
6363
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006364 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006365
6366 return (status);
6367}
6368
Jeff Johnsone7245742012-09-05 17:12:55 -07006369eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6370 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006371{
6372 tpSirRcvFltPktClearParam pRequestBuf;
6373 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006374 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6375 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006376
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006377 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006378 pRcvFltPktClearParam->filterId);
6379
6380 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006381 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006382 {
6383 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6384 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006385 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006386 return eHAL_STATUS_FAILED_ALLOC;
6387 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006388 if( NULL == pSession )
6389 {
6390 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006391 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006392 vos_mem_free(pRequestBuf);
6393 return eHAL_STATUS_FAILURE;
6394 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006395
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006396 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6397 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006398 sizeof(tSirMacAddr));
6399
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006400 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6401
Jeff Johnson295189b2012-06-20 16:38:30 -07006402 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6403 msg.reserved = 0;
6404 msg.bodyptr = pRequestBuf;
6405 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6406 {
6407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006408 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006409 vos_mem_free(pRequestBuf);
6410 return eHAL_STATUS_FAILURE;
6411 }
6412
6413 return eHAL_STATUS_SUCCESS;
6414}
6415#endif // WLAN_FEATURE_PACKET_FILTERING
6416
6417/* ---------------------------------------------------------------------------
6418 \fn sme_PreChannelSwitchIndFullPowerCB
6419 \brief call back function for the PMC full power request because of pre
6420 channel switch.
6421 \param callbackContext
6422 \param status
6423 ---------------------------------------------------------------------------*/
6424void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6425 eHalStatus status)
6426{
6427 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6428 tSirMbMsg *pMsg;
6429 tANI_U16 msgLen;
6430
6431 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6432 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6433 if(HAL_STATUS_SUCCESS(status))
6434 {
6435 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6436 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6437 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6438 status = palSendMBMessage(pMac->hHdd, pMsg);
6439 }
6440
6441 return;
6442}
6443
6444/* ---------------------------------------------------------------------------
6445 \fn sme_HandlePreChannelSwitchInd
6446 \brief Processes the indcation from PE for pre-channel switch.
6447 \param hHal
6448 \- The handle returned by macOpen. return eHalStatus
6449 ---------------------------------------------------------------------------*/
6450eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6451{
6452 eHalStatus status = eHAL_STATUS_FAILURE;
6453 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6454 status = sme_AcquireGlobalLock( &pMac->sme );
6455 if ( HAL_STATUS_SUCCESS( status ) )
6456 {
6457 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6458 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6459 sme_ReleaseGlobalLock( &pMac->sme );
6460 }
6461
6462 return (status);
6463}
6464
6465/* ---------------------------------------------------------------------------
6466 \fn sme_HandlePostChannelSwitchInd
6467 \brief Processes the indcation from PE for post-channel switch.
6468 \param hHal
6469 \- The handle returned by macOpen. return eHalStatus
6470 ---------------------------------------------------------------------------*/
6471eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6472{
6473 eHalStatus status = eHAL_STATUS_FAILURE;
6474 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6475
6476 status = sme_AcquireGlobalLock( &pMac->sme );
6477 if ( HAL_STATUS_SUCCESS( status ) )
6478 {
6479 status = pmcRequestBmps(hHal, NULL, NULL);
6480 sme_ReleaseGlobalLock( &pMac->sme );
6481 }
6482
6483 return (status);
6484}
6485
6486/* ---------------------------------------------------------------------------
6487
6488 \fn sme_IsChannelValid
6489
6490 \brief To check if the channel is valid for currently established domain
6491 This is a synchronous API.
6492
6493 \param hHal - The handle returned by macOpen.
6494 \param channel - channel to verify
6495
6496 \return TRUE/FALSE, TRUE if channel is valid
6497
6498 -------------------------------------------------------------------------------*/
6499tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6500{
6501 eHalStatus status = eHAL_STATUS_FAILURE;
6502 tANI_BOOLEAN valid = FALSE;
6503 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6504
6505 status = sme_AcquireGlobalLock( &pMac->sme );
6506 if ( HAL_STATUS_SUCCESS( status ) )
6507 {
6508
6509 valid = csrRoamIsChannelValid( pMac, channel);
6510
6511 sme_ReleaseGlobalLock( &pMac->sme );
6512 }
6513
6514 return (valid);
6515}
6516
6517/* ---------------------------------------------------------------------------
6518 \fn sme_SetFreqBand
6519 \brief Used to set frequency band.
6520 \param hHal
6521 \eBand band value to be configured
6522 \- return eHalStatus
6523 -------------------------------------------------------------------------*/
6524eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
6525{
6526 eHalStatus status = eHAL_STATUS_FAILURE;
6527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6528
6529 status = sme_AcquireGlobalLock( &pMac->sme );
6530 if ( HAL_STATUS_SUCCESS( status ) )
6531 {
6532 status = csrSetBand(hHal, eBand);
6533 sme_ReleaseGlobalLock( &pMac->sme );
6534 }
6535 return status;
6536}
6537
6538/* ---------------------------------------------------------------------------
6539 \fn sme_GetFreqBand
6540 \brief Used to get the current band settings.
6541 \param hHal
6542 \pBand pointer to hold band value
6543 \- return eHalStatus
6544 -------------------------------------------------------------------------*/
6545eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
6546{
6547 eHalStatus status = eHAL_STATUS_FAILURE;
6548 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6549
6550 status = sme_AcquireGlobalLock( &pMac->sme );
6551 if ( HAL_STATUS_SUCCESS( status ) )
6552 {
6553 *pBand = csrGetCurrentBand( hHal );
6554 sme_ReleaseGlobalLock( &pMac->sme );
6555 }
6556 return status;
6557}
6558
6559#ifdef WLAN_WAKEUP_EVENTS
6560/******************************************************************************
6561 \fn sme_WakeReasonIndCallback
6562
6563 \brief
6564 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
6565
6566 \param hHal - HAL handle for device
6567 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
6568
6569 \return eHalStatus
6570******************************************************************************/
6571eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
6572{
6573 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6574 eHalStatus status = eHAL_STATUS_SUCCESS;
6575 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
6576
6577 if (NULL == pMsg)
6578 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006579 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006580 status = eHAL_STATUS_FAILURE;
6581 }
6582 else
6583 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006584 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07006585
6586 /* Call Wake Reason Indication callback routine. */
6587 if (pMac->pmc.wakeReasonIndCB != NULL)
6588 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
6589
6590 pMac->pmc.wakeReasonIndCB = NULL;
6591 pMac->pmc.wakeReasonIndCBContext = NULL;
6592
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006593 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07006594 }
6595
6596 return(status);
6597}
6598#endif // WLAN_WAKEUP_EVENTS
6599
6600
6601/* ---------------------------------------------------------------------------
6602
6603 \fn sme_SetMaxTxPower
6604
6605 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
6606 not persist over reboots.
6607
6608 \param hHal
6609 \param pBssid BSSID to set the power cap for
6610 \param pBssid pSelfMacAddress self MAC Address
6611 \param pBssid power to set in dB
6612 \- return eHalStatus
6613
6614 -------------------------------------------------------------------------------*/
6615eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
6616 tSirMacAddr pSelfMacAddress, v_S7_t dB)
6617{
6618 vos_msg_t msg;
6619 tpMaxTxPowerParams pMaxTxParams = NULL;
6620
6621 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
6622 if (NULL == pMaxTxParams)
6623 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006624 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 -07006625 return eHAL_STATUS_FAILURE;
6626 }
6627
6628 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
6629 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
6630 SIR_MAC_ADDR_LENGTH);
6631 pMaxTxParams->power = dB;
6632
6633 msg.type = WDA_SET_MAX_TX_POWER_REQ;
6634 msg.reserved = 0;
6635 msg.bodyptr = pMaxTxParams;
6636
6637 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6638 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006639 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 -07006640 vos_mem_free(pMaxTxParams);
6641 return eHAL_STATUS_FAILURE;
6642 }
6643
6644 return eHAL_STATUS_SUCCESS;
6645}
6646
Jeff Johnson295189b2012-06-20 16:38:30 -07006647/* ---------------------------------------------------------------------------
6648
schang86c22c42013-03-13 18:41:24 -07006649 \fn sme_SetTxPower
6650
6651 \brief Set Transmit Power dynamically. Note: this setting will
6652 not persist over reboots.
6653
6654 \param hHal
6655 \param sessionId Target Session ID
6656 \param mW power to set in mW
6657 \- return eHalStatus
6658
6659 -------------------------------------------------------------------------------*/
6660eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
6661{
6662
6663 eHalStatus status = eHAL_STATUS_FAILURE;
6664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6665
6666 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
6667 status = sme_AcquireGlobalLock(&pMac->sme);
6668 if (HAL_STATUS_SUCCESS(status))
6669 {
6670 status = csrSetTxPower(pMac, sessionId, mW);
6671 sme_ReleaseGlobalLock(&pMac->sme);
6672 }
6673 return status;
6674}
6675
6676/* ---------------------------------------------------------------------------
6677
Jeff Johnson295189b2012-06-20 16:38:30 -07006678 \fn sme_HideSSID
6679
6680 \brief hide/show SSID dynamically. Note: this setting will
6681 not persist over reboots.
6682
6683 \param hHal
6684 \param sessionId
6685 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
6686 \- return eHalStatus
6687
6688 -------------------------------------------------------------------------------*/
6689eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
6690{
6691 eHalStatus status = eHAL_STATUS_SUCCESS;
6692 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6693 tANI_U16 len;
6694
6695 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6696 {
6697 tpSirUpdateParams pMsg;
6698 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006699
6700 if(!pSession)
6701 {
6702 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006703 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006704 return eHAL_STATUS_FAILURE;
6705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006706
6707 if( !pSession->sessionActive )
6708 VOS_ASSERT(0);
6709
6710 /* Create the message and send to lim */
6711 len = sizeof(tSirUpdateParams);
6712 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
6713 if(HAL_STATUS_SUCCESS(status))
6714 {
6715 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
6716 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
6717 pMsg->length = len;
6718 /* Data starts from here */
6719 pMsg->sessionId = sessionId;
6720 pMsg->ssidHidden = ssidHidden;
6721 status = palSendMBMessage(pMac->hHdd, pMsg);
6722 }
6723 sme_ReleaseGlobalLock( &pMac->sme );
6724 }
6725 return status;
6726}
Jeff Johnson295189b2012-06-20 16:38:30 -07006727
6728/* ---------------------------------------------------------------------------
6729
6730 \fn sme_SetTmLevel
6731 \brief Set Thermal Mitigation Level to RIVA
6732 \param hHal - The handle returned by macOpen.
6733 \param newTMLevel - new Thermal Mitigation Level
6734 \param tmMode - Thermal Mitigation handle mode, default 0
6735 \return eHalStatus
6736 ---------------------------------------------------------------------------*/
6737eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
6738{
6739 eHalStatus status = eHAL_STATUS_SUCCESS;
6740 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6741 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6742 vos_msg_t vosMessage;
6743 tAniSetTmLevelReq *setTmLevelReq = NULL;
6744
6745 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6746 {
6747 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
6748 if(NULL == setTmLevelReq)
6749 {
6750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006751 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006752 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07006753 return eHAL_STATUS_FAILURE;
6754 }
6755
6756 setTmLevelReq->tmMode = tmMode;
6757 setTmLevelReq->newTmLevel = newTMLevel;
6758
6759 /* serialize the req through MC thread */
6760 vosMessage.bodyptr = setTmLevelReq;
6761 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
6762 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6763 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6764 {
6765 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006766 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006767 vos_mem_free(setTmLevelReq);
6768 status = eHAL_STATUS_FAILURE;
6769 }
6770 sme_ReleaseGlobalLock( &pMac->sme );
6771 }
6772 return(status);
6773}
6774
6775/*---------------------------------------------------------------------------
6776
6777 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
6778 Host and FW.
6779
6780 \param hHal - HAL handle for device
6781
6782 \return NONE
6783
6784---------------------------------------------------------------------------*/
6785void sme_featureCapsExchange( tHalHandle hHal)
6786{
6787 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6788 WDA_featureCapsExchange(vosContext);
6789}
Jeff Johnsond13512a2012-07-17 11:42:19 -07006790
Yathish9f22e662012-12-10 14:21:35 -08006791/*---------------------------------------------------------------------------
6792
6793 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
6794 in Host.
6795
6796 \param hHal - HAL handle for device
6797
6798 \return NONE
6799
6800---------------------------------------------------------------------------*/
6801void sme_disableFeatureCapablity(tANI_U8 feature_index)
6802{
6803 WDA_disableCapablityFeature(feature_index);
6804}
6805
6806
Jeff Johnsond13512a2012-07-17 11:42:19 -07006807
6808/* ---------------------------------------------------------------------------
6809
6810 \fn sme_GetDefaultCountryCode
6811
6812 \brief Get the default country code from NV
6813
6814 \param hHal
6815 \param pCountry
6816 \- return eHalStatus
6817
6818 -------------------------------------------------------------------------------*/
6819eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
6820{
6821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6822 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
6823}
6824
6825/* ---------------------------------------------------------------------------
6826
6827 \fn sme_GetCurrentCountryCode
6828
6829 \brief Get the current country code
6830
6831 \param hHal
6832 \param pCountry
6833 \- return eHalStatus
6834
6835 -------------------------------------------------------------------------------*/
6836eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
6837{
6838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6839 return csrGetCurrentCountryCode(pMac, pCountry);
6840}
6841
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006842/* ---------------------------------------------------------------------------
6843 \fn sme_transportDebug
6844 \brief Dynamically monitoring Transport channels
6845 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07006846 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08006847 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006848 \param toggleStallDetect Enable stall detect feature
6849 This feature will take effect to data performance
6850 Not integrate till fully verification
6851 \- return NONE
6852 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07006853void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006854{
schang6295e542013-03-12 15:31:23 -07006855 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6856
6857 if (NULL == pMac)
6858 {
6859 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6860 "%s: invalid context", __func__);
6861 return;
6862 }
6863 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07006864}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006865
Kiran4a17ebe2013-01-31 10:43:43 -08006866/* ---------------------------------------------------------------------------
6867 \fn sme_ResetPowerValuesFor5G
6868 \brief Reset the power values for 5G band with NV power values.
6869 \param hHal - HAL handle for device
6870 \- return NONE
6871 -------------------------------------------------------------------------*/
6872void sme_ResetPowerValuesFor5G (tHalHandle hHal)
6873{
6874 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
6875 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
6876 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
6877}
6878
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006879#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
6880/* ---------------------------------------------------------------------------
6881 \fn sme_UpdateRoamPrefer5GHz
6882 \brief enable/disable Roam prefer 5G runtime option
6883 This function is called through dynamic setConfig callback function
6884 to configure the Roam prefer 5G runtime option
6885 \param hHal - HAL handle for device
6886 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
6887 \- return Success or failure
6888 -------------------------------------------------------------------------*/
6889
6890eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
6891{
6892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006893 eHalStatus status = eHAL_STATUS_SUCCESS;
6894
6895 status = sme_AcquireGlobalLock( &pMac->sme );
6896 if ( HAL_STATUS_SUCCESS( status ) )
6897 {
6898 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6899 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
6900 pMac->roam.configParam.nRoamPrefer5GHz,
6901 nRoamPrefer5GHz);
6902 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
6903 sme_ReleaseGlobalLock( &pMac->sme );
6904 }
6905
6906 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006907}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006908
6909/* ---------------------------------------------------------------------------
6910 \fn sme_UpdateImmediateRoamRssiDiff
6911 \brief Update nImmediateRoamRssiDiff
6912 This function is called through dynamic setConfig callback function
6913 to configure nImmediateRoamRssiDiff
6914 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
6915 \param hHal - HAL handle for device
6916 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
6917 candidate and current AP.
6918 \- return Success or failure
6919 -------------------------------------------------------------------------*/
6920
6921eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
6922{
6923 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006924 eHalStatus status = eHAL_STATUS_SUCCESS;
6925
6926 status = sme_AcquireGlobalLock( &pMac->sme );
6927 if ( HAL_STATUS_SUCCESS( status ) )
6928 {
6929 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
6930 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
6931 nImmediateRoamRssiDiff,
6932 pMac->roam.configParam.nImmediateRoamRssiDiff,
6933 pMac->roam.neighborRoamInfo.neighborRoamState);
6934 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
6935 sme_ReleaseGlobalLock( &pMac->sme );
6936 }
6937
6938 return status ;
6939}
6940
6941/* ---------------------------------------------------------------------------
6942 \fn sme_UpdateRoamRssiDiff
6943 \brief Update RoamRssiDiff
6944 This function is called through dynamic setConfig callback function
6945 to configure RoamRssiDiff
6946 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
6947 \param hHal - HAL handle for device
6948 \param RoamRssiDiff - minimum rssi difference between potential
6949 candidate and current AP.
6950 \- return Success or failure
6951 -------------------------------------------------------------------------*/
6952
6953eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
6954{
6955 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6956 eHalStatus status = eHAL_STATUS_SUCCESS;
6957
6958 status = sme_AcquireGlobalLock( &pMac->sme );
6959 if ( HAL_STATUS_SUCCESS( status ) )
6960 {
6961 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
6962 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
6963 RoamRssiDiff,
6964 pMac->roam.configParam.RoamRssiDiff,
6965 pMac->roam.neighborRoamInfo.neighborRoamState);
6966 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
6967 sme_ReleaseGlobalLock( &pMac->sme );
6968 }
6969
6970 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006971}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006972
6973/*--------------------------------------------------------------------------
6974 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
6975 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
6976 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08006977 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006978 \param hHal - The handle returned by macOpen.
6979 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
6980 Other status means SME is failed to update isFastTransitionEnabled.
6981 \sa
6982 --------------------------------------------------------------------------*/
6983eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
6984 v_BOOL_t isFastTransitionEnabled)
6985{
6986 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006987 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006988
Srinivas Girigowdade697412013-02-14 16:31:48 -08006989 status = sme_AcquireGlobalLock( &pMac->sme );
6990 if ( HAL_STATUS_SUCCESS( status ) )
6991 {
6992 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6993 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
6994 pMac->roam.configParam.isFastTransitionEnabled,
6995 isFastTransitionEnabled);
6996 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
6997 sme_ReleaseGlobalLock( &pMac->sme );
6998 }
6999
7000 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007001}
7002#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
7003
7004#ifdef FEATURE_WLAN_LFR
7005/*--------------------------------------------------------------------------
7006 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
7007 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7008 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007009 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007010 \param hHal - The handle returned by macOpen.
7011 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
7012 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
7013 \sa
7014 --------------------------------------------------------------------------*/
7015eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
7016 v_BOOL_t isFastRoamIniFeatureEnabled)
7017{
7018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7019
Srinivas Girigowdade697412013-02-14 16:31:48 -08007020 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7021 "%s: FastRoamEnabled is changed from %d to %d", __func__,
7022 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7023 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007024 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
7025
7026 if(TRUE == isFastRoamIniFeatureEnabled)
7027 {
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007028 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7029 }
7030 else
7031 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007032 /* CCX also depend on FW Monitoring.
7033 Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007034#ifdef FEATURE_WLAN_CCX
7035 if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007036#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007037 {
7038 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Srinivas Girigowdade697412013-02-14 16:31:48 -08007039 "%s: Turn off FW Monitoring", __func__);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007040 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7041 }
7042 }
7043
7044 return eHAL_STATUS_SUCCESS;
7045}
7046#endif /* FEATURE_WLAN_LFR */
7047
7048#ifdef FEATURE_WLAN_CCX
7049/*--------------------------------------------------------------------------
7050 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
7051 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7052 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007053 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007054 \param hHal - The handle returned by macOpen.
7055 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
7056 Other status means SME is failed to update isCcxIniFeatureEnabled.
7057 \sa
7058 --------------------------------------------------------------------------*/
7059
7060eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
7061 v_BOOL_t isCcxIniFeatureEnabled)
7062{
7063 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7064
Srinivas Girigowdade697412013-02-14 16:31:48 -08007065 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7066 "%s: CcxEnabled is changed from %d to %d", __func__,
7067 pMac->roam.configParam.isCcxIniFeatureEnabled,
7068 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007069 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
7070
7071 if(TRUE == isCcxIniFeatureEnabled)
7072 {
7073 sme_UpdateFastTransitionEnabled(hHal, TRUE);
7074 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7075 }
7076 else
7077 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007078 /* LFR also depend on FW Monitoring.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007079 Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */
7080#ifdef FEATURE_WLAN_LFR
7081 if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled)
7082#endif
7083 {
7084 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7085 "%s: Turn off FW Monitoring/Fast Transition", __func__);
7086 sme_UpdateFastTransitionEnabled(hHal, FALSE);
7087 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7088 }
7089 }
7090 return eHAL_STATUS_SUCCESS;
7091}
7092#endif /* FEATURE_WLAN_CCX */
7093
7094/*--------------------------------------------------------------------------
7095 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7096 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7097 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007098 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007099 \param hHal - The handle returned by macOpen.
7100 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7101 Other status means SME is failed to update fEnableFwRssiMonitoring.
7102 \sa
7103 --------------------------------------------------------------------------*/
7104
7105eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7106 v_BOOL_t fEnableFwRssiMonitoring)
7107{
7108 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7109
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007110 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7111 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7112 {
7113 halStatus = eHAL_STATUS_FAILURE;
7114 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007115 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007116 }
7117
7118 return (halStatus);
7119}
7120
Srinivas Girigowdade697412013-02-14 16:31:48 -08007121/*--------------------------------------------------------------------------
7122 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7123 This is a synchronous call
7124 \param hHal - The handle returned by macOpen.
7125 \return eHAL_STATUS_SUCCESS - SME update config successful.
7126 Other status means SME is failed to update
7127 \sa
7128 --------------------------------------------------------------------------*/
7129eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7130 v_U8_t neighborLookupRssiThreshold)
7131{
7132 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7133 eHalStatus status = eHAL_STATUS_SUCCESS;
7134
7135 status = sme_AcquireGlobalLock( &pMac->sme );
7136 if ( HAL_STATUS_SUCCESS( status ) )
7137 {
7138 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7139 if (HAL_STATUS_SUCCESS(status))
7140 {
7141 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7142 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7143 neighborLookupRssiThreshold,
7144 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7145 pMac->roam.neighborRoamInfo.neighborRoamState);
7146 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7147 neighborLookupRssiThreshold;
7148 }
7149 sme_ReleaseGlobalLock( &pMac->sme );
7150 }
7151
7152 return status;
7153}
7154
7155/*--------------------------------------------------------------------------
7156 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
7157 This is a synchronous call
7158 \param hHal - The handle returned by macOpen.
7159 \return eHAL_STATUS_SUCCESS - SME update config successful.
7160 Other status means SME is failed to update
7161 \sa
7162 --------------------------------------------------------------------------*/
7163eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
7164 v_U8_t neighborReassocRssiThreshold)
7165{
7166 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7167 eHalStatus status = eHAL_STATUS_SUCCESS;
7168
7169 status = sme_AcquireGlobalLock( &pMac->sme );
7170 if ( HAL_STATUS_SUCCESS( status ) )
7171 {
7172 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7173 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7174 neighborReassocRssiThreshold,
7175 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7176 pMac->roam.neighborRoamInfo.neighborRoamState);
7177 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7178 neighborReassocRssiThreshold;
7179 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7180 neighborReassocRssiThreshold;
7181 sme_ReleaseGlobalLock( &pMac->sme );
7182 }
7183
7184 return status ;
7185}
7186
7187
7188/*--------------------------------------------------------------------------
7189 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7190 This is a synchronous call
7191 \param hHal - The handle returned by macOpen.
7192 \return eHAL_STATUS_SUCCESS - SME update config successful.
7193 Other status means SME is failed to update
7194 \sa
7195 --------------------------------------------------------------------------*/
7196v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7197{
7198 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7199 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7200}
7201
7202/*--------------------------------------------------------------------------
7203 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7204 This is a synchronous call
7205 \param hHal - The handle returned by macOpen.
7206 \return eHAL_STATUS_SUCCESS - SME update config successful.
7207 Other status means SME is failed to update
7208 \sa
7209 --------------------------------------------------------------------------*/
7210eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7211 v_U16_t neighborScanResultsRefreshPeriod)
7212{
7213 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7214 eHalStatus status = eHAL_STATUS_SUCCESS;
7215
7216 status = sme_AcquireGlobalLock( &pMac->sme );
7217 if ( HAL_STATUS_SUCCESS( status ) )
7218 {
7219 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7220 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7221 neighborScanResultsRefreshPeriod,
7222 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7223 pMac->roam.neighborRoamInfo.neighborRoamState);
7224 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7225 neighborScanResultsRefreshPeriod;
7226 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7227 neighborScanResultsRefreshPeriod;
7228
7229 sme_ReleaseGlobalLock( &pMac->sme );
7230 }
7231
7232 return status ;
7233}
7234
7235/*--------------------------------------------------------------------------
7236 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7237 This is a synchronous call
7238 \param hHal - The handle returned by macOpen.
7239 \return v_U16_t - Neighbor scan results refresh period value
7240 \sa
7241 --------------------------------------------------------------------------*/
7242v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7243{
7244 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7245 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7246}
7247
7248/*--------------------------------------------------------------------------
7249 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7250 This is a synchronuous call
7251 \param hHal - The handle returned by macOpen.
7252 \return eHAL_STATUS_SUCCESS - SME update config successful.
7253 Other status means SME is failed to update
7254 \sa
7255 --------------------------------------------------------------------------*/
7256v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7257{
7258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7259 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7260}
7261
7262#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
7263/*--------------------------------------------------------------------------
7264 \brief sme_getRoamRssiDiff() - get Roam rssi diff
7265 This is a synchronous call
7266 \param hHal - The handle returned by macOpen.
7267 \return v_U16_t - Rssi diff value
7268 \sa
7269 --------------------------------------------------------------------------*/
7270v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
7271{
7272 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7273 return pMac->roam.configParam.RoamRssiDiff;
7274}
7275
7276/*--------------------------------------------------------------------------
7277 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
7278 This is a synchronous call
7279 \param hHal - The handle returned by macOpen.
7280 \return eHAL_STATUS_SUCCESS - SME update config successful.
7281 Other status means SME is failed to update
7282 \sa
7283 --------------------------------------------------------------------------*/
7284eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7285 tANI_U8 numChannels)
7286{
7287 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7288 eHalStatus status = eHAL_STATUS_SUCCESS;
7289 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7290 tANI_U8 oldChannelList[128] = {0};
7291 tANI_U8 newChannelList[128] = {0};
7292 tANI_U8 i = 0, j = 0;
7293
7294 status = sme_AcquireGlobalLock( &pMac->sme );
7295 if ( HAL_STATUS_SUCCESS( status ) )
7296 {
7297 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7298 {
7299 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7300 {
7301 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
7302 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7303 }
7304 }
7305 csrFlushAndCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
7306 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
7307
7308 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7309 {
7310 j = 0;
7311 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7312 {
7313 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
7314 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7315 }
7316 }
7317
7318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7319 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
7320 newChannelList, oldChannelList,
7321 pMac->roam.neighborRoamInfo.neighborRoamState);
7322 sme_ReleaseGlobalLock( &pMac->sme );
7323 }
7324
7325 return status ;
7326}
7327
7328/*--------------------------------------------------------------------------
7329 \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list
7330 based on country revision number
7331 This is a synchronous call
7332 \param hHal - The handle returned by macOpen.
7333 \return eHAL_STATUS_SUCCESS - SME update config successful.
7334 Other status means SME is failed to update
7335 \sa
7336 --------------------------------------------------------------------------*/
7337eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal,
7338 tANI_U8 Revision)
7339{
7340 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7341 eHalStatus status = eHAL_STATUS_SUCCESS;
7342
7343 status = sme_AcquireGlobalLock( &pMac->sme );
7344 if ( HAL_STATUS_SUCCESS( status ) )
7345 {
7346 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7347 "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d",
7348 "KR", Revision, "KR",
7349 pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision,
7350 pMac->roam.neighborRoamInfo.neighborRoamState);
7351 csr_SetRevision(pMac, Revision);
7352 csrInitCountryValidChannelList(pMac, Revision);
7353 sme_ReleaseGlobalLock( &pMac->sme );
7354 }
7355
7356 return status ;
7357}
7358
7359
7360/*--------------------------------------------------------------------------
7361 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
7362 This is a synchronous call
7363 \param hHal - The handle returned by macOpen.
7364 \return eHAL_STATUS_SUCCESS - SME update config successful.
7365 Other status means SME is failed to update
7366 \sa
7367 --------------------------------------------------------------------------*/
7368eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
7369 eCsrBand eBand)
7370{
7371 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7372 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
7373}
7374
7375/*--------------------------------------------------------------------------
7376 \brief sme_getRoamScanChannelList() - get roam scan channel list
7377 This is a synchronous call
7378 \param hHal - The handle returned by macOpen.
7379 \return eHAL_STATUS_SUCCESS - SME update config successful.
7380 Other status means SME is failed to update
7381 \sa
7382 --------------------------------------------------------------------------*/
7383eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7384 tANI_U8 *pNumChannels)
7385{
7386 int i = 0;
7387 tANI_U8 *pOutPtr = pChannelList;
7388 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7389 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7390 eHalStatus status = eHAL_STATUS_SUCCESS;
7391
7392 status = sme_AcquireGlobalLock( &pMac->sme );
7393 if ( HAL_STATUS_SUCCESS( status ) )
7394 {
7395 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7396 {
7397 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
7398 "Roam Scan channel list is NOT yet initialized");
7399 sme_ReleaseGlobalLock( &pMac->sme );
7400 return eHAL_STATUS_NOT_INITIALIZED;
7401 }
7402
7403 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
7404 for (i = 0; i < (*pNumChannels); i++)
7405 {
7406 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
7407 }
7408 pOutPtr[i] = '\0';
7409 sme_ReleaseGlobalLock( &pMac->sme );
7410 }
7411
7412 return status ;
7413}
7414
7415/*--------------------------------------------------------------------------
7416 \brief sme_GetCountryRevision() - get Country revision index
7417 This is a synchronous call
7418 \param hHal - The handle returned by macOpen.
7419 \return eHAL_STATUS_SUCCESS - SME update config successful.
7420 Other status means SME is failed to update
7421 \sa
7422 --------------------------------------------------------------------------*/
7423eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision)
7424{
7425 /* this is valid for Country KR only now */
7426 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7427 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7428 eHalStatus status = eHAL_STATUS_SUCCESS;
7429
7430 *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision;
7431
7432 return status;
7433}
7434
7435#endif
7436
7437/* ---------------------------------------------------------------------------
7438 \fn sme_UpdateEmptyScanRefreshPeriod
7439 \brief Update nEmptyScanRefreshPeriod
7440 This function is called through dynamic setConfig callback function
7441 to configure nEmptyScanRefreshPeriod
7442 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7443 \param hHal - HAL handle for device
7444 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7445 \- return Success or failure
7446 -------------------------------------------------------------------------*/
7447
7448eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
7449{
7450 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7451 eHalStatus status = eHAL_STATUS_SUCCESS;
7452
7453 status = sme_AcquireGlobalLock( &pMac->sme );
7454 if ( HAL_STATUS_SUCCESS( status ) )
7455 {
7456 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7457 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
7458 nEmptyScanRefreshPeriod,
7459 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
7460 pMac->roam.neighborRoamInfo.neighborRoamState);
7461 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7462 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7463 sme_ReleaseGlobalLock( &pMac->sme );
7464 }
7465
7466 return status ;
7467
7468}
7469
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007470
7471
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007472/* ---------------------------------------------------------------------------
7473 \fn sme_IsFeatureSupportedByFW
7474 \brief Check if an feature is enabled by FW
7475
7476 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
7477 \- return 1/0 (TRUE/FALSE)
7478 -------------------------------------------------------------------------*/
7479tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
7480{
7481 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
7482}
7483#ifdef FEATURE_WLAN_TDLS
7484/* ---------------------------------------------------------------------------
7485 \fn sme_SendTdlsMgmtFrame
7486 \brief API to send TDLS management frames.
7487
7488 \param peerMac - peer's Mac Adress.
7489 \param frame_type - Type of TDLS mgmt frame to be sent.
7490 \param dialog - dialog token used in the frame.
7491 \param status - status to be incuded in the frame.
7492 \param buf - additional IEs to be included
7493 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08007494 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007495 \- return VOS_STATUS_SUCCES
7496 -------------------------------------------------------------------------*/
7497VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08007498 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 -08007499{
7500 eHalStatus status = eHAL_STATUS_SUCCESS;
7501 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
7502 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7503
7504 status = sme_AcquireGlobalLock( &pMac->sme );
7505 if ( HAL_STATUS_SUCCESS( status ) )
7506 {
7507 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7508 sendTdlsReq.frameType = frame_type;
7509 sendTdlsReq.buf = buf;
7510 sendTdlsReq.len = len;
7511 sendTdlsReq.dialog = dialog;
7512 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08007513 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007514
7515 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
7516
7517 sme_ReleaseGlobalLock( &pMac->sme );
7518 }
7519
7520 return status ;
7521
7522}
7523/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08007524 \fn sme_ChangeTdlsPeerSta
7525 \brief API to Update TDLS peer sta parameters.
7526
7527 \param peerMac - peer's Mac Adress.
7528 \param staParams - Peer Station Parameters
7529 \- return VOS_STATUS_SUCCES
7530 -------------------------------------------------------------------------*/
7531VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
7532 tCsrStaParams *pstaParams)
7533{
7534 eHalStatus status = eHAL_STATUS_SUCCESS;
7535 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7536
7537 status = sme_AcquireGlobalLock( &pMac->sme );
7538 if ( HAL_STATUS_SUCCESS( status ) )
7539 {
7540 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
7541
7542 sme_ReleaseGlobalLock( &pMac->sme );
7543 }
7544
7545 return status ;
7546
7547}
7548
7549/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007550 \fn sme_AddTdlsPeerSta
7551 \brief API to Add TDLS peer sta entry.
7552
7553 \param peerMac - peer's Mac Adress.
7554 \- return VOS_STATUS_SUCCES
7555 -------------------------------------------------------------------------*/
7556VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7557{
7558 eHalStatus status = eHAL_STATUS_SUCCESS;
7559 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7560
7561 status = sme_AcquireGlobalLock( &pMac->sme );
7562 if ( HAL_STATUS_SUCCESS( status ) )
7563 {
7564 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
7565
7566 sme_ReleaseGlobalLock( &pMac->sme );
7567 }
7568
7569 return status ;
7570
7571}
7572/* ---------------------------------------------------------------------------
7573 \fn sme_DeleteTdlsPeerSta
7574 \brief API to Delete TDLS peer sta entry.
7575
7576 \param peerMac - peer's Mac Adress.
7577 \- return VOS_STATUS_SUCCES
7578 -------------------------------------------------------------------------*/
7579VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7580{
7581 eHalStatus status = eHAL_STATUS_SUCCESS;
7582 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7583
7584 status = sme_AcquireGlobalLock( &pMac->sme );
7585 if ( HAL_STATUS_SUCCESS( status ) )
7586 {
7587 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
7588
7589 sme_ReleaseGlobalLock( &pMac->sme );
7590 }
7591
7592 return status ;
7593
7594}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07007595/* ---------------------------------------------------------------------------
7596 \fn sme_IsPmcBmps
7597 \API to Check if PMC state is BMPS.
7598
7599 \- return v_BOOL_t
7600 -------------------------------------------------------------------------*/
7601v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
7602{
7603 return (BMPS == pmcGetPmcState(hHal));
7604}
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07007605/* ---------------------------------------------------------------------------
7606 \fn sme_SetTdlsPowerSaveProhibited
7607 \API to set/reset the isTdlsPowerSaveProhibited.
7608
7609 \- return void
7610 -------------------------------------------------------------------------*/
7611void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
7612{
7613 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7614
7615 pMac->isTdlsPowerSaveProhibited = val;
7616 return;
7617}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007618#endif
7619#ifdef FEATURE_WLAN_TDLS_INTERNAL
7620/*
7621 * SME API to start TDLS discovery Procedure
7622 */
7623VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7624{
7625 VOS_STATUS status = VOS_STATUS_SUCCESS;
7626 tCsrTdlsDisRequest disReq = {{0}} ;
7627 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7628 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
7629
7630 return status ;
7631
7632}
7633
7634/*
7635 * Process TDLS discovery results
7636 */
7637v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
7638 tSmeTdlsDisResult *disResult, v_U8_t listType)
7639{
7640 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
7641 tSirTdlsPeerInfo *peerInfo = NULL ;
7642 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7643 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
7644 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
7645 tListElem *pEntry = NULL ;
7646 v_U8_t peerCnt = 0 ;
7647
7648 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007649 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007650 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
7651 while(pEntry)
7652 {
7653 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
7654 tdlsPeerStaLink) ;
7655 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
7656
7657 switch(listType)
7658 {
7659 case TDLS_SETUP_LIST:
7660 {
7661 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
7662 {
7663 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
7664 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
7665 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
7666 peerCnt++ ;
7667 }
7668 break ;
7669 }
7670 case TDLS_DIS_LIST:
7671 {
7672 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
7673 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
7674 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
7675 peerCnt++ ;
7676 break ;
7677 }
7678 default:
7679 {
7680 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007681 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007682 break ;
7683 }
7684 }
7685
7686 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
7687 }
7688
7689 return peerCnt ;
7690
7691}
7692
7693/*
7694 * SME API to start TDLS link setup Procedure.
7695 */
7696VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7697{
7698 VOS_STATUS status = VOS_STATUS_SUCCESS;
7699 tCsrTdlsSetupRequest setupReq = {{0}} ;
7700 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7701 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
7702 return status ;
7703
7704}
7705
7706/*
7707 * SME API to start TDLS link Teardown Procedure.
7708 */
7709VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7710{
7711 VOS_STATUS status = VOS_STATUS_SUCCESS;
7712 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
7713 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7714 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
7715 return status ;
7716
7717}
7718
7719#endif /* FEATURE_WLAN_TDLS */
7720