blob: de4e6f84462adbb98b4ee0f27c83544243a56588 [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
Jeff Johnson295189b2012-06-20 16:38:30 -0700121//Internal SME APIs
122eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
123{
124 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
125
126 if(psSme)
127 {
128 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
129 {
130 status = eHAL_STATUS_SUCCESS;
131 }
132 }
133
134 return (status);
135}
136
137
138eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
139{
140 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
141
142 if(psSme)
143 {
144 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
145 {
146 status = eHAL_STATUS_SUCCESS;
147 }
148 }
149
150 return (status);
151}
152
153
154
155static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
156{
157 eHalStatus status;
158 tSmeCmd *pCmd;
159
160 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
161 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdActiveList)))
162 {
163 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdPendingList)))
164 {
165 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdFreeList)))
166 {
167 status = palAllocateMemory(pMac->hHdd, (void **)&pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
168 if(HAL_STATUS_SUCCESS(status))
169 {
170 tANI_U32 c;
171
172 palZeroMemory(pMac->hHdd, pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
173 pMac->sme.pSmeCmdBufAddr = pCmd;
174 for(c = 0; c < pMac->sme.totalSmeCmd; c++)
175 {
176 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd[c].Link, LL_ACCESS_LOCK);
177 }
178 }
179 }
180 }
181 }
182
183 return (status);
184}
185
186
187void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
188{
189 pCmd->command = eSmeNoCommand;
190 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
191}
192
193
194
195static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
196{
197 tListElem *pEntry;
198 tSmeCmd *pCommand;
199
200 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
201 {
202 //TODO: base on command type to call release functions
203 //reinitialize different command types so they can be reused
204 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
205 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
206 }
207}
208
209static void purgeSmeCmdList(tpAniSirGlobal pMac)
210{
211 //release any out standing commands back to free command list
212 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
213 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
214}
215
216void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
217{
218 //release any out standing commands back to free command list
219 tListElem *pEntry, *pNext;
220 tSmeCmd *pCommand;
221 tDblLinkList *pList = &pMac->sme.smeCmdPendingList;
222 tDblLinkList localList;
223
224 vos_mem_zero(&localList, sizeof(tDblLinkList));
225 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
226 {
227 smsLog(pMac, LOGE, FL(" failed to open list"));
228 return;
229 }
230
231 csrLLLock(pList);
232 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
233 while(pEntry != NULL)
234 {
235 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
236 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
237 if(pCommand->sessionId == sessionId)
238 {
239 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
240 {
241 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
242 }
243 }
244 pEntry = pNext;
245 }
246 csrLLUnlock(pList);
247
248 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
249 {
250 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
251 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
252 }
253 csrLLClose(&localList);
254
255}
256
257
258static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
259{
260 eHalStatus status = eHAL_STATUS_SUCCESS;
261
262 purgeSmeCmdList(pMac);
263 csrLLClose(&pMac->sme.smeCmdPendingList);
264 csrLLClose(&pMac->sme.smeCmdActiveList);
265 csrLLClose(&pMac->sme.smeCmdFreeList);
266
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800267 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
268 if(status != eHAL_STATUS_SUCCESS)
269 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800270 smsLog(pMac, LOGE,
271 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800272 goto done;
273 }
274
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 if(NULL != pMac->sme.pSmeCmdBufAddr)
276 {
277 status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr);
278 pMac->sme.pSmeCmdBufAddr = NULL;
279 }
280
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800281 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
282 if(status != eHAL_STATUS_SUCCESS)
283 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800284 smsLog(pMac, LOGE,
285 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800286 }
287done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 return (status);
289}
290
291
292void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
293{
294#ifdef WLAN_DEBUG
295 switch( pCmd->command )
296 {
297 case eSmeCommandScan:
298 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
299 break;
300
301 case eSmeCommandRoam:
302 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
303 break;
304
305 case eSmeCommandWmStatusChange:
306 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
307 break;
308
309 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800310 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
312 break;
313
314 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800315 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
317 break;
318
319 default:
320 break;
321 }
322#endif //#ifdef WLAN_DEBUG
323}
324
325tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
326{
327 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
328 tListElem *pEntry;
329
330 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
331
332 // If we can get another MS Msg buffer, then we are ok. Just link
333 // the entry onto the linked list. (We are using the linked list
334 // to keep track of tfhe message buffers).
335 if ( pEntry )
336 {
337 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
338 }
339 else {
340 int idx = 1;
341
342 //Cannot change pRetCmd here since it needs to return later.
343 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
344 if( pEntry )
345 {
346 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
347 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800348 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
350 if(pTempCmd)
351 {
352 if( eSmeCsrCommandMask & pTempCmd->command )
353 {
354 //CSR command is stuck. See what the reason code is for that command
355 dumpCsrCommandInfo(pMac, pTempCmd);
356 }
357 } //if(pTempCmd)
358
359 //dump what is in the pending queue
360 csrLLLock(&pMac->sme.smeCmdPendingList);
361 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
362 while(pEntry)
363 {
364 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800365 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 idx++, pTempCmd->command );
367 if( eSmeCsrCommandMask & pTempCmd->command )
368 {
369 //CSR command is stuck. See what the reason code is for that command
370 dumpCsrCommandInfo(pMac, pTempCmd);
371 }
372 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
373 }
374 csrLLUnlock(&pMac->sme.smeCmdPendingList);
375
376 //There may be some more command in CSR's own pending queue
377 csrLLLock(&pMac->roam.roamCmdPendingList);
378 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
379 while(pEntry)
380 {
381 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800382 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 idx++, pTempCmd->command );
384 dumpCsrCommandInfo(pMac, pTempCmd);
385 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
386 }
387 csrLLUnlock(&pMac->roam.roamCmdPendingList);
388 }
389
390 return( pRetCmd );
391}
392
393
394void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
395{
396 if ( fHighPriority )
397 {
398 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
399 }
400 else
401 {
402 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
403 }
404
405 // process the command queue...
406 smeProcessPendingQueue( pMac );
407
408 return;
409}
410
411
412static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
413{
414 eSmeCommandType pmcCommand = eSmeNoCommand;
415 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
416 tPmcState pmcState;
417 eHalStatus status;
418
419 do
420 {
421 pmcState = pmcGetPmcState(pMac);
422
423 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
424 if( !HAL_STATUS_SUCCESS(status) )
425 {
426 //PMC state is not right for the command, drop it
427 return ( eSmeDropCommand );
428 }
429 if( fFullPowerNeeded ) break;
430 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
431 ( eSmeCommandDelTs == pCommand->command ) );
432 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700433#ifdef FEATURE_OEM_DATA_SUPPORT
434 fFullPowerNeeded = (pmcState == IMPS &&
435 eSmeCommandOemDataReq == pCommand->command);
436 if(fFullPowerNeeded) break;
437#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 fFullPowerNeeded = (pmcState == IMPS &&
439 eSmeCommandRemainOnChannel == pCommand->command);
440 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 } while(0);
442
443 if( fFullPowerNeeded )
444 {
445 switch( pmcState )
446 {
447 case IMPS:
448 case STANDBY:
449 pmcCommand = eSmeCommandExitImps;
450 break;
451
452 case BMPS:
453 pmcCommand = eSmeCommandExitBmps;
454 break;
455
456 case UAPSD:
457 pmcCommand = eSmeCommandExitUapsd;
458 break;
459
460 case WOWL:
461 pmcCommand = eSmeCommandExitWowl;
462 break;
463
464 default:
465 break;
466 }
467 }
468
469 return ( pmcCommand );
470}
471
472
473//For commands that need to do extra cleanup.
474static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
475{
476 if( eSmePmcCommandMask & pCommand->command )
477 {
478 pmcAbortCommand( pMac, pCommand, fStopping );
479 }
480 else if ( eSmeCsrCommandMask & pCommand->command )
481 {
482 csrAbortCommand( pMac, pCommand, fStopping );
483 }
484 else
485 {
486 switch( pCommand->command )
487 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 case eSmeCommandRemainOnChannel:
489 if (NULL != pCommand->u.remainChlCmd.callback)
490 {
491 remainOnChanCallback callback =
492 pCommand->u.remainChlCmd.callback;
493 /* process the msg */
494 if( callback )
495 {
496 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
497 eCSR_SCAN_ABORT );
498 }
499 }
500 smeReleaseCommand( pMac, pCommand );
501 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 default:
503 smeReleaseCommand( pMac, pCommand );
504 break;
505 }
506 }
507}
508
509
510
511tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
512{
513 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
514 eHalStatus status = eHAL_STATUS_SUCCESS;
515 tListElem *pEntry;
516 tSmeCmd *pCommand;
517 eSmeCommandType pmcCommand = eSmeNoCommand;
518
519 // if the ActiveList is empty, then nothing is active so we can process a
520 // pending command...
521 //alwasy lock active list before locking pending list
522 csrLLLock( &pMac->sme.smeCmdActiveList );
523 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
524 {
525 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
526 {
527 //Peek the command
528 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
529 if( pEntry )
530 {
531 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
532 //We cannot execute any command in wait-for-key state until setKey is through.
533 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
534 {
535 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
536 {
537 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800538 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 return ( eANI_BOOLEAN_FALSE );
540 }
541 }
542 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
543 if( eSmeDropCommand == pmcCommand )
544 {
545 //This command is not ok for current PMC state
546 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
547 {
548 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
549 }
550 csrLLUnlock( &pMac->sme.smeCmdActiveList );
551 //tell caller to continue
552 return (eANI_BOOLEAN_TRUE);
553 }
554 else if( eSmeNoCommand != pmcCommand )
555 {
556 tExitBmpsInfo exitBmpsInfo;
557 void *pv = NULL;
558 tANI_U32 size = 0;
559 tSmeCmd *pPmcCmd = NULL;
560
561 if( eSmeCommandExitBmps == pmcCommand )
562 {
563 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
564 pv = (void *)&exitBmpsInfo;
565 size = sizeof(tExitBmpsInfo);
566 }
567 //pmcCommand has to be one of the exit power save command
568 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
569 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
570 {
571 //Force this command to wake up the chip
572 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
573 csrLLUnlock( &pMac->sme.smeCmdActiveList );
574 fContinue = pmcProcessCommand( pMac, pPmcCmd );
575 if( fContinue )
576 {
577 //The command failed, remove it
578 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
579 {
580 pmcReleaseCommand( pMac, pPmcCmd );
581 }
582 }
583 }
584 else
585 {
586 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800587 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 -0700588 //Let it retry
589 fContinue = eANI_BOOLEAN_TRUE;
590 }
591 return fContinue;
592 }
593 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
594 {
595 // we can reuse the pCommand
596
597 // Insert the command onto the ActiveList...
598 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
599
600 // .... and process the command.
601
602 switch ( pCommand->command )
603 {
604
605 case eSmeCommandScan:
606 csrLLUnlock( &pMac->sme.smeCmdActiveList );
607 status = csrProcessScanCommand( pMac, pCommand );
608 break;
609
610 case eSmeCommandRoam:
611 csrLLUnlock( &pMac->sme.smeCmdActiveList );
612 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800613 if(!HAL_STATUS_SUCCESS(status))
614 {
615 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
616 &pCommand->Link, LL_ACCESS_LOCK ) )
617 {
618 csrReleaseCommandRoam( pMac, pCommand );
619 }
620 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 break;
622
623 case eSmeCommandWmStatusChange:
624 csrLLUnlock( &pMac->sme.smeCmdActiveList );
625 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
626 break;
627
628 case eSmeCommandSetKey:
629 csrLLUnlock( &pMac->sme.smeCmdActiveList );
630 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
631 if(!HAL_STATUS_SUCCESS(status))
632 {
633 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
634 &pCommand->Link, LL_ACCESS_LOCK ) )
635 {
636 csrReleaseCommandSetKey( pMac, pCommand );
637 }
638 }
639 break;
640
641 case eSmeCommandRemoveKey:
642 csrLLUnlock( &pMac->sme.smeCmdActiveList );
643 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
644 if(!HAL_STATUS_SUCCESS(status))
645 {
646 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
647 &pCommand->Link, LL_ACCESS_LOCK ) )
648 {
649 csrReleaseCommandRemoveKey( pMac, pCommand );
650 }
651 }
652 break;
653
654 case eSmeCommandAddStaSession:
655 csrLLUnlock( &pMac->sme.smeCmdActiveList );
656 csrProcessAddStaSessionCommand( pMac, pCommand );
657 break;
658 case eSmeCommandDelStaSession:
659 csrLLUnlock( &pMac->sme.smeCmdActiveList );
660 csrProcessDelStaSessionCommand( pMac, pCommand );
661 break;
662
Jeff Johnsone7245742012-09-05 17:12:55 -0700663#ifdef FEATURE_OEM_DATA_SUPPORT
664 case eSmeCommandOemDataReq:
665 csrLLUnlock(&pMac->sme.smeCmdActiveList);
666 oemData_ProcessOemDataReqCommand(pMac, pCommand);
667 break;
668#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 case eSmeCommandRemainOnChannel:
670 csrLLUnlock(&pMac->sme.smeCmdActiveList);
671 p2pProcessRemainOnChannelCmd(pMac, pCommand);
672 break;
673 case eSmeCommandNoAUpdate:
674 csrLLUnlock( &pMac->sme.smeCmdActiveList );
675 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case eSmeCommandEnterImps:
677 case eSmeCommandExitImps:
678 case eSmeCommandEnterBmps:
679 case eSmeCommandExitBmps:
680 case eSmeCommandEnterUapsd:
681 case eSmeCommandExitUapsd:
682 case eSmeCommandEnterWowl:
683 case eSmeCommandExitWowl:
684 csrLLUnlock( &pMac->sme.smeCmdActiveList );
685 fContinue = pmcProcessCommand( pMac, pCommand );
686 if( fContinue )
687 {
688 //The command failed, remove it
689 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
690 &pCommand->Link, LL_ACCESS_LOCK ) )
691 {
692 pmcReleaseCommand( pMac, pCommand );
693 }
694 }
695 break;
696
697 //Treat standby differently here because caller may not be able to handle
698 //the failure so we do our best here
699 case eSmeCommandEnterStandby:
700 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
701 {
702 //It can continue
703 csrLLUnlock( &pMac->sme.smeCmdActiveList );
704 fContinue = pmcProcessCommand( pMac, pCommand );
705 if( fContinue )
706 {
707 //The command failed, remove it
708 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
709 &pCommand->Link, LL_ACCESS_LOCK ) )
710 {
711 pmcReleaseCommand( pMac, pCommand );
712 }
713 }
714 }
715 else
716 {
717 //Need to issue a disconnect first before processing this command
718 tSmeCmd *pNewCmd;
719
720 //We need to re-run the command
721 fContinue = eANI_BOOLEAN_TRUE;
722 //Pull off the standby command first
723 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
724 &pCommand->Link, LL_ACCESS_NOLOCK ) )
725 {
726 csrLLUnlock( &pMac->sme.smeCmdActiveList );
727 //Need to call CSR function here because the disconnect command
728 //is handled by CSR
729 pNewCmd = csrGetCommandBuffer( pMac );
730 if( NULL != pNewCmd )
731 {
732 //Put the standby command to the head of the pending list first
733 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
734 LL_ACCESS_LOCK );
735 pNewCmd->command = eSmeCommandRoam;
736 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
737 //Put the disassoc command before the standby command
738 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
739 LL_ACCESS_LOCK );
740 }
741 else
742 {
743 //Continue the command here
744 fContinue = pmcProcessCommand( pMac, pCommand );
745 if( fContinue )
746 {
747 //The command failed, remove it
748 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
749 &pCommand->Link, LL_ACCESS_LOCK ) )
750 {
751 pmcReleaseCommand( pMac, pCommand );
752 }
753 }
754 }
755 }
756 else
757 {
758 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800759 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 VOS_ASSERT(0);
761 }
762 }
763 break;
764
765 case eSmeCommandAddTs:
766 case eSmeCommandDelTs:
767 csrLLUnlock( &pMac->sme.smeCmdActiveList );
768#ifndef WLAN_MDM_CODE_REDUCTION_OPT
769 fContinue = qosProcessCommand( pMac, pCommand );
770 if( fContinue )
771 {
772 //The command failed, remove it
773 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
774 &pCommand->Link, LL_ACCESS_NOLOCK ) )
775 {
776//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
777 qosReleaseCommand( pMac, pCommand );
778//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
779 }
780 }
781#endif
782 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800783#ifdef FEATURE_WLAN_TDLS
784 case eSmeCommandTdlsSendMgmt:
785 case eSmeCommandTdlsAddPeer:
786 case eSmeCommandTdlsDelPeer:
787#ifdef FEATURE_WLAN_TDLS_INTERNAL
788 case eSmeCommandTdlsDiscovery:
789 case eSmeCommandTdlsLinkSetup:
790 case eSmeCommandTdlsLinkTear:
791 case eSmeCommandTdlsEnterUapsd:
792 case eSmeCommandTdlsExitUapsd:
793#endif
794 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800795 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800796 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800797
798 csrLLUnlock( &pMac->sme.smeCmdActiveList );
799 status = csrTdlsProcessCmd( pMac, pCommand );
800 }
801 break ;
802#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700803
804 default:
805 //something is wrong
806 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800807 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
809 csrLLUnlock( &pMac->sme.smeCmdActiveList );
810 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
811 smeReleaseCommand( pMac, pCommand );
812 status = eHAL_STATUS_FAILURE;
813 break;
814 }
815 if(!HAL_STATUS_SUCCESS(status))
816 {
817 fContinue = eANI_BOOLEAN_TRUE;
818 }
819 }//if(pEntry)
820 else
821 {
822 //This is odd. Some one else pull off the command.
823 csrLLUnlock( &pMac->sme.smeCmdActiveList );
824 }
825 }
826 else
827 {
828 csrLLUnlock( &pMac->sme.smeCmdActiveList );
829 }
830 }
831 else
832 {
833 //No command waiting
834 csrLLUnlock( &pMac->sme.smeCmdActiveList );
835 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
836 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
837 {
838 tANI_U32 nTime = 0;
839
840 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
841 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
842 {
843 csrScanStartIdleScanTimer(pMac, nTime);
844 }
845 }
846 }
847 }
848 else {
849 csrLLUnlock( &pMac->sme.smeCmdActiveList );
850 }
851
852 return ( fContinue );
853}
854
855void smeProcessPendingQueue( tpAniSirGlobal pMac )
856{
857 while( smeProcessCommand( pMac ) );
858}
859
860
861tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
862{
863 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
864 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
865}
866
867
868
869//Global APIs
870
871/*--------------------------------------------------------------------------
872
873 \brief sme_Open() - Initialze all SME modules and put them at idle state
874
875 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
876 successfully return, all modules are at idle state ready to start.
877
878 smeOpen must be called before any other SME APIs can be involved.
879 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -0800880 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 \param hHal - The handle returned by macOpen.
882
883 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
884
885 Other status means SME is failed to be initialized
886 \sa
887
888 --------------------------------------------------------------------------*/
889eHalStatus sme_Open(tHalHandle hHal)
890{
891 eHalStatus status = eHAL_STATUS_FAILURE;
892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
893
894 do {
895 pMac->sme.state = SME_STATE_STOP;
896 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
897 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800898 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 status = eHAL_STATUS_FAILURE;
900 break;
901 }
902
903 status = ccmOpen(hHal);
904 if ( ! HAL_STATUS_SUCCESS( status ) ) {
905 smsLog( pMac, LOGE,
906 "ccmOpen failed during initialization with status=%d", status );
907 break;
908 }
909
910 status = csrOpen(pMac);
911 if ( ! HAL_STATUS_SUCCESS( status ) ) {
912 smsLog( pMac, LOGE,
913 "csrOpen failed during initialization with status=%d", status );
914 break;
915 }
916
917 status = pmcOpen(hHal);
918 if ( ! HAL_STATUS_SUCCESS( status ) ) {
919 smsLog( pMac, LOGE,
920 "pmcOpen failed during initialization with status=%d", status );
921 break;
922 }
923
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700924#ifdef FEATURE_WLAN_TDLS
925 pMac->isTdlsPowerSaveProhibited = 0;
926#endif
927
Jeff Johnson295189b2012-06-20 16:38:30 -0700928#ifndef WLAN_MDM_CODE_REDUCTION_OPT
929 status = sme_QosOpen(pMac);
930 if ( ! HAL_STATUS_SUCCESS( status ) ) {
931 smsLog( pMac, LOGE,
932 "Qos open failed during initialization with status=%d", status );
933 break;
934 }
935
936 status = btcOpen(pMac);
937 if ( ! HAL_STATUS_SUCCESS( status ) ) {
938 smsLog( pMac, LOGE,
939 "btcOpen open failed during initialization with status=%d", status );
940 break;
941 }
942#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700943#ifdef FEATURE_OEM_DATA_SUPPORT
944 status = oemData_OemDataReqOpen(pMac);
945 if ( ! HAL_STATUS_SUCCESS( status ) ) {
946 smsLog(pMac, LOGE,
947 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
948 break;
949 }
950#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700951
952 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
953 break;
954
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 {
956 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
957 if ( NULL == pvosGCtx ){
958 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
959 status = eHAL_STATUS_FAILURE;
960 break;
961 }
962
963 status = WLANSAP_Open( pvosGCtx );
964 if ( ! HAL_STATUS_SUCCESS( status ) ) {
965 smsLog( pMac, LOGE,
966 "WLANSAP_Open open failed during initialization with status=%d", status );
967 break;
968 }
969 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700970#if defined WLAN_FEATURE_VOWIFI
971 status = rrmOpen(pMac);
972 if ( ! HAL_STATUS_SUCCESS( status ) ) {
973 smsLog( pMac, LOGE,
974 "rrmOpen open failed during initialization with status=%d", status );
975 break;
976 }
977#endif
978
979#if defined WLAN_FEATURE_VOWIFI_11R
980 sme_FTOpen(pMac);
981#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700983
984 }while (0);
985
986 return status;
987}
988
Jeff Johnson295189b2012-06-20 16:38:30 -0700989/*--------------------------------------------------------------------------
990
991 \brief sme_set11dinfo() - Set the 11d information about valid channels
992 and there power using information from nvRAM
993 This function is called only for AP.
994
Srinivas Girigowdade697412013-02-14 16:31:48 -0800995 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -0700996
997 \param hHal - The handle returned by macOpen.
998 \Param pSmeConfigParams - a pointer to a caller allocated object of
999 typedef struct _smeConfigParams.
1000
1001 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1002
1003 Other status means SME is failed to update the config parameters.
1004 \sa
1005--------------------------------------------------------------------------*/
1006
1007eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1008{
1009 eHalStatus status = eHAL_STATUS_FAILURE;
1010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1011
1012 if (NULL == pSmeConfigParams ) {
1013 smsLog( pMac, LOGE,
1014 "Empty config param structure for SME, nothing to update");
1015 return status;
1016 }
1017
1018 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1019 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001020 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 status );
1022 }
1023 return status;
1024}
1025
1026/*--------------------------------------------------------------------------
1027
1028 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1029
Srinivas Girigowdade697412013-02-14 16:31:48 -08001030 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001031
1032 \param hHal - The handle returned by HostapdAdapter.
1033 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1034
1035 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1036
1037 Other status means, failed to get the current regulatory domain.
1038 \sa
1039--------------------------------------------------------------------------*/
1040
1041eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1042{
1043 eHalStatus status = eHAL_STATUS_FAILURE;
1044 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1045
1046 if (NULL == domainIdSoftAp ) {
1047 smsLog( pMac, LOGE, "Uninitialized domain Id");
1048 return status;
1049 }
1050
1051 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1052 status = eHAL_STATUS_SUCCESS;
1053
1054 return status;
1055}
1056
1057
1058eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1059{
1060 eHalStatus status = eHAL_STATUS_FAILURE;
1061 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1062
1063 if (NULL == apCntryCode ) {
1064 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1065 return status;
1066 }
1067
1068 status = csrSetRegInfo(hHal, apCntryCode );
1069 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001070 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 status );
1072 }
1073 return status;
1074}
1075
Jeff Johnson295189b2012-06-20 16:38:30 -07001076#ifdef FEATURE_WLAN_SCAN_PNO
1077/*--------------------------------------------------------------------------
1078
1079 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1080
1081 It is used at driver start up to inform RIVA of the default channel
1082 configuration.
1083
Srinivas Girigowdade697412013-02-14 16:31:48 -08001084 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001085
1086 \param hHal - The handle returned by macOpen.
1087
1088 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1089
1090 Other status means SME is failed to update the channel config.
1091 \sa
1092
1093 --------------------------------------------------------------------------*/
1094eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1095{
1096 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1097
1098 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1099 &pMac->scan.base20MHzChannels, FALSE);
1100 return eHAL_STATUS_SUCCESS;
1101}
1102#endif // FEATURE_WLAN_SCAN_PNLO
1103
1104/*--------------------------------------------------------------------------
1105
1106 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1107
1108 The function updates some configuration for modules in SME, CCM, CSR, etc
1109 during SMEs close open sequence.
1110
1111 Modules inside SME apply the new configuration at the next transaction.
1112
Srinivas Girigowdade697412013-02-14 16:31:48 -08001113 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001114
1115 \param hHal - The handle returned by macOpen.
1116 \Param pSmeConfigParams - a pointer to a caller allocated object of
1117 typedef struct _smeConfigParams.
1118
1119 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1120
1121 Other status means SME is failed to update the config parameters.
1122 \sa
1123
1124 --------------------------------------------------------------------------*/
1125eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1126{
1127 eHalStatus status = eHAL_STATUS_FAILURE;
1128 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1129
1130 if (NULL == pSmeConfigParams ) {
1131 smsLog( pMac, LOGE,
1132 "Empty config param structure for SME, nothing to update");
1133 return status;
1134 }
1135
1136 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1137
1138 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001139 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 status );
1141 }
1142#if defined WLAN_FEATURE_P2P_INTERNAL
1143 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1144
1145 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001146 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 status );
1148 }
1149#endif
1150#if defined WLAN_FEATURE_VOWIFI
1151 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1152
1153 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001154 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001155 status );
1156 }
1157#endif
1158 //For SOC, CFG is set before start
1159 //We don't want to apply global CFG in connect state because that may cause some side affect
1160 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 csrIsAllSessionDisconnected( pMac) )
1162 {
1163 csrSetGlobalCfgs(pMac);
1164 }
1165
1166 return status;
1167}
1168
1169/* ---------------------------------------------------------------------------
1170 \fn sme_ChangeConfigParams
1171 \brief The SME API exposed for HDD to provide config params to SME during
1172 SMEs stop -> start sequence.
1173
1174 If HDD changed the domain that will cause a reset. This function will
1175 provide the new set of 11d information for the new domain. Currrently this
1176 API provides info regarding 11d only at reset but we can extend this for
1177 other params (PMC, QoS) which needs to be initialized again at reset.
1178
Srinivas Girigowdade697412013-02-14 16:31:48 -08001179 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001180
1181 \param hHal - The handle returned by macOpen.
1182
1183 \Param
1184 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1185 currently provides 11d related information like Country code,
1186 Regulatory domain, valid channel list, Tx power per channel, a
1187 list with active/passive scan allowed per valid channel.
1188
1189 \return eHalStatus
1190 ---------------------------------------------------------------------------*/
1191eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1192 tCsrUpdateConfigParam *pUpdateConfigParam)
1193{
1194 eHalStatus status = eHAL_STATUS_FAILURE;
1195 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1196
1197 if (NULL == pUpdateConfigParam ) {
1198 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001199 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 return status;
1201 }
1202
1203 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1204
1205 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001206 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 status );
1208 }
1209
1210 return status;
1211
1212}
1213
1214/*--------------------------------------------------------------------------
1215
1216 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1217 that the NIC is ready tio run.
1218
1219 The function is called by HDD at the end of initialization stage so PE/HAL can
1220 enable the NIC to running state.
1221
Srinivas Girigowdade697412013-02-14 16:31:48 -08001222 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 \param hHal - The handle returned by macOpen.
1224
1225 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1226 successfully.
1227
1228 Other status means SME failed to send the message to PE.
1229 \sa
1230
1231 --------------------------------------------------------------------------*/
1232eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1233{
1234 tSirSmeReadyReq Msg;
1235 eHalStatus status = eHAL_STATUS_FAILURE;
1236 tPmcPowerState powerState;
1237 tPmcSwitchState hwWlanSwitchState;
1238 tPmcSwitchState swWlanSwitchState;
1239 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1240
1241 do
1242 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001243
1244 Msg.messageType = eWNI_SME_SYS_READY_IND;
1245 Msg.length = sizeof( tSirSmeReadyReq );
1246
1247 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1248 {
1249 status = eHAL_STATUS_SUCCESS;
1250 }
1251 else
1252 {
1253 smsLog( pMac, LOGE,
1254 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1255 break;
1256 }
1257
1258 status = pmcQueryPowerState( hHal, &powerState,
1259 &hwWlanSwitchState, &swWlanSwitchState );
1260 if ( ! HAL_STATUS_SUCCESS( status ) )
1261 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001262 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 status );
1264 break;
1265 }
1266
1267 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1268 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1269 {
1270 status = csrReady(pMac);
1271 if ( ! HAL_STATUS_SUCCESS( status ) )
1272 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001273 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 break;
1275 }
1276 status = pmcReady(hHal);
1277 if ( ! HAL_STATUS_SUCCESS( status ) )
1278 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001279 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 break;
1281 }
1282#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1283 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1284 {
1285 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001286 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 break;
1288 }
1289#endif
1290
1291#if defined WLAN_FEATURE_VOWIFI
1292 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1293 {
1294 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001295 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 break;
1297 }
1298#endif
1299 }
1300 pMac->sme.state = SME_STATE_READY;
1301 } while( 0 );
1302
1303 return status;
1304}
1305
1306/*--------------------------------------------------------------------------
1307
1308 \brief sme_Start() - Put all SME modules at ready state.
1309
1310 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1311 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001312 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 \param hHal - The handle returned by macOpen.
1314
1315 \return eHAL_STATUS_SUCCESS - SME is ready.
1316
1317 Other status means SME is failed to start
1318 \sa
1319
1320 --------------------------------------------------------------------------*/
1321eHalStatus sme_Start(tHalHandle hHal)
1322{
1323 eHalStatus status = eHAL_STATUS_FAILURE;
1324 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1325
1326 do
1327 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 status = csrStart(pMac);
1329 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001330 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 status );
1332 break;
1333 }
1334
1335 status = pmcStart(hHal);
1336 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001337 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 status );
1339 break;
1340 }
1341
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1343 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001344 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 status );
1346 break;
1347 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 pMac->sme.state = SME_STATE_START;
1349 }while (0);
1350
1351 return status;
1352}
1353
1354
1355#ifdef WLAN_FEATURE_PACKET_FILTERING
1356/******************************************************************************
1357*
1358* Name: sme_PCFilterMatchCountResponseHandler
1359*
1360* Description:
1361* Invoke Packet Coalescing Filter Match Count callback routine
1362*
1363* Parameters:
1364* hHal - HAL handle for device
1365* pMsg - Pointer to tRcvFltPktMatchRsp structure
1366*
1367* Returns: eHalStatus
1368*
1369******************************************************************************/
1370eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1371{
1372 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1373 eHalStatus status = eHAL_STATUS_SUCCESS;
1374 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1375
1376 if (NULL == pMsg)
1377 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001378 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 status = eHAL_STATUS_FAILURE;
1380 }
1381 else
1382 {
1383 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001384 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001385
1386 /* Call Packet Coalescing Filter Match Count callback routine. */
1387 if (pMac->pmc.FilterMatchCountCB != NULL)
1388 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1389 pRcvFltPktMatchRsp);
1390
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001391 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 pRcvFltPktMatchRsp->status);
1393
1394 pMac->pmc.FilterMatchCountCB = NULL;
1395 pMac->pmc.FilterMatchCountCBContext = NULL;
1396 }
1397
1398 return(status);
1399}
1400#endif // WLAN_FEATURE_PACKET_FILTERING
1401
1402
1403/*--------------------------------------------------------------------------
1404
1405 \brief sme_ProcessMsg() - The main message processor for SME.
1406
1407 The function is called by a message dispatcher when to process a message
1408 targeted for SME.
1409
Srinivas Girigowdade697412013-02-14 16:31:48 -08001410 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001411 \param hHal - The handle returned by macOpen.
1412 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1413
1414 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1415
1416 Other status means SME failed to process the message to HAL.
1417 \sa
1418
1419 --------------------------------------------------------------------------*/
1420eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1421{
1422 eHalStatus status = eHAL_STATUS_FAILURE;
1423 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1424
1425 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001426 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 return status;
1428 }
1429
1430 status = sme_AcquireGlobalLock( &pMac->sme );
1431 if ( HAL_STATUS_SUCCESS( status ) )
1432 {
1433 if( SME_IS_START(pMac) )
1434 {
1435 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1436 case eWNI_PMC_ENTER_BMPS_RSP:
1437 case eWNI_PMC_EXIT_BMPS_RSP:
1438 case eWNI_PMC_EXIT_BMPS_IND:
1439 case eWNI_PMC_ENTER_IMPS_RSP:
1440 case eWNI_PMC_EXIT_IMPS_RSP:
1441 case eWNI_PMC_SMPS_STATE_IND:
1442 case eWNI_PMC_ENTER_UAPSD_RSP:
1443 case eWNI_PMC_EXIT_UAPSD_RSP:
1444 case eWNI_PMC_ENTER_WOWL_RSP:
1445 case eWNI_PMC_EXIT_WOWL_RSP:
1446 //PMC
1447 if (pMsg->bodyptr)
1448 {
1449 pmcMessageProcessor(hHal, pMsg->bodyptr);
1450 status = eHAL_STATUS_SUCCESS;
1451 vos_mem_free( pMsg->bodyptr );
1452 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001453 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 }
1455 break;
1456
1457 case WNI_CFG_SET_CNF:
1458 case WNI_CFG_DNLD_CNF:
1459 case WNI_CFG_GET_RSP:
1460 case WNI_CFG_ADD_GRP_ADDR_CNF:
1461 case WNI_CFG_DEL_GRP_ADDR_CNF:
1462 //CCM
1463 if (pMsg->bodyptr)
1464 {
1465 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1466 status = eHAL_STATUS_SUCCESS;
1467 vos_mem_free( pMsg->bodyptr );
1468 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001469 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 }
1471 break;
1472
1473 case eWNI_SME_ADDTS_RSP:
1474 case eWNI_SME_DELTS_RSP:
1475 case eWNI_SME_DELTS_IND:
1476#ifdef WLAN_FEATURE_VOWIFI_11R
1477 case eWNI_SME_FT_AGGR_QOS_RSP:
1478#endif
1479 //QoS
1480 if (pMsg->bodyptr)
1481 {
1482#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1483 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1484 vos_mem_free( pMsg->bodyptr );
1485#endif
1486 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001487 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 }
1489 break;
1490#if defined WLAN_FEATURE_VOWIFI
1491 case eWNI_SME_NEIGHBOR_REPORT_IND:
1492 case eWNI_SME_BEACON_REPORT_REQ_IND:
1493#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001494 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001495#endif
1496 if ( pMsg->bodyptr )
1497 {
1498 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
1499 vos_mem_free( pMsg->bodyptr );
1500 }
1501 else
1502 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001503 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 }
1505 break;
1506#endif
1507
Jeff Johnsone7245742012-09-05 17:12:55 -07001508#ifdef FEATURE_OEM_DATA_SUPPORT
1509 //Handle the eWNI_SME_OEM_DATA_RSP:
1510 case eWNI_SME_OEM_DATA_RSP:
1511 if(pMsg->bodyptr)
1512 {
1513 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1514 vos_mem_free(pMsg->bodyptr);
1515 }
1516 else
1517 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001518 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001519 }
1520 smeProcessPendingQueue( pMac );
1521 break;
1522#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001523
1524 case eWNI_SME_ADD_STA_SELF_RSP:
1525 if(pMsg->bodyptr)
1526 {
1527 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1528 vos_mem_free(pMsg->bodyptr);
1529 }
1530 else
1531 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001532 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001533 }
1534 break;
1535 case eWNI_SME_DEL_STA_SELF_RSP:
1536 if(pMsg->bodyptr)
1537 {
1538 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1539 vos_mem_free(pMsg->bodyptr);
1540 }
1541 else
1542 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001543 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 }
1545 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001546 case eWNI_SME_REMAIN_ON_CHN_RSP:
1547 if(pMsg->bodyptr)
1548 {
1549 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1550 vos_mem_free(pMsg->bodyptr);
1551 }
1552 else
1553 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001554 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001555 }
1556 break;
1557 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1558 if(pMsg->bodyptr)
1559 {
1560 status = sme_remainOnChnReady(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_REMAIN_ON_CHN_RDY_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 }
1567 break;
1568 case eWNI_SME_MGMT_FRM_IND:
1569 if(pMsg->bodyptr)
1570 {
1571 sme_mgmtFrmInd(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_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 }
1578 break;
1579 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1580 if(pMsg->bodyptr)
1581 {
1582 status = sme_sendActionCnf(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_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 }
1589 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001590 case eWNI_SME_COEX_IND:
1591 if(pMsg->bodyptr)
1592 {
1593 status = btcHandleCoexInd((void *)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_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 }
1600 break;
1601
1602#ifdef FEATURE_WLAN_SCAN_PNO
1603 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1604 if(pMsg->bodyptr)
1605 {
1606 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1607 vos_mem_free(pMsg->bodyptr);
1608 }
1609 else
1610 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001611 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 }
1613 break;
1614#endif // FEATURE_WLAN_SCAN_PNO
1615
1616 case eWNI_SME_TX_PER_HIT_IND:
1617 if (pMac->sme.pTxPerHitCallback)
1618 {
1619 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1620 }
1621 break;
1622
1623 case eWNI_SME_CHANGE_COUNTRY_CODE:
1624 if(pMsg->bodyptr)
1625 {
1626 status = sme_HandleChangeCountryCode((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 WLAN_FEATURE_PACKET_FILTERING
1636 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1637 if(pMsg->bodyptr)
1638 {
1639 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1640 vos_mem_free(pMsg->bodyptr);
1641 }
1642 else
1643 {
1644 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001645 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 }
1647 break;
1648#endif // WLAN_FEATURE_PACKET_FILTERING
1649 case eWNI_SME_PRE_SWITCH_CHL_IND:
1650 {
1651 status = sme_HandlePreChannelSwitchInd(pMac);
1652 break;
1653 }
1654
1655 case eWNI_SME_POST_SWITCH_CHL_IND:
1656 {
1657 status = sme_HandlePostChannelSwitchInd(pMac);
1658 break;
1659 }
1660
1661#ifdef WLAN_WAKEUP_EVENTS
1662 case eWNI_SME_WAKE_REASON_IND:
1663 if(pMsg->bodyptr)
1664 {
1665 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1666 vos_mem_free(pMsg->bodyptr);
1667 }
1668 else
1669 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001670 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 }
1672 break;
1673#endif // WLAN_WAKEUP_EVENTS
1674
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001675#ifdef FEATURE_WLAN_TDLS
1676 /*
1677 * command rescived from PE, SME tdls msg processor shall be called
1678 * to process commands recieved from PE
1679 */
1680 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1681 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001682 case eWNI_SME_TDLS_DEL_STA_RSP:
1683 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001684 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001685 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001686#ifdef FEATURE_WLAN_TDLS_INTERNAL
1687 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1688 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1689 case eWNI_SME_TDLS_LINK_START_RSP:
1690 case eWNI_SME_TDLS_LINK_START_IND:
1691 case eWNI_SME_TDLS_TEARDOWN_RSP:
1692 case eWNI_SME_TDLS_TEARDOWN_IND:
1693 case eWNI_SME_ADD_TDLS_PEER_IND:
1694 case eWNI_SME_DELETE_TDLS_PEER_IND:
1695#endif
1696 {
1697 if (pMsg->bodyptr)
1698 {
1699 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1700 vos_mem_free( pMsg->bodyptr );
1701 }
1702 else
1703 {
1704 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001705 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001706 }
1707 break;
1708 }
1709#endif
1710
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 default:
1712
1713 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
1714 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
1715 {
1716 //CSR
1717 if (pMsg->bodyptr)
1718 {
1719 status = csrMsgProcessor(hHal, pMsg->bodyptr);
1720 vos_mem_free( pMsg->bodyptr );
1721 }
1722 else
1723 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001724 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 }
1726 }
1727 else
1728 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001729 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 pMsg->type);
1731 if (pMsg->bodyptr)
1732 {
1733 vos_mem_free( pMsg->bodyptr );
1734 }
1735 }
1736 }//switch
1737 } //SME_IS_START
1738 else
1739 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001740 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001741 if (pMsg->bodyptr)
1742 {
1743 vos_mem_free( pMsg->bodyptr );
1744 }
1745 }
1746 sme_ReleaseGlobalLock( &pMac->sme );
1747 }
1748 else
1749 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001750 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 if (pMsg->bodyptr)
1752 {
1753 vos_mem_free( pMsg->bodyptr );
1754 }
1755 }
1756
1757 return status;
1758}
1759
1760
1761//No need to hold the global lock here because this function can only be called
1762//after sme_Stop.
1763v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
1764{
1765 if( pMsg )
1766 {
1767 if (pMsg->bodyptr)
1768 {
1769 vos_mem_free( pMsg->bodyptr );
1770 }
1771 }
1772
1773}
1774
1775
1776/*--------------------------------------------------------------------------
1777
1778 \brief sme_Stop() - Stop all SME modules and put them at idle state
1779
1780 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
1781 return, all modules are at idle state ready to start.
1782
Srinivas Girigowdade697412013-02-14 16:31:48 -08001783 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001784 \param hHal - The handle returned by macOpen
1785
1786 \return eHAL_STATUS_SUCCESS - SME is stopped.
1787
1788 Other status means SME is failed to stop but caller should still
1789 consider SME is stopped.
1790 \sa
1791
1792 --------------------------------------------------------------------------*/
1793eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
1794{
1795 eHalStatus status = eHAL_STATUS_FAILURE;
1796 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1797 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1798
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1800 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001801 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 status );
1803 fail_status = status;
1804 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001805
1806 p2pStop(hHal);
1807
1808 if(pmcFlag)
1809 {
1810 status = pmcStop(hHal);
1811 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001812 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 status );
1814 fail_status = status;
1815 }
1816 }
1817
1818 status = csrStop(pMac);
1819 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001820 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 status );
1822 fail_status = status;
1823 }
1824
1825 ccmStop(hHal);
1826
1827 purgeSmeCmdList(pMac);
1828
1829 if (!HAL_STATUS_SUCCESS( fail_status )) {
1830 status = fail_status;
1831 }
1832
1833 pMac->sme.state = SME_STATE_STOP;
1834
1835 return status;
1836}
1837
1838/*--------------------------------------------------------------------------
1839
1840 \brief sme_Close() - Release all SME modules and their resources.
1841
1842 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
1843 return, all modules are at closed state.
1844
1845 No SME APIs can be involved after smeClose except smeOpen.
1846 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001847 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 \param hHal - The handle returned by macOpen
1849
1850 \return eHAL_STATUS_SUCCESS - SME is successfully close.
1851
1852 Other status means SME is failed to be closed but caller still cannot
1853 call any other SME functions except smeOpen.
1854 \sa
1855
1856 --------------------------------------------------------------------------*/
1857eHalStatus sme_Close(tHalHandle hHal)
1858{
1859 eHalStatus status = eHAL_STATUS_FAILURE;
1860 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1861 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1862
1863 status = csrClose(pMac);
1864 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001865 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 status );
1867 fail_status = status;
1868 }
1869
Jeff Johnson295189b2012-06-20 16:38:30 -07001870 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1871 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001872 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 status );
1874 fail_status = status;
1875 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001876
1877#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1878 status = btcClose(hHal);
1879 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001880 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 status );
1882 fail_status = status;
1883 }
1884
1885 status = sme_QosClose(pMac);
1886 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001887 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001888 status );
1889 fail_status = status;
1890 }
1891#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001892#ifdef FEATURE_OEM_DATA_SUPPORT
1893 status = oemData_OemDataReqClose(hHal);
1894 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001895 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07001896 status );
1897 fail_status = status;
1898 }
1899#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001900
1901 status = ccmClose(hHal);
1902 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001903 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001904 status );
1905 fail_status = status;
1906 }
1907
1908 status = pmcClose(hHal);
1909 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001910 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 status );
1912 fail_status = status;
1913 }
1914#if defined WLAN_FEATURE_VOWIFI
1915 status = rrmClose(hHal);
1916 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001917 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001918 status );
1919 fail_status = status;
1920 }
1921#endif
1922
1923#if defined WLAN_FEATURE_VOWIFI_11R
1924 sme_FTClose(hHal);
1925#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001926 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07001927
1928 freeSmeCmdList(pMac);
1929
1930 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
1931 {
1932 fail_status = eHAL_STATUS_FAILURE;
1933 }
1934
1935 if (!HAL_STATUS_SUCCESS( fail_status )) {
1936 status = fail_status;
1937 }
1938
1939 pMac->sme.state = SME_STATE_STOP;
1940
1941 return status;
1942}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001943#ifdef FEATURE_WLAN_LFR
1944tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
1945{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07001946#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001947 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
1948 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
1949 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
1950 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
1951 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
1952 return eANI_BOOLEAN_FALSE;
1953 default:
1954 return eANI_BOOLEAN_TRUE;
1955 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07001956#else
1957 /*
1958 * TODO: always return TRUE for now until
1959 * we figure out why we could be stuck in
1960 * one of the roaming states forever.
1961 */
1962 return eANI_BOOLEAN_TRUE;
1963#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001964}
1965#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001966/* ---------------------------------------------------------------------------
1967 \fn sme_ScanRequest
1968 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001969 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 \param pScanRequestID - pointer to an object to get back the request ID
1971 \param callback - a callback function that scan calls upon finish, will not
1972 be called if csrScanRequest returns error
1973 \param pContext - a pointer passed in for the callback
1974 \return eHalStatus
1975 ---------------------------------------------------------------------------*/
1976eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
1977 tANI_U32 *pScanRequestID,
1978 csrScanCompleteCallback callback, void *pContext)
1979{
1980 eHalStatus status = eHAL_STATUS_FAILURE;
1981 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1982
1983 smsLog(pMac, LOG2, FL("enter"));
1984 do
1985 {
1986 if(pMac->scan.fScanEnable)
1987 {
1988 status = sme_AcquireGlobalLock( &pMac->sme );
1989 if ( HAL_STATUS_SUCCESS( status ) )
1990 {
1991 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001992#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08001993 if(csrIsScanAllowed(pMac))
1994 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001995#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08001996 status = csrScanRequest( hHal, sessionId, pscanReq,
1997 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001998#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08001999 }
2000 else
2001 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002002 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2003 pMac->roam.neighborRoamInfo.neighborRoamState,
2004 pMac->roam.curSubState[sessionId]);
2005 /*HandOff is in progress. So schedule this scan later*/
2006 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002007 }
2008#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 }
2010
2011 sme_ReleaseGlobalLock( &pMac->sme );
2012 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002013 else
2014 {
2015 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2016 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002018 else
2019 {
2020 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2021 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 } while( 0 );
2023
2024 return (status);
2025
2026
2027}
2028
2029/* ---------------------------------------------------------------------------
2030 \fn sme_ScanGetResult
2031 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002032 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 \param pFilter - If pFilter is NULL, all cached results are returned
2034 \param phResult - an object for the result.
2035 \return eHalStatus
2036 ---------------------------------------------------------------------------*/
2037eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2038 tScanResultHandle *phResult)
2039{
2040 eHalStatus status = eHAL_STATUS_FAILURE;
2041 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2042
2043 smsLog(pMac, LOG2, FL("enter"));
2044 status = sme_AcquireGlobalLock( &pMac->sme );
2045 if ( HAL_STATUS_SUCCESS( status ) )
2046 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002047 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 sme_ReleaseGlobalLock( &pMac->sme );
2049 }
2050 smsLog(pMac, LOG2, FL("exit status %d"), status);
2051
2052 return (status);
2053}
2054
2055
2056/* ---------------------------------------------------------------------------
2057 \fn sme_ScanFlushResult
2058 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002059 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 \return eHalStatus
2061 ---------------------------------------------------------------------------*/
2062eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2063{
2064 eHalStatus status = eHAL_STATUS_FAILURE;
2065 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2066
2067 status = sme_AcquireGlobalLock( &pMac->sme );
2068 if ( HAL_STATUS_SUCCESS( status ) )
2069 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002070 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 sme_ReleaseGlobalLock( &pMac->sme );
2072 }
2073
2074 return (status);
2075}
2076
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002077eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2078{
2079 eHalStatus status = eHAL_STATUS_FAILURE;
2080 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2081
2082 status = sme_AcquireGlobalLock( &pMac->sme );
2083 if ( HAL_STATUS_SUCCESS( status ) )
2084 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302085 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002086 sme_ReleaseGlobalLock( &pMac->sme );
2087 }
2088
2089 return (status);
2090}
Jeff Johnson295189b2012-06-20 16:38:30 -07002091
2092/* ---------------------------------------------------------------------------
2093 \fn sme_ScanResultGetFirst
2094 \brief a wrapper function to request CSR to returns the first element of
2095 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002096 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 \param hScanResult - returned from csrScanGetResult
2098 \return tCsrScanResultInfo * - NULL if no result
2099 ---------------------------------------------------------------------------*/
2100tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2101 tScanResultHandle hScanResult)
2102{
2103 eHalStatus status = eHAL_STATUS_FAILURE;
2104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2105 tCsrScanResultInfo *pRet = NULL;
2106
2107 status = sme_AcquireGlobalLock( &pMac->sme );
2108 if ( HAL_STATUS_SUCCESS( status ) )
2109 {
2110 pRet = csrScanResultGetFirst( pMac, hScanResult );
2111 sme_ReleaseGlobalLock( &pMac->sme );
2112 }
2113
2114 return (pRet);
2115}
2116
2117
2118/* ---------------------------------------------------------------------------
2119 \fn sme_ScanResultGetNext
2120 \brief a wrapper function to request CSR to returns the next element of
2121 scan result. It can be called without calling csrScanResultGetFirst
2122 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002123 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 \param hScanResult - returned from csrScanGetResult
2125 \return Null if no result or reach the end
2126 ---------------------------------------------------------------------------*/
2127tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2128 tScanResultHandle hScanResult)
2129{
2130 eHalStatus status = eHAL_STATUS_FAILURE;
2131 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2132 tCsrScanResultInfo *pRet = NULL;
2133
2134 status = sme_AcquireGlobalLock( &pMac->sme );
2135 if ( HAL_STATUS_SUCCESS( status ) )
2136 {
2137 pRet = csrScanResultGetNext( pMac, hScanResult );
2138 sme_ReleaseGlobalLock( &pMac->sme );
2139 }
2140
2141 return (pRet);
2142}
2143
2144
2145/* ---------------------------------------------------------------------------
2146 \fn sme_ScanSetBGScanparams
2147 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002148 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 \param pScanReq - BG scan request structure
2150 \return eHalStatus
2151 ---------------------------------------------------------------------------*/
2152eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2153{
2154 eHalStatus status = eHAL_STATUS_FAILURE;
2155 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2156
2157 if( NULL != pScanReq )
2158 {
2159 status = sme_AcquireGlobalLock( &pMac->sme );
2160 if ( HAL_STATUS_SUCCESS( status ) )
2161 {
2162 status = csrScanSetBGScanparams( hHal, pScanReq );
2163 sme_ReleaseGlobalLock( &pMac->sme );
2164 }
2165 }
2166
2167 return (status);
2168}
2169
2170
2171/* ---------------------------------------------------------------------------
2172 \fn sme_ScanResultPurge
2173 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2174 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002175 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 \param hScanResult - returned from csrScanGetResult. hScanResult is
2177 considered gone by
2178 calling this function and even before this function reutrns.
2179 \return eHalStatus
2180 ---------------------------------------------------------------------------*/
2181eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2182{
2183 eHalStatus status = eHAL_STATUS_FAILURE;
2184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2185
2186 status = sme_AcquireGlobalLock( &pMac->sme );
2187 if ( HAL_STATUS_SUCCESS( status ) )
2188 {
2189 status = csrScanResultPurge( hHal, hScanResult );
2190 sme_ReleaseGlobalLock( &pMac->sme );
2191 }
2192
2193 return (status);
2194}
2195
2196/* ---------------------------------------------------------------------------
2197 \fn sme_ScanGetPMKIDCandidateList
2198 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002199 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 \param pPmkidList - caller allocated buffer point to an array of
2201 tPmkidCandidateInfo
2202 \param pNumItems - pointer to a variable that has the number of
2203 tPmkidCandidateInfo allocated when retruning, this is
2204 either the number needed or number of items put into
2205 pPmkidList
2206 \return eHalStatus - when fail, it usually means the buffer allocated is not
2207 big enough and pNumItems
2208 has the number of tPmkidCandidateInfo.
2209 \Note: pNumItems is a number of tPmkidCandidateInfo,
2210 not sizeof(tPmkidCandidateInfo) * something
2211 ---------------------------------------------------------------------------*/
2212eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2213 tPmkidCandidateInfo *pPmkidList,
2214 tANI_U32 *pNumItems )
2215{
2216 eHalStatus status = eHAL_STATUS_FAILURE;
2217 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2218
2219 status = sme_AcquireGlobalLock( &pMac->sme );
2220 if ( HAL_STATUS_SUCCESS( status ) )
2221 {
2222 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2223 sme_ReleaseGlobalLock( &pMac->sme );
2224 }
2225
2226 return (status);
2227}
2228
2229/*----------------------------------------------------------------------------
2230 \fn sme_RoamRegisterLinkQualityIndCallback
2231
2232 \brief
2233 a wrapper function to allow HDD to register a callback handler with CSR for
2234 link quality indications.
2235
2236 Only one callback may be registered at any time.
2237 In order to deregister the callback, a NULL cback may be provided.
2238
2239 Registration happens in the task context of the caller.
2240
2241 \param callback - Call back being registered
2242 \param pContext - user data
2243
2244 DEPENDENCIES: After CSR open
2245
2246 \return eHalStatus
2247-----------------------------------------------------------------------------*/
2248eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2249 csrRoamLinkQualityIndCallback callback,
2250 void *pContext)
2251{
2252 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2253}
2254
2255/* ---------------------------------------------------------------------------
2256 \fn sme_RoamRegisterCallback
2257 \brief a wrapper function to allow HDD to register a callback with CSR.
2258 Unlike scan, roam has one callback for all the roam requests
2259 \param callback - a callback function that roam calls upon when state changes
2260 \param pContext - a pointer passed in for the callback
2261 \return eHalStatus
2262 ---------------------------------------------------------------------------*/
2263eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2264 csrRoamCompleteCallback callback,
2265 void *pContext)
2266{
2267 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2268}
2269
2270eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2271{
2272 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2273 return pMac->roam.configParam.phyMode;
2274}
2275
2276/* ---------------------------------------------------------------------------
2277 \fn sme_RoamConnect
2278 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002279 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 \param sessionId - the sessionId returned by sme_OpenSession.
2281 \param pProfile - description of the network to which to connect
2282 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2283 from csrScanGetResult
2284 \param pRoamId - to get back the request ID
2285 \return eHalStatus
2286 ---------------------------------------------------------------------------*/
2287eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2288 tANI_U32 *pRoamId)
2289{
2290 eHalStatus status = eHAL_STATUS_FAILURE;
2291 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2292
2293 smsLog(pMac, LOG2, FL("enter"));
2294 status = sme_AcquireGlobalLock( &pMac->sme );
2295 if ( HAL_STATUS_SUCCESS( status ) )
2296 {
2297 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2298 {
2299 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2300 }
2301 else
2302 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002303 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 status = eHAL_STATUS_INVALID_PARAMETER;
2305 }
2306 sme_ReleaseGlobalLock( &pMac->sme );
2307 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002308 else
2309 {
2310 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2311 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002312
2313 return (status);
2314}
2315
2316/* ---------------------------------------------------------------------------
2317 \fn sme_RoamReassoc
2318 \brief a wrapper function to request CSR to inititiate a re-association
2319 \param pProfile - can be NULL to join the currently connected AP. In that
2320 case modProfileFields should carry the modified field(s) which could trigger
2321 reassoc
2322 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2323 that might need modification dynamically once STA is up & running and this
2324 could trigger a reassoc
2325 \param pRoamId - to get back the request ID
2326 \return eHalStatus
2327 -------------------------------------------------------------------------------*/
2328eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2329 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002330 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002331{
2332 eHalStatus status = eHAL_STATUS_FAILURE;
2333 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2334
2335 smsLog(pMac, LOG2, FL("enter"));
2336 status = sme_AcquireGlobalLock( &pMac->sme );
2337 if ( HAL_STATUS_SUCCESS( status ) )
2338 {
2339 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2340 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002341 if((NULL == pProfile) && (fForce == 1))
2342 {
2343 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2344 /* to force the AP initiate fresh 802.1x authentication need to clear
2345 * the PMKID cache for that set the following boolean. this is needed
2346 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2347 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002348 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2349 }
2350 else
2351 {
2352 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2353 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 }
2355 else
2356 {
2357 status = eHAL_STATUS_INVALID_PARAMETER;
2358 }
2359 sme_ReleaseGlobalLock( &pMac->sme );
2360 }
2361
2362 return (status);
2363}
2364
2365/* ---------------------------------------------------------------------------
2366 \fn sme_RoamConnectToLastProfile
2367 \brief a wrapper function to request CSR to disconnect and reconnect with
2368 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002369 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002370 \return eHalStatus. It returns fail if currently connected
2371 ---------------------------------------------------------------------------*/
2372eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2373{
2374 eHalStatus status = eHAL_STATUS_FAILURE;
2375 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2376
2377 status = sme_AcquireGlobalLock( &pMac->sme );
2378 if ( HAL_STATUS_SUCCESS( status ) )
2379 {
2380 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2381 {
2382 status = csrRoamConnectToLastProfile( pMac, sessionId );
2383 }
2384 else
2385 {
2386 status = eHAL_STATUS_INVALID_PARAMETER;
2387 }
2388 sme_ReleaseGlobalLock( &pMac->sme );
2389 }
2390
2391 return (status);
2392}
2393
2394/* ---------------------------------------------------------------------------
2395 \fn sme_RoamDisconnect
2396 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002397 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002398 \param reason -- To indicate the reason for disconnecting. Currently, only
2399 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2400 \return eHalStatus
2401 ---------------------------------------------------------------------------*/
2402eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2403{
2404 eHalStatus status = eHAL_STATUS_FAILURE;
2405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2406
2407 smsLog(pMac, LOG2, FL("enter"));
2408 status = sme_AcquireGlobalLock( &pMac->sme );
2409 if ( HAL_STATUS_SUCCESS( status ) )
2410 {
2411 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2412 {
2413 status = csrRoamDisconnect( pMac, sessionId, reason );
2414 }
2415 else
2416 {
2417 status = eHAL_STATUS_INVALID_PARAMETER;
2418 }
2419 sme_ReleaseGlobalLock( &pMac->sme );
2420 }
2421
2422 return (status);
2423}
2424
Jeff Johnson295189b2012-06-20 16:38:30 -07002425/* ---------------------------------------------------------------------------
2426 \fn sme_RoamStopBss
2427 \brief To stop BSS for Soft AP. This is an asynchronous API.
2428 \param hHal - Global structure
2429 \param sessionId - sessionId of SoftAP
2430 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2431 -------------------------------------------------------------------------------*/
2432eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2433{
2434 eHalStatus status = eHAL_STATUS_FAILURE;
2435 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2436
2437 smsLog(pMac, LOG2, FL("enter"));
2438 status = sme_AcquireGlobalLock( &pMac->sme );
2439 if ( HAL_STATUS_SUCCESS( status ) )
2440 {
2441 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2442 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302443 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002444 }
2445 else
2446 {
2447 status = eHAL_STATUS_INVALID_PARAMETER;
2448 }
2449 sme_ReleaseGlobalLock( &pMac->sme );
2450 }
2451
2452 return (status);
2453}
2454
2455/* ---------------------------------------------------------------------------
2456 \fn sme_RoamDisconnectSta
2457 \brief To disassociate a station. This is an asynchronous API.
2458 \param hHal - Global structure
2459 \param sessionId - sessionId of SoftAP
2460 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2461 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2462 -------------------------------------------------------------------------------*/
2463eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2464 tANI_U8 *pPeerMacAddr)
2465{
2466 eHalStatus status = eHAL_STATUS_FAILURE;
2467 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2468
2469 if ( NULL == pMac )
2470 {
2471 VOS_ASSERT(0);
2472 return status;
2473 }
2474
2475 status = sme_AcquireGlobalLock( &pMac->sme );
2476 if ( HAL_STATUS_SUCCESS( status ) )
2477 {
2478 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2479 {
2480 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302481 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 }
2483 else
2484 {
2485 status = eHAL_STATUS_INVALID_PARAMETER;
2486 }
2487 sme_ReleaseGlobalLock( &pMac->sme );
2488 }
2489
2490 return (status);
2491}
2492
2493/* ---------------------------------------------------------------------------
2494 \fn sme_RoamDeauthSta
2495 \brief To disassociate a station. This is an asynchronous API.
2496 \param hHal - Global structure
2497 \param sessionId - sessionId of SoftAP
2498 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2499 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2500 -------------------------------------------------------------------------------*/
2501eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2502 tANI_U8 *pPeerMacAddr)
2503{
2504 eHalStatus status = eHAL_STATUS_FAILURE;
2505 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2506
2507 if ( NULL == pMac )
2508 {
2509 VOS_ASSERT(0);
2510 return status;
2511 }
2512
2513 status = sme_AcquireGlobalLock( &pMac->sme );
2514 if ( HAL_STATUS_SUCCESS( status ) )
2515 {
2516 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2517 {
2518 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302519 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 }
2521 else
2522 {
2523 status = eHAL_STATUS_INVALID_PARAMETER;
2524 }
2525 sme_ReleaseGlobalLock( &pMac->sme );
2526 }
2527
2528 return (status);
2529}
2530
2531/* ---------------------------------------------------------------------------
2532 \fn sme_RoamTKIPCounterMeasures
2533 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2534 \param sessionId - sessionId of SoftAP
2535 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2536 \return eHalStatus
2537 -------------------------------------------------------------------------------*/
2538eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2539 tANI_BOOLEAN bEnable)
2540{
2541 eHalStatus status = eHAL_STATUS_FAILURE;
2542 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2543
2544 if ( NULL == pMac )
2545 {
2546 VOS_ASSERT(0);
2547 return status;
2548 }
2549
2550 status = sme_AcquireGlobalLock( &pMac->sme );
2551 if ( HAL_STATUS_SUCCESS( status ) )
2552 {
2553 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2554 {
2555 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2556 }
2557 else
2558 {
2559 status = eHAL_STATUS_INVALID_PARAMETER;
2560 }
2561 sme_ReleaseGlobalLock( &pMac->sme );
2562 }
2563
2564 return (status);
2565}
2566
2567/* ---------------------------------------------------------------------------
2568 \fn sme_RoamGetAssociatedStas
2569 \brief To probe the list of associated stations from various modules of CORE stack.
2570 \This is an asynchronous API.
2571 \param sessionId - sessionId of SoftAP
2572 \param modId - Module from whom list of associtated stations is to be probed.
2573 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2574 \param pUsrContext - Opaque HDD context
2575 \param pfnSapEventCallback - Sap event callback in HDD
2576 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2577 \return eHalStatus
2578 -------------------------------------------------------------------------------*/
2579eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2580 VOS_MODULE_ID modId, void *pUsrContext,
2581 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2582{
2583 eHalStatus status = eHAL_STATUS_FAILURE;
2584 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2585
2586 if ( NULL == pMac )
2587 {
2588 VOS_ASSERT(0);
2589 return status;
2590 }
2591
2592 status = sme_AcquireGlobalLock( &pMac->sme );
2593 if ( HAL_STATUS_SUCCESS( status ) )
2594 {
2595 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2596 {
2597 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2598 }
2599 else
2600 {
2601 status = eHAL_STATUS_INVALID_PARAMETER;
2602 }
2603 sme_ReleaseGlobalLock( &pMac->sme );
2604 }
2605
2606 return (status);
2607}
2608
2609/* ---------------------------------------------------------------------------
2610 \fn sme_RoamGetWpsSessionOverlap
2611 \brief To get the WPS PBC session overlap information.
2612 \This is an asynchronous API.
2613 \param sessionId - sessionId of SoftAP
2614 \param pUsrContext - Opaque HDD context
2615 \param pfnSapEventCallback - Sap event callback in HDD
2616 \pRemoveMac - pointer to Mac address which needs to be removed from session
2617 \return eHalStatus
2618 -------------------------------------------------------------------------------*/
2619eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
2620 void *pUsrContext, void
2621 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
2622{
2623 eHalStatus status = eHAL_STATUS_FAILURE;
2624 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2625
2626 if ( NULL == pMac )
2627 {
2628 VOS_ASSERT(0);
2629 return status;
2630 }
2631
2632 status = sme_AcquireGlobalLock( &pMac->sme );
2633 if ( HAL_STATUS_SUCCESS( status ) )
2634 {
2635 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2636 {
2637 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
2638 }
2639 else
2640 {
2641 status = eHAL_STATUS_INVALID_PARAMETER;
2642 }
2643 sme_ReleaseGlobalLock( &pMac->sme );
2644 }
2645
2646 return (status);
2647}
2648
Jeff Johnson295189b2012-06-20 16:38:30 -07002649
2650/* ---------------------------------------------------------------------------
2651 \fn sme_RoamGetConnectState
2652 \brief a wrapper function to request CSR to return the current connect state
2653 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08002654 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002655 \return eHalStatus
2656 ---------------------------------------------------------------------------*/
2657eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
2658{
2659 eHalStatus status = eHAL_STATUS_FAILURE;
2660 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2661
2662 status = sme_AcquireGlobalLock( &pMac->sme );
2663 if ( HAL_STATUS_SUCCESS( status ) )
2664 {
2665 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2666 {
2667 status = csrRoamGetConnectState( pMac, sessionId, pState );
2668 }
2669 else
2670 {
2671 status = eHAL_STATUS_INVALID_PARAMETER;
2672 }
2673 sme_ReleaseGlobalLock( &pMac->sme );
2674 }
2675
2676 return (status);
2677}
2678
2679/* ---------------------------------------------------------------------------
2680 \fn sme_RoamGetConnectProfile
2681 \brief a wrapper function to request CSR to return the current connect
2682 profile. Caller must call csrRoamFreeConnectProfile after it is done
2683 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002684 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 \param pProfile - pointer to a caller allocated structure
2686 tCsrRoamConnectedProfile
2687 \return eHalStatus. Failure if not connected
2688 ---------------------------------------------------------------------------*/
2689eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
2690 tCsrRoamConnectedProfile *pProfile)
2691{
2692 eHalStatus status = eHAL_STATUS_FAILURE;
2693 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2694
2695 status = sme_AcquireGlobalLock( &pMac->sme );
2696 if ( HAL_STATUS_SUCCESS( status ) )
2697 {
2698 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2699 {
2700 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
2701 }
2702 else
2703 {
2704 status = eHAL_STATUS_INVALID_PARAMETER;
2705 }
2706 sme_ReleaseGlobalLock( &pMac->sme );
2707 }
2708
2709 return (status);
2710}
2711
2712/* ---------------------------------------------------------------------------
2713 \fn sme_RoamFreeConnectProfile
2714 \brief a wrapper function to request CSR to free and reinitialize the
2715 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002716 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 \param pProfile - pointer to a caller allocated structure
2718 tCsrRoamConnectedProfile
2719 \return eHalStatus.
2720 ---------------------------------------------------------------------------*/
2721eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
2722 tCsrRoamConnectedProfile *pProfile)
2723{
2724 eHalStatus status = eHAL_STATUS_FAILURE;
2725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2726
2727 status = sme_AcquireGlobalLock( &pMac->sme );
2728 if ( HAL_STATUS_SUCCESS( status ) )
2729 {
2730 status = csrRoamFreeConnectProfile( pMac, pProfile );
2731 sme_ReleaseGlobalLock( &pMac->sme );
2732 }
2733
2734 return (status);
2735}
2736
2737/* ---------------------------------------------------------------------------
2738 \fn sme_RoamSetPMKIDCache
2739 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002740 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002741 \param pPMKIDCache - caller allocated buffer point to an array of
2742 tPmkidCacheInfo
2743 \param numItems - a variable that has the number of tPmkidCacheInfo
2744 allocated when retruning, this is either the number needed
2745 or number of items put into pPMKIDCache
2746 \return eHalStatus - when fail, it usually means the buffer allocated is not
2747 big enough and pNumItems has the number of
2748 tPmkidCacheInfo.
2749 \Note: pNumItems is a number of tPmkidCacheInfo,
2750 not sizeof(tPmkidCacheInfo) * something
2751 ---------------------------------------------------------------------------*/
2752eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
2753 tANI_U32 numItems )
2754{
2755 eHalStatus status = eHAL_STATUS_FAILURE;
2756 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2757
2758 status = sme_AcquireGlobalLock( &pMac->sme );
2759 if ( HAL_STATUS_SUCCESS( status ) )
2760 {
2761 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2762 {
2763 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
2764 }
2765 else
2766 {
2767 status = eHAL_STATUS_INVALID_PARAMETER;
2768 }
2769 sme_ReleaseGlobalLock( &pMac->sme );
2770 }
2771
2772 return (status);
2773}
2774
2775/* ---------------------------------------------------------------------------
2776 \fn sme_RoamGetSecurityReqIE
2777 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
2778 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08002779 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002780 \param pLen - caller allocated memory that has the length of pBuf as input.
2781 Upon returned, *pLen has the needed or IE length in pBuf.
2782 \param pBuf - Caller allocated memory that contain the IE field, if any,
2783 upon return
2784 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2785 \return eHalStatus - when fail, it usually means the buffer allocated is not
2786 big enough
2787 ---------------------------------------------------------------------------*/
2788eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2789 tANI_U8 *pBuf, eCsrSecurityType secType)
2790{
2791 eHalStatus status = eHAL_STATUS_FAILURE;
2792 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2793
2794 status = sme_AcquireGlobalLock( &pMac->sme );
2795 if ( HAL_STATUS_SUCCESS( status ) )
2796 {
2797 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2798 {
2799 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
2800 }
2801 else
2802 {
2803 status = eHAL_STATUS_INVALID_PARAMETER;
2804 }
2805 sme_ReleaseGlobalLock( &pMac->sme );
2806 }
2807
2808 return (status);
2809}
2810
2811/* ---------------------------------------------------------------------------
2812 \fn sme_RoamGetSecurityRspIE
2813 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
2814 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08002815 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 \param pLen - caller allocated memory that has the length of pBuf as input.
2817 Upon returned, *pLen has the needed or IE length in pBuf.
2818 \param pBuf - Caller allocated memory that contain the IE field, if any,
2819 upon return
2820 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2821 \return eHalStatus - when fail, it usually means the buffer allocated is not
2822 big enough
2823 ---------------------------------------------------------------------------*/
2824eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2825 tANI_U8 *pBuf, eCsrSecurityType secType)
2826{
2827 eHalStatus status = eHAL_STATUS_FAILURE;
2828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2829
2830 status = sme_AcquireGlobalLock( &pMac->sme );
2831 if ( HAL_STATUS_SUCCESS( status ) )
2832 {
2833 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2834 {
2835 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
2836 }
2837 else
2838 {
2839 status = eHAL_STATUS_INVALID_PARAMETER;
2840 }
2841 sme_ReleaseGlobalLock( &pMac->sme );
2842 }
2843
2844 return (status);
2845
2846}
2847
2848
2849/* ---------------------------------------------------------------------------
2850 \fn sme_RoamGetNumPMKIDCache
2851 \brief a wrapper function to request CSR to return number of PMKID cache
2852 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08002853 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 \return tANI_U32 - the number of PMKID cache entries
2855 ---------------------------------------------------------------------------*/
2856tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
2857{
2858 eHalStatus status = eHAL_STATUS_FAILURE;
2859 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2860 tANI_U32 numPmkidCache = 0;
2861
2862 status = sme_AcquireGlobalLock( &pMac->sme );
2863 if ( HAL_STATUS_SUCCESS( status ) )
2864 {
2865 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2866 {
2867 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
2868 status = eHAL_STATUS_SUCCESS;
2869 }
2870 else
2871 {
2872 status = eHAL_STATUS_INVALID_PARAMETER;
2873 }
2874 sme_ReleaseGlobalLock( &pMac->sme );
2875 }
2876
2877 return (numPmkidCache);
2878}
2879
2880/* ---------------------------------------------------------------------------
2881 \fn sme_RoamGetPMKIDCache
2882 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08002883 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 \param pNum - caller allocated memory that has the space of the number of
2885 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
2886 needed or actually number in tPmkidCacheInfo.
2887 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
2888 any, upon return
2889 \return eHalStatus - when fail, it usually means the buffer allocated is not
2890 big enough
2891 ---------------------------------------------------------------------------*/
2892eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
2893 tPmkidCacheInfo *pPmkidCache)
2894{
2895 eHalStatus status = eHAL_STATUS_FAILURE;
2896 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2897
2898 status = sme_AcquireGlobalLock( &pMac->sme );
2899 if ( HAL_STATUS_SUCCESS( status ) )
2900 {
2901 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2902 {
2903 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
2904 }
2905 else
2906 {
2907 status = eHAL_STATUS_INVALID_PARAMETER;
2908 }
2909 sme_ReleaseGlobalLock( &pMac->sme );
2910 }
2911
2912 return (status);
2913}
2914
2915
2916/* ---------------------------------------------------------------------------
2917 \fn sme_GetConfigParam
2918 \brief a wrapper function that HDD calls to get the global settings
2919 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002920 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002921 \param pParam - caller allocated memory
2922 \return eHalStatus
2923 ---------------------------------------------------------------------------*/
2924eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
2925{
2926 eHalStatus status = eHAL_STATUS_FAILURE;
2927 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2928
2929 status = sme_AcquireGlobalLock( &pMac->sme );
2930 if ( HAL_STATUS_SUCCESS( status ) )
2931 {
2932 status = csrGetConfigParam(pMac, &pParam->csrConfig);
2933 if (status != eHAL_STATUS_SUCCESS)
2934 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002935 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002936 sme_ReleaseGlobalLock( &pMac->sme );
2937 return status;
2938 }
2939#if defined WLAN_FEATURE_P2P_INTERNAL
2940 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
2941 if (status != eHAL_STATUS_SUCCESS)
2942 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002943 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002944 sme_ReleaseGlobalLock( &pMac->sme );
2945 return status;
2946 }
2947#endif
2948 sme_ReleaseGlobalLock( &pMac->sme );
2949 }
2950
2951 return (status);
2952}
2953
2954/* ---------------------------------------------------------------------------
2955 \fn sme_CfgSetInt
2956 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002957 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002958 \param cfgId - Configuration Parameter ID (type) for STA.
2959 \param ccmValue - The information related to Configuration Parameter ID
2960 which needs to be saved in CFG
2961 \param callback - To be registered by CSR with CCM. Once the CFG done with
2962 saving the information in the database, it notifies CCM &
2963 then the callback will be invoked to notify.
2964 \param toBeSaved - To save the request for future reference
2965 \return eHalStatus
2966 ---------------------------------------------------------------------------*/
2967eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
2968 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
2969{
2970 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
2971}
2972
2973/* ---------------------------------------------------------------------------
2974 \fn sme_CfgSetStr
2975 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002976 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002977 \param cfgId - Configuration Parameter ID (type) for STA.
2978 \param pStr - Pointer to the byte array which carries the information needs
2979 to be saved in CFG
2980 \param length - Length of the data to be saved
2981 \param callback - To be registered by CSR with CCM. Once the CFG done with
2982 saving the information in the database, it notifies CCM &
2983 then the callback will be invoked to notify.
2984 \param toBeSaved - To save the request for future reference
2985 \return eHalStatus
2986 ---------------------------------------------------------------------------*/
2987eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
2988 tANI_U32 length, tCcmCfgSetCallback callback,
2989 eAniBoolean toBeSaved)
2990{
2991 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
2992}
2993
2994/* ---------------------------------------------------------------------------
2995 \fn sme_GetModifyProfileFields
2996 \brief HDD or SME - QOS calls this function to get the current values of
2997 connected profile fields, changing which can cause reassoc.
2998 This function must be called after CFG is downloaded and STA is in connected
2999 state. Also, make sure to call this function to get the current profile
3000 fields before calling the reassoc. So that pModifyProfileFields will have
3001 all the latest values plus the one(s) has been updated as part of reassoc
3002 request.
3003 \param pModifyProfileFields - pointer to the connected profile fields
3004 changing which can cause reassoc
3005
3006 \return eHalStatus
3007 -------------------------------------------------------------------------------*/
3008eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3009 tCsrRoamModifyProfileFields * pModifyProfileFields)
3010{
3011 eHalStatus status = eHAL_STATUS_FAILURE;
3012 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3013
3014 status = sme_AcquireGlobalLock( &pMac->sme );
3015 if ( HAL_STATUS_SUCCESS( status ) )
3016 {
3017 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3018 {
3019 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3020 }
3021 else
3022 {
3023 status = eHAL_STATUS_INVALID_PARAMETER;
3024 }
3025 sme_ReleaseGlobalLock( &pMac->sme );
3026 }
3027
3028 return (status);
3029}
3030
3031/*--------------------------------------------------------------------------
3032 \fn sme_SetConfigPowerSave
3033 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3034 For BMPS related configuration, this function also updates the CFG
3035 and sends a message to FW to pick up the new values. Note: Calling
3036 this function only updates the configuration and does not enable
3037 the specified power save mode.
3038 \param hHal - The handle returned by macOpen.
3039 \param psMode - Power Saving mode being modified
3040 \param pConfigParams - a pointer to a caller allocated object of type
3041 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3042 \return eHalStatus
3043 --------------------------------------------------------------------------*/
3044eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3045 void *pConfigParams)
3046{
3047 eHalStatus status = eHAL_STATUS_FAILURE;
3048 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3049
3050 if (NULL == pConfigParams ) {
3051 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3052 "nothing to update");
3053 return eHAL_STATUS_FAILURE;
3054 }
3055
3056 status = sme_AcquireGlobalLock( &pMac->sme );
3057 if ( HAL_STATUS_SUCCESS( status ) )
3058 {
3059 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3060 sme_ReleaseGlobalLock( &pMac->sme );
3061 }
3062
3063 return (status);
3064}
3065
3066/*--------------------------------------------------------------------------
3067 \fn sme_GetConfigPowerSave
3068 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3069 \param hHal - The handle returned by macOpen.
3070 \param psMode - Power Saving mode
3071 \param pConfigParams - a pointer to a caller allocated object of type
3072 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3073 \return eHalStatus
3074 --------------------------------------------------------------------------*/
3075eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3076 void *pConfigParams)
3077{
3078 eHalStatus status = eHAL_STATUS_FAILURE;
3079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3080
3081 if (NULL == pConfigParams ) {
3082 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3083 "nothing to update");
3084 return eHAL_STATUS_FAILURE;
3085 }
3086
3087 status = sme_AcquireGlobalLock( &pMac->sme );
3088 if ( HAL_STATUS_SUCCESS( status ) )
3089 {
3090 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3091 sme_ReleaseGlobalLock( &pMac->sme );
3092 }
3093
3094 return (status);
3095}
3096
3097/* ---------------------------------------------------------------------------
3098 \fn sme_SignalPowerEvent
3099 \brief Signals to PMC that a power event has occurred. Used for putting
3100 the chip into deep sleep mode.
3101 \param hHal - The handle returned by macOpen.
3102 \param event - the event that has occurred
3103 \return eHalStatus
3104 ---------------------------------------------------------------------------*/
3105eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3106{
3107 eHalStatus status = eHAL_STATUS_FAILURE;
3108 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3109
3110 status = sme_AcquireGlobalLock( &pMac->sme );
3111 if ( HAL_STATUS_SUCCESS( status ) )
3112 {
3113 status = pmcSignalPowerEvent(hHal, event);
3114 sme_ReleaseGlobalLock( &pMac->sme );
3115 }
3116
3117 return (status);
3118}
3119
3120/* ---------------------------------------------------------------------------
3121 \fn sme_EnablePowerSave
3122 \brief Enables one of the power saving modes.
3123 \param hHal - The handle returned by macOpen.
3124 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3125 while the chip is operating in Full Power, PMC will start
3126 a timer that will try to put the chip in BMPS mode after
3127 expiry.
3128 \return eHalStatus
3129 ---------------------------------------------------------------------------*/
3130eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3131{
3132 eHalStatus status = eHAL_STATUS_FAILURE;
3133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3134
3135 status = sme_AcquireGlobalLock( &pMac->sme );
3136 if ( HAL_STATUS_SUCCESS( status ) )
3137 {
3138 status = pmcEnablePowerSave(hHal, psMode);
3139 sme_ReleaseGlobalLock( &pMac->sme );
3140 }
3141
3142 return (status);
3143}
3144
3145/* ---------------------------------------------------------------------------
3146 \fn sme_DisablePowerSave
3147 \brief Disables one of the power saving modes.
3148 \param hHal - The handle returned by macOpen.
3149 \param psMode - The power saving mode to disable. Disabling does not imply
3150 that device will be brought out of the current PS mode. This
3151 is purely a configuration API.
3152 \return eHalStatus
3153 ---------------------------------------------------------------------------*/
3154eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3155{
3156 eHalStatus status = eHAL_STATUS_FAILURE;
3157 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3158
3159 status = sme_AcquireGlobalLock( &pMac->sme );
3160 if ( HAL_STATUS_SUCCESS( status ) )
3161 {
3162 status = pmcDisablePowerSave(hHal, psMode);
3163 sme_ReleaseGlobalLock( &pMac->sme );
3164 }
3165
3166 return (status);
3167 }
3168
3169/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303170+ \fn sme_SetHostPowerSave
3171+ \brief Enables BMPS logic to be controlled by User level apps
3172+ \param hHal - The handle returned by macOpen.
3173+ \param psMode - The power saving mode to disable. Disabling does not imply
3174+ that device will be brought out of the current PS mode. This
3175+ is purely a configuration API.
3176+ \return eHalStatus
3177+ ---------------------------------------------------------------------------*/
3178eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3179{
3180 eHalStatus status = eHAL_STATUS_FAILURE;
3181 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3182
3183 pMac->pmc.isHostPsEn = psMode;
3184
3185 return (status);
3186}
3187
3188/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003189 \fn sme_StartAutoBmpsTimer
3190 \brief Starts a timer that periodically polls all the registered
3191 module for entry into Bmps mode. This timer is started only if BMPS is
3192 enabled and whenever the device is in full power.
3193 \param hHal - The handle returned by macOpen.
3194 \return eHalStatus
3195 ---------------------------------------------------------------------------*/
3196eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3197{
3198 eHalStatus status = eHAL_STATUS_FAILURE;
3199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3200
3201 status = sme_AcquireGlobalLock( &pMac->sme );
3202 if ( HAL_STATUS_SUCCESS( status ) )
3203 {
3204 status = pmcStartAutoBmpsTimer(hHal);
3205 sme_ReleaseGlobalLock( &pMac->sme );
3206 }
3207
3208 return (status);
3209}
3210/* ---------------------------------------------------------------------------
3211 \fn sme_StopAutoBmpsTimer
3212 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3213 Stopping the timer does not cause a device state change. Only the timer
3214 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3215 \param hHal - The handle returned by macOpen.
3216 \return eHalStatus
3217 ---------------------------------------------------------------------------*/
3218eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3219{
3220 eHalStatus status = eHAL_STATUS_FAILURE;
3221 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3222
3223 status = sme_AcquireGlobalLock( &pMac->sme );
3224 if ( HAL_STATUS_SUCCESS( status ) )
3225 {
3226 status = pmcStopAutoBmpsTimer(hHal);
3227 sme_ReleaseGlobalLock( &pMac->sme );
3228 }
3229
3230 return (status);
3231}
3232/* ---------------------------------------------------------------------------
3233 \fn sme_QueryPowerState
3234 \brief Returns the current power state of the device.
3235 \param hHal - The handle returned by macOpen.
3236 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3237 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3238 \return eHalStatus
3239 ---------------------------------------------------------------------------*/
3240eHalStatus sme_QueryPowerState (
3241 tHalHandle hHal,
3242 tPmcPowerState *pPowerState,
3243 tPmcSwitchState *pSwWlanSwitchState)
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 = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3252 sme_ReleaseGlobalLock( &pMac->sme );
3253 }
3254
3255 return (status);
3256}
3257
3258/* ---------------------------------------------------------------------------
3259 \fn sme_IsPowerSaveEnabled
3260 \brief Checks if the device is able to enter a particular power save mode
3261 This does not imply that the device is in a particular PS mode
3262 \param hHal - The handle returned by macOpen.
3263 \param psMode - the power saving mode
3264 \return eHalStatus
3265 ---------------------------------------------------------------------------*/
3266tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3267{
3268 eHalStatus status = eHAL_STATUS_FAILURE;
3269 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3270 tANI_BOOLEAN result = false;
3271
3272 status = sme_AcquireGlobalLock( &pMac->sme );
3273 if ( HAL_STATUS_SUCCESS( status ) )
3274 {
3275 result = pmcIsPowerSaveEnabled(hHal, psMode);
3276 sme_ReleaseGlobalLock( &pMac->sme );
3277 return result;
3278 }
3279
3280 return false;
3281}
3282
3283/* ---------------------------------------------------------------------------
3284 \fn sme_RequestFullPower
3285 \brief Request that the device be brought to full power state. When the
3286 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3287 is enabled. On timer expiry PMC will attempt to put the device in
3288 BMPS mode if following holds true:
3289 - BMPS mode is enabled
3290 - Polling of all modules through the Power Save Check routine passes
3291 - STA is associated to an access point
3292 \param hHal - The handle returned by macOpen.
3293 \param - callbackRoutine Callback routine invoked in case of success/failure
3294 \return eHalStatus - status
3295 eHAL_STATUS_SUCCESS - device brought to full power state
3296 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3297 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3298 ---------------------------------------------------------------------------*/
3299eHalStatus sme_RequestFullPower (
3300 tHalHandle hHal,
3301 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3302 void *callbackContext,
3303 tRequestFullPowerReason fullPowerReason)
3304{
3305 eHalStatus status = eHAL_STATUS_FAILURE;
3306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3307
3308 status = sme_AcquireGlobalLock( &pMac->sme );
3309 if ( HAL_STATUS_SUCCESS( status ) )
3310 {
3311 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3312 sme_ReleaseGlobalLock( &pMac->sme );
3313 }
3314
3315 return (status);
3316}
3317
3318/* ---------------------------------------------------------------------------
3319 \fn sme_RequestBmps
3320 \brief Request that the device be put in BMPS state. Request will be
3321 accepted only if BMPS mode is enabled and power save check routine
3322 passes.
3323 \param hHal - The handle returned by macOpen.
3324 \param - callbackRoutine Callback routine invoked in case of success/failure
3325 \return eHalStatus
3326 eHAL_STATUS_SUCCESS - device is in BMPS state
3327 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3328 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3329 ---------------------------------------------------------------------------*/
3330eHalStatus sme_RequestBmps (
3331 tHalHandle hHal,
3332 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3333 void *callbackContext)
3334{
3335 eHalStatus status = eHAL_STATUS_FAILURE;
3336 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3337
3338 status = sme_AcquireGlobalLock( &pMac->sme );
3339 if ( HAL_STATUS_SUCCESS( status ) )
3340 {
3341 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3342 sme_ReleaseGlobalLock( &pMac->sme );
3343 }
3344
3345 return (status);
3346}
3347
3348
3349/* ---------------------------------------------------------------------------
3350 \fn sme_SetDHCPTillPowerActiveFlag
3351 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3352 entry by PMC
3353 \param hHal - The handle returned by macOpen.
3354 ---------------------------------------------------------------------------*/
3355void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3356{
3357 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3358
3359 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3360 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3361}
3362
3363
3364/* ---------------------------------------------------------------------------
3365 \fn sme_StartUapsd
3366 \brief Request that the device be put in UAPSD state. If the device is in
3367 Full Power it will be put in BMPS mode first and then into UAPSD
3368 mode.
3369 \param hHal - The handle returned by macOpen.
3370 \param - callbackRoutine Callback routine invoked in case of success/failure
3371 eHAL_STATUS_SUCCESS - device is in UAPSD state
3372 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3373 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3374 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3375 \return eHalStatus
3376 ---------------------------------------------------------------------------*/
3377eHalStatus sme_StartUapsd (
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 = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3389 sme_ReleaseGlobalLock( &pMac->sme );
3390 }
3391
3392 return (status);
3393 }
3394
3395/* ---------------------------------------------------------------------------
3396 \fn sme_StopUapsd
3397 \brief Request that the device be put out of UAPSD state. Device will be
3398 put in in BMPS state after stop UAPSD completes.
3399 \param hHal - The handle returned by macOpen.
3400 \return eHalStatus
3401 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3402 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3403 ---------------------------------------------------------------------------*/
3404eHalStatus sme_StopUapsd (tHalHandle hHal)
3405{
3406 eHalStatus status = eHAL_STATUS_FAILURE;
3407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3408
3409 status = sme_AcquireGlobalLock( &pMac->sme );
3410 if ( HAL_STATUS_SUCCESS( status ) )
3411 {
3412 status = pmcStopUapsd(hHal);
3413 sme_ReleaseGlobalLock( &pMac->sme );
3414 }
3415
3416 return (status);
3417}
3418
3419/* ---------------------------------------------------------------------------
3420 \fn sme_RequestStandby
3421 \brief Request that the device be put in standby. It is HDD's responsibility
3422 to bring the chip to full power and do a disassoc before calling
3423 this API.
3424 \param hHal - The handle returned by macOpen.
3425 \param - callbackRoutine Callback routine invoked in case of success/failure
3426 \return eHalStatus
3427 eHAL_STATUS_SUCCESS - device is in Standby mode
3428 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3429 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3430 ---------------------------------------------------------------------------*/
3431eHalStatus sme_RequestStandby (
3432 tHalHandle hHal,
3433 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3434 void *callbackContext)
3435{
3436 eHalStatus status = eHAL_STATUS_FAILURE;
3437 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3438
3439 smsLog( pMac, LOG1, FL("") );
3440 status = sme_AcquireGlobalLock( &pMac->sme );
3441 if ( HAL_STATUS_SUCCESS( status ) )
3442 {
3443 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3444 sme_ReleaseGlobalLock( &pMac->sme );
3445 }
3446
3447 return (status);
3448}
3449
3450/* ---------------------------------------------------------------------------
3451 \fn sme_RegisterPowerSaveCheck
3452 \brief Register a power save check routine that is called whenever
3453 the device is about to enter one of the power save modes.
3454 \param hHal - The handle returned by macOpen.
3455 \param checkRoutine - Power save check routine to be registered
3456 \return eHalStatus
3457 eHAL_STATUS_SUCCESS - successfully registered
3458 eHAL_STATUS_FAILURE - not successfully registered
3459 ---------------------------------------------------------------------------*/
3460eHalStatus sme_RegisterPowerSaveCheck (
3461 tHalHandle hHal,
3462 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3463{
3464 eHalStatus status = eHAL_STATUS_FAILURE;
3465 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3466
3467 status = sme_AcquireGlobalLock( &pMac->sme );
3468 if ( HAL_STATUS_SUCCESS( status ) )
3469 {
3470 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3471 sme_ReleaseGlobalLock( &pMac->sme );
3472 }
3473
3474 return (status);
3475}
3476
3477/* ---------------------------------------------------------------------------
3478 \fn sme_DeregisterPowerSaveCheck
3479 \brief Deregister a power save check routine
3480 \param hHal - The handle returned by macOpen.
3481 \param checkRoutine - Power save check routine to be deregistered
3482 \return eHalStatus
3483 eHAL_STATUS_SUCCESS - successfully deregistered
3484 eHAL_STATUS_FAILURE - not successfully deregistered
3485 ---------------------------------------------------------------------------*/
3486eHalStatus sme_DeregisterPowerSaveCheck (
3487 tHalHandle hHal,
3488 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3489{
3490 eHalStatus status = eHAL_STATUS_FAILURE;
3491 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3492
3493 status = sme_AcquireGlobalLock( &pMac->sme );
3494 if ( HAL_STATUS_SUCCESS( status ) )
3495 {
3496 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3497 sme_ReleaseGlobalLock( &pMac->sme );
3498 }
3499
3500 return (status);
3501}
3502
3503/* ---------------------------------------------------------------------------
3504 \fn sme_RegisterDeviceStateUpdateInd
3505 \brief Register a callback routine that is called whenever
3506 the device enters a new device state (Full Power, BMPS, UAPSD)
3507 \param hHal - The handle returned by macOpen.
3508 \param callbackRoutine - Callback routine to be registered
3509 \param callbackContext - Cookie to be passed back during callback
3510 \return eHalStatus
3511 eHAL_STATUS_SUCCESS - successfully registered
3512 eHAL_STATUS_FAILURE - not successfully registered
3513 ---------------------------------------------------------------------------*/
3514eHalStatus sme_RegisterDeviceStateUpdateInd (
3515 tHalHandle hHal,
3516 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3517 void *callbackContext)
3518{
3519 eHalStatus status = eHAL_STATUS_FAILURE;
3520 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3521
3522 status = sme_AcquireGlobalLock( &pMac->sme );
3523 if ( HAL_STATUS_SUCCESS( status ) )
3524 {
3525 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3526 sme_ReleaseGlobalLock( &pMac->sme );
3527 }
3528
3529 return (status);
3530}
3531
3532/* ---------------------------------------------------------------------------
3533 \fn sme_DeregisterDeviceStateUpdateInd
3534 \brief Deregister a routine that was registered for device state changes
3535 \param hHal - The handle returned by macOpen.
3536 \param callbackRoutine - Callback routine to be deregistered
3537 \return eHalStatus
3538 eHAL_STATUS_SUCCESS - successfully deregistered
3539 eHAL_STATUS_FAILURE - not successfully deregistered
3540 ---------------------------------------------------------------------------*/
3541eHalStatus sme_DeregisterDeviceStateUpdateInd (
3542 tHalHandle hHal,
3543 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3544{
3545 eHalStatus status = eHAL_STATUS_FAILURE;
3546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3547
3548 status = sme_AcquireGlobalLock( &pMac->sme );
3549 if ( HAL_STATUS_SUCCESS( status ) )
3550 {
3551 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3552 sme_ReleaseGlobalLock( &pMac->sme );
3553 }
3554
3555 return (status);
3556}
3557
3558/* ---------------------------------------------------------------------------
3559 \fn sme_WowlAddBcastPattern
3560 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3561 do a pattern match on these patterns when Wowl is enabled during BMPS
3562 mode. Note that Firmware performs the pattern matching only on
3563 broadcast frames and while Libra is in BMPS mode.
3564 \param hHal - The handle returned by macOpen.
3565 \param pattern - Pattern to be added
3566 \return eHalStatus
3567 eHAL_STATUS_FAILURE Cannot add pattern
3568 eHAL_STATUS_SUCCESS Request accepted.
3569 ---------------------------------------------------------------------------*/
3570eHalStatus sme_WowlAddBcastPattern (
3571 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003572 tpSirWowlAddBcastPtrn pattern,
3573 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003574{
3575 eHalStatus status = eHAL_STATUS_FAILURE;
3576 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3577 status = sme_AcquireGlobalLock( &pMac->sme );
3578 if ( HAL_STATUS_SUCCESS( status ) )
3579 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003580 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003581 sme_ReleaseGlobalLock( &pMac->sme );
3582 }
3583
3584 return (status);
3585}
3586
3587/* ---------------------------------------------------------------------------
3588 \fn sme_WowlDelBcastPattern
3589 \brief Delete a pattern that was added for Pattern Byte Matching.
3590 \param hHal - The handle returned by macOpen.
3591 \param pattern - Pattern to be deleted
3592 \return eHalStatus
3593 eHAL_STATUS_FAILURE Cannot delete pattern
3594 eHAL_STATUS_SUCCESS Request accepted.
3595 ---------------------------------------------------------------------------*/
3596eHalStatus sme_WowlDelBcastPattern (
3597 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003598 tpSirWowlDelBcastPtrn pattern,
3599 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003600{
3601 eHalStatus status = eHAL_STATUS_FAILURE;
3602 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3603 status = sme_AcquireGlobalLock( &pMac->sme );
3604 if ( HAL_STATUS_SUCCESS( status ) )
3605 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003606 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003607 sme_ReleaseGlobalLock( &pMac->sme );
3608 }
3609
3610 return (status);
3611}
3612
3613/* ---------------------------------------------------------------------------
3614 \fn sme_EnterWowl
3615 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
3616 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
3617 SME will will cache the information that WOWL has been enabled and
3618 attempt to put the device in BMPS. On entry into BMPS, SME will
3619 enable the WOWL mode.
3620 Note 1: If we exit BMPS mode (someone requests full power), we
3621 will NOT resume WOWL when we go back to BMPS again. Request for full
3622 power (while in WOWL mode) means disable WOWL and go to full power.
3623 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
3624 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
3625 are required. Currently there is no requirement or use case to support
3626 UAPSD and WOWL at the same time.
3627
3628 \param hHal - The handle returned by macOpen.
3629 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
3630 Used for success/failure notification by SME
3631 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
3632 at the time of callback.
3633 \param wakeReasonIndCB - Callback routine provided by HDD.
3634 Used for Wake Reason Indication by SME
3635 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
3636 at the time of callback.
3637 \return eHalStatus
3638 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
3639 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
3640 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
3641 BMPS mode is entered.
3642 ---------------------------------------------------------------------------*/
3643eHalStatus sme_EnterWowl (
3644 tHalHandle hHal,
3645 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
3646 void *enterWowlCallbackContext,
3647#ifdef WLAN_WAKEUP_EVENTS
3648 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
3649 void *wakeIndicationCBContext,
3650#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003651 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003652{
3653 eHalStatus status = eHAL_STATUS_FAILURE;
3654 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3655 status = sme_AcquireGlobalLock( &pMac->sme );
3656 if ( HAL_STATUS_SUCCESS( status ) )
3657 {
3658 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
3659#ifdef WLAN_WAKEUP_EVENTS
3660 wakeIndicationCB, wakeIndicationCBContext,
3661#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003662 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003663 sme_ReleaseGlobalLock( &pMac->sme );
3664 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 return (status);
3666}
3667/* ---------------------------------------------------------------------------
3668 \fn sme_ExitWowl
3669 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
3670 SME will initiate exit from WoWLAN mode and device will be put in BMPS
3671 mode.
3672 \param hHal - The handle returned by macOpen.
3673 \return eHalStatus
3674 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
3675 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
3676 ---------------------------------------------------------------------------*/
3677eHalStatus sme_ExitWowl (tHalHandle hHal)
3678{
3679 eHalStatus status = eHAL_STATUS_FAILURE;
3680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3681 status = sme_AcquireGlobalLock( &pMac->sme );
3682 if ( HAL_STATUS_SUCCESS( status ) )
3683 {
3684 status = pmcExitWowl (hHal);
3685 sme_ReleaseGlobalLock( &pMac->sme );
3686 }
3687
3688 return (status);
3689}
3690
3691/* ---------------------------------------------------------------------------
3692
3693 \fn sme_RoamSetKey
3694
3695 \brief To set encryption key. This function should be called only when connected
3696 This is an asynchronous API.
3697
3698 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
3699
3700 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3701
3702 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3703
3704 FAILURE or RESOURCES The API finished and failed.
3705
3706 -------------------------------------------------------------------------------*/
3707eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
3708{
3709 eHalStatus status = eHAL_STATUS_FAILURE;
3710 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3711 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 tANI_U32 i;
3713 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003714
3715 status = sme_AcquireGlobalLock( &pMac->sme );
3716 if ( HAL_STATUS_SUCCESS( status ) )
3717 {
3718 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3719 if(pRoamId)
3720 {
3721 *pRoamId = roamId;
3722 }
3723
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003724 smsLog(pMac, LOG2, FL("keyLength"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07003725
3726 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003727 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003728
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003729 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003730
3731 pSession = CSR_GET_SESSION(pMac, sessionId);
3732
Jeff Johnson32d95a32012-09-10 13:15:23 -07003733 if(!pSession)
3734 {
3735 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08003736 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003737 return eHAL_STATUS_FAILURE;
3738 }
3739
Jeff Johnson295189b2012-06-20 16:38:30 -07003740 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
3741 {
3742 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
3743 {
3744 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
3745 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
3746 {
3747 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3748 }
3749 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
3750 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
3751 {
3752 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3753 }
3754 }
3755 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003756
3757 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
3758 sme_ReleaseGlobalLock( &pMac->sme );
3759 }
3760
3761 return (status);
3762}
3763
3764
3765/* ---------------------------------------------------------------------------
3766
3767 \fn sme_RoamRemoveKey
3768
3769 \brief To set encryption key. This is an asynchronous API.
3770
3771 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
3772
3773 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3774
3775 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3776
3777 FAILURE or RESOURCES The API finished and failed.
3778
3779 -------------------------------------------------------------------------------*/
3780eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
3781 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
3782{
3783 eHalStatus status = eHAL_STATUS_FAILURE;
3784 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3785 tANI_U32 roamId;
3786
3787 status = sme_AcquireGlobalLock( &pMac->sme );
3788 if ( HAL_STATUS_SUCCESS( status ) )
3789 {
3790 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3791 if(pRoamId)
3792 {
3793 *pRoamId = roamId;
3794 }
3795 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
3796 sme_ReleaseGlobalLock( &pMac->sme );
3797 }
3798
3799 return (status);
3800}
3801
3802/* ---------------------------------------------------------------------------
3803 \fn sme_GetRssi
3804 \brief a wrapper function that client calls to register a callback to get RSSI
3805
3806 \param callback - SME sends back the requested stats using the callback
3807 \param staId - The station ID for which the stats is requested for
3808 \param pContext - user context to be passed back along with the callback
3809 \param pVosContext - vos context
3810 \return eHalStatus
3811 ---------------------------------------------------------------------------*/
3812eHalStatus sme_GetRssi(tHalHandle hHal,
3813 tCsrRssiCallback callback,
3814 tANI_U8 staId, tCsrBssid bssId,
3815 void *pContext, void* pVosContext)
3816{
3817 eHalStatus status = eHAL_STATUS_FAILURE;
3818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3819
3820 status = sme_AcquireGlobalLock( &pMac->sme );
3821 if ( HAL_STATUS_SUCCESS( status ) )
3822 {
3823 status = csrGetRssi( pMac, callback,
3824 staId, bssId, pContext, pVosContext);
3825 sme_ReleaseGlobalLock( &pMac->sme );
3826 }
3827 return (status);
3828}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003829#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3830/* ---------------------------------------------------------------------------
3831 \fn sme_GetRoamRssi
3832 \brief a wrapper function that client calls to register a callback to get Roam RSSI
3833
3834 \param callback - SME sends back the requested stats using the callback
3835 \param staId - The station ID for which the stats is requested for
3836 \param pContext - user context to be passed back along with the callback
3837 \param pVosContext - vos context
3838 \return eHalStatus
3839 ---------------------------------------------------------------------------*/
3840eHalStatus sme_GetRoamRssi(tHalHandle hHal,
3841 tCsrRssiCallback callback,
3842 tANI_U8 staId, tCsrBssid bssId,
3843 void *pContext, void* pVosContext)
3844{
3845 eHalStatus status = eHAL_STATUS_FAILURE;
3846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3847
3848 status = sme_AcquireGlobalLock( &pMac->sme );
3849 if ( HAL_STATUS_SUCCESS( status ) )
3850 {
3851 status = csrGetRoamRssi( pMac, callback,
3852 staId, bssId, pContext, pVosContext);
3853 sme_ReleaseGlobalLock( &pMac->sme );
3854 }
3855 return (status);
3856}
3857#endif
3858
Jeff Johnson295189b2012-06-20 16:38:30 -07003859
3860/* ---------------------------------------------------------------------------
3861 \fn sme_GetStatistics
3862 \brief a wrapper function that client calls to register a callback to get
3863 different PHY level statistics from CSR.
3864
3865 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
3866 \param statsMask - The different category/categories of stats requester is looking for
3867 \param callback - SME sends back the requested stats using the callback
3868 \param periodicity - If requester needs periodic update in millisec, 0 means
3869 it's an one time request
3870 \param cache - If requester is happy with cached stats
3871 \param staId - The station ID for which the stats is requested for
3872 \param pContext - user context to be passed back along with the callback
3873 \return eHalStatus
3874 ---------------------------------------------------------------------------*/
3875eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
3876 tANI_U32 statsMask,
3877 tCsrStatsCallback callback,
3878 tANI_U32 periodicity, tANI_BOOLEAN cache,
3879 tANI_U8 staId, void *pContext)
3880{
3881 eHalStatus status = eHAL_STATUS_FAILURE;
3882 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3883
3884 status = sme_AcquireGlobalLock( &pMac->sme );
3885 if ( HAL_STATUS_SUCCESS( status ) )
3886 {
3887 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
3888 periodicity, cache, staId, pContext);
3889 sme_ReleaseGlobalLock( &pMac->sme );
3890 }
3891
3892 return (status);
3893
3894}
3895
3896/* ---------------------------------------------------------------------------
3897
3898 \fn sme_GetCountryCode
3899
3900 \brief To return the current country code. If no country code is applied, default country code is
3901 used to fill the buffer.
3902 If 11d supported is turned off, an error is return and the last applied/default country code is used.
3903 This is a synchronous API.
3904
3905 \param pBuf - pointer to a caller allocated buffer for returned country code.
3906
3907 \param pbLen For input, this parameter indicates how big is the buffer.
3908 Upon return, this parameter has the number of bytes for country. If pBuf
3909 doesn't have enough space, this function returns
3910 fail status and this parameter contains the number that is needed.
3911
3912 \return eHalStatus SUCCESS.
3913
3914 FAILURE or RESOURCES The API finished and failed.
3915
3916 -------------------------------------------------------------------------------*/
3917eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
3918{
3919 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3920
3921 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
3922}
3923
3924
3925/* ---------------------------------------------------------------------------
3926
3927 \fn sme_SetCountryCode
3928
3929 \brief To change the current/default country code.
3930 If 11d supported is turned off, an error is return.
3931 This is a synchronous API.
3932
3933 \param pCountry - pointer to a caller allocated buffer for the country code.
3934
3935 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
3936 whether a reset is required.
3937
3938 \return eHalStatus SUCCESS.
3939
3940 FAILURE or RESOURCES The API finished and failed.
3941
3942 -------------------------------------------------------------------------------*/
3943eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
3944{
3945 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3946
3947 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
3948}
3949
3950
3951/* ---------------------------------------------------------------------------
3952 \fn sme_ResetCountryCodeInformation
3953 \brief this function is to reset the country code current being used back to EEPROM default
3954 this includes channel list and power setting. This is a synchronous API.
3955 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
3956 a restart is needed to apply the change
3957 \return eHalStatus
3958 -------------------------------------------------------------------------------*/
3959eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
3960{
3961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3962
3963 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
3964}
3965
3966
3967/* ---------------------------------------------------------------------------
3968 \fn sme_GetSupportedCountryCode
3969 \brief this function is to get a list of the country code current being supported
3970 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
3971 this has the country code list. 3 bytes for each country code. This may be NULL if
3972 caller wants to know the needed byte count.
3973 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
3974 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
3975 \return eHalStatus
3976 -------------------------------------------------------------------------------*/
3977eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
3978{
3979 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3980
3981 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
3982}
3983
3984
3985/* ---------------------------------------------------------------------------
3986 \fn sme_GetCurrentRegulatoryDomain
3987 \brief this function is to get the current regulatory domain. This is a synchronous API.
3988 This function must be called after CFG is downloaded and all the band/mode setting already passed into
3989 SME. The function fails if 11d support is turned off.
3990 \param pDomain - Caller allocated buffer to return the current domain.
3991 \return eHalStatus SUCCESS.
3992
3993 FAILURE or RESOURCES The API finished and failed.
3994 -------------------------------------------------------------------------------*/
3995eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
3996{
3997 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3998 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
3999
4000 if( pDomain )
4001 {
4002 if( csrIs11dSupported( pMac ) )
4003 {
4004 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4005 status = eHAL_STATUS_SUCCESS;
4006 }
4007 else
4008 {
4009 status = eHAL_STATUS_FAILURE;
4010 }
4011 }
4012
4013 return ( status );
4014}
4015
4016
4017/* ---------------------------------------------------------------------------
4018 \fn sme_SetRegulatoryDomain
4019 \brief this function is to set the current regulatory domain.
4020 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4021 SME. This is a synchronous API.
4022 \param domainId - indicate the domain (defined in the driver) needs to set to.
4023 See v_REGDOMAIN_t for definition
4024 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4025 a restart is needed to apply the change
4026 \return eHalStatus
4027 -------------------------------------------------------------------------------*/
4028eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4029{
4030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4031
4032 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4033}
4034
4035
4036/* ---------------------------------------------------------------------------
4037
4038 \fn sme_GetRegulatoryDomainForCountry
4039
4040 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4041
4042 \param pCountry - pointer to a caller allocated buffer for input country code.
4043
4044 \param pDomainId Upon successful return, it is the domain that country belongs to.
4045 If it is NULL, returning success means that the country code is known.
4046
4047 \return eHalStatus SUCCESS.
4048
4049 FAILURE or RESOURCES The API finished and failed.
4050
4051 -------------------------------------------------------------------------------*/
4052eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4053{
4054 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4055
4056 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4057}
4058
4059
4060
4061
4062/* ---------------------------------------------------------------------------
4063
4064 \fn sme_GetSupportedRegulatoryDomains
4065
4066 \brief To return a list of supported regulatory domains. This is a synchronous API.
4067
4068 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4069
4070 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4071 Upon return, this parameter has the number for supported domains. If pDomains
4072 doesn't have enough space for all the supported domains, this function returns
4073 fail status and this parameter contains the number that is needed.
4074
4075 \return eHalStatus SUCCESS.
4076
4077 FAILURE or RESOURCES The API finished and failed.
4078
4079 -------------------------------------------------------------------------------*/
4080eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4081{
4082 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4083
4084 //We support all domains for now
4085 if( pNumDomains )
4086 {
4087 if( NUM_REG_DOMAINS <= *pNumDomains )
4088 {
4089 status = eHAL_STATUS_SUCCESS;
4090 }
4091 *pNumDomains = NUM_REG_DOMAINS;
4092 }
4093 if( HAL_STATUS_SUCCESS( status ) )
4094 {
4095 if( pDomains )
4096 {
4097 pDomains[0] = REGDOMAIN_FCC;
4098 pDomains[1] = REGDOMAIN_ETSI;
4099 pDomains[2] = REGDOMAIN_JAPAN;
4100 pDomains[3] = REGDOMAIN_WORLD;
4101 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4102 pDomains[5] = REGDOMAIN_APAC;
4103 pDomains[6] = REGDOMAIN_KOREA;
4104 pDomains[7] = REGDOMAIN_HI_5GHZ;
4105 pDomains[8] = REGDOMAIN_NO_5GHZ;
4106 }
4107 else
4108 {
4109 status = eHAL_STATUS_INVALID_PARAMETER;
4110 }
4111 }
4112
4113 return ( status );
4114}
4115
4116
4117//some support functions
4118tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4119{
4120 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4121
4122 return ( csrIs11dSupported( pMac ) );
4123}
4124
4125
4126tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4127{
4128 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4129
4130 return ( csrIs11hSupported( pMac ) );
4131}
4132
4133
4134tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4135{
4136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4137
4138 return ( csrIsWmmSupported( pMac ) );
4139}
4140
4141//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4142eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4143{
4144 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4145
4146 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4147}
4148
4149/* ---------------------------------------------------------------------------
4150
4151 \fn sme_ChangeCountryCode
4152
4153 \brief Change Country code from upperlayer during WLAN driver operation.
4154 This is a synchronous API.
4155
4156 \param hHal - The handle returned by macOpen.
4157
4158 \param pCountry New Country Code String
4159
4160 \return eHalStatus SUCCESS.
4161
4162 FAILURE or RESOURCES The API finished and failed.
4163
4164 -------------------------------------------------------------------------------*/
4165eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4166 tSmeChangeCountryCallback callback,
4167 tANI_U8 *pCountry,
4168 void *pContext,
4169 void* pVosContext )
4170{
4171 eHalStatus status = eHAL_STATUS_FAILURE;
4172 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4173 vos_msg_t msg;
4174 tAniChangeCountryCodeReq *pMsg;
4175
4176 status = sme_AcquireGlobalLock( &pMac->sme );
4177 if ( HAL_STATUS_SUCCESS( status ) )
4178 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004179 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4181 if ( !HAL_STATUS_SUCCESS(status) )
4182 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004183 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004184 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004185 return status;
4186 }
4187
4188 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4189 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4190 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
4191 pMsg->changeCCCallback = callback;
4192 pMsg->pDevContext = pContext;
4193 pMsg->pVosContext = pVosContext;
4194
4195 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4196 msg.bodyptr = pMsg;
4197 msg.reserved = 0;
4198
4199 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4200 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004201 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004202 palFreeMemory(pMac->hHdd, (void *)pMsg);
4203 status = eHAL_STATUS_FAILURE;
4204 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004205 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004206 sme_ReleaseGlobalLock( &pMac->sme );
4207 }
4208
4209 return (status);
4210}
4211
4212/* ---------------------------------------------------------------------------
4213 \fn sme_BtcSignalBtEvent
4214 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4215 BT event type and the current operating mode of Libra (full power,
4216 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4217 would be employed.
4218 \param hHal - The handle returned by macOpen.
4219 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4220 Caller owns the memory and is responsible for freeing it.
4221 \return VOS_STATUS
4222 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4223 if BTC execution mode is set to BTC_WLAN_ONLY
4224 or BTC_PTA_ONLY.
4225 VOS_STATUS_SUCCESS BT Event passed to HAL
4226 ---------------------------------------------------------------------------*/
4227VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4228{
4229 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4230#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4232
4233 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4234 {
4235 status = btcSignalBTEvent (hHal, pBtEvent);
4236 sme_ReleaseGlobalLock( &pMac->sme );
4237 }
4238#endif
4239 return (status);
4240}
4241
4242/* ---------------------------------------------------------------------------
4243 \fn sme_BtcSetConfig
4244 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4245 This function should be invoked only after CFG download has completed.
4246 Calling it after sme_HDDReadyInd is recommended.
4247 \param hHal - The handle returned by macOpen.
4248 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4249 Caller owns the memory and is responsible for freeing it.
4250 \return VOS_STATUS
4251 VOS_STATUS_E_FAILURE Config not passed to HAL.
4252 VOS_STATUS_SUCCESS Config passed to HAL
4253 ---------------------------------------------------------------------------*/
4254VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4255{
4256 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4257#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4259 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4260 {
4261 status = btcSetConfig (hHal, pSmeBtcConfig);
4262 sme_ReleaseGlobalLock( &pMac->sme );
4263 }
4264#endif
4265 return (status);
4266}
4267
4268/* ---------------------------------------------------------------------------
4269 \fn sme_BtcGetConfig
4270 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4271 \param hHal - The handle returned by macOpen.
4272 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4273 tSmeBtcConfig. Caller owns the memory and is responsible
4274 for freeing it.
4275 \return VOS_STATUS
4276 VOS_STATUS_E_FAILURE - failure
4277 VOS_STATUS_SUCCESS success
4278 ---------------------------------------------------------------------------*/
4279VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4280{
4281 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4282#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4284
4285 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4286 {
4287 status = btcGetConfig (hHal, pSmeBtcConfig);
4288 sme_ReleaseGlobalLock( &pMac->sme );
4289 }
4290#endif
4291 return (status);
4292}
4293/* ---------------------------------------------------------------------------
4294 \fn sme_SetCfgPrivacy
4295 \brief API to set configure privacy parameters
4296 \param hHal - The handle returned by macOpen.
4297 \param pProfile - Pointer CSR Roam profile.
4298 \param fPrivacy - This parameter indicates status of privacy
4299
4300 \return void
4301 ---------------------------------------------------------------------------*/
4302void sme_SetCfgPrivacy( tHalHandle hHal,
4303 tCsrRoamProfile *pProfile,
4304 tANI_BOOLEAN fPrivacy
4305 )
4306{
4307 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4308 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4309 {
4310 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4311 sme_ReleaseGlobalLock( &pMac->sme );
4312 }
4313}
4314
4315#if defined WLAN_FEATURE_VOWIFI
4316/* ---------------------------------------------------------------------------
4317 \fn sme_NeighborReportRequest
4318 \brief API to request neighbor report.
4319 \param hHal - The handle returned by macOpen.
4320 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4321 tRrmNeighborReq. Caller owns the memory and is responsible
4322 for freeing it.
4323 \return VOS_STATUS
4324 VOS_STATUS_E_FAILURE - failure
4325 VOS_STATUS_SUCCESS success
4326 ---------------------------------------------------------------------------*/
4327VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4328 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4329{
4330 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4331 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4332
4333 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4334 {
4335 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4336 sme_ReleaseGlobalLock( &pMac->sme );
4337 }
4338
4339 return (status);
4340}
4341#endif
4342
4343//The following are debug APIs to support direct read/write register/memory
4344//They are placed in SME because HW cannot be access when in LOW_POWER state
4345//AND not connected. The knowledge and synchronization is done in SME
4346
4347//sme_DbgReadRegister
4348//Caller needs to validate the input values
4349VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4350{
4351 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4352 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004353 tPmcPowerState PowerState;
4354 tANI_U32 sessionId = 0;
4355
4356 /* 1) To make Quarky work in FTM mode **************************************/
4357
4358 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4359 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004360 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004361 {
4362 return VOS_STATUS_SUCCESS;
4363 }
4364 return VOS_STATUS_E_FAILURE;
4365 }
4366
4367 /* 2) NON FTM mode driver *************************************************/
4368
4369 /* Acquire SME global lock */
4370 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4371 {
4372 return VOS_STATUS_E_FAILURE;
4373 }
4374
4375 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4376 {
4377 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4378 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4379 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004380 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 {
4382 status = VOS_STATUS_SUCCESS;
4383 }
4384 else
4385 {
4386 status = VOS_STATUS_E_FAILURE;
4387 }
4388 }
4389 else
4390 {
4391 status = VOS_STATUS_E_FAILURE;
4392 }
4393 }
4394
4395 /* This is a hack for Qualky/pttWniSocket
4396 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4397 if ( VOS_STATUS_SUCCESS != status )
4398 {
4399 *pRegValue = 0xDEADBEEF;
4400 status = VOS_STATUS_SUCCESS;
4401 }
4402
4403 /* Release SME global lock */
4404 sme_ReleaseGlobalLock(&pMac->sme);
4405
4406 return (status);
4407}
4408
4409
4410//sme_DbgWriteRegister
4411//Caller needs to validate the input values
4412VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4413{
4414 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4415 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004416 tPmcPowerState PowerState;
4417 tANI_U32 sessionId = 0;
4418
4419 /* 1) To make Quarky work in FTM mode **************************************/
4420
4421 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4422 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004423 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004424 {
4425 return VOS_STATUS_SUCCESS;
4426 }
4427 return VOS_STATUS_E_FAILURE;
4428 }
4429
4430 /* 2) NON FTM mode driver *************************************************/
4431
4432 /* Acquire SME global lock */
4433 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4434 {
4435 return VOS_STATUS_E_FAILURE;
4436 }
4437
4438 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4439 {
4440 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4441 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4442 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004443 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004444 {
4445 status = VOS_STATUS_SUCCESS;
4446 }
4447 else
4448 {
4449 status = VOS_STATUS_E_FAILURE;
4450 }
4451 }
4452 else
4453 {
4454 status = VOS_STATUS_E_FAILURE;
4455 }
4456 }
4457
4458 /* Release SME global lock */
4459 sme_ReleaseGlobalLock(&pMac->sme);
4460
4461 return (status);
4462}
4463
4464
4465
4466//sme_DbgReadMemory
4467//Caller needs to validate the input values
4468//pBuf caller allocated buffer has the length of nLen
4469VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4470{
4471 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004473 tPmcPowerState PowerState;
4474 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004475 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4476 tANI_U32 arg1 = memAddr;
4477 tANI_U32 arg2 = nLen/4;
4478 tANI_U32 arg3 = 4;
4479 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004480 /* 1) To make Quarky work in FTM mode **************************************/
4481
4482 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4483 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004484 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004485 {
4486 return VOS_STATUS_SUCCESS;
4487 }
4488 return VOS_STATUS_E_FAILURE;
4489 }
4490
4491 /* 2) NON FTM mode driver *************************************************/
4492
4493 /* Acquire SME global lock */
4494 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4495 {
4496 return VOS_STATUS_E_FAILURE;
4497 }
4498
4499 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4500 {
4501 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4502 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4503 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004504 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 {
4506 status = VOS_STATUS_SUCCESS;
4507 }
4508 else
4509 {
4510 status = VOS_STATUS_E_FAILURE;
4511 }
4512 }
4513 else
4514 {
4515 status = VOS_STATUS_E_FAILURE;
4516 }
4517 }
4518
4519 /* This is a hack for Qualky/pttWniSocket
4520 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4521 if (VOS_STATUS_SUCCESS != status)
4522 {
4523 vos_mem_set(pBuf, nLen, 0xCD);
4524 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004525 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 }
4527
4528 /* Release SME lock */
4529 sme_ReleaseGlobalLock(&pMac->sme);
4530
4531 return (status);
4532}
4533
4534
4535//sme_DbgWriteMemory
4536//Caller needs to validate the input values
4537VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4538{
4539 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4540 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 tPmcPowerState PowerState;
4542 tANI_U32 sessionId = 0;
4543
4544 /* 1) To make Quarky work in FTM mode **************************************/
4545
4546 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4547 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 {
4549 return VOS_STATUS_SUCCESS;
4550 }
4551 return VOS_STATUS_E_FAILURE;
4552 }
4553
4554 /* 2) NON FTM mode driver *************************************************/
4555
4556 /* Acquire SME global lock */
4557 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4558 {
4559 return VOS_STATUS_E_FAILURE;
4560 }
4561
4562 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4563 {
4564 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4565 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4566 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 {
4569 status = VOS_STATUS_SUCCESS;
4570 }
4571 else
4572 {
4573 status = VOS_STATUS_E_FAILURE;
4574 }
4575 }
4576 else
4577 {
4578 status = VOS_STATUS_E_FAILURE;
4579 }
4580 }
4581
4582 /* Release Global lock */
4583 sme_ReleaseGlobalLock(&pMac->sme);
4584
4585 return (status);
4586}
4587
4588
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004589void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07004590{
4591#ifdef WLAN_DEBUG
4592 // Verify against current log level
4593 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
4594 return;
4595 else
4596 {
4597 va_list marker;
4598
4599 va_start( marker, pString ); /* Initialize variable arguments. */
4600
4601 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
4602
4603 va_end( marker ); /* Reset variable arguments. */
4604 }
4605#endif
4606}
Jeff Johnson295189b2012-06-20 16:38:30 -07004607
Jeff Johnson295189b2012-06-20 16:38:30 -07004608/* ---------------------------------------------------------------------------
4609 \fn sme_GetWcnssWlanCompiledVersion
4610 \brief This API returns the version of the WCNSS WLAN API with
4611 which the HOST driver was built
4612 \param hHal - The handle returned by macOpen.
4613 \param pVersion - Points to the Version structure to be filled
4614 \return VOS_STATUS
4615 VOS_STATUS_E_INVAL - failure
4616 VOS_STATUS_SUCCESS success
4617 ---------------------------------------------------------------------------*/
4618VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
4619 tSirVersionType *pVersion)
4620{
4621 VOS_STATUS status = VOS_STATUS_SUCCESS;
4622 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4623 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4624
4625 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4626 {
4627 if( pVersion != NULL )
4628 {
4629 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
4630 }
4631 else
4632 {
4633 status = VOS_STATUS_E_INVAL;
4634 }
4635 sme_ReleaseGlobalLock( &pMac->sme );
4636 }
4637
4638 return (status);
4639}
4640
4641
4642/* ---------------------------------------------------------------------------
4643 \fn sme_GetWcnssWlanReportedVersion
4644 \brief This API returns the version of the WCNSS WLAN API with
4645 which the WCNSS driver reports it was built
4646 \param hHal - The handle returned by macOpen.
4647 \param pVersion - Points to the Version structure to be filled
4648 \return VOS_STATUS
4649 VOS_STATUS_E_INVAL - failure
4650 VOS_STATUS_SUCCESS success
4651 ---------------------------------------------------------------------------*/
4652VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
4653 tSirVersionType *pVersion)
4654{
4655 VOS_STATUS status = VOS_STATUS_SUCCESS;
4656 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4657 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4658
4659 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4660 {
4661 if( pVersion != NULL )
4662 {
4663 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
4664 }
4665 else
4666 {
4667 status = VOS_STATUS_E_INVAL;
4668 }
4669 sme_ReleaseGlobalLock( &pMac->sme );
4670 }
4671
4672 return (status);
4673}
4674
4675
4676/* ---------------------------------------------------------------------------
4677 \fn sme_GetWcnssSoftwareVersion
4678 \brief This API returns the version string of the WCNSS driver
4679 \param hHal - The handle returned by macOpen.
4680 \param pVersion - Points to the Version string buffer to be filled
4681 \param versionBufferSize - THe size of the Version string buffer
4682 \return VOS_STATUS
4683 VOS_STATUS_E_INVAL - failure
4684 VOS_STATUS_SUCCESS success
4685 ---------------------------------------------------------------------------*/
4686VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
4687 tANI_U8 *pVersion,
4688 tANI_U32 versionBufferSize)
4689{
4690 VOS_STATUS status = VOS_STATUS_SUCCESS;
4691 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4692 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4693
4694 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4695 {
4696 if( pVersion != NULL )
4697 {
4698 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
4699 versionBufferSize);
4700 }
4701 else
4702 {
4703 status = VOS_STATUS_E_INVAL;
4704 }
4705 sme_ReleaseGlobalLock( &pMac->sme );
4706 }
4707
4708 return (status);
4709}
4710
4711
4712/* ---------------------------------------------------------------------------
4713 \fn sme_GetWcnssHardwareVersion
4714 \brief This API returns the version string of the WCNSS hardware
4715 \param hHal - The handle returned by macOpen.
4716 \param pVersion - Points to the Version string buffer to be filled
4717 \param versionBufferSize - THe size of the Version string buffer
4718 \return VOS_STATUS
4719 VOS_STATUS_E_INVAL - failure
4720 VOS_STATUS_SUCCESS success
4721 ---------------------------------------------------------------------------*/
4722VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
4723 tANI_U8 *pVersion,
4724 tANI_U32 versionBufferSize)
4725{
4726 VOS_STATUS status = VOS_STATUS_SUCCESS;
4727 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4728 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4729
4730 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4731 {
4732 if( pVersion != NULL )
4733 {
4734 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
4735 versionBufferSize);
4736 }
4737 else
4738 {
4739 status = VOS_STATUS_E_INVAL;
4740 }
4741 sme_ReleaseGlobalLock( &pMac->sme );
4742 }
4743
4744 return (status);
4745}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08004746
Jeff Johnson295189b2012-06-20 16:38:30 -07004747
4748#ifdef FEATURE_WLAN_WAPI
4749/* ---------------------------------------------------------------------------
4750 \fn sme_RoamSetBKIDCache
4751 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
4752 candidate list.
4753 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4754 it is opened (by calling halOpen).
4755 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
4756 \param numItems - a variable that has the number of tBkidCacheInfo allocated
4757 when retruning, this is the number of items put into pBKIDCache
4758 \return eHalStatus - when fail, it usually means the buffer allocated is not
4759 big enough and pNumItems has the number of tBkidCacheInfo.
4760 ---------------------------------------------------------------------------*/
4761eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
4762 tANI_U32 numItems )
4763{
4764 eHalStatus status = eHAL_STATUS_FAILURE;
4765 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4766
4767 status = sme_AcquireGlobalLock( &pMac->sme );
4768 if ( HAL_STATUS_SUCCESS( status ) )
4769 {
4770 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
4771 sme_ReleaseGlobalLock( &pMac->sme );
4772 }
4773
4774 return (status);
4775}
4776
4777/* ---------------------------------------------------------------------------
4778 \fn sme_RoamGetBKIDCache
4779 \brief The SME API exposed to HDD to allow HDD to request SME to return its
4780 BKID cache.
4781 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4782 it is opened (by calling halOpen).
4783 \param pNum - caller allocated memory that has the space of the number of
4784 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
4785 in SME cache.
4786 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
4787 upon return
4788 \return eHalStatus - when fail, it usually means the buffer allocated is not
4789 big enough.
4790 ---------------------------------------------------------------------------*/
4791eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
4792 tBkidCacheInfo *pBkidCache)
4793{
4794 eHalStatus status = eHAL_STATUS_FAILURE;
4795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4796
4797 status = sme_AcquireGlobalLock( &pMac->sme );
4798 if ( HAL_STATUS_SUCCESS( status ) )
4799 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004800 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
4802 sme_ReleaseGlobalLock( &pMac->sme );
4803 }
4804
4805 return (status);
4806}
4807
4808/* ---------------------------------------------------------------------------
4809 \fn sme_RoamGetNumBKIDCache
4810 \brief The SME API exposed to HDD to allow HDD to request SME to return the
4811 number of BKID cache entries.
4812 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4813 it is opened (by calling halOpen).
4814 \return tANI_U32 - the number of BKID cache entries.
4815 ---------------------------------------------------------------------------*/
4816tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
4817{
4818 eHalStatus status = eHAL_STATUS_FAILURE;
4819 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4820 tANI_U32 numBkidCache = 0;
4821
4822 status = sme_AcquireGlobalLock( &pMac->sme );
4823 if ( HAL_STATUS_SUCCESS( status ) )
4824 {
4825 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
4826 sme_ReleaseGlobalLock( &pMac->sme );
4827 }
4828
4829 return (numBkidCache);
4830}
4831
4832/* ---------------------------------------------------------------------------
4833 \fn sme_ScanGetBKIDCandidateList
4834 \brief a wrapper function to return the BKID candidate list
4835 \param pBkidList - caller allocated buffer point to an array of
4836 tBkidCandidateInfo
4837 \param pNumItems - pointer to a variable that has the number of
4838 tBkidCandidateInfo allocated when retruning, this is
4839 either the number needed or number of items put into
4840 pPmkidList
4841 \return eHalStatus - when fail, it usually means the buffer allocated is not
4842 big enough and pNumItems
4843 has the number of tBkidCandidateInfo.
4844 \Note: pNumItems is a number of tBkidCandidateInfo,
4845 not sizeof(tBkidCandidateInfo) * something
4846 ---------------------------------------------------------------------------*/
4847eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
4848 tBkidCandidateInfo *pBkidList,
4849 tANI_U32 *pNumItems )
4850{
4851 eHalStatus status = eHAL_STATUS_FAILURE;
4852 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4853
4854 status = sme_AcquireGlobalLock( &pMac->sme );
4855 if ( HAL_STATUS_SUCCESS( status ) )
4856 {
4857 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
4858 sme_ReleaseGlobalLock( &pMac->sme );
4859 }
4860
4861 return (status);
4862}
4863#endif /* FEATURE_WLAN_WAPI */
4864
Jeff Johnsone7245742012-09-05 17:12:55 -07004865#ifdef FEATURE_OEM_DATA_SUPPORT
4866
4867/*****************************************************************************
4868 OEM DATA related modifications and function additions
4869 *****************************************************************************/
4870
4871/* ---------------------------------------------------------------------------
4872 \fn sme_getOemDataRsp
4873 \brief a wrapper function to obtain the OEM DATA RSP
4874 \param pOemDataRsp - A pointer to the response object
4875 \param pContext - a pointer passed in for the callback
4876 \return eHalStatus
4877 ---------------------------------------------------------------------------*/
4878eHalStatus sme_getOemDataRsp(tHalHandle hHal,
4879 tOemDataRsp **pOemDataRsp)
4880{
4881 eHalStatus status = eHAL_STATUS_SUCCESS;
4882 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4883
4884 do
4885 {
4886 //acquire the lock for the sme object
4887 status = sme_AcquireGlobalLock(&pMac->sme);
4888
4889 if(!HAL_STATUS_SUCCESS(status))
4890 {
4891 break;
4892 }
4893
4894 if(pMac->oemData.pOemDataRsp != NULL)
4895 {
4896 *pOemDataRsp = pMac->oemData.pOemDataRsp;
4897 }
4898 else
4899 {
4900 status = eHAL_STATUS_FAILURE;
4901 }
4902
4903 //release the lock for the sme object
4904 sme_ReleaseGlobalLock( &pMac->sme );
4905
4906 } while(0);
4907
4908 return status;
4909}
4910
4911/* ---------------------------------------------------------------------------
4912 \fn sme_OemDataReq
4913 \brief a wrapper function for OEM DATA REQ
4914 \param sessionId - session id to be used.
4915 \param pOemDataReqId - pointer to an object to get back the request ID
4916 \param callback - a callback function that is called upon finish
4917 \param pContext - a pointer passed in for the callback
4918 \return eHalStatus
4919 ---------------------------------------------------------------------------*/
4920eHalStatus sme_OemDataReq(tHalHandle hHal,
4921 tANI_U8 sessionId,
4922 tOemDataReqConfig *pOemDataReqConfig,
4923 tANI_U32 *pOemDataReqID,
4924 oemData_OemDataReqCompleteCallback callback,
4925 void *pContext)
4926{
4927 eHalStatus status = eHAL_STATUS_SUCCESS;
4928 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4929
4930 do
4931 {
4932 //acquire the lock for the sme object
4933 status = sme_AcquireGlobalLock(&pMac->sme);
4934 if(HAL_STATUS_SUCCESS(status))
4935 {
4936 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
4937
4938 if(pOemDataReqID)
4939 {
4940 *pOemDataReqID = lOemDataReqId;
4941 }
4942 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004943 {
4944 sme_ReleaseGlobalLock( &pMac->sme );
4945 return eHAL_STATUS_FAILURE;
4946 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004947
4948 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
4949
4950 //release the lock for the sme object
4951 sme_ReleaseGlobalLock( &pMac->sme );
4952 }
4953 } while(0);
4954
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004955 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07004956
4957 return(status);
4958}
4959
4960#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07004961
4962/*--------------------------------------------------------------------------
4963
4964 \brief sme_OpenSession() - Open a session for scan/roam operation.
4965
4966 This is a synchronous API.
4967
4968
4969 \param hHal - The handle returned by macOpen.
4970 \param callback - A pointer to the function caller specifies for roam/connect status indication
4971 \param pContext - The context passed with callback
4972 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
4973 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
4974
4975 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
4976
4977 Other status means SME is failed to open the session.
4978 eHAL_STATUS_RESOURCES - no more session available.
4979 \sa
4980
4981 --------------------------------------------------------------------------*/
4982eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext,
4983 tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId)
4984{
4985 eHalStatus status;
4986 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4987
4988 if( NULL == pbSessionId )
4989 {
4990 status = eHAL_STATUS_INVALID_PARAMETER;
4991 }
4992 else
4993 {
4994 status = sme_AcquireGlobalLock( &pMac->sme );
4995 if ( HAL_STATUS_SUCCESS( status ) )
4996 {
4997 status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId );
4998
4999 sme_ReleaseGlobalLock( &pMac->sme );
5000 }
5001 }
5002
5003 return ( status );
5004}
5005
5006
5007/*--------------------------------------------------------------------------
5008
5009 \brief sme_CloseSession() - Open a session for scan/roam operation.
5010
5011 This is a synchronous API.
5012
5013
5014 \param hHal - The handle returned by macOpen.
5015
5016 \param sessionId - A previous opened session's ID.
5017
5018 \return eHAL_STATUS_SUCCESS - session is closed.
5019
5020 Other status means SME is failed to open the session.
5021 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5022 \sa
5023
5024 --------------------------------------------------------------------------*/
5025eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5026 csrRoamSessionCloseCallback callback, void *pContext)
5027{
5028 eHalStatus status;
5029 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5030
5031 status = sme_AcquireGlobalLock( &pMac->sme );
5032 if ( HAL_STATUS_SUCCESS( status ) )
5033 {
5034 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5035 callback, pContext );
5036
5037 sme_ReleaseGlobalLock( &pMac->sme );
5038 }
5039
5040 return ( status );
5041}
5042
Jeff Johnson295189b2012-06-20 16:38:30 -07005043/* ---------------------------------------------------------------------------
5044
5045 \fn sme_RoamUpdateAPWPSIE
5046
5047 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5048 This is an asynchronous API.
5049
5050 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5051
5052 \return eHalStatus – SUCCESS –
5053
5054 FAILURE or RESOURCES – The API finished and failed.
5055
5056 -------------------------------------------------------------------------------*/
5057eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5058{
5059
5060 eHalStatus status = eHAL_STATUS_FAILURE;
5061 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5062
5063 status = sme_AcquireGlobalLock( &pMac->sme );
5064 if ( HAL_STATUS_SUCCESS( status ) )
5065 {
5066
5067 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5068
5069 sme_ReleaseGlobalLock( &pMac->sme );
5070 }
5071
5072 return (status);
5073}
5074/* ---------------------------------------------------------------------------
5075
5076 \fn sme_RoamUpdateAPWPARSNIEs
5077
5078 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5079 This is an asynchronous API.
5080
5081 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5082
5083 \return eHalStatus – SUCCESS –
5084
5085 FAILURE or RESOURCES – The API finished and failed.
5086
5087 -------------------------------------------------------------------------------*/
5088eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5089{
5090
5091 eHalStatus status = eHAL_STATUS_FAILURE;
5092 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5093
5094 status = sme_AcquireGlobalLock( &pMac->sme );
5095 if ( HAL_STATUS_SUCCESS( status ) )
5096 {
5097
5098 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5099
5100 sme_ReleaseGlobalLock( &pMac->sme );
5101 }
5102
5103 return (status);
5104}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005105/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005106
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005107 \fn sme_ChangeMCCBeaconInterval
5108
5109 \brief To update P2P-GO beaconInterval. This function should be called after
5110 disassociating all the station is done
5111 This is an asynchronous API.
5112
5113 \param
5114
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005115 \return eHalStatus SUCCESS
5116 FAILURE or RESOURCES
5117 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005118
5119 -------------------------------------------------------------------------------*/
5120eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5121{
5122 eHalStatus status = eHAL_STATUS_FAILURE;
5123 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5124
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005125 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005126 status = sme_AcquireGlobalLock( &pMac->sme );
5127 if ( HAL_STATUS_SUCCESS( status ) )
5128 {
5129 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5130 sme_ReleaseGlobalLock( &pMac->sme );
5131 }
5132 return (status);
5133}
Jeff Johnson295189b2012-06-20 16:38:30 -07005134
5135/*-------------------------------------------------------------------------------*
5136
5137 \fn sme_sendBTAmpEvent
5138
5139 \brief to receive the coex priorty request from BT-AMP PAL
5140 and send the BT_AMP link state to HAL
5141
5142 \param btAmpEvent - btAmpEvent
5143
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005144 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005145
5146 FAILURE: API failed
5147
5148-------------------------------------------------------------------------------*/
5149
5150eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5151{
5152 vos_msg_t msg;
5153 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5154 eHalStatus status = eHAL_STATUS_FAILURE;
5155
5156 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5157 if (NULL == ptrSmeBtAmpEvent)
5158 {
5159 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005160 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 return status;
5162 }
5163
5164 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5165 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5166 msg.reserved = 0;
5167 msg.bodyptr = ptrSmeBtAmpEvent;
5168
5169 //status = halFW_SendBTAmpEventMesg(pMac, event);
5170
5171 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5172 {
5173 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005174 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005175 vos_mem_free(ptrSmeBtAmpEvent);
5176 return status;
5177 }
5178
5179 return eHAL_STATUS_SUCCESS;
5180
5181}
5182
5183/* ---------------------------------------------------------------------------
5184 \fn sme_SetHostOffload
5185 \brief API to set the host offload feature.
5186 \param hHal - The handle returned by macOpen.
5187 \param pRequest - Pointer to the offload request.
5188 \return eHalStatus
5189 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005190eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5191 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005192{
5193 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005194 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005195
5196 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5197 {
5198#ifdef WLAN_NS_OFFLOAD
5199 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5200 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005201 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005202 }
5203 else
5204#endif //WLAN_NS_OFFLOAD
5205 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005206 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005207 }
5208 sme_ReleaseGlobalLock( &pMac->sme );
5209 }
5210
5211 return (status);
5212}
5213
5214#ifdef WLAN_FEATURE_GTK_OFFLOAD
5215/* ---------------------------------------------------------------------------
5216 \fn sme_SetGTKOffload
5217 \brief API to set GTK offload information.
5218 \param hHal - The handle returned by macOpen.
5219 \param pRequest - Pointer to the GTK offload request.
5220 \return eHalStatus
5221 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005222eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5223 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005224{
5225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5226 eHalStatus status;
5227
5228 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5229 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005230 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005231 sme_ReleaseGlobalLock( &pMac->sme );
5232 }
5233
5234 return (status);
5235}
5236
5237/* ---------------------------------------------------------------------------
5238 \fn sme_GetGTKOffload
5239 \brief API to get GTK offload information.
5240 \param hHal - The handle returned by macOpen.
5241 \param pRequest - Pointer to the GTK offload response.
5242 \return eHalStatus
5243 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005244eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5245 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005246{
5247 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5248 eHalStatus status;
5249
5250 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5251 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005252 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005253 sme_ReleaseGlobalLock( &pMac->sme );
5254 }
5255
5256 return (status);
5257}
5258#endif // WLAN_FEATURE_GTK_OFFLOAD
5259
5260/* ---------------------------------------------------------------------------
5261 \fn sme_SetKeepAlive
5262 \brief API to set the Keep Alive feature.
5263 \param hHal - The handle returned by macOpen.
5264 \param pRequest - Pointer to the Keep Alive request.
5265 \return eHalStatus
5266 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005267eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5268 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005269{
5270 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5271 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005272 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5273 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005274 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005275 sme_ReleaseGlobalLock( &pMac->sme );
5276 }
5277
5278 return (status);
5279}
5280
5281#ifdef FEATURE_WLAN_SCAN_PNO
5282/* ---------------------------------------------------------------------------
5283 \fn sme_SetPreferredNetworkList
5284 \brief API to set the Preferred Network List Offload feature.
5285 \param hHal - The handle returned by macOpen.
5286 \param pRequest - Pointer to the offload request.
5287 \return eHalStatus
5288 ---------------------------------------------------------------------------*/
5289eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5290{
5291 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5292 eHalStatus status;
5293
5294 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5295 {
5296 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5297 sme_ReleaseGlobalLock( &pMac->sme );
5298 }
5299
5300 return (status);
5301}
5302
5303eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5304{
5305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5306 eHalStatus status;
5307
5308 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5309 {
5310 pmcSetRssiFilter(hHal, rssiThreshold);
5311 sme_ReleaseGlobalLock( &pMac->sme );
5312 }
5313
5314 return (status);
5315}
5316
5317#endif // FEATURE_WLAN_SCAN_PNO
5318
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005319eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005320{
5321 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5322 eHalStatus status;
5323
5324 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5325 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005326 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005327 sme_ReleaseGlobalLock( &pMac->sme );
5328 }
5329
5330 return (status);
5331}
5332
5333/* ---------------------------------------------------------------------------
5334 \fn sme_AbortMacScan
5335 \brief API to cancel MAC scan.
5336 \param hHal - The handle returned by macOpen.
5337 \return VOS_STATUS
5338 VOS_STATUS_E_FAILURE - failure
5339 VOS_STATUS_SUCCESS success
5340 ---------------------------------------------------------------------------*/
5341eHalStatus sme_AbortMacScan(tHalHandle hHal)
5342{
5343 eHalStatus status;
5344 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5345
5346 status = sme_AcquireGlobalLock( &pMac->sme );
5347 if ( HAL_STATUS_SUCCESS( status ) )
5348 {
5349 status = csrScanAbortMacScan(pMac);
5350
5351 sme_ReleaseGlobalLock( &pMac->sme );
5352 }
5353
5354 return ( status );
5355}
5356
5357/* ----------------------------------------------------------------------------
5358 \fn sme_GetOperationChannel
5359 \brief API to get current channel on which STA is parked
5360 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005361 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005362 \returns eHAL_STATUS_SUCCESS
5363 eHAL_STATUS_FAILURE
5364-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005365eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005366{
Jeff Johnson295189b2012-06-20 16:38:30 -07005367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5368 tCsrRoamSession *pSession;
5369
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005370 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005371 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005372 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005373
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005374 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5375 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005376 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005377 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5378 {
5379 *pChannel =pSession->connectedProfile.operationChannel;
5380 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005381 }
5382 }
5383 return eHAL_STATUS_FAILURE;
5384}// sme_GetOperationChannel ends here
5385
Jeff Johnson295189b2012-06-20 16:38:30 -07005386/* ---------------------------------------------------------------------------
5387
5388 \fn sme_RegisterMgtFrame
5389
5390 \brief To register managment frame of specified type and subtype.
5391 \param frameType - type of the frame that needs to be passed to HDD.
5392 \param matchData - data which needs to be matched before passing frame
5393 to HDD.
5394 \param matchDataLen - Length of matched data.
5395 \return eHalStatus
5396 -------------------------------------------------------------------------------*/
5397eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5398 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5399{
5400 eHalStatus status = eHAL_STATUS_SUCCESS;
5401 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5402
5403 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5404 {
5405 tSirRegisterMgmtFrame *pMsg;
5406 tANI_U16 len;
5407 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005408
5409 if(!pSession)
5410 {
5411 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005412 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005413 return eHAL_STATUS_FAILURE;
5414 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005415
5416 if( !pSession->sessionActive )
5417 {
5418 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005419 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005420 sme_ReleaseGlobalLock( &pMac->sme );
5421 return eHAL_STATUS_FAILURE;
5422 }
5423
5424 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5425
5426 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5427 if(HAL_STATUS_SUCCESS(status))
5428 {
5429 palZeroMemory(pMac->hHdd, pMsg, len);
5430 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5431 pMsg->length = len;
5432 pMsg->sessionId = sessionId;
5433 pMsg->registerFrame = VOS_TRUE;
5434 pMsg->frameType = frameType;
5435 pMsg->matchLen = matchLen;
5436 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5437 status = palSendMBMessage(pMac->hHdd, pMsg);
5438 }
5439 sme_ReleaseGlobalLock( &pMac->sme );
5440 }
5441 return status;
5442}
5443
5444/* ---------------------------------------------------------------------------
5445
5446 \fn sme_DeregisterMgtFrame
5447
5448 \brief To De-register managment frame of specified type and subtype.
5449 \param frameType - type of the frame that needs to be passed to HDD.
5450 \param matchData - data which needs to be matched before passing frame
5451 to HDD.
5452 \param matchDataLen - Length of matched data.
5453 \return eHalStatus
5454 -------------------------------------------------------------------------------*/
5455eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5456 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5457{
5458 eHalStatus status = eHAL_STATUS_SUCCESS;
5459 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5460
5461 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5462 {
5463 tSirRegisterMgmtFrame *pMsg;
5464 tANI_U16 len;
5465 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005466
5467 if(!pSession)
5468 {
5469 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005470 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005471 return eHAL_STATUS_FAILURE;
5472 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005473
5474 if( !pSession->sessionActive )
5475 {
5476 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005477 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005478 sme_ReleaseGlobalLock( &pMac->sme );
5479 return eHAL_STATUS_FAILURE;
5480 }
5481
5482 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5483
5484 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5485 if(HAL_STATUS_SUCCESS(status))
5486 {
5487 palZeroMemory(pMac->hHdd, pMsg, len);
5488 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5489 pMsg->length = len;
5490 pMsg->registerFrame = VOS_FALSE;
5491 pMsg->frameType = frameType;
5492 pMsg->matchLen = matchLen;
5493 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5494 status = palSendMBMessage(pMac->hHdd, pMsg);
5495 }
5496 sme_ReleaseGlobalLock( &pMac->sme );
5497 }
5498 return status;
5499}
5500
5501/* ---------------------------------------------------------------------------
5502 \fn sme_RemainOnChannel
5503 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
5504 \param hHal - The handle returned by macOpen.
5505 \param pRequest - channel
5506 \param duration - duration in ms
5507 \param callback - HDD registered callback to process reaminOnChannelRsp
5508 \param context - HDD Callback param
5509 \return eHalStatus
5510 ---------------------------------------------------------------------------*/
5511
5512eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
5513 tANI_U8 channel, tANI_U32 duration,
5514 remainOnChanCallback callback,
5515 void *pContext)
5516{
5517 eHalStatus status = eHAL_STATUS_SUCCESS;
5518 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5519
5520 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5521 {
5522 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext
5523#ifdef WLAN_FEATURE_P2P_INTERNAL
5524 , eP2PRemainOnChnReasonUnknown
5525#endif
5526 );
5527 sme_ReleaseGlobalLock( &pMac->sme );
5528 }
5529 return(status);
5530}
5531
5532/* ---------------------------------------------------------------------------
5533 \fn sme_ReportProbeReq
5534 \brief API to enable/disable forwarding of probeReq to apps in p2p.
5535 \param hHal - The handle returned by macOpen.
5536 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
5537 \return eHalStatus
5538 ---------------------------------------------------------------------------*/
5539
5540#ifndef WLAN_FEATURE_CONCURRENT_P2P
5541eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
5542{
5543 eHalStatus status = eHAL_STATUS_SUCCESS;
5544 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5545
5546 do
5547 {
5548 //acquire the lock for the sme object
5549 status = sme_AcquireGlobalLock(&pMac->sme);
5550 if(HAL_STATUS_SUCCESS(status))
5551 {
5552 /* call set in context */
5553 pMac->p2pContext.probeReqForwarding = flag;
5554 //release the lock for the sme object
5555 sme_ReleaseGlobalLock( &pMac->sme );
5556 }
5557 } while(0);
5558
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005559 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005560
5561 return(status);
5562}
5563
5564/* ---------------------------------------------------------------------------
5565 \fn sme_updateP2pIe
5566 \brief API to set the P2p Ie in p2p context
5567 \param hHal - The handle returned by macOpen.
5568 \param p2pIe - Ptr to p2pIe from HDD.
5569 \param p2pIeLength: length of p2pIe
5570 \return eHalStatus
5571 ---------------------------------------------------------------------------*/
5572
5573eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
5574{
5575 eHalStatus status = eHAL_STATUS_SUCCESS;
5576 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5577
5578 //acquire the lock for the sme object
5579 status = sme_AcquireGlobalLock(&pMac->sme);
5580 if(HAL_STATUS_SUCCESS(status))
5581 {
5582 if(NULL != pMac->p2pContext.probeRspIe){
5583 vos_mem_free(pMac->p2pContext.probeRspIe);
5584 pMac->p2pContext.probeRspIeLength = 0;
5585 }
5586
5587 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
5588 if (NULL == pMac->p2pContext.probeRspIe)
5589 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005590 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005591 pMac->p2pContext.probeRspIeLength = 0;
5592 status = eHAL_STATUS_FAILURE;
5593 }
5594 else
5595 {
5596 pMac->p2pContext.probeRspIeLength = p2pIeLength;
5597
5598 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
5599 pMac->p2pContext.probeRspIe,
5600 pMac->p2pContext.probeRspIeLength );
5601 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
5602 p2pIeLength);
5603 }
5604
5605 //release the lock for the sme object
5606 sme_ReleaseGlobalLock( &pMac->sme );
5607 }
5608
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005609 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005610
5611 return(status);
5612}
5613#endif
5614
5615/* ---------------------------------------------------------------------------
5616 \fn sme_sendAction
5617 \brief API to send action frame from supplicant.
5618 \param hHal - The handle returned by macOpen.
5619 \return eHalStatus
5620 ---------------------------------------------------------------------------*/
5621
5622eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07005623 const tANI_U8 *pBuf, tANI_U32 len,
5624 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07005625{
5626 eHalStatus status = eHAL_STATUS_SUCCESS;
5627 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5628
5629 //acquire the lock for the sme object
5630 status = sme_AcquireGlobalLock(&pMac->sme);
5631 if(HAL_STATUS_SUCCESS(status))
5632 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005633 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07005634 //release the lock for the sme object
5635 sme_ReleaseGlobalLock( &pMac->sme );
5636 }
5637
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005638 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005639
5640 return(status);
5641}
5642
5643eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
5644{
5645 eHalStatus status = eHAL_STATUS_SUCCESS;
5646 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5647
5648 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5649 {
5650 status = p2pCancelRemainOnChannel (hHal, sessionId);
5651 sme_ReleaseGlobalLock( &pMac->sme );
5652 }
5653 return(status);
5654}
5655
5656//Power Save Related
5657eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
5658{
5659 eHalStatus status = eHAL_STATUS_SUCCESS;
5660 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5661
5662 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5663 {
5664 status = p2pSetPs (hHal, data);
5665 sme_ReleaseGlobalLock( &pMac->sme );
5666 }
5667 return(status);
5668}
5669
Jeff Johnson295189b2012-06-20 16:38:30 -07005670
5671/* ---------------------------------------------------------------------------
5672
5673 \fn sme_ConfigureRxpFilter
5674
5675 \brief
5676 SME will pass this request to lower mac to set/reset the filter on RXP for
5677 multicast & broadcast traffic.
5678
5679 \param
5680
5681 hHal - The handle returned by macOpen.
5682
5683 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
5684 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
5685 on this param. In future we can use this as a mask to set various types of
5686 filters as suggested below:
5687 FILTER_ALL_MULTICAST:
5688 FILTER_ALL_BROADCAST:
5689 FILTER_ALL_MULTICAST_BROADCAST:
5690
5691
5692 \return eHalStatus
5693
5694
5695--------------------------------------------------------------------------- */
5696eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
5697 tpSirWlanSetRxpFilters wlanRxpFilterParam)
5698{
5699 eHalStatus status = eHAL_STATUS_SUCCESS;
5700 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5701 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5702 vos_msg_t vosMessage;
5703
5704 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5705 {
5706 /* serialize the req through MC thread */
5707 vosMessage.bodyptr = wlanRxpFilterParam;
5708 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
5709 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5710 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5711 {
5712 status = eHAL_STATUS_FAILURE;
5713 }
5714 sme_ReleaseGlobalLock( &pMac->sme );
5715 }
5716 return(status);
5717}
5718
Jeff Johnson295189b2012-06-20 16:38:30 -07005719/* ---------------------------------------------------------------------------
5720
5721 \fn sme_ConfigureSuspendInd
5722
5723 \brief
5724 SME will pass this request to lower mac to Indicate that the wlan needs to
5725 be suspended
5726
5727 \param
5728
5729 hHal - The handle returned by macOpen.
5730
5731 wlanSuspendParam- Depicts the wlan suspend params
5732
5733
5734 \return eHalStatus
5735
5736
5737--------------------------------------------------------------------------- */
5738eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
5739 tpSirWlanSuspendParam wlanSuspendParam)
5740{
5741 eHalStatus status = eHAL_STATUS_SUCCESS;
5742 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5743 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5744 vos_msg_t vosMessage;
5745
5746 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5747 {
5748 /* serialize the req through MC thread */
5749 vosMessage.bodyptr = wlanSuspendParam;
5750 vosMessage.type = WDA_WLAN_SUSPEND_IND;
5751 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5752 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5753 {
5754 status = eHAL_STATUS_FAILURE;
5755 }
5756 sme_ReleaseGlobalLock( &pMac->sme );
5757 }
5758 return(status);
5759}
5760
5761/* ---------------------------------------------------------------------------
5762
5763 \fn sme_ConfigureResumeReq
5764
5765 \brief
5766 SME will pass this request to lower mac to Indicate that the wlan needs to
5767 be Resumed
5768
5769 \param
5770
5771 hHal - The handle returned by macOpen.
5772
5773 wlanResumeParam- Depicts the wlan resume params
5774
5775
5776 \return eHalStatus
5777
5778
5779--------------------------------------------------------------------------- */
5780eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
5781 tpSirWlanResumeParam wlanResumeParam)
5782{
5783 eHalStatus status = eHAL_STATUS_SUCCESS;
5784 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5785 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5786 vos_msg_t vosMessage;
5787
5788 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5789 {
5790 /* serialize the req through MC thread */
5791 vosMessage.bodyptr = wlanResumeParam;
5792 vosMessage.type = WDA_WLAN_RESUME_REQ;
5793 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5794 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5795 {
5796 status = eHAL_STATUS_FAILURE;
5797 }
5798 sme_ReleaseGlobalLock( &pMac->sme );
5799 }
5800 return(status);
5801}
5802
Jeff Johnson295189b2012-06-20 16:38:30 -07005803/* ---------------------------------------------------------------------------
5804
5805 \fn sme_GetInfraSessionId
5806
5807 \brief To get the session ID for infra session, if connected
5808 This is a synchronous API.
5809
5810 \param hHal - The handle returned by macOpen.
5811
5812 \return sessionid, -1 if infra session is not connected
5813
5814 -------------------------------------------------------------------------------*/
5815tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
5816{
5817 eHalStatus status = eHAL_STATUS_FAILURE;
5818 tANI_S8 sessionid = -1;
5819 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5820
5821 status = sme_AcquireGlobalLock( &pMac->sme );
5822 if ( HAL_STATUS_SUCCESS( status ) )
5823 {
5824
5825 sessionid = csrGetInfraSessionId( pMac);
5826
5827 sme_ReleaseGlobalLock( &pMac->sme );
5828 }
5829
5830 return (sessionid);
5831}
5832
5833/* ---------------------------------------------------------------------------
5834
5835 \fn sme_GetInfraOperationChannel
5836
5837 \brief To get the operating channel for infra session, if connected
5838 This is a synchronous API.
5839
5840 \param hHal - The handle returned by macOpen.
5841 \param sessionId - the sessionId returned by sme_OpenSession.
5842
5843 \return operating channel, 0 if infra session is not connected
5844
5845 -------------------------------------------------------------------------------*/
5846tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
5847{
5848 eHalStatus status = eHAL_STATUS_FAILURE;
5849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5850 tANI_U8 channel = 0;
5851 status = sme_AcquireGlobalLock( &pMac->sme );
5852 if ( HAL_STATUS_SUCCESS( status ) )
5853 {
5854
5855 channel = csrGetInfraOperationChannel( pMac, sessionId);
5856
5857 sme_ReleaseGlobalLock( &pMac->sme );
5858 }
5859
5860 return (channel);
5861}
5862
5863//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
5864//If other BSS is not up or not connected it will return 0
5865tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
5866{
5867 eHalStatus status = eHAL_STATUS_FAILURE;
5868 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5869 tANI_U8 channel = 0;
5870 status = sme_AcquireGlobalLock( &pMac->sme );
5871 if ( HAL_STATUS_SUCCESS( status ) )
5872 {
5873
5874 channel = csrGetConcurrentOperationChannel( pMac );
5875 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005876 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07005877 sme_ReleaseGlobalLock( &pMac->sme );
5878 }
5879
5880 return (channel);
5881}
5882
5883#ifdef FEATURE_WLAN_SCAN_PNO
5884/******************************************************************************
5885*
5886* Name: sme_PreferredNetworkFoundInd
5887*
5888* Description:
5889* Invoke Preferred Network Found Indication
5890*
5891* Parameters:
5892* hHal - HAL handle for device
5893* pMsg - found network description
5894*
5895* Returns: eHalStatus
5896*
5897******************************************************************************/
5898eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
5899{
5900 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5901 eHalStatus status = eHAL_STATUS_SUCCESS;
5902 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
5903
5904 if (NULL == pMsg)
5905 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005906 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005907 status = eHAL_STATUS_FAILURE;
5908 }
5909 else
5910 {
5911 if (pPrefNetworkFoundInd->ssId.length > 0)
5912 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005913 smsLog(pMac, LOG1, "Preferred Network Found Indication in %s(), SSID=%s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005914 __func__, pPrefNetworkFoundInd->ssId.ssId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005915
5916
5917 /* Call Preferred Netowrk Found Indication callback routine. */
5918 if (pMac->pmc.prefNetwFoundCB != NULL)
5919 {
5920 pMac->pmc.prefNetwFoundCB(pMac->pmc.preferredNetworkFoundIndCallbackContext, pPrefNetworkFoundInd);
5921 }
5922
5923 }
5924 else
5925 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005926 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005927 status = eHAL_STATUS_FAILURE;
5928 }
5929 }
5930
5931
5932 return(status);
5933}
5934
5935#endif // FEATURE_WLAN_SCAN_PNO
5936
5937
5938eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
5939{
5940 eHalStatus status = eHAL_STATUS_FAILURE;
5941 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5942
5943 status = sme_AcquireGlobalLock( &pMac->sme );
5944 if ( HAL_STATUS_SUCCESS( status ) )
5945 {
5946 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
5947 sme_ReleaseGlobalLock( &pMac->sme );
5948 }
5949
5950 return (status);
5951}
5952
5953
5954/* ---------------------------------------------------------------------------
5955
5956 \fn sme_SetTxPerTracking
5957
5958 \brief Set Tx PER tracking configuration parameters
5959
5960 \param hHal - The handle returned by macOpen.
5961 \param pTxPerTrackingConf - Tx PER configuration parameters
5962
5963 \return eHalStatus
5964
5965 -------------------------------------------------------------------------------*/
5966eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
5967 void (*pCallbackfn) (void *pCallbackContext),
5968 void *pCallbackContext,
5969 tpSirTxPerTrackingParam pTxPerTrackingParam)
5970{
5971 vos_msg_t msg;
5972 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
5973 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5974
5975 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5976 {
5977 pMac->sme.pTxPerHitCallback = pCallbackfn;
5978 pMac->sme.pTxPerHitCbContext = pCallbackContext;
5979 sme_ReleaseGlobalLock( &pMac->sme );
5980 }
5981
5982 // free this memory in failure case or WDA request callback function
5983 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
5984 if (NULL == pTxPerTrackingParamReq)
5985 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005986 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 -07005987 return eHAL_STATUS_FAILURE;
5988 }
5989
5990 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
5991 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
5992 msg.reserved = 0;
5993 msg.bodyptr = pTxPerTrackingParamReq;
5994
5995 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5996 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005997 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 -07005998 vos_mem_free(pTxPerTrackingParamReq);
5999 return eHAL_STATUS_FAILURE;
6000 }
6001
6002 return eHAL_STATUS_SUCCESS;
6003}
6004
6005/* ---------------------------------------------------------------------------
6006
6007 \fn sme_HandleChangeCountryCode
6008
6009 \brief Change Country code, Reg Domain and channel list
6010
6011 \details Country Code Priority
6012 0 = 11D > Configured Country > NV
6013 1 = Configured Country > 11D > NV
6014 If Supplicant country code is priority than 11d is disabled.
6015 If 11D is enabled, we update the country code after every scan.
6016 Hence when Supplicant country code is priority, we don't need 11D info.
6017 Country code from Supplicant is set as current courtry code.
6018 User can send reset command XX (instead of country code) to reset the
6019 country code to default values which is read from NV.
6020 In case of reset, 11D is enabled and default NV code is Set as current country code
6021 If 11D is priority,
6022 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6023
6024 \param pMac - The handle returned by macOpen.
6025 \param pMsgBuf - MSG Buffer
6026
6027 \return eHalStatus
6028
6029 -------------------------------------------------------------------------------*/
6030eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6031{
6032 eHalStatus status = eHAL_STATUS_SUCCESS;
6033 tAniChangeCountryCodeReq *pMsg;
6034 v_REGDOMAIN_t domainIdIoctl;
6035 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6036 static uNvTables nvTables;
6037 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6038
6039
6040 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6041 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6042 {
6043 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6044
6045 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6046
6047 /* read the country code from NV and use it */
6048 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6049 {
6050 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6051 }
6052 else
6053 {
6054 status = eHAL_STATUS_FAILURE;
6055 return status;
6056 }
6057 }
6058 else
6059 {
6060 /* if Supplicant country code has priority, disable 11d */
6061 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
6062 {
6063 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6064 }
6065 }
6066
6067 /* WEXT set country code means
6068 * 11D should be supported?
6069 * 11D Channel should be enforced?
6070 * 11D Country code should be matched?
6071 * 11D Reg Domian should be matched?
6072 * Country string changed */
6073 if(pMac->roam.configParam.Is11dSupportEnabled &&
6074 pMac->roam.configParam.fEnforce11dChannels &&
6075 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6076 pMac->roam.configParam.fEnforceDefaultDomain &&
6077 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6078 {
6079 /* All 11D related options are already enabled
6080 * Country string is not changed
6081 * Do not need do anything for country code change request */
6082 return eHAL_STATUS_SUCCESS;
6083 }
6084
6085 /* Set Current Country code and Current Regulatory domain */
6086 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6087 if(eHAL_STATUS_SUCCESS != status)
6088 {
6089 /* Supplicant country code failed. So give 11D priority */
6090 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6091 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6092 return status;
6093 }
6094
6095 /* purge current scan results
6096 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).
6097 Looks like a bug in current scan sequence.
6098 */
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07006099 csrScanFlushResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07006100
6101 /* overwrite the defualt country code */
6102 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6103
6104 /* Get Domain ID from country code */
6105 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6106 if ( status != eHAL_STATUS_SUCCESS )
6107 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006108 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006109 return status;
6110 }
6111
6112 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6113
6114 if ( status != eHAL_STATUS_SUCCESS )
6115 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006116 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006117 return status;
6118 }
6119
6120 /* set to default domain ID */
6121 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6122
6123 /* get the channels based on new cc */
6124 status = csrInitGetChannels( pMac );
6125
6126 if ( status != eHAL_STATUS_SUCCESS )
6127 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006128 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006129 return status;
6130 }
6131
6132 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006133 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006134 if( pMsg->changeCCCallback )
6135 {
6136 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6137 }
6138
6139 return eHAL_STATUS_SUCCESS;
6140}
6141
6142#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006143eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006144{
6145 tpSirRcvFltMcAddrList pRequestBuf;
6146 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006147 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006148 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006149
6150 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006151 "ulMulticastAddrCnt=%d, multicastAddr[0]=%d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006152 pMulticastAddrs->ulMulticastAddrCnt,
6153 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006154
6155 /*
6156 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006157 */
6158 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6159 csrIsConnStateInfra(pMac, sessionId))
6160 {
6161 pSession = CSR_GET_SESSION( pMac, sessionId );
6162 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006163
6164 if(pSession == NULL )
6165 {
6166 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006167 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006168 return eHAL_STATUS_FAILURE;
6169 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006170
Jeff Johnson295189b2012-06-20 16:38:30 -07006171 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6172 if (NULL == pRequestBuf)
6173 {
6174 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006175 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006176 return eHAL_STATUS_FAILED_ALLOC;
6177 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006178
6179 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6180 {
6181 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6182 "indication as we are not connected", __func__);
6183 vos_mem_free(pRequestBuf);
6184 return eHAL_STATUS_FAILURE;
6185 }
6186
Jeff Johnson295189b2012-06-20 16:38:30 -07006187 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6188
Jeff Johnsone7245742012-09-05 17:12:55 -07006189 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6190 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6191 sizeof(tSirMacAddr));
6192
Jeff Johnson295189b2012-06-20 16:38:30 -07006193 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6194 msg.reserved = 0;
6195 msg.bodyptr = pRequestBuf;
6196 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6197 {
6198 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006199 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006200 vos_mem_free(pRequestBuf);
6201 return eHAL_STATUS_FAILURE;
6202 }
6203
6204 return eHAL_STATUS_SUCCESS;
6205}
6206
Jeff Johnsone7245742012-09-05 17:12:55 -07006207eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6208 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006209{
6210 tpSirRcvPktFilterCfgType pRequestBuf;
6211 v_SINT_t allocSize;
6212 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006213 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6214 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006215 v_U8_t idx=0;
6216
6217 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006218 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006219 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6220
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006221 allocSize = sizeof(tSirRcvPktFilterCfgType);
6222
Jeff Johnson295189b2012-06-20 16:38:30 -07006223 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006224
6225 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006226 {
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 Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006229 return eHAL_STATUS_FAILED_ALLOC;
6230 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006231
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006232 if( NULL == pSession )
6233 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006234 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006235 vos_mem_free(pRequestBuf);
6236 return eHAL_STATUS_FAILURE;
6237 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006238
6239 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6240 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006241 sizeof(tSirMacAddr));
6242
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006243 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6244
Jeff Johnson295189b2012-06-20 16:38:30 -07006245 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6246 msg.reserved = 0;
6247 msg.bodyptr = pRequestBuf;
6248
6249 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6250 "FT %d FID %d ",
6251 pRequestBuf->filterType, pRequestBuf->filterId);
6252
6253 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6254 "params %d CT %d",
6255 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6256
6257 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6258 {
6259
6260 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006261 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006262 pRequestBuf->paramsData[idx].protocolLayer,
6263 pRequestBuf->paramsData[idx].cmpFlag);
6264
6265 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006266 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006267 pRequestBuf->paramsData[idx].dataOffset,
6268 pRequestBuf->paramsData[idx].dataLength);
6269
6270 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006271 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006272 pRequestBuf->paramsData[idx].compareData[0],
6273 pRequestBuf->paramsData[idx].compareData[1],
6274 pRequestBuf->paramsData[idx].compareData[2],
6275 pRequestBuf->paramsData[idx].compareData[3],
6276 pRequestBuf->paramsData[idx].compareData[4],
6277 pRequestBuf->paramsData[idx].compareData[5]);
6278
6279 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006280 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006281 pRequestBuf->paramsData[idx].dataMask[0],
6282 pRequestBuf->paramsData[idx].dataMask[1],
6283 pRequestBuf->paramsData[idx].dataMask[2],
6284 pRequestBuf->paramsData[idx].dataMask[3],
6285 pRequestBuf->paramsData[idx].dataMask[4],
6286 pRequestBuf->paramsData[idx].dataMask[5]);
6287
6288 }
6289
6290 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6291 {
6292 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006293 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006294 vos_mem_free(pRequestBuf);
6295 return eHAL_STATUS_FAILURE;
6296 }
6297
6298 return eHAL_STATUS_SUCCESS;
6299}
6300
6301eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6302 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006303 void *callbackContext,
6304 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006305{
6306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6307 eHalStatus status;
6308
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006309 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006310
6311 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6312 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006313 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006314 sme_ReleaseGlobalLock( &pMac->sme );
6315 }
6316
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006317 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006318
6319 return (status);
6320}
6321
Jeff Johnsone7245742012-09-05 17:12:55 -07006322eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6323 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006324{
6325 tpSirRcvFltPktClearParam pRequestBuf;
6326 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006327 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6328 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006329
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006330 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006331 pRcvFltPktClearParam->filterId);
6332
6333 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006334 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006335 {
6336 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6337 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006338 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006339 return eHAL_STATUS_FAILED_ALLOC;
6340 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006341 if( NULL == pSession )
6342 {
6343 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006344 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006345 vos_mem_free(pRequestBuf);
6346 return eHAL_STATUS_FAILURE;
6347 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006348
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006349 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6350 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006351 sizeof(tSirMacAddr));
6352
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006353 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6354
Jeff Johnson295189b2012-06-20 16:38:30 -07006355 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6356 msg.reserved = 0;
6357 msg.bodyptr = pRequestBuf;
6358 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6359 {
6360 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006361 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006362 vos_mem_free(pRequestBuf);
6363 return eHAL_STATUS_FAILURE;
6364 }
6365
6366 return eHAL_STATUS_SUCCESS;
6367}
6368#endif // WLAN_FEATURE_PACKET_FILTERING
6369
6370/* ---------------------------------------------------------------------------
6371 \fn sme_PreChannelSwitchIndFullPowerCB
6372 \brief call back function for the PMC full power request because of pre
6373 channel switch.
6374 \param callbackContext
6375 \param status
6376 ---------------------------------------------------------------------------*/
6377void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6378 eHalStatus status)
6379{
6380 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6381 tSirMbMsg *pMsg;
6382 tANI_U16 msgLen;
6383
6384 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6385 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6386 if(HAL_STATUS_SUCCESS(status))
6387 {
6388 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6389 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6390 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6391 status = palSendMBMessage(pMac->hHdd, pMsg);
6392 }
6393
6394 return;
6395}
6396
6397/* ---------------------------------------------------------------------------
6398 \fn sme_HandlePreChannelSwitchInd
6399 \brief Processes the indcation from PE for pre-channel switch.
6400 \param hHal
6401 \- The handle returned by macOpen. return eHalStatus
6402 ---------------------------------------------------------------------------*/
6403eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6404{
6405 eHalStatus status = eHAL_STATUS_FAILURE;
6406 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6407 status = sme_AcquireGlobalLock( &pMac->sme );
6408 if ( HAL_STATUS_SUCCESS( status ) )
6409 {
6410 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6411 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6412 sme_ReleaseGlobalLock( &pMac->sme );
6413 }
6414
6415 return (status);
6416}
6417
6418/* ---------------------------------------------------------------------------
6419 \fn sme_HandlePostChannelSwitchInd
6420 \brief Processes the indcation from PE for post-channel switch.
6421 \param hHal
6422 \- The handle returned by macOpen. return eHalStatus
6423 ---------------------------------------------------------------------------*/
6424eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6425{
6426 eHalStatus status = eHAL_STATUS_FAILURE;
6427 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6428
6429 status = sme_AcquireGlobalLock( &pMac->sme );
6430 if ( HAL_STATUS_SUCCESS( status ) )
6431 {
6432 status = pmcRequestBmps(hHal, NULL, NULL);
6433 sme_ReleaseGlobalLock( &pMac->sme );
6434 }
6435
6436 return (status);
6437}
6438
6439/* ---------------------------------------------------------------------------
6440
6441 \fn sme_IsChannelValid
6442
6443 \brief To check if the channel is valid for currently established domain
6444 This is a synchronous API.
6445
6446 \param hHal - The handle returned by macOpen.
6447 \param channel - channel to verify
6448
6449 \return TRUE/FALSE, TRUE if channel is valid
6450
6451 -------------------------------------------------------------------------------*/
6452tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6453{
6454 eHalStatus status = eHAL_STATUS_FAILURE;
6455 tANI_BOOLEAN valid = FALSE;
6456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6457
6458 status = sme_AcquireGlobalLock( &pMac->sme );
6459 if ( HAL_STATUS_SUCCESS( status ) )
6460 {
6461
6462 valid = csrRoamIsChannelValid( pMac, channel);
6463
6464 sme_ReleaseGlobalLock( &pMac->sme );
6465 }
6466
6467 return (valid);
6468}
6469
6470/* ---------------------------------------------------------------------------
6471 \fn sme_SetFreqBand
6472 \brief Used to set frequency band.
6473 \param hHal
6474 \eBand band value to be configured
6475 \- return eHalStatus
6476 -------------------------------------------------------------------------*/
6477eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
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 = csrSetBand(hHal, eBand);
6486 sme_ReleaseGlobalLock( &pMac->sme );
6487 }
6488 return status;
6489}
6490
6491/* ---------------------------------------------------------------------------
6492 \fn sme_GetFreqBand
6493 \brief Used to get the current band settings.
6494 \param hHal
6495 \pBand pointer to hold band value
6496 \- return eHalStatus
6497 -------------------------------------------------------------------------*/
6498eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
6499{
6500 eHalStatus status = eHAL_STATUS_FAILURE;
6501 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6502
6503 status = sme_AcquireGlobalLock( &pMac->sme );
6504 if ( HAL_STATUS_SUCCESS( status ) )
6505 {
6506 *pBand = csrGetCurrentBand( hHal );
6507 sme_ReleaseGlobalLock( &pMac->sme );
6508 }
6509 return status;
6510}
6511
6512#ifdef WLAN_WAKEUP_EVENTS
6513/******************************************************************************
6514 \fn sme_WakeReasonIndCallback
6515
6516 \brief
6517 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
6518
6519 \param hHal - HAL handle for device
6520 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
6521
6522 \return eHalStatus
6523******************************************************************************/
6524eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
6525{
6526 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6527 eHalStatus status = eHAL_STATUS_SUCCESS;
6528 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
6529
6530 if (NULL == pMsg)
6531 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006532 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006533 status = eHAL_STATUS_FAILURE;
6534 }
6535 else
6536 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006537 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07006538
6539 /* Call Wake Reason Indication callback routine. */
6540 if (pMac->pmc.wakeReasonIndCB != NULL)
6541 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
6542
6543 pMac->pmc.wakeReasonIndCB = NULL;
6544 pMac->pmc.wakeReasonIndCBContext = NULL;
6545
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006546 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07006547 }
6548
6549 return(status);
6550}
6551#endif // WLAN_WAKEUP_EVENTS
6552
6553
6554/* ---------------------------------------------------------------------------
6555
6556 \fn sme_SetMaxTxPower
6557
6558 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
6559 not persist over reboots.
6560
6561 \param hHal
6562 \param pBssid BSSID to set the power cap for
6563 \param pBssid pSelfMacAddress self MAC Address
6564 \param pBssid power to set in dB
6565 \- return eHalStatus
6566
6567 -------------------------------------------------------------------------------*/
6568eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
6569 tSirMacAddr pSelfMacAddress, v_S7_t dB)
6570{
6571 vos_msg_t msg;
6572 tpMaxTxPowerParams pMaxTxParams = NULL;
6573
6574 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
6575 if (NULL == pMaxTxParams)
6576 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006577 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 -07006578 return eHAL_STATUS_FAILURE;
6579 }
6580
6581 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
6582 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
6583 SIR_MAC_ADDR_LENGTH);
6584 pMaxTxParams->power = dB;
6585
6586 msg.type = WDA_SET_MAX_TX_POWER_REQ;
6587 msg.reserved = 0;
6588 msg.bodyptr = pMaxTxParams;
6589
6590 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6591 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006592 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 -07006593 vos_mem_free(pMaxTxParams);
6594 return eHAL_STATUS_FAILURE;
6595 }
6596
6597 return eHAL_STATUS_SUCCESS;
6598}
6599
Jeff Johnson295189b2012-06-20 16:38:30 -07006600/* ---------------------------------------------------------------------------
6601
6602 \fn sme_HideSSID
6603
6604 \brief hide/show SSID dynamically. Note: this setting will
6605 not persist over reboots.
6606
6607 \param hHal
6608 \param sessionId
6609 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
6610 \- return eHalStatus
6611
6612 -------------------------------------------------------------------------------*/
6613eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
6614{
6615 eHalStatus status = eHAL_STATUS_SUCCESS;
6616 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6617 tANI_U16 len;
6618
6619 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6620 {
6621 tpSirUpdateParams pMsg;
6622 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006623
6624 if(!pSession)
6625 {
6626 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006627 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006628 return eHAL_STATUS_FAILURE;
6629 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006630
6631 if( !pSession->sessionActive )
6632 VOS_ASSERT(0);
6633
6634 /* Create the message and send to lim */
6635 len = sizeof(tSirUpdateParams);
6636 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
6637 if(HAL_STATUS_SUCCESS(status))
6638 {
6639 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
6640 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
6641 pMsg->length = len;
6642 /* Data starts from here */
6643 pMsg->sessionId = sessionId;
6644 pMsg->ssidHidden = ssidHidden;
6645 status = palSendMBMessage(pMac->hHdd, pMsg);
6646 }
6647 sme_ReleaseGlobalLock( &pMac->sme );
6648 }
6649 return status;
6650}
Jeff Johnson295189b2012-06-20 16:38:30 -07006651
6652/* ---------------------------------------------------------------------------
6653
6654 \fn sme_SetTmLevel
6655 \brief Set Thermal Mitigation Level to RIVA
6656 \param hHal - The handle returned by macOpen.
6657 \param newTMLevel - new Thermal Mitigation Level
6658 \param tmMode - Thermal Mitigation handle mode, default 0
6659 \return eHalStatus
6660 ---------------------------------------------------------------------------*/
6661eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
6662{
6663 eHalStatus status = eHAL_STATUS_SUCCESS;
6664 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6665 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6666 vos_msg_t vosMessage;
6667 tAniSetTmLevelReq *setTmLevelReq = NULL;
6668
6669 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6670 {
6671 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
6672 if(NULL == setTmLevelReq)
6673 {
6674 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006675 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006676 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07006677 return eHAL_STATUS_FAILURE;
6678 }
6679
6680 setTmLevelReq->tmMode = tmMode;
6681 setTmLevelReq->newTmLevel = newTMLevel;
6682
6683 /* serialize the req through MC thread */
6684 vosMessage.bodyptr = setTmLevelReq;
6685 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
6686 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6687 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6688 {
6689 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006690 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006691 vos_mem_free(setTmLevelReq);
6692 status = eHAL_STATUS_FAILURE;
6693 }
6694 sme_ReleaseGlobalLock( &pMac->sme );
6695 }
6696 return(status);
6697}
6698
6699/*---------------------------------------------------------------------------
6700
6701 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
6702 Host and FW.
6703
6704 \param hHal - HAL handle for device
6705
6706 \return NONE
6707
6708---------------------------------------------------------------------------*/
6709void sme_featureCapsExchange( tHalHandle hHal)
6710{
6711 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6712 WDA_featureCapsExchange(vosContext);
6713}
Jeff Johnsond13512a2012-07-17 11:42:19 -07006714
Yathish9f22e662012-12-10 14:21:35 -08006715/*---------------------------------------------------------------------------
6716
6717 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
6718 in Host.
6719
6720 \param hHal - HAL handle for device
6721
6722 \return NONE
6723
6724---------------------------------------------------------------------------*/
6725void sme_disableFeatureCapablity(tANI_U8 feature_index)
6726{
6727 WDA_disableCapablityFeature(feature_index);
6728}
6729
6730
Jeff Johnsond13512a2012-07-17 11:42:19 -07006731
6732/* ---------------------------------------------------------------------------
6733
6734 \fn sme_GetDefaultCountryCode
6735
6736 \brief Get the default country code from NV
6737
6738 \param hHal
6739 \param pCountry
6740 \- return eHalStatus
6741
6742 -------------------------------------------------------------------------------*/
6743eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
6744{
6745 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6746 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
6747}
6748
6749/* ---------------------------------------------------------------------------
6750
6751 \fn sme_GetCurrentCountryCode
6752
6753 \brief Get the current country code
6754
6755 \param hHal
6756 \param pCountry
6757 \- return eHalStatus
6758
6759 -------------------------------------------------------------------------------*/
6760eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
6761{
6762 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6763 return csrGetCurrentCountryCode(pMac, pCountry);
6764}
6765
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006766/* ---------------------------------------------------------------------------
6767 \fn sme_transportDebug
6768 \brief Dynamically monitoring Transport channels
6769 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07006770 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08006771 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006772 \param toggleStallDetect Enable stall detect feature
6773 This feature will take effect to data performance
6774 Not integrate till fully verification
6775 \- return NONE
6776 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07006777void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006778{
schang6295e542013-03-12 15:31:23 -07006779 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6780
6781 if (NULL == pMac)
6782 {
6783 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6784 "%s: invalid context", __func__);
6785 return;
6786 }
6787 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07006788}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006789
Kiran4a17ebe2013-01-31 10:43:43 -08006790/* ---------------------------------------------------------------------------
6791 \fn sme_ResetPowerValuesFor5G
6792 \brief Reset the power values for 5G band with NV power values.
6793 \param hHal - HAL handle for device
6794 \- return NONE
6795 -------------------------------------------------------------------------*/
6796void sme_ResetPowerValuesFor5G (tHalHandle hHal)
6797{
6798 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
6799 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
6800 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
6801}
6802
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006803#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
6804/* ---------------------------------------------------------------------------
6805 \fn sme_UpdateRoamPrefer5GHz
6806 \brief enable/disable Roam prefer 5G runtime option
6807 This function is called through dynamic setConfig callback function
6808 to configure the Roam prefer 5G runtime option
6809 \param hHal - HAL handle for device
6810 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
6811 \- return Success or failure
6812 -------------------------------------------------------------------------*/
6813
6814eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
6815{
6816 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006817 eHalStatus status = eHAL_STATUS_SUCCESS;
6818
6819 status = sme_AcquireGlobalLock( &pMac->sme );
6820 if ( HAL_STATUS_SUCCESS( status ) )
6821 {
6822 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6823 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
6824 pMac->roam.configParam.nRoamPrefer5GHz,
6825 nRoamPrefer5GHz);
6826 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
6827 sme_ReleaseGlobalLock( &pMac->sme );
6828 }
6829
6830 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006831}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006832
6833/* ---------------------------------------------------------------------------
6834 \fn sme_UpdateImmediateRoamRssiDiff
6835 \brief Update nImmediateRoamRssiDiff
6836 This function is called through dynamic setConfig callback function
6837 to configure nImmediateRoamRssiDiff
6838 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
6839 \param hHal - HAL handle for device
6840 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
6841 candidate and current AP.
6842 \- return Success or failure
6843 -------------------------------------------------------------------------*/
6844
6845eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
6846{
6847 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006848 eHalStatus status = eHAL_STATUS_SUCCESS;
6849
6850 status = sme_AcquireGlobalLock( &pMac->sme );
6851 if ( HAL_STATUS_SUCCESS( status ) )
6852 {
6853 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
6854 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
6855 nImmediateRoamRssiDiff,
6856 pMac->roam.configParam.nImmediateRoamRssiDiff,
6857 pMac->roam.neighborRoamInfo.neighborRoamState);
6858 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
6859 sme_ReleaseGlobalLock( &pMac->sme );
6860 }
6861
6862 return status ;
6863}
6864
6865/* ---------------------------------------------------------------------------
6866 \fn sme_UpdateRoamRssiDiff
6867 \brief Update RoamRssiDiff
6868 This function is called through dynamic setConfig callback function
6869 to configure RoamRssiDiff
6870 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
6871 \param hHal - HAL handle for device
6872 \param RoamRssiDiff - minimum rssi difference between potential
6873 candidate and current AP.
6874 \- return Success or failure
6875 -------------------------------------------------------------------------*/
6876
6877eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
6878{
6879 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6880 eHalStatus status = eHAL_STATUS_SUCCESS;
6881
6882 status = sme_AcquireGlobalLock( &pMac->sme );
6883 if ( HAL_STATUS_SUCCESS( status ) )
6884 {
6885 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
6886 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
6887 RoamRssiDiff,
6888 pMac->roam.configParam.RoamRssiDiff,
6889 pMac->roam.neighborRoamInfo.neighborRoamState);
6890 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
6891 sme_ReleaseGlobalLock( &pMac->sme );
6892 }
6893
6894 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006895}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006896
6897/*--------------------------------------------------------------------------
6898 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
6899 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
6900 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08006901 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006902 \param hHal - The handle returned by macOpen.
6903 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
6904 Other status means SME is failed to update isFastTransitionEnabled.
6905 \sa
6906 --------------------------------------------------------------------------*/
6907eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
6908 v_BOOL_t isFastTransitionEnabled)
6909{
6910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006911 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006912
Srinivas Girigowdade697412013-02-14 16:31:48 -08006913 status = sme_AcquireGlobalLock( &pMac->sme );
6914 if ( HAL_STATUS_SUCCESS( status ) )
6915 {
6916 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6917 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
6918 pMac->roam.configParam.isFastTransitionEnabled,
6919 isFastTransitionEnabled);
6920 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
6921 sme_ReleaseGlobalLock( &pMac->sme );
6922 }
6923
6924 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006925}
6926#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
6927
6928#ifdef FEATURE_WLAN_LFR
6929/*--------------------------------------------------------------------------
6930 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
6931 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
6932 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08006933 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006934 \param hHal - The handle returned by macOpen.
6935 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
6936 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
6937 \sa
6938 --------------------------------------------------------------------------*/
6939eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
6940 v_BOOL_t isFastRoamIniFeatureEnabled)
6941{
6942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6943
Srinivas Girigowdade697412013-02-14 16:31:48 -08006944 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6945 "%s: FastRoamEnabled is changed from %d to %d", __func__,
6946 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
6947 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006948 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
6949
6950 if(TRUE == isFastRoamIniFeatureEnabled)
6951 {
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006952 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
6953 }
6954 else
6955 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08006956 /* CCX also depend on FW Monitoring.
6957 Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006958#ifdef FEATURE_WLAN_CCX
6959 if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006960#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006961 {
6962 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Srinivas Girigowdade697412013-02-14 16:31:48 -08006963 "%s: Turn off FW Monitoring", __func__);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006964 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
6965 }
6966 }
6967
6968 return eHAL_STATUS_SUCCESS;
6969}
6970#endif /* FEATURE_WLAN_LFR */
6971
6972#ifdef FEATURE_WLAN_CCX
6973/*--------------------------------------------------------------------------
6974 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
6975 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
6976 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08006977 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006978 \param hHal - The handle returned by macOpen.
6979 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
6980 Other status means SME is failed to update isCcxIniFeatureEnabled.
6981 \sa
6982 --------------------------------------------------------------------------*/
6983
6984eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
6985 v_BOOL_t isCcxIniFeatureEnabled)
6986{
6987 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6988
Srinivas Girigowdade697412013-02-14 16:31:48 -08006989 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6990 "%s: CcxEnabled is changed from %d to %d", __func__,
6991 pMac->roam.configParam.isCcxIniFeatureEnabled,
6992 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08006993 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
6994
6995 if(TRUE == isCcxIniFeatureEnabled)
6996 {
6997 sme_UpdateFastTransitionEnabled(hHal, TRUE);
6998 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
6999 }
7000 else
7001 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007002 /* LFR also depend on FW Monitoring.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007003 Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */
7004#ifdef FEATURE_WLAN_LFR
7005 if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled)
7006#endif
7007 {
7008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7009 "%s: Turn off FW Monitoring/Fast Transition", __func__);
7010 sme_UpdateFastTransitionEnabled(hHal, FALSE);
7011 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7012 }
7013 }
7014 return eHAL_STATUS_SUCCESS;
7015}
7016#endif /* FEATURE_WLAN_CCX */
7017
7018/*--------------------------------------------------------------------------
7019 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7020 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7021 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007022 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007023 \param hHal - The handle returned by macOpen.
7024 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7025 Other status means SME is failed to update fEnableFwRssiMonitoring.
7026 \sa
7027 --------------------------------------------------------------------------*/
7028
7029eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7030 v_BOOL_t fEnableFwRssiMonitoring)
7031{
7032 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7033
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007034 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7035 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7036 {
7037 halStatus = eHAL_STATUS_FAILURE;
7038 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007039 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007040 }
7041
7042 return (halStatus);
7043}
7044
Srinivas Girigowdade697412013-02-14 16:31:48 -08007045/*--------------------------------------------------------------------------
7046 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7047 This is a synchronous call
7048 \param hHal - The handle returned by macOpen.
7049 \return eHAL_STATUS_SUCCESS - SME update config successful.
7050 Other status means SME is failed to update
7051 \sa
7052 --------------------------------------------------------------------------*/
7053eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7054 v_U8_t neighborLookupRssiThreshold)
7055{
7056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7057 eHalStatus status = eHAL_STATUS_SUCCESS;
7058
7059 status = sme_AcquireGlobalLock( &pMac->sme );
7060 if ( HAL_STATUS_SUCCESS( status ) )
7061 {
7062 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7063 if (HAL_STATUS_SUCCESS(status))
7064 {
7065 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7066 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7067 neighborLookupRssiThreshold,
7068 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7069 pMac->roam.neighborRoamInfo.neighborRoamState);
7070 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7071 neighborLookupRssiThreshold;
7072 }
7073 sme_ReleaseGlobalLock( &pMac->sme );
7074 }
7075
7076 return status;
7077}
7078
7079/*--------------------------------------------------------------------------
7080 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
7081 This is a synchronous call
7082 \param hHal - The handle returned by macOpen.
7083 \return eHAL_STATUS_SUCCESS - SME update config successful.
7084 Other status means SME is failed to update
7085 \sa
7086 --------------------------------------------------------------------------*/
7087eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
7088 v_U8_t neighborReassocRssiThreshold)
7089{
7090 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7091 eHalStatus status = eHAL_STATUS_SUCCESS;
7092
7093 status = sme_AcquireGlobalLock( &pMac->sme );
7094 if ( HAL_STATUS_SUCCESS( status ) )
7095 {
7096 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7097 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7098 neighborReassocRssiThreshold,
7099 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7100 pMac->roam.neighborRoamInfo.neighborRoamState);
7101 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7102 neighborReassocRssiThreshold;
7103 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7104 neighborReassocRssiThreshold;
7105 sme_ReleaseGlobalLock( &pMac->sme );
7106 }
7107
7108 return status ;
7109}
7110
7111
7112/*--------------------------------------------------------------------------
7113 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7114 This is a synchronous call
7115 \param hHal - The handle returned by macOpen.
7116 \return eHAL_STATUS_SUCCESS - SME update config successful.
7117 Other status means SME is failed to update
7118 \sa
7119 --------------------------------------------------------------------------*/
7120v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7121{
7122 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7123 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7124}
7125
7126/*--------------------------------------------------------------------------
7127 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7128 This is a synchronous call
7129 \param hHal - The handle returned by macOpen.
7130 \return eHAL_STATUS_SUCCESS - SME update config successful.
7131 Other status means SME is failed to update
7132 \sa
7133 --------------------------------------------------------------------------*/
7134eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7135 v_U16_t neighborScanResultsRefreshPeriod)
7136{
7137 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7138 eHalStatus status = eHAL_STATUS_SUCCESS;
7139
7140 status = sme_AcquireGlobalLock( &pMac->sme );
7141 if ( HAL_STATUS_SUCCESS( status ) )
7142 {
7143 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7144 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7145 neighborScanResultsRefreshPeriod,
7146 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7147 pMac->roam.neighborRoamInfo.neighborRoamState);
7148 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7149 neighborScanResultsRefreshPeriod;
7150 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7151 neighborScanResultsRefreshPeriod;
7152
7153 sme_ReleaseGlobalLock( &pMac->sme );
7154 }
7155
7156 return status ;
7157}
7158
7159/*--------------------------------------------------------------------------
7160 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7161 This is a synchronous call
7162 \param hHal - The handle returned by macOpen.
7163 \return v_U16_t - Neighbor scan results refresh period value
7164 \sa
7165 --------------------------------------------------------------------------*/
7166v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7167{
7168 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7169 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7170}
7171
7172/*--------------------------------------------------------------------------
7173 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7174 This is a synchronuous call
7175 \param hHal - The handle returned by macOpen.
7176 \return eHAL_STATUS_SUCCESS - SME update config successful.
7177 Other status means SME is failed to update
7178 \sa
7179 --------------------------------------------------------------------------*/
7180v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7181{
7182 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7183 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7184}
7185
7186#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
7187/*--------------------------------------------------------------------------
7188 \brief sme_getRoamRssiDiff() - get Roam rssi diff
7189 This is a synchronous call
7190 \param hHal - The handle returned by macOpen.
7191 \return v_U16_t - Rssi diff value
7192 \sa
7193 --------------------------------------------------------------------------*/
7194v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
7195{
7196 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7197 return pMac->roam.configParam.RoamRssiDiff;
7198}
7199
7200/*--------------------------------------------------------------------------
7201 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
7202 This is a synchronous call
7203 \param hHal - The handle returned by macOpen.
7204 \return eHAL_STATUS_SUCCESS - SME update config successful.
7205 Other status means SME is failed to update
7206 \sa
7207 --------------------------------------------------------------------------*/
7208eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7209 tANI_U8 numChannels)
7210{
7211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7212 eHalStatus status = eHAL_STATUS_SUCCESS;
7213 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7214 tANI_U8 oldChannelList[128] = {0};
7215 tANI_U8 newChannelList[128] = {0};
7216 tANI_U8 i = 0, j = 0;
7217
7218 status = sme_AcquireGlobalLock( &pMac->sme );
7219 if ( HAL_STATUS_SUCCESS( status ) )
7220 {
7221 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7222 {
7223 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7224 {
7225 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
7226 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7227 }
7228 }
7229 csrFlushAndCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
7230 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
7231
7232 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7233 {
7234 j = 0;
7235 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7236 {
7237 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
7238 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7239 }
7240 }
7241
7242 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7243 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
7244 newChannelList, oldChannelList,
7245 pMac->roam.neighborRoamInfo.neighborRoamState);
7246 sme_ReleaseGlobalLock( &pMac->sme );
7247 }
7248
7249 return status ;
7250}
7251
7252/*--------------------------------------------------------------------------
7253 \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list
7254 based on country revision number
7255 This is a synchronous call
7256 \param hHal - The handle returned by macOpen.
7257 \return eHAL_STATUS_SUCCESS - SME update config successful.
7258 Other status means SME is failed to update
7259 \sa
7260 --------------------------------------------------------------------------*/
7261eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal,
7262 tANI_U8 Revision)
7263{
7264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7265 eHalStatus status = eHAL_STATUS_SUCCESS;
7266
7267 status = sme_AcquireGlobalLock( &pMac->sme );
7268 if ( HAL_STATUS_SUCCESS( status ) )
7269 {
7270 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7271 "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d",
7272 "KR", Revision, "KR",
7273 pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision,
7274 pMac->roam.neighborRoamInfo.neighborRoamState);
7275 csr_SetRevision(pMac, Revision);
7276 csrInitCountryValidChannelList(pMac, Revision);
7277 sme_ReleaseGlobalLock( &pMac->sme );
7278 }
7279
7280 return status ;
7281}
7282
7283
7284/*--------------------------------------------------------------------------
7285 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
7286 This is a synchronous call
7287 \param hHal - The handle returned by macOpen.
7288 \return eHAL_STATUS_SUCCESS - SME update config successful.
7289 Other status means SME is failed to update
7290 \sa
7291 --------------------------------------------------------------------------*/
7292eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
7293 eCsrBand eBand)
7294{
7295 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7296 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
7297}
7298
7299/*--------------------------------------------------------------------------
7300 \brief sme_getRoamScanChannelList() - get roam scan channel list
7301 This is a synchronous call
7302 \param hHal - The handle returned by macOpen.
7303 \return eHAL_STATUS_SUCCESS - SME update config successful.
7304 Other status means SME is failed to update
7305 \sa
7306 --------------------------------------------------------------------------*/
7307eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7308 tANI_U8 *pNumChannels)
7309{
7310 int i = 0;
7311 tANI_U8 *pOutPtr = pChannelList;
7312 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7313 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7314 eHalStatus status = eHAL_STATUS_SUCCESS;
7315
7316 status = sme_AcquireGlobalLock( &pMac->sme );
7317 if ( HAL_STATUS_SUCCESS( status ) )
7318 {
7319 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7320 {
7321 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
7322 "Roam Scan channel list is NOT yet initialized");
7323 sme_ReleaseGlobalLock( &pMac->sme );
7324 return eHAL_STATUS_NOT_INITIALIZED;
7325 }
7326
7327 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
7328 for (i = 0; i < (*pNumChannels); i++)
7329 {
7330 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
7331 }
7332 pOutPtr[i] = '\0';
7333 sme_ReleaseGlobalLock( &pMac->sme );
7334 }
7335
7336 return status ;
7337}
7338
7339/*--------------------------------------------------------------------------
7340 \brief sme_GetCountryRevision() - get Country revision index
7341 This is a synchronous call
7342 \param hHal - The handle returned by macOpen.
7343 \return eHAL_STATUS_SUCCESS - SME update config successful.
7344 Other status means SME is failed to update
7345 \sa
7346 --------------------------------------------------------------------------*/
7347eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision)
7348{
7349 /* this is valid for Country KR only now */
7350 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7351 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7352 eHalStatus status = eHAL_STATUS_SUCCESS;
7353
7354 *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision;
7355
7356 return status;
7357}
7358
7359#endif
7360
7361/* ---------------------------------------------------------------------------
7362 \fn sme_UpdateEmptyScanRefreshPeriod
7363 \brief Update nEmptyScanRefreshPeriod
7364 This function is called through dynamic setConfig callback function
7365 to configure nEmptyScanRefreshPeriod
7366 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7367 \param hHal - HAL handle for device
7368 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7369 \- return Success or failure
7370 -------------------------------------------------------------------------*/
7371
7372eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
7373{
7374 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7375 eHalStatus status = eHAL_STATUS_SUCCESS;
7376
7377 status = sme_AcquireGlobalLock( &pMac->sme );
7378 if ( HAL_STATUS_SUCCESS( status ) )
7379 {
7380 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7381 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
7382 nEmptyScanRefreshPeriod,
7383 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
7384 pMac->roam.neighborRoamInfo.neighborRoamState);
7385 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7386 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7387 sme_ReleaseGlobalLock( &pMac->sme );
7388 }
7389
7390 return status ;
7391
7392}
7393
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007394
7395
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007396/* ---------------------------------------------------------------------------
7397 \fn sme_IsFeatureSupportedByFW
7398 \brief Check if an feature is enabled by FW
7399
7400 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
7401 \- return 1/0 (TRUE/FALSE)
7402 -------------------------------------------------------------------------*/
7403tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
7404{
7405 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
7406}
7407#ifdef FEATURE_WLAN_TDLS
7408/* ---------------------------------------------------------------------------
7409 \fn sme_SendTdlsMgmtFrame
7410 \brief API to send TDLS management frames.
7411
7412 \param peerMac - peer's Mac Adress.
7413 \param frame_type - Type of TDLS mgmt frame to be sent.
7414 \param dialog - dialog token used in the frame.
7415 \param status - status to be incuded in the frame.
7416 \param buf - additional IEs to be included
7417 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08007418 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007419 \- return VOS_STATUS_SUCCES
7420 -------------------------------------------------------------------------*/
7421VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08007422 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 -08007423{
7424 eHalStatus status = eHAL_STATUS_SUCCESS;
7425 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
7426 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7427
7428 status = sme_AcquireGlobalLock( &pMac->sme );
7429 if ( HAL_STATUS_SUCCESS( status ) )
7430 {
7431 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7432 sendTdlsReq.frameType = frame_type;
7433 sendTdlsReq.buf = buf;
7434 sendTdlsReq.len = len;
7435 sendTdlsReq.dialog = dialog;
7436 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08007437 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007438
7439 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
7440
7441 sme_ReleaseGlobalLock( &pMac->sme );
7442 }
7443
7444 return status ;
7445
7446}
7447/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08007448 \fn sme_ChangeTdlsPeerSta
7449 \brief API to Update TDLS peer sta parameters.
7450
7451 \param peerMac - peer's Mac Adress.
7452 \param staParams - Peer Station Parameters
7453 \- return VOS_STATUS_SUCCES
7454 -------------------------------------------------------------------------*/
7455VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
7456 tCsrStaParams *pstaParams)
7457{
7458 eHalStatus status = eHAL_STATUS_SUCCESS;
7459 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7460
7461 status = sme_AcquireGlobalLock( &pMac->sme );
7462 if ( HAL_STATUS_SUCCESS( status ) )
7463 {
7464 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
7465
7466 sme_ReleaseGlobalLock( &pMac->sme );
7467 }
7468
7469 return status ;
7470
7471}
7472
7473/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007474 \fn sme_AddTdlsPeerSta
7475 \brief API to Add TDLS peer sta entry.
7476
7477 \param peerMac - peer's Mac Adress.
7478 \- return VOS_STATUS_SUCCES
7479 -------------------------------------------------------------------------*/
7480VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7481{
7482 eHalStatus status = eHAL_STATUS_SUCCESS;
7483 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7484
7485 status = sme_AcquireGlobalLock( &pMac->sme );
7486 if ( HAL_STATUS_SUCCESS( status ) )
7487 {
7488 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
7489
7490 sme_ReleaseGlobalLock( &pMac->sme );
7491 }
7492
7493 return status ;
7494
7495}
7496/* ---------------------------------------------------------------------------
7497 \fn sme_DeleteTdlsPeerSta
7498 \brief API to Delete TDLS peer sta entry.
7499
7500 \param peerMac - peer's Mac Adress.
7501 \- return VOS_STATUS_SUCCES
7502 -------------------------------------------------------------------------*/
7503VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7504{
7505 eHalStatus status = eHAL_STATUS_SUCCESS;
7506 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7507
7508 status = sme_AcquireGlobalLock( &pMac->sme );
7509 if ( HAL_STATUS_SUCCESS( status ) )
7510 {
7511 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
7512
7513 sme_ReleaseGlobalLock( &pMac->sme );
7514 }
7515
7516 return status ;
7517
7518}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07007519/* ---------------------------------------------------------------------------
7520 \fn sme_IsPmcBmps
7521 \API to Check if PMC state is BMPS.
7522
7523 \- return v_BOOL_t
7524 -------------------------------------------------------------------------*/
7525v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
7526{
7527 return (BMPS == pmcGetPmcState(hHal));
7528}
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07007529/* ---------------------------------------------------------------------------
7530 \fn sme_SetTdlsPowerSaveProhibited
7531 \API to set/reset the isTdlsPowerSaveProhibited.
7532
7533 \- return void
7534 -------------------------------------------------------------------------*/
7535void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
7536{
7537 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7538
7539 pMac->isTdlsPowerSaveProhibited = val;
7540 return;
7541}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007542#endif
7543#ifdef FEATURE_WLAN_TDLS_INTERNAL
7544/*
7545 * SME API to start TDLS discovery Procedure
7546 */
7547VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7548{
7549 VOS_STATUS status = VOS_STATUS_SUCCESS;
7550 tCsrTdlsDisRequest disReq = {{0}} ;
7551 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7552 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
7553
7554 return status ;
7555
7556}
7557
7558/*
7559 * Process TDLS discovery results
7560 */
7561v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
7562 tSmeTdlsDisResult *disResult, v_U8_t listType)
7563{
7564 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
7565 tSirTdlsPeerInfo *peerInfo = NULL ;
7566 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7567 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
7568 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
7569 tListElem *pEntry = NULL ;
7570 v_U8_t peerCnt = 0 ;
7571
7572 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007573 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007574 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
7575 while(pEntry)
7576 {
7577 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
7578 tdlsPeerStaLink) ;
7579 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
7580
7581 switch(listType)
7582 {
7583 case TDLS_SETUP_LIST:
7584 {
7585 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
7586 {
7587 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
7588 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
7589 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
7590 peerCnt++ ;
7591 }
7592 break ;
7593 }
7594 case TDLS_DIS_LIST:
7595 {
7596 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
7597 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
7598 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
7599 peerCnt++ ;
7600 break ;
7601 }
7602 default:
7603 {
7604 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007605 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007606 break ;
7607 }
7608 }
7609
7610 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
7611 }
7612
7613 return peerCnt ;
7614
7615}
7616
7617/*
7618 * SME API to start TDLS link setup Procedure.
7619 */
7620VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7621{
7622 VOS_STATUS status = VOS_STATUS_SUCCESS;
7623 tCsrTdlsSetupRequest setupReq = {{0}} ;
7624 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7625 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
7626 return status ;
7627
7628}
7629
7630/*
7631 * SME API to start TDLS link Teardown Procedure.
7632 */
7633VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
7634{
7635 VOS_STATUS status = VOS_STATUS_SUCCESS;
7636 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
7637 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7638 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
7639 return status ;
7640
7641}
7642
7643#endif /* FEATURE_WLAN_TDLS */
7644