blob: 98bc4ce8f5e02e3a0ff036bfd2d66c6cc5d7ce13 [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
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003762 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
3763 {
3764 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
3765 return eHAL_STATUS_FAILURE;
3766 }
3767
Jeff Johnson295189b2012-06-20 16:38:30 -07003768 status = sme_AcquireGlobalLock( &pMac->sme );
3769 if ( HAL_STATUS_SUCCESS( status ) )
3770 {
3771 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3772 if(pRoamId)
3773 {
3774 *pRoamId = roamId;
3775 }
3776
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003777 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07003778
3779 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003780 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003781
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003782 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003783
3784 pSession = CSR_GET_SESSION(pMac, sessionId);
3785
Jeff Johnson32d95a32012-09-10 13:15:23 -07003786 if(!pSession)
3787 {
3788 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08003789 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003790 return eHAL_STATUS_FAILURE;
3791 }
3792
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
3794 {
3795 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
3796 {
3797 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
3798 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
3799 {
3800 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3801 }
3802 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
3803 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
3804 {
3805 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3806 }
3807 }
3808 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003809
3810 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
3811 sme_ReleaseGlobalLock( &pMac->sme );
3812 }
3813
3814 return (status);
3815}
3816
3817
3818/* ---------------------------------------------------------------------------
3819
3820 \fn sme_RoamRemoveKey
3821
3822 \brief To set encryption key. This is an asynchronous API.
3823
3824 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
3825
3826 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3827
3828 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3829
3830 FAILURE or RESOURCES The API finished and failed.
3831
3832 -------------------------------------------------------------------------------*/
3833eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
3834 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
3835{
3836 eHalStatus status = eHAL_STATUS_FAILURE;
3837 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3838 tANI_U32 roamId;
3839
3840 status = sme_AcquireGlobalLock( &pMac->sme );
3841 if ( HAL_STATUS_SUCCESS( status ) )
3842 {
3843 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3844 if(pRoamId)
3845 {
3846 *pRoamId = roamId;
3847 }
3848 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
3849 sme_ReleaseGlobalLock( &pMac->sme );
3850 }
3851
3852 return (status);
3853}
3854
3855/* ---------------------------------------------------------------------------
3856 \fn sme_GetRssi
3857 \brief a wrapper function that client calls to register a callback to get RSSI
3858
3859 \param callback - SME sends back the requested stats using the callback
3860 \param staId - The station ID for which the stats is requested for
3861 \param pContext - user context to be passed back along with the callback
3862 \param pVosContext - vos context
3863 \return eHalStatus
3864 ---------------------------------------------------------------------------*/
3865eHalStatus sme_GetRssi(tHalHandle hHal,
3866 tCsrRssiCallback callback,
3867 tANI_U8 staId, tCsrBssid bssId,
3868 void *pContext, void* pVosContext)
3869{
3870 eHalStatus status = eHAL_STATUS_FAILURE;
3871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3872
3873 status = sme_AcquireGlobalLock( &pMac->sme );
3874 if ( HAL_STATUS_SUCCESS( status ) )
3875 {
3876 status = csrGetRssi( pMac, callback,
3877 staId, bssId, pContext, pVosContext);
3878 sme_ReleaseGlobalLock( &pMac->sme );
3879 }
3880 return (status);
3881}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003882#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3883/* ---------------------------------------------------------------------------
3884 \fn sme_GetRoamRssi
3885 \brief a wrapper function that client calls to register a callback to get Roam RSSI
3886
3887 \param callback - SME sends back the requested stats using the callback
3888 \param staId - The station ID for which the stats is requested for
3889 \param pContext - user context to be passed back along with the callback
3890 \param pVosContext - vos context
3891 \return eHalStatus
3892 ---------------------------------------------------------------------------*/
3893eHalStatus sme_GetRoamRssi(tHalHandle hHal,
3894 tCsrRssiCallback callback,
3895 tANI_U8 staId, tCsrBssid bssId,
3896 void *pContext, void* pVosContext)
3897{
3898 eHalStatus status = eHAL_STATUS_FAILURE;
3899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3900
3901 status = sme_AcquireGlobalLock( &pMac->sme );
3902 if ( HAL_STATUS_SUCCESS( status ) )
3903 {
3904 status = csrGetRoamRssi( pMac, callback,
3905 staId, bssId, pContext, pVosContext);
3906 sme_ReleaseGlobalLock( &pMac->sme );
3907 }
3908 return (status);
3909}
3910#endif
3911
Jeff Johnson295189b2012-06-20 16:38:30 -07003912
3913/* ---------------------------------------------------------------------------
3914 \fn sme_GetStatistics
3915 \brief a wrapper function that client calls to register a callback to get
3916 different PHY level statistics from CSR.
3917
3918 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
3919 \param statsMask - The different category/categories of stats requester is looking for
3920 \param callback - SME sends back the requested stats using the callback
3921 \param periodicity - If requester needs periodic update in millisec, 0 means
3922 it's an one time request
3923 \param cache - If requester is happy with cached stats
3924 \param staId - The station ID for which the stats is requested for
3925 \param pContext - user context to be passed back along with the callback
3926 \return eHalStatus
3927 ---------------------------------------------------------------------------*/
3928eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
3929 tANI_U32 statsMask,
3930 tCsrStatsCallback callback,
3931 tANI_U32 periodicity, tANI_BOOLEAN cache,
3932 tANI_U8 staId, void *pContext)
3933{
3934 eHalStatus status = eHAL_STATUS_FAILURE;
3935 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3936
3937 status = sme_AcquireGlobalLock( &pMac->sme );
3938 if ( HAL_STATUS_SUCCESS( status ) )
3939 {
3940 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
3941 periodicity, cache, staId, pContext);
3942 sme_ReleaseGlobalLock( &pMac->sme );
3943 }
3944
3945 return (status);
3946
3947}
3948
3949/* ---------------------------------------------------------------------------
3950
3951 \fn sme_GetCountryCode
3952
3953 \brief To return the current country code. If no country code is applied, default country code is
3954 used to fill the buffer.
3955 If 11d supported is turned off, an error is return and the last applied/default country code is used.
3956 This is a synchronous API.
3957
3958 \param pBuf - pointer to a caller allocated buffer for returned country code.
3959
3960 \param pbLen For input, this parameter indicates how big is the buffer.
3961 Upon return, this parameter has the number of bytes for country. If pBuf
3962 doesn't have enough space, this function returns
3963 fail status and this parameter contains the number that is needed.
3964
3965 \return eHalStatus SUCCESS.
3966
3967 FAILURE or RESOURCES The API finished and failed.
3968
3969 -------------------------------------------------------------------------------*/
3970eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
3971{
3972 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3973
3974 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
3975}
3976
3977
3978/* ---------------------------------------------------------------------------
3979
3980 \fn sme_SetCountryCode
3981
3982 \brief To change the current/default country code.
3983 If 11d supported is turned off, an error is return.
3984 This is a synchronous API.
3985
3986 \param pCountry - pointer to a caller allocated buffer for the country code.
3987
3988 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
3989 whether a reset is required.
3990
3991 \return eHalStatus SUCCESS.
3992
3993 FAILURE or RESOURCES The API finished and failed.
3994
3995 -------------------------------------------------------------------------------*/
3996eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
3997{
3998 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3999
4000 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4001}
4002
4003
4004/* ---------------------------------------------------------------------------
4005 \fn sme_ResetCountryCodeInformation
4006 \brief this function is to reset the country code current being used back to EEPROM default
4007 this includes channel list and power setting. This is a synchronous API.
4008 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4009 a restart is needed to apply the change
4010 \return eHalStatus
4011 -------------------------------------------------------------------------------*/
4012eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4013{
4014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4015
4016 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4017}
4018
4019
4020/* ---------------------------------------------------------------------------
4021 \fn sme_GetSupportedCountryCode
4022 \brief this function is to get a list of the country code current being supported
4023 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4024 this has the country code list. 3 bytes for each country code. This may be NULL if
4025 caller wants to know the needed byte count.
4026 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4027 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4028 \return eHalStatus
4029 -------------------------------------------------------------------------------*/
4030eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4031{
4032 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4033
4034 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4035}
4036
4037
4038/* ---------------------------------------------------------------------------
4039 \fn sme_GetCurrentRegulatoryDomain
4040 \brief this function is to get the current regulatory domain. This is a synchronous API.
4041 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4042 SME. The function fails if 11d support is turned off.
4043 \param pDomain - Caller allocated buffer to return the current domain.
4044 \return eHalStatus SUCCESS.
4045
4046 FAILURE or RESOURCES The API finished and failed.
4047 -------------------------------------------------------------------------------*/
4048eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4049{
4050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4051 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4052
4053 if( pDomain )
4054 {
4055 if( csrIs11dSupported( pMac ) )
4056 {
4057 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4058 status = eHAL_STATUS_SUCCESS;
4059 }
4060 else
4061 {
4062 status = eHAL_STATUS_FAILURE;
4063 }
4064 }
4065
4066 return ( status );
4067}
4068
4069
4070/* ---------------------------------------------------------------------------
4071 \fn sme_SetRegulatoryDomain
4072 \brief this function is to set the current regulatory domain.
4073 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4074 SME. This is a synchronous API.
4075 \param domainId - indicate the domain (defined in the driver) needs to set to.
4076 See v_REGDOMAIN_t for definition
4077 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4078 a restart is needed to apply the change
4079 \return eHalStatus
4080 -------------------------------------------------------------------------------*/
4081eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4082{
4083 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4084
4085 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4086}
4087
4088
4089/* ---------------------------------------------------------------------------
4090
4091 \fn sme_GetRegulatoryDomainForCountry
4092
4093 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4094
4095 \param pCountry - pointer to a caller allocated buffer for input country code.
4096
4097 \param pDomainId Upon successful return, it is the domain that country belongs to.
4098 If it is NULL, returning success means that the country code is known.
4099
4100 \return eHalStatus SUCCESS.
4101
4102 FAILURE or RESOURCES The API finished and failed.
4103
4104 -------------------------------------------------------------------------------*/
4105eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4106{
4107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4108
4109 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4110}
4111
4112
4113
4114
4115/* ---------------------------------------------------------------------------
4116
4117 \fn sme_GetSupportedRegulatoryDomains
4118
4119 \brief To return a list of supported regulatory domains. This is a synchronous API.
4120
4121 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4122
4123 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4124 Upon return, this parameter has the number for supported domains. If pDomains
4125 doesn't have enough space for all the supported domains, this function returns
4126 fail status and this parameter contains the number that is needed.
4127
4128 \return eHalStatus SUCCESS.
4129
4130 FAILURE or RESOURCES The API finished and failed.
4131
4132 -------------------------------------------------------------------------------*/
4133eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4134{
4135 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4136
4137 //We support all domains for now
4138 if( pNumDomains )
4139 {
4140 if( NUM_REG_DOMAINS <= *pNumDomains )
4141 {
4142 status = eHAL_STATUS_SUCCESS;
4143 }
4144 *pNumDomains = NUM_REG_DOMAINS;
4145 }
4146 if( HAL_STATUS_SUCCESS( status ) )
4147 {
4148 if( pDomains )
4149 {
4150 pDomains[0] = REGDOMAIN_FCC;
4151 pDomains[1] = REGDOMAIN_ETSI;
4152 pDomains[2] = REGDOMAIN_JAPAN;
4153 pDomains[3] = REGDOMAIN_WORLD;
4154 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4155 pDomains[5] = REGDOMAIN_APAC;
4156 pDomains[6] = REGDOMAIN_KOREA;
4157 pDomains[7] = REGDOMAIN_HI_5GHZ;
4158 pDomains[8] = REGDOMAIN_NO_5GHZ;
4159 }
4160 else
4161 {
4162 status = eHAL_STATUS_INVALID_PARAMETER;
4163 }
4164 }
4165
4166 return ( status );
4167}
4168
4169
4170//some support functions
4171tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4172{
4173 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4174
4175 return ( csrIs11dSupported( pMac ) );
4176}
4177
4178
4179tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4180{
4181 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4182
4183 return ( csrIs11hSupported( pMac ) );
4184}
4185
4186
4187tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4188{
4189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4190
4191 return ( csrIsWmmSupported( pMac ) );
4192}
4193
4194//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4195eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4196{
4197 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4198
4199 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4200}
4201
4202/* ---------------------------------------------------------------------------
4203
4204 \fn sme_ChangeCountryCode
4205
4206 \brief Change Country code from upperlayer during WLAN driver operation.
4207 This is a synchronous API.
4208
4209 \param hHal - The handle returned by macOpen.
4210
4211 \param pCountry New Country Code String
4212
4213 \return eHalStatus SUCCESS.
4214
4215 FAILURE or RESOURCES The API finished and failed.
4216
4217 -------------------------------------------------------------------------------*/
4218eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4219 tSmeChangeCountryCallback callback,
4220 tANI_U8 *pCountry,
4221 void *pContext,
4222 void* pVosContext )
4223{
4224 eHalStatus status = eHAL_STATUS_FAILURE;
4225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4226 vos_msg_t msg;
4227 tAniChangeCountryCodeReq *pMsg;
4228
4229 status = sme_AcquireGlobalLock( &pMac->sme );
4230 if ( HAL_STATUS_SUCCESS( status ) )
4231 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004232 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004233 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4234 if ( !HAL_STATUS_SUCCESS(status) )
4235 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004236 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004237 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004238 return status;
4239 }
4240
4241 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4242 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4243 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
4244 pMsg->changeCCCallback = callback;
4245 pMsg->pDevContext = pContext;
4246 pMsg->pVosContext = pVosContext;
4247
4248 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4249 msg.bodyptr = pMsg;
4250 msg.reserved = 0;
4251
4252 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4253 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004254 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 palFreeMemory(pMac->hHdd, (void *)pMsg);
4256 status = eHAL_STATUS_FAILURE;
4257 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004258 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 sme_ReleaseGlobalLock( &pMac->sme );
4260 }
4261
4262 return (status);
4263}
4264
4265/* ---------------------------------------------------------------------------
4266 \fn sme_BtcSignalBtEvent
4267 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4268 BT event type and the current operating mode of Libra (full power,
4269 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4270 would be employed.
4271 \param hHal - The handle returned by macOpen.
4272 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4273 Caller owns the memory and is responsible for freeing it.
4274 \return VOS_STATUS
4275 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4276 if BTC execution mode is set to BTC_WLAN_ONLY
4277 or BTC_PTA_ONLY.
4278 VOS_STATUS_SUCCESS BT Event passed to HAL
4279 ---------------------------------------------------------------------------*/
4280VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4281{
4282 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4283#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4285
4286 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4287 {
4288 status = btcSignalBTEvent (hHal, pBtEvent);
4289 sme_ReleaseGlobalLock( &pMac->sme );
4290 }
4291#endif
4292 return (status);
4293}
4294
4295/* ---------------------------------------------------------------------------
4296 \fn sme_BtcSetConfig
4297 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4298 This function should be invoked only after CFG download has completed.
4299 Calling it after sme_HDDReadyInd is recommended.
4300 \param hHal - The handle returned by macOpen.
4301 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4302 Caller owns the memory and is responsible for freeing it.
4303 \return VOS_STATUS
4304 VOS_STATUS_E_FAILURE Config not passed to HAL.
4305 VOS_STATUS_SUCCESS Config passed to HAL
4306 ---------------------------------------------------------------------------*/
4307VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4308{
4309 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4310#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4311 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4312 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4313 {
4314 status = btcSetConfig (hHal, pSmeBtcConfig);
4315 sme_ReleaseGlobalLock( &pMac->sme );
4316 }
4317#endif
4318 return (status);
4319}
4320
4321/* ---------------------------------------------------------------------------
4322 \fn sme_BtcGetConfig
4323 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4324 \param hHal - The handle returned by macOpen.
4325 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4326 tSmeBtcConfig. Caller owns the memory and is responsible
4327 for freeing it.
4328 \return VOS_STATUS
4329 VOS_STATUS_E_FAILURE - failure
4330 VOS_STATUS_SUCCESS success
4331 ---------------------------------------------------------------------------*/
4332VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4333{
4334 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4335#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4336 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4337
4338 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4339 {
4340 status = btcGetConfig (hHal, pSmeBtcConfig);
4341 sme_ReleaseGlobalLock( &pMac->sme );
4342 }
4343#endif
4344 return (status);
4345}
4346/* ---------------------------------------------------------------------------
4347 \fn sme_SetCfgPrivacy
4348 \brief API to set configure privacy parameters
4349 \param hHal - The handle returned by macOpen.
4350 \param pProfile - Pointer CSR Roam profile.
4351 \param fPrivacy - This parameter indicates status of privacy
4352
4353 \return void
4354 ---------------------------------------------------------------------------*/
4355void sme_SetCfgPrivacy( tHalHandle hHal,
4356 tCsrRoamProfile *pProfile,
4357 tANI_BOOLEAN fPrivacy
4358 )
4359{
4360 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4361 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4362 {
4363 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4364 sme_ReleaseGlobalLock( &pMac->sme );
4365 }
4366}
4367
4368#if defined WLAN_FEATURE_VOWIFI
4369/* ---------------------------------------------------------------------------
4370 \fn sme_NeighborReportRequest
4371 \brief API to request neighbor report.
4372 \param hHal - The handle returned by macOpen.
4373 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4374 tRrmNeighborReq. Caller owns the memory and is responsible
4375 for freeing it.
4376 \return VOS_STATUS
4377 VOS_STATUS_E_FAILURE - failure
4378 VOS_STATUS_SUCCESS success
4379 ---------------------------------------------------------------------------*/
4380VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4381 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4382{
4383 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4384 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4385
4386 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4387 {
4388 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4389 sme_ReleaseGlobalLock( &pMac->sme );
4390 }
4391
4392 return (status);
4393}
4394#endif
4395
4396//The following are debug APIs to support direct read/write register/memory
4397//They are placed in SME because HW cannot be access when in LOW_POWER state
4398//AND not connected. The knowledge and synchronization is done in SME
4399
4400//sme_DbgReadRegister
4401//Caller needs to validate the input values
4402VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4403{
4404 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4405 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 tPmcPowerState PowerState;
4407 tANI_U32 sessionId = 0;
4408
4409 /* 1) To make Quarky work in FTM mode **************************************/
4410
4411 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4412 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004413 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004414 {
4415 return VOS_STATUS_SUCCESS;
4416 }
4417 return VOS_STATUS_E_FAILURE;
4418 }
4419
4420 /* 2) NON FTM mode driver *************************************************/
4421
4422 /* Acquire SME global lock */
4423 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4424 {
4425 return VOS_STATUS_E_FAILURE;
4426 }
4427
4428 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4429 {
4430 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4431 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4432 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004433 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004434 {
4435 status = VOS_STATUS_SUCCESS;
4436 }
4437 else
4438 {
4439 status = VOS_STATUS_E_FAILURE;
4440 }
4441 }
4442 else
4443 {
4444 status = VOS_STATUS_E_FAILURE;
4445 }
4446 }
4447
4448 /* This is a hack for Qualky/pttWniSocket
4449 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4450 if ( VOS_STATUS_SUCCESS != status )
4451 {
4452 *pRegValue = 0xDEADBEEF;
4453 status = VOS_STATUS_SUCCESS;
4454 }
4455
4456 /* Release SME global lock */
4457 sme_ReleaseGlobalLock(&pMac->sme);
4458
4459 return (status);
4460}
4461
4462
4463//sme_DbgWriteRegister
4464//Caller needs to validate the input values
4465VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4466{
4467 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4468 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 tPmcPowerState PowerState;
4470 tANI_U32 sessionId = 0;
4471
4472 /* 1) To make Quarky work in FTM mode **************************************/
4473
4474 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4475 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004476 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004477 {
4478 return VOS_STATUS_SUCCESS;
4479 }
4480 return VOS_STATUS_E_FAILURE;
4481 }
4482
4483 /* 2) NON FTM mode driver *************************************************/
4484
4485 /* Acquire SME global lock */
4486 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4487 {
4488 return VOS_STATUS_E_FAILURE;
4489 }
4490
4491 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4492 {
4493 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4494 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4495 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004496 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004497 {
4498 status = VOS_STATUS_SUCCESS;
4499 }
4500 else
4501 {
4502 status = VOS_STATUS_E_FAILURE;
4503 }
4504 }
4505 else
4506 {
4507 status = VOS_STATUS_E_FAILURE;
4508 }
4509 }
4510
4511 /* Release SME global lock */
4512 sme_ReleaseGlobalLock(&pMac->sme);
4513
4514 return (status);
4515}
4516
4517
4518
4519//sme_DbgReadMemory
4520//Caller needs to validate the input values
4521//pBuf caller allocated buffer has the length of nLen
4522VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4523{
4524 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4525 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 tPmcPowerState PowerState;
4527 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004528 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4529 tANI_U32 arg1 = memAddr;
4530 tANI_U32 arg2 = nLen/4;
4531 tANI_U32 arg3 = 4;
4532 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 /* 1) To make Quarky work in FTM mode **************************************/
4534
4535 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4536 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004537 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 {
4539 return VOS_STATUS_SUCCESS;
4540 }
4541 return VOS_STATUS_E_FAILURE;
4542 }
4543
4544 /* 2) NON FTM mode driver *************************************************/
4545
4546 /* Acquire SME global lock */
4547 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4548 {
4549 return VOS_STATUS_E_FAILURE;
4550 }
4551
4552 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4553 {
4554 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4555 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4556 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004557 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 {
4559 status = VOS_STATUS_SUCCESS;
4560 }
4561 else
4562 {
4563 status = VOS_STATUS_E_FAILURE;
4564 }
4565 }
4566 else
4567 {
4568 status = VOS_STATUS_E_FAILURE;
4569 }
4570 }
4571
4572 /* This is a hack for Qualky/pttWniSocket
4573 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4574 if (VOS_STATUS_SUCCESS != status)
4575 {
4576 vos_mem_set(pBuf, nLen, 0xCD);
4577 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004578 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004579 }
4580
4581 /* Release SME lock */
4582 sme_ReleaseGlobalLock(&pMac->sme);
4583
4584 return (status);
4585}
4586
4587
4588//sme_DbgWriteMemory
4589//Caller needs to validate the input values
4590VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4591{
4592 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4593 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 tPmcPowerState PowerState;
4595 tANI_U32 sessionId = 0;
4596
4597 /* 1) To make Quarky work in FTM mode **************************************/
4598
4599 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4600 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004601 {
4602 return VOS_STATUS_SUCCESS;
4603 }
4604 return VOS_STATUS_E_FAILURE;
4605 }
4606
4607 /* 2) NON FTM mode driver *************************************************/
4608
4609 /* Acquire SME global lock */
4610 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4611 {
4612 return VOS_STATUS_E_FAILURE;
4613 }
4614
4615 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4616 {
4617 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4618 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4619 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004620 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 {
4622 status = VOS_STATUS_SUCCESS;
4623 }
4624 else
4625 {
4626 status = VOS_STATUS_E_FAILURE;
4627 }
4628 }
4629 else
4630 {
4631 status = VOS_STATUS_E_FAILURE;
4632 }
4633 }
4634
4635 /* Release Global lock */
4636 sme_ReleaseGlobalLock(&pMac->sme);
4637
4638 return (status);
4639}
4640
4641
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004642void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07004643{
4644#ifdef WLAN_DEBUG
4645 // Verify against current log level
4646 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
4647 return;
4648 else
4649 {
4650 va_list marker;
4651
4652 va_start( marker, pString ); /* Initialize variable arguments. */
4653
4654 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
4655
4656 va_end( marker ); /* Reset variable arguments. */
4657 }
4658#endif
4659}
Jeff Johnson295189b2012-06-20 16:38:30 -07004660
Jeff Johnson295189b2012-06-20 16:38:30 -07004661/* ---------------------------------------------------------------------------
4662 \fn sme_GetWcnssWlanCompiledVersion
4663 \brief This API returns the version of the WCNSS WLAN API with
4664 which the HOST driver was built
4665 \param hHal - The handle returned by macOpen.
4666 \param pVersion - Points to the Version structure to be filled
4667 \return VOS_STATUS
4668 VOS_STATUS_E_INVAL - failure
4669 VOS_STATUS_SUCCESS success
4670 ---------------------------------------------------------------------------*/
4671VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
4672 tSirVersionType *pVersion)
4673{
4674 VOS_STATUS status = VOS_STATUS_SUCCESS;
4675 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4676 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4677
4678 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4679 {
4680 if( pVersion != NULL )
4681 {
4682 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
4683 }
4684 else
4685 {
4686 status = VOS_STATUS_E_INVAL;
4687 }
4688 sme_ReleaseGlobalLock( &pMac->sme );
4689 }
4690
4691 return (status);
4692}
4693
4694
4695/* ---------------------------------------------------------------------------
4696 \fn sme_GetWcnssWlanReportedVersion
4697 \brief This API returns the version of the WCNSS WLAN API with
4698 which the WCNSS driver reports it was built
4699 \param hHal - The handle returned by macOpen.
4700 \param pVersion - Points to the Version structure to be filled
4701 \return VOS_STATUS
4702 VOS_STATUS_E_INVAL - failure
4703 VOS_STATUS_SUCCESS success
4704 ---------------------------------------------------------------------------*/
4705VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
4706 tSirVersionType *pVersion)
4707{
4708 VOS_STATUS status = VOS_STATUS_SUCCESS;
4709 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4710 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4711
4712 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4713 {
4714 if( pVersion != NULL )
4715 {
4716 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
4717 }
4718 else
4719 {
4720 status = VOS_STATUS_E_INVAL;
4721 }
4722 sme_ReleaseGlobalLock( &pMac->sme );
4723 }
4724
4725 return (status);
4726}
4727
4728
4729/* ---------------------------------------------------------------------------
4730 \fn sme_GetWcnssSoftwareVersion
4731 \brief This API returns the version string of the WCNSS driver
4732 \param hHal - The handle returned by macOpen.
4733 \param pVersion - Points to the Version string buffer to be filled
4734 \param versionBufferSize - THe size of the Version string buffer
4735 \return VOS_STATUS
4736 VOS_STATUS_E_INVAL - failure
4737 VOS_STATUS_SUCCESS success
4738 ---------------------------------------------------------------------------*/
4739VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
4740 tANI_U8 *pVersion,
4741 tANI_U32 versionBufferSize)
4742{
4743 VOS_STATUS status = VOS_STATUS_SUCCESS;
4744 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4745 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4746
4747 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4748 {
4749 if( pVersion != NULL )
4750 {
4751 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
4752 versionBufferSize);
4753 }
4754 else
4755 {
4756 status = VOS_STATUS_E_INVAL;
4757 }
4758 sme_ReleaseGlobalLock( &pMac->sme );
4759 }
4760
4761 return (status);
4762}
4763
4764
4765/* ---------------------------------------------------------------------------
4766 \fn sme_GetWcnssHardwareVersion
4767 \brief This API returns the version string of the WCNSS hardware
4768 \param hHal - The handle returned by macOpen.
4769 \param pVersion - Points to the Version string buffer to be filled
4770 \param versionBufferSize - THe size of the Version string buffer
4771 \return VOS_STATUS
4772 VOS_STATUS_E_INVAL - failure
4773 VOS_STATUS_SUCCESS success
4774 ---------------------------------------------------------------------------*/
4775VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
4776 tANI_U8 *pVersion,
4777 tANI_U32 versionBufferSize)
4778{
4779 VOS_STATUS status = VOS_STATUS_SUCCESS;
4780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4781 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4782
4783 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4784 {
4785 if( pVersion != NULL )
4786 {
4787 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
4788 versionBufferSize);
4789 }
4790 else
4791 {
4792 status = VOS_STATUS_E_INVAL;
4793 }
4794 sme_ReleaseGlobalLock( &pMac->sme );
4795 }
4796
4797 return (status);
4798}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08004799
Jeff Johnson295189b2012-06-20 16:38:30 -07004800
4801#ifdef FEATURE_WLAN_WAPI
4802/* ---------------------------------------------------------------------------
4803 \fn sme_RoamSetBKIDCache
4804 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
4805 candidate list.
4806 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4807 it is opened (by calling halOpen).
4808 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
4809 \param numItems - a variable that has the number of tBkidCacheInfo allocated
4810 when retruning, this is the number of items put into pBKIDCache
4811 \return eHalStatus - when fail, it usually means the buffer allocated is not
4812 big enough and pNumItems has the number of tBkidCacheInfo.
4813 ---------------------------------------------------------------------------*/
4814eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
4815 tANI_U32 numItems )
4816{
4817 eHalStatus status = eHAL_STATUS_FAILURE;
4818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4819
4820 status = sme_AcquireGlobalLock( &pMac->sme );
4821 if ( HAL_STATUS_SUCCESS( status ) )
4822 {
4823 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
4824 sme_ReleaseGlobalLock( &pMac->sme );
4825 }
4826
4827 return (status);
4828}
4829
4830/* ---------------------------------------------------------------------------
4831 \fn sme_RoamGetBKIDCache
4832 \brief The SME API exposed to HDD to allow HDD to request SME to return its
4833 BKID cache.
4834 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4835 it is opened (by calling halOpen).
4836 \param pNum - caller allocated memory that has the space of the number of
4837 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
4838 in SME cache.
4839 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
4840 upon return
4841 \return eHalStatus - when fail, it usually means the buffer allocated is not
4842 big enough.
4843 ---------------------------------------------------------------------------*/
4844eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
4845 tBkidCacheInfo *pBkidCache)
4846{
4847 eHalStatus status = eHAL_STATUS_FAILURE;
4848 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4849
4850 status = sme_AcquireGlobalLock( &pMac->sme );
4851 if ( HAL_STATUS_SUCCESS( status ) )
4852 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004853 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004854 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
4855 sme_ReleaseGlobalLock( &pMac->sme );
4856 }
4857
4858 return (status);
4859}
4860
4861/* ---------------------------------------------------------------------------
4862 \fn sme_RoamGetNumBKIDCache
4863 \brief The SME API exposed to HDD to allow HDD to request SME to return the
4864 number of BKID cache entries.
4865 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4866 it is opened (by calling halOpen).
4867 \return tANI_U32 - the number of BKID cache entries.
4868 ---------------------------------------------------------------------------*/
4869tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
4870{
4871 eHalStatus status = eHAL_STATUS_FAILURE;
4872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4873 tANI_U32 numBkidCache = 0;
4874
4875 status = sme_AcquireGlobalLock( &pMac->sme );
4876 if ( HAL_STATUS_SUCCESS( status ) )
4877 {
4878 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
4879 sme_ReleaseGlobalLock( &pMac->sme );
4880 }
4881
4882 return (numBkidCache);
4883}
4884
4885/* ---------------------------------------------------------------------------
4886 \fn sme_ScanGetBKIDCandidateList
4887 \brief a wrapper function to return the BKID candidate list
4888 \param pBkidList - caller allocated buffer point to an array of
4889 tBkidCandidateInfo
4890 \param pNumItems - pointer to a variable that has the number of
4891 tBkidCandidateInfo allocated when retruning, this is
4892 either the number needed or number of items put into
4893 pPmkidList
4894 \return eHalStatus - when fail, it usually means the buffer allocated is not
4895 big enough and pNumItems
4896 has the number of tBkidCandidateInfo.
4897 \Note: pNumItems is a number of tBkidCandidateInfo,
4898 not sizeof(tBkidCandidateInfo) * something
4899 ---------------------------------------------------------------------------*/
4900eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
4901 tBkidCandidateInfo *pBkidList,
4902 tANI_U32 *pNumItems )
4903{
4904 eHalStatus status = eHAL_STATUS_FAILURE;
4905 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4906
4907 status = sme_AcquireGlobalLock( &pMac->sme );
4908 if ( HAL_STATUS_SUCCESS( status ) )
4909 {
4910 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
4911 sme_ReleaseGlobalLock( &pMac->sme );
4912 }
4913
4914 return (status);
4915}
4916#endif /* FEATURE_WLAN_WAPI */
4917
Jeff Johnsone7245742012-09-05 17:12:55 -07004918#ifdef FEATURE_OEM_DATA_SUPPORT
4919
4920/*****************************************************************************
4921 OEM DATA related modifications and function additions
4922 *****************************************************************************/
4923
4924/* ---------------------------------------------------------------------------
4925 \fn sme_getOemDataRsp
4926 \brief a wrapper function to obtain the OEM DATA RSP
4927 \param pOemDataRsp - A pointer to the response object
4928 \param pContext - a pointer passed in for the callback
4929 \return eHalStatus
4930 ---------------------------------------------------------------------------*/
4931eHalStatus sme_getOemDataRsp(tHalHandle hHal,
4932 tOemDataRsp **pOemDataRsp)
4933{
4934 eHalStatus status = eHAL_STATUS_SUCCESS;
4935 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4936
4937 do
4938 {
4939 //acquire the lock for the sme object
4940 status = sme_AcquireGlobalLock(&pMac->sme);
4941
4942 if(!HAL_STATUS_SUCCESS(status))
4943 {
4944 break;
4945 }
4946
4947 if(pMac->oemData.pOemDataRsp != NULL)
4948 {
4949 *pOemDataRsp = pMac->oemData.pOemDataRsp;
4950 }
4951 else
4952 {
4953 status = eHAL_STATUS_FAILURE;
4954 }
4955
4956 //release the lock for the sme object
4957 sme_ReleaseGlobalLock( &pMac->sme );
4958
4959 } while(0);
4960
4961 return status;
4962}
4963
4964/* ---------------------------------------------------------------------------
4965 \fn sme_OemDataReq
4966 \brief a wrapper function for OEM DATA REQ
4967 \param sessionId - session id to be used.
4968 \param pOemDataReqId - pointer to an object to get back the request ID
4969 \param callback - a callback function that is called upon finish
4970 \param pContext - a pointer passed in for the callback
4971 \return eHalStatus
4972 ---------------------------------------------------------------------------*/
4973eHalStatus sme_OemDataReq(tHalHandle hHal,
4974 tANI_U8 sessionId,
4975 tOemDataReqConfig *pOemDataReqConfig,
4976 tANI_U32 *pOemDataReqID,
4977 oemData_OemDataReqCompleteCallback callback,
4978 void *pContext)
4979{
4980 eHalStatus status = eHAL_STATUS_SUCCESS;
4981 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4982
4983 do
4984 {
4985 //acquire the lock for the sme object
4986 status = sme_AcquireGlobalLock(&pMac->sme);
4987 if(HAL_STATUS_SUCCESS(status))
4988 {
4989 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
4990
4991 if(pOemDataReqID)
4992 {
4993 *pOemDataReqID = lOemDataReqId;
4994 }
4995 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004996 {
4997 sme_ReleaseGlobalLock( &pMac->sme );
4998 return eHAL_STATUS_FAILURE;
4999 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005000
5001 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5002
5003 //release the lock for the sme object
5004 sme_ReleaseGlobalLock( &pMac->sme );
5005 }
5006 } while(0);
5007
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005008 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005009
5010 return(status);
5011}
5012
5013#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005014
5015/*--------------------------------------------------------------------------
5016
5017 \brief sme_OpenSession() - Open a session for scan/roam operation.
5018
5019 This is a synchronous API.
5020
5021
5022 \param hHal - The handle returned by macOpen.
5023 \param callback - A pointer to the function caller specifies for roam/connect status indication
5024 \param pContext - The context passed with callback
5025 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5026 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5027
5028 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5029
5030 Other status means SME is failed to open the session.
5031 eHAL_STATUS_RESOURCES - no more session available.
5032 \sa
5033
5034 --------------------------------------------------------------------------*/
5035eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext,
5036 tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId)
5037{
5038 eHalStatus status;
5039 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5040
5041 if( NULL == pbSessionId )
5042 {
5043 status = eHAL_STATUS_INVALID_PARAMETER;
5044 }
5045 else
5046 {
5047 status = sme_AcquireGlobalLock( &pMac->sme );
5048 if ( HAL_STATUS_SUCCESS( status ) )
5049 {
5050 status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId );
5051
5052 sme_ReleaseGlobalLock( &pMac->sme );
5053 }
5054 }
5055
5056 return ( status );
5057}
5058
5059
5060/*--------------------------------------------------------------------------
5061
5062 \brief sme_CloseSession() - Open a session for scan/roam operation.
5063
5064 This is a synchronous API.
5065
5066
5067 \param hHal - The handle returned by macOpen.
5068
5069 \param sessionId - A previous opened session's ID.
5070
5071 \return eHAL_STATUS_SUCCESS - session is closed.
5072
5073 Other status means SME is failed to open the session.
5074 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5075 \sa
5076
5077 --------------------------------------------------------------------------*/
5078eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5079 csrRoamSessionCloseCallback callback, void *pContext)
5080{
5081 eHalStatus status;
5082 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5083
5084 status = sme_AcquireGlobalLock( &pMac->sme );
5085 if ( HAL_STATUS_SUCCESS( status ) )
5086 {
5087 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5088 callback, pContext );
5089
5090 sme_ReleaseGlobalLock( &pMac->sme );
5091 }
5092
5093 return ( status );
5094}
5095
Jeff Johnson295189b2012-06-20 16:38:30 -07005096/* ---------------------------------------------------------------------------
5097
5098 \fn sme_RoamUpdateAPWPSIE
5099
5100 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5101 This is an asynchronous API.
5102
5103 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5104
5105 \return eHalStatus – SUCCESS –
5106
5107 FAILURE or RESOURCES – The API finished and failed.
5108
5109 -------------------------------------------------------------------------------*/
5110eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5111{
5112
5113 eHalStatus status = eHAL_STATUS_FAILURE;
5114 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5115
5116 status = sme_AcquireGlobalLock( &pMac->sme );
5117 if ( HAL_STATUS_SUCCESS( status ) )
5118 {
5119
5120 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5121
5122 sme_ReleaseGlobalLock( &pMac->sme );
5123 }
5124
5125 return (status);
5126}
5127/* ---------------------------------------------------------------------------
5128
5129 \fn sme_RoamUpdateAPWPARSNIEs
5130
5131 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5132 This is an asynchronous API.
5133
5134 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5135
5136 \return eHalStatus – SUCCESS –
5137
5138 FAILURE or RESOURCES – The API finished and failed.
5139
5140 -------------------------------------------------------------------------------*/
5141eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5142{
5143
5144 eHalStatus status = eHAL_STATUS_FAILURE;
5145 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5146
5147 status = sme_AcquireGlobalLock( &pMac->sme );
5148 if ( HAL_STATUS_SUCCESS( status ) )
5149 {
5150
5151 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5152
5153 sme_ReleaseGlobalLock( &pMac->sme );
5154 }
5155
5156 return (status);
5157}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005158/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005159
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005160 \fn sme_ChangeMCCBeaconInterval
5161
5162 \brief To update P2P-GO beaconInterval. This function should be called after
5163 disassociating all the station is done
5164 This is an asynchronous API.
5165
5166 \param
5167
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005168 \return eHalStatus SUCCESS
5169 FAILURE or RESOURCES
5170 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005171
5172 -------------------------------------------------------------------------------*/
5173eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5174{
5175 eHalStatus status = eHAL_STATUS_FAILURE;
5176 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5177
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005178 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005179 status = sme_AcquireGlobalLock( &pMac->sme );
5180 if ( HAL_STATUS_SUCCESS( status ) )
5181 {
5182 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5183 sme_ReleaseGlobalLock( &pMac->sme );
5184 }
5185 return (status);
5186}
Jeff Johnson295189b2012-06-20 16:38:30 -07005187
5188/*-------------------------------------------------------------------------------*
5189
5190 \fn sme_sendBTAmpEvent
5191
5192 \brief to receive the coex priorty request from BT-AMP PAL
5193 and send the BT_AMP link state to HAL
5194
5195 \param btAmpEvent - btAmpEvent
5196
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005197 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005198
5199 FAILURE: API failed
5200
5201-------------------------------------------------------------------------------*/
5202
5203eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5204{
5205 vos_msg_t msg;
5206 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5207 eHalStatus status = eHAL_STATUS_FAILURE;
5208
5209 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5210 if (NULL == ptrSmeBtAmpEvent)
5211 {
5212 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005213 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005214 return status;
5215 }
5216
5217 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5218 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5219 msg.reserved = 0;
5220 msg.bodyptr = ptrSmeBtAmpEvent;
5221
5222 //status = halFW_SendBTAmpEventMesg(pMac, event);
5223
5224 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5225 {
5226 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005227 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005228 vos_mem_free(ptrSmeBtAmpEvent);
5229 return status;
5230 }
5231
5232 return eHAL_STATUS_SUCCESS;
5233
5234}
5235
5236/* ---------------------------------------------------------------------------
5237 \fn sme_SetHostOffload
5238 \brief API to set the host offload feature.
5239 \param hHal - The handle returned by macOpen.
5240 \param pRequest - Pointer to the offload request.
5241 \return eHalStatus
5242 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005243eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5244 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005245{
5246 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005247 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005248
5249 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5250 {
5251#ifdef WLAN_NS_OFFLOAD
5252 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5253 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005254 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005255 }
5256 else
5257#endif //WLAN_NS_OFFLOAD
5258 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005259 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005260 }
5261 sme_ReleaseGlobalLock( &pMac->sme );
5262 }
5263
5264 return (status);
5265}
5266
5267#ifdef WLAN_FEATURE_GTK_OFFLOAD
5268/* ---------------------------------------------------------------------------
5269 \fn sme_SetGTKOffload
5270 \brief API to set GTK offload information.
5271 \param hHal - The handle returned by macOpen.
5272 \param pRequest - Pointer to the GTK offload request.
5273 \return eHalStatus
5274 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005275eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5276 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005277{
5278 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5279 eHalStatus status;
5280
5281 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5282 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005283 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005284 sme_ReleaseGlobalLock( &pMac->sme );
5285 }
5286
5287 return (status);
5288}
5289
5290/* ---------------------------------------------------------------------------
5291 \fn sme_GetGTKOffload
5292 \brief API to get GTK offload information.
5293 \param hHal - The handle returned by macOpen.
5294 \param pRequest - Pointer to the GTK offload response.
5295 \return eHalStatus
5296 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005297eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5298 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005299{
5300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5301 eHalStatus status;
5302
5303 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5304 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005305 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005306 sme_ReleaseGlobalLock( &pMac->sme );
5307 }
5308
5309 return (status);
5310}
5311#endif // WLAN_FEATURE_GTK_OFFLOAD
5312
5313/* ---------------------------------------------------------------------------
5314 \fn sme_SetKeepAlive
5315 \brief API to set the Keep Alive feature.
5316 \param hHal - The handle returned by macOpen.
5317 \param pRequest - Pointer to the Keep Alive request.
5318 \return eHalStatus
5319 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005320eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5321 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005322{
5323 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5324 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005325 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5326 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005327 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005328 sme_ReleaseGlobalLock( &pMac->sme );
5329 }
5330
5331 return (status);
5332}
5333
5334#ifdef FEATURE_WLAN_SCAN_PNO
5335/* ---------------------------------------------------------------------------
5336 \fn sme_SetPreferredNetworkList
5337 \brief API to set the Preferred Network List Offload feature.
5338 \param hHal - The handle returned by macOpen.
5339 \param pRequest - Pointer to the offload request.
5340 \return eHalStatus
5341 ---------------------------------------------------------------------------*/
5342eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5343{
5344 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5345 eHalStatus status;
5346
5347 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5348 {
5349 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5350 sme_ReleaseGlobalLock( &pMac->sme );
5351 }
5352
5353 return (status);
5354}
5355
5356eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5357{
5358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5359 eHalStatus status;
5360
5361 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5362 {
5363 pmcSetRssiFilter(hHal, rssiThreshold);
5364 sme_ReleaseGlobalLock( &pMac->sme );
5365 }
5366
5367 return (status);
5368}
5369
5370#endif // FEATURE_WLAN_SCAN_PNO
5371
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005372eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005373{
5374 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5375 eHalStatus status;
5376
5377 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5378 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005379 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005380 sme_ReleaseGlobalLock( &pMac->sme );
5381 }
5382
5383 return (status);
5384}
5385
5386/* ---------------------------------------------------------------------------
5387 \fn sme_AbortMacScan
5388 \brief API to cancel MAC scan.
5389 \param hHal - The handle returned by macOpen.
5390 \return VOS_STATUS
5391 VOS_STATUS_E_FAILURE - failure
5392 VOS_STATUS_SUCCESS success
5393 ---------------------------------------------------------------------------*/
5394eHalStatus sme_AbortMacScan(tHalHandle hHal)
5395{
5396 eHalStatus status;
5397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5398
5399 status = sme_AcquireGlobalLock( &pMac->sme );
5400 if ( HAL_STATUS_SUCCESS( status ) )
5401 {
5402 status = csrScanAbortMacScan(pMac);
5403
5404 sme_ReleaseGlobalLock( &pMac->sme );
5405 }
5406
5407 return ( status );
5408}
5409
5410/* ----------------------------------------------------------------------------
5411 \fn sme_GetOperationChannel
5412 \brief API to get current channel on which STA is parked
5413 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005414 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005415 \returns eHAL_STATUS_SUCCESS
5416 eHAL_STATUS_FAILURE
5417-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005418eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005419{
Jeff Johnson295189b2012-06-20 16:38:30 -07005420 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5421 tCsrRoamSession *pSession;
5422
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005423 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005424 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005425 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005426
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005427 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5428 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005429 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005430 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5431 {
5432 *pChannel =pSession->connectedProfile.operationChannel;
5433 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005434 }
5435 }
5436 return eHAL_STATUS_FAILURE;
5437}// sme_GetOperationChannel ends here
5438
Jeff Johnson295189b2012-06-20 16:38:30 -07005439/* ---------------------------------------------------------------------------
5440
5441 \fn sme_RegisterMgtFrame
5442
5443 \brief To register managment frame of specified type and subtype.
5444 \param frameType - type of the frame that needs to be passed to HDD.
5445 \param matchData - data which needs to be matched before passing frame
5446 to HDD.
5447 \param matchDataLen - Length of matched data.
5448 \return eHalStatus
5449 -------------------------------------------------------------------------------*/
5450eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5451 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5452{
5453 eHalStatus status = eHAL_STATUS_SUCCESS;
5454 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5455
5456 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5457 {
5458 tSirRegisterMgmtFrame *pMsg;
5459 tANI_U16 len;
5460 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005461
5462 if(!pSession)
5463 {
5464 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005465 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005466 return eHAL_STATUS_FAILURE;
5467 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005468
5469 if( !pSession->sessionActive )
5470 {
5471 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005472 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005473 sme_ReleaseGlobalLock( &pMac->sme );
5474 return eHAL_STATUS_FAILURE;
5475 }
5476
5477 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5478
5479 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5480 if(HAL_STATUS_SUCCESS(status))
5481 {
5482 palZeroMemory(pMac->hHdd, pMsg, len);
5483 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5484 pMsg->length = len;
5485 pMsg->sessionId = sessionId;
5486 pMsg->registerFrame = VOS_TRUE;
5487 pMsg->frameType = frameType;
5488 pMsg->matchLen = matchLen;
5489 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5490 status = palSendMBMessage(pMac->hHdd, pMsg);
5491 }
5492 sme_ReleaseGlobalLock( &pMac->sme );
5493 }
5494 return status;
5495}
5496
5497/* ---------------------------------------------------------------------------
5498
5499 \fn sme_DeregisterMgtFrame
5500
5501 \brief To De-register managment frame of specified type and subtype.
5502 \param frameType - type of the frame that needs to be passed to HDD.
5503 \param matchData - data which needs to be matched before passing frame
5504 to HDD.
5505 \param matchDataLen - Length of matched data.
5506 \return eHalStatus
5507 -------------------------------------------------------------------------------*/
5508eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5509 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5510{
5511 eHalStatus status = eHAL_STATUS_SUCCESS;
5512 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5513
5514 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5515 {
5516 tSirRegisterMgmtFrame *pMsg;
5517 tANI_U16 len;
5518 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005519
5520 if(!pSession)
5521 {
5522 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005523 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005524 return eHAL_STATUS_FAILURE;
5525 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005526
5527 if( !pSession->sessionActive )
5528 {
5529 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005530 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005531 sme_ReleaseGlobalLock( &pMac->sme );
5532 return eHAL_STATUS_FAILURE;
5533 }
5534
5535 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5536
5537 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5538 if(HAL_STATUS_SUCCESS(status))
5539 {
5540 palZeroMemory(pMac->hHdd, pMsg, len);
5541 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5542 pMsg->length = len;
5543 pMsg->registerFrame = VOS_FALSE;
5544 pMsg->frameType = frameType;
5545 pMsg->matchLen = matchLen;
5546 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5547 status = palSendMBMessage(pMac->hHdd, pMsg);
5548 }
5549 sme_ReleaseGlobalLock( &pMac->sme );
5550 }
5551 return status;
5552}
5553
5554/* ---------------------------------------------------------------------------
5555 \fn sme_RemainOnChannel
5556 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
5557 \param hHal - The handle returned by macOpen.
5558 \param pRequest - channel
5559 \param duration - duration in ms
5560 \param callback - HDD registered callback to process reaminOnChannelRsp
5561 \param context - HDD Callback param
5562 \return eHalStatus
5563 ---------------------------------------------------------------------------*/
5564
5565eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
5566 tANI_U8 channel, tANI_U32 duration,
5567 remainOnChanCallback callback,
5568 void *pContext)
5569{
5570 eHalStatus status = eHAL_STATUS_SUCCESS;
5571 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5572
5573 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5574 {
5575 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext
5576#ifdef WLAN_FEATURE_P2P_INTERNAL
5577 , eP2PRemainOnChnReasonUnknown
5578#endif
5579 );
5580 sme_ReleaseGlobalLock( &pMac->sme );
5581 }
5582 return(status);
5583}
5584
5585/* ---------------------------------------------------------------------------
5586 \fn sme_ReportProbeReq
5587 \brief API to enable/disable forwarding of probeReq to apps in p2p.
5588 \param hHal - The handle returned by macOpen.
5589 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
5590 \return eHalStatus
5591 ---------------------------------------------------------------------------*/
5592
5593#ifndef WLAN_FEATURE_CONCURRENT_P2P
5594eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
5595{
5596 eHalStatus status = eHAL_STATUS_SUCCESS;
5597 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5598
5599 do
5600 {
5601 //acquire the lock for the sme object
5602 status = sme_AcquireGlobalLock(&pMac->sme);
5603 if(HAL_STATUS_SUCCESS(status))
5604 {
5605 /* call set in context */
5606 pMac->p2pContext.probeReqForwarding = flag;
5607 //release the lock for the sme object
5608 sme_ReleaseGlobalLock( &pMac->sme );
5609 }
5610 } while(0);
5611
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005612 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005613
5614 return(status);
5615}
5616
5617/* ---------------------------------------------------------------------------
5618 \fn sme_updateP2pIe
5619 \brief API to set the P2p Ie in p2p context
5620 \param hHal - The handle returned by macOpen.
5621 \param p2pIe - Ptr to p2pIe from HDD.
5622 \param p2pIeLength: length of p2pIe
5623 \return eHalStatus
5624 ---------------------------------------------------------------------------*/
5625
5626eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
5627{
5628 eHalStatus status = eHAL_STATUS_SUCCESS;
5629 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5630
5631 //acquire the lock for the sme object
5632 status = sme_AcquireGlobalLock(&pMac->sme);
5633 if(HAL_STATUS_SUCCESS(status))
5634 {
5635 if(NULL != pMac->p2pContext.probeRspIe){
5636 vos_mem_free(pMac->p2pContext.probeRspIe);
5637 pMac->p2pContext.probeRspIeLength = 0;
5638 }
5639
5640 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
5641 if (NULL == pMac->p2pContext.probeRspIe)
5642 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005643 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005644 pMac->p2pContext.probeRspIeLength = 0;
5645 status = eHAL_STATUS_FAILURE;
5646 }
5647 else
5648 {
5649 pMac->p2pContext.probeRspIeLength = p2pIeLength;
5650
5651 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
5652 pMac->p2pContext.probeRspIe,
5653 pMac->p2pContext.probeRspIeLength );
5654 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
5655 p2pIeLength);
5656 }
5657
5658 //release the lock for the sme object
5659 sme_ReleaseGlobalLock( &pMac->sme );
5660 }
5661
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005662 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005663
5664 return(status);
5665}
5666#endif
5667
5668/* ---------------------------------------------------------------------------
5669 \fn sme_sendAction
5670 \brief API to send action frame from supplicant.
5671 \param hHal - The handle returned by macOpen.
5672 \return eHalStatus
5673 ---------------------------------------------------------------------------*/
5674
5675eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07005676 const tANI_U8 *pBuf, tANI_U32 len,
5677 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07005678{
5679 eHalStatus status = eHAL_STATUS_SUCCESS;
5680 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5681
5682 //acquire the lock for the sme object
5683 status = sme_AcquireGlobalLock(&pMac->sme);
5684 if(HAL_STATUS_SUCCESS(status))
5685 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005686 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07005687 //release the lock for the sme object
5688 sme_ReleaseGlobalLock( &pMac->sme );
5689 }
5690
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005691 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005692
5693 return(status);
5694}
5695
5696eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
5697{
5698 eHalStatus status = eHAL_STATUS_SUCCESS;
5699 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5700
5701 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5702 {
5703 status = p2pCancelRemainOnChannel (hHal, sessionId);
5704 sme_ReleaseGlobalLock( &pMac->sme );
5705 }
5706 return(status);
5707}
5708
5709//Power Save Related
5710eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
5711{
5712 eHalStatus status = eHAL_STATUS_SUCCESS;
5713 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5714
5715 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5716 {
5717 status = p2pSetPs (hHal, data);
5718 sme_ReleaseGlobalLock( &pMac->sme );
5719 }
5720 return(status);
5721}
5722
Jeff Johnson295189b2012-06-20 16:38:30 -07005723
5724/* ---------------------------------------------------------------------------
5725
5726 \fn sme_ConfigureRxpFilter
5727
5728 \brief
5729 SME will pass this request to lower mac to set/reset the filter on RXP for
5730 multicast & broadcast traffic.
5731
5732 \param
5733
5734 hHal - The handle returned by macOpen.
5735
5736 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
5737 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
5738 on this param. In future we can use this as a mask to set various types of
5739 filters as suggested below:
5740 FILTER_ALL_MULTICAST:
5741 FILTER_ALL_BROADCAST:
5742 FILTER_ALL_MULTICAST_BROADCAST:
5743
5744
5745 \return eHalStatus
5746
5747
5748--------------------------------------------------------------------------- */
5749eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
5750 tpSirWlanSetRxpFilters wlanRxpFilterParam)
5751{
5752 eHalStatus status = eHAL_STATUS_SUCCESS;
5753 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5754 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5755 vos_msg_t vosMessage;
5756
5757 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5758 {
5759 /* serialize the req through MC thread */
5760 vosMessage.bodyptr = wlanRxpFilterParam;
5761 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
5762 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5763 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5764 {
5765 status = eHAL_STATUS_FAILURE;
5766 }
5767 sme_ReleaseGlobalLock( &pMac->sme );
5768 }
5769 return(status);
5770}
5771
Jeff Johnson295189b2012-06-20 16:38:30 -07005772/* ---------------------------------------------------------------------------
5773
5774 \fn sme_ConfigureSuspendInd
5775
5776 \brief
5777 SME will pass this request to lower mac to Indicate that the wlan needs to
5778 be suspended
5779
5780 \param
5781
5782 hHal - The handle returned by macOpen.
5783
5784 wlanSuspendParam- Depicts the wlan suspend params
5785
5786
5787 \return eHalStatus
5788
5789
5790--------------------------------------------------------------------------- */
5791eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
5792 tpSirWlanSuspendParam wlanSuspendParam)
5793{
5794 eHalStatus status = eHAL_STATUS_SUCCESS;
5795 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5796 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5797 vos_msg_t vosMessage;
5798
5799 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5800 {
5801 /* serialize the req through MC thread */
5802 vosMessage.bodyptr = wlanSuspendParam;
5803 vosMessage.type = WDA_WLAN_SUSPEND_IND;
5804 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5805 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5806 {
5807 status = eHAL_STATUS_FAILURE;
5808 }
5809 sme_ReleaseGlobalLock( &pMac->sme );
5810 }
5811 return(status);
5812}
5813
5814/* ---------------------------------------------------------------------------
5815
5816 \fn sme_ConfigureResumeReq
5817
5818 \brief
5819 SME will pass this request to lower mac to Indicate that the wlan needs to
5820 be Resumed
5821
5822 \param
5823
5824 hHal - The handle returned by macOpen.
5825
5826 wlanResumeParam- Depicts the wlan resume params
5827
5828
5829 \return eHalStatus
5830
5831
5832--------------------------------------------------------------------------- */
5833eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
5834 tpSirWlanResumeParam wlanResumeParam)
5835{
5836 eHalStatus status = eHAL_STATUS_SUCCESS;
5837 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5838 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5839 vos_msg_t vosMessage;
5840
5841 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5842 {
5843 /* serialize the req through MC thread */
5844 vosMessage.bodyptr = wlanResumeParam;
5845 vosMessage.type = WDA_WLAN_RESUME_REQ;
5846 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5847 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5848 {
5849 status = eHAL_STATUS_FAILURE;
5850 }
5851 sme_ReleaseGlobalLock( &pMac->sme );
5852 }
5853 return(status);
5854}
5855
Jeff Johnson295189b2012-06-20 16:38:30 -07005856/* ---------------------------------------------------------------------------
5857
5858 \fn sme_GetInfraSessionId
5859
5860 \brief To get the session ID for infra session, if connected
5861 This is a synchronous API.
5862
5863 \param hHal - The handle returned by macOpen.
5864
5865 \return sessionid, -1 if infra session is not connected
5866
5867 -------------------------------------------------------------------------------*/
5868tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
5869{
5870 eHalStatus status = eHAL_STATUS_FAILURE;
5871 tANI_S8 sessionid = -1;
5872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5873
5874 status = sme_AcquireGlobalLock( &pMac->sme );
5875 if ( HAL_STATUS_SUCCESS( status ) )
5876 {
5877
5878 sessionid = csrGetInfraSessionId( pMac);
5879
5880 sme_ReleaseGlobalLock( &pMac->sme );
5881 }
5882
5883 return (sessionid);
5884}
5885
5886/* ---------------------------------------------------------------------------
5887
5888 \fn sme_GetInfraOperationChannel
5889
5890 \brief To get the operating channel for infra session, if connected
5891 This is a synchronous API.
5892
5893 \param hHal - The handle returned by macOpen.
5894 \param sessionId - the sessionId returned by sme_OpenSession.
5895
5896 \return operating channel, 0 if infra session is not connected
5897
5898 -------------------------------------------------------------------------------*/
5899tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
5900{
5901 eHalStatus status = eHAL_STATUS_FAILURE;
5902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5903 tANI_U8 channel = 0;
5904 status = sme_AcquireGlobalLock( &pMac->sme );
5905 if ( HAL_STATUS_SUCCESS( status ) )
5906 {
5907
5908 channel = csrGetInfraOperationChannel( pMac, sessionId);
5909
5910 sme_ReleaseGlobalLock( &pMac->sme );
5911 }
5912
5913 return (channel);
5914}
5915
5916//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
5917//If other BSS is not up or not connected it will return 0
5918tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
5919{
5920 eHalStatus status = eHAL_STATUS_FAILURE;
5921 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5922 tANI_U8 channel = 0;
5923 status = sme_AcquireGlobalLock( &pMac->sme );
5924 if ( HAL_STATUS_SUCCESS( status ) )
5925 {
5926
5927 channel = csrGetConcurrentOperationChannel( pMac );
5928 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005929 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07005930 sme_ReleaseGlobalLock( &pMac->sme );
5931 }
5932
5933 return (channel);
5934}
5935
5936#ifdef FEATURE_WLAN_SCAN_PNO
5937/******************************************************************************
5938*
5939* Name: sme_PreferredNetworkFoundInd
5940*
5941* Description:
5942* Invoke Preferred Network Found Indication
5943*
5944* Parameters:
5945* hHal - HAL handle for device
5946* pMsg - found network description
5947*
5948* Returns: eHalStatus
5949*
5950******************************************************************************/
5951eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
5952{
5953 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5954 eHalStatus status = eHAL_STATUS_SUCCESS;
5955 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
5956
5957 if (NULL == pMsg)
5958 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005959 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 status = eHAL_STATUS_FAILURE;
5961 }
5962 else
5963 {
5964 if (pPrefNetworkFoundInd->ssId.length > 0)
5965 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005966 smsLog(pMac, LOG1, "Preferred Network Found Indication in %s(), SSID=%s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005967 __func__, pPrefNetworkFoundInd->ssId.ssId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005968
5969
5970 /* Call Preferred Netowrk Found Indication callback routine. */
5971 if (pMac->pmc.prefNetwFoundCB != NULL)
5972 {
5973 pMac->pmc.prefNetwFoundCB(pMac->pmc.preferredNetworkFoundIndCallbackContext, pPrefNetworkFoundInd);
5974 }
5975
5976 }
5977 else
5978 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005979 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005980 status = eHAL_STATUS_FAILURE;
5981 }
5982 }
5983
5984
5985 return(status);
5986}
5987
5988#endif // FEATURE_WLAN_SCAN_PNO
5989
5990
5991eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
5992{
5993 eHalStatus status = eHAL_STATUS_FAILURE;
5994 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5995
5996 status = sme_AcquireGlobalLock( &pMac->sme );
5997 if ( HAL_STATUS_SUCCESS( status ) )
5998 {
5999 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6000 sme_ReleaseGlobalLock( &pMac->sme );
6001 }
6002
6003 return (status);
6004}
6005
6006
6007/* ---------------------------------------------------------------------------
6008
6009 \fn sme_SetTxPerTracking
6010
6011 \brief Set Tx PER tracking configuration parameters
6012
6013 \param hHal - The handle returned by macOpen.
6014 \param pTxPerTrackingConf - Tx PER configuration parameters
6015
6016 \return eHalStatus
6017
6018 -------------------------------------------------------------------------------*/
6019eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6020 void (*pCallbackfn) (void *pCallbackContext),
6021 void *pCallbackContext,
6022 tpSirTxPerTrackingParam pTxPerTrackingParam)
6023{
6024 vos_msg_t msg;
6025 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6026 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6027
6028 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6029 {
6030 pMac->sme.pTxPerHitCallback = pCallbackfn;
6031 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6032 sme_ReleaseGlobalLock( &pMac->sme );
6033 }
6034
6035 // free this memory in failure case or WDA request callback function
6036 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6037 if (NULL == pTxPerTrackingParamReq)
6038 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006039 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 -07006040 return eHAL_STATUS_FAILURE;
6041 }
6042
6043 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
6044 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6045 msg.reserved = 0;
6046 msg.bodyptr = pTxPerTrackingParamReq;
6047
6048 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6049 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006050 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 -07006051 vos_mem_free(pTxPerTrackingParamReq);
6052 return eHAL_STATUS_FAILURE;
6053 }
6054
6055 return eHAL_STATUS_SUCCESS;
6056}
6057
6058/* ---------------------------------------------------------------------------
6059
6060 \fn sme_HandleChangeCountryCode
6061
6062 \brief Change Country code, Reg Domain and channel list
6063
6064 \details Country Code Priority
6065 0 = 11D > Configured Country > NV
6066 1 = Configured Country > 11D > NV
6067 If Supplicant country code is priority than 11d is disabled.
6068 If 11D is enabled, we update the country code after every scan.
6069 Hence when Supplicant country code is priority, we don't need 11D info.
6070 Country code from Supplicant is set as current courtry code.
6071 User can send reset command XX (instead of country code) to reset the
6072 country code to default values which is read from NV.
6073 In case of reset, 11D is enabled and default NV code is Set as current country code
6074 If 11D is priority,
6075 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6076
6077 \param pMac - The handle returned by macOpen.
6078 \param pMsgBuf - MSG Buffer
6079
6080 \return eHalStatus
6081
6082 -------------------------------------------------------------------------------*/
6083eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6084{
6085 eHalStatus status = eHAL_STATUS_SUCCESS;
6086 tAniChangeCountryCodeReq *pMsg;
6087 v_REGDOMAIN_t domainIdIoctl;
6088 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6089 static uNvTables nvTables;
6090 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6091
6092
6093 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6094 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6095 {
6096 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6097
6098 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6099
6100 /* read the country code from NV and use it */
6101 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6102 {
6103 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6104 }
6105 else
6106 {
6107 status = eHAL_STATUS_FAILURE;
6108 return status;
6109 }
6110 }
6111 else
6112 {
6113 /* if Supplicant country code has priority, disable 11d */
6114 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
6115 {
6116 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6117 }
6118 }
6119
6120 /* WEXT set country code means
6121 * 11D should be supported?
6122 * 11D Channel should be enforced?
6123 * 11D Country code should be matched?
6124 * 11D Reg Domian should be matched?
6125 * Country string changed */
6126 if(pMac->roam.configParam.Is11dSupportEnabled &&
6127 pMac->roam.configParam.fEnforce11dChannels &&
6128 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6129 pMac->roam.configParam.fEnforceDefaultDomain &&
6130 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6131 {
6132 /* All 11D related options are already enabled
6133 * Country string is not changed
6134 * Do not need do anything for country code change request */
6135 return eHAL_STATUS_SUCCESS;
6136 }
6137
6138 /* Set Current Country code and Current Regulatory domain */
6139 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6140 if(eHAL_STATUS_SUCCESS != status)
6141 {
6142 /* Supplicant country code failed. So give 11D priority */
6143 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6144 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6145 return status;
6146 }
6147
6148 /* purge current scan results
6149 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).
6150 Looks like a bug in current scan sequence.
6151 */
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07006152 csrScanFlushResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07006153
6154 /* overwrite the defualt country code */
6155 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6156
6157 /* Get Domain ID from country code */
6158 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6159 if ( status != eHAL_STATUS_SUCCESS )
6160 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006161 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006162 return status;
6163 }
6164
6165 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6166
6167 if ( status != eHAL_STATUS_SUCCESS )
6168 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006169 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006170 return status;
6171 }
6172
6173 /* set to default domain ID */
6174 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6175
6176 /* get the channels based on new cc */
6177 status = csrInitGetChannels( pMac );
6178
6179 if ( status != eHAL_STATUS_SUCCESS )
6180 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006181 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006182 return status;
6183 }
6184
6185 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006186 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006187 if( pMsg->changeCCCallback )
6188 {
6189 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6190 }
6191
6192 return eHAL_STATUS_SUCCESS;
6193}
6194
6195#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006196eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006197{
6198 tpSirRcvFltMcAddrList pRequestBuf;
6199 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006200 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006201 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006202
6203 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006204 "ulMulticastAddrCnt=%d, multicastAddr[0]=%d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006205 pMulticastAddrs->ulMulticastAddrCnt,
6206 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006207
6208 /*
6209 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006210 */
6211 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6212 csrIsConnStateInfra(pMac, sessionId))
6213 {
6214 pSession = CSR_GET_SESSION( pMac, sessionId );
6215 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006216
6217 if(pSession == NULL )
6218 {
6219 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006220 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006221 return eHAL_STATUS_FAILURE;
6222 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006223
Jeff Johnson295189b2012-06-20 16:38:30 -07006224 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6225 if (NULL == pRequestBuf)
6226 {
6227 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006228 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006229 return eHAL_STATUS_FAILED_ALLOC;
6230 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006231
6232 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6233 {
6234 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6235 "indication as we are not connected", __func__);
6236 vos_mem_free(pRequestBuf);
6237 return eHAL_STATUS_FAILURE;
6238 }
6239
Jeff Johnson295189b2012-06-20 16:38:30 -07006240 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6241
Jeff Johnsone7245742012-09-05 17:12:55 -07006242 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6243 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6244 sizeof(tSirMacAddr));
6245
Jeff Johnson295189b2012-06-20 16:38:30 -07006246 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6247 msg.reserved = 0;
6248 msg.bodyptr = pRequestBuf;
6249 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6250 {
6251 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006252 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006253 vos_mem_free(pRequestBuf);
6254 return eHAL_STATUS_FAILURE;
6255 }
6256
6257 return eHAL_STATUS_SUCCESS;
6258}
6259
Jeff Johnsone7245742012-09-05 17:12:55 -07006260eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6261 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006262{
6263 tpSirRcvPktFilterCfgType pRequestBuf;
6264 v_SINT_t allocSize;
6265 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006266 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6267 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006268 v_U8_t idx=0;
6269
6270 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006271 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006272 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6273
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006274 allocSize = sizeof(tSirRcvPktFilterCfgType);
6275
Jeff Johnson295189b2012-06-20 16:38:30 -07006276 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006277
6278 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006279 {
6280 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006281 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006282 return eHAL_STATUS_FAILED_ALLOC;
6283 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006284
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006285 if( NULL == pSession )
6286 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006287 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006288 vos_mem_free(pRequestBuf);
6289 return eHAL_STATUS_FAILURE;
6290 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006291
6292 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6293 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006294 sizeof(tSirMacAddr));
6295
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006296 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6297
Jeff Johnson295189b2012-06-20 16:38:30 -07006298 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6299 msg.reserved = 0;
6300 msg.bodyptr = pRequestBuf;
6301
6302 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6303 "FT %d FID %d ",
6304 pRequestBuf->filterType, pRequestBuf->filterId);
6305
6306 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6307 "params %d CT %d",
6308 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6309
6310 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6311 {
6312
6313 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006314 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006315 pRequestBuf->paramsData[idx].protocolLayer,
6316 pRequestBuf->paramsData[idx].cmpFlag);
6317
6318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006319 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006320 pRequestBuf->paramsData[idx].dataOffset,
6321 pRequestBuf->paramsData[idx].dataLength);
6322
6323 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006324 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006325 pRequestBuf->paramsData[idx].compareData[0],
6326 pRequestBuf->paramsData[idx].compareData[1],
6327 pRequestBuf->paramsData[idx].compareData[2],
6328 pRequestBuf->paramsData[idx].compareData[3],
6329 pRequestBuf->paramsData[idx].compareData[4],
6330 pRequestBuf->paramsData[idx].compareData[5]);
6331
6332 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006333 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006334 pRequestBuf->paramsData[idx].dataMask[0],
6335 pRequestBuf->paramsData[idx].dataMask[1],
6336 pRequestBuf->paramsData[idx].dataMask[2],
6337 pRequestBuf->paramsData[idx].dataMask[3],
6338 pRequestBuf->paramsData[idx].dataMask[4],
6339 pRequestBuf->paramsData[idx].dataMask[5]);
6340
6341 }
6342
6343 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6344 {
6345 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006346 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006347 vos_mem_free(pRequestBuf);
6348 return eHAL_STATUS_FAILURE;
6349 }
6350
6351 return eHAL_STATUS_SUCCESS;
6352}
6353
6354eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6355 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006356 void *callbackContext,
6357 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006358{
6359 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6360 eHalStatus status;
6361
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006362 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006363
6364 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6365 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006366 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006367 sme_ReleaseGlobalLock( &pMac->sme );
6368 }
6369
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006370 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006371
6372 return (status);
6373}
6374
Jeff Johnsone7245742012-09-05 17:12:55 -07006375eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6376 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006377{
6378 tpSirRcvFltPktClearParam pRequestBuf;
6379 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006380 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6381 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006382
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006383 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006384 pRcvFltPktClearParam->filterId);
6385
6386 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006387 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006388 {
6389 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6390 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006391 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006392 return eHAL_STATUS_FAILED_ALLOC;
6393 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006394 if( NULL == pSession )
6395 {
6396 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006397 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006398 vos_mem_free(pRequestBuf);
6399 return eHAL_STATUS_FAILURE;
6400 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006401
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006402 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6403 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006404 sizeof(tSirMacAddr));
6405
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006406 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6407
Jeff Johnson295189b2012-06-20 16:38:30 -07006408 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6409 msg.reserved = 0;
6410 msg.bodyptr = pRequestBuf;
6411 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6412 {
6413 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006414 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006415 vos_mem_free(pRequestBuf);
6416 return eHAL_STATUS_FAILURE;
6417 }
6418
6419 return eHAL_STATUS_SUCCESS;
6420}
6421#endif // WLAN_FEATURE_PACKET_FILTERING
6422
6423/* ---------------------------------------------------------------------------
6424 \fn sme_PreChannelSwitchIndFullPowerCB
6425 \brief call back function for the PMC full power request because of pre
6426 channel switch.
6427 \param callbackContext
6428 \param status
6429 ---------------------------------------------------------------------------*/
6430void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6431 eHalStatus status)
6432{
6433 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6434 tSirMbMsg *pMsg;
6435 tANI_U16 msgLen;
6436
6437 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6438 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6439 if(HAL_STATUS_SUCCESS(status))
6440 {
6441 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6442 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6443 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6444 status = palSendMBMessage(pMac->hHdd, pMsg);
6445 }
6446
6447 return;
6448}
6449
6450/* ---------------------------------------------------------------------------
6451 \fn sme_HandlePreChannelSwitchInd
6452 \brief Processes the indcation from PE for pre-channel switch.
6453 \param hHal
6454 \- The handle returned by macOpen. return eHalStatus
6455 ---------------------------------------------------------------------------*/
6456eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6457{
6458 eHalStatus status = eHAL_STATUS_FAILURE;
6459 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6460 status = sme_AcquireGlobalLock( &pMac->sme );
6461 if ( HAL_STATUS_SUCCESS( status ) )
6462 {
6463 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6464 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6465 sme_ReleaseGlobalLock( &pMac->sme );
6466 }
6467
6468 return (status);
6469}
6470
6471/* ---------------------------------------------------------------------------
6472 \fn sme_HandlePostChannelSwitchInd
6473 \brief Processes the indcation from PE for post-channel switch.
6474 \param hHal
6475 \- The handle returned by macOpen. return eHalStatus
6476 ---------------------------------------------------------------------------*/
6477eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6478{
6479 eHalStatus status = eHAL_STATUS_FAILURE;
6480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6481
6482 status = sme_AcquireGlobalLock( &pMac->sme );
6483 if ( HAL_STATUS_SUCCESS( status ) )
6484 {
6485 status = pmcRequestBmps(hHal, NULL, NULL);
6486 sme_ReleaseGlobalLock( &pMac->sme );
6487 }
6488
6489 return (status);
6490}
6491
6492/* ---------------------------------------------------------------------------
6493
6494 \fn sme_IsChannelValid
6495
6496 \brief To check if the channel is valid for currently established domain
6497 This is a synchronous API.
6498
6499 \param hHal - The handle returned by macOpen.
6500 \param channel - channel to verify
6501
6502 \return TRUE/FALSE, TRUE if channel is valid
6503
6504 -------------------------------------------------------------------------------*/
6505tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6506{
6507 eHalStatus status = eHAL_STATUS_FAILURE;
6508 tANI_BOOLEAN valid = FALSE;
6509 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6510
6511 status = sme_AcquireGlobalLock( &pMac->sme );
6512 if ( HAL_STATUS_SUCCESS( status ) )
6513 {
6514
6515 valid = csrRoamIsChannelValid( pMac, channel);
6516
6517 sme_ReleaseGlobalLock( &pMac->sme );
6518 }
6519
6520 return (valid);
6521}
6522
6523/* ---------------------------------------------------------------------------
6524 \fn sme_SetFreqBand
6525 \brief Used to set frequency band.
6526 \param hHal
6527 \eBand band value to be configured
6528 \- return eHalStatus
6529 -------------------------------------------------------------------------*/
6530eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
6531{
6532 eHalStatus status = eHAL_STATUS_FAILURE;
6533 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6534
6535 status = sme_AcquireGlobalLock( &pMac->sme );
6536 if ( HAL_STATUS_SUCCESS( status ) )
6537 {
6538 status = csrSetBand(hHal, eBand);
6539 sme_ReleaseGlobalLock( &pMac->sme );
6540 }
6541 return status;
6542}
6543
6544/* ---------------------------------------------------------------------------
6545 \fn sme_GetFreqBand
6546 \brief Used to get the current band settings.
6547 \param hHal
6548 \pBand pointer to hold band value
6549 \- return eHalStatus
6550 -------------------------------------------------------------------------*/
6551eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
6552{
6553 eHalStatus status = eHAL_STATUS_FAILURE;
6554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6555
6556 status = sme_AcquireGlobalLock( &pMac->sme );
6557 if ( HAL_STATUS_SUCCESS( status ) )
6558 {
6559 *pBand = csrGetCurrentBand( hHal );
6560 sme_ReleaseGlobalLock( &pMac->sme );
6561 }
6562 return status;
6563}
6564
6565#ifdef WLAN_WAKEUP_EVENTS
6566/******************************************************************************
6567 \fn sme_WakeReasonIndCallback
6568
6569 \brief
6570 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
6571
6572 \param hHal - HAL handle for device
6573 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
6574
6575 \return eHalStatus
6576******************************************************************************/
6577eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
6578{
6579 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6580 eHalStatus status = eHAL_STATUS_SUCCESS;
6581 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
6582
6583 if (NULL == pMsg)
6584 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006585 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006586 status = eHAL_STATUS_FAILURE;
6587 }
6588 else
6589 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006590 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07006591
6592 /* Call Wake Reason Indication callback routine. */
6593 if (pMac->pmc.wakeReasonIndCB != NULL)
6594 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
6595
6596 pMac->pmc.wakeReasonIndCB = NULL;
6597 pMac->pmc.wakeReasonIndCBContext = NULL;
6598
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006599 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07006600 }
6601
6602 return(status);
6603}
6604#endif // WLAN_WAKEUP_EVENTS
6605
6606
6607/* ---------------------------------------------------------------------------
6608
6609 \fn sme_SetMaxTxPower
6610
6611 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
6612 not persist over reboots.
6613
6614 \param hHal
6615 \param pBssid BSSID to set the power cap for
6616 \param pBssid pSelfMacAddress self MAC Address
6617 \param pBssid power to set in dB
6618 \- return eHalStatus
6619
6620 -------------------------------------------------------------------------------*/
6621eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
6622 tSirMacAddr pSelfMacAddress, v_S7_t dB)
6623{
6624 vos_msg_t msg;
6625 tpMaxTxPowerParams pMaxTxParams = NULL;
6626
6627 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
6628 if (NULL == pMaxTxParams)
6629 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006630 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 -07006631 return eHAL_STATUS_FAILURE;
6632 }
6633
6634 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
6635 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
6636 SIR_MAC_ADDR_LENGTH);
6637 pMaxTxParams->power = dB;
6638
6639 msg.type = WDA_SET_MAX_TX_POWER_REQ;
6640 msg.reserved = 0;
6641 msg.bodyptr = pMaxTxParams;
6642
6643 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6644 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006645 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 -07006646 vos_mem_free(pMaxTxParams);
6647 return eHAL_STATUS_FAILURE;
6648 }
6649
6650 return eHAL_STATUS_SUCCESS;
6651}
6652
Jeff Johnson295189b2012-06-20 16:38:30 -07006653/* ---------------------------------------------------------------------------
6654
schang86c22c42013-03-13 18:41:24 -07006655 \fn sme_SetTxPower
6656
6657 \brief Set Transmit Power dynamically. Note: this setting will
6658 not persist over reboots.
6659
6660 \param hHal
6661 \param sessionId Target Session ID
6662 \param mW power to set in mW
6663 \- return eHalStatus
6664
6665 -------------------------------------------------------------------------------*/
6666eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
6667{
6668
6669 eHalStatus status = eHAL_STATUS_FAILURE;
6670 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6671
6672 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
6673 status = sme_AcquireGlobalLock(&pMac->sme);
6674 if (HAL_STATUS_SUCCESS(status))
6675 {
6676 status = csrSetTxPower(pMac, sessionId, mW);
6677 sme_ReleaseGlobalLock(&pMac->sme);
6678 }
6679 return status;
6680}
6681
6682/* ---------------------------------------------------------------------------
6683
Jeff Johnson295189b2012-06-20 16:38:30 -07006684 \fn sme_HideSSID
6685
6686 \brief hide/show SSID dynamically. Note: this setting will
6687 not persist over reboots.
6688
6689 \param hHal
6690 \param sessionId
6691 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
6692 \- return eHalStatus
6693
6694 -------------------------------------------------------------------------------*/
6695eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
6696{
6697 eHalStatus status = eHAL_STATUS_SUCCESS;
6698 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6699 tANI_U16 len;
6700
6701 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6702 {
6703 tpSirUpdateParams pMsg;
6704 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006705
6706 if(!pSession)
6707 {
6708 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006709 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006710 return eHAL_STATUS_FAILURE;
6711 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006712
6713 if( !pSession->sessionActive )
6714 VOS_ASSERT(0);
6715
6716 /* Create the message and send to lim */
6717 len = sizeof(tSirUpdateParams);
6718 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
6719 if(HAL_STATUS_SUCCESS(status))
6720 {
6721 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
6722 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
6723 pMsg->length = len;
6724 /* Data starts from here */
6725 pMsg->sessionId = sessionId;
6726 pMsg->ssidHidden = ssidHidden;
6727 status = palSendMBMessage(pMac->hHdd, pMsg);
6728 }
6729 sme_ReleaseGlobalLock( &pMac->sme );
6730 }
6731 return status;
6732}
Jeff Johnson295189b2012-06-20 16:38:30 -07006733
6734/* ---------------------------------------------------------------------------
6735
6736 \fn sme_SetTmLevel
6737 \brief Set Thermal Mitigation Level to RIVA
6738 \param hHal - The handle returned by macOpen.
6739 \param newTMLevel - new Thermal Mitigation Level
6740 \param tmMode - Thermal Mitigation handle mode, default 0
6741 \return eHalStatus
6742 ---------------------------------------------------------------------------*/
6743eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
6744{
6745 eHalStatus status = eHAL_STATUS_SUCCESS;
6746 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6747 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6748 vos_msg_t vosMessage;
6749 tAniSetTmLevelReq *setTmLevelReq = NULL;
6750
6751 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6752 {
6753 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
6754 if(NULL == setTmLevelReq)
6755 {
6756 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006757 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006758 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07006759 return eHAL_STATUS_FAILURE;
6760 }
6761
6762 setTmLevelReq->tmMode = tmMode;
6763 setTmLevelReq->newTmLevel = newTMLevel;
6764
6765 /* serialize the req through MC thread */
6766 vosMessage.bodyptr = setTmLevelReq;
6767 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
6768 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6769 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6770 {
6771 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006772 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006773 vos_mem_free(setTmLevelReq);
6774 status = eHAL_STATUS_FAILURE;
6775 }
6776 sme_ReleaseGlobalLock( &pMac->sme );
6777 }
6778 return(status);
6779}
6780
6781/*---------------------------------------------------------------------------
6782
6783 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
6784 Host and FW.
6785
6786 \param hHal - HAL handle for device
6787
6788 \return NONE
6789
6790---------------------------------------------------------------------------*/
6791void sme_featureCapsExchange( tHalHandle hHal)
6792{
6793 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6794 WDA_featureCapsExchange(vosContext);
6795}
Jeff Johnsond13512a2012-07-17 11:42:19 -07006796
Yathish9f22e662012-12-10 14:21:35 -08006797/*---------------------------------------------------------------------------
6798
6799 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
6800 in Host.
6801
6802 \param hHal - HAL handle for device
6803
6804 \return NONE
6805
6806---------------------------------------------------------------------------*/
6807void sme_disableFeatureCapablity(tANI_U8 feature_index)
6808{
6809 WDA_disableCapablityFeature(feature_index);
6810}
6811
6812
Jeff Johnsond13512a2012-07-17 11:42:19 -07006813
6814/* ---------------------------------------------------------------------------
6815
6816 \fn sme_GetDefaultCountryCode
6817
6818 \brief Get the default country code from NV
6819
6820 \param hHal
6821 \param pCountry
6822 \- return eHalStatus
6823
6824 -------------------------------------------------------------------------------*/
6825eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
6826{
6827 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6828 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
6829}
6830
6831/* ---------------------------------------------------------------------------
6832
6833 \fn sme_GetCurrentCountryCode
6834
6835 \brief Get the current country code
6836
6837 \param hHal
6838 \param pCountry
6839 \- return eHalStatus
6840
6841 -------------------------------------------------------------------------------*/
6842eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
6843{
6844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6845 return csrGetCurrentCountryCode(pMac, pCountry);
6846}
6847
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006848/* ---------------------------------------------------------------------------
6849 \fn sme_transportDebug
6850 \brief Dynamically monitoring Transport channels
6851 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07006852 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08006853 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006854 \param toggleStallDetect Enable stall detect feature
6855 This feature will take effect to data performance
6856 Not integrate till fully verification
6857 \- return NONE
6858 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07006859void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006860{
schang6295e542013-03-12 15:31:23 -07006861 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6862
6863 if (NULL == pMac)
6864 {
6865 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6866 "%s: invalid context", __func__);
6867 return;
6868 }
6869 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07006870}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006871
Kiran4a17ebe2013-01-31 10:43:43 -08006872/* ---------------------------------------------------------------------------
6873 \fn sme_ResetPowerValuesFor5G
6874 \brief Reset the power values for 5G band with NV power values.
6875 \param hHal - HAL handle for device
6876 \- return NONE
6877 -------------------------------------------------------------------------*/
6878void sme_ResetPowerValuesFor5G (tHalHandle hHal)
6879{
6880 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
6881 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
6882 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
6883}
6884
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006885#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
6886/* ---------------------------------------------------------------------------
6887 \fn sme_UpdateRoamPrefer5GHz
6888 \brief enable/disable Roam prefer 5G runtime option
6889 This function is called through dynamic setConfig callback function
6890 to configure the Roam prefer 5G runtime option
6891 \param hHal - HAL handle for device
6892 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
6893 \- return Success or failure
6894 -------------------------------------------------------------------------*/
6895
6896eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
6897{
6898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006899 eHalStatus status = eHAL_STATUS_SUCCESS;
6900
6901 status = sme_AcquireGlobalLock( &pMac->sme );
6902 if ( HAL_STATUS_SUCCESS( status ) )
6903 {
6904 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6905 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
6906 pMac->roam.configParam.nRoamPrefer5GHz,
6907 nRoamPrefer5GHz);
6908 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
6909 sme_ReleaseGlobalLock( &pMac->sme );
6910 }
6911
6912 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006913}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006914
6915/* ---------------------------------------------------------------------------
6916 \fn sme_UpdateImmediateRoamRssiDiff
6917 \brief Update nImmediateRoamRssiDiff
6918 This function is called through dynamic setConfig callback function
6919 to configure nImmediateRoamRssiDiff
6920 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
6921 \param hHal - HAL handle for device
6922 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
6923 candidate and current AP.
6924 \- return Success or failure
6925 -------------------------------------------------------------------------*/
6926
6927eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
6928{
6929 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006930 eHalStatus status = eHAL_STATUS_SUCCESS;
6931
6932 status = sme_AcquireGlobalLock( &pMac->sme );
6933 if ( HAL_STATUS_SUCCESS( status ) )
6934 {
6935 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
6936 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
6937 nImmediateRoamRssiDiff,
6938 pMac->roam.configParam.nImmediateRoamRssiDiff,
6939 pMac->roam.neighborRoamInfo.neighborRoamState);
6940 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
6941 sme_ReleaseGlobalLock( &pMac->sme );
6942 }
6943
6944 return status ;
6945}
6946
6947/* ---------------------------------------------------------------------------
6948 \fn sme_UpdateRoamRssiDiff
6949 \brief Update RoamRssiDiff
6950 This function is called through dynamic setConfig callback function
6951 to configure RoamRssiDiff
6952 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
6953 \param hHal - HAL handle for device
6954 \param RoamRssiDiff - minimum rssi difference between potential
6955 candidate and current AP.
6956 \- return Success or failure
6957 -------------------------------------------------------------------------*/
6958
6959eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
6960{
6961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6962 eHalStatus status = eHAL_STATUS_SUCCESS;
6963
6964 status = sme_AcquireGlobalLock( &pMac->sme );
6965 if ( HAL_STATUS_SUCCESS( status ) )
6966 {
6967 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
6968 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
6969 RoamRssiDiff,
6970 pMac->roam.configParam.RoamRssiDiff,
6971 pMac->roam.neighborRoamInfo.neighborRoamState);
6972 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
6973 sme_ReleaseGlobalLock( &pMac->sme );
6974 }
6975
6976 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006977}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006978
6979/*--------------------------------------------------------------------------
6980 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
6981 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
6982 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08006983 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006984 \param hHal - The handle returned by macOpen.
6985 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
6986 Other status means SME is failed to update isFastTransitionEnabled.
6987 \sa
6988 --------------------------------------------------------------------------*/
6989eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
6990 v_BOOL_t isFastTransitionEnabled)
6991{
6992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006993 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006994
Srinivas Girigowdade697412013-02-14 16:31:48 -08006995 status = sme_AcquireGlobalLock( &pMac->sme );
6996 if ( HAL_STATUS_SUCCESS( status ) )
6997 {
6998 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6999 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
7000 pMac->roam.configParam.isFastTransitionEnabled,
7001 isFastTransitionEnabled);
7002 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
7003 sme_ReleaseGlobalLock( &pMac->sme );
7004 }
7005
7006 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007007}
7008#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
7009
7010#ifdef FEATURE_WLAN_LFR
7011/*--------------------------------------------------------------------------
7012 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
7013 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7014 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007015 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007016 \param hHal - The handle returned by macOpen.
7017 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
7018 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
7019 \sa
7020 --------------------------------------------------------------------------*/
7021eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
7022 v_BOOL_t isFastRoamIniFeatureEnabled)
7023{
7024 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7025
Srinivas Girigowdade697412013-02-14 16:31:48 -08007026 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7027 "%s: FastRoamEnabled is changed from %d to %d", __func__,
7028 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7029 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007030 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
7031
7032 if(TRUE == isFastRoamIniFeatureEnabled)
7033 {
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007034 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7035 }
7036 else
7037 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007038 /* CCX also depend on FW Monitoring.
7039 Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007040#ifdef FEATURE_WLAN_CCX
7041 if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007042#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007043 {
7044 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Srinivas Girigowdade697412013-02-14 16:31:48 -08007045 "%s: Turn off FW Monitoring", __func__);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007046 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7047 }
7048 }
7049
7050 return eHAL_STATUS_SUCCESS;
7051}
7052#endif /* FEATURE_WLAN_LFR */
7053
7054#ifdef FEATURE_WLAN_CCX
7055/*--------------------------------------------------------------------------
7056 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
7057 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7058 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007059 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007060 \param hHal - The handle returned by macOpen.
7061 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
7062 Other status means SME is failed to update isCcxIniFeatureEnabled.
7063 \sa
7064 --------------------------------------------------------------------------*/
7065
7066eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
7067 v_BOOL_t isCcxIniFeatureEnabled)
7068{
7069 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7070
Srinivas Girigowdade697412013-02-14 16:31:48 -08007071 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7072 "%s: CcxEnabled is changed from %d to %d", __func__,
7073 pMac->roam.configParam.isCcxIniFeatureEnabled,
7074 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007075 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
7076
7077 if(TRUE == isCcxIniFeatureEnabled)
7078 {
7079 sme_UpdateFastTransitionEnabled(hHal, TRUE);
7080 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7081 }
7082 else
7083 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007084 /* LFR also depend on FW Monitoring.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007085 Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */
7086#ifdef FEATURE_WLAN_LFR
7087 if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled)
7088#endif
7089 {
7090 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7091 "%s: Turn off FW Monitoring/Fast Transition", __func__);
7092 sme_UpdateFastTransitionEnabled(hHal, FALSE);
7093 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7094 }
7095 }
7096 return eHAL_STATUS_SUCCESS;
7097}
7098#endif /* FEATURE_WLAN_CCX */
7099
7100/*--------------------------------------------------------------------------
7101 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7102 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7103 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007104 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007105 \param hHal - The handle returned by macOpen.
7106 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7107 Other status means SME is failed to update fEnableFwRssiMonitoring.
7108 \sa
7109 --------------------------------------------------------------------------*/
7110
7111eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7112 v_BOOL_t fEnableFwRssiMonitoring)
7113{
7114 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7115
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007116 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7117 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7118 {
7119 halStatus = eHAL_STATUS_FAILURE;
7120 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007121 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007122 }
7123
7124 return (halStatus);
7125}
7126
Srinivas Girigowdade697412013-02-14 16:31:48 -08007127/*--------------------------------------------------------------------------
7128 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7129 This is a synchronous call
7130 \param hHal - The handle returned by macOpen.
7131 \return eHAL_STATUS_SUCCESS - SME update config successful.
7132 Other status means SME is failed to update
7133 \sa
7134 --------------------------------------------------------------------------*/
7135eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7136 v_U8_t neighborLookupRssiThreshold)
7137{
7138 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7139 eHalStatus status = eHAL_STATUS_SUCCESS;
7140
7141 status = sme_AcquireGlobalLock( &pMac->sme );
7142 if ( HAL_STATUS_SUCCESS( status ) )
7143 {
7144 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7145 if (HAL_STATUS_SUCCESS(status))
7146 {
7147 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7148 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7149 neighborLookupRssiThreshold,
7150 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7151 pMac->roam.neighborRoamInfo.neighborRoamState);
7152 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7153 neighborLookupRssiThreshold;
7154 }
7155 sme_ReleaseGlobalLock( &pMac->sme );
7156 }
7157
7158 return status;
7159}
7160
7161/*--------------------------------------------------------------------------
7162 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
7163 This is a synchronous call
7164 \param hHal - The handle returned by macOpen.
7165 \return eHAL_STATUS_SUCCESS - SME update config successful.
7166 Other status means SME is failed to update
7167 \sa
7168 --------------------------------------------------------------------------*/
7169eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
7170 v_U8_t neighborReassocRssiThreshold)
7171{
7172 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7173 eHalStatus status = eHAL_STATUS_SUCCESS;
7174
7175 status = sme_AcquireGlobalLock( &pMac->sme );
7176 if ( HAL_STATUS_SUCCESS( status ) )
7177 {
7178 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7179 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7180 neighborReassocRssiThreshold,
7181 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7182 pMac->roam.neighborRoamInfo.neighborRoamState);
7183 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7184 neighborReassocRssiThreshold;
7185 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7186 neighborReassocRssiThreshold;
7187 sme_ReleaseGlobalLock( &pMac->sme );
7188 }
7189
7190 return status ;
7191}
7192
7193
7194/*--------------------------------------------------------------------------
7195 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7196 This is a synchronous call
7197 \param hHal - The handle returned by macOpen.
7198 \return eHAL_STATUS_SUCCESS - SME update config successful.
7199 Other status means SME is failed to update
7200 \sa
7201 --------------------------------------------------------------------------*/
7202v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7203{
7204 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7205 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7206}
7207
7208/*--------------------------------------------------------------------------
7209 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7210 This is a synchronous call
7211 \param hHal - The handle returned by macOpen.
7212 \return eHAL_STATUS_SUCCESS - SME update config successful.
7213 Other status means SME is failed to update
7214 \sa
7215 --------------------------------------------------------------------------*/
7216eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7217 v_U16_t neighborScanResultsRefreshPeriod)
7218{
7219 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7220 eHalStatus status = eHAL_STATUS_SUCCESS;
7221
7222 status = sme_AcquireGlobalLock( &pMac->sme );
7223 if ( HAL_STATUS_SUCCESS( status ) )
7224 {
7225 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7226 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7227 neighborScanResultsRefreshPeriod,
7228 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7229 pMac->roam.neighborRoamInfo.neighborRoamState);
7230 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7231 neighborScanResultsRefreshPeriod;
7232 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7233 neighborScanResultsRefreshPeriod;
7234
7235 sme_ReleaseGlobalLock( &pMac->sme );
7236 }
7237
7238 return status ;
7239}
7240
7241/*--------------------------------------------------------------------------
7242 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7243 This is a synchronous call
7244 \param hHal - The handle returned by macOpen.
7245 \return v_U16_t - Neighbor scan results refresh period value
7246 \sa
7247 --------------------------------------------------------------------------*/
7248v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7249{
7250 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7251 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7252}
7253
7254/*--------------------------------------------------------------------------
7255 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7256 This is a synchronuous call
7257 \param hHal - The handle returned by macOpen.
7258 \return eHAL_STATUS_SUCCESS - SME update config successful.
7259 Other status means SME is failed to update
7260 \sa
7261 --------------------------------------------------------------------------*/
7262v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7263{
7264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7265 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7266}
7267
7268#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
7269/*--------------------------------------------------------------------------
7270 \brief sme_getRoamRssiDiff() - get Roam rssi diff
7271 This is a synchronous call
7272 \param hHal - The handle returned by macOpen.
7273 \return v_U16_t - Rssi diff value
7274 \sa
7275 --------------------------------------------------------------------------*/
7276v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
7277{
7278 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7279 return pMac->roam.configParam.RoamRssiDiff;
7280}
7281
7282/*--------------------------------------------------------------------------
7283 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
7284 This is a synchronous call
7285 \param hHal - The handle returned by macOpen.
7286 \return eHAL_STATUS_SUCCESS - SME update config successful.
7287 Other status means SME is failed to update
7288 \sa
7289 --------------------------------------------------------------------------*/
7290eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7291 tANI_U8 numChannels)
7292{
7293 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7294 eHalStatus status = eHAL_STATUS_SUCCESS;
7295 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7296 tANI_U8 oldChannelList[128] = {0};
7297 tANI_U8 newChannelList[128] = {0};
7298 tANI_U8 i = 0, j = 0;
7299
7300 status = sme_AcquireGlobalLock( &pMac->sme );
7301 if ( HAL_STATUS_SUCCESS( status ) )
7302 {
7303 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7304 {
7305 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7306 {
7307 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
7308 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7309 }
7310 }
7311 csrFlushAndCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
7312 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
7313
7314 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7315 {
7316 j = 0;
7317 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7318 {
7319 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
7320 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7321 }
7322 }
7323
7324 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7325 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
7326 newChannelList, oldChannelList,
7327 pMac->roam.neighborRoamInfo.neighborRoamState);
7328 sme_ReleaseGlobalLock( &pMac->sme );
7329 }
7330
7331 return status ;
7332}
7333
7334/*--------------------------------------------------------------------------
7335 \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list
7336 based on country revision number
7337 This is a synchronous call
7338 \param hHal - The handle returned by macOpen.
7339 \return eHAL_STATUS_SUCCESS - SME update config successful.
7340 Other status means SME is failed to update
7341 \sa
7342 --------------------------------------------------------------------------*/
7343eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal,
7344 tANI_U8 Revision)
7345{
7346 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7347 eHalStatus status = eHAL_STATUS_SUCCESS;
7348
7349 status = sme_AcquireGlobalLock( &pMac->sme );
7350 if ( HAL_STATUS_SUCCESS( status ) )
7351 {
7352 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7353 "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d",
7354 "KR", Revision, "KR",
7355 pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision,
7356 pMac->roam.neighborRoamInfo.neighborRoamState);
7357 csr_SetRevision(pMac, Revision);
7358 csrInitCountryValidChannelList(pMac, Revision);
7359 sme_ReleaseGlobalLock( &pMac->sme );
7360 }
7361
7362 return status ;
7363}
7364
7365
7366/*--------------------------------------------------------------------------
7367 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
7368 This is a synchronous call
7369 \param hHal - The handle returned by macOpen.
7370 \return eHAL_STATUS_SUCCESS - SME update config successful.
7371 Other status means SME is failed to update
7372 \sa
7373 --------------------------------------------------------------------------*/
7374eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
7375 eCsrBand eBand)
7376{
7377 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7378 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
7379}
7380
7381/*--------------------------------------------------------------------------
7382 \brief sme_getRoamScanChannelList() - get roam scan channel list
7383 This is a synchronous call
7384 \param hHal - The handle returned by macOpen.
7385 \return eHAL_STATUS_SUCCESS - SME update config successful.
7386 Other status means SME is failed to update
7387 \sa
7388 --------------------------------------------------------------------------*/
7389eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7390 tANI_U8 *pNumChannels)
7391{
7392 int i = 0;
7393 tANI_U8 *pOutPtr = pChannelList;
7394 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7395 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7396 eHalStatus status = eHAL_STATUS_SUCCESS;
7397
7398 status = sme_AcquireGlobalLock( &pMac->sme );
7399 if ( HAL_STATUS_SUCCESS( status ) )
7400 {
7401 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7402 {
7403 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
7404 "Roam Scan channel list is NOT yet initialized");
7405 sme_ReleaseGlobalLock( &pMac->sme );
7406 return eHAL_STATUS_NOT_INITIALIZED;
7407 }
7408
7409 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
7410 for (i = 0; i < (*pNumChannels); i++)
7411 {
7412 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
7413 }
7414 pOutPtr[i] = '\0';
7415 sme_ReleaseGlobalLock( &pMac->sme );
7416 }
7417
7418 return status ;
7419}
7420
7421/*--------------------------------------------------------------------------
7422 \brief sme_GetCountryRevision() - get Country revision index
7423 This is a synchronous call
7424 \param hHal - The handle returned by macOpen.
7425 \return eHAL_STATUS_SUCCESS - SME update config successful.
7426 Other status means SME is failed to update
7427 \sa
7428 --------------------------------------------------------------------------*/
7429eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision)
7430{
7431 /* this is valid for Country KR only now */
7432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7433 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7434 eHalStatus status = eHAL_STATUS_SUCCESS;
7435
7436 *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision;
7437
7438 return status;
7439}
7440
7441#endif
7442
7443/* ---------------------------------------------------------------------------
7444 \fn sme_UpdateEmptyScanRefreshPeriod
7445 \brief Update nEmptyScanRefreshPeriod
7446 This function is called through dynamic setConfig callback function
7447 to configure nEmptyScanRefreshPeriod
7448 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7449 \param hHal - HAL handle for device
7450 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7451 \- return Success or failure
7452 -------------------------------------------------------------------------*/
7453
7454eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
7455{
7456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7457 eHalStatus status = eHAL_STATUS_SUCCESS;
7458
7459 status = sme_AcquireGlobalLock( &pMac->sme );
7460 if ( HAL_STATUS_SUCCESS( status ) )
7461 {
7462 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7463 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
7464 nEmptyScanRefreshPeriod,
7465 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
7466 pMac->roam.neighborRoamInfo.neighborRoamState);
7467 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7468 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7469 sme_ReleaseGlobalLock( &pMac->sme );
7470 }
7471
7472 return status ;
7473
7474}
7475
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007476
7477
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007478/* ---------------------------------------------------------------------------
7479 \fn sme_IsFeatureSupportedByFW
7480 \brief Check if an feature is enabled by FW
7481
7482 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
7483 \- return 1/0 (TRUE/FALSE)
7484 -------------------------------------------------------------------------*/
7485tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
7486{
7487 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
7488}
7489#ifdef FEATURE_WLAN_TDLS
7490/* ---------------------------------------------------------------------------
7491 \fn sme_SendTdlsMgmtFrame
7492 \brief API to send TDLS management frames.
7493
7494 \param peerMac - peer's Mac Adress.
7495 \param frame_type - Type of TDLS mgmt frame to be sent.
7496 \param dialog - dialog token used in the frame.
7497 \param status - status to be incuded in the frame.
7498 \param buf - additional IEs to be included
7499 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08007500 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007501 \- return VOS_STATUS_SUCCES
7502 -------------------------------------------------------------------------*/
7503VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08007504 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 -08007505{
7506 eHalStatus status = eHAL_STATUS_SUCCESS;
7507 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
7508 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7509
7510 status = sme_AcquireGlobalLock( &pMac->sme );
7511 if ( HAL_STATUS_SUCCESS( status ) )
7512 {
7513 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7514 sendTdlsReq.frameType = frame_type;
7515 sendTdlsReq.buf = buf;
7516 sendTdlsReq.len = len;
7517 sendTdlsReq.dialog = dialog;
7518 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08007519 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007520
7521 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
7522
7523 sme_ReleaseGlobalLock( &pMac->sme );
7524 }
7525
7526 return status ;
7527
7528}
7529/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08007530 \fn sme_ChangeTdlsPeerSta
7531 \brief API to Update TDLS peer sta parameters.
7532
7533 \param peerMac - peer's Mac Adress.
7534 \param staParams - Peer Station Parameters
7535 \- return VOS_STATUS_SUCCES
7536 -------------------------------------------------------------------------*/
7537VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
7538 tCsrStaParams *pstaParams)
7539{
7540 eHalStatus status = eHAL_STATUS_SUCCESS;
7541 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7542
7543 status = sme_AcquireGlobalLock( &pMac->sme );
7544 if ( HAL_STATUS_SUCCESS( status ) )
7545 {
7546 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
7547
7548 sme_ReleaseGlobalLock( &pMac->sme );
7549 }
7550
7551 return status ;
7552
7553}
7554
7555/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007556 \fn sme_AddTdlsPeerSta
7557 \brief API to Add TDLS peer sta entry.
7558
7559 \param peerMac - peer's Mac Adress.
7560 \- return VOS_STATUS_SUCCES
7561 -------------------------------------------------------------------------*/
7562VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7563{
7564 eHalStatus status = eHAL_STATUS_SUCCESS;
7565 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7566
7567 status = sme_AcquireGlobalLock( &pMac->sme );
7568 if ( HAL_STATUS_SUCCESS( status ) )
7569 {
7570 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
7571
7572 sme_ReleaseGlobalLock( &pMac->sme );
7573 }
7574
7575 return status ;
7576
7577}
7578/* ---------------------------------------------------------------------------
7579 \fn sme_DeleteTdlsPeerSta
7580 \brief API to Delete TDLS peer sta entry.
7581
7582 \param peerMac - peer's Mac Adress.
7583 \- return VOS_STATUS_SUCCES
7584 -------------------------------------------------------------------------*/
7585VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7586{
7587 eHalStatus status = eHAL_STATUS_SUCCESS;
7588 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7589
7590 status = sme_AcquireGlobalLock( &pMac->sme );
7591 if ( HAL_STATUS_SUCCESS( status ) )
7592 {
7593 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
7594
7595 sme_ReleaseGlobalLock( &pMac->sme );
7596 }
7597
7598 return status ;
7599
7600}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07007601/* ---------------------------------------------------------------------------
7602 \fn sme_IsPmcBmps
7603 \API to Check if PMC state is BMPS.
7604
7605 \- return v_BOOL_t
7606 -------------------------------------------------------------------------*/
7607v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
7608{
7609 return (BMPS == pmcGetPmcState(hHal));
7610}
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07007611/* ---------------------------------------------------------------------------
7612 \fn sme_SetTdlsPowerSaveProhibited
7613 \API to set/reset the isTdlsPowerSaveProhibited.
7614
7615 \- return void
7616 -------------------------------------------------------------------------*/
7617void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
7618{
7619 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7620
7621 pMac->isTdlsPowerSaveProhibited = val;
7622 return;
7623}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007624#endif
7625#ifdef FEATURE_WLAN_TDLS_INTERNAL
7626/*
7627 * SME API to start TDLS discovery Procedure
7628 */
7629VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7630{
7631 VOS_STATUS status = VOS_STATUS_SUCCESS;
7632 tCsrTdlsDisRequest disReq = {{0}} ;
7633 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7634 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
7635
7636 return status ;
7637
7638}
7639
7640/*
7641 * Process TDLS discovery results
7642 */
7643v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
7644 tSmeTdlsDisResult *disResult, v_U8_t listType)
7645{
7646 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
7647 tSirTdlsPeerInfo *peerInfo = NULL ;
7648 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7649 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
7650 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
7651 tListElem *pEntry = NULL ;
7652 v_U8_t peerCnt = 0 ;
7653
7654 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007655 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007656 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
7657 while(pEntry)
7658 {
7659 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
7660 tdlsPeerStaLink) ;
7661 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
7662
7663 switch(listType)
7664 {
7665 case TDLS_SETUP_LIST:
7666 {
7667 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
7668 {
7669 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
7670 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
7671 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
7672 peerCnt++ ;
7673 }
7674 break ;
7675 }
7676 case TDLS_DIS_LIST:
7677 {
7678 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
7679 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
7680 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
7681 peerCnt++ ;
7682 break ;
7683 }
7684 default:
7685 {
7686 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007687 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007688 break ;
7689 }
7690 }
7691
7692 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
7693 }
7694
7695 return peerCnt ;
7696
7697}
7698
7699/*
7700 * SME API to start TDLS link setup Procedure.
7701 */
7702VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7703{
7704 VOS_STATUS status = VOS_STATUS_SUCCESS;
7705 tCsrTdlsSetupRequest setupReq = {{0}} ;
7706 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7707 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
7708 return status ;
7709
7710}
7711
7712/*
7713 * SME API to start TDLS link Teardown Procedure.
7714 */
7715VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7716{
7717 VOS_STATUS status = VOS_STATUS_SUCCESS;
7718 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
7719 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7720 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
7721 return status ;
7722
7723}
7724
7725#endif /* FEATURE_WLAN_TDLS */
7726