blob: a14ac58dda7602834e0a491adec084bab542d92e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/**=========================================================================
43
44 \file smeApi.c
45
46 \brief Definitions for SME APIs
47
48 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
49
50 Qualcomm Confidential and Proprietary.
51
52 ========================================================================*/
53
54/*===========================================================================
55
56 EDIT HISTORY FOR FILE
57
58
59 This section contains comments describing changes made to the module.
60 Notice that changes are listed in reverse chronological order.
61
62
63
64 when who what, where, why
65---------- --- --------------------------------------------------------
6606/03/10 js Added support to hostapd driven
67 * deauth/disassoc/mic failure
68
69===========================================================================*/
70
71/*--------------------------------------------------------------------------
72 Include Files
73 ------------------------------------------------------------------------*/
74
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76#include "smsDebug.h"
77#include "sme_Api.h"
78#include "csrInsideApi.h"
79#include "smeInside.h"
80#include "csrInternal.h"
81#include "wlan_qct_wda.h"
82#include "halMsgApi.h"
83
Jeff Johnson295189b2012-06-20 16:38:30 -070084#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070085
86
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
89
90#include <wlan_qct_pal_api.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070091
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080092#define READ_MEMORY_DUMP_CMD 9
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080093
Jeff Johnson295189b2012-06-20 16:38:30 -070094// TxMB Functions
95extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
96 tANI_U32 size, tSmeCmd **ppCmd );
97extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
98extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070099extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
100extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
101extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
102extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
103extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700105
106static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
107static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
108
109eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
110
111eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
112
113eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
114
115eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
116
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700117#ifdef FEATURE_WLAN_LFR
118tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
119#endif
120
Chet Lanctot186b5732013-03-18 10:26:30 -0700121#ifdef WLAN_FEATURE_11W
122eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
123 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
124#endif
125
Jeff Johnson295189b2012-06-20 16:38:30 -0700126//Internal SME APIs
127eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
128{
129 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
130
131 if(psSme)
132 {
133 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
134 {
135 status = eHAL_STATUS_SUCCESS;
136 }
137 }
138
139 return (status);
140}
141
142
143eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
144{
145 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
146
147 if(psSme)
148 {
149 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
150 {
151 status = eHAL_STATUS_SUCCESS;
152 }
153 }
154
155 return (status);
156}
157
158
159
160static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
161{
162 eHalStatus status;
163 tSmeCmd *pCmd;
164
165 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
166 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdActiveList)))
167 {
168 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdPendingList)))
169 {
170 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdFreeList)))
171 {
172 status = palAllocateMemory(pMac->hHdd, (void **)&pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
173 if(HAL_STATUS_SUCCESS(status))
174 {
175 tANI_U32 c;
176
177 palZeroMemory(pMac->hHdd, pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
178 pMac->sme.pSmeCmdBufAddr = pCmd;
179 for(c = 0; c < pMac->sme.totalSmeCmd; c++)
180 {
181 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd[c].Link, LL_ACCESS_LOCK);
182 }
183 }
184 }
185 }
186 }
187
188 return (status);
189}
190
191
192void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
193{
194 pCmd->command = eSmeNoCommand;
195 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
196}
197
198
199
200static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
201{
202 tListElem *pEntry;
203 tSmeCmd *pCommand;
204
205 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
206 {
207 //TODO: base on command type to call release functions
208 //reinitialize different command types so they can be reused
209 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
210 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
211 }
212}
213
214static void purgeSmeCmdList(tpAniSirGlobal pMac)
215{
216 //release any out standing commands back to free command list
217 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
218 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
219}
220
221void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
222{
223 //release any out standing commands back to free command list
224 tListElem *pEntry, *pNext;
225 tSmeCmd *pCommand;
226 tDblLinkList *pList = &pMac->sme.smeCmdPendingList;
227 tDblLinkList localList;
228
229 vos_mem_zero(&localList, sizeof(tDblLinkList));
230 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
231 {
232 smsLog(pMac, LOGE, FL(" failed to open list"));
233 return;
234 }
235
236 csrLLLock(pList);
237 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
238 while(pEntry != NULL)
239 {
240 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
241 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
242 if(pCommand->sessionId == sessionId)
243 {
244 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
245 {
246 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
247 }
248 }
249 pEntry = pNext;
250 }
251 csrLLUnlock(pList);
252
253 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
254 {
255 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
256 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
257 }
258 csrLLClose(&localList);
259
260}
261
262
263static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
264{
265 eHalStatus status = eHAL_STATUS_SUCCESS;
266
267 purgeSmeCmdList(pMac);
268 csrLLClose(&pMac->sme.smeCmdPendingList);
269 csrLLClose(&pMac->sme.smeCmdActiveList);
270 csrLLClose(&pMac->sme.smeCmdFreeList);
271
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800272 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
273 if(status != eHAL_STATUS_SUCCESS)
274 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800275 smsLog(pMac, LOGE,
276 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800277 goto done;
278 }
279
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 if(NULL != pMac->sme.pSmeCmdBufAddr)
281 {
282 status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr);
283 pMac->sme.pSmeCmdBufAddr = NULL;
284 }
285
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800286 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
287 if(status != eHAL_STATUS_SUCCESS)
288 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800289 smsLog(pMac, LOGE,
290 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800291 }
292done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 return (status);
294}
295
296
297void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
298{
299#ifdef WLAN_DEBUG
300 switch( pCmd->command )
301 {
302 case eSmeCommandScan:
303 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
304 break;
305
306 case eSmeCommandRoam:
307 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
308 break;
309
310 case eSmeCommandWmStatusChange:
311 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
312 break;
313
314 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800315 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
317 break;
318
319 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800320 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
322 break;
323
324 default:
325 break;
326 }
327#endif //#ifdef WLAN_DEBUG
328}
329
330tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
331{
332 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
333 tListElem *pEntry;
334
335 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
336
337 // If we can get another MS Msg buffer, then we are ok. Just link
338 // the entry onto the linked list. (We are using the linked list
339 // to keep track of tfhe message buffers).
340 if ( pEntry )
341 {
342 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
343 }
344 else {
345 int idx = 1;
346
347 //Cannot change pRetCmd here since it needs to return later.
348 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
349 if( pEntry )
350 {
351 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
352 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800353 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
355 if(pTempCmd)
356 {
357 if( eSmeCsrCommandMask & pTempCmd->command )
358 {
359 //CSR command is stuck. See what the reason code is for that command
360 dumpCsrCommandInfo(pMac, pTempCmd);
361 }
362 } //if(pTempCmd)
363
364 //dump what is in the pending queue
365 csrLLLock(&pMac->sme.smeCmdPendingList);
366 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
367 while(pEntry)
368 {
369 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800370 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 idx++, pTempCmd->command );
372 if( eSmeCsrCommandMask & pTempCmd->command )
373 {
374 //CSR command is stuck. See what the reason code is for that command
375 dumpCsrCommandInfo(pMac, pTempCmd);
376 }
377 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
378 }
379 csrLLUnlock(&pMac->sme.smeCmdPendingList);
380
381 //There may be some more command in CSR's own pending queue
382 csrLLLock(&pMac->roam.roamCmdPendingList);
383 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
384 while(pEntry)
385 {
386 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800387 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 idx++, pTempCmd->command );
389 dumpCsrCommandInfo(pMac, pTempCmd);
390 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
391 }
392 csrLLUnlock(&pMac->roam.roamCmdPendingList);
393 }
394
395 return( pRetCmd );
396}
397
398
399void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
400{
401 if ( fHighPriority )
402 {
403 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
404 }
405 else
406 {
407 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
408 }
409
410 // process the command queue...
411 smeProcessPendingQueue( pMac );
412
413 return;
414}
415
416
417static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
418{
419 eSmeCommandType pmcCommand = eSmeNoCommand;
420 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
421 tPmcState pmcState;
422 eHalStatus status;
423
424 do
425 {
426 pmcState = pmcGetPmcState(pMac);
427
428 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
429 if( !HAL_STATUS_SUCCESS(status) )
430 {
431 //PMC state is not right for the command, drop it
432 return ( eSmeDropCommand );
433 }
434 if( fFullPowerNeeded ) break;
435 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
436 ( eSmeCommandDelTs == pCommand->command ) );
437 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700438#ifdef FEATURE_OEM_DATA_SUPPORT
439 fFullPowerNeeded = (pmcState == IMPS &&
440 eSmeCommandOemDataReq == pCommand->command);
441 if(fFullPowerNeeded) break;
442#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 fFullPowerNeeded = (pmcState == IMPS &&
444 eSmeCommandRemainOnChannel == pCommand->command);
445 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 } while(0);
447
448 if( fFullPowerNeeded )
449 {
450 switch( pmcState )
451 {
452 case IMPS:
453 case STANDBY:
454 pmcCommand = eSmeCommandExitImps;
455 break;
456
457 case BMPS:
458 pmcCommand = eSmeCommandExitBmps;
459 break;
460
461 case UAPSD:
462 pmcCommand = eSmeCommandExitUapsd;
463 break;
464
465 case WOWL:
466 pmcCommand = eSmeCommandExitWowl;
467 break;
468
469 default:
470 break;
471 }
472 }
473
474 return ( pmcCommand );
475}
476
477
478//For commands that need to do extra cleanup.
479static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
480{
481 if( eSmePmcCommandMask & pCommand->command )
482 {
483 pmcAbortCommand( pMac, pCommand, fStopping );
484 }
485 else if ( eSmeCsrCommandMask & pCommand->command )
486 {
487 csrAbortCommand( pMac, pCommand, fStopping );
488 }
489 else
490 {
491 switch( pCommand->command )
492 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eSmeCommandRemainOnChannel:
494 if (NULL != pCommand->u.remainChlCmd.callback)
495 {
496 remainOnChanCallback callback =
497 pCommand->u.remainChlCmd.callback;
498 /* process the msg */
499 if( callback )
500 {
501 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
502 eCSR_SCAN_ABORT );
503 }
504 }
505 smeReleaseCommand( pMac, pCommand );
506 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 default:
508 smeReleaseCommand( pMac, pCommand );
509 break;
510 }
511 }
512}
513
514
515
516tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
517{
518 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
519 eHalStatus status = eHAL_STATUS_SUCCESS;
520 tListElem *pEntry;
521 tSmeCmd *pCommand;
522 eSmeCommandType pmcCommand = eSmeNoCommand;
523
524 // if the ActiveList is empty, then nothing is active so we can process a
525 // pending command...
526 //alwasy lock active list before locking pending list
527 csrLLLock( &pMac->sme.smeCmdActiveList );
528 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
529 {
530 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
531 {
532 //Peek the command
533 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
534 if( pEntry )
535 {
536 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
537 //We cannot execute any command in wait-for-key state until setKey is through.
538 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
539 {
540 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
541 {
542 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800543 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 return ( eANI_BOOLEAN_FALSE );
545 }
546 }
547 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
548 if( eSmeDropCommand == pmcCommand )
549 {
550 //This command is not ok for current PMC state
551 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
552 {
553 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
554 }
555 csrLLUnlock( &pMac->sme.smeCmdActiveList );
556 //tell caller to continue
557 return (eANI_BOOLEAN_TRUE);
558 }
559 else if( eSmeNoCommand != pmcCommand )
560 {
561 tExitBmpsInfo exitBmpsInfo;
562 void *pv = NULL;
563 tANI_U32 size = 0;
564 tSmeCmd *pPmcCmd = NULL;
565
566 if( eSmeCommandExitBmps == pmcCommand )
567 {
568 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
569 pv = (void *)&exitBmpsInfo;
570 size = sizeof(tExitBmpsInfo);
571 }
572 //pmcCommand has to be one of the exit power save command
573 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
574 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
575 {
576 //Force this command to wake up the chip
577 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
578 csrLLUnlock( &pMac->sme.smeCmdActiveList );
579 fContinue = pmcProcessCommand( pMac, pPmcCmd );
580 if( fContinue )
581 {
582 //The command failed, remove it
583 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
584 {
585 pmcReleaseCommand( pMac, pPmcCmd );
586 }
587 }
588 }
589 else
590 {
591 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800592 smsLog( pMac, LOGE, FL( "Cannot issue command(0x%X) to wake up the chip. Status = %d"), pmcCommand, status );
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 //Let it retry
594 fContinue = eANI_BOOLEAN_TRUE;
595 }
596 return fContinue;
597 }
598 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
599 {
600 // we can reuse the pCommand
601
602 // Insert the command onto the ActiveList...
603 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
604
605 // .... and process the command.
606
607 switch ( pCommand->command )
608 {
609
610 case eSmeCommandScan:
611 csrLLUnlock( &pMac->sme.smeCmdActiveList );
612 status = csrProcessScanCommand( pMac, pCommand );
613 break;
614
615 case eSmeCommandRoam:
616 csrLLUnlock( &pMac->sme.smeCmdActiveList );
617 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800618 if(!HAL_STATUS_SUCCESS(status))
619 {
620 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
621 &pCommand->Link, LL_ACCESS_LOCK ) )
622 {
623 csrReleaseCommandRoam( pMac, pCommand );
624 }
625 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 break;
627
628 case eSmeCommandWmStatusChange:
629 csrLLUnlock( &pMac->sme.smeCmdActiveList );
630 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
631 break;
632
633 case eSmeCommandSetKey:
634 csrLLUnlock( &pMac->sme.smeCmdActiveList );
635 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
636 if(!HAL_STATUS_SUCCESS(status))
637 {
638 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
639 &pCommand->Link, LL_ACCESS_LOCK ) )
640 {
641 csrReleaseCommandSetKey( pMac, pCommand );
642 }
643 }
644 break;
645
646 case eSmeCommandRemoveKey:
647 csrLLUnlock( &pMac->sme.smeCmdActiveList );
648 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
649 if(!HAL_STATUS_SUCCESS(status))
650 {
651 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
652 &pCommand->Link, LL_ACCESS_LOCK ) )
653 {
654 csrReleaseCommandRemoveKey( pMac, pCommand );
655 }
656 }
657 break;
658
659 case eSmeCommandAddStaSession:
660 csrLLUnlock( &pMac->sme.smeCmdActiveList );
661 csrProcessAddStaSessionCommand( pMac, pCommand );
662 break;
663 case eSmeCommandDelStaSession:
664 csrLLUnlock( &pMac->sme.smeCmdActiveList );
665 csrProcessDelStaSessionCommand( pMac, pCommand );
666 break;
667
Jeff Johnsone7245742012-09-05 17:12:55 -0700668#ifdef FEATURE_OEM_DATA_SUPPORT
669 case eSmeCommandOemDataReq:
670 csrLLUnlock(&pMac->sme.smeCmdActiveList);
671 oemData_ProcessOemDataReqCommand(pMac, pCommand);
672 break;
673#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case eSmeCommandRemainOnChannel:
675 csrLLUnlock(&pMac->sme.smeCmdActiveList);
676 p2pProcessRemainOnChannelCmd(pMac, pCommand);
677 break;
678 case eSmeCommandNoAUpdate:
679 csrLLUnlock( &pMac->sme.smeCmdActiveList );
680 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case eSmeCommandEnterImps:
682 case eSmeCommandExitImps:
683 case eSmeCommandEnterBmps:
684 case eSmeCommandExitBmps:
685 case eSmeCommandEnterUapsd:
686 case eSmeCommandExitUapsd:
687 case eSmeCommandEnterWowl:
688 case eSmeCommandExitWowl:
689 csrLLUnlock( &pMac->sme.smeCmdActiveList );
690 fContinue = pmcProcessCommand( pMac, pCommand );
691 if( fContinue )
692 {
693 //The command failed, remove it
694 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
695 &pCommand->Link, LL_ACCESS_LOCK ) )
696 {
697 pmcReleaseCommand( pMac, pCommand );
698 }
699 }
700 break;
701
702 //Treat standby differently here because caller may not be able to handle
703 //the failure so we do our best here
704 case eSmeCommandEnterStandby:
705 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
706 {
707 //It can continue
708 csrLLUnlock( &pMac->sme.smeCmdActiveList );
709 fContinue = pmcProcessCommand( pMac, pCommand );
710 if( fContinue )
711 {
712 //The command failed, remove it
713 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
714 &pCommand->Link, LL_ACCESS_LOCK ) )
715 {
716 pmcReleaseCommand( pMac, pCommand );
717 }
718 }
719 }
720 else
721 {
722 //Need to issue a disconnect first before processing this command
723 tSmeCmd *pNewCmd;
724
725 //We need to re-run the command
726 fContinue = eANI_BOOLEAN_TRUE;
727 //Pull off the standby command first
728 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
729 &pCommand->Link, LL_ACCESS_NOLOCK ) )
730 {
731 csrLLUnlock( &pMac->sme.smeCmdActiveList );
732 //Need to call CSR function here because the disconnect command
733 //is handled by CSR
734 pNewCmd = csrGetCommandBuffer( pMac );
735 if( NULL != pNewCmd )
736 {
737 //Put the standby command to the head of the pending list first
738 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
739 LL_ACCESS_LOCK );
740 pNewCmd->command = eSmeCommandRoam;
741 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
742 //Put the disassoc command before the standby command
743 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
744 LL_ACCESS_LOCK );
745 }
746 else
747 {
748 //Continue the command here
749 fContinue = pmcProcessCommand( pMac, pCommand );
750 if( fContinue )
751 {
752 //The command failed, remove it
753 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
754 &pCommand->Link, LL_ACCESS_LOCK ) )
755 {
756 pmcReleaseCommand( pMac, pCommand );
757 }
758 }
759 }
760 }
761 else
762 {
763 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800764 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 VOS_ASSERT(0);
766 }
767 }
768 break;
769
770 case eSmeCommandAddTs:
771 case eSmeCommandDelTs:
772 csrLLUnlock( &pMac->sme.smeCmdActiveList );
773#ifndef WLAN_MDM_CODE_REDUCTION_OPT
774 fContinue = qosProcessCommand( pMac, pCommand );
775 if( fContinue )
776 {
777 //The command failed, remove it
778 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
779 &pCommand->Link, LL_ACCESS_NOLOCK ) )
780 {
781//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
782 qosReleaseCommand( pMac, pCommand );
783//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
784 }
785 }
786#endif
787 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800788#ifdef FEATURE_WLAN_TDLS
789 case eSmeCommandTdlsSendMgmt:
790 case eSmeCommandTdlsAddPeer:
791 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530792 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800793#ifdef FEATURE_WLAN_TDLS_INTERNAL
794 case eSmeCommandTdlsDiscovery:
795 case eSmeCommandTdlsLinkSetup:
796 case eSmeCommandTdlsLinkTear:
797 case eSmeCommandTdlsEnterUapsd:
798 case eSmeCommandTdlsExitUapsd:
799#endif
800 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800801 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800802 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800803
804 csrLLUnlock( &pMac->sme.smeCmdActiveList );
805 status = csrTdlsProcessCmd( pMac, pCommand );
806 }
807 break ;
808#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700809
810 default:
811 //something is wrong
812 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800813 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
815 csrLLUnlock( &pMac->sme.smeCmdActiveList );
816 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
817 smeReleaseCommand( pMac, pCommand );
818 status = eHAL_STATUS_FAILURE;
819 break;
820 }
821 if(!HAL_STATUS_SUCCESS(status))
822 {
823 fContinue = eANI_BOOLEAN_TRUE;
824 }
825 }//if(pEntry)
826 else
827 {
828 //This is odd. Some one else pull off the command.
829 csrLLUnlock( &pMac->sme.smeCmdActiveList );
830 }
831 }
832 else
833 {
834 csrLLUnlock( &pMac->sme.smeCmdActiveList );
835 }
836 }
837 else
838 {
839 //No command waiting
840 csrLLUnlock( &pMac->sme.smeCmdActiveList );
841 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
842 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
843 {
844 tANI_U32 nTime = 0;
845
846 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
847 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
848 {
849 csrScanStartIdleScanTimer(pMac, nTime);
850 }
851 }
852 }
853 }
854 else {
855 csrLLUnlock( &pMac->sme.smeCmdActiveList );
856 }
857
858 return ( fContinue );
859}
860
861void smeProcessPendingQueue( tpAniSirGlobal pMac )
862{
863 while( smeProcessCommand( pMac ) );
864}
865
866
867tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
868{
869 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
870 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
871}
872
873
874
875//Global APIs
876
877/*--------------------------------------------------------------------------
878
879 \brief sme_Open() - Initialze all SME modules and put them at idle state
880
881 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
882 successfully return, all modules are at idle state ready to start.
883
884 smeOpen must be called before any other SME APIs can be involved.
885 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -0800886 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 \param hHal - The handle returned by macOpen.
888
889 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
890
891 Other status means SME is failed to be initialized
892 \sa
893
894 --------------------------------------------------------------------------*/
895eHalStatus sme_Open(tHalHandle hHal)
896{
897 eHalStatus status = eHAL_STATUS_FAILURE;
898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
899
900 do {
901 pMac->sme.state = SME_STATE_STOP;
902 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
903 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800904 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 status = eHAL_STATUS_FAILURE;
906 break;
907 }
908
909 status = ccmOpen(hHal);
910 if ( ! HAL_STATUS_SUCCESS( status ) ) {
911 smsLog( pMac, LOGE,
912 "ccmOpen failed during initialization with status=%d", status );
913 break;
914 }
915
916 status = csrOpen(pMac);
917 if ( ! HAL_STATUS_SUCCESS( status ) ) {
918 smsLog( pMac, LOGE,
919 "csrOpen failed during initialization with status=%d", status );
920 break;
921 }
922
923 status = pmcOpen(hHal);
924 if ( ! HAL_STATUS_SUCCESS( status ) ) {
925 smsLog( pMac, LOGE,
926 "pmcOpen failed during initialization with status=%d", status );
927 break;
928 }
929
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700930#ifdef FEATURE_WLAN_TDLS
931 pMac->isTdlsPowerSaveProhibited = 0;
932#endif
933
Jeff Johnson295189b2012-06-20 16:38:30 -0700934#ifndef WLAN_MDM_CODE_REDUCTION_OPT
935 status = sme_QosOpen(pMac);
936 if ( ! HAL_STATUS_SUCCESS( status ) ) {
937 smsLog( pMac, LOGE,
938 "Qos open failed during initialization with status=%d", status );
939 break;
940 }
941
942 status = btcOpen(pMac);
943 if ( ! HAL_STATUS_SUCCESS( status ) ) {
944 smsLog( pMac, LOGE,
945 "btcOpen open failed during initialization with status=%d", status );
946 break;
947 }
948#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700949#ifdef FEATURE_OEM_DATA_SUPPORT
950 status = oemData_OemDataReqOpen(pMac);
951 if ( ! HAL_STATUS_SUCCESS( status ) ) {
952 smsLog(pMac, LOGE,
953 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
954 break;
955 }
956#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700957
958 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
959 break;
960
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 {
962 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
963 if ( NULL == pvosGCtx ){
964 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
965 status = eHAL_STATUS_FAILURE;
966 break;
967 }
968
969 status = WLANSAP_Open( pvosGCtx );
970 if ( ! HAL_STATUS_SUCCESS( status ) ) {
971 smsLog( pMac, LOGE,
972 "WLANSAP_Open open failed during initialization with status=%d", status );
973 break;
974 }
975 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700976#if defined WLAN_FEATURE_VOWIFI
977 status = rrmOpen(pMac);
978 if ( ! HAL_STATUS_SUCCESS( status ) ) {
979 smsLog( pMac, LOGE,
980 "rrmOpen open failed during initialization with status=%d", status );
981 break;
982 }
983#endif
984
985#if defined WLAN_FEATURE_VOWIFI_11R
986 sme_FTOpen(pMac);
987#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700989
990 }while (0);
991
992 return status;
993}
994
Jeff Johnson295189b2012-06-20 16:38:30 -0700995/*--------------------------------------------------------------------------
996
997 \brief sme_set11dinfo() - Set the 11d information about valid channels
998 and there power using information from nvRAM
999 This function is called only for AP.
1000
Srinivas Girigowdade697412013-02-14 16:31:48 -08001001 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001002
1003 \param hHal - The handle returned by macOpen.
1004 \Param pSmeConfigParams - a pointer to a caller allocated object of
1005 typedef struct _smeConfigParams.
1006
1007 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1008
1009 Other status means SME is failed to update the config parameters.
1010 \sa
1011--------------------------------------------------------------------------*/
1012
1013eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1014{
1015 eHalStatus status = eHAL_STATUS_FAILURE;
1016 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1017
1018 if (NULL == pSmeConfigParams ) {
1019 smsLog( pMac, LOGE,
1020 "Empty config param structure for SME, nothing to update");
1021 return status;
1022 }
1023
1024 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1025 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001026 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 status );
1028 }
1029 return status;
1030}
1031
1032/*--------------------------------------------------------------------------
1033
1034 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1035
Srinivas Girigowdade697412013-02-14 16:31:48 -08001036 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001037
1038 \param hHal - The handle returned by HostapdAdapter.
1039 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1040
1041 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1042
1043 Other status means, failed to get the current regulatory domain.
1044 \sa
1045--------------------------------------------------------------------------*/
1046
1047eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1048{
1049 eHalStatus status = eHAL_STATUS_FAILURE;
1050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1051
1052 if (NULL == domainIdSoftAp ) {
1053 smsLog( pMac, LOGE, "Uninitialized domain Id");
1054 return status;
1055 }
1056
1057 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1058 status = eHAL_STATUS_SUCCESS;
1059
1060 return status;
1061}
1062
1063
1064eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1065{
1066 eHalStatus status = eHAL_STATUS_FAILURE;
1067 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1068
1069 if (NULL == apCntryCode ) {
1070 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1071 return status;
1072 }
1073
1074 status = csrSetRegInfo(hHal, apCntryCode );
1075 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001076 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 status );
1078 }
1079 return status;
1080}
1081
Jeff Johnson295189b2012-06-20 16:38:30 -07001082#ifdef FEATURE_WLAN_SCAN_PNO
1083/*--------------------------------------------------------------------------
1084
1085 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1086
1087 It is used at driver start up to inform RIVA of the default channel
1088 configuration.
1089
Srinivas Girigowdade697412013-02-14 16:31:48 -08001090 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001091
1092 \param hHal - The handle returned by macOpen.
1093
1094 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1095
1096 Other status means SME is failed to update the channel config.
1097 \sa
1098
1099 --------------------------------------------------------------------------*/
1100eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1101{
1102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1103
1104 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1105 &pMac->scan.base20MHzChannels, FALSE);
1106 return eHAL_STATUS_SUCCESS;
1107}
1108#endif // FEATURE_WLAN_SCAN_PNLO
1109
1110/*--------------------------------------------------------------------------
1111
1112 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1113
1114 The function updates some configuration for modules in SME, CCM, CSR, etc
1115 during SMEs close open sequence.
1116
1117 Modules inside SME apply the new configuration at the next transaction.
1118
Srinivas Girigowdade697412013-02-14 16:31:48 -08001119 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001120
1121 \param hHal - The handle returned by macOpen.
1122 \Param pSmeConfigParams - a pointer to a caller allocated object of
1123 typedef struct _smeConfigParams.
1124
1125 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1126
1127 Other status means SME is failed to update the config parameters.
1128 \sa
1129
1130 --------------------------------------------------------------------------*/
1131eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1132{
1133 eHalStatus status = eHAL_STATUS_FAILURE;
1134 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1135
1136 if (NULL == pSmeConfigParams ) {
1137 smsLog( pMac, LOGE,
1138 "Empty config param structure for SME, nothing to update");
1139 return status;
1140 }
1141
1142 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1143
1144 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001145 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 status );
1147 }
1148#if defined WLAN_FEATURE_P2P_INTERNAL
1149 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1150
1151 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001152 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 status );
1154 }
1155#endif
1156#if defined WLAN_FEATURE_VOWIFI
1157 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1158
1159 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001160 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 status );
1162 }
1163#endif
1164 //For SOC, CFG is set before start
1165 //We don't want to apply global CFG in connect state because that may cause some side affect
1166 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 csrIsAllSessionDisconnected( pMac) )
1168 {
1169 csrSetGlobalCfgs(pMac);
1170 }
1171
1172 return status;
1173}
1174
1175/* ---------------------------------------------------------------------------
1176 \fn sme_ChangeConfigParams
1177 \brief The SME API exposed for HDD to provide config params to SME during
1178 SMEs stop -> start sequence.
1179
1180 If HDD changed the domain that will cause a reset. This function will
1181 provide the new set of 11d information for the new domain. Currrently this
1182 API provides info regarding 11d only at reset but we can extend this for
1183 other params (PMC, QoS) which needs to be initialized again at reset.
1184
Srinivas Girigowdade697412013-02-14 16:31:48 -08001185 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001186
1187 \param hHal - The handle returned by macOpen.
1188
1189 \Param
1190 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1191 currently provides 11d related information like Country code,
1192 Regulatory domain, valid channel list, Tx power per channel, a
1193 list with active/passive scan allowed per valid channel.
1194
1195 \return eHalStatus
1196 ---------------------------------------------------------------------------*/
1197eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1198 tCsrUpdateConfigParam *pUpdateConfigParam)
1199{
1200 eHalStatus status = eHAL_STATUS_FAILURE;
1201 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1202
1203 if (NULL == pUpdateConfigParam ) {
1204 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001205 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 return status;
1207 }
1208
1209 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1210
1211 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001212 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 status );
1214 }
1215
1216 return status;
1217
1218}
1219
1220/*--------------------------------------------------------------------------
1221
1222 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1223 that the NIC is ready tio run.
1224
1225 The function is called by HDD at the end of initialization stage so PE/HAL can
1226 enable the NIC to running state.
1227
Srinivas Girigowdade697412013-02-14 16:31:48 -08001228 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 \param hHal - The handle returned by macOpen.
1230
1231 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1232 successfully.
1233
1234 Other status means SME failed to send the message to PE.
1235 \sa
1236
1237 --------------------------------------------------------------------------*/
1238eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1239{
1240 tSirSmeReadyReq Msg;
1241 eHalStatus status = eHAL_STATUS_FAILURE;
1242 tPmcPowerState powerState;
1243 tPmcSwitchState hwWlanSwitchState;
1244 tPmcSwitchState swWlanSwitchState;
1245 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1246
1247 do
1248 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001249
1250 Msg.messageType = eWNI_SME_SYS_READY_IND;
1251 Msg.length = sizeof( tSirSmeReadyReq );
1252
1253 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1254 {
1255 status = eHAL_STATUS_SUCCESS;
1256 }
1257 else
1258 {
1259 smsLog( pMac, LOGE,
1260 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1261 break;
1262 }
1263
1264 status = pmcQueryPowerState( hHal, &powerState,
1265 &hwWlanSwitchState, &swWlanSwitchState );
1266 if ( ! HAL_STATUS_SUCCESS( status ) )
1267 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001268 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001269 status );
1270 break;
1271 }
1272
1273 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1274 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1275 {
1276 status = csrReady(pMac);
1277 if ( ! HAL_STATUS_SUCCESS( status ) )
1278 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001279 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 break;
1281 }
1282 status = pmcReady(hHal);
1283 if ( ! HAL_STATUS_SUCCESS( status ) )
1284 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001285 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 break;
1287 }
1288#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1289 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1290 {
1291 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001292 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 break;
1294 }
1295#endif
1296
1297#if defined WLAN_FEATURE_VOWIFI
1298 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1299 {
1300 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001301 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 break;
1303 }
1304#endif
1305 }
1306 pMac->sme.state = SME_STATE_READY;
1307 } while( 0 );
1308
1309 return status;
1310}
1311
1312/*--------------------------------------------------------------------------
1313
1314 \brief sme_Start() - Put all SME modules at ready state.
1315
1316 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1317 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001318 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 \param hHal - The handle returned by macOpen.
1320
1321 \return eHAL_STATUS_SUCCESS - SME is ready.
1322
1323 Other status means SME is failed to start
1324 \sa
1325
1326 --------------------------------------------------------------------------*/
1327eHalStatus sme_Start(tHalHandle hHal)
1328{
1329 eHalStatus status = eHAL_STATUS_FAILURE;
1330 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1331
1332 do
1333 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 status = csrStart(pMac);
1335 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001336 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 status );
1338 break;
1339 }
1340
1341 status = pmcStart(hHal);
1342 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001343 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 status );
1345 break;
1346 }
1347
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1349 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001350 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 status );
1352 break;
1353 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 pMac->sme.state = SME_STATE_START;
1355 }while (0);
1356
1357 return status;
1358}
1359
1360
1361#ifdef WLAN_FEATURE_PACKET_FILTERING
1362/******************************************************************************
1363*
1364* Name: sme_PCFilterMatchCountResponseHandler
1365*
1366* Description:
1367* Invoke Packet Coalescing Filter Match Count callback routine
1368*
1369* Parameters:
1370* hHal - HAL handle for device
1371* pMsg - Pointer to tRcvFltPktMatchRsp structure
1372*
1373* Returns: eHalStatus
1374*
1375******************************************************************************/
1376eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1377{
1378 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1379 eHalStatus status = eHAL_STATUS_SUCCESS;
1380 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1381
1382 if (NULL == pMsg)
1383 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001384 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 status = eHAL_STATUS_FAILURE;
1386 }
1387 else
1388 {
1389 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001390 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
1392 /* Call Packet Coalescing Filter Match Count callback routine. */
1393 if (pMac->pmc.FilterMatchCountCB != NULL)
1394 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1395 pRcvFltPktMatchRsp);
1396
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001397 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 pRcvFltPktMatchRsp->status);
1399
1400 pMac->pmc.FilterMatchCountCB = NULL;
1401 pMac->pmc.FilterMatchCountCBContext = NULL;
1402 }
1403
1404 return(status);
1405}
1406#endif // WLAN_FEATURE_PACKET_FILTERING
1407
1408
Chet Lanctot186b5732013-03-18 10:26:30 -07001409#ifdef WLAN_FEATURE_11W
1410/*------------------------------------------------------------------
1411 *
1412 * Handle the unprotected management frame indication from LIM and
1413 * forward it to HDD.
1414 *
1415 *------------------------------------------------------------------*/
1416
1417eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1418 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1419{
1420 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1421 eHalStatus status = eHAL_STATUS_SUCCESS;
1422 tCsrRoamInfo pRoamInfo = {0};
1423 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1424
1425 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1426 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1427 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1428
1429 /* forward the mgmt frame to HDD */
1430 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1431
1432 return status;
1433}
1434#endif
1435
1436
Jeff Johnson295189b2012-06-20 16:38:30 -07001437/*--------------------------------------------------------------------------
1438
1439 \brief sme_ProcessMsg() - The main message processor for SME.
1440
1441 The function is called by a message dispatcher when to process a message
1442 targeted for SME.
1443
Srinivas Girigowdade697412013-02-14 16:31:48 -08001444 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 \param hHal - The handle returned by macOpen.
1446 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1447
1448 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1449
1450 Other status means SME failed to process the message to HAL.
1451 \sa
1452
1453 --------------------------------------------------------------------------*/
1454eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1455{
1456 eHalStatus status = eHAL_STATUS_FAILURE;
1457 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1458
1459 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001460 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 return status;
1462 }
1463
1464 status = sme_AcquireGlobalLock( &pMac->sme );
1465 if ( HAL_STATUS_SUCCESS( status ) )
1466 {
1467 if( SME_IS_START(pMac) )
1468 {
1469 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1470 case eWNI_PMC_ENTER_BMPS_RSP:
1471 case eWNI_PMC_EXIT_BMPS_RSP:
1472 case eWNI_PMC_EXIT_BMPS_IND:
1473 case eWNI_PMC_ENTER_IMPS_RSP:
1474 case eWNI_PMC_EXIT_IMPS_RSP:
1475 case eWNI_PMC_SMPS_STATE_IND:
1476 case eWNI_PMC_ENTER_UAPSD_RSP:
1477 case eWNI_PMC_EXIT_UAPSD_RSP:
1478 case eWNI_PMC_ENTER_WOWL_RSP:
1479 case eWNI_PMC_EXIT_WOWL_RSP:
1480 //PMC
1481 if (pMsg->bodyptr)
1482 {
1483 pmcMessageProcessor(hHal, pMsg->bodyptr);
1484 status = eHAL_STATUS_SUCCESS;
1485 vos_mem_free( pMsg->bodyptr );
1486 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001487 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 }
1489 break;
1490
1491 case WNI_CFG_SET_CNF:
1492 case WNI_CFG_DNLD_CNF:
1493 case WNI_CFG_GET_RSP:
1494 case WNI_CFG_ADD_GRP_ADDR_CNF:
1495 case WNI_CFG_DEL_GRP_ADDR_CNF:
1496 //CCM
1497 if (pMsg->bodyptr)
1498 {
1499 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1500 status = eHAL_STATUS_SUCCESS;
1501 vos_mem_free( pMsg->bodyptr );
1502 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001503 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 }
1505 break;
1506
1507 case eWNI_SME_ADDTS_RSP:
1508 case eWNI_SME_DELTS_RSP:
1509 case eWNI_SME_DELTS_IND:
1510#ifdef WLAN_FEATURE_VOWIFI_11R
1511 case eWNI_SME_FT_AGGR_QOS_RSP:
1512#endif
1513 //QoS
1514 if (pMsg->bodyptr)
1515 {
1516#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1517 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1518 vos_mem_free( pMsg->bodyptr );
1519#endif
1520 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001521 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 }
1523 break;
1524#if defined WLAN_FEATURE_VOWIFI
1525 case eWNI_SME_NEIGHBOR_REPORT_IND:
1526 case eWNI_SME_BEACON_REPORT_REQ_IND:
1527#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001528 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001529#endif
1530 if ( pMsg->bodyptr )
1531 {
1532 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
1533 vos_mem_free( pMsg->bodyptr );
1534 }
1535 else
1536 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001537 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001538 }
1539 break;
1540#endif
1541
Jeff Johnsone7245742012-09-05 17:12:55 -07001542#ifdef FEATURE_OEM_DATA_SUPPORT
1543 //Handle the eWNI_SME_OEM_DATA_RSP:
1544 case eWNI_SME_OEM_DATA_RSP:
1545 if(pMsg->bodyptr)
1546 {
1547 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1548 vos_mem_free(pMsg->bodyptr);
1549 }
1550 else
1551 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001552 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001553 }
1554 smeProcessPendingQueue( pMac );
1555 break;
1556#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001557
1558 case eWNI_SME_ADD_STA_SELF_RSP:
1559 if(pMsg->bodyptr)
1560 {
1561 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1562 vos_mem_free(pMsg->bodyptr);
1563 }
1564 else
1565 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001566 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001567 }
1568 break;
1569 case eWNI_SME_DEL_STA_SELF_RSP:
1570 if(pMsg->bodyptr)
1571 {
1572 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1573 vos_mem_free(pMsg->bodyptr);
1574 }
1575 else
1576 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001577 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 }
1579 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 case eWNI_SME_REMAIN_ON_CHN_RSP:
1581 if(pMsg->bodyptr)
1582 {
1583 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1584 vos_mem_free(pMsg->bodyptr);
1585 }
1586 else
1587 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001588 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 }
1590 break;
1591 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1592 if(pMsg->bodyptr)
1593 {
1594 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1595 vos_mem_free(pMsg->bodyptr);
1596 }
1597 else
1598 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001599 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 -07001600 }
1601 break;
1602 case eWNI_SME_MGMT_FRM_IND:
1603 if(pMsg->bodyptr)
1604 {
1605 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1606 vos_mem_free(pMsg->bodyptr);
1607 }
1608 else
1609 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001610 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 }
1612 break;
1613 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1614 if(pMsg->bodyptr)
1615 {
1616 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1617 vos_mem_free(pMsg->bodyptr);
1618 }
1619 else
1620 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001621 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001622 }
1623 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001624 case eWNI_SME_COEX_IND:
1625 if(pMsg->bodyptr)
1626 {
1627 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1628 vos_mem_free(pMsg->bodyptr);
1629 }
1630 else
1631 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001632 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 }
1634 break;
1635
1636#ifdef FEATURE_WLAN_SCAN_PNO
1637 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1638 if(pMsg->bodyptr)
1639 {
1640 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1641 vos_mem_free(pMsg->bodyptr);
1642 }
1643 else
1644 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001645 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 }
1647 break;
1648#endif // FEATURE_WLAN_SCAN_PNO
1649
1650 case eWNI_SME_TX_PER_HIT_IND:
1651 if (pMac->sme.pTxPerHitCallback)
1652 {
1653 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1654 }
1655 break;
1656
1657 case eWNI_SME_CHANGE_COUNTRY_CODE:
1658 if(pMsg->bodyptr)
1659 {
1660 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1661 vos_mem_free(pMsg->bodyptr);
1662 }
1663 else
1664 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001665 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 }
1667 break;
1668
1669#ifdef WLAN_FEATURE_PACKET_FILTERING
1670 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1671 if(pMsg->bodyptr)
1672 {
1673 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1674 vos_mem_free(pMsg->bodyptr);
1675 }
1676 else
1677 {
1678 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001679 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 }
1681 break;
1682#endif // WLAN_FEATURE_PACKET_FILTERING
1683 case eWNI_SME_PRE_SWITCH_CHL_IND:
1684 {
1685 status = sme_HandlePreChannelSwitchInd(pMac);
1686 break;
1687 }
1688
1689 case eWNI_SME_POST_SWITCH_CHL_IND:
1690 {
1691 status = sme_HandlePostChannelSwitchInd(pMac);
1692 break;
1693 }
1694
1695#ifdef WLAN_WAKEUP_EVENTS
1696 case eWNI_SME_WAKE_REASON_IND:
1697 if(pMsg->bodyptr)
1698 {
1699 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1700 vos_mem_free(pMsg->bodyptr);
1701 }
1702 else
1703 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001704 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 }
1706 break;
1707#endif // WLAN_WAKEUP_EVENTS
1708
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001709#ifdef FEATURE_WLAN_TDLS
1710 /*
1711 * command rescived from PE, SME tdls msg processor shall be called
1712 * to process commands recieved from PE
1713 */
1714 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1715 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001716 case eWNI_SME_TDLS_DEL_STA_RSP:
1717 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001718 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001719 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301720 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301721#ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP
1722 case eWNI_SME_TDLS_AP_DISAPPEAR_IND:
1723#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001724#ifdef FEATURE_WLAN_TDLS_INTERNAL
1725 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1726 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1727 case eWNI_SME_TDLS_LINK_START_RSP:
1728 case eWNI_SME_TDLS_LINK_START_IND:
1729 case eWNI_SME_TDLS_TEARDOWN_RSP:
1730 case eWNI_SME_TDLS_TEARDOWN_IND:
1731 case eWNI_SME_ADD_TDLS_PEER_IND:
1732 case eWNI_SME_DELETE_TDLS_PEER_IND:
1733#endif
1734 {
1735 if (pMsg->bodyptr)
1736 {
1737 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1738 vos_mem_free( pMsg->bodyptr );
1739 }
1740 else
1741 {
1742 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001743 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001744 }
1745 break;
1746 }
1747#endif
1748
Chet Lanctot186b5732013-03-18 10:26:30 -07001749#ifdef WLAN_FEATURE_11W
1750 case eWNI_SME_UNPROT_MGMT_FRM_IND:
1751 if (pMsg->bodyptr)
1752 {
1753 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
1754 vos_mem_free(pMsg->bodyptr);
1755 }
1756 else
1757 {
1758 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
1759 }
1760 break;
1761#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001762#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1763 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
1764 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
1765 break;
1766#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07001767
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 default:
1769
1770 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
1771 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
1772 {
1773 //CSR
1774 if (pMsg->bodyptr)
1775 {
1776 status = csrMsgProcessor(hHal, pMsg->bodyptr);
1777 vos_mem_free( pMsg->bodyptr );
1778 }
1779 else
1780 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001781 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001782 }
1783 }
1784 else
1785 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001786 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07001787 pMsg->type);
1788 if (pMsg->bodyptr)
1789 {
1790 vos_mem_free( pMsg->bodyptr );
1791 }
1792 }
1793 }//switch
1794 } //SME_IS_START
1795 else
1796 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001797 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 if (pMsg->bodyptr)
1799 {
1800 vos_mem_free( pMsg->bodyptr );
1801 }
1802 }
1803 sme_ReleaseGlobalLock( &pMac->sme );
1804 }
1805 else
1806 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001807 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 if (pMsg->bodyptr)
1809 {
1810 vos_mem_free( pMsg->bodyptr );
1811 }
1812 }
1813
1814 return status;
1815}
1816
1817
1818//No need to hold the global lock here because this function can only be called
1819//after sme_Stop.
1820v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
1821{
1822 if( pMsg )
1823 {
1824 if (pMsg->bodyptr)
1825 {
1826 vos_mem_free( pMsg->bodyptr );
1827 }
1828 }
1829
1830}
1831
1832
1833/*--------------------------------------------------------------------------
1834
1835 \brief sme_Stop() - Stop all SME modules and put them at idle state
1836
1837 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
1838 return, all modules are at idle state ready to start.
1839
Srinivas Girigowdade697412013-02-14 16:31:48 -08001840 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 \param hHal - The handle returned by macOpen
1842
1843 \return eHAL_STATUS_SUCCESS - SME is stopped.
1844
1845 Other status means SME is failed to stop but caller should still
1846 consider SME is stopped.
1847 \sa
1848
1849 --------------------------------------------------------------------------*/
1850eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
1851{
1852 eHalStatus status = eHAL_STATUS_FAILURE;
1853 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1854 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1855
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1857 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001858 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 status );
1860 fail_status = status;
1861 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001862
1863 p2pStop(hHal);
1864
1865 if(pmcFlag)
1866 {
1867 status = pmcStop(hHal);
1868 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001869 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001870 status );
1871 fail_status = status;
1872 }
1873 }
1874
1875 status = csrStop(pMac);
1876 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001877 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 status );
1879 fail_status = status;
1880 }
1881
1882 ccmStop(hHal);
1883
1884 purgeSmeCmdList(pMac);
1885
1886 if (!HAL_STATUS_SUCCESS( fail_status )) {
1887 status = fail_status;
1888 }
1889
1890 pMac->sme.state = SME_STATE_STOP;
1891
1892 return status;
1893}
1894
1895/*--------------------------------------------------------------------------
1896
1897 \brief sme_Close() - Release all SME modules and their resources.
1898
1899 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
1900 return, all modules are at closed state.
1901
1902 No SME APIs can be involved after smeClose except smeOpen.
1903 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001904 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 \param hHal - The handle returned by macOpen
1906
1907 \return eHAL_STATUS_SUCCESS - SME is successfully close.
1908
1909 Other status means SME is failed to be closed but caller still cannot
1910 call any other SME functions except smeOpen.
1911 \sa
1912
1913 --------------------------------------------------------------------------*/
1914eHalStatus sme_Close(tHalHandle hHal)
1915{
1916 eHalStatus status = eHAL_STATUS_FAILURE;
1917 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1919
1920 status = csrClose(pMac);
1921 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001922 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 status );
1924 fail_status = status;
1925 }
1926
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1928 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001929 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001930 status );
1931 fail_status = status;
1932 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001933
1934#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1935 status = btcClose(hHal);
1936 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001937 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 status );
1939 fail_status = status;
1940 }
1941
1942 status = sme_QosClose(pMac);
1943 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001944 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 status );
1946 fail_status = status;
1947 }
1948#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001949#ifdef FEATURE_OEM_DATA_SUPPORT
1950 status = oemData_OemDataReqClose(hHal);
1951 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001952 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07001953 status );
1954 fail_status = status;
1955 }
1956#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001957
1958 status = ccmClose(hHal);
1959 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001960 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 status );
1962 fail_status = status;
1963 }
1964
1965 status = pmcClose(hHal);
1966 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001967 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 status );
1969 fail_status = status;
1970 }
1971#if defined WLAN_FEATURE_VOWIFI
1972 status = rrmClose(hHal);
1973 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001974 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 status );
1976 fail_status = status;
1977 }
1978#endif
1979
1980#if defined WLAN_FEATURE_VOWIFI_11R
1981 sme_FTClose(hHal);
1982#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07001984
1985 freeSmeCmdList(pMac);
1986
1987 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
1988 {
1989 fail_status = eHAL_STATUS_FAILURE;
1990 }
1991
1992 if (!HAL_STATUS_SUCCESS( fail_status )) {
1993 status = fail_status;
1994 }
1995
1996 pMac->sme.state = SME_STATE_STOP;
1997
1998 return status;
1999}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002000#ifdef FEATURE_WLAN_LFR
2001tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2002{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002003#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002004 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2005 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2006 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2007 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2008 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2009 return eANI_BOOLEAN_FALSE;
2010 default:
2011 return eANI_BOOLEAN_TRUE;
2012 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002013#else
2014 /*
2015 * TODO: always return TRUE for now until
2016 * we figure out why we could be stuck in
2017 * one of the roaming states forever.
2018 */
2019 return eANI_BOOLEAN_TRUE;
2020#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002021}
2022#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002023/* ---------------------------------------------------------------------------
2024 \fn sme_ScanRequest
2025 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002026 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 \param pScanRequestID - pointer to an object to get back the request ID
2028 \param callback - a callback function that scan calls upon finish, will not
2029 be called if csrScanRequest returns error
2030 \param pContext - a pointer passed in for the callback
2031 \return eHalStatus
2032 ---------------------------------------------------------------------------*/
2033eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2034 tANI_U32 *pScanRequestID,
2035 csrScanCompleteCallback callback, void *pContext)
2036{
2037 eHalStatus status = eHAL_STATUS_FAILURE;
2038 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2039
2040 smsLog(pMac, LOG2, FL("enter"));
2041 do
2042 {
2043 if(pMac->scan.fScanEnable)
2044 {
2045 status = sme_AcquireGlobalLock( &pMac->sme );
2046 if ( HAL_STATUS_SUCCESS( status ) )
2047 {
2048 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002049#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002050 if(csrIsScanAllowed(pMac))
2051 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002052#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002053 status = csrScanRequest( hHal, sessionId, pscanReq,
2054 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002055#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002056 }
2057 else
2058 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002059 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2060 pMac->roam.neighborRoamInfo.neighborRoamState,
2061 pMac->roam.curSubState[sessionId]);
2062 /*HandOff is in progress. So schedule this scan later*/
2063 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002064 }
2065#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 }
2067
2068 sme_ReleaseGlobalLock( &pMac->sme );
2069 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002070 else
2071 {
2072 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2073 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002075 else
2076 {
2077 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2078 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 } while( 0 );
2080
2081 return (status);
2082
2083
2084}
2085
2086/* ---------------------------------------------------------------------------
2087 \fn sme_ScanGetResult
2088 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002089 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 \param pFilter - If pFilter is NULL, all cached results are returned
2091 \param phResult - an object for the result.
2092 \return eHalStatus
2093 ---------------------------------------------------------------------------*/
2094eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2095 tScanResultHandle *phResult)
2096{
2097 eHalStatus status = eHAL_STATUS_FAILURE;
2098 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2099
2100 smsLog(pMac, LOG2, FL("enter"));
2101 status = sme_AcquireGlobalLock( &pMac->sme );
2102 if ( HAL_STATUS_SUCCESS( status ) )
2103 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002104 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 sme_ReleaseGlobalLock( &pMac->sme );
2106 }
2107 smsLog(pMac, LOG2, FL("exit status %d"), status);
2108
2109 return (status);
2110}
2111
2112
2113/* ---------------------------------------------------------------------------
2114 \fn sme_ScanFlushResult
2115 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002116 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 \return eHalStatus
2118 ---------------------------------------------------------------------------*/
2119eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2120{
2121 eHalStatus status = eHAL_STATUS_FAILURE;
2122 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2123
2124 status = sme_AcquireGlobalLock( &pMac->sme );
2125 if ( HAL_STATUS_SUCCESS( status ) )
2126 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002127 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 sme_ReleaseGlobalLock( &pMac->sme );
2129 }
2130
2131 return (status);
2132}
2133
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002134eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2135{
2136 eHalStatus status = eHAL_STATUS_FAILURE;
2137 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2138
2139 status = sme_AcquireGlobalLock( &pMac->sme );
2140 if ( HAL_STATUS_SUCCESS( status ) )
2141 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302142 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002143 sme_ReleaseGlobalLock( &pMac->sme );
2144 }
2145
2146 return (status);
2147}
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
2149/* ---------------------------------------------------------------------------
2150 \fn sme_ScanResultGetFirst
2151 \brief a wrapper function to request CSR to returns the first element of
2152 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002153 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 \param hScanResult - returned from csrScanGetResult
2155 \return tCsrScanResultInfo * - NULL if no result
2156 ---------------------------------------------------------------------------*/
2157tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2158 tScanResultHandle hScanResult)
2159{
2160 eHalStatus status = eHAL_STATUS_FAILURE;
2161 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2162 tCsrScanResultInfo *pRet = NULL;
2163
2164 status = sme_AcquireGlobalLock( &pMac->sme );
2165 if ( HAL_STATUS_SUCCESS( status ) )
2166 {
2167 pRet = csrScanResultGetFirst( pMac, hScanResult );
2168 sme_ReleaseGlobalLock( &pMac->sme );
2169 }
2170
2171 return (pRet);
2172}
2173
2174
2175/* ---------------------------------------------------------------------------
2176 \fn sme_ScanResultGetNext
2177 \brief a wrapper function to request CSR to returns the next element of
2178 scan result. It can be called without calling csrScanResultGetFirst
2179 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002180 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 \param hScanResult - returned from csrScanGetResult
2182 \return Null if no result or reach the end
2183 ---------------------------------------------------------------------------*/
2184tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2185 tScanResultHandle hScanResult)
2186{
2187 eHalStatus status = eHAL_STATUS_FAILURE;
2188 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2189 tCsrScanResultInfo *pRet = NULL;
2190
2191 status = sme_AcquireGlobalLock( &pMac->sme );
2192 if ( HAL_STATUS_SUCCESS( status ) )
2193 {
2194 pRet = csrScanResultGetNext( pMac, hScanResult );
2195 sme_ReleaseGlobalLock( &pMac->sme );
2196 }
2197
2198 return (pRet);
2199}
2200
2201
2202/* ---------------------------------------------------------------------------
2203 \fn sme_ScanSetBGScanparams
2204 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002205 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 \param pScanReq - BG scan request structure
2207 \return eHalStatus
2208 ---------------------------------------------------------------------------*/
2209eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2210{
2211 eHalStatus status = eHAL_STATUS_FAILURE;
2212 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2213
2214 if( NULL != pScanReq )
2215 {
2216 status = sme_AcquireGlobalLock( &pMac->sme );
2217 if ( HAL_STATUS_SUCCESS( status ) )
2218 {
2219 status = csrScanSetBGScanparams( hHal, pScanReq );
2220 sme_ReleaseGlobalLock( &pMac->sme );
2221 }
2222 }
2223
2224 return (status);
2225}
2226
2227
2228/* ---------------------------------------------------------------------------
2229 \fn sme_ScanResultPurge
2230 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2231 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002232 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 \param hScanResult - returned from csrScanGetResult. hScanResult is
2234 considered gone by
2235 calling this function and even before this function reutrns.
2236 \return eHalStatus
2237 ---------------------------------------------------------------------------*/
2238eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2239{
2240 eHalStatus status = eHAL_STATUS_FAILURE;
2241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2242
2243 status = sme_AcquireGlobalLock( &pMac->sme );
2244 if ( HAL_STATUS_SUCCESS( status ) )
2245 {
2246 status = csrScanResultPurge( hHal, hScanResult );
2247 sme_ReleaseGlobalLock( &pMac->sme );
2248 }
2249
2250 return (status);
2251}
2252
2253/* ---------------------------------------------------------------------------
2254 \fn sme_ScanGetPMKIDCandidateList
2255 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002256 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 \param pPmkidList - caller allocated buffer point to an array of
2258 tPmkidCandidateInfo
2259 \param pNumItems - pointer to a variable that has the number of
2260 tPmkidCandidateInfo allocated when retruning, this is
2261 either the number needed or number of items put into
2262 pPmkidList
2263 \return eHalStatus - when fail, it usually means the buffer allocated is not
2264 big enough and pNumItems
2265 has the number of tPmkidCandidateInfo.
2266 \Note: pNumItems is a number of tPmkidCandidateInfo,
2267 not sizeof(tPmkidCandidateInfo) * something
2268 ---------------------------------------------------------------------------*/
2269eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2270 tPmkidCandidateInfo *pPmkidList,
2271 tANI_U32 *pNumItems )
2272{
2273 eHalStatus status = eHAL_STATUS_FAILURE;
2274 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2275
2276 status = sme_AcquireGlobalLock( &pMac->sme );
2277 if ( HAL_STATUS_SUCCESS( status ) )
2278 {
2279 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2280 sme_ReleaseGlobalLock( &pMac->sme );
2281 }
2282
2283 return (status);
2284}
2285
2286/*----------------------------------------------------------------------------
2287 \fn sme_RoamRegisterLinkQualityIndCallback
2288
2289 \brief
2290 a wrapper function to allow HDD to register a callback handler with CSR for
2291 link quality indications.
2292
2293 Only one callback may be registered at any time.
2294 In order to deregister the callback, a NULL cback may be provided.
2295
2296 Registration happens in the task context of the caller.
2297
2298 \param callback - Call back being registered
2299 \param pContext - user data
2300
2301 DEPENDENCIES: After CSR open
2302
2303 \return eHalStatus
2304-----------------------------------------------------------------------------*/
2305eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2306 csrRoamLinkQualityIndCallback callback,
2307 void *pContext)
2308{
2309 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2310}
2311
2312/* ---------------------------------------------------------------------------
2313 \fn sme_RoamRegisterCallback
2314 \brief a wrapper function to allow HDD to register a callback with CSR.
2315 Unlike scan, roam has one callback for all the roam requests
2316 \param callback - a callback function that roam calls upon when state changes
2317 \param pContext - a pointer passed in for the callback
2318 \return eHalStatus
2319 ---------------------------------------------------------------------------*/
2320eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2321 csrRoamCompleteCallback callback,
2322 void *pContext)
2323{
2324 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2325}
2326
2327eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2328{
2329 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2330 return pMac->roam.configParam.phyMode;
2331}
2332
2333/* ---------------------------------------------------------------------------
2334 \fn sme_RoamConnect
2335 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002336 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 \param sessionId - the sessionId returned by sme_OpenSession.
2338 \param pProfile - description of the network to which to connect
2339 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2340 from csrScanGetResult
2341 \param pRoamId - to get back the request ID
2342 \return eHalStatus
2343 ---------------------------------------------------------------------------*/
2344eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2345 tANI_U32 *pRoamId)
2346{
2347 eHalStatus status = eHAL_STATUS_FAILURE;
2348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2349
2350 smsLog(pMac, LOG2, FL("enter"));
2351 status = sme_AcquireGlobalLock( &pMac->sme );
2352 if ( HAL_STATUS_SUCCESS( status ) )
2353 {
2354 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2355 {
2356 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2357 }
2358 else
2359 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002360 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 status = eHAL_STATUS_INVALID_PARAMETER;
2362 }
2363 sme_ReleaseGlobalLock( &pMac->sme );
2364 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002365 else
2366 {
2367 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2368 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002369
2370 return (status);
2371}
2372
2373/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302374
2375 \fn sme_SetPhyMode
2376
2377 \brief Changes the PhyMode.
2378
2379 \param hHal - The handle returned by macOpen.
2380
2381 \param phyMode new phyMode which is to set
2382
2383 \return eHalStatus SUCCESS.
2384
2385 -------------------------------------------------------------------------------*/
2386eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2387{
2388 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2389
2390 if (NULL == pMac)
2391 {
2392 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2393 "%s: invalid context", __func__);
2394 return eHAL_STATUS_FAILURE;
2395 }
2396
2397 pMac->roam.configParam.phyMode = phyMode;
2398 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2399 pMac->roam.configParam.phyMode,
2400 pMac->roam.configParam.ProprietaryRatesEnabled);
2401
2402 return eHAL_STATUS_SUCCESS;
2403}
2404
2405/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002406 \fn sme_RoamReassoc
2407 \brief a wrapper function to request CSR to inititiate a re-association
2408 \param pProfile - can be NULL to join the currently connected AP. In that
2409 case modProfileFields should carry the modified field(s) which could trigger
2410 reassoc
2411 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2412 that might need modification dynamically once STA is up & running and this
2413 could trigger a reassoc
2414 \param pRoamId - to get back the request ID
2415 \return eHalStatus
2416 -------------------------------------------------------------------------------*/
2417eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2418 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002419 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002420{
2421 eHalStatus status = eHAL_STATUS_FAILURE;
2422 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2423
2424 smsLog(pMac, LOG2, FL("enter"));
2425 status = sme_AcquireGlobalLock( &pMac->sme );
2426 if ( HAL_STATUS_SUCCESS( status ) )
2427 {
2428 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2429 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002430 if((NULL == pProfile) && (fForce == 1))
2431 {
2432 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2433 /* to force the AP initiate fresh 802.1x authentication need to clear
2434 * the PMKID cache for that set the following boolean. this is needed
2435 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2436 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002437 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2438 }
2439 else
2440 {
2441 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2442 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 }
2444 else
2445 {
2446 status = eHAL_STATUS_INVALID_PARAMETER;
2447 }
2448 sme_ReleaseGlobalLock( &pMac->sme );
2449 }
2450
2451 return (status);
2452}
2453
2454/* ---------------------------------------------------------------------------
2455 \fn sme_RoamConnectToLastProfile
2456 \brief a wrapper function to request CSR to disconnect and reconnect with
2457 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002458 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 \return eHalStatus. It returns fail if currently connected
2460 ---------------------------------------------------------------------------*/
2461eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2462{
2463 eHalStatus status = eHAL_STATUS_FAILURE;
2464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2465
2466 status = sme_AcquireGlobalLock( &pMac->sme );
2467 if ( HAL_STATUS_SUCCESS( status ) )
2468 {
2469 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2470 {
2471 status = csrRoamConnectToLastProfile( pMac, sessionId );
2472 }
2473 else
2474 {
2475 status = eHAL_STATUS_INVALID_PARAMETER;
2476 }
2477 sme_ReleaseGlobalLock( &pMac->sme );
2478 }
2479
2480 return (status);
2481}
2482
2483/* ---------------------------------------------------------------------------
2484 \fn sme_RoamDisconnect
2485 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002486 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002487 \param reason -- To indicate the reason for disconnecting. Currently, only
2488 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2489 \return eHalStatus
2490 ---------------------------------------------------------------------------*/
2491eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2492{
2493 eHalStatus status = eHAL_STATUS_FAILURE;
2494 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2495
2496 smsLog(pMac, LOG2, FL("enter"));
2497 status = sme_AcquireGlobalLock( &pMac->sme );
2498 if ( HAL_STATUS_SUCCESS( status ) )
2499 {
2500 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2501 {
2502 status = csrRoamDisconnect( pMac, sessionId, reason );
2503 }
2504 else
2505 {
2506 status = eHAL_STATUS_INVALID_PARAMETER;
2507 }
2508 sme_ReleaseGlobalLock( &pMac->sme );
2509 }
2510
2511 return (status);
2512}
2513
Jeff Johnson295189b2012-06-20 16:38:30 -07002514/* ---------------------------------------------------------------------------
2515 \fn sme_RoamStopBss
2516 \brief To stop BSS for Soft AP. This is an asynchronous API.
2517 \param hHal - Global structure
2518 \param sessionId - sessionId of SoftAP
2519 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2520 -------------------------------------------------------------------------------*/
2521eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2522{
2523 eHalStatus status = eHAL_STATUS_FAILURE;
2524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2525
2526 smsLog(pMac, LOG2, FL("enter"));
2527 status = sme_AcquireGlobalLock( &pMac->sme );
2528 if ( HAL_STATUS_SUCCESS( status ) )
2529 {
2530 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2531 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302532 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002533 }
2534 else
2535 {
2536 status = eHAL_STATUS_INVALID_PARAMETER;
2537 }
2538 sme_ReleaseGlobalLock( &pMac->sme );
2539 }
2540
2541 return (status);
2542}
2543
2544/* ---------------------------------------------------------------------------
2545 \fn sme_RoamDisconnectSta
2546 \brief To disassociate a station. This is an asynchronous API.
2547 \param hHal - Global structure
2548 \param sessionId - sessionId of SoftAP
2549 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2550 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2551 -------------------------------------------------------------------------------*/
2552eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2553 tANI_U8 *pPeerMacAddr)
2554{
2555 eHalStatus status = eHAL_STATUS_FAILURE;
2556 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2557
2558 if ( NULL == pMac )
2559 {
2560 VOS_ASSERT(0);
2561 return status;
2562 }
2563
2564 status = sme_AcquireGlobalLock( &pMac->sme );
2565 if ( HAL_STATUS_SUCCESS( status ) )
2566 {
2567 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2568 {
2569 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302570 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 }
2572 else
2573 {
2574 status = eHAL_STATUS_INVALID_PARAMETER;
2575 }
2576 sme_ReleaseGlobalLock( &pMac->sme );
2577 }
2578
2579 return (status);
2580}
2581
2582/* ---------------------------------------------------------------------------
2583 \fn sme_RoamDeauthSta
2584 \brief To disassociate a station. This is an asynchronous API.
2585 \param hHal - Global structure
2586 \param sessionId - sessionId of SoftAP
2587 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2588 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2589 -------------------------------------------------------------------------------*/
2590eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2591 tANI_U8 *pPeerMacAddr)
2592{
2593 eHalStatus status = eHAL_STATUS_FAILURE;
2594 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2595
2596 if ( NULL == pMac )
2597 {
2598 VOS_ASSERT(0);
2599 return status;
2600 }
2601
2602 status = sme_AcquireGlobalLock( &pMac->sme );
2603 if ( HAL_STATUS_SUCCESS( status ) )
2604 {
2605 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2606 {
2607 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302608 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002609 }
2610 else
2611 {
2612 status = eHAL_STATUS_INVALID_PARAMETER;
2613 }
2614 sme_ReleaseGlobalLock( &pMac->sme );
2615 }
2616
2617 return (status);
2618}
2619
2620/* ---------------------------------------------------------------------------
2621 \fn sme_RoamTKIPCounterMeasures
2622 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2623 \param sessionId - sessionId of SoftAP
2624 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2625 \return eHalStatus
2626 -------------------------------------------------------------------------------*/
2627eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2628 tANI_BOOLEAN bEnable)
2629{
2630 eHalStatus status = eHAL_STATUS_FAILURE;
2631 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2632
2633 if ( NULL == pMac )
2634 {
2635 VOS_ASSERT(0);
2636 return status;
2637 }
2638
2639 status = sme_AcquireGlobalLock( &pMac->sme );
2640 if ( HAL_STATUS_SUCCESS( status ) )
2641 {
2642 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2643 {
2644 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2645 }
2646 else
2647 {
2648 status = eHAL_STATUS_INVALID_PARAMETER;
2649 }
2650 sme_ReleaseGlobalLock( &pMac->sme );
2651 }
2652
2653 return (status);
2654}
2655
2656/* ---------------------------------------------------------------------------
2657 \fn sme_RoamGetAssociatedStas
2658 \brief To probe the list of associated stations from various modules of CORE stack.
2659 \This is an asynchronous API.
2660 \param sessionId - sessionId of SoftAP
2661 \param modId - Module from whom list of associtated stations is to be probed.
2662 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2663 \param pUsrContext - Opaque HDD context
2664 \param pfnSapEventCallback - Sap event callback in HDD
2665 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2666 \return eHalStatus
2667 -------------------------------------------------------------------------------*/
2668eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2669 VOS_MODULE_ID modId, void *pUsrContext,
2670 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2671{
2672 eHalStatus status = eHAL_STATUS_FAILURE;
2673 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2674
2675 if ( NULL == pMac )
2676 {
2677 VOS_ASSERT(0);
2678 return status;
2679 }
2680
2681 status = sme_AcquireGlobalLock( &pMac->sme );
2682 if ( HAL_STATUS_SUCCESS( status ) )
2683 {
2684 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2685 {
2686 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2687 }
2688 else
2689 {
2690 status = eHAL_STATUS_INVALID_PARAMETER;
2691 }
2692 sme_ReleaseGlobalLock( &pMac->sme );
2693 }
2694
2695 return (status);
2696}
2697
2698/* ---------------------------------------------------------------------------
2699 \fn sme_RoamGetWpsSessionOverlap
2700 \brief To get the WPS PBC session overlap information.
2701 \This is an asynchronous API.
2702 \param sessionId - sessionId of SoftAP
2703 \param pUsrContext - Opaque HDD context
2704 \param pfnSapEventCallback - Sap event callback in HDD
2705 \pRemoveMac - pointer to Mac address which needs to be removed from session
2706 \return eHalStatus
2707 -------------------------------------------------------------------------------*/
2708eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
2709 void *pUsrContext, void
2710 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
2711{
2712 eHalStatus status = eHAL_STATUS_FAILURE;
2713 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2714
2715 if ( NULL == pMac )
2716 {
2717 VOS_ASSERT(0);
2718 return status;
2719 }
2720
2721 status = sme_AcquireGlobalLock( &pMac->sme );
2722 if ( HAL_STATUS_SUCCESS( status ) )
2723 {
2724 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2725 {
2726 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
2727 }
2728 else
2729 {
2730 status = eHAL_STATUS_INVALID_PARAMETER;
2731 }
2732 sme_ReleaseGlobalLock( &pMac->sme );
2733 }
2734
2735 return (status);
2736}
2737
Jeff Johnson295189b2012-06-20 16:38:30 -07002738
2739/* ---------------------------------------------------------------------------
2740 \fn sme_RoamGetConnectState
2741 \brief a wrapper function to request CSR to return the current connect state
2742 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08002743 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 \return eHalStatus
2745 ---------------------------------------------------------------------------*/
2746eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
2747{
2748 eHalStatus status = eHAL_STATUS_FAILURE;
2749 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2750
2751 status = sme_AcquireGlobalLock( &pMac->sme );
2752 if ( HAL_STATUS_SUCCESS( status ) )
2753 {
2754 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2755 {
2756 status = csrRoamGetConnectState( pMac, sessionId, pState );
2757 }
2758 else
2759 {
2760 status = eHAL_STATUS_INVALID_PARAMETER;
2761 }
2762 sme_ReleaseGlobalLock( &pMac->sme );
2763 }
2764
2765 return (status);
2766}
2767
2768/* ---------------------------------------------------------------------------
2769 \fn sme_RoamGetConnectProfile
2770 \brief a wrapper function to request CSR to return the current connect
2771 profile. Caller must call csrRoamFreeConnectProfile after it is done
2772 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002773 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 \param pProfile - pointer to a caller allocated structure
2775 tCsrRoamConnectedProfile
2776 \return eHalStatus. Failure if not connected
2777 ---------------------------------------------------------------------------*/
2778eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
2779 tCsrRoamConnectedProfile *pProfile)
2780{
2781 eHalStatus status = eHAL_STATUS_FAILURE;
2782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2783
2784 status = sme_AcquireGlobalLock( &pMac->sme );
2785 if ( HAL_STATUS_SUCCESS( status ) )
2786 {
2787 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2788 {
2789 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
2790 }
2791 else
2792 {
2793 status = eHAL_STATUS_INVALID_PARAMETER;
2794 }
2795 sme_ReleaseGlobalLock( &pMac->sme );
2796 }
2797
2798 return (status);
2799}
2800
2801/* ---------------------------------------------------------------------------
2802 \fn sme_RoamFreeConnectProfile
2803 \brief a wrapper function to request CSR to free and reinitialize the
2804 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002805 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 \param pProfile - pointer to a caller allocated structure
2807 tCsrRoamConnectedProfile
2808 \return eHalStatus.
2809 ---------------------------------------------------------------------------*/
2810eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
2811 tCsrRoamConnectedProfile *pProfile)
2812{
2813 eHalStatus status = eHAL_STATUS_FAILURE;
2814 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2815
2816 status = sme_AcquireGlobalLock( &pMac->sme );
2817 if ( HAL_STATUS_SUCCESS( status ) )
2818 {
2819 status = csrRoamFreeConnectProfile( pMac, pProfile );
2820 sme_ReleaseGlobalLock( &pMac->sme );
2821 }
2822
2823 return (status);
2824}
2825
2826/* ---------------------------------------------------------------------------
2827 \fn sme_RoamSetPMKIDCache
2828 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002829 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 \param pPMKIDCache - caller allocated buffer point to an array of
2831 tPmkidCacheInfo
2832 \param numItems - a variable that has the number of tPmkidCacheInfo
2833 allocated when retruning, this is either the number needed
2834 or number of items put into pPMKIDCache
2835 \return eHalStatus - when fail, it usually means the buffer allocated is not
2836 big enough and pNumItems has the number of
2837 tPmkidCacheInfo.
2838 \Note: pNumItems is a number of tPmkidCacheInfo,
2839 not sizeof(tPmkidCacheInfo) * something
2840 ---------------------------------------------------------------------------*/
2841eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
2842 tANI_U32 numItems )
2843{
2844 eHalStatus status = eHAL_STATUS_FAILURE;
2845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2846
2847 status = sme_AcquireGlobalLock( &pMac->sme );
2848 if ( HAL_STATUS_SUCCESS( status ) )
2849 {
2850 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2851 {
2852 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
2853 }
2854 else
2855 {
2856 status = eHAL_STATUS_INVALID_PARAMETER;
2857 }
2858 sme_ReleaseGlobalLock( &pMac->sme );
2859 }
2860
2861 return (status);
2862}
2863
2864/* ---------------------------------------------------------------------------
2865 \fn sme_RoamGetSecurityReqIE
2866 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
2867 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08002868 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 \param pLen - caller allocated memory that has the length of pBuf as input.
2870 Upon returned, *pLen has the needed or IE length in pBuf.
2871 \param pBuf - Caller allocated memory that contain the IE field, if any,
2872 upon return
2873 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2874 \return eHalStatus - when fail, it usually means the buffer allocated is not
2875 big enough
2876 ---------------------------------------------------------------------------*/
2877eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2878 tANI_U8 *pBuf, eCsrSecurityType secType)
2879{
2880 eHalStatus status = eHAL_STATUS_FAILURE;
2881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2882
2883 status = sme_AcquireGlobalLock( &pMac->sme );
2884 if ( HAL_STATUS_SUCCESS( status ) )
2885 {
2886 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2887 {
2888 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
2889 }
2890 else
2891 {
2892 status = eHAL_STATUS_INVALID_PARAMETER;
2893 }
2894 sme_ReleaseGlobalLock( &pMac->sme );
2895 }
2896
2897 return (status);
2898}
2899
2900/* ---------------------------------------------------------------------------
2901 \fn sme_RoamGetSecurityRspIE
2902 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
2903 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08002904 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002905 \param pLen - caller allocated memory that has the length of pBuf as input.
2906 Upon returned, *pLen has the needed or IE length in pBuf.
2907 \param pBuf - Caller allocated memory that contain the IE field, if any,
2908 upon return
2909 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2910 \return eHalStatus - when fail, it usually means the buffer allocated is not
2911 big enough
2912 ---------------------------------------------------------------------------*/
2913eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2914 tANI_U8 *pBuf, eCsrSecurityType secType)
2915{
2916 eHalStatus status = eHAL_STATUS_FAILURE;
2917 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2918
2919 status = sme_AcquireGlobalLock( &pMac->sme );
2920 if ( HAL_STATUS_SUCCESS( status ) )
2921 {
2922 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2923 {
2924 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
2925 }
2926 else
2927 {
2928 status = eHAL_STATUS_INVALID_PARAMETER;
2929 }
2930 sme_ReleaseGlobalLock( &pMac->sme );
2931 }
2932
2933 return (status);
2934
2935}
2936
2937
2938/* ---------------------------------------------------------------------------
2939 \fn sme_RoamGetNumPMKIDCache
2940 \brief a wrapper function to request CSR to return number of PMKID cache
2941 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08002942 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002943 \return tANI_U32 - the number of PMKID cache entries
2944 ---------------------------------------------------------------------------*/
2945tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
2946{
2947 eHalStatus status = eHAL_STATUS_FAILURE;
2948 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2949 tANI_U32 numPmkidCache = 0;
2950
2951 status = sme_AcquireGlobalLock( &pMac->sme );
2952 if ( HAL_STATUS_SUCCESS( status ) )
2953 {
2954 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2955 {
2956 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
2957 status = eHAL_STATUS_SUCCESS;
2958 }
2959 else
2960 {
2961 status = eHAL_STATUS_INVALID_PARAMETER;
2962 }
2963 sme_ReleaseGlobalLock( &pMac->sme );
2964 }
2965
2966 return (numPmkidCache);
2967}
2968
2969/* ---------------------------------------------------------------------------
2970 \fn sme_RoamGetPMKIDCache
2971 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08002972 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002973 \param pNum - caller allocated memory that has the space of the number of
2974 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
2975 needed or actually number in tPmkidCacheInfo.
2976 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
2977 any, upon return
2978 \return eHalStatus - when fail, it usually means the buffer allocated is not
2979 big enough
2980 ---------------------------------------------------------------------------*/
2981eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
2982 tPmkidCacheInfo *pPmkidCache)
2983{
2984 eHalStatus status = eHAL_STATUS_FAILURE;
2985 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2986
2987 status = sme_AcquireGlobalLock( &pMac->sme );
2988 if ( HAL_STATUS_SUCCESS( status ) )
2989 {
2990 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2991 {
2992 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
2993 }
2994 else
2995 {
2996 status = eHAL_STATUS_INVALID_PARAMETER;
2997 }
2998 sme_ReleaseGlobalLock( &pMac->sme );
2999 }
3000
3001 return (status);
3002}
3003
3004
3005/* ---------------------------------------------------------------------------
3006 \fn sme_GetConfigParam
3007 \brief a wrapper function that HDD calls to get the global settings
3008 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003009 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 \param pParam - caller allocated memory
3011 \return eHalStatus
3012 ---------------------------------------------------------------------------*/
3013eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3014{
3015 eHalStatus status = eHAL_STATUS_FAILURE;
3016 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3017
3018 status = sme_AcquireGlobalLock( &pMac->sme );
3019 if ( HAL_STATUS_SUCCESS( status ) )
3020 {
3021 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3022 if (status != eHAL_STATUS_SUCCESS)
3023 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003024 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 sme_ReleaseGlobalLock( &pMac->sme );
3026 return status;
3027 }
3028#if defined WLAN_FEATURE_P2P_INTERNAL
3029 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3030 if (status != eHAL_STATUS_SUCCESS)
3031 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003032 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 sme_ReleaseGlobalLock( &pMac->sme );
3034 return status;
3035 }
3036#endif
3037 sme_ReleaseGlobalLock( &pMac->sme );
3038 }
3039
3040 return (status);
3041}
3042
3043/* ---------------------------------------------------------------------------
3044 \fn sme_CfgSetInt
3045 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003046 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 \param cfgId - Configuration Parameter ID (type) for STA.
3048 \param ccmValue - The information related to Configuration Parameter ID
3049 which needs to be saved in CFG
3050 \param callback - To be registered by CSR with CCM. Once the CFG done with
3051 saving the information in the database, it notifies CCM &
3052 then the callback will be invoked to notify.
3053 \param toBeSaved - To save the request for future reference
3054 \return eHalStatus
3055 ---------------------------------------------------------------------------*/
3056eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3057 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3058{
3059 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3060}
3061
3062/* ---------------------------------------------------------------------------
3063 \fn sme_CfgSetStr
3064 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003065 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 \param cfgId - Configuration Parameter ID (type) for STA.
3067 \param pStr - Pointer to the byte array which carries the information needs
3068 to be saved in CFG
3069 \param length - Length of the data to be saved
3070 \param callback - To be registered by CSR with CCM. Once the CFG done with
3071 saving the information in the database, it notifies CCM &
3072 then the callback will be invoked to notify.
3073 \param toBeSaved - To save the request for future reference
3074 \return eHalStatus
3075 ---------------------------------------------------------------------------*/
3076eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3077 tANI_U32 length, tCcmCfgSetCallback callback,
3078 eAniBoolean toBeSaved)
3079{
3080 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3081}
3082
3083/* ---------------------------------------------------------------------------
3084 \fn sme_GetModifyProfileFields
3085 \brief HDD or SME - QOS calls this function to get the current values of
3086 connected profile fields, changing which can cause reassoc.
3087 This function must be called after CFG is downloaded and STA is in connected
3088 state. Also, make sure to call this function to get the current profile
3089 fields before calling the reassoc. So that pModifyProfileFields will have
3090 all the latest values plus the one(s) has been updated as part of reassoc
3091 request.
3092 \param pModifyProfileFields - pointer to the connected profile fields
3093 changing which can cause reassoc
3094
3095 \return eHalStatus
3096 -------------------------------------------------------------------------------*/
3097eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3098 tCsrRoamModifyProfileFields * pModifyProfileFields)
3099{
3100 eHalStatus status = eHAL_STATUS_FAILURE;
3101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3102
3103 status = sme_AcquireGlobalLock( &pMac->sme );
3104 if ( HAL_STATUS_SUCCESS( status ) )
3105 {
3106 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3107 {
3108 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3109 }
3110 else
3111 {
3112 status = eHAL_STATUS_INVALID_PARAMETER;
3113 }
3114 sme_ReleaseGlobalLock( &pMac->sme );
3115 }
3116
3117 return (status);
3118}
3119
3120/*--------------------------------------------------------------------------
3121 \fn sme_SetConfigPowerSave
3122 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3123 For BMPS related configuration, this function also updates the CFG
3124 and sends a message to FW to pick up the new values. Note: Calling
3125 this function only updates the configuration and does not enable
3126 the specified power save mode.
3127 \param hHal - The handle returned by macOpen.
3128 \param psMode - Power Saving mode being modified
3129 \param pConfigParams - a pointer to a caller allocated object of type
3130 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3131 \return eHalStatus
3132 --------------------------------------------------------------------------*/
3133eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3134 void *pConfigParams)
3135{
3136 eHalStatus status = eHAL_STATUS_FAILURE;
3137 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3138
3139 if (NULL == pConfigParams ) {
3140 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3141 "nothing to update");
3142 return eHAL_STATUS_FAILURE;
3143 }
3144
3145 status = sme_AcquireGlobalLock( &pMac->sme );
3146 if ( HAL_STATUS_SUCCESS( status ) )
3147 {
3148 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3149 sme_ReleaseGlobalLock( &pMac->sme );
3150 }
3151
3152 return (status);
3153}
3154
3155/*--------------------------------------------------------------------------
3156 \fn sme_GetConfigPowerSave
3157 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3158 \param hHal - The handle returned by macOpen.
3159 \param psMode - Power Saving mode
3160 \param pConfigParams - a pointer to a caller allocated object of type
3161 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3162 \return eHalStatus
3163 --------------------------------------------------------------------------*/
3164eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3165 void *pConfigParams)
3166{
3167 eHalStatus status = eHAL_STATUS_FAILURE;
3168 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3169
3170 if (NULL == pConfigParams ) {
3171 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3172 "nothing to update");
3173 return eHAL_STATUS_FAILURE;
3174 }
3175
3176 status = sme_AcquireGlobalLock( &pMac->sme );
3177 if ( HAL_STATUS_SUCCESS( status ) )
3178 {
3179 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3180 sme_ReleaseGlobalLock( &pMac->sme );
3181 }
3182
3183 return (status);
3184}
3185
3186/* ---------------------------------------------------------------------------
3187 \fn sme_SignalPowerEvent
3188 \brief Signals to PMC that a power event has occurred. Used for putting
3189 the chip into deep sleep mode.
3190 \param hHal - The handle returned by macOpen.
3191 \param event - the event that has occurred
3192 \return eHalStatus
3193 ---------------------------------------------------------------------------*/
3194eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3195{
3196 eHalStatus status = eHAL_STATUS_FAILURE;
3197 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3198
3199 status = sme_AcquireGlobalLock( &pMac->sme );
3200 if ( HAL_STATUS_SUCCESS( status ) )
3201 {
3202 status = pmcSignalPowerEvent(hHal, event);
3203 sme_ReleaseGlobalLock( &pMac->sme );
3204 }
3205
3206 return (status);
3207}
3208
3209/* ---------------------------------------------------------------------------
3210 \fn sme_EnablePowerSave
3211 \brief Enables one of the power saving modes.
3212 \param hHal - The handle returned by macOpen.
3213 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3214 while the chip is operating in Full Power, PMC will start
3215 a timer that will try to put the chip in BMPS mode after
3216 expiry.
3217 \return eHalStatus
3218 ---------------------------------------------------------------------------*/
3219eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3220{
3221 eHalStatus status = eHAL_STATUS_FAILURE;
3222 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3223
3224 status = sme_AcquireGlobalLock( &pMac->sme );
3225 if ( HAL_STATUS_SUCCESS( status ) )
3226 {
3227 status = pmcEnablePowerSave(hHal, psMode);
3228 sme_ReleaseGlobalLock( &pMac->sme );
3229 }
3230
3231 return (status);
3232}
3233
3234/* ---------------------------------------------------------------------------
3235 \fn sme_DisablePowerSave
3236 \brief Disables one of the power saving modes.
3237 \param hHal - The handle returned by macOpen.
3238 \param psMode - The power saving mode to disable. Disabling does not imply
3239 that device will be brought out of the current PS mode. This
3240 is purely a configuration API.
3241 \return eHalStatus
3242 ---------------------------------------------------------------------------*/
3243eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
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 = pmcDisablePowerSave(hHal, psMode);
3252 sme_ReleaseGlobalLock( &pMac->sme );
3253 }
3254
3255 return (status);
3256 }
3257
3258/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303259+ \fn sme_SetHostPowerSave
3260+ \brief Enables BMPS logic to be controlled by User level apps
3261+ \param hHal - The handle returned by macOpen.
3262+ \param psMode - The power saving mode to disable. Disabling does not imply
3263+ that device will be brought out of the current PS mode. This
3264+ is purely a configuration API.
3265+ \return eHalStatus
3266+ ---------------------------------------------------------------------------*/
3267eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3268{
3269 eHalStatus status = eHAL_STATUS_FAILURE;
3270 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3271
3272 pMac->pmc.isHostPsEn = psMode;
3273
3274 return (status);
3275}
3276
3277/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003278 \fn sme_StartAutoBmpsTimer
3279 \brief Starts a timer that periodically polls all the registered
3280 module for entry into Bmps mode. This timer is started only if BMPS is
3281 enabled and whenever the device is in full power.
3282 \param hHal - The handle returned by macOpen.
3283 \return eHalStatus
3284 ---------------------------------------------------------------------------*/
3285eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3286{
3287 eHalStatus status = eHAL_STATUS_FAILURE;
3288 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3289
3290 status = sme_AcquireGlobalLock( &pMac->sme );
3291 if ( HAL_STATUS_SUCCESS( status ) )
3292 {
3293 status = pmcStartAutoBmpsTimer(hHal);
3294 sme_ReleaseGlobalLock( &pMac->sme );
3295 }
3296
3297 return (status);
3298}
3299/* ---------------------------------------------------------------------------
3300 \fn sme_StopAutoBmpsTimer
3301 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3302 Stopping the timer does not cause a device state change. Only the timer
3303 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3304 \param hHal - The handle returned by macOpen.
3305 \return eHalStatus
3306 ---------------------------------------------------------------------------*/
3307eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3308{
3309 eHalStatus status = eHAL_STATUS_FAILURE;
3310 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3311
3312 status = sme_AcquireGlobalLock( &pMac->sme );
3313 if ( HAL_STATUS_SUCCESS( status ) )
3314 {
3315 status = pmcStopAutoBmpsTimer(hHal);
3316 sme_ReleaseGlobalLock( &pMac->sme );
3317 }
3318
3319 return (status);
3320}
3321/* ---------------------------------------------------------------------------
3322 \fn sme_QueryPowerState
3323 \brief Returns the current power state of the device.
3324 \param hHal - The handle returned by macOpen.
3325 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3326 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3327 \return eHalStatus
3328 ---------------------------------------------------------------------------*/
3329eHalStatus sme_QueryPowerState (
3330 tHalHandle hHal,
3331 tPmcPowerState *pPowerState,
3332 tPmcSwitchState *pSwWlanSwitchState)
3333{
3334 eHalStatus status = eHAL_STATUS_FAILURE;
3335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3336
3337 status = sme_AcquireGlobalLock( &pMac->sme );
3338 if ( HAL_STATUS_SUCCESS( status ) )
3339 {
3340 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3341 sme_ReleaseGlobalLock( &pMac->sme );
3342 }
3343
3344 return (status);
3345}
3346
3347/* ---------------------------------------------------------------------------
3348 \fn sme_IsPowerSaveEnabled
3349 \brief Checks if the device is able to enter a particular power save mode
3350 This does not imply that the device is in a particular PS mode
3351 \param hHal - The handle returned by macOpen.
3352 \param psMode - the power saving mode
3353 \return eHalStatus
3354 ---------------------------------------------------------------------------*/
3355tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3356{
3357 eHalStatus status = eHAL_STATUS_FAILURE;
3358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3359 tANI_BOOLEAN result = false;
3360
3361 status = sme_AcquireGlobalLock( &pMac->sme );
3362 if ( HAL_STATUS_SUCCESS( status ) )
3363 {
3364 result = pmcIsPowerSaveEnabled(hHal, psMode);
3365 sme_ReleaseGlobalLock( &pMac->sme );
3366 return result;
3367 }
3368
3369 return false;
3370}
3371
3372/* ---------------------------------------------------------------------------
3373 \fn sme_RequestFullPower
3374 \brief Request that the device be brought to full power state. When the
3375 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3376 is enabled. On timer expiry PMC will attempt to put the device in
3377 BMPS mode if following holds true:
3378 - BMPS mode is enabled
3379 - Polling of all modules through the Power Save Check routine passes
3380 - STA is associated to an access point
3381 \param hHal - The handle returned by macOpen.
3382 \param - callbackRoutine Callback routine invoked in case of success/failure
3383 \return eHalStatus - status
3384 eHAL_STATUS_SUCCESS - device brought to full power state
3385 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3386 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3387 ---------------------------------------------------------------------------*/
3388eHalStatus sme_RequestFullPower (
3389 tHalHandle hHal,
3390 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3391 void *callbackContext,
3392 tRequestFullPowerReason fullPowerReason)
3393{
3394 eHalStatus status = eHAL_STATUS_FAILURE;
3395 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3396
3397 status = sme_AcquireGlobalLock( &pMac->sme );
3398 if ( HAL_STATUS_SUCCESS( status ) )
3399 {
3400 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3401 sme_ReleaseGlobalLock( &pMac->sme );
3402 }
3403
3404 return (status);
3405}
3406
3407/* ---------------------------------------------------------------------------
3408 \fn sme_RequestBmps
3409 \brief Request that the device be put in BMPS state. Request will be
3410 accepted only if BMPS mode is enabled and power save check routine
3411 passes.
3412 \param hHal - The handle returned by macOpen.
3413 \param - callbackRoutine Callback routine invoked in case of success/failure
3414 \return eHalStatus
3415 eHAL_STATUS_SUCCESS - device is in BMPS state
3416 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3417 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3418 ---------------------------------------------------------------------------*/
3419eHalStatus sme_RequestBmps (
3420 tHalHandle hHal,
3421 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3422 void *callbackContext)
3423{
3424 eHalStatus status = eHAL_STATUS_FAILURE;
3425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3426
3427 status = sme_AcquireGlobalLock( &pMac->sme );
3428 if ( HAL_STATUS_SUCCESS( status ) )
3429 {
3430 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3431 sme_ReleaseGlobalLock( &pMac->sme );
3432 }
3433
3434 return (status);
3435}
3436
3437
3438/* ---------------------------------------------------------------------------
3439 \fn sme_SetDHCPTillPowerActiveFlag
3440 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3441 entry by PMC
3442 \param hHal - The handle returned by macOpen.
3443 ---------------------------------------------------------------------------*/
3444void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3445{
3446 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3447
3448 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3449 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3450}
3451
3452
3453/* ---------------------------------------------------------------------------
3454 \fn sme_StartUapsd
3455 \brief Request that the device be put in UAPSD state. If the device is in
3456 Full Power it will be put in BMPS mode first and then into UAPSD
3457 mode.
3458 \param hHal - The handle returned by macOpen.
3459 \param - callbackRoutine Callback routine invoked in case of success/failure
3460 eHAL_STATUS_SUCCESS - device is in UAPSD state
3461 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3462 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3463 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3464 \return eHalStatus
3465 ---------------------------------------------------------------------------*/
3466eHalStatus sme_StartUapsd (
3467 tHalHandle hHal,
3468 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3469 void *callbackContext)
3470{
3471 eHalStatus status = eHAL_STATUS_FAILURE;
3472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3473
3474 status = sme_AcquireGlobalLock( &pMac->sme );
3475 if ( HAL_STATUS_SUCCESS( status ) )
3476 {
3477 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3478 sme_ReleaseGlobalLock( &pMac->sme );
3479 }
3480
3481 return (status);
3482 }
3483
3484/* ---------------------------------------------------------------------------
3485 \fn sme_StopUapsd
3486 \brief Request that the device be put out of UAPSD state. Device will be
3487 put in in BMPS state after stop UAPSD completes.
3488 \param hHal - The handle returned by macOpen.
3489 \return eHalStatus
3490 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3491 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3492 ---------------------------------------------------------------------------*/
3493eHalStatus sme_StopUapsd (tHalHandle hHal)
3494{
3495 eHalStatus status = eHAL_STATUS_FAILURE;
3496 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3497
3498 status = sme_AcquireGlobalLock( &pMac->sme );
3499 if ( HAL_STATUS_SUCCESS( status ) )
3500 {
3501 status = pmcStopUapsd(hHal);
3502 sme_ReleaseGlobalLock( &pMac->sme );
3503 }
3504
3505 return (status);
3506}
3507
3508/* ---------------------------------------------------------------------------
3509 \fn sme_RequestStandby
3510 \brief Request that the device be put in standby. It is HDD's responsibility
3511 to bring the chip to full power and do a disassoc before calling
3512 this API.
3513 \param hHal - The handle returned by macOpen.
3514 \param - callbackRoutine Callback routine invoked in case of success/failure
3515 \return eHalStatus
3516 eHAL_STATUS_SUCCESS - device is in Standby mode
3517 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3518 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3519 ---------------------------------------------------------------------------*/
3520eHalStatus sme_RequestStandby (
3521 tHalHandle hHal,
3522 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3523 void *callbackContext)
3524{
3525 eHalStatus status = eHAL_STATUS_FAILURE;
3526 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3527
3528 smsLog( pMac, LOG1, FL("") );
3529 status = sme_AcquireGlobalLock( &pMac->sme );
3530 if ( HAL_STATUS_SUCCESS( status ) )
3531 {
3532 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3533 sme_ReleaseGlobalLock( &pMac->sme );
3534 }
3535
3536 return (status);
3537}
3538
3539/* ---------------------------------------------------------------------------
3540 \fn sme_RegisterPowerSaveCheck
3541 \brief Register a power save check routine that is called whenever
3542 the device is about to enter one of the power save modes.
3543 \param hHal - The handle returned by macOpen.
3544 \param checkRoutine - Power save check routine to be registered
3545 \return eHalStatus
3546 eHAL_STATUS_SUCCESS - successfully registered
3547 eHAL_STATUS_FAILURE - not successfully registered
3548 ---------------------------------------------------------------------------*/
3549eHalStatus sme_RegisterPowerSaveCheck (
3550 tHalHandle hHal,
3551 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3552{
3553 eHalStatus status = eHAL_STATUS_FAILURE;
3554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3555
3556 status = sme_AcquireGlobalLock( &pMac->sme );
3557 if ( HAL_STATUS_SUCCESS( status ) )
3558 {
3559 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3560 sme_ReleaseGlobalLock( &pMac->sme );
3561 }
3562
3563 return (status);
3564}
3565
3566/* ---------------------------------------------------------------------------
3567 \fn sme_DeregisterPowerSaveCheck
3568 \brief Deregister a power save check routine
3569 \param hHal - The handle returned by macOpen.
3570 \param checkRoutine - Power save check routine to be deregistered
3571 \return eHalStatus
3572 eHAL_STATUS_SUCCESS - successfully deregistered
3573 eHAL_STATUS_FAILURE - not successfully deregistered
3574 ---------------------------------------------------------------------------*/
3575eHalStatus sme_DeregisterPowerSaveCheck (
3576 tHalHandle hHal,
3577 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3578{
3579 eHalStatus status = eHAL_STATUS_FAILURE;
3580 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3581
3582 status = sme_AcquireGlobalLock( &pMac->sme );
3583 if ( HAL_STATUS_SUCCESS( status ) )
3584 {
3585 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3586 sme_ReleaseGlobalLock( &pMac->sme );
3587 }
3588
3589 return (status);
3590}
3591
3592/* ---------------------------------------------------------------------------
3593 \fn sme_RegisterDeviceStateUpdateInd
3594 \brief Register a callback routine that is called whenever
3595 the device enters a new device state (Full Power, BMPS, UAPSD)
3596 \param hHal - The handle returned by macOpen.
3597 \param callbackRoutine - Callback routine to be registered
3598 \param callbackContext - Cookie to be passed back during callback
3599 \return eHalStatus
3600 eHAL_STATUS_SUCCESS - successfully registered
3601 eHAL_STATUS_FAILURE - not successfully registered
3602 ---------------------------------------------------------------------------*/
3603eHalStatus sme_RegisterDeviceStateUpdateInd (
3604 tHalHandle hHal,
3605 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3606 void *callbackContext)
3607{
3608 eHalStatus status = eHAL_STATUS_FAILURE;
3609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3610
3611 status = sme_AcquireGlobalLock( &pMac->sme );
3612 if ( HAL_STATUS_SUCCESS( status ) )
3613 {
3614 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3615 sme_ReleaseGlobalLock( &pMac->sme );
3616 }
3617
3618 return (status);
3619}
3620
3621/* ---------------------------------------------------------------------------
3622 \fn sme_DeregisterDeviceStateUpdateInd
3623 \brief Deregister a routine that was registered for device state changes
3624 \param hHal - The handle returned by macOpen.
3625 \param callbackRoutine - Callback routine to be deregistered
3626 \return eHalStatus
3627 eHAL_STATUS_SUCCESS - successfully deregistered
3628 eHAL_STATUS_FAILURE - not successfully deregistered
3629 ---------------------------------------------------------------------------*/
3630eHalStatus sme_DeregisterDeviceStateUpdateInd (
3631 tHalHandle hHal,
3632 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3633{
3634 eHalStatus status = eHAL_STATUS_FAILURE;
3635 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3636
3637 status = sme_AcquireGlobalLock( &pMac->sme );
3638 if ( HAL_STATUS_SUCCESS( status ) )
3639 {
3640 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3641 sme_ReleaseGlobalLock( &pMac->sme );
3642 }
3643
3644 return (status);
3645}
3646
3647/* ---------------------------------------------------------------------------
3648 \fn sme_WowlAddBcastPattern
3649 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3650 do a pattern match on these patterns when Wowl is enabled during BMPS
3651 mode. Note that Firmware performs the pattern matching only on
3652 broadcast frames and while Libra is in BMPS mode.
3653 \param hHal - The handle returned by macOpen.
3654 \param pattern - Pattern to be added
3655 \return eHalStatus
3656 eHAL_STATUS_FAILURE Cannot add pattern
3657 eHAL_STATUS_SUCCESS Request accepted.
3658 ---------------------------------------------------------------------------*/
3659eHalStatus sme_WowlAddBcastPattern (
3660 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003661 tpSirWowlAddBcastPtrn pattern,
3662 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003663{
3664 eHalStatus status = eHAL_STATUS_FAILURE;
3665 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3666 status = sme_AcquireGlobalLock( &pMac->sme );
3667 if ( HAL_STATUS_SUCCESS( status ) )
3668 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003669 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 sme_ReleaseGlobalLock( &pMac->sme );
3671 }
3672
3673 return (status);
3674}
3675
3676/* ---------------------------------------------------------------------------
3677 \fn sme_WowlDelBcastPattern
3678 \brief Delete a pattern that was added for Pattern Byte Matching.
3679 \param hHal - The handle returned by macOpen.
3680 \param pattern - Pattern to be deleted
3681 \return eHalStatus
3682 eHAL_STATUS_FAILURE Cannot delete pattern
3683 eHAL_STATUS_SUCCESS Request accepted.
3684 ---------------------------------------------------------------------------*/
3685eHalStatus sme_WowlDelBcastPattern (
3686 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003687 tpSirWowlDelBcastPtrn pattern,
3688 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003689{
3690 eHalStatus status = eHAL_STATUS_FAILURE;
3691 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3692 status = sme_AcquireGlobalLock( &pMac->sme );
3693 if ( HAL_STATUS_SUCCESS( status ) )
3694 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003695 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 sme_ReleaseGlobalLock( &pMac->sme );
3697 }
3698
3699 return (status);
3700}
3701
3702/* ---------------------------------------------------------------------------
3703 \fn sme_EnterWowl
3704 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
3705 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
3706 SME will will cache the information that WOWL has been enabled and
3707 attempt to put the device in BMPS. On entry into BMPS, SME will
3708 enable the WOWL mode.
3709 Note 1: If we exit BMPS mode (someone requests full power), we
3710 will NOT resume WOWL when we go back to BMPS again. Request for full
3711 power (while in WOWL mode) means disable WOWL and go to full power.
3712 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
3713 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
3714 are required. Currently there is no requirement or use case to support
3715 UAPSD and WOWL at the same time.
3716
3717 \param hHal - The handle returned by macOpen.
3718 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
3719 Used for success/failure notification by SME
3720 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
3721 at the time of callback.
3722 \param wakeReasonIndCB - Callback routine provided by HDD.
3723 Used for Wake Reason Indication by SME
3724 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
3725 at the time of callback.
3726 \return eHalStatus
3727 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
3728 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
3729 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
3730 BMPS mode is entered.
3731 ---------------------------------------------------------------------------*/
3732eHalStatus sme_EnterWowl (
3733 tHalHandle hHal,
3734 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
3735 void *enterWowlCallbackContext,
3736#ifdef WLAN_WAKEUP_EVENTS
3737 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
3738 void *wakeIndicationCBContext,
3739#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003740 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003741{
3742 eHalStatus status = eHAL_STATUS_FAILURE;
3743 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3744 status = sme_AcquireGlobalLock( &pMac->sme );
3745 if ( HAL_STATUS_SUCCESS( status ) )
3746 {
3747 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
3748#ifdef WLAN_WAKEUP_EVENTS
3749 wakeIndicationCB, wakeIndicationCBContext,
3750#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003751 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003752 sme_ReleaseGlobalLock( &pMac->sme );
3753 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 return (status);
3755}
3756/* ---------------------------------------------------------------------------
3757 \fn sme_ExitWowl
3758 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
3759 SME will initiate exit from WoWLAN mode and device will be put in BMPS
3760 mode.
3761 \param hHal - The handle returned by macOpen.
3762 \return eHalStatus
3763 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
3764 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
3765 ---------------------------------------------------------------------------*/
3766eHalStatus sme_ExitWowl (tHalHandle hHal)
3767{
3768 eHalStatus status = eHAL_STATUS_FAILURE;
3769 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3770 status = sme_AcquireGlobalLock( &pMac->sme );
3771 if ( HAL_STATUS_SUCCESS( status ) )
3772 {
3773 status = pmcExitWowl (hHal);
3774 sme_ReleaseGlobalLock( &pMac->sme );
3775 }
3776
3777 return (status);
3778}
3779
3780/* ---------------------------------------------------------------------------
3781
3782 \fn sme_RoamSetKey
3783
3784 \brief To set encryption key. This function should be called only when connected
3785 This is an asynchronous API.
3786
3787 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
3788
3789 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3790
3791 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3792
3793 FAILURE or RESOURCES The API finished and failed.
3794
3795 -------------------------------------------------------------------------------*/
3796eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
3797{
3798 eHalStatus status = eHAL_STATUS_FAILURE;
3799 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3800 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 tANI_U32 i;
3802 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003803
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003804 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
3805 {
3806 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
3807 return eHAL_STATUS_FAILURE;
3808 }
3809
Jeff Johnson295189b2012-06-20 16:38:30 -07003810 status = sme_AcquireGlobalLock( &pMac->sme );
3811 if ( HAL_STATUS_SUCCESS( status ) )
3812 {
3813 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3814 if(pRoamId)
3815 {
3816 *pRoamId = roamId;
3817 }
3818
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003819 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07003820
3821 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003822 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003823
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003824 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003825
3826 pSession = CSR_GET_SESSION(pMac, sessionId);
3827
Jeff Johnson32d95a32012-09-10 13:15:23 -07003828 if(!pSession)
3829 {
3830 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08003831 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003832 return eHAL_STATUS_FAILURE;
3833 }
3834
Jeff Johnson295189b2012-06-20 16:38:30 -07003835 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
3836 {
3837 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
3838 {
3839 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
3840 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
3841 {
3842 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3843 }
3844 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
3845 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
3846 {
3847 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3848 }
3849 }
3850 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003851
3852 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
3853 sme_ReleaseGlobalLock( &pMac->sme );
3854 }
3855
3856 return (status);
3857}
3858
3859
3860/* ---------------------------------------------------------------------------
3861
3862 \fn sme_RoamRemoveKey
3863
3864 \brief To set encryption key. This is an asynchronous API.
3865
3866 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
3867
3868 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3869
3870 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3871
3872 FAILURE or RESOURCES The API finished and failed.
3873
3874 -------------------------------------------------------------------------------*/
3875eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
3876 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
3877{
3878 eHalStatus status = eHAL_STATUS_FAILURE;
3879 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3880 tANI_U32 roamId;
3881
3882 status = sme_AcquireGlobalLock( &pMac->sme );
3883 if ( HAL_STATUS_SUCCESS( status ) )
3884 {
3885 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3886 if(pRoamId)
3887 {
3888 *pRoamId = roamId;
3889 }
3890 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
3891 sme_ReleaseGlobalLock( &pMac->sme );
3892 }
3893
3894 return (status);
3895}
3896
3897/* ---------------------------------------------------------------------------
3898 \fn sme_GetRssi
3899 \brief a wrapper function that client calls to register a callback to get RSSI
3900
3901 \param callback - SME sends back the requested stats using the callback
3902 \param staId - The station ID for which the stats is requested for
3903 \param pContext - user context to be passed back along with the callback
3904 \param pVosContext - vos context
3905 \return eHalStatus
3906 ---------------------------------------------------------------------------*/
3907eHalStatus sme_GetRssi(tHalHandle hHal,
3908 tCsrRssiCallback callback,
3909 tANI_U8 staId, tCsrBssid bssId,
3910 void *pContext, void* pVosContext)
3911{
3912 eHalStatus status = eHAL_STATUS_FAILURE;
3913 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3914
3915 status = sme_AcquireGlobalLock( &pMac->sme );
3916 if ( HAL_STATUS_SUCCESS( status ) )
3917 {
3918 status = csrGetRssi( pMac, callback,
3919 staId, bssId, pContext, pVosContext);
3920 sme_ReleaseGlobalLock( &pMac->sme );
3921 }
3922 return (status);
3923}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003924#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3925/* ---------------------------------------------------------------------------
3926 \fn sme_GetRoamRssi
3927 \brief a wrapper function that client calls to register a callback to get Roam RSSI
3928
3929 \param callback - SME sends back the requested stats using the callback
3930 \param staId - The station ID for which the stats is requested for
3931 \param pContext - user context to be passed back along with the callback
3932 \param pVosContext - vos context
3933 \return eHalStatus
3934 ---------------------------------------------------------------------------*/
3935eHalStatus sme_GetRoamRssi(tHalHandle hHal,
3936 tCsrRssiCallback callback,
3937 tANI_U8 staId, tCsrBssid bssId,
3938 void *pContext, void* pVosContext)
3939{
3940 eHalStatus status = eHAL_STATUS_FAILURE;
3941 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3942
3943 status = sme_AcquireGlobalLock( &pMac->sme );
3944 if ( HAL_STATUS_SUCCESS( status ) )
3945 {
3946 status = csrGetRoamRssi( pMac, callback,
3947 staId, bssId, pContext, pVosContext);
3948 sme_ReleaseGlobalLock( &pMac->sme );
3949 }
3950 return (status);
3951}
3952#endif
3953
Jeff Johnson295189b2012-06-20 16:38:30 -07003954
3955/* ---------------------------------------------------------------------------
3956 \fn sme_GetStatistics
3957 \brief a wrapper function that client calls to register a callback to get
3958 different PHY level statistics from CSR.
3959
3960 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
3961 \param statsMask - The different category/categories of stats requester is looking for
3962 \param callback - SME sends back the requested stats using the callback
3963 \param periodicity - If requester needs periodic update in millisec, 0 means
3964 it's an one time request
3965 \param cache - If requester is happy with cached stats
3966 \param staId - The station ID for which the stats is requested for
3967 \param pContext - user context to be passed back along with the callback
3968 \return eHalStatus
3969 ---------------------------------------------------------------------------*/
3970eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
3971 tANI_U32 statsMask,
3972 tCsrStatsCallback callback,
3973 tANI_U32 periodicity, tANI_BOOLEAN cache,
3974 tANI_U8 staId, void *pContext)
3975{
3976 eHalStatus status = eHAL_STATUS_FAILURE;
3977 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3978
3979 status = sme_AcquireGlobalLock( &pMac->sme );
3980 if ( HAL_STATUS_SUCCESS( status ) )
3981 {
3982 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
3983 periodicity, cache, staId, pContext);
3984 sme_ReleaseGlobalLock( &pMac->sme );
3985 }
3986
3987 return (status);
3988
3989}
3990
3991/* ---------------------------------------------------------------------------
3992
3993 \fn sme_GetCountryCode
3994
3995 \brief To return the current country code. If no country code is applied, default country code is
3996 used to fill the buffer.
3997 If 11d supported is turned off, an error is return and the last applied/default country code is used.
3998 This is a synchronous API.
3999
4000 \param pBuf - pointer to a caller allocated buffer for returned country code.
4001
4002 \param pbLen For input, this parameter indicates how big is the buffer.
4003 Upon return, this parameter has the number of bytes for country. If pBuf
4004 doesn't have enough space, this function returns
4005 fail status and this parameter contains the number that is needed.
4006
4007 \return eHalStatus SUCCESS.
4008
4009 FAILURE or RESOURCES The API finished and failed.
4010
4011 -------------------------------------------------------------------------------*/
4012eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4013{
4014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4015
4016 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4017}
4018
4019
4020/* ---------------------------------------------------------------------------
4021
4022 \fn sme_SetCountryCode
4023
4024 \brief To change the current/default country code.
4025 If 11d supported is turned off, an error is return.
4026 This is a synchronous API.
4027
4028 \param pCountry - pointer to a caller allocated buffer for the country code.
4029
4030 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4031 whether a reset is required.
4032
4033 \return eHalStatus SUCCESS.
4034
4035 FAILURE or RESOURCES The API finished and failed.
4036
4037 -------------------------------------------------------------------------------*/
4038eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4039{
4040 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4041
4042 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4043}
4044
4045
4046/* ---------------------------------------------------------------------------
4047 \fn sme_ResetCountryCodeInformation
4048 \brief this function is to reset the country code current being used back to EEPROM default
4049 this includes channel list and power setting. This is a synchronous API.
4050 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4051 a restart is needed to apply the change
4052 \return eHalStatus
4053 -------------------------------------------------------------------------------*/
4054eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4055{
4056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4057
4058 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4059}
4060
4061
4062/* ---------------------------------------------------------------------------
4063 \fn sme_GetSupportedCountryCode
4064 \brief this function is to get a list of the country code current being supported
4065 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4066 this has the country code list. 3 bytes for each country code. This may be NULL if
4067 caller wants to know the needed byte count.
4068 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4069 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4070 \return eHalStatus
4071 -------------------------------------------------------------------------------*/
4072eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4073{
4074 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4075
4076 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4077}
4078
4079
4080/* ---------------------------------------------------------------------------
4081 \fn sme_GetCurrentRegulatoryDomain
4082 \brief this function is to get the current regulatory domain. This is a synchronous API.
4083 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4084 SME. The function fails if 11d support is turned off.
4085 \param pDomain - Caller allocated buffer to return the current domain.
4086 \return eHalStatus SUCCESS.
4087
4088 FAILURE or RESOURCES The API finished and failed.
4089 -------------------------------------------------------------------------------*/
4090eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4091{
4092 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4093 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4094
4095 if( pDomain )
4096 {
4097 if( csrIs11dSupported( pMac ) )
4098 {
4099 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4100 status = eHAL_STATUS_SUCCESS;
4101 }
4102 else
4103 {
4104 status = eHAL_STATUS_FAILURE;
4105 }
4106 }
4107
4108 return ( status );
4109}
4110
4111
4112/* ---------------------------------------------------------------------------
4113 \fn sme_SetRegulatoryDomain
4114 \brief this function is to set the current regulatory domain.
4115 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4116 SME. This is a synchronous API.
4117 \param domainId - indicate the domain (defined in the driver) needs to set to.
4118 See v_REGDOMAIN_t for definition
4119 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4120 a restart is needed to apply the change
4121 \return eHalStatus
4122 -------------------------------------------------------------------------------*/
4123eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4124{
4125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4126
4127 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4128}
4129
4130
4131/* ---------------------------------------------------------------------------
4132
4133 \fn sme_GetRegulatoryDomainForCountry
4134
4135 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4136
4137 \param pCountry - pointer to a caller allocated buffer for input country code.
4138
4139 \param pDomainId Upon successful return, it is the domain that country belongs to.
4140 If it is NULL, returning success means that the country code is known.
4141
4142 \return eHalStatus SUCCESS.
4143
4144 FAILURE or RESOURCES The API finished and failed.
4145
4146 -------------------------------------------------------------------------------*/
4147eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4148{
4149 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4150
4151 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4152}
4153
4154
4155
4156
4157/* ---------------------------------------------------------------------------
4158
4159 \fn sme_GetSupportedRegulatoryDomains
4160
4161 \brief To return a list of supported regulatory domains. This is a synchronous API.
4162
4163 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4164
4165 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4166 Upon return, this parameter has the number for supported domains. If pDomains
4167 doesn't have enough space for all the supported domains, this function returns
4168 fail status and this parameter contains the number that is needed.
4169
4170 \return eHalStatus SUCCESS.
4171
4172 FAILURE or RESOURCES The API finished and failed.
4173
4174 -------------------------------------------------------------------------------*/
4175eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4176{
4177 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4178
4179 //We support all domains for now
4180 if( pNumDomains )
4181 {
4182 if( NUM_REG_DOMAINS <= *pNumDomains )
4183 {
4184 status = eHAL_STATUS_SUCCESS;
4185 }
4186 *pNumDomains = NUM_REG_DOMAINS;
4187 }
4188 if( HAL_STATUS_SUCCESS( status ) )
4189 {
4190 if( pDomains )
4191 {
4192 pDomains[0] = REGDOMAIN_FCC;
4193 pDomains[1] = REGDOMAIN_ETSI;
4194 pDomains[2] = REGDOMAIN_JAPAN;
4195 pDomains[3] = REGDOMAIN_WORLD;
4196 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4197 pDomains[5] = REGDOMAIN_APAC;
4198 pDomains[6] = REGDOMAIN_KOREA;
4199 pDomains[7] = REGDOMAIN_HI_5GHZ;
4200 pDomains[8] = REGDOMAIN_NO_5GHZ;
4201 }
4202 else
4203 {
4204 status = eHAL_STATUS_INVALID_PARAMETER;
4205 }
4206 }
4207
4208 return ( status );
4209}
4210
4211
4212//some support functions
4213tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4214{
4215 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4216
4217 return ( csrIs11dSupported( pMac ) );
4218}
4219
4220
4221tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4222{
4223 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4224
4225 return ( csrIs11hSupported( pMac ) );
4226}
4227
4228
4229tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4230{
4231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4232
4233 return ( csrIsWmmSupported( pMac ) );
4234}
4235
4236//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4237eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4238{
4239 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4240
4241 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4242}
4243
4244/* ---------------------------------------------------------------------------
4245
4246 \fn sme_ChangeCountryCode
4247
4248 \brief Change Country code from upperlayer during WLAN driver operation.
4249 This is a synchronous API.
4250
4251 \param hHal - The handle returned by macOpen.
4252
4253 \param pCountry New Country Code String
4254
4255 \return eHalStatus SUCCESS.
4256
4257 FAILURE or RESOURCES The API finished and failed.
4258
4259 -------------------------------------------------------------------------------*/
4260eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4261 tSmeChangeCountryCallback callback,
4262 tANI_U8 *pCountry,
4263 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304264 void* pVosContext,
4265 tAniBool countryFromUserSpace )
Jeff Johnson295189b2012-06-20 16:38:30 -07004266{
4267 eHalStatus status = eHAL_STATUS_FAILURE;
4268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4269 vos_msg_t msg;
4270 tAniChangeCountryCodeReq *pMsg;
4271
4272 status = sme_AcquireGlobalLock( &pMac->sme );
4273 if ( HAL_STATUS_SUCCESS( status ) )
4274 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004275 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4277 if ( !HAL_STATUS_SUCCESS(status) )
4278 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004279 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004280 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 return status;
4282 }
4283
4284 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4285 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4286 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304287 pMsg->countryFromUserSpace = countryFromUserSpace;
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 pMsg->changeCCCallback = callback;
4289 pMsg->pDevContext = pContext;
4290 pMsg->pVosContext = pVosContext;
4291
4292 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4293 msg.bodyptr = pMsg;
4294 msg.reserved = 0;
4295
4296 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4297 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004298 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004299 palFreeMemory(pMac->hHdd, (void *)pMsg);
4300 status = eHAL_STATUS_FAILURE;
4301 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004302 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004303 sme_ReleaseGlobalLock( &pMac->sme );
4304 }
4305
4306 return (status);
4307}
4308
4309/* ---------------------------------------------------------------------------
4310 \fn sme_BtcSignalBtEvent
4311 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4312 BT event type and the current operating mode of Libra (full power,
4313 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4314 would be employed.
4315 \param hHal - The handle returned by macOpen.
4316 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4317 Caller owns the memory and is responsible for freeing it.
4318 \return VOS_STATUS
4319 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4320 if BTC execution mode is set to BTC_WLAN_ONLY
4321 or BTC_PTA_ONLY.
4322 VOS_STATUS_SUCCESS BT Event passed to HAL
4323 ---------------------------------------------------------------------------*/
4324VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4325{
4326 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4327#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4328 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4329
4330 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4331 {
4332 status = btcSignalBTEvent (hHal, pBtEvent);
4333 sme_ReleaseGlobalLock( &pMac->sme );
4334 }
4335#endif
4336 return (status);
4337}
4338
4339/* ---------------------------------------------------------------------------
4340 \fn sme_BtcSetConfig
4341 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4342 This function should be invoked only after CFG download has completed.
4343 Calling it after sme_HDDReadyInd is recommended.
4344 \param hHal - The handle returned by macOpen.
4345 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4346 Caller owns the memory and is responsible for freeing it.
4347 \return VOS_STATUS
4348 VOS_STATUS_E_FAILURE Config not passed to HAL.
4349 VOS_STATUS_SUCCESS Config passed to HAL
4350 ---------------------------------------------------------------------------*/
4351VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4352{
4353 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4354#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4356 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4357 {
4358 status = btcSetConfig (hHal, pSmeBtcConfig);
4359 sme_ReleaseGlobalLock( &pMac->sme );
4360 }
4361#endif
4362 return (status);
4363}
4364
4365/* ---------------------------------------------------------------------------
4366 \fn sme_BtcGetConfig
4367 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4368 \param hHal - The handle returned by macOpen.
4369 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4370 tSmeBtcConfig. Caller owns the memory and is responsible
4371 for freeing it.
4372 \return VOS_STATUS
4373 VOS_STATUS_E_FAILURE - failure
4374 VOS_STATUS_SUCCESS success
4375 ---------------------------------------------------------------------------*/
4376VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4377{
4378 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4379#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4381
4382 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4383 {
4384 status = btcGetConfig (hHal, pSmeBtcConfig);
4385 sme_ReleaseGlobalLock( &pMac->sme );
4386 }
4387#endif
4388 return (status);
4389}
4390/* ---------------------------------------------------------------------------
4391 \fn sme_SetCfgPrivacy
4392 \brief API to set configure privacy parameters
4393 \param hHal - The handle returned by macOpen.
4394 \param pProfile - Pointer CSR Roam profile.
4395 \param fPrivacy - This parameter indicates status of privacy
4396
4397 \return void
4398 ---------------------------------------------------------------------------*/
4399void sme_SetCfgPrivacy( tHalHandle hHal,
4400 tCsrRoamProfile *pProfile,
4401 tANI_BOOLEAN fPrivacy
4402 )
4403{
4404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4405 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4406 {
4407 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4408 sme_ReleaseGlobalLock( &pMac->sme );
4409 }
4410}
4411
4412#if defined WLAN_FEATURE_VOWIFI
4413/* ---------------------------------------------------------------------------
4414 \fn sme_NeighborReportRequest
4415 \brief API to request neighbor report.
4416 \param hHal - The handle returned by macOpen.
4417 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4418 tRrmNeighborReq. Caller owns the memory and is responsible
4419 for freeing it.
4420 \return VOS_STATUS
4421 VOS_STATUS_E_FAILURE - failure
4422 VOS_STATUS_SUCCESS success
4423 ---------------------------------------------------------------------------*/
4424VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4425 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4426{
4427 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4428 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4429
4430 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4431 {
4432 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4433 sme_ReleaseGlobalLock( &pMac->sme );
4434 }
4435
4436 return (status);
4437}
4438#endif
4439
4440//The following are debug APIs to support direct read/write register/memory
4441//They are placed in SME because HW cannot be access when in LOW_POWER state
4442//AND not connected. The knowledge and synchronization is done in SME
4443
4444//sme_DbgReadRegister
4445//Caller needs to validate the input values
4446VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4447{
4448 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4449 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004450 tPmcPowerState PowerState;
4451 tANI_U32 sessionId = 0;
4452
4453 /* 1) To make Quarky work in FTM mode **************************************/
4454
4455 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4456 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004457 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 {
4459 return VOS_STATUS_SUCCESS;
4460 }
4461 return VOS_STATUS_E_FAILURE;
4462 }
4463
4464 /* 2) NON FTM mode driver *************************************************/
4465
4466 /* Acquire SME global lock */
4467 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4468 {
4469 return VOS_STATUS_E_FAILURE;
4470 }
4471
4472 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4473 {
4474 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4475 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4476 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004477 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 {
4479 status = VOS_STATUS_SUCCESS;
4480 }
4481 else
4482 {
4483 status = VOS_STATUS_E_FAILURE;
4484 }
4485 }
4486 else
4487 {
4488 status = VOS_STATUS_E_FAILURE;
4489 }
4490 }
4491
4492 /* This is a hack for Qualky/pttWniSocket
4493 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4494 if ( VOS_STATUS_SUCCESS != status )
4495 {
4496 *pRegValue = 0xDEADBEEF;
4497 status = VOS_STATUS_SUCCESS;
4498 }
4499
4500 /* Release SME global lock */
4501 sme_ReleaseGlobalLock(&pMac->sme);
4502
4503 return (status);
4504}
4505
4506
4507//sme_DbgWriteRegister
4508//Caller needs to validate the input values
4509VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4510{
4511 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4512 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004513 tPmcPowerState PowerState;
4514 tANI_U32 sessionId = 0;
4515
4516 /* 1) To make Quarky work in FTM mode **************************************/
4517
4518 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4519 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004520 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004521 {
4522 return VOS_STATUS_SUCCESS;
4523 }
4524 return VOS_STATUS_E_FAILURE;
4525 }
4526
4527 /* 2) NON FTM mode driver *************************************************/
4528
4529 /* Acquire SME global lock */
4530 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4531 {
4532 return VOS_STATUS_E_FAILURE;
4533 }
4534
4535 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4536 {
4537 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4538 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4539 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004540 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 {
4542 status = VOS_STATUS_SUCCESS;
4543 }
4544 else
4545 {
4546 status = VOS_STATUS_E_FAILURE;
4547 }
4548 }
4549 else
4550 {
4551 status = VOS_STATUS_E_FAILURE;
4552 }
4553 }
4554
4555 /* Release SME global lock */
4556 sme_ReleaseGlobalLock(&pMac->sme);
4557
4558 return (status);
4559}
4560
4561
4562
4563//sme_DbgReadMemory
4564//Caller needs to validate the input values
4565//pBuf caller allocated buffer has the length of nLen
4566VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4567{
4568 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 tPmcPowerState PowerState;
4571 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004572 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4573 tANI_U32 arg1 = memAddr;
4574 tANI_U32 arg2 = nLen/4;
4575 tANI_U32 arg3 = 4;
4576 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 /* 1) To make Quarky work in FTM mode **************************************/
4578
4579 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4580 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004581 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 {
4583 return VOS_STATUS_SUCCESS;
4584 }
4585 return VOS_STATUS_E_FAILURE;
4586 }
4587
4588 /* 2) NON FTM mode driver *************************************************/
4589
4590 /* Acquire SME global lock */
4591 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4592 {
4593 return VOS_STATUS_E_FAILURE;
4594 }
4595
4596 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4597 {
4598 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4599 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4600 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004601 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004602 {
4603 status = VOS_STATUS_SUCCESS;
4604 }
4605 else
4606 {
4607 status = VOS_STATUS_E_FAILURE;
4608 }
4609 }
4610 else
4611 {
4612 status = VOS_STATUS_E_FAILURE;
4613 }
4614 }
4615
4616 /* This is a hack for Qualky/pttWniSocket
4617 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4618 if (VOS_STATUS_SUCCESS != status)
4619 {
4620 vos_mem_set(pBuf, nLen, 0xCD);
4621 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004622 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 }
4624
4625 /* Release SME lock */
4626 sme_ReleaseGlobalLock(&pMac->sme);
4627
4628 return (status);
4629}
4630
4631
4632//sme_DbgWriteMemory
4633//Caller needs to validate the input values
4634VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4635{
4636 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4637 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004638 tPmcPowerState PowerState;
4639 tANI_U32 sessionId = 0;
4640
4641 /* 1) To make Quarky work in FTM mode **************************************/
4642
4643 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4644 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 {
4646 return VOS_STATUS_SUCCESS;
4647 }
4648 return VOS_STATUS_E_FAILURE;
4649 }
4650
4651 /* 2) NON FTM mode driver *************************************************/
4652
4653 /* Acquire SME global lock */
4654 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4655 {
4656 return VOS_STATUS_E_FAILURE;
4657 }
4658
4659 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4660 {
4661 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4662 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4663 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07004665 {
4666 status = VOS_STATUS_SUCCESS;
4667 }
4668 else
4669 {
4670 status = VOS_STATUS_E_FAILURE;
4671 }
4672 }
4673 else
4674 {
4675 status = VOS_STATUS_E_FAILURE;
4676 }
4677 }
4678
4679 /* Release Global lock */
4680 sme_ReleaseGlobalLock(&pMac->sme);
4681
4682 return (status);
4683}
4684
4685
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004686void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07004687{
4688#ifdef WLAN_DEBUG
4689 // Verify against current log level
4690 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
4691 return;
4692 else
4693 {
4694 va_list marker;
4695
4696 va_start( marker, pString ); /* Initialize variable arguments. */
4697
4698 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
4699
4700 va_end( marker ); /* Reset variable arguments. */
4701 }
4702#endif
4703}
Jeff Johnson295189b2012-06-20 16:38:30 -07004704
Jeff Johnson295189b2012-06-20 16:38:30 -07004705/* ---------------------------------------------------------------------------
4706 \fn sme_GetWcnssWlanCompiledVersion
4707 \brief This API returns the version of the WCNSS WLAN API with
4708 which the HOST driver was built
4709 \param hHal - The handle returned by macOpen.
4710 \param pVersion - Points to the Version structure to be filled
4711 \return VOS_STATUS
4712 VOS_STATUS_E_INVAL - failure
4713 VOS_STATUS_SUCCESS success
4714 ---------------------------------------------------------------------------*/
4715VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
4716 tSirVersionType *pVersion)
4717{
4718 VOS_STATUS status = VOS_STATUS_SUCCESS;
4719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4720 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4721
4722 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4723 {
4724 if( pVersion != NULL )
4725 {
4726 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
4727 }
4728 else
4729 {
4730 status = VOS_STATUS_E_INVAL;
4731 }
4732 sme_ReleaseGlobalLock( &pMac->sme );
4733 }
4734
4735 return (status);
4736}
4737
4738
4739/* ---------------------------------------------------------------------------
4740 \fn sme_GetWcnssWlanReportedVersion
4741 \brief This API returns the version of the WCNSS WLAN API with
4742 which the WCNSS driver reports it was built
4743 \param hHal - The handle returned by macOpen.
4744 \param pVersion - Points to the Version structure to be filled
4745 \return VOS_STATUS
4746 VOS_STATUS_E_INVAL - failure
4747 VOS_STATUS_SUCCESS success
4748 ---------------------------------------------------------------------------*/
4749VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
4750 tSirVersionType *pVersion)
4751{
4752 VOS_STATUS status = VOS_STATUS_SUCCESS;
4753 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4754 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4755
4756 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4757 {
4758 if( pVersion != NULL )
4759 {
4760 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
4761 }
4762 else
4763 {
4764 status = VOS_STATUS_E_INVAL;
4765 }
4766 sme_ReleaseGlobalLock( &pMac->sme );
4767 }
4768
4769 return (status);
4770}
4771
4772
4773/* ---------------------------------------------------------------------------
4774 \fn sme_GetWcnssSoftwareVersion
4775 \brief This API returns the version string of the WCNSS driver
4776 \param hHal - The handle returned by macOpen.
4777 \param pVersion - Points to the Version string buffer to be filled
4778 \param versionBufferSize - THe size of the Version string buffer
4779 \return VOS_STATUS
4780 VOS_STATUS_E_INVAL - failure
4781 VOS_STATUS_SUCCESS success
4782 ---------------------------------------------------------------------------*/
4783VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
4784 tANI_U8 *pVersion,
4785 tANI_U32 versionBufferSize)
4786{
4787 VOS_STATUS status = VOS_STATUS_SUCCESS;
4788 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4789 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4790
4791 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4792 {
4793 if( pVersion != NULL )
4794 {
4795 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
4796 versionBufferSize);
4797 }
4798 else
4799 {
4800 status = VOS_STATUS_E_INVAL;
4801 }
4802 sme_ReleaseGlobalLock( &pMac->sme );
4803 }
4804
4805 return (status);
4806}
4807
4808
4809/* ---------------------------------------------------------------------------
4810 \fn sme_GetWcnssHardwareVersion
4811 \brief This API returns the version string of the WCNSS hardware
4812 \param hHal - The handle returned by macOpen.
4813 \param pVersion - Points to the Version string buffer to be filled
4814 \param versionBufferSize - THe size of the Version string buffer
4815 \return VOS_STATUS
4816 VOS_STATUS_E_INVAL - failure
4817 VOS_STATUS_SUCCESS success
4818 ---------------------------------------------------------------------------*/
4819VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
4820 tANI_U8 *pVersion,
4821 tANI_U32 versionBufferSize)
4822{
4823 VOS_STATUS status = VOS_STATUS_SUCCESS;
4824 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4825 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4826
4827 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4828 {
4829 if( pVersion != NULL )
4830 {
4831 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
4832 versionBufferSize);
4833 }
4834 else
4835 {
4836 status = VOS_STATUS_E_INVAL;
4837 }
4838 sme_ReleaseGlobalLock( &pMac->sme );
4839 }
4840
4841 return (status);
4842}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08004843
Jeff Johnson295189b2012-06-20 16:38:30 -07004844
4845#ifdef FEATURE_WLAN_WAPI
4846/* ---------------------------------------------------------------------------
4847 \fn sme_RoamSetBKIDCache
4848 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
4849 candidate list.
4850 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4851 it is opened (by calling halOpen).
4852 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
4853 \param numItems - a variable that has the number of tBkidCacheInfo allocated
4854 when retruning, this is the number of items put into pBKIDCache
4855 \return eHalStatus - when fail, it usually means the buffer allocated is not
4856 big enough and pNumItems has the number of tBkidCacheInfo.
4857 ---------------------------------------------------------------------------*/
4858eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
4859 tANI_U32 numItems )
4860{
4861 eHalStatus status = eHAL_STATUS_FAILURE;
4862 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4863
4864 status = sme_AcquireGlobalLock( &pMac->sme );
4865 if ( HAL_STATUS_SUCCESS( status ) )
4866 {
4867 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
4868 sme_ReleaseGlobalLock( &pMac->sme );
4869 }
4870
4871 return (status);
4872}
4873
4874/* ---------------------------------------------------------------------------
4875 \fn sme_RoamGetBKIDCache
4876 \brief The SME API exposed to HDD to allow HDD to request SME to return its
4877 BKID cache.
4878 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4879 it is opened (by calling halOpen).
4880 \param pNum - caller allocated memory that has the space of the number of
4881 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
4882 in SME cache.
4883 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
4884 upon return
4885 \return eHalStatus - when fail, it usually means the buffer allocated is not
4886 big enough.
4887 ---------------------------------------------------------------------------*/
4888eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
4889 tBkidCacheInfo *pBkidCache)
4890{
4891 eHalStatus status = eHAL_STATUS_FAILURE;
4892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4893
4894 status = sme_AcquireGlobalLock( &pMac->sme );
4895 if ( HAL_STATUS_SUCCESS( status ) )
4896 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004897 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
4899 sme_ReleaseGlobalLock( &pMac->sme );
4900 }
4901
4902 return (status);
4903}
4904
4905/* ---------------------------------------------------------------------------
4906 \fn sme_RoamGetNumBKIDCache
4907 \brief The SME API exposed to HDD to allow HDD to request SME to return the
4908 number of BKID cache entries.
4909 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4910 it is opened (by calling halOpen).
4911 \return tANI_U32 - the number of BKID cache entries.
4912 ---------------------------------------------------------------------------*/
4913tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
4914{
4915 eHalStatus status = eHAL_STATUS_FAILURE;
4916 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4917 tANI_U32 numBkidCache = 0;
4918
4919 status = sme_AcquireGlobalLock( &pMac->sme );
4920 if ( HAL_STATUS_SUCCESS( status ) )
4921 {
4922 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
4923 sme_ReleaseGlobalLock( &pMac->sme );
4924 }
4925
4926 return (numBkidCache);
4927}
4928
4929/* ---------------------------------------------------------------------------
4930 \fn sme_ScanGetBKIDCandidateList
4931 \brief a wrapper function to return the BKID candidate list
4932 \param pBkidList - caller allocated buffer point to an array of
4933 tBkidCandidateInfo
4934 \param pNumItems - pointer to a variable that has the number of
4935 tBkidCandidateInfo allocated when retruning, this is
4936 either the number needed or number of items put into
4937 pPmkidList
4938 \return eHalStatus - when fail, it usually means the buffer allocated is not
4939 big enough and pNumItems
4940 has the number of tBkidCandidateInfo.
4941 \Note: pNumItems is a number of tBkidCandidateInfo,
4942 not sizeof(tBkidCandidateInfo) * something
4943 ---------------------------------------------------------------------------*/
4944eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
4945 tBkidCandidateInfo *pBkidList,
4946 tANI_U32 *pNumItems )
4947{
4948 eHalStatus status = eHAL_STATUS_FAILURE;
4949 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4950
4951 status = sme_AcquireGlobalLock( &pMac->sme );
4952 if ( HAL_STATUS_SUCCESS( status ) )
4953 {
4954 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
4955 sme_ReleaseGlobalLock( &pMac->sme );
4956 }
4957
4958 return (status);
4959}
4960#endif /* FEATURE_WLAN_WAPI */
4961
Jeff Johnsone7245742012-09-05 17:12:55 -07004962#ifdef FEATURE_OEM_DATA_SUPPORT
4963
4964/*****************************************************************************
4965 OEM DATA related modifications and function additions
4966 *****************************************************************************/
4967
4968/* ---------------------------------------------------------------------------
4969 \fn sme_getOemDataRsp
4970 \brief a wrapper function to obtain the OEM DATA RSP
4971 \param pOemDataRsp - A pointer to the response object
4972 \param pContext - a pointer passed in for the callback
4973 \return eHalStatus
4974 ---------------------------------------------------------------------------*/
4975eHalStatus sme_getOemDataRsp(tHalHandle hHal,
4976 tOemDataRsp **pOemDataRsp)
4977{
4978 eHalStatus status = eHAL_STATUS_SUCCESS;
4979 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4980
4981 do
4982 {
4983 //acquire the lock for the sme object
4984 status = sme_AcquireGlobalLock(&pMac->sme);
4985
4986 if(!HAL_STATUS_SUCCESS(status))
4987 {
4988 break;
4989 }
4990
4991 if(pMac->oemData.pOemDataRsp != NULL)
4992 {
4993 *pOemDataRsp = pMac->oemData.pOemDataRsp;
4994 }
4995 else
4996 {
4997 status = eHAL_STATUS_FAILURE;
4998 }
4999
5000 //release the lock for the sme object
5001 sme_ReleaseGlobalLock( &pMac->sme );
5002
5003 } while(0);
5004
5005 return status;
5006}
5007
5008/* ---------------------------------------------------------------------------
5009 \fn sme_OemDataReq
5010 \brief a wrapper function for OEM DATA REQ
5011 \param sessionId - session id to be used.
5012 \param pOemDataReqId - pointer to an object to get back the request ID
5013 \param callback - a callback function that is called upon finish
5014 \param pContext - a pointer passed in for the callback
5015 \return eHalStatus
5016 ---------------------------------------------------------------------------*/
5017eHalStatus sme_OemDataReq(tHalHandle hHal,
5018 tANI_U8 sessionId,
5019 tOemDataReqConfig *pOemDataReqConfig,
5020 tANI_U32 *pOemDataReqID,
5021 oemData_OemDataReqCompleteCallback callback,
5022 void *pContext)
5023{
5024 eHalStatus status = eHAL_STATUS_SUCCESS;
5025 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5026
5027 do
5028 {
5029 //acquire the lock for the sme object
5030 status = sme_AcquireGlobalLock(&pMac->sme);
5031 if(HAL_STATUS_SUCCESS(status))
5032 {
5033 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5034
5035 if(pOemDataReqID)
5036 {
5037 *pOemDataReqID = lOemDataReqId;
5038 }
5039 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005040 {
5041 sme_ReleaseGlobalLock( &pMac->sme );
5042 return eHAL_STATUS_FAILURE;
5043 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005044
5045 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5046
5047 //release the lock for the sme object
5048 sme_ReleaseGlobalLock( &pMac->sme );
5049 }
5050 } while(0);
5051
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005052 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005053
5054 return(status);
5055}
5056
5057#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005058
5059/*--------------------------------------------------------------------------
5060
5061 \brief sme_OpenSession() - Open a session for scan/roam operation.
5062
5063 This is a synchronous API.
5064
5065
5066 \param hHal - The handle returned by macOpen.
5067 \param callback - A pointer to the function caller specifies for roam/connect status indication
5068 \param pContext - The context passed with callback
5069 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5070 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5071
5072 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5073
5074 Other status means SME is failed to open the session.
5075 eHAL_STATUS_RESOURCES - no more session available.
5076 \sa
5077
5078 --------------------------------------------------------------------------*/
5079eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext,
5080 tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId)
5081{
5082 eHalStatus status;
5083 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5084
5085 if( NULL == pbSessionId )
5086 {
5087 status = eHAL_STATUS_INVALID_PARAMETER;
5088 }
5089 else
5090 {
5091 status = sme_AcquireGlobalLock( &pMac->sme );
5092 if ( HAL_STATUS_SUCCESS( status ) )
5093 {
5094 status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId );
5095
5096 sme_ReleaseGlobalLock( &pMac->sme );
5097 }
5098 }
5099
5100 return ( status );
5101}
5102
5103
5104/*--------------------------------------------------------------------------
5105
5106 \brief sme_CloseSession() - Open a session for scan/roam operation.
5107
5108 This is a synchronous API.
5109
5110
5111 \param hHal - The handle returned by macOpen.
5112
5113 \param sessionId - A previous opened session's ID.
5114
5115 \return eHAL_STATUS_SUCCESS - session is closed.
5116
5117 Other status means SME is failed to open the session.
5118 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5119 \sa
5120
5121 --------------------------------------------------------------------------*/
5122eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5123 csrRoamSessionCloseCallback callback, void *pContext)
5124{
5125 eHalStatus status;
5126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5127
5128 status = sme_AcquireGlobalLock( &pMac->sme );
5129 if ( HAL_STATUS_SUCCESS( status ) )
5130 {
5131 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5132 callback, pContext );
5133
5134 sme_ReleaseGlobalLock( &pMac->sme );
5135 }
5136
5137 return ( status );
5138}
5139
Jeff Johnson295189b2012-06-20 16:38:30 -07005140/* ---------------------------------------------------------------------------
5141
5142 \fn sme_RoamUpdateAPWPSIE
5143
5144 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5145 This is an asynchronous API.
5146
5147 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5148
5149 \return eHalStatus – SUCCESS –
5150
5151 FAILURE or RESOURCES – The API finished and failed.
5152
5153 -------------------------------------------------------------------------------*/
5154eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5155{
5156
5157 eHalStatus status = eHAL_STATUS_FAILURE;
5158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5159
5160 status = sme_AcquireGlobalLock( &pMac->sme );
5161 if ( HAL_STATUS_SUCCESS( status ) )
5162 {
5163
5164 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5165
5166 sme_ReleaseGlobalLock( &pMac->sme );
5167 }
5168
5169 return (status);
5170}
5171/* ---------------------------------------------------------------------------
5172
5173 \fn sme_RoamUpdateAPWPARSNIEs
5174
5175 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5176 This is an asynchronous API.
5177
5178 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5179
5180 \return eHalStatus – SUCCESS –
5181
5182 FAILURE or RESOURCES – The API finished and failed.
5183
5184 -------------------------------------------------------------------------------*/
5185eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5186{
5187
5188 eHalStatus status = eHAL_STATUS_FAILURE;
5189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5190
5191 status = sme_AcquireGlobalLock( &pMac->sme );
5192 if ( HAL_STATUS_SUCCESS( status ) )
5193 {
5194
5195 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5196
5197 sme_ReleaseGlobalLock( &pMac->sme );
5198 }
5199
5200 return (status);
5201}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005202/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005203
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005204 \fn sme_ChangeMCCBeaconInterval
5205
5206 \brief To update P2P-GO beaconInterval. This function should be called after
5207 disassociating all the station is done
5208 This is an asynchronous API.
5209
5210 \param
5211
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005212 \return eHalStatus SUCCESS
5213 FAILURE or RESOURCES
5214 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005215
5216 -------------------------------------------------------------------------------*/
5217eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5218{
5219 eHalStatus status = eHAL_STATUS_FAILURE;
5220 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5221
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005222 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005223 status = sme_AcquireGlobalLock( &pMac->sme );
5224 if ( HAL_STATUS_SUCCESS( status ) )
5225 {
5226 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5227 sme_ReleaseGlobalLock( &pMac->sme );
5228 }
5229 return (status);
5230}
Jeff Johnson295189b2012-06-20 16:38:30 -07005231
5232/*-------------------------------------------------------------------------------*
5233
5234 \fn sme_sendBTAmpEvent
5235
5236 \brief to receive the coex priorty request from BT-AMP PAL
5237 and send the BT_AMP link state to HAL
5238
5239 \param btAmpEvent - btAmpEvent
5240
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005241 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005242
5243 FAILURE: API failed
5244
5245-------------------------------------------------------------------------------*/
5246
5247eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5248{
5249 vos_msg_t msg;
5250 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5251 eHalStatus status = eHAL_STATUS_FAILURE;
5252
5253 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5254 if (NULL == ptrSmeBtAmpEvent)
5255 {
5256 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005257 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005258 return status;
5259 }
5260
5261 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5262 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5263 msg.reserved = 0;
5264 msg.bodyptr = ptrSmeBtAmpEvent;
5265
5266 //status = halFW_SendBTAmpEventMesg(pMac, event);
5267
5268 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5269 {
5270 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005271 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005272 vos_mem_free(ptrSmeBtAmpEvent);
5273 return status;
5274 }
5275
5276 return eHAL_STATUS_SUCCESS;
5277
5278}
5279
5280/* ---------------------------------------------------------------------------
5281 \fn sme_SetHostOffload
5282 \brief API to set the host offload feature.
5283 \param hHal - The handle returned by macOpen.
5284 \param pRequest - Pointer to the offload request.
5285 \return eHalStatus
5286 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005287eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5288 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005289{
5290 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005291 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005292
5293 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5294 {
5295#ifdef WLAN_NS_OFFLOAD
5296 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5297 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005298 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005299 }
5300 else
5301#endif //WLAN_NS_OFFLOAD
5302 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005303 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005304 }
5305 sme_ReleaseGlobalLock( &pMac->sme );
5306 }
5307
5308 return (status);
5309}
5310
5311#ifdef WLAN_FEATURE_GTK_OFFLOAD
5312/* ---------------------------------------------------------------------------
5313 \fn sme_SetGTKOffload
5314 \brief API to set GTK offload information.
5315 \param hHal - The handle returned by macOpen.
5316 \param pRequest - Pointer to the GTK offload request.
5317 \return eHalStatus
5318 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005319eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5320 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005321{
5322 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5323 eHalStatus status;
5324
5325 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5326 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005327 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005328 sme_ReleaseGlobalLock( &pMac->sme );
5329 }
5330
5331 return (status);
5332}
5333
5334/* ---------------------------------------------------------------------------
5335 \fn sme_GetGTKOffload
5336 \brief API to get GTK offload information.
5337 \param hHal - The handle returned by macOpen.
5338 \param pRequest - Pointer to the GTK offload response.
5339 \return eHalStatus
5340 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005341eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5342 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005343{
5344 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5345 eHalStatus status;
5346
5347 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5348 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005349 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005350 sme_ReleaseGlobalLock( &pMac->sme );
5351 }
5352
5353 return (status);
5354}
5355#endif // WLAN_FEATURE_GTK_OFFLOAD
5356
5357/* ---------------------------------------------------------------------------
5358 \fn sme_SetKeepAlive
5359 \brief API to set the Keep Alive feature.
5360 \param hHal - The handle returned by macOpen.
5361 \param pRequest - Pointer to the Keep Alive request.
5362 \return eHalStatus
5363 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005364eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5365 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005366{
5367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5368 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005369 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5370 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005371 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005372 sme_ReleaseGlobalLock( &pMac->sme );
5373 }
5374
5375 return (status);
5376}
5377
5378#ifdef FEATURE_WLAN_SCAN_PNO
5379/* ---------------------------------------------------------------------------
5380 \fn sme_SetPreferredNetworkList
5381 \brief API to set the Preferred Network List Offload feature.
5382 \param hHal - The handle returned by macOpen.
5383 \param pRequest - Pointer to the offload request.
5384 \return eHalStatus
5385 ---------------------------------------------------------------------------*/
5386eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5387{
5388 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5389 eHalStatus status;
5390
5391 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5392 {
5393 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5394 sme_ReleaseGlobalLock( &pMac->sme );
5395 }
5396
5397 return (status);
5398}
5399
5400eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5401{
5402 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5403 eHalStatus status;
5404
5405 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5406 {
5407 pmcSetRssiFilter(hHal, rssiThreshold);
5408 sme_ReleaseGlobalLock( &pMac->sme );
5409 }
5410
5411 return (status);
5412}
5413
5414#endif // FEATURE_WLAN_SCAN_PNO
5415
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005416eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005417{
5418 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5419 eHalStatus status;
5420
5421 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5422 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005423 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005424 sme_ReleaseGlobalLock( &pMac->sme );
5425 }
5426
5427 return (status);
5428}
5429
5430/* ---------------------------------------------------------------------------
5431 \fn sme_AbortMacScan
5432 \brief API to cancel MAC scan.
5433 \param hHal - The handle returned by macOpen.
5434 \return VOS_STATUS
5435 VOS_STATUS_E_FAILURE - failure
5436 VOS_STATUS_SUCCESS success
5437 ---------------------------------------------------------------------------*/
5438eHalStatus sme_AbortMacScan(tHalHandle hHal)
5439{
5440 eHalStatus status;
5441 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5442
5443 status = sme_AcquireGlobalLock( &pMac->sme );
5444 if ( HAL_STATUS_SUCCESS( status ) )
5445 {
5446 status = csrScanAbortMacScan(pMac);
5447
5448 sme_ReleaseGlobalLock( &pMac->sme );
5449 }
5450
5451 return ( status );
5452}
5453
5454/* ----------------------------------------------------------------------------
5455 \fn sme_GetOperationChannel
5456 \brief API to get current channel on which STA is parked
5457 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005458 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005459 \returns eHAL_STATUS_SUCCESS
5460 eHAL_STATUS_FAILURE
5461-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005462eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005463{
Jeff Johnson295189b2012-06-20 16:38:30 -07005464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5465 tCsrRoamSession *pSession;
5466
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005467 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005468 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005469 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005470
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005471 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5472 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005473 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005474 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5475 {
5476 *pChannel =pSession->connectedProfile.operationChannel;
5477 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005478 }
5479 }
5480 return eHAL_STATUS_FAILURE;
5481}// sme_GetOperationChannel ends here
5482
Jeff Johnson295189b2012-06-20 16:38:30 -07005483/* ---------------------------------------------------------------------------
5484
5485 \fn sme_RegisterMgtFrame
5486
5487 \brief To register managment frame of specified type and subtype.
5488 \param frameType - type of the frame that needs to be passed to HDD.
5489 \param matchData - data which needs to be matched before passing frame
5490 to HDD.
5491 \param matchDataLen - Length of matched data.
5492 \return eHalStatus
5493 -------------------------------------------------------------------------------*/
5494eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5495 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5496{
5497 eHalStatus status = eHAL_STATUS_SUCCESS;
5498 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5499
5500 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5501 {
5502 tSirRegisterMgmtFrame *pMsg;
5503 tANI_U16 len;
5504 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005505
5506 if(!pSession)
5507 {
5508 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005509 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005510 return eHAL_STATUS_FAILURE;
5511 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005512
5513 if( !pSession->sessionActive )
5514 {
5515 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005516 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005517 sme_ReleaseGlobalLock( &pMac->sme );
5518 return eHAL_STATUS_FAILURE;
5519 }
5520
5521 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5522
5523 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5524 if(HAL_STATUS_SUCCESS(status))
5525 {
5526 palZeroMemory(pMac->hHdd, pMsg, len);
5527 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5528 pMsg->length = len;
5529 pMsg->sessionId = sessionId;
5530 pMsg->registerFrame = VOS_TRUE;
5531 pMsg->frameType = frameType;
5532 pMsg->matchLen = matchLen;
5533 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5534 status = palSendMBMessage(pMac->hHdd, pMsg);
5535 }
5536 sme_ReleaseGlobalLock( &pMac->sme );
5537 }
5538 return status;
5539}
5540
5541/* ---------------------------------------------------------------------------
5542
5543 \fn sme_DeregisterMgtFrame
5544
5545 \brief To De-register managment frame of specified type and subtype.
5546 \param frameType - type of the frame that needs to be passed to HDD.
5547 \param matchData - data which needs to be matched before passing frame
5548 to HDD.
5549 \param matchDataLen - Length of matched data.
5550 \return eHalStatus
5551 -------------------------------------------------------------------------------*/
5552eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5553 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5554{
5555 eHalStatus status = eHAL_STATUS_SUCCESS;
5556 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5557
5558 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5559 {
5560 tSirRegisterMgmtFrame *pMsg;
5561 tANI_U16 len;
5562 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005563
5564 if(!pSession)
5565 {
5566 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005567 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005568 return eHAL_STATUS_FAILURE;
5569 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005570
5571 if( !pSession->sessionActive )
5572 {
5573 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005574 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005575 sme_ReleaseGlobalLock( &pMac->sme );
5576 return eHAL_STATUS_FAILURE;
5577 }
5578
5579 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5580
5581 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5582 if(HAL_STATUS_SUCCESS(status))
5583 {
5584 palZeroMemory(pMac->hHdd, pMsg, len);
5585 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5586 pMsg->length = len;
5587 pMsg->registerFrame = VOS_FALSE;
5588 pMsg->frameType = frameType;
5589 pMsg->matchLen = matchLen;
5590 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5591 status = palSendMBMessage(pMac->hHdd, pMsg);
5592 }
5593 sme_ReleaseGlobalLock( &pMac->sme );
5594 }
5595 return status;
5596}
5597
5598/* ---------------------------------------------------------------------------
5599 \fn sme_RemainOnChannel
5600 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
5601 \param hHal - The handle returned by macOpen.
5602 \param pRequest - channel
5603 \param duration - duration in ms
5604 \param callback - HDD registered callback to process reaminOnChannelRsp
5605 \param context - HDD Callback param
5606 \return eHalStatus
5607 ---------------------------------------------------------------------------*/
5608
5609eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
5610 tANI_U8 channel, tANI_U32 duration,
5611 remainOnChanCallback callback,
5612 void *pContext)
5613{
5614 eHalStatus status = eHAL_STATUS_SUCCESS;
5615 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5616
5617 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5618 {
5619 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext
5620#ifdef WLAN_FEATURE_P2P_INTERNAL
5621 , eP2PRemainOnChnReasonUnknown
5622#endif
5623 );
5624 sme_ReleaseGlobalLock( &pMac->sme );
5625 }
5626 return(status);
5627}
5628
5629/* ---------------------------------------------------------------------------
5630 \fn sme_ReportProbeReq
5631 \brief API to enable/disable forwarding of probeReq to apps in p2p.
5632 \param hHal - The handle returned by macOpen.
5633 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
5634 \return eHalStatus
5635 ---------------------------------------------------------------------------*/
5636
5637#ifndef WLAN_FEATURE_CONCURRENT_P2P
5638eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
5639{
5640 eHalStatus status = eHAL_STATUS_SUCCESS;
5641 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5642
5643 do
5644 {
5645 //acquire the lock for the sme object
5646 status = sme_AcquireGlobalLock(&pMac->sme);
5647 if(HAL_STATUS_SUCCESS(status))
5648 {
5649 /* call set in context */
5650 pMac->p2pContext.probeReqForwarding = flag;
5651 //release the lock for the sme object
5652 sme_ReleaseGlobalLock( &pMac->sme );
5653 }
5654 } while(0);
5655
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005656 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005657
5658 return(status);
5659}
5660
5661/* ---------------------------------------------------------------------------
5662 \fn sme_updateP2pIe
5663 \brief API to set the P2p Ie in p2p context
5664 \param hHal - The handle returned by macOpen.
5665 \param p2pIe - Ptr to p2pIe from HDD.
5666 \param p2pIeLength: length of p2pIe
5667 \return eHalStatus
5668 ---------------------------------------------------------------------------*/
5669
5670eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
5671{
5672 eHalStatus status = eHAL_STATUS_SUCCESS;
5673 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5674
5675 //acquire the lock for the sme object
5676 status = sme_AcquireGlobalLock(&pMac->sme);
5677 if(HAL_STATUS_SUCCESS(status))
5678 {
5679 if(NULL != pMac->p2pContext.probeRspIe){
5680 vos_mem_free(pMac->p2pContext.probeRspIe);
5681 pMac->p2pContext.probeRspIeLength = 0;
5682 }
5683
5684 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
5685 if (NULL == pMac->p2pContext.probeRspIe)
5686 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005687 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005688 pMac->p2pContext.probeRspIeLength = 0;
5689 status = eHAL_STATUS_FAILURE;
5690 }
5691 else
5692 {
5693 pMac->p2pContext.probeRspIeLength = p2pIeLength;
5694
5695 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
5696 pMac->p2pContext.probeRspIe,
5697 pMac->p2pContext.probeRspIeLength );
5698 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
5699 p2pIeLength);
5700 }
5701
5702 //release the lock for the sme object
5703 sme_ReleaseGlobalLock( &pMac->sme );
5704 }
5705
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005706 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005707
5708 return(status);
5709}
5710#endif
5711
5712/* ---------------------------------------------------------------------------
5713 \fn sme_sendAction
5714 \brief API to send action frame from supplicant.
5715 \param hHal - The handle returned by macOpen.
5716 \return eHalStatus
5717 ---------------------------------------------------------------------------*/
5718
5719eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07005720 const tANI_U8 *pBuf, tANI_U32 len,
5721 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07005722{
5723 eHalStatus status = eHAL_STATUS_SUCCESS;
5724 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5725
5726 //acquire the lock for the sme object
5727 status = sme_AcquireGlobalLock(&pMac->sme);
5728 if(HAL_STATUS_SUCCESS(status))
5729 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005730 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07005731 //release the lock for the sme object
5732 sme_ReleaseGlobalLock( &pMac->sme );
5733 }
5734
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005735 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005736
5737 return(status);
5738}
5739
5740eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
5741{
5742 eHalStatus status = eHAL_STATUS_SUCCESS;
5743 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5744
5745 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5746 {
5747 status = p2pCancelRemainOnChannel (hHal, sessionId);
5748 sme_ReleaseGlobalLock( &pMac->sme );
5749 }
5750 return(status);
5751}
5752
5753//Power Save Related
5754eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
5755{
5756 eHalStatus status = eHAL_STATUS_SUCCESS;
5757 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5758
5759 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5760 {
5761 status = p2pSetPs (hHal, data);
5762 sme_ReleaseGlobalLock( &pMac->sme );
5763 }
5764 return(status);
5765}
5766
Jeff Johnson295189b2012-06-20 16:38:30 -07005767
5768/* ---------------------------------------------------------------------------
5769
5770 \fn sme_ConfigureRxpFilter
5771
5772 \brief
5773 SME will pass this request to lower mac to set/reset the filter on RXP for
5774 multicast & broadcast traffic.
5775
5776 \param
5777
5778 hHal - The handle returned by macOpen.
5779
5780 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
5781 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
5782 on this param. In future we can use this as a mask to set various types of
5783 filters as suggested below:
5784 FILTER_ALL_MULTICAST:
5785 FILTER_ALL_BROADCAST:
5786 FILTER_ALL_MULTICAST_BROADCAST:
5787
5788
5789 \return eHalStatus
5790
5791
5792--------------------------------------------------------------------------- */
5793eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
5794 tpSirWlanSetRxpFilters wlanRxpFilterParam)
5795{
5796 eHalStatus status = eHAL_STATUS_SUCCESS;
5797 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5798 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5799 vos_msg_t vosMessage;
5800
5801 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5802 {
5803 /* serialize the req through MC thread */
5804 vosMessage.bodyptr = wlanRxpFilterParam;
5805 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
5806 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5807 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5808 {
5809 status = eHAL_STATUS_FAILURE;
5810 }
5811 sme_ReleaseGlobalLock( &pMac->sme );
5812 }
5813 return(status);
5814}
5815
Jeff Johnson295189b2012-06-20 16:38:30 -07005816/* ---------------------------------------------------------------------------
5817
5818 \fn sme_ConfigureSuspendInd
5819
5820 \brief
5821 SME will pass this request to lower mac to Indicate that the wlan needs to
5822 be suspended
5823
5824 \param
5825
5826 hHal - The handle returned by macOpen.
5827
5828 wlanSuspendParam- Depicts the wlan suspend params
5829
5830
5831 \return eHalStatus
5832
5833
5834--------------------------------------------------------------------------- */
5835eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
5836 tpSirWlanSuspendParam wlanSuspendParam)
5837{
5838 eHalStatus status = eHAL_STATUS_SUCCESS;
5839 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5840 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5841 vos_msg_t vosMessage;
5842
5843 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5844 {
5845 /* serialize the req through MC thread */
5846 vosMessage.bodyptr = wlanSuspendParam;
5847 vosMessage.type = WDA_WLAN_SUSPEND_IND;
5848 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5849 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5850 {
5851 status = eHAL_STATUS_FAILURE;
5852 }
5853 sme_ReleaseGlobalLock( &pMac->sme );
5854 }
5855 return(status);
5856}
5857
5858/* ---------------------------------------------------------------------------
5859
5860 \fn sme_ConfigureResumeReq
5861
5862 \brief
5863 SME will pass this request to lower mac to Indicate that the wlan needs to
5864 be Resumed
5865
5866 \param
5867
5868 hHal - The handle returned by macOpen.
5869
5870 wlanResumeParam- Depicts the wlan resume params
5871
5872
5873 \return eHalStatus
5874
5875
5876--------------------------------------------------------------------------- */
5877eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
5878 tpSirWlanResumeParam wlanResumeParam)
5879{
5880 eHalStatus status = eHAL_STATUS_SUCCESS;
5881 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5882 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5883 vos_msg_t vosMessage;
5884
5885 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5886 {
5887 /* serialize the req through MC thread */
5888 vosMessage.bodyptr = wlanResumeParam;
5889 vosMessage.type = WDA_WLAN_RESUME_REQ;
5890 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5891 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5892 {
5893 status = eHAL_STATUS_FAILURE;
5894 }
5895 sme_ReleaseGlobalLock( &pMac->sme );
5896 }
5897 return(status);
5898}
5899
Jeff Johnson295189b2012-06-20 16:38:30 -07005900/* ---------------------------------------------------------------------------
5901
5902 \fn sme_GetInfraSessionId
5903
5904 \brief To get the session ID for infra session, if connected
5905 This is a synchronous API.
5906
5907 \param hHal - The handle returned by macOpen.
5908
5909 \return sessionid, -1 if infra session is not connected
5910
5911 -------------------------------------------------------------------------------*/
5912tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
5913{
5914 eHalStatus status = eHAL_STATUS_FAILURE;
5915 tANI_S8 sessionid = -1;
5916 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5917
5918 status = sme_AcquireGlobalLock( &pMac->sme );
5919 if ( HAL_STATUS_SUCCESS( status ) )
5920 {
5921
5922 sessionid = csrGetInfraSessionId( pMac);
5923
5924 sme_ReleaseGlobalLock( &pMac->sme );
5925 }
5926
5927 return (sessionid);
5928}
5929
5930/* ---------------------------------------------------------------------------
5931
5932 \fn sme_GetInfraOperationChannel
5933
5934 \brief To get the operating channel for infra session, if connected
5935 This is a synchronous API.
5936
5937 \param hHal - The handle returned by macOpen.
5938 \param sessionId - the sessionId returned by sme_OpenSession.
5939
5940 \return operating channel, 0 if infra session is not connected
5941
5942 -------------------------------------------------------------------------------*/
5943tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
5944{
5945 eHalStatus status = eHAL_STATUS_FAILURE;
5946 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5947 tANI_U8 channel = 0;
5948 status = sme_AcquireGlobalLock( &pMac->sme );
5949 if ( HAL_STATUS_SUCCESS( status ) )
5950 {
5951
5952 channel = csrGetInfraOperationChannel( pMac, sessionId);
5953
5954 sme_ReleaseGlobalLock( &pMac->sme );
5955 }
5956
5957 return (channel);
5958}
5959
5960//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
5961//If other BSS is not up or not connected it will return 0
5962tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
5963{
5964 eHalStatus status = eHAL_STATUS_FAILURE;
5965 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5966 tANI_U8 channel = 0;
5967 status = sme_AcquireGlobalLock( &pMac->sme );
5968 if ( HAL_STATUS_SUCCESS( status ) )
5969 {
5970
5971 channel = csrGetConcurrentOperationChannel( pMac );
5972 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005973 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07005974 sme_ReleaseGlobalLock( &pMac->sme );
5975 }
5976
5977 return (channel);
5978}
5979
5980#ifdef FEATURE_WLAN_SCAN_PNO
5981/******************************************************************************
5982*
5983* Name: sme_PreferredNetworkFoundInd
5984*
5985* Description:
5986* Invoke Preferred Network Found Indication
5987*
5988* Parameters:
5989* hHal - HAL handle for device
5990* pMsg - found network description
5991*
5992* Returns: eHalStatus
5993*
5994******************************************************************************/
5995eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
5996{
5997 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5998 eHalStatus status = eHAL_STATUS_SUCCESS;
5999 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07006000 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
6001 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006002
6003 if (NULL == pMsg)
6004 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006005 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006006 status = eHAL_STATUS_FAILURE;
6007 }
6008 else
6009 {
6010 if (pPrefNetworkFoundInd->ssId.length > 0)
6011 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07006012 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
6013 pPrefNetworkFoundInd->ssId.length);
6014 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
6015 dumpSsId[ssIdLength] = 0;
6016 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
6017 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07006018
Srikant Kuppa066904f2013-05-07 13:56:02 -07006019 //Save the frame to scan result
6020 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
6021 {
6022 //we may have a frame
6023 status = csrScanSavePreferredNetworkFound(pMac,
6024 pPrefNetworkFoundInd);
6025 if (!HAL_STATUS_SUCCESS(status))
6026 {
6027 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
6028 }
6029 }
6030 else
6031 {
6032 smsLog(pMac, LOGE, FL(" not enough data length %d needed %d"),
6033 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07006034 }
6035
Srikant Kuppa066904f2013-05-07 13:56:02 -07006036 /* Call Preferred Netowrk Found Indication callback routine. */
6037 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
6038 {
6039 pMac->pmc.prefNetwFoundCB(
6040 pMac->pmc.preferredNetworkFoundIndCallbackContext,
6041 pPrefNetworkFoundInd);
6042 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006043 }
6044 else
6045 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006046 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006047 status = eHAL_STATUS_FAILURE;
6048 }
6049 }
6050
6051
6052 return(status);
6053}
6054
6055#endif // FEATURE_WLAN_SCAN_PNO
6056
6057
6058eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
6059{
6060 eHalStatus status = eHAL_STATUS_FAILURE;
6061 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6062
6063 status = sme_AcquireGlobalLock( &pMac->sme );
6064 if ( HAL_STATUS_SUCCESS( status ) )
6065 {
6066 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6067 sme_ReleaseGlobalLock( &pMac->sme );
6068 }
6069
6070 return (status);
6071}
6072
6073
6074/* ---------------------------------------------------------------------------
6075
6076 \fn sme_SetTxPerTracking
6077
6078 \brief Set Tx PER tracking configuration parameters
6079
6080 \param hHal - The handle returned by macOpen.
6081 \param pTxPerTrackingConf - Tx PER configuration parameters
6082
6083 \return eHalStatus
6084
6085 -------------------------------------------------------------------------------*/
6086eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6087 void (*pCallbackfn) (void *pCallbackContext),
6088 void *pCallbackContext,
6089 tpSirTxPerTrackingParam pTxPerTrackingParam)
6090{
6091 vos_msg_t msg;
6092 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6093 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6094
6095 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6096 {
6097 pMac->sme.pTxPerHitCallback = pCallbackfn;
6098 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6099 sme_ReleaseGlobalLock( &pMac->sme );
6100 }
6101
6102 // free this memory in failure case or WDA request callback function
6103 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6104 if (NULL == pTxPerTrackingParamReq)
6105 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006106 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 -07006107 return eHAL_STATUS_FAILURE;
6108 }
6109
6110 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
6111 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6112 msg.reserved = 0;
6113 msg.bodyptr = pTxPerTrackingParamReq;
6114
6115 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6116 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006117 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 -07006118 vos_mem_free(pTxPerTrackingParamReq);
6119 return eHAL_STATUS_FAILURE;
6120 }
6121
6122 return eHAL_STATUS_SUCCESS;
6123}
6124
6125/* ---------------------------------------------------------------------------
6126
6127 \fn sme_HandleChangeCountryCode
6128
6129 \brief Change Country code, Reg Domain and channel list
6130
6131 \details Country Code Priority
6132 0 = 11D > Configured Country > NV
6133 1 = Configured Country > 11D > NV
6134 If Supplicant country code is priority than 11d is disabled.
6135 If 11D is enabled, we update the country code after every scan.
6136 Hence when Supplicant country code is priority, we don't need 11D info.
6137 Country code from Supplicant is set as current courtry code.
6138 User can send reset command XX (instead of country code) to reset the
6139 country code to default values which is read from NV.
6140 In case of reset, 11D is enabled and default NV code is Set as current country code
6141 If 11D is priority,
6142 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6143
6144 \param pMac - The handle returned by macOpen.
6145 \param pMsgBuf - MSG Buffer
6146
6147 \return eHalStatus
6148
6149 -------------------------------------------------------------------------------*/
6150eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6151{
6152 eHalStatus status = eHAL_STATUS_SUCCESS;
6153 tAniChangeCountryCodeReq *pMsg;
6154 v_REGDOMAIN_t domainIdIoctl;
6155 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6156 static uNvTables nvTables;
6157 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6158
6159
6160 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6161 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6162 {
6163 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6164
6165 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6166
6167 /* read the country code from NV and use it */
6168 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6169 {
6170 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6171 }
6172 else
6173 {
6174 status = eHAL_STATUS_FAILURE;
6175 return status;
6176 }
6177 }
6178 else
6179 {
6180 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05306181 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
6182 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07006183 {
6184 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6185 }
6186 }
6187
6188 /* WEXT set country code means
6189 * 11D should be supported?
6190 * 11D Channel should be enforced?
6191 * 11D Country code should be matched?
6192 * 11D Reg Domian should be matched?
6193 * Country string changed */
6194 if(pMac->roam.configParam.Is11dSupportEnabled &&
6195 pMac->roam.configParam.fEnforce11dChannels &&
6196 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6197 pMac->roam.configParam.fEnforceDefaultDomain &&
6198 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6199 {
6200 /* All 11D related options are already enabled
6201 * Country string is not changed
6202 * Do not need do anything for country code change request */
6203 return eHAL_STATUS_SUCCESS;
6204 }
6205
6206 /* Set Current Country code and Current Regulatory domain */
6207 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6208 if(eHAL_STATUS_SUCCESS != status)
6209 {
6210 /* Supplicant country code failed. So give 11D priority */
6211 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6212 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6213 return status;
6214 }
6215
Jeff Johnson295189b2012-06-20 16:38:30 -07006216 /* overwrite the defualt country code */
6217 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6218
6219 /* Get Domain ID from country code */
6220 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6221 if ( status != eHAL_STATUS_SUCCESS )
6222 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006223 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006224 return status;
6225 }
6226
6227 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6228
6229 if ( status != eHAL_STATUS_SUCCESS )
6230 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006231 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006232 return status;
6233 }
6234
6235 /* set to default domain ID */
6236 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6237
6238 /* get the channels based on new cc */
6239 status = csrInitGetChannels( pMac );
6240
6241 if ( status != eHAL_STATUS_SUCCESS )
6242 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006243 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006244 return status;
6245 }
6246
6247 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006248 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006249 if( pMsg->changeCCCallback )
6250 {
6251 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6252 }
6253
6254 return eHAL_STATUS_SUCCESS;
6255}
6256
6257#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006258eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006259{
6260 tpSirRcvFltMcAddrList pRequestBuf;
6261 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006262 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006263 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006264
6265 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05306266 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006267 pMulticastAddrs->ulMulticastAddrCnt,
6268 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006269
6270 /*
6271 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006272 */
6273 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6274 csrIsConnStateInfra(pMac, sessionId))
6275 {
6276 pSession = CSR_GET_SESSION( pMac, sessionId );
6277 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006278
6279 if(pSession == NULL )
6280 {
6281 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006282 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006283 return eHAL_STATUS_FAILURE;
6284 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006285
Jeff Johnson295189b2012-06-20 16:38:30 -07006286 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6287 if (NULL == pRequestBuf)
6288 {
6289 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006290 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006291 return eHAL_STATUS_FAILED_ALLOC;
6292 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006293
6294 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6295 {
6296 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6297 "indication as we are not connected", __func__);
6298 vos_mem_free(pRequestBuf);
6299 return eHAL_STATUS_FAILURE;
6300 }
6301
Jeff Johnson295189b2012-06-20 16:38:30 -07006302 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6303
Jeff Johnsone7245742012-09-05 17:12:55 -07006304 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6305 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6306 sizeof(tSirMacAddr));
6307
Jeff Johnson295189b2012-06-20 16:38:30 -07006308 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6309 msg.reserved = 0;
6310 msg.bodyptr = pRequestBuf;
6311 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6312 {
6313 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006314 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006315 vos_mem_free(pRequestBuf);
6316 return eHAL_STATUS_FAILURE;
6317 }
6318
6319 return eHAL_STATUS_SUCCESS;
6320}
6321
Jeff Johnsone7245742012-09-05 17:12:55 -07006322eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6323 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006324{
6325 tpSirRcvPktFilterCfgType pRequestBuf;
6326 v_SINT_t allocSize;
6327 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006328 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6329 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006330 v_U8_t idx=0;
6331
6332 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006333 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006334 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6335
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006336 allocSize = sizeof(tSirRcvPktFilterCfgType);
6337
Jeff Johnson295189b2012-06-20 16:38:30 -07006338 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006339
6340 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006341 {
6342 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006343 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006344 return eHAL_STATUS_FAILED_ALLOC;
6345 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006346
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006347 if( NULL == pSession )
6348 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006349 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006350 vos_mem_free(pRequestBuf);
6351 return eHAL_STATUS_FAILURE;
6352 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006353
6354 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6355 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006356 sizeof(tSirMacAddr));
6357
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006358 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6359
Jeff Johnson295189b2012-06-20 16:38:30 -07006360 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6361 msg.reserved = 0;
6362 msg.bodyptr = pRequestBuf;
6363
6364 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6365 "FT %d FID %d ",
6366 pRequestBuf->filterType, pRequestBuf->filterId);
6367
6368 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6369 "params %d CT %d",
6370 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6371
6372 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6373 {
6374
6375 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006376 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006377 pRequestBuf->paramsData[idx].protocolLayer,
6378 pRequestBuf->paramsData[idx].cmpFlag);
6379
6380 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006381 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006382 pRequestBuf->paramsData[idx].dataOffset,
6383 pRequestBuf->paramsData[idx].dataLength);
6384
6385 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006386 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006387 pRequestBuf->paramsData[idx].compareData[0],
6388 pRequestBuf->paramsData[idx].compareData[1],
6389 pRequestBuf->paramsData[idx].compareData[2],
6390 pRequestBuf->paramsData[idx].compareData[3],
6391 pRequestBuf->paramsData[idx].compareData[4],
6392 pRequestBuf->paramsData[idx].compareData[5]);
6393
6394 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006395 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006396 pRequestBuf->paramsData[idx].dataMask[0],
6397 pRequestBuf->paramsData[idx].dataMask[1],
6398 pRequestBuf->paramsData[idx].dataMask[2],
6399 pRequestBuf->paramsData[idx].dataMask[3],
6400 pRequestBuf->paramsData[idx].dataMask[4],
6401 pRequestBuf->paramsData[idx].dataMask[5]);
6402
6403 }
6404
6405 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6406 {
6407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006408 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006409 vos_mem_free(pRequestBuf);
6410 return eHAL_STATUS_FAILURE;
6411 }
6412
6413 return eHAL_STATUS_SUCCESS;
6414}
6415
6416eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6417 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006418 void *callbackContext,
6419 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006420{
6421 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6422 eHalStatus status;
6423
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006424 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006425
6426 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6427 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006428 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006429 sme_ReleaseGlobalLock( &pMac->sme );
6430 }
6431
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006432 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006433
6434 return (status);
6435}
6436
Jeff Johnsone7245742012-09-05 17:12:55 -07006437eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6438 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006439{
6440 tpSirRcvFltPktClearParam pRequestBuf;
6441 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006442 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6443 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006444
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006445 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006446 pRcvFltPktClearParam->filterId);
6447
6448 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006449 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006450 {
6451 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6452 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006453 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006454 return eHAL_STATUS_FAILED_ALLOC;
6455 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006456 if( NULL == pSession )
6457 {
6458 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006459 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006460 vos_mem_free(pRequestBuf);
6461 return eHAL_STATUS_FAILURE;
6462 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006463
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006464 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6465 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006466 sizeof(tSirMacAddr));
6467
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006468 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6469
Jeff Johnson295189b2012-06-20 16:38:30 -07006470 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6471 msg.reserved = 0;
6472 msg.bodyptr = pRequestBuf;
6473 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6474 {
6475 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006476 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006477 vos_mem_free(pRequestBuf);
6478 return eHAL_STATUS_FAILURE;
6479 }
6480
6481 return eHAL_STATUS_SUCCESS;
6482}
6483#endif // WLAN_FEATURE_PACKET_FILTERING
6484
6485/* ---------------------------------------------------------------------------
6486 \fn sme_PreChannelSwitchIndFullPowerCB
6487 \brief call back function for the PMC full power request because of pre
6488 channel switch.
6489 \param callbackContext
6490 \param status
6491 ---------------------------------------------------------------------------*/
6492void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6493 eHalStatus status)
6494{
6495 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6496 tSirMbMsg *pMsg;
6497 tANI_U16 msgLen;
6498
6499 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6500 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6501 if(HAL_STATUS_SUCCESS(status))
6502 {
6503 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6504 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6505 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6506 status = palSendMBMessage(pMac->hHdd, pMsg);
6507 }
6508
6509 return;
6510}
6511
6512/* ---------------------------------------------------------------------------
6513 \fn sme_HandlePreChannelSwitchInd
6514 \brief Processes the indcation from PE for pre-channel switch.
6515 \param hHal
6516 \- The handle returned by macOpen. return eHalStatus
6517 ---------------------------------------------------------------------------*/
6518eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6519{
6520 eHalStatus status = eHAL_STATUS_FAILURE;
6521 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6522 status = sme_AcquireGlobalLock( &pMac->sme );
6523 if ( HAL_STATUS_SUCCESS( status ) )
6524 {
6525 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6526 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6527 sme_ReleaseGlobalLock( &pMac->sme );
6528 }
6529
6530 return (status);
6531}
6532
6533/* ---------------------------------------------------------------------------
6534 \fn sme_HandlePostChannelSwitchInd
6535 \brief Processes the indcation from PE for post-channel switch.
6536 \param hHal
6537 \- The handle returned by macOpen. return eHalStatus
6538 ---------------------------------------------------------------------------*/
6539eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6540{
6541 eHalStatus status = eHAL_STATUS_FAILURE;
6542 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6543
6544 status = sme_AcquireGlobalLock( &pMac->sme );
6545 if ( HAL_STATUS_SUCCESS( status ) )
6546 {
6547 status = pmcRequestBmps(hHal, NULL, NULL);
6548 sme_ReleaseGlobalLock( &pMac->sme );
6549 }
6550
6551 return (status);
6552}
6553
6554/* ---------------------------------------------------------------------------
6555
6556 \fn sme_IsChannelValid
6557
6558 \brief To check if the channel is valid for currently established domain
6559 This is a synchronous API.
6560
6561 \param hHal - The handle returned by macOpen.
6562 \param channel - channel to verify
6563
6564 \return TRUE/FALSE, TRUE if channel is valid
6565
6566 -------------------------------------------------------------------------------*/
6567tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6568{
6569 eHalStatus status = eHAL_STATUS_FAILURE;
6570 tANI_BOOLEAN valid = FALSE;
6571 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6572
6573 status = sme_AcquireGlobalLock( &pMac->sme );
6574 if ( HAL_STATUS_SUCCESS( status ) )
6575 {
6576
6577 valid = csrRoamIsChannelValid( pMac, channel);
6578
6579 sme_ReleaseGlobalLock( &pMac->sme );
6580 }
6581
6582 return (valid);
6583}
6584
6585/* ---------------------------------------------------------------------------
6586 \fn sme_SetFreqBand
6587 \brief Used to set frequency band.
6588 \param hHal
6589 \eBand band value to be configured
6590 \- return eHalStatus
6591 -------------------------------------------------------------------------*/
6592eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
6593{
6594 eHalStatus status = eHAL_STATUS_FAILURE;
6595 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6596
6597 status = sme_AcquireGlobalLock( &pMac->sme );
6598 if ( HAL_STATUS_SUCCESS( status ) )
6599 {
6600 status = csrSetBand(hHal, eBand);
6601 sme_ReleaseGlobalLock( &pMac->sme );
6602 }
6603 return status;
6604}
6605
6606/* ---------------------------------------------------------------------------
6607 \fn sme_GetFreqBand
6608 \brief Used to get the current band settings.
6609 \param hHal
6610 \pBand pointer to hold band value
6611 \- return eHalStatus
6612 -------------------------------------------------------------------------*/
6613eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
6614{
6615 eHalStatus status = eHAL_STATUS_FAILURE;
6616 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6617
6618 status = sme_AcquireGlobalLock( &pMac->sme );
6619 if ( HAL_STATUS_SUCCESS( status ) )
6620 {
6621 *pBand = csrGetCurrentBand( hHal );
6622 sme_ReleaseGlobalLock( &pMac->sme );
6623 }
6624 return status;
6625}
6626
6627#ifdef WLAN_WAKEUP_EVENTS
6628/******************************************************************************
6629 \fn sme_WakeReasonIndCallback
6630
6631 \brief
6632 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
6633
6634 \param hHal - HAL handle for device
6635 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
6636
6637 \return eHalStatus
6638******************************************************************************/
6639eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
6640{
6641 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6642 eHalStatus status = eHAL_STATUS_SUCCESS;
6643 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
6644
6645 if (NULL == pMsg)
6646 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006647 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006648 status = eHAL_STATUS_FAILURE;
6649 }
6650 else
6651 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006652 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07006653
6654 /* Call Wake Reason Indication callback routine. */
6655 if (pMac->pmc.wakeReasonIndCB != NULL)
6656 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
6657
6658 pMac->pmc.wakeReasonIndCB = NULL;
6659 pMac->pmc.wakeReasonIndCBContext = NULL;
6660
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006661 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07006662 }
6663
6664 return(status);
6665}
6666#endif // WLAN_WAKEUP_EVENTS
6667
6668
6669/* ---------------------------------------------------------------------------
6670
6671 \fn sme_SetMaxTxPower
6672
6673 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
6674 not persist over reboots.
6675
6676 \param hHal
6677 \param pBssid BSSID to set the power cap for
6678 \param pBssid pSelfMacAddress self MAC Address
6679 \param pBssid power to set in dB
6680 \- return eHalStatus
6681
6682 -------------------------------------------------------------------------------*/
6683eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
6684 tSirMacAddr pSelfMacAddress, v_S7_t dB)
6685{
6686 vos_msg_t msg;
6687 tpMaxTxPowerParams pMaxTxParams = NULL;
6688
6689 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
6690 if (NULL == pMaxTxParams)
6691 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006692 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 -07006693 return eHAL_STATUS_FAILURE;
6694 }
6695
6696 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
6697 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
6698 SIR_MAC_ADDR_LENGTH);
6699 pMaxTxParams->power = dB;
6700
6701 msg.type = WDA_SET_MAX_TX_POWER_REQ;
6702 msg.reserved = 0;
6703 msg.bodyptr = pMaxTxParams;
6704
6705 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6706 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006707 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 -07006708 vos_mem_free(pMaxTxParams);
6709 return eHAL_STATUS_FAILURE;
6710 }
6711
6712 return eHAL_STATUS_SUCCESS;
6713}
6714
Jeff Johnson295189b2012-06-20 16:38:30 -07006715/* ---------------------------------------------------------------------------
6716
schang86c22c42013-03-13 18:41:24 -07006717 \fn sme_SetTxPower
6718
6719 \brief Set Transmit Power dynamically. Note: this setting will
6720 not persist over reboots.
6721
6722 \param hHal
6723 \param sessionId Target Session ID
6724 \param mW power to set in mW
6725 \- return eHalStatus
6726
6727 -------------------------------------------------------------------------------*/
6728eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
6729{
6730
6731 eHalStatus status = eHAL_STATUS_FAILURE;
6732 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6733
6734 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
6735 status = sme_AcquireGlobalLock(&pMac->sme);
6736 if (HAL_STATUS_SUCCESS(status))
6737 {
6738 status = csrSetTxPower(pMac, sessionId, mW);
6739 sme_ReleaseGlobalLock(&pMac->sme);
6740 }
6741 return status;
6742}
6743
6744/* ---------------------------------------------------------------------------
6745
Jeff Johnson295189b2012-06-20 16:38:30 -07006746 \fn sme_HideSSID
6747
6748 \brief hide/show SSID dynamically. Note: this setting will
6749 not persist over reboots.
6750
6751 \param hHal
6752 \param sessionId
6753 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
6754 \- return eHalStatus
6755
6756 -------------------------------------------------------------------------------*/
6757eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
6758{
6759 eHalStatus status = eHAL_STATUS_SUCCESS;
6760 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6761 tANI_U16 len;
6762
6763 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6764 {
6765 tpSirUpdateParams pMsg;
6766 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006767
6768 if(!pSession)
6769 {
6770 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006771 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006772 return eHAL_STATUS_FAILURE;
6773 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006774
6775 if( !pSession->sessionActive )
6776 VOS_ASSERT(0);
6777
6778 /* Create the message and send to lim */
6779 len = sizeof(tSirUpdateParams);
6780 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
6781 if(HAL_STATUS_SUCCESS(status))
6782 {
6783 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
6784 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
6785 pMsg->length = len;
6786 /* Data starts from here */
6787 pMsg->sessionId = sessionId;
6788 pMsg->ssidHidden = ssidHidden;
6789 status = palSendMBMessage(pMac->hHdd, pMsg);
6790 }
6791 sme_ReleaseGlobalLock( &pMac->sme );
6792 }
6793 return status;
6794}
Jeff Johnson295189b2012-06-20 16:38:30 -07006795
6796/* ---------------------------------------------------------------------------
6797
6798 \fn sme_SetTmLevel
6799 \brief Set Thermal Mitigation Level to RIVA
6800 \param hHal - The handle returned by macOpen.
6801 \param newTMLevel - new Thermal Mitigation Level
6802 \param tmMode - Thermal Mitigation handle mode, default 0
6803 \return eHalStatus
6804 ---------------------------------------------------------------------------*/
6805eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
6806{
6807 eHalStatus status = eHAL_STATUS_SUCCESS;
6808 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6809 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6810 vos_msg_t vosMessage;
6811 tAniSetTmLevelReq *setTmLevelReq = NULL;
6812
6813 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6814 {
6815 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
6816 if(NULL == setTmLevelReq)
6817 {
6818 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006819 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006820 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07006821 return eHAL_STATUS_FAILURE;
6822 }
6823
6824 setTmLevelReq->tmMode = tmMode;
6825 setTmLevelReq->newTmLevel = newTMLevel;
6826
6827 /* serialize the req through MC thread */
6828 vosMessage.bodyptr = setTmLevelReq;
6829 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
6830 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6831 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6832 {
6833 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006834 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006835 vos_mem_free(setTmLevelReq);
6836 status = eHAL_STATUS_FAILURE;
6837 }
6838 sme_ReleaseGlobalLock( &pMac->sme );
6839 }
6840 return(status);
6841}
6842
6843/*---------------------------------------------------------------------------
6844
6845 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
6846 Host and FW.
6847
6848 \param hHal - HAL handle for device
6849
6850 \return NONE
6851
6852---------------------------------------------------------------------------*/
6853void sme_featureCapsExchange( tHalHandle hHal)
6854{
6855 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6856 WDA_featureCapsExchange(vosContext);
6857}
Jeff Johnsond13512a2012-07-17 11:42:19 -07006858
Yathish9f22e662012-12-10 14:21:35 -08006859/*---------------------------------------------------------------------------
6860
6861 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
6862 in Host.
6863
6864 \param hHal - HAL handle for device
6865
6866 \return NONE
6867
6868---------------------------------------------------------------------------*/
6869void sme_disableFeatureCapablity(tANI_U8 feature_index)
6870{
6871 WDA_disableCapablityFeature(feature_index);
6872}
6873
6874
Jeff Johnsond13512a2012-07-17 11:42:19 -07006875
6876/* ---------------------------------------------------------------------------
6877
6878 \fn sme_GetDefaultCountryCode
6879
6880 \brief Get the default country code from NV
6881
6882 \param hHal
6883 \param pCountry
6884 \- return eHalStatus
6885
6886 -------------------------------------------------------------------------------*/
6887eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
6888{
6889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6890 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
6891}
6892
6893/* ---------------------------------------------------------------------------
6894
6895 \fn sme_GetCurrentCountryCode
6896
6897 \brief Get the current country code
6898
6899 \param hHal
6900 \param pCountry
6901 \- return eHalStatus
6902
6903 -------------------------------------------------------------------------------*/
6904eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
6905{
6906 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6907 return csrGetCurrentCountryCode(pMac, pCountry);
6908}
6909
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006910/* ---------------------------------------------------------------------------
6911 \fn sme_transportDebug
6912 \brief Dynamically monitoring Transport channels
6913 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07006914 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08006915 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006916 \param toggleStallDetect Enable stall detect feature
6917 This feature will take effect to data performance
6918 Not integrate till fully verification
6919 \- return NONE
6920 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07006921void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006922{
schang6295e542013-03-12 15:31:23 -07006923 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6924
6925 if (NULL == pMac)
6926 {
6927 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6928 "%s: invalid context", __func__);
6929 return;
6930 }
6931 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07006932}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006933
Kiran4a17ebe2013-01-31 10:43:43 -08006934/* ---------------------------------------------------------------------------
6935 \fn sme_ResetPowerValuesFor5G
6936 \brief Reset the power values for 5G band with NV power values.
6937 \param hHal - HAL handle for device
6938 \- return NONE
6939 -------------------------------------------------------------------------*/
6940void sme_ResetPowerValuesFor5G (tHalHandle hHal)
6941{
6942 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
6943 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
6944 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
6945}
6946
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006947#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
6948/* ---------------------------------------------------------------------------
6949 \fn sme_UpdateRoamPrefer5GHz
6950 \brief enable/disable Roam prefer 5G runtime option
6951 This function is called through dynamic setConfig callback function
6952 to configure the Roam prefer 5G runtime option
6953 \param hHal - HAL handle for device
6954 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
6955 \- return Success or failure
6956 -------------------------------------------------------------------------*/
6957
6958eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
6959{
6960 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006961 eHalStatus status = eHAL_STATUS_SUCCESS;
6962
6963 status = sme_AcquireGlobalLock( &pMac->sme );
6964 if ( HAL_STATUS_SUCCESS( status ) )
6965 {
6966 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6967 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
6968 pMac->roam.configParam.nRoamPrefer5GHz,
6969 nRoamPrefer5GHz);
6970 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
6971 sme_ReleaseGlobalLock( &pMac->sme );
6972 }
6973
6974 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006975}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006976
6977/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07006978 \fn sme_setRoamIntraBand
6979 \brief enable/disable Intra band roaming
6980 This function is called through dynamic setConfig callback function
6981 to configure the intra band roaming
6982 \param hHal - HAL handle for device
6983 \param nRoamIntraBand Enable/Disable Intra band roaming
6984 \- return Success or failure
6985 -------------------------------------------------------------------------*/
6986eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
6987{
6988 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6989 eHalStatus status = eHAL_STATUS_SUCCESS;
6990
6991 status = sme_AcquireGlobalLock( &pMac->sme );
6992 if ( HAL_STATUS_SUCCESS( status ) )
6993 {
6994 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6995 "%s: gRoamIntraBand is changed from %d to %d", __func__,
6996 pMac->roam.configParam.nRoamIntraBand,
6997 nRoamIntraBand);
6998 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
6999 sme_ReleaseGlobalLock( &pMac->sme );
7000 }
7001
7002 return status ;
7003}
7004
7005/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007006 \fn sme_UpdateRoamScanNProbes
7007 \brief function to update roam scan N probes
7008 This function is called through dynamic setConfig callback function
7009 to update roam scan N probes
7010 \param hHal - HAL handle for device
7011 \param nProbes number of probe requests to be sent out
7012 \- return Success or failure
7013 -------------------------------------------------------------------------*/
7014eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
7015{
7016 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7017 eHalStatus status = eHAL_STATUS_SUCCESS;
7018
7019 status = sme_AcquireGlobalLock( &pMac->sme );
7020 if ( HAL_STATUS_SUCCESS( status ) )
7021 {
7022 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7023 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
7024 pMac->roam.configParam.nProbes,
7025 nProbes);
7026 pMac->roam.configParam.nProbes = nProbes;
7027 sme_ReleaseGlobalLock( &pMac->sme );
7028 }
7029#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7030 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7031 {
7032 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7033 REASON_NPROBES_CHANGED);
7034 }
7035#endif
7036 return status ;
7037}
7038
7039/* ---------------------------------------------------------------------------
7040 \fn sme_UpdateRoamScanHomeAwayTime
7041 \brief function to update roam scan Home away time
7042 This function is called through dynamic setConfig callback function
7043 to update roam scan home away time
7044 \param hHal - HAL handle for device
7045 \param nRoamScanAwayTime Scan home away time
7046 \- return Success or failure
7047 -------------------------------------------------------------------------*/
7048eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime)
7049{
7050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7051 eHalStatus status = eHAL_STATUS_SUCCESS;
7052
7053 status = sme_AcquireGlobalLock( &pMac->sme );
7054 if ( HAL_STATUS_SUCCESS( status ) )
7055 {
7056 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7057 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
7058 pMac->roam.configParam.nRoamScanHomeAwayTime,
7059 nRoamScanHomeAwayTime);
7060 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
7061 sme_ReleaseGlobalLock( &pMac->sme );
7062 }
7063
7064#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7065 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7066 {
7067 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7068 REASON_HOME_AWAY_TIME_CHANGED);
7069 }
7070#endif
7071 return status;
7072}
7073
7074
7075/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007076 \fn sme_getRoamIntraBand
7077 \brief get Intra band roaming
7078 \param hHal - HAL handle for device
7079 \- return Success or failure
7080 -------------------------------------------------------------------------*/
7081v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
7082{
7083 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7084 return pMac->roam.configParam.nRoamIntraBand;
7085}
7086
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007087/* ---------------------------------------------------------------------------
7088 \fn sme_getRoamScanNProbes
7089 \brief get N Probes
7090 \param hHal - HAL handle for device
7091 \- return Success or failure
7092 -------------------------------------------------------------------------*/
7093v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
7094{
7095 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7096 return pMac->roam.configParam.nProbes;
7097}
7098
7099/* ---------------------------------------------------------------------------
7100 \fn sme_getRoamScanHomeAwayTime
7101 \brief get Roam scan home away time
7102 \param hHal - HAL handle for device
7103 \- return Success or failure
7104 -------------------------------------------------------------------------*/
7105v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
7106{
7107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7108 return pMac->roam.configParam.nRoamScanHomeAwayTime;
7109}
7110
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007111
7112/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007113 \fn sme_UpdateImmediateRoamRssiDiff
7114 \brief Update nImmediateRoamRssiDiff
7115 This function is called through dynamic setConfig callback function
7116 to configure nImmediateRoamRssiDiff
7117 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
7118 \param hHal - HAL handle for device
7119 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
7120 candidate and current AP.
7121 \- return Success or failure
7122 -------------------------------------------------------------------------*/
7123
7124eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
7125{
7126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007127 eHalStatus status = eHAL_STATUS_SUCCESS;
7128
7129 status = sme_AcquireGlobalLock( &pMac->sme );
7130 if ( HAL_STATUS_SUCCESS( status ) )
7131 {
7132 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7133 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
7134 nImmediateRoamRssiDiff,
7135 pMac->roam.configParam.nImmediateRoamRssiDiff,
7136 pMac->roam.neighborRoamInfo.neighborRoamState);
7137 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
7138 sme_ReleaseGlobalLock( &pMac->sme );
7139 }
7140
7141 return status ;
7142}
7143
7144/* ---------------------------------------------------------------------------
7145 \fn sme_UpdateRoamRssiDiff
7146 \brief Update RoamRssiDiff
7147 This function is called through dynamic setConfig callback function
7148 to configure RoamRssiDiff
7149 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
7150 \param hHal - HAL handle for device
7151 \param RoamRssiDiff - minimum rssi difference between potential
7152 candidate and current AP.
7153 \- return Success or failure
7154 -------------------------------------------------------------------------*/
7155
7156eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
7157{
7158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7159 eHalStatus status = eHAL_STATUS_SUCCESS;
7160
7161 status = sme_AcquireGlobalLock( &pMac->sme );
7162 if ( HAL_STATUS_SUCCESS( status ) )
7163 {
7164 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7165 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
7166 RoamRssiDiff,
7167 pMac->roam.configParam.RoamRssiDiff,
7168 pMac->roam.neighborRoamInfo.neighborRoamState);
7169 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
7170 sme_ReleaseGlobalLock( &pMac->sme );
7171 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007172#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7173 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7174 {
7175 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
7176 }
7177#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007178 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007179}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007180
7181/*--------------------------------------------------------------------------
7182 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
7183 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7184 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007185 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007186 \param hHal - The handle returned by macOpen.
7187 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
7188 Other status means SME is failed to update isFastTransitionEnabled.
7189 \sa
7190 --------------------------------------------------------------------------*/
7191eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
7192 v_BOOL_t isFastTransitionEnabled)
7193{
7194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007195 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007196
Srinivas Girigowdade697412013-02-14 16:31:48 -08007197 status = sme_AcquireGlobalLock( &pMac->sme );
7198 if ( HAL_STATUS_SUCCESS( status ) )
7199 {
7200 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7201 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
7202 pMac->roam.configParam.isFastTransitionEnabled,
7203 isFastTransitionEnabled);
7204 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
7205 sme_ReleaseGlobalLock( &pMac->sme );
7206 }
7207
7208 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007209}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007210
7211/* ---------------------------------------------------------------------------
7212 \fn sme_UpdateWESMode
7213 \brief Update WES Mode
7214 This function is called through dynamic setConfig callback function
7215 to configure isWESModeEnabled
7216 \param hHal - HAL handle for device
7217 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
7218 Other status means SME is failed to update isWESModeEnabled.
7219 -------------------------------------------------------------------------*/
7220
7221eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
7222{
7223 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7224 eHalStatus status = eHAL_STATUS_SUCCESS;
7225
7226 status = sme_AcquireGlobalLock( &pMac->sme );
7227 if ( HAL_STATUS_SUCCESS( status ) )
7228 {
7229 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7230 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
7231 isWESModeEnabled,
7232 pMac->roam.configParam.isWESModeEnabled,
7233 pMac->roam.neighborRoamInfo.neighborRoamState);
7234 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
7235 sme_ReleaseGlobalLock( &pMac->sme );
7236 }
7237
7238 return status ;
7239}
7240
7241/* ---------------------------------------------------------------------------
7242 \fn sme_SetRoamScanControl
7243 \brief Set roam scan control
7244 This function is called to set roam scan control
7245 if roam scan control is set to 0, roaming scan cache is cleared
7246 any value other than 0 is treated as invalid value
7247 \param hHal - HAL handle for device
7248 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7249 Other status means SME failure to update
7250 -------------------------------------------------------------------------*/
7251eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
7252{
7253 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7254 eHalStatus status = eHAL_STATUS_SUCCESS;
7255
7256 status = sme_AcquireGlobalLock( &pMac->sme );
7257 if ( HAL_STATUS_SUCCESS( status ) )
7258 {
7259 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7260 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
7261 roamScanControl,
7262 pMac->roam.configParam.nRoamScanControl,
7263 pMac->roam.neighborRoamInfo.neighborRoamState);
7264 pMac->roam.configParam.nRoamScanControl = roamScanControl;
7265 if ( 0 == roamScanControl)
7266 {
7267 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7268 "LFR runtime successfully cleared roam scan cache");
7269 csrFlushBgScanRoamChannelList(pMac);
7270#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7271 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7272 {
7273 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
7274 }
7275#endif
7276 }
7277 sme_ReleaseGlobalLock( &pMac->sme );
7278 }
7279 return status ;
7280}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007281#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
7282
7283#ifdef FEATURE_WLAN_LFR
7284/*--------------------------------------------------------------------------
7285 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
7286 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7287 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007288 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007289 \param hHal - The handle returned by macOpen.
7290 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
7291 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
7292 \sa
7293 --------------------------------------------------------------------------*/
7294eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007295 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007296{
7297 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7298
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007299 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
7300 {
7301 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7302 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7303 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7304 isFastRoamIniFeatureEnabled);
7305 return eHAL_STATUS_SUCCESS;
7306 }
7307
Srinivas Girigowdade697412013-02-14 16:31:48 -08007308 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7309 "%s: FastRoamEnabled is changed from %d to %d", __func__,
7310 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7311 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007312 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007313 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007314
7315 if(TRUE == isFastRoamIniFeatureEnabled)
7316 {
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007317 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7318 }
7319 else
7320 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007321 /* CCX also depend on FW Monitoring.
7322 Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007323#ifdef FEATURE_WLAN_CCX
7324 if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007325#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007326 {
7327 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Srinivas Girigowdade697412013-02-14 16:31:48 -08007328 "%s: Turn off FW Monitoring", __func__);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007329 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7330 }
7331 }
7332
7333 return eHAL_STATUS_SUCCESS;
7334}
7335#endif /* FEATURE_WLAN_LFR */
7336
7337#ifdef FEATURE_WLAN_CCX
7338/*--------------------------------------------------------------------------
7339 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
7340 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7341 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007342 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007343 \param hHal - The handle returned by macOpen.
7344 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
7345 Other status means SME is failed to update isCcxIniFeatureEnabled.
7346 \sa
7347 --------------------------------------------------------------------------*/
7348
7349eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007350 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007351{
7352 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7353
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007354 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
7355 {
7356 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7357 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7358 pMac->roam.configParam.isCcxIniFeatureEnabled,
7359 isCcxIniFeatureEnabled);
7360 return eHAL_STATUS_SUCCESS;
7361 }
7362
Srinivas Girigowdade697412013-02-14 16:31:48 -08007363 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7364 "%s: CcxEnabled is changed from %d to %d", __func__,
7365 pMac->roam.configParam.isCcxIniFeatureEnabled,
7366 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007367 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007368 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007369
7370 if(TRUE == isCcxIniFeatureEnabled)
7371 {
7372 sme_UpdateFastTransitionEnabled(hHal, TRUE);
7373 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7374 }
7375 else
7376 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007377 /* LFR also depend on FW Monitoring.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007378 Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */
7379#ifdef FEATURE_WLAN_LFR
7380 if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled)
7381#endif
7382 {
7383 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7384 "%s: Turn off FW Monitoring/Fast Transition", __func__);
7385 sme_UpdateFastTransitionEnabled(hHal, FALSE);
7386 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7387 }
7388 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007389#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7390 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7391 {
7392 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
7393 }
7394#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007395 return eHAL_STATUS_SUCCESS;
7396}
7397#endif /* FEATURE_WLAN_CCX */
7398
7399/*--------------------------------------------------------------------------
7400 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7401 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7402 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007403 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007404 \param hHal - The handle returned by macOpen.
7405 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7406 Other status means SME is failed to update fEnableFwRssiMonitoring.
7407 \sa
7408 --------------------------------------------------------------------------*/
7409
7410eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7411 v_BOOL_t fEnableFwRssiMonitoring)
7412{
7413 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7414
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007415 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7416 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7417 {
7418 halStatus = eHAL_STATUS_FAILURE;
7419 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007420 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007421 }
7422
7423 return (halStatus);
7424}
7425
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007426#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08007427/*--------------------------------------------------------------------------
7428 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7429 This is a synchronous call
7430 \param hHal - The handle returned by macOpen.
7431 \return eHAL_STATUS_SUCCESS - SME update config successful.
7432 Other status means SME is failed to update
7433 \sa
7434 --------------------------------------------------------------------------*/
7435eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7436 v_U8_t neighborLookupRssiThreshold)
7437{
7438 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7439 eHalStatus status = eHAL_STATUS_SUCCESS;
7440
7441 status = sme_AcquireGlobalLock( &pMac->sme );
7442 if ( HAL_STATUS_SUCCESS( status ) )
7443 {
7444 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7445 if (HAL_STATUS_SUCCESS(status))
7446 {
7447 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7448 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7449 neighborLookupRssiThreshold,
7450 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7451 pMac->roam.neighborRoamInfo.neighborRoamState);
7452 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7453 neighborLookupRssiThreshold;
7454 }
7455 sme_ReleaseGlobalLock( &pMac->sme );
7456 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007457 return status;
7458}
7459
7460/*--------------------------------------------------------------------------
7461 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
7462 This is a synchronous call
7463 \param hHal - The handle returned by macOpen.
7464 \return eHAL_STATUS_SUCCESS - SME update config successful.
7465 Other status means SME is failed to update
7466 \sa
7467 --------------------------------------------------------------------------*/
7468eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
7469 v_U8_t neighborReassocRssiThreshold)
7470{
7471 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7472 eHalStatus status = eHAL_STATUS_SUCCESS;
7473
7474 status = sme_AcquireGlobalLock( &pMac->sme );
7475 if ( HAL_STATUS_SUCCESS( status ) )
7476 {
7477 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7478 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7479 neighborReassocRssiThreshold,
7480 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7481 pMac->roam.neighborRoamInfo.neighborRoamState);
7482 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7483 neighborReassocRssiThreshold;
7484 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7485 neighborReassocRssiThreshold;
7486 sme_ReleaseGlobalLock( &pMac->sme );
7487 }
7488
7489 return status ;
7490}
7491
7492
7493/*--------------------------------------------------------------------------
7494 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7495 This is a synchronous call
7496 \param hHal - The handle returned by macOpen.
7497 \return eHAL_STATUS_SUCCESS - SME update config successful.
7498 Other status means SME is failed to update
7499 \sa
7500 --------------------------------------------------------------------------*/
7501v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7502{
7503 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7504 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7505}
7506
7507/*--------------------------------------------------------------------------
7508 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7509 This is a synchronous call
7510 \param hHal - The handle returned by macOpen.
7511 \return eHAL_STATUS_SUCCESS - SME update config successful.
7512 Other status means SME is failed to update
7513 \sa
7514 --------------------------------------------------------------------------*/
7515eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7516 v_U16_t neighborScanResultsRefreshPeriod)
7517{
7518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7519 eHalStatus status = eHAL_STATUS_SUCCESS;
7520
7521 status = sme_AcquireGlobalLock( &pMac->sme );
7522 if ( HAL_STATUS_SUCCESS( status ) )
7523 {
7524 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7525 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7526 neighborScanResultsRefreshPeriod,
7527 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7528 pMac->roam.neighborRoamInfo.neighborRoamState);
7529 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7530 neighborScanResultsRefreshPeriod;
7531 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7532 neighborScanResultsRefreshPeriod;
7533
7534 sme_ReleaseGlobalLock( &pMac->sme );
7535 }
7536
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007537#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7538 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7539 {
7540 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7541 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
7542 }
7543#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007544 return status ;
7545}
7546
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007547#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7548/*--------------------------------------------------------------------------
7549 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
7550 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7551 gRoamScanOffloadEnabled.
7552 This is a synchronous call
7553 \param hHal - The handle returned by macOpen.
7554 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7555 Other status means SME is failed to update.
7556 \sa
7557 --------------------------------------------------------------------------*/
7558
7559eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
7560 v_BOOL_t nRoamScanOffloadEnabled)
7561{
7562 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7563 eHalStatus status = eHAL_STATUS_SUCCESS;
7564
7565 status = sme_AcquireGlobalLock( &pMac->sme );
7566 if ( HAL_STATUS_SUCCESS( status ) )
7567 {
7568 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7569 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
7570 pMac->roam.configParam.isRoamOffloadScanEnabled,
7571 nRoamScanOffloadEnabled);
7572 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
7573 sme_ReleaseGlobalLock( &pMac->sme );
7574 }
7575
7576 return status ;
7577}
7578#endif
7579
Srinivas Girigowdade697412013-02-14 16:31:48 -08007580/*--------------------------------------------------------------------------
7581 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7582 This is a synchronous call
7583 \param hHal - The handle returned by macOpen.
7584 \return v_U16_t - Neighbor scan results refresh period value
7585 \sa
7586 --------------------------------------------------------------------------*/
7587v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7588{
7589 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7590 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7591}
7592
7593/*--------------------------------------------------------------------------
7594 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7595 This is a synchronuous call
7596 \param hHal - The handle returned by macOpen.
7597 \return eHAL_STATUS_SUCCESS - SME update config successful.
7598 Other status means SME is failed to update
7599 \sa
7600 --------------------------------------------------------------------------*/
7601v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7602{
7603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7604 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7605}
7606
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007607/* ---------------------------------------------------------------------------
7608 \fn sme_UpdateEmptyScanRefreshPeriod
7609 \brief Update nEmptyScanRefreshPeriod
7610 This function is called through dynamic setConfig callback function
7611 to configure nEmptyScanRefreshPeriod
7612 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7613 \param hHal - HAL handle for device
7614 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7615 \- return Success or failure
7616 -------------------------------------------------------------------------*/
7617
7618eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
7619{
7620 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7621 eHalStatus status = eHAL_STATUS_SUCCESS;
7622
7623 status = sme_AcquireGlobalLock( &pMac->sme );
7624 if ( HAL_STATUS_SUCCESS( status ) )
7625 {
7626 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7627 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
7628 nEmptyScanRefreshPeriod,
7629 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
7630 pMac->roam.neighborRoamInfo.neighborRoamState);
7631 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7632 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7633 sme_ReleaseGlobalLock( &pMac->sme );
7634 }
7635
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007636#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7637 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7638 {
7639 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7640 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
7641 }
7642#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007643 return status ;
7644}
7645
7646/* ---------------------------------------------------------------------------
7647 \fn sme_setNeighborScanMinChanTime
7648 \brief Update nNeighborScanMinChanTime
7649 This function is called through dynamic setConfig callback function
7650 to configure gNeighborScanChannelMinTime
7651 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
7652 \param hHal - HAL handle for device
7653 \param nNeighborScanMinChanTime - Channel minimum dwell time
7654 \- return Success or failure
7655 -------------------------------------------------------------------------*/
7656eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
7657{
7658 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7659 eHalStatus status = eHAL_STATUS_SUCCESS;
7660
7661 status = sme_AcquireGlobalLock( &pMac->sme );
7662 if ( HAL_STATUS_SUCCESS( status ) )
7663 {
7664 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7665 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
7666 nNeighborScanMinChanTime,
7667 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
7668 pMac->roam.neighborRoamInfo.neighborRoamState);
7669 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
7670 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
7671 sme_ReleaseGlobalLock( &pMac->sme );
7672 }
7673
7674 return status ;
7675}
7676
7677/* ---------------------------------------------------------------------------
7678 \fn sme_setNeighborScanMaxChanTime
7679 \brief Update nNeighborScanMaxChanTime
7680 This function is called through dynamic setConfig callback function
7681 to configure gNeighborScanChannelMaxTime
7682 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
7683 \param hHal - HAL handle for device
7684 \param nNeighborScanMinChanTime - Channel maximum dwell time
7685 \- return Success or failure
7686 -------------------------------------------------------------------------*/
7687eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
7688{
7689 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7690 eHalStatus status = eHAL_STATUS_SUCCESS;
7691
7692 status = sme_AcquireGlobalLock( &pMac->sme );
7693 if ( HAL_STATUS_SUCCESS( status ) )
7694 {
7695 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7696 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
7697 nNeighborScanMaxChanTime,
7698 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
7699 pMac->roam.neighborRoamInfo.neighborRoamState);
7700 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
7701 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
7702 sme_ReleaseGlobalLock( &pMac->sme );
7703 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007704#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7705 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7706 {
7707 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7708 REASON_SCAN_CH_TIME_CHANGED);
7709 }
7710#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007711
7712 return status ;
7713}
7714
7715/* ---------------------------------------------------------------------------
7716 \fn sme_getNeighborScanMinChanTime
7717 \brief get neighbor scan min channel time
7718 \param hHal - The handle returned by macOpen.
7719 \return v_U16_t - channel min time value
7720 -------------------------------------------------------------------------*/
7721v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
7722{
7723 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7724 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
7725}
7726
7727/* ---------------------------------------------------------------------------
7728 \fn sme_getNeighborScanMaxChanTime
7729 \brief get neighbor scan max channel time
7730 \param hHal - The handle returned by macOpen.
7731 \return v_U16_t - channel max time value
7732 -------------------------------------------------------------------------*/
7733v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
7734{
7735 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7736 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
7737}
7738
7739/* ---------------------------------------------------------------------------
7740 \fn sme_setNeighborScanPeriod
7741 \brief Update nNeighborScanPeriod
7742 This function is called through dynamic setConfig callback function
7743 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007744 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007745 \param hHal - HAL handle for device
7746 \param nNeighborScanPeriod - neighbor scan period
7747 \- return Success or failure
7748 -------------------------------------------------------------------------*/
7749eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
7750{
7751 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7752 eHalStatus status = eHAL_STATUS_SUCCESS;
7753
7754 status = sme_AcquireGlobalLock( &pMac->sme );
7755 if ( HAL_STATUS_SUCCESS( status ) )
7756 {
7757 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7758 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
7759 nNeighborScanPeriod,
7760 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
7761 pMac->roam.neighborRoamInfo.neighborRoamState);
7762 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
7763 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
7764 sme_ReleaseGlobalLock( &pMac->sme );
7765 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007766#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7767 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7768 {
7769 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7770 REASON_SCAN_HOME_TIME_CHANGED);
7771 }
7772#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007773
7774 return status ;
7775}
7776
7777/* ---------------------------------------------------------------------------
7778 \fn sme_getNeighborScanPeriod
7779 \brief get neighbor scan period
7780 \param hHal - The handle returned by macOpen.
7781 \return v_U16_t - neighbor scan period
7782 -------------------------------------------------------------------------*/
7783v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
7784{
7785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7786 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
7787}
7788
7789#endif
7790
Srinivas Girigowdade697412013-02-14 16:31:48 -08007791#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007792
Srinivas Girigowdade697412013-02-14 16:31:48 -08007793/*--------------------------------------------------------------------------
7794 \brief sme_getRoamRssiDiff() - get Roam rssi diff
7795 This is a synchronous call
7796 \param hHal - The handle returned by macOpen.
7797 \return v_U16_t - Rssi diff value
7798 \sa
7799 --------------------------------------------------------------------------*/
7800v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
7801{
7802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7803 return pMac->roam.configParam.RoamRssiDiff;
7804}
7805
7806/*--------------------------------------------------------------------------
7807 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
7808 This is a synchronous call
7809 \param hHal - The handle returned by macOpen.
7810 \return eHAL_STATUS_SUCCESS - SME update config successful.
7811 Other status means SME is failed to update
7812 \sa
7813 --------------------------------------------------------------------------*/
7814eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7815 tANI_U8 numChannels)
7816{
7817 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7818 eHalStatus status = eHAL_STATUS_SUCCESS;
7819 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007820 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08007821 tANI_U8 newChannelList[128] = {0};
7822 tANI_U8 i = 0, j = 0;
7823
7824 status = sme_AcquireGlobalLock( &pMac->sme );
7825 if ( HAL_STATUS_SUCCESS( status ) )
7826 {
7827 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7828 {
7829 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7830 {
7831 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
7832 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7833 }
7834 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007835 csrFlushBgScanRoamChannelList(pMac);
7836 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Srinivas Girigowdade697412013-02-14 16:31:48 -08007837 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
7838
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007839 if ( HAL_STATUS_SUCCESS( status ))
Srinivas Girigowdade697412013-02-14 16:31:48 -08007840 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007841 sme_SetRoamScanControl(hHal, 1);
7842 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08007843 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007844 j = 0;
7845 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7846 {
7847 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
7848 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7849 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007850 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007851
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007852 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7853 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
7854 newChannelList, oldChannelList,
7855 pMac->roam.neighborRoamInfo.neighborRoamState);
7856 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007857 sme_ReleaseGlobalLock( &pMac->sme );
7858 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007859#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7860 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7861 {
7862 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
7863 }
7864#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007865
7866 return status ;
7867}
7868
7869/*--------------------------------------------------------------------------
7870 \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list
7871 based on country revision number
7872 This is a synchronous call
7873 \param hHal - The handle returned by macOpen.
7874 \return eHAL_STATUS_SUCCESS - SME update config successful.
7875 Other status means SME is failed to update
7876 \sa
7877 --------------------------------------------------------------------------*/
7878eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal,
7879 tANI_U8 Revision)
7880{
7881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7882 eHalStatus status = eHAL_STATUS_SUCCESS;
7883
7884 status = sme_AcquireGlobalLock( &pMac->sme );
7885 if ( HAL_STATUS_SUCCESS( status ) )
7886 {
7887 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7888 "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d",
7889 "KR", Revision, "KR",
7890 pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision,
7891 pMac->roam.neighborRoamInfo.neighborRoamState);
7892 csr_SetRevision(pMac, Revision);
7893 csrInitCountryValidChannelList(pMac, Revision);
7894 sme_ReleaseGlobalLock( &pMac->sme );
7895 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007896#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7897 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7898 {
7899 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_VALID_CHANNEL_LIST_CHANGED);
7900 }
7901#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007902
7903 return status ;
7904}
7905
7906
7907/*--------------------------------------------------------------------------
7908 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
7909 This is a synchronous call
7910 \param hHal - The handle returned by macOpen.
7911 \return eHAL_STATUS_SUCCESS - SME update config successful.
7912 Other status means SME is failed to update
7913 \sa
7914 --------------------------------------------------------------------------*/
7915eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
7916 eCsrBand eBand)
7917{
7918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7919 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
7920}
7921
7922/*--------------------------------------------------------------------------
7923 \brief sme_getRoamScanChannelList() - get roam scan channel list
7924 This is a synchronous call
7925 \param hHal - The handle returned by macOpen.
7926 \return eHAL_STATUS_SUCCESS - SME update config successful.
7927 Other status means SME is failed to update
7928 \sa
7929 --------------------------------------------------------------------------*/
7930eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7931 tANI_U8 *pNumChannels)
7932{
7933 int i = 0;
7934 tANI_U8 *pOutPtr = pChannelList;
7935 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7936 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7937 eHalStatus status = eHAL_STATUS_SUCCESS;
7938
7939 status = sme_AcquireGlobalLock( &pMac->sme );
7940 if ( HAL_STATUS_SUCCESS( status ) )
7941 {
7942 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7943 {
7944 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
7945 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007946 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08007947 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007948 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08007949 }
7950
7951 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
7952 for (i = 0; i < (*pNumChannels); i++)
7953 {
7954 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
7955 }
7956 pOutPtr[i] = '\0';
7957 sme_ReleaseGlobalLock( &pMac->sme );
7958 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007959 return status ;
7960}
7961
7962/*--------------------------------------------------------------------------
7963 \brief sme_GetCountryRevision() - get Country revision index
7964 This is a synchronous call
7965 \param hHal - The handle returned by macOpen.
7966 \return eHAL_STATUS_SUCCESS - SME update config successful.
7967 Other status means SME is failed to update
7968 \sa
7969 --------------------------------------------------------------------------*/
7970eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision)
7971{
7972 /* this is valid for Country KR only now */
7973 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7974 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7975 eHalStatus status = eHAL_STATUS_SUCCESS;
7976
7977 *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision;
7978
7979 return status;
7980}
7981
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007982/*--------------------------------------------------------------------------
7983 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
7984 This is a synchronuous call
7985 \param hHal - The handle returned by macOpen.
7986 \return TRUE (1) - if the CCX feature is enabled
7987 FALSE (0) - if feature is disabled (compile or runtime)
7988 \sa
7989 --------------------------------------------------------------------------*/
7990tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08007991{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007992#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08007993 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007994 return pMac->roam.configParam.isCcxIniFeatureEnabled;
7995#else
7996 return eANI_BOOLEAN_FALSE;
7997#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007998}
7999
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008000/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008001 \brief sme_GetWESMode() - get WES Mode
8002 This is a synchronous call
8003 \param hHal - The handle returned by macOpen
8004 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
8005 \sa
8006 --------------------------------------------------------------------------*/
8007v_BOOL_t sme_GetWESMode(tHalHandle hHal)
8008{
8009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8010 return pMac->roam.configParam.isWESModeEnabled;
8011}
8012
8013/*--------------------------------------------------------------------------
8014 \brief sme_GetRoamScanControl() - get scan control
8015 This is a synchronous call
8016 \param hHal - The handle returned by macOpen.
8017 \return v_BOOL_t - Enabled(1)/Disabled(0)
8018 \sa
8019 --------------------------------------------------------------------------*/
8020v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
8021{
8022 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8023 return pMac->roam.configParam.nRoamScanControl;
8024}
8025#endif
8026
8027/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008028 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
8029 This is a synchronuous call
8030 \param hHal - The handle returned by macOpen.
8031 \return TRUE (1) - if the feature is enabled
8032 FALSE (0) - if feature is disabled (compile or runtime)
8033 \sa
8034 --------------------------------------------------------------------------*/
8035tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
8036{
8037#ifdef FEATURE_WLAN_LFR
8038 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8039 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
8040#else
8041 return eANI_BOOLEAN_FALSE;
8042#endif
8043}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008044
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008045/*--------------------------------------------------------------------------
8046 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
8047 This is a synchronuous call
8048 \param hHal - The handle returned by macOpen.
8049 \return TRUE (1) - if the feature is enabled
8050 FALSE (0) - if feature is disabled (compile or runtime)
8051 \sa
8052 --------------------------------------------------------------------------*/
8053tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
8054{
8055#ifdef WLAN_FEATURE_VOWIFI_11R
8056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8057 return pMac->roam.configParam.isFastTransitionEnabled;
8058#else
8059 return eANI_BOOLEAN_FALSE;
8060#endif
8061}
8062
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008063
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008064/* ---------------------------------------------------------------------------
8065 \fn sme_IsFeatureSupportedByFW
8066 \brief Check if an feature is enabled by FW
8067
8068 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
8069 \- return 1/0 (TRUE/FALSE)
8070 -------------------------------------------------------------------------*/
8071tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
8072{
8073 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
8074}
8075#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05308076
8077/* ---------------------------------------------------------------------------
8078 \fn sme_SendTdlsMgmtFrame
8079 \brief API to send TDLS management frames.
8080
8081 \param peerMac - peer's Mac Adress.
8082 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
8083 \- return VOS_STATUS_SUCCES
8084 -------------------------------------------------------------------------*/
8085VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
8086 tANI_U8 sessionId,
8087 tSirMacAddr peerMac,
8088 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
8089{
8090 eHalStatus status = eHAL_STATUS_SUCCESS;
8091 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8092
8093 status = sme_AcquireGlobalLock( &pMac->sme );
8094
8095 if ( HAL_STATUS_SUCCESS( status ) )
8096 {
8097 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
8098 sme_ReleaseGlobalLock( &pMac->sme );
8099 }
8100 return status ;
8101}
8102
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008103/* ---------------------------------------------------------------------------
8104 \fn sme_SendTdlsMgmtFrame
8105 \brief API to send TDLS management frames.
8106
8107 \param peerMac - peer's Mac Adress.
8108 \param frame_type - Type of TDLS mgmt frame to be sent.
8109 \param dialog - dialog token used in the frame.
8110 \param status - status to be incuded in the frame.
8111 \param buf - additional IEs to be included
8112 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08008113 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008114 \- return VOS_STATUS_SUCCES
8115 -------------------------------------------------------------------------*/
8116VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08008117 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 -08008118{
8119 eHalStatus status = eHAL_STATUS_SUCCESS;
8120 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
8121 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8122
8123 status = sme_AcquireGlobalLock( &pMac->sme );
8124 if ( HAL_STATUS_SUCCESS( status ) )
8125 {
8126 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8127 sendTdlsReq.frameType = frame_type;
8128 sendTdlsReq.buf = buf;
8129 sendTdlsReq.len = len;
8130 sendTdlsReq.dialog = dialog;
8131 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08008132 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008133
8134 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
8135
8136 sme_ReleaseGlobalLock( &pMac->sme );
8137 }
8138
8139 return status ;
8140
8141}
8142/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08008143 \fn sme_ChangeTdlsPeerSta
8144 \brief API to Update TDLS peer sta parameters.
8145
8146 \param peerMac - peer's Mac Adress.
8147 \param staParams - Peer Station Parameters
8148 \- return VOS_STATUS_SUCCES
8149 -------------------------------------------------------------------------*/
8150VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
8151 tCsrStaParams *pstaParams)
8152{
8153 eHalStatus status = eHAL_STATUS_SUCCESS;
8154 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8155
8156 status = sme_AcquireGlobalLock( &pMac->sme );
8157 if ( HAL_STATUS_SUCCESS( status ) )
8158 {
8159 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
8160
8161 sme_ReleaseGlobalLock( &pMac->sme );
8162 }
8163
8164 return status ;
8165
8166}
8167
8168/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008169 \fn sme_AddTdlsPeerSta
8170 \brief API to Add TDLS peer sta entry.
8171
8172 \param peerMac - peer's Mac Adress.
8173 \- return VOS_STATUS_SUCCES
8174 -------------------------------------------------------------------------*/
8175VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8176{
8177 eHalStatus status = eHAL_STATUS_SUCCESS;
8178 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8179
8180 status = sme_AcquireGlobalLock( &pMac->sme );
8181 if ( HAL_STATUS_SUCCESS( status ) )
8182 {
8183 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
8184
8185 sme_ReleaseGlobalLock( &pMac->sme );
8186 }
8187
8188 return status ;
8189
8190}
8191/* ---------------------------------------------------------------------------
8192 \fn sme_DeleteTdlsPeerSta
8193 \brief API to Delete TDLS peer sta entry.
8194
8195 \param peerMac - peer's Mac Adress.
8196 \- return VOS_STATUS_SUCCES
8197 -------------------------------------------------------------------------*/
8198VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8199{
8200 eHalStatus status = eHAL_STATUS_SUCCESS;
8201 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8202
8203 status = sme_AcquireGlobalLock( &pMac->sme );
8204 if ( HAL_STATUS_SUCCESS( status ) )
8205 {
8206 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
8207
8208 sme_ReleaseGlobalLock( &pMac->sme );
8209 }
8210
8211 return status ;
8212
8213}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07008214/* ---------------------------------------------------------------------------
8215 \fn sme_IsPmcBmps
8216 \API to Check if PMC state is BMPS.
8217
8218 \- return v_BOOL_t
8219 -------------------------------------------------------------------------*/
8220v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
8221{
8222 return (BMPS == pmcGetPmcState(hHal));
8223}
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07008224/* ---------------------------------------------------------------------------
8225 \fn sme_SetTdlsPowerSaveProhibited
8226 \API to set/reset the isTdlsPowerSaveProhibited.
8227
8228 \- return void
8229 -------------------------------------------------------------------------*/
8230void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
8231{
8232 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8233
8234 pMac->isTdlsPowerSaveProhibited = val;
8235 return;
8236}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008237#endif
8238#ifdef FEATURE_WLAN_TDLS_INTERNAL
8239/*
8240 * SME API to start TDLS discovery Procedure
8241 */
8242VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8243{
8244 VOS_STATUS status = VOS_STATUS_SUCCESS;
8245 tCsrTdlsDisRequest disReq = {{0}} ;
8246 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8247 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
8248
8249 return status ;
8250
8251}
8252
8253/*
8254 * Process TDLS discovery results
8255 */
8256v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
8257 tSmeTdlsDisResult *disResult, v_U8_t listType)
8258{
8259 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
8260 tSirTdlsPeerInfo *peerInfo = NULL ;
8261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8262 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
8263 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
8264 tListElem *pEntry = NULL ;
8265 v_U8_t peerCnt = 0 ;
8266
8267 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008268 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008269 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
8270 while(pEntry)
8271 {
8272 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
8273 tdlsPeerStaLink) ;
8274 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
8275
8276 switch(listType)
8277 {
8278 case TDLS_SETUP_LIST:
8279 {
8280 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
8281 {
8282 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8283 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8284 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8285 peerCnt++ ;
8286 }
8287 break ;
8288 }
8289 case TDLS_DIS_LIST:
8290 {
8291 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8292 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8293 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8294 peerCnt++ ;
8295 break ;
8296 }
8297 default:
8298 {
8299 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008300 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008301 break ;
8302 }
8303 }
8304
8305 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
8306 }
8307
8308 return peerCnt ;
8309
8310}
8311
8312/*
8313 * SME API to start TDLS link setup Procedure.
8314 */
8315VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8316{
8317 VOS_STATUS status = VOS_STATUS_SUCCESS;
8318 tCsrTdlsSetupRequest setupReq = {{0}} ;
8319 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8320 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
8321 return status ;
8322
8323}
8324
8325/*
8326 * SME API to start TDLS link Teardown Procedure.
8327 */
8328VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8329{
8330 VOS_STATUS status = VOS_STATUS_SUCCESS;
8331 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
8332 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8333 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
8334 return status ;
8335
8336}
8337
8338#endif /* FEATURE_WLAN_TDLS */
8339
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07008340eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
8341{
8342 eHalStatus status = eHAL_STATUS_FAILURE;
8343 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8344
8345 smsLog(pMac, LOG2, FL("enter"));
8346 status = sme_AcquireGlobalLock( &pMac->sme );
8347 if ( HAL_STATUS_SUCCESS( status ) )
8348 {
8349 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
8350 sme_ReleaseGlobalLock( &pMac->sme );
8351 }
8352 smsLog(pMac, LOG2, FL("exit status %d"), status);
8353
8354 return (status);
8355}
8356
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07008357/*
8358 * SME API to enable/disable WLAN driver initiated SSR
8359 */
8360void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
8361{
8362 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8363 eHalStatus status = eHAL_STATUS_SUCCESS;
8364
8365 status = sme_AcquireGlobalLock(&pMac->sme);
8366 if (HAL_STATUS_SUCCESS(status))
8367 {
8368 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8369 "SSR level is changed %d", enableSSR);
8370 /* not serializing this messsage, as this is only going
8371 * to set a variable in WDA/WDI
8372 */
8373 WDA_SetEnableSSR(enableSSR);
8374 sme_ReleaseGlobalLock(&pMac->sme);
8375 }
8376 return;
8377}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07008378
8379/*
8380 * SME API to determine the channel bonding mode
8381 */
8382VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
8383{
8384 tSmeConfigParams smeConfig;
8385 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8386
8387 if (
8388#ifdef WLAN_FEATURE_11AC
8389 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
8390 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
8391#endif
8392 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
8393 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
8394 )
8395 {
8396 return VOS_STATUS_SUCCESS;
8397 }
8398
8399 /* If channel bonding mode is not required */
8400 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
8401 return VOS_STATUS_SUCCESS;
8402 }
8403
8404 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
8405 sme_GetConfigParam(pMac, &smeConfig);
8406
8407#ifdef WLAN_FEATURE_11AC
8408 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
8409 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
8410 {
8411 if ( channel== 36 || channel == 52 || channel == 100 ||
8412 channel == 116 || channel == 149 )
8413 {
8414 smeConfig.csrConfig.channelBondingMode5GHz =
8415 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
8416 }
8417 else if ( channel == 40 || channel == 56 || channel == 104 ||
8418 channel == 120 || channel == 153 )
8419 {
8420 smeConfig.csrConfig.channelBondingMode5GHz =
8421 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
8422 }
8423 else if ( channel == 44 || channel == 60 || channel == 108 ||
8424 channel == 124 || channel == 157 )
8425 {
8426 smeConfig.csrConfig.channelBondingMode5GHz =
8427 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
8428 }
8429 else if ( channel == 48 || channel == 64 || channel == 112 ||
8430 channel == 128 || channel == 161 )
8431 {
8432 smeConfig.csrConfig.channelBondingMode5GHz =
8433 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
8434 }
8435 else if ( channel == 165 )
8436 {
8437 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8438 }
8439 }
8440#endif
8441
8442 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
8443 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
8444 {
8445 if ( channel== 40 || channel == 48 || channel == 56 ||
8446 channel == 64 || channel == 104 || channel == 112 ||
8447 channel == 120 || channel == 128 || channel == 136 ||
8448 channel == 144 || channel == 153 || channel == 161 )
8449 {
8450 smeConfig.csrConfig.channelBondingMode5GHz = 1;
8451 }
8452 else if ( channel== 36 || channel == 44 || channel == 52 ||
8453 channel == 60 || channel == 100 || channel == 108 ||
8454 channel == 116 || channel == 124 || channel == 132 ||
8455 channel == 140 || channel == 149 || channel == 157 )
8456 {
8457 smeConfig.csrConfig.channelBondingMode5GHz = 2;
8458 }
8459 else if ( channel == 165 )
8460 {
8461 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8462 }
8463 }
8464 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8465 "cbmode selected=%ld\n", smeConfig.csrConfig.channelBondingMode5GHz);
8466
8467 sme_UpdateConfig (pMac, &smeConfig);
8468 return VOS_STATUS_SUCCESS;
8469}
8470
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07008471#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8472/*--------------------------------------------------------------------------
8473 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
8474 from CSR.
8475 This is a synchronous call
8476 \param hHal - The handle returned by macOpen
8477 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
8478 BSSID, channel etc.)
8479 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
8480 Other status means SME is failed to send the request.
8481 \sa
8482 --------------------------------------------------------------------------*/
8483
8484eHalStatus sme_HandoffRequest(tHalHandle hHal,
8485 tCsrHandoffRequest *pHandoffInfo)
8486{
8487 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8488 eHalStatus status = eHAL_STATUS_SUCCESS;
8489
8490 status = sme_AcquireGlobalLock( &pMac->sme );
8491 if ( HAL_STATUS_SUCCESS( status ) )
8492 {
8493 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8494 "%s: invoked", __func__);
8495 status = csrHandoffRequest(pMac, pHandoffInfo);
8496 sme_ReleaseGlobalLock( &pMac->sme );
8497 }
8498
8499 return status ;
8500}
8501#endif
8502