blob: 656dea462d1c5e34cd715d2949fb596fa28559f2 [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"
Katya Nigam70d68332013-09-16 16:49:45 +053083#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -070084#include "sme_Trace.h"
85#include "limTrace.h"
86
Jeff Johnson295189b2012-06-20 16:38:30 -070087#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070088
89
90
Jeff Johnson295189b2012-06-20 16:38:30 -070091extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
92
93#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053094#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080095#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053096#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080097
Jeff Johnson295189b2012-06-20 16:38:30 -070098// TxMB Functions
99extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
100 tANI_U32 size, tSmeCmd **ppCmd );
101extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
102extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -0700103extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
104extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
105extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
106extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
107extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
108extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700109
110static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
111static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
112
113eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
114
115eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
116
Amar Singhal0d15bd52013-10-12 23:13:13 -0700117eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
118
Jeff Johnson295189b2012-06-20 16:38:30 -0700119eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
120
121eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
122
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700123#ifdef FEATURE_WLAN_LFR
124tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
125#endif
126
Chet Lanctot186b5732013-03-18 10:26:30 -0700127#ifdef WLAN_FEATURE_11W
128eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
129 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
130#endif
131
Jeff Johnson295189b2012-06-20 16:38:30 -0700132//Internal SME APIs
133eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
134{
135 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
136
137 if(psSme)
138 {
139 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
140 {
141 status = eHAL_STATUS_SUCCESS;
142 }
143 }
144
145 return (status);
146}
147
148
149eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
150{
151 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
152
153 if(psSme)
154 {
155 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
156 {
157 status = eHAL_STATUS_SUCCESS;
158 }
159 }
160
161 return (status);
162}
163
164
165
166static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
167{
168 eHalStatus status;
169 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530170 tANI_U32 cmd_idx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700171
172 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530173 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
174 &pMac->sme.smeCmdActiveList)))
175 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700176
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530177 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
178 &pMac->sme.smeCmdPendingList)))
179 goto end;
180
181 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
182 &pMac->sme.smeScanCmdActiveList)))
183 goto end;
184
185 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
186 &pMac->sme.smeScanCmdPendingList)))
187 goto end;
188
189 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
190 &pMac->sme.smeCmdFreeList)))
191 goto end;
192
Kiet Lam64c1b492013-07-12 13:56:44 +0530193 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
194 if ( NULL == pCmd )
195 status = eHAL_STATUS_FAILURE;
196 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530197 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530198 status = eHAL_STATUS_SUCCESS;
199
200 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
201 pMac->sme.pSmeCmdBufAddr = pCmd;
202
203 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
204 {
205 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530206 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530207 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 }
209
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530210end:
211 if (!HAL_STATUS_SUCCESS(status))
212 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
213 status);
214
Jeff Johnson295189b2012-06-20 16:38:30 -0700215 return (status);
216}
217
218
219void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
220{
221 pCmd->command = eSmeNoCommand;
222 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
223}
224
225
226
227static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
228{
229 tListElem *pEntry;
230 tSmeCmd *pCommand;
231
232 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
233 {
234 //TODO: base on command type to call release functions
235 //reinitialize different command types so they can be reused
236 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
237 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
238 }
239}
240
241static void purgeSmeCmdList(tpAniSirGlobal pMac)
242{
243 //release any out standing commands back to free command list
244 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
245 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530246 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
247 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700248}
249
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530250void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
251 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700252{
253 //release any out standing commands back to free command list
254 tListElem *pEntry, *pNext;
255 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 tDblLinkList localList;
257
258 vos_mem_zero(&localList, sizeof(tDblLinkList));
259 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
260 {
261 smsLog(pMac, LOGE, FL(" failed to open list"));
262 return;
263 }
264
265 csrLLLock(pList);
266 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
267 while(pEntry != NULL)
268 {
269 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
270 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
271 if(pCommand->sessionId == sessionId)
272 {
273 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
274 {
275 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
276 }
277 }
278 pEntry = pNext;
279 }
280 csrLLUnlock(pList);
281
282 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
283 {
284 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
285 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
286 }
287 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700288}
289
290
291static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
292{
293 eHalStatus status = eHAL_STATUS_SUCCESS;
294
295 purgeSmeCmdList(pMac);
296 csrLLClose(&pMac->sme.smeCmdPendingList);
297 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530298 csrLLClose(&pMac->sme.smeScanCmdPendingList);
299 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 csrLLClose(&pMac->sme.smeCmdFreeList);
301
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800302 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
303 if(status != eHAL_STATUS_SUCCESS)
304 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800305 smsLog(pMac, LOGE,
306 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800307 goto done;
308 }
309
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 if(NULL != pMac->sme.pSmeCmdBufAddr)
311 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530312 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 pMac->sme.pSmeCmdBufAddr = NULL;
314 }
315
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800316 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
317 if(status != eHAL_STATUS_SUCCESS)
318 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800319 smsLog(pMac, LOGE,
320 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800321 }
322done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 return (status);
324}
325
326
327void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
328{
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 switch( pCmd->command )
330 {
331 case eSmeCommandScan:
332 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
333 break;
334
335 case eSmeCommandRoam:
336 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
337 break;
338
339 case eSmeCommandWmStatusChange:
340 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
341 break;
342
343 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800344 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
346 break;
347
348 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800349 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
351 break;
352
353 default:
354 break;
355 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700356}
357
358tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
359{
360 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
361 tListElem *pEntry;
362
363 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
364
365 // If we can get another MS Msg buffer, then we are ok. Just link
366 // the entry onto the linked list. (We are using the linked list
367 // to keep track of tfhe message buffers).
368 if ( pEntry )
369 {
370 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
371 }
372 else {
373 int idx = 1;
374
375 //Cannot change pRetCmd here since it needs to return later.
376 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
377 if( pEntry )
378 {
379 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
380 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800381 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
383 if(pTempCmd)
384 {
385 if( eSmeCsrCommandMask & pTempCmd->command )
386 {
387 //CSR command is stuck. See what the reason code is for that command
388 dumpCsrCommandInfo(pMac, pTempCmd);
389 }
390 } //if(pTempCmd)
391
392 //dump what is in the pending queue
393 csrLLLock(&pMac->sme.smeCmdPendingList);
394 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
395 while(pEntry)
396 {
397 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800398 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 idx++, pTempCmd->command );
400 if( eSmeCsrCommandMask & pTempCmd->command )
401 {
402 //CSR command is stuck. See what the reason code is for that command
403 dumpCsrCommandInfo(pMac, pTempCmd);
404 }
405 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
406 }
407 csrLLUnlock(&pMac->sme.smeCmdPendingList);
408
409 //There may be some more command in CSR's own pending queue
410 csrLLLock(&pMac->roam.roamCmdPendingList);
411 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
412 while(pEntry)
413 {
414 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800415 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 idx++, pTempCmd->command );
417 dumpCsrCommandInfo(pMac, pTempCmd);
418 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
419 }
420 csrLLUnlock(&pMac->roam.roamCmdPendingList);
421 }
422
423 return( pRetCmd );
424}
425
426
427void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
428{
429 if ( fHighPriority )
430 {
431 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
432 }
433 else
434 {
435 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
436 }
437
438 // process the command queue...
439 smeProcessPendingQueue( pMac );
440
441 return;
442}
443
444
445static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
446{
447 eSmeCommandType pmcCommand = eSmeNoCommand;
448 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
449 tPmcState pmcState;
450 eHalStatus status;
451
452 do
453 {
454 pmcState = pmcGetPmcState(pMac);
455
456 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
457 if( !HAL_STATUS_SUCCESS(status) )
458 {
459 //PMC state is not right for the command, drop it
460 return ( eSmeDropCommand );
461 }
462 if( fFullPowerNeeded ) break;
463 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
464 ( eSmeCommandDelTs == pCommand->command ) );
465 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700466#ifdef FEATURE_OEM_DATA_SUPPORT
467 fFullPowerNeeded = (pmcState == IMPS &&
468 eSmeCommandOemDataReq == pCommand->command);
469 if(fFullPowerNeeded) break;
470#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 fFullPowerNeeded = (pmcState == IMPS &&
472 eSmeCommandRemainOnChannel == pCommand->command);
473 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 } while(0);
475
476 if( fFullPowerNeeded )
477 {
478 switch( pmcState )
479 {
480 case IMPS:
481 case STANDBY:
482 pmcCommand = eSmeCommandExitImps;
483 break;
484
485 case BMPS:
486 pmcCommand = eSmeCommandExitBmps;
487 break;
488
489 case UAPSD:
490 pmcCommand = eSmeCommandExitUapsd;
491 break;
492
493 case WOWL:
494 pmcCommand = eSmeCommandExitWowl;
495 break;
496
497 default:
498 break;
499 }
500 }
501
502 return ( pmcCommand );
503}
504
505
506//For commands that need to do extra cleanup.
507static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
508{
509 if( eSmePmcCommandMask & pCommand->command )
510 {
511 pmcAbortCommand( pMac, pCommand, fStopping );
512 }
513 else if ( eSmeCsrCommandMask & pCommand->command )
514 {
515 csrAbortCommand( pMac, pCommand, fStopping );
516 }
517 else
518 {
519 switch( pCommand->command )
520 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eSmeCommandRemainOnChannel:
522 if (NULL != pCommand->u.remainChlCmd.callback)
523 {
524 remainOnChanCallback callback =
525 pCommand->u.remainChlCmd.callback;
526 /* process the msg */
527 if( callback )
528 {
529 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
530 eCSR_SCAN_ABORT );
531 }
532 }
533 smeReleaseCommand( pMac, pCommand );
534 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 default:
536 smeReleaseCommand( pMac, pCommand );
537 break;
538 }
539 }
540}
541
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530542tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
543 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
544{
545 tListElem *pCurEntry = NULL;
546 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700547
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530548 /* Go through the list and return the command whose session id is not
549 * matching with the current ongoing scan cmd sessionId */
550 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
551 while (pCurEntry)
552 {
553 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
554 if (pCommand->sessionId != sessionId)
555 {
556 smsLog(pMac, LOG1, "selected the command with different sessionId");
557 return pCurEntry;
558 }
559
560 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
561 }
562
563 smsLog(pMac, LOG1, "No command pending with different sessionId");
564 return NULL;
565}
566
567tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
568{
569 tListElem *pEntry;
570 tSmeCmd *pCommand;
571 tListElem *pSmeEntry;
572 tSmeCmd *pSmeCommand;
573 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
574
575 csrLLLock( &pMac->sme.smeScanCmdActiveList );
576 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
577 LL_ACCESS_NOLOCK ))
578 {
579 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
580 LL_ACCESS_LOCK))
581 {
582 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
583 LL_ACCESS_LOCK );
584 if (pEntry)
585 {
586 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
587 //We cannot execute any command in wait-for-key state until setKey is through.
588 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
589 {
590 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
591 {
592 smsLog(pMac, LOGE,
593 " Cannot process command(%d) while waiting for key",
594 pCommand->command);
595 status = eANI_BOOLEAN_FALSE;
596 goto end;
597 }
598 }
599
600 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
601 LL_ACCESS_LOCK )))
602 {
603 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
604 LL_ACCESS_LOCK);
605 if (pEntry)
606 {
607 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
608 Link) ;
609
610 /* if scan is running on one interface and SME recei
611 ves the next command on the same interface then
612 dont the allow the command to be queued to
613 smeCmdPendingList. If next scan is allowed on
614 the same interface the CSR state machine will
615 get screwed up. */
616 if (pSmeCommand->sessionId == pCommand->sessionId)
617 {
618 status = eANI_BOOLEAN_FALSE;
619 goto end;
620 }
621 }
622 }
623 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
624 pEntry, LL_ACCESS_LOCK ) )
625 {
626 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
627 &pCommand->Link, LL_ACCESS_NOLOCK );
628
629 switch (pCommand->command)
630 {
631 case eSmeCommandScan:
632 smsLog(pMac, LOG1,
633 " Processing scan offload command ");
634 csrProcessScanCommand( pMac, pCommand );
635 break;
636 default:
637 smsLog(pMac, LOGE,
638 " Something wrong, wrong command enqueued"
639 " to smeScanCmdPendingList");
640 pEntry = csrLLRemoveHead(
641 &pMac->sme.smeScanCmdActiveList,
642 LL_ACCESS_NOLOCK );
643 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
644 smeReleaseCommand( pMac, pCommand );
645 break;
646 }
647 }
648 }
649 }
650 }
651end:
652 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
653 return status;
654}
Jeff Johnson295189b2012-06-20 16:38:30 -0700655
656tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
657{
658 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
659 eHalStatus status = eHAL_STATUS_SUCCESS;
660 tListElem *pEntry;
661 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530662 tListElem *pSmeEntry;
663 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 eSmeCommandType pmcCommand = eSmeNoCommand;
665
666 // if the ActiveList is empty, then nothing is active so we can process a
667 // pending command...
668 //alwasy lock active list before locking pending list
669 csrLLLock( &pMac->sme.smeCmdActiveList );
670 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
671 {
672 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
673 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530674 /* If scan command is pending in the smeScanCmdActive list
675 * then pick the command from smeCmdPendingList which is
676 * not matching with the scan command session id.
677 * At any point of time only one command will be allowed
678 * on a single session. */
679 if ((pMac->fScanOffload) &&
680 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
681 LL_ACCESS_LOCK)))
682 {
683 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
684 LL_ACCESS_LOCK);
685 if (pSmeEntry)
686 {
687 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
688
689 pEntry = csrGetCmdToProcess(pMac,
690 &pMac->sme.smeCmdPendingList,
691 pSmeCommand->sessionId,
692 LL_ACCESS_LOCK);
693 goto sme_process_cmd;
694 }
695 }
696
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 //Peek the command
698 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530699sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 if( pEntry )
701 {
702 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530703
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 //We cannot execute any command in wait-for-key state until setKey is through.
705 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
706 {
707 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
708 {
709 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800710 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530711 fContinue = eANI_BOOLEAN_FALSE;
712 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 }
714 }
715 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
716 if( eSmeDropCommand == pmcCommand )
717 {
718 //This command is not ok for current PMC state
719 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
720 {
721 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
722 }
723 csrLLUnlock( &pMac->sme.smeCmdActiveList );
724 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530725 fContinue = eANI_BOOLEAN_TRUE;
726 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 }
728 else if( eSmeNoCommand != pmcCommand )
729 {
730 tExitBmpsInfo exitBmpsInfo;
731 void *pv = NULL;
732 tANI_U32 size = 0;
733 tSmeCmd *pPmcCmd = NULL;
734
735 if( eSmeCommandExitBmps == pmcCommand )
736 {
737 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
738 pv = (void *)&exitBmpsInfo;
739 size = sizeof(tExitBmpsInfo);
740 }
741 //pmcCommand has to be one of the exit power save command
742 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
743 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
744 {
745 //Force this command to wake up the chip
746 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
747 csrLLUnlock( &pMac->sme.smeCmdActiveList );
748 fContinue = pmcProcessCommand( pMac, pPmcCmd );
749 if( fContinue )
750 {
751 //The command failed, remove it
752 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
753 {
754 pmcReleaseCommand( pMac, pPmcCmd );
755 }
756 }
757 }
758 else
759 {
760 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800761 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 -0700762 //Let it retry
763 fContinue = eANI_BOOLEAN_TRUE;
764 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530765 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 }
767 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
768 {
769 // we can reuse the pCommand
770
771 // Insert the command onto the ActiveList...
772 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
773
774 // .... and process the command.
775
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -0700776 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
777 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 switch ( pCommand->command )
779 {
780
781 case eSmeCommandScan:
782 csrLLUnlock( &pMac->sme.smeCmdActiveList );
783 status = csrProcessScanCommand( pMac, pCommand );
784 break;
785
786 case eSmeCommandRoam:
787 csrLLUnlock( &pMac->sme.smeCmdActiveList );
788 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800789 if(!HAL_STATUS_SUCCESS(status))
790 {
791 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
792 &pCommand->Link, LL_ACCESS_LOCK ) )
793 {
794 csrReleaseCommandRoam( pMac, pCommand );
795 }
796 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 break;
798
799 case eSmeCommandWmStatusChange:
800 csrLLUnlock( &pMac->sme.smeCmdActiveList );
801 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
802 break;
803
804 case eSmeCommandSetKey:
805 csrLLUnlock( &pMac->sme.smeCmdActiveList );
806 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
807 if(!HAL_STATUS_SUCCESS(status))
808 {
809 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
810 &pCommand->Link, LL_ACCESS_LOCK ) )
811 {
812 csrReleaseCommandSetKey( pMac, pCommand );
813 }
814 }
815 break;
816
817 case eSmeCommandRemoveKey:
818 csrLLUnlock( &pMac->sme.smeCmdActiveList );
819 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
820 if(!HAL_STATUS_SUCCESS(status))
821 {
822 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
823 &pCommand->Link, LL_ACCESS_LOCK ) )
824 {
825 csrReleaseCommandRemoveKey( pMac, pCommand );
826 }
827 }
828 break;
829
830 case eSmeCommandAddStaSession:
831 csrLLUnlock( &pMac->sme.smeCmdActiveList );
832 csrProcessAddStaSessionCommand( pMac, pCommand );
833 break;
834 case eSmeCommandDelStaSession:
835 csrLLUnlock( &pMac->sme.smeCmdActiveList );
836 csrProcessDelStaSessionCommand( pMac, pCommand );
837 break;
838
Jeff Johnsone7245742012-09-05 17:12:55 -0700839#ifdef FEATURE_OEM_DATA_SUPPORT
840 case eSmeCommandOemDataReq:
841 csrLLUnlock(&pMac->sme.smeCmdActiveList);
842 oemData_ProcessOemDataReqCommand(pMac, pCommand);
843 break;
844#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSmeCommandRemainOnChannel:
846 csrLLUnlock(&pMac->sme.smeCmdActiveList);
847 p2pProcessRemainOnChannelCmd(pMac, pCommand);
848 break;
849 case eSmeCommandNoAUpdate:
850 csrLLUnlock( &pMac->sme.smeCmdActiveList );
851 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 case eSmeCommandEnterImps:
853 case eSmeCommandExitImps:
854 case eSmeCommandEnterBmps:
855 case eSmeCommandExitBmps:
856 case eSmeCommandEnterUapsd:
857 case eSmeCommandExitUapsd:
858 case eSmeCommandEnterWowl:
859 case eSmeCommandExitWowl:
860 csrLLUnlock( &pMac->sme.smeCmdActiveList );
861 fContinue = pmcProcessCommand( pMac, pCommand );
862 if( fContinue )
863 {
864 //The command failed, remove it
865 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
866 &pCommand->Link, LL_ACCESS_LOCK ) )
867 {
868 pmcReleaseCommand( pMac, pCommand );
869 }
870 }
871 break;
872
873 //Treat standby differently here because caller may not be able to handle
874 //the failure so we do our best here
875 case eSmeCommandEnterStandby:
876 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
877 {
878 //It can continue
879 csrLLUnlock( &pMac->sme.smeCmdActiveList );
880 fContinue = pmcProcessCommand( pMac, pCommand );
881 if( fContinue )
882 {
883 //The command failed, remove it
884 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
885 &pCommand->Link, LL_ACCESS_LOCK ) )
886 {
887 pmcReleaseCommand( pMac, pCommand );
888 }
889 }
890 }
891 else
892 {
893 //Need to issue a disconnect first before processing this command
894 tSmeCmd *pNewCmd;
895
896 //We need to re-run the command
897 fContinue = eANI_BOOLEAN_TRUE;
898 //Pull off the standby command first
899 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
900 &pCommand->Link, LL_ACCESS_NOLOCK ) )
901 {
902 csrLLUnlock( &pMac->sme.smeCmdActiveList );
903 //Need to call CSR function here because the disconnect command
904 //is handled by CSR
905 pNewCmd = csrGetCommandBuffer( pMac );
906 if( NULL != pNewCmd )
907 {
908 //Put the standby command to the head of the pending list first
909 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
910 LL_ACCESS_LOCK );
911 pNewCmd->command = eSmeCommandRoam;
912 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
913 //Put the disassoc command before the standby command
914 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
915 LL_ACCESS_LOCK );
916 }
917 else
918 {
919 //Continue the command here
920 fContinue = pmcProcessCommand( pMac, pCommand );
921 if( fContinue )
922 {
923 //The command failed, remove it
924 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
925 &pCommand->Link, LL_ACCESS_LOCK ) )
926 {
927 pmcReleaseCommand( pMac, pCommand );
928 }
929 }
930 }
931 }
932 else
933 {
934 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800935 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 VOS_ASSERT(0);
937 }
938 }
939 break;
940
941 case eSmeCommandAddTs:
942 case eSmeCommandDelTs:
943 csrLLUnlock( &pMac->sme.smeCmdActiveList );
944#ifndef WLAN_MDM_CODE_REDUCTION_OPT
945 fContinue = qosProcessCommand( pMac, pCommand );
946 if( fContinue )
947 {
948 //The command failed, remove it
949 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
950 &pCommand->Link, LL_ACCESS_NOLOCK ) )
951 {
952//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
953 qosReleaseCommand( pMac, pCommand );
954//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
955 }
956 }
957#endif
958 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800959#ifdef FEATURE_WLAN_TDLS
960 case eSmeCommandTdlsSendMgmt:
961 case eSmeCommandTdlsAddPeer:
962 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530963 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800964#ifdef FEATURE_WLAN_TDLS_INTERNAL
965 case eSmeCommandTdlsDiscovery:
966 case eSmeCommandTdlsLinkSetup:
967 case eSmeCommandTdlsLinkTear:
968 case eSmeCommandTdlsEnterUapsd:
969 case eSmeCommandTdlsExitUapsd:
970#endif
971 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800972 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800973 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800974
975 csrLLUnlock( &pMac->sme.smeCmdActiveList );
976 status = csrTdlsProcessCmd( pMac, pCommand );
977 }
978 break ;
979#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700980
981 default:
982 //something is wrong
983 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800984 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
986 csrLLUnlock( &pMac->sme.smeCmdActiveList );
987 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
988 smeReleaseCommand( pMac, pCommand );
989 status = eHAL_STATUS_FAILURE;
990 break;
991 }
992 if(!HAL_STATUS_SUCCESS(status))
993 {
994 fContinue = eANI_BOOLEAN_TRUE;
995 }
996 }//if(pEntry)
997 else
998 {
999 //This is odd. Some one else pull off the command.
1000 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1001 }
1002 }
1003 else
1004 {
1005 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1006 }
1007 }
1008 else
1009 {
1010 //No command waiting
1011 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1012 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1013 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1014 {
1015 tANI_U32 nTime = 0;
1016
1017 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1018 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1019 {
1020 csrScanStartIdleScanTimer(pMac, nTime);
1021 }
1022 }
1023 }
1024 }
1025 else {
1026 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1027 }
1028
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301029sme_process_scan_queue:
1030 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1031 fContinue = eANI_BOOLEAN_FALSE;
1032
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 return ( fContinue );
1034}
1035
1036void smeProcessPendingQueue( tpAniSirGlobal pMac )
1037{
1038 while( smeProcessCommand( pMac ) );
1039}
1040
1041
1042tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1043{
1044 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1045 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1046}
1047
1048
1049
1050//Global APIs
1051
1052/*--------------------------------------------------------------------------
1053
1054 \brief sme_Open() - Initialze all SME modules and put them at idle state
1055
1056 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1057 successfully return, all modules are at idle state ready to start.
1058
1059 smeOpen must be called before any other SME APIs can be involved.
1060 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001061 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 \param hHal - The handle returned by macOpen.
1063
1064 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1065
1066 Other status means SME is failed to be initialized
1067 \sa
1068
1069 --------------------------------------------------------------------------*/
1070eHalStatus sme_Open(tHalHandle hHal)
1071{
1072 eHalStatus status = eHAL_STATUS_FAILURE;
1073 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1074
1075 do {
1076 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001077 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1079 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001080 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 status = eHAL_STATUS_FAILURE;
1082 break;
1083 }
1084
1085 status = ccmOpen(hHal);
1086 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1087 smsLog( pMac, LOGE,
1088 "ccmOpen failed during initialization with status=%d", status );
1089 break;
1090 }
1091
1092 status = csrOpen(pMac);
1093 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1094 smsLog( pMac, LOGE,
1095 "csrOpen failed during initialization with status=%d", status );
1096 break;
1097 }
1098
1099 status = pmcOpen(hHal);
1100 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1101 smsLog( pMac, LOGE,
1102 "pmcOpen failed during initialization with status=%d", status );
1103 break;
1104 }
1105
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001106#ifdef FEATURE_WLAN_TDLS
1107 pMac->isTdlsPowerSaveProhibited = 0;
1108#endif
1109
Jeff Johnson295189b2012-06-20 16:38:30 -07001110#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1111 status = sme_QosOpen(pMac);
1112 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1113 smsLog( pMac, LOGE,
1114 "Qos open failed during initialization with status=%d", status );
1115 break;
1116 }
1117
1118 status = btcOpen(pMac);
1119 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1120 smsLog( pMac, LOGE,
1121 "btcOpen open failed during initialization with status=%d", status );
1122 break;
1123 }
1124#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001125#ifdef FEATURE_OEM_DATA_SUPPORT
1126 status = oemData_OemDataReqOpen(pMac);
1127 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1128 smsLog(pMac, LOGE,
1129 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1130 break;
1131 }
1132#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001133
1134 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1135 break;
1136
Jeff Johnson295189b2012-06-20 16:38:30 -07001137 {
1138 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1139 if ( NULL == pvosGCtx ){
1140 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1141 status = eHAL_STATUS_FAILURE;
1142 break;
1143 }
1144
1145 status = WLANSAP_Open( pvosGCtx );
1146 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1147 smsLog( pMac, LOGE,
1148 "WLANSAP_Open open failed during initialization with status=%d", status );
1149 break;
1150 }
1151 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001152#if defined WLAN_FEATURE_VOWIFI
1153 status = rrmOpen(pMac);
1154 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1155 smsLog( pMac, LOGE,
1156 "rrmOpen open failed during initialization with status=%d", status );
1157 break;
1158 }
1159#endif
1160
1161#if defined WLAN_FEATURE_VOWIFI_11R
1162 sme_FTOpen(pMac);
1163#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07001165 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001166
1167 }while (0);
1168
1169 return status;
1170}
1171
Jeff Johnson295189b2012-06-20 16:38:30 -07001172/*--------------------------------------------------------------------------
1173
1174 \brief sme_set11dinfo() - Set the 11d information about valid channels
1175 and there power using information from nvRAM
1176 This function is called only for AP.
1177
Srinivas Girigowdade697412013-02-14 16:31:48 -08001178 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001179
1180 \param hHal - The handle returned by macOpen.
1181 \Param pSmeConfigParams - a pointer to a caller allocated object of
1182 typedef struct _smeConfigParams.
1183
1184 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1185
1186 Other status means SME is failed to update the config parameters.
1187 \sa
1188--------------------------------------------------------------------------*/
1189
1190eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1191{
1192 eHalStatus status = eHAL_STATUS_FAILURE;
1193 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1194
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07001195 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
1196 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 if (NULL == pSmeConfigParams ) {
1198 smsLog( pMac, LOGE,
1199 "Empty config param structure for SME, nothing to update");
1200 return status;
1201 }
1202
1203 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1204 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001205 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 status );
1207 }
1208 return status;
1209}
1210
1211/*--------------------------------------------------------------------------
1212
1213 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1214
Srinivas Girigowdade697412013-02-14 16:31:48 -08001215 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001216
1217 \param hHal - The handle returned by HostapdAdapter.
1218 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1219
1220 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1221
1222 Other status means, failed to get the current regulatory domain.
1223 \sa
1224--------------------------------------------------------------------------*/
1225
1226eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1227{
1228 eHalStatus status = eHAL_STATUS_FAILURE;
1229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1230
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07001231 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
1232 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 if (NULL == domainIdSoftAp ) {
1234 smsLog( pMac, LOGE, "Uninitialized domain Id");
1235 return status;
1236 }
1237
1238 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1239 status = eHAL_STATUS_SUCCESS;
1240
1241 return status;
1242}
1243
1244
1245eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1246{
1247 eHalStatus status = eHAL_STATUS_FAILURE;
1248 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1249
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07001250 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
1251 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 if (NULL == apCntryCode ) {
1253 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1254 return status;
1255 }
1256
1257 status = csrSetRegInfo(hHal, apCntryCode );
1258 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001259 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 status );
1261 }
1262 return status;
1263}
1264
Jeff Johnson295189b2012-06-20 16:38:30 -07001265#ifdef FEATURE_WLAN_SCAN_PNO
1266/*--------------------------------------------------------------------------
1267
1268 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1269
1270 It is used at driver start up to inform RIVA of the default channel
1271 configuration.
1272
Srinivas Girigowdade697412013-02-14 16:31:48 -08001273 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001274
1275 \param hHal - The handle returned by macOpen.
1276
1277 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1278
1279 Other status means SME is failed to update the channel config.
1280 \sa
1281
1282 --------------------------------------------------------------------------*/
1283eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1284{
1285 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1286
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07001287 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
1288 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1289 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 &pMac->scan.base20MHzChannels, FALSE);
1291 return eHAL_STATUS_SUCCESS;
1292}
1293#endif // FEATURE_WLAN_SCAN_PNLO
1294
1295/*--------------------------------------------------------------------------
1296
1297 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1298
1299 The function updates some configuration for modules in SME, CCM, CSR, etc
1300 during SMEs close open sequence.
1301
1302 Modules inside SME apply the new configuration at the next transaction.
1303
Srinivas Girigowdade697412013-02-14 16:31:48 -08001304 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001305
1306 \param hHal - The handle returned by macOpen.
1307 \Param pSmeConfigParams - a pointer to a caller allocated object of
1308 typedef struct _smeConfigParams.
1309
1310 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1311
1312 Other status means SME is failed to update the config parameters.
1313 \sa
1314
1315 --------------------------------------------------------------------------*/
1316eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1317{
1318 eHalStatus status = eHAL_STATUS_FAILURE;
1319 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1320
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07001321 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
1322 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 if (NULL == pSmeConfigParams ) {
1324 smsLog( pMac, LOGE,
1325 "Empty config param structure for SME, nothing to update");
1326 return status;
1327 }
1328
1329 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1330
1331 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001332 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 status );
1334 }
1335#if defined WLAN_FEATURE_P2P_INTERNAL
1336 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1337
1338 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001339 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 status );
1341 }
1342#endif
1343#if defined WLAN_FEATURE_VOWIFI
1344 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1345
1346 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001347 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 status );
1349 }
1350#endif
1351 //For SOC, CFG is set before start
1352 //We don't want to apply global CFG in connect state because that may cause some side affect
1353 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 csrIsAllSessionDisconnected( pMac) )
1355 {
1356 csrSetGlobalCfgs(pMac);
1357 }
1358
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301359 /* update the directed scan offload setting */
1360 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1361
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301362 if (pMac->fScanOffload)
1363 {
1364 /* If scan offload is enabled then lim has allow the sending of
1365 scan request to firmware even in powersave mode. The firmware has
1366 to take care of exiting from power save mode */
1367 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1368 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1369
1370 if (eHAL_STATUS_SUCCESS != status)
1371 {
1372 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1373 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1374 }
1375 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 return status;
1377}
1378
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301379#ifdef WLAN_FEATURE_GTK_OFFLOAD
1380void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1381 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1382{
1383 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1384
1385 if (NULL == pMac)
1386 {
1387 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1388 "%s: pMac is null", __func__);
1389 return ;
1390 }
1391 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1392 {
1393 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1394 "%s: HDD callback is null", __func__);
1395 return ;
1396 }
1397 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1398 pGtkOffloadGetInfoRsp);
1399}
1400#endif
1401
Jeff Johnson295189b2012-06-20 16:38:30 -07001402/* ---------------------------------------------------------------------------
1403 \fn sme_ChangeConfigParams
1404 \brief The SME API exposed for HDD to provide config params to SME during
1405 SMEs stop -> start sequence.
1406
1407 If HDD changed the domain that will cause a reset. This function will
1408 provide the new set of 11d information for the new domain. Currrently this
1409 API provides info regarding 11d only at reset but we can extend this for
1410 other params (PMC, QoS) which needs to be initialized again at reset.
1411
Srinivas Girigowdade697412013-02-14 16:31:48 -08001412 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001413
1414 \param hHal - The handle returned by macOpen.
1415
1416 \Param
1417 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1418 currently provides 11d related information like Country code,
1419 Regulatory domain, valid channel list, Tx power per channel, a
1420 list with active/passive scan allowed per valid channel.
1421
1422 \return eHalStatus
1423 ---------------------------------------------------------------------------*/
1424eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1425 tCsrUpdateConfigParam *pUpdateConfigParam)
1426{
1427 eHalStatus status = eHAL_STATUS_FAILURE;
1428 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1429
1430 if (NULL == pUpdateConfigParam ) {
1431 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001432 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 return status;
1434 }
1435
1436 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1437
1438 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001439 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 status );
1441 }
1442
1443 return status;
1444
1445}
1446
1447/*--------------------------------------------------------------------------
1448
1449 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1450 that the NIC is ready tio run.
1451
1452 The function is called by HDD at the end of initialization stage so PE/HAL can
1453 enable the NIC to running state.
1454
Srinivas Girigowdade697412013-02-14 16:31:48 -08001455 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 \param hHal - The handle returned by macOpen.
1457
1458 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1459 successfully.
1460
1461 Other status means SME failed to send the message to PE.
1462 \sa
1463
1464 --------------------------------------------------------------------------*/
1465eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1466{
1467 tSirSmeReadyReq Msg;
1468 eHalStatus status = eHAL_STATUS_FAILURE;
1469 tPmcPowerState powerState;
1470 tPmcSwitchState hwWlanSwitchState;
1471 tPmcSwitchState swWlanSwitchState;
1472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1473
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07001474 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
1475 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 do
1477 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001478
1479 Msg.messageType = eWNI_SME_SYS_READY_IND;
1480 Msg.length = sizeof( tSirSmeReadyReq );
1481
1482 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1483 {
1484 status = eHAL_STATUS_SUCCESS;
1485 }
1486 else
1487 {
1488 smsLog( pMac, LOGE,
1489 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1490 break;
1491 }
1492
1493 status = pmcQueryPowerState( hHal, &powerState,
1494 &hwWlanSwitchState, &swWlanSwitchState );
1495 if ( ! HAL_STATUS_SUCCESS( status ) )
1496 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001497 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 status );
1499 break;
1500 }
1501
1502 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1503 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1504 {
1505 status = csrReady(pMac);
1506 if ( ! HAL_STATUS_SUCCESS( status ) )
1507 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001508 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001509 break;
1510 }
1511 status = pmcReady(hHal);
1512 if ( ! HAL_STATUS_SUCCESS( status ) )
1513 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001514 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 break;
1516 }
1517#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1518 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1519 {
1520 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001521 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 break;
1523 }
1524#endif
1525
1526#if defined WLAN_FEATURE_VOWIFI
1527 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1528 {
1529 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001530 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001531 break;
1532 }
1533#endif
1534 }
1535 pMac->sme.state = SME_STATE_READY;
1536 } while( 0 );
1537
1538 return status;
1539}
1540
1541/*--------------------------------------------------------------------------
1542
1543 \brief sme_Start() - Put all SME modules at ready state.
1544
1545 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1546 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001547 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 \param hHal - The handle returned by macOpen.
1549
1550 \return eHAL_STATUS_SUCCESS - SME is ready.
1551
1552 Other status means SME is failed to start
1553 \sa
1554
1555 --------------------------------------------------------------------------*/
1556eHalStatus sme_Start(tHalHandle hHal)
1557{
1558 eHalStatus status = eHAL_STATUS_FAILURE;
1559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1560
1561 do
1562 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 status = csrStart(pMac);
1564 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001565 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 status );
1567 break;
1568 }
1569
1570 status = pmcStart(hHal);
1571 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001572 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 status );
1574 break;
1575 }
1576
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1578 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001579 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 status );
1581 break;
1582 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 pMac->sme.state = SME_STATE_START;
1584 }while (0);
1585
1586 return status;
1587}
1588
1589
1590#ifdef WLAN_FEATURE_PACKET_FILTERING
1591/******************************************************************************
1592*
1593* Name: sme_PCFilterMatchCountResponseHandler
1594*
1595* Description:
1596* Invoke Packet Coalescing Filter Match Count callback routine
1597*
1598* Parameters:
1599* hHal - HAL handle for device
1600* pMsg - Pointer to tRcvFltPktMatchRsp structure
1601*
1602* Returns: eHalStatus
1603*
1604******************************************************************************/
1605eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1606{
1607 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1608 eHalStatus status = eHAL_STATUS_SUCCESS;
1609 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1610
1611 if (NULL == pMsg)
1612 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001613 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 status = eHAL_STATUS_FAILURE;
1615 }
1616 else
1617 {
1618 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001619 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001620
1621 /* Call Packet Coalescing Filter Match Count callback routine. */
1622 if (pMac->pmc.FilterMatchCountCB != NULL)
1623 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1624 pRcvFltPktMatchRsp);
1625
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001626 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 pRcvFltPktMatchRsp->status);
1628
1629 pMac->pmc.FilterMatchCountCB = NULL;
1630 pMac->pmc.FilterMatchCountCBContext = NULL;
1631 }
1632
1633 return(status);
1634}
1635#endif // WLAN_FEATURE_PACKET_FILTERING
1636
1637
Chet Lanctot186b5732013-03-18 10:26:30 -07001638#ifdef WLAN_FEATURE_11W
1639/*------------------------------------------------------------------
1640 *
1641 * Handle the unprotected management frame indication from LIM and
1642 * forward it to HDD.
1643 *
1644 *------------------------------------------------------------------*/
1645
1646eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1647 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1648{
1649 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1650 eHalStatus status = eHAL_STATUS_SUCCESS;
1651 tCsrRoamInfo pRoamInfo = {0};
1652 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1653
1654 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1655 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1656 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1657
1658 /* forward the mgmt frame to HDD */
1659 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1660
1661 return status;
1662}
1663#endif
1664
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001665#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
1666/*------------------------------------------------------------------
1667 *
1668 * Handle the tsm ie indication from LIM and forward it to HDD.
1669 *
1670 *------------------------------------------------------------------*/
1671
1672eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1673{
1674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1675 eHalStatus status = eHAL_STATUS_SUCCESS;
1676 tCsrRoamInfo pRoamInfo = {0};
1677 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1678
1679 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1680 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1681 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1682
1683 /* forward the tsm ie information to HDD */
1684 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1685
1686 return status;
1687}
1688
1689/* ---------------------------------------------------------------------------
1690 \fn sme_SetCCKMIe
1691 \brief function to store the CCKM IE passed from supplicant and use it while packing
1692 reassociation request
1693 \param hHal - HAL handle for device
1694 \param pCckmIe - pointer to CCKM IE data
1695 \param pCckmIeLen - length of the CCKM IE
1696 \- return Success or failure
1697 -------------------------------------------------------------------------*/
1698eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1699 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1700{
1701 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1702 eHalStatus status = eHAL_STATUS_SUCCESS;
1703
1704 status = sme_AcquireGlobalLock( &pMac->sme );
1705 if ( HAL_STATUS_SUCCESS( status ) )
1706 {
1707 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1708 sme_ReleaseGlobalLock( &pMac->sme );
1709 }
1710 return status;
1711}
1712
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001713/* ---------------------------------------------------------------------------
1714 \fn sme_SetCcxBeaconRequest
1715 \brief function to set CCX beacon request parameters
1716 \param hHal - HAL handle for device
1717 \param sessionId - Session id
1718 \param pCcxBcnReq - pointer to CCX beacon request
1719 \- return Success or failure
1720 -------------------------------------------------------------------------*/
1721eHalStatus sme_SetCcxBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1722 const tCsrCcxBeaconReq* pCcxBcnReq)
1723{
1724 eHalStatus status = eSIR_SUCCESS;
1725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1726 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
1727 tCsrCcxBeaconReqParams *pBeaconReq = NULL;
1728 tANI_U8 counter = 0;
1729 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1730 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1731
1732 /* Store the info in RRM context */
1733 vos_mem_copy(&pSmeRrmContext->ccxBcnReqInfo, pCcxBcnReq, sizeof(tCsrCcxBeaconReq));
1734
1735 //Prepare the request to send to SME.
1736 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1737 if(NULL == pSmeBcnReportReq)
1738 {
1739 smsLog(pMac, LOGP, "Memory Allocation Failure!!! CCX BcnReq Ind to SME");
1740 return eSIR_FAILURE;
1741 }
1742
1743 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1744 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1745
1746 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1747 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1748 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1749 pSmeBcnReportReq->channelInfo.channelNum = 255;
1750 pSmeBcnReportReq->channelList.numChannels = pCcxBcnReq->numBcnReqIe;
1751
1752 for (counter = 0; counter < pCcxBcnReq->numBcnReqIe; counter++)
1753 {
1754 pBeaconReq = (tCsrCcxBeaconReqParams *)&pCcxBcnReq->bcnReq[counter];
1755 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1756 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1757 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1758 }
1759
1760 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1761 return status;
1762}
1763
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001764#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
1765
Chet Lanctot186b5732013-03-18 10:26:30 -07001766
Jeff Johnson295189b2012-06-20 16:38:30 -07001767/*--------------------------------------------------------------------------
1768
1769 \brief sme_ProcessMsg() - The main message processor for SME.
1770
1771 The function is called by a message dispatcher when to process a message
1772 targeted for SME.
1773
Srinivas Girigowdade697412013-02-14 16:31:48 -08001774 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 \param hHal - The handle returned by macOpen.
1776 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1777
1778 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1779
1780 Other status means SME failed to process the message to HAL.
1781 \sa
1782
1783 --------------------------------------------------------------------------*/
1784eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1785{
1786 eHalStatus status = eHAL_STATUS_FAILURE;
1787 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1788
1789 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001790 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001791 return status;
1792 }
1793
1794 status = sme_AcquireGlobalLock( &pMac->sme );
1795 if ( HAL_STATUS_SUCCESS( status ) )
1796 {
1797 if( SME_IS_START(pMac) )
1798 {
1799 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1800 case eWNI_PMC_ENTER_BMPS_RSP:
1801 case eWNI_PMC_EXIT_BMPS_RSP:
1802 case eWNI_PMC_EXIT_BMPS_IND:
1803 case eWNI_PMC_ENTER_IMPS_RSP:
1804 case eWNI_PMC_EXIT_IMPS_RSP:
1805 case eWNI_PMC_SMPS_STATE_IND:
1806 case eWNI_PMC_ENTER_UAPSD_RSP:
1807 case eWNI_PMC_EXIT_UAPSD_RSP:
1808 case eWNI_PMC_ENTER_WOWL_RSP:
1809 case eWNI_PMC_EXIT_WOWL_RSP:
1810 //PMC
1811 if (pMsg->bodyptr)
1812 {
1813 pmcMessageProcessor(hHal, pMsg->bodyptr);
1814 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301815 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001816 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001817 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 }
1819 break;
1820
1821 case WNI_CFG_SET_CNF:
1822 case WNI_CFG_DNLD_CNF:
1823 case WNI_CFG_GET_RSP:
1824 case WNI_CFG_ADD_GRP_ADDR_CNF:
1825 case WNI_CFG_DEL_GRP_ADDR_CNF:
1826 //CCM
1827 if (pMsg->bodyptr)
1828 {
1829 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1830 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301831 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001833 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 }
1835 break;
1836
1837 case eWNI_SME_ADDTS_RSP:
1838 case eWNI_SME_DELTS_RSP:
1839 case eWNI_SME_DELTS_IND:
1840#ifdef WLAN_FEATURE_VOWIFI_11R
1841 case eWNI_SME_FT_AGGR_QOS_RSP:
1842#endif
1843 //QoS
1844 if (pMsg->bodyptr)
1845 {
1846#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1847 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301848 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001849#endif
1850 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001851 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 }
1853 break;
1854#if defined WLAN_FEATURE_VOWIFI
1855 case eWNI_SME_NEIGHBOR_REPORT_IND:
1856 case eWNI_SME_BEACON_REPORT_REQ_IND:
1857#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001858 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001859#endif
1860 if ( pMsg->bodyptr )
1861 {
1862 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301863 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001864 }
1865 else
1866 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001867 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 }
1869 break;
1870#endif
1871
Jeff Johnsone7245742012-09-05 17:12:55 -07001872#ifdef FEATURE_OEM_DATA_SUPPORT
1873 //Handle the eWNI_SME_OEM_DATA_RSP:
1874 case eWNI_SME_OEM_DATA_RSP:
1875 if(pMsg->bodyptr)
1876 {
1877 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1878 vos_mem_free(pMsg->bodyptr);
1879 }
1880 else
1881 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001882 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001883 }
1884 smeProcessPendingQueue( pMac );
1885 break;
1886#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001887
1888 case eWNI_SME_ADD_STA_SELF_RSP:
1889 if(pMsg->bodyptr)
1890 {
1891 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1892 vos_mem_free(pMsg->bodyptr);
1893 }
1894 else
1895 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001896 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 }
1898 break;
1899 case eWNI_SME_DEL_STA_SELF_RSP:
1900 if(pMsg->bodyptr)
1901 {
1902 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1903 vos_mem_free(pMsg->bodyptr);
1904 }
1905 else
1906 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001907 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001908 }
1909 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001910 case eWNI_SME_REMAIN_ON_CHN_RSP:
1911 if(pMsg->bodyptr)
1912 {
1913 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1914 vos_mem_free(pMsg->bodyptr);
1915 }
1916 else
1917 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001918 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 }
1920 break;
1921 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1922 if(pMsg->bodyptr)
1923 {
1924 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1925 vos_mem_free(pMsg->bodyptr);
1926 }
1927 else
1928 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001929 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 -07001930 }
1931 break;
1932 case eWNI_SME_MGMT_FRM_IND:
1933 if(pMsg->bodyptr)
1934 {
1935 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1936 vos_mem_free(pMsg->bodyptr);
1937 }
1938 else
1939 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001940 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 }
1942 break;
1943 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1944 if(pMsg->bodyptr)
1945 {
1946 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1947 vos_mem_free(pMsg->bodyptr);
1948 }
1949 else
1950 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001951 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 }
1953 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 case eWNI_SME_COEX_IND:
1955 if(pMsg->bodyptr)
1956 {
1957 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1958 vos_mem_free(pMsg->bodyptr);
1959 }
1960 else
1961 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001962 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 }
1964 break;
1965
1966#ifdef FEATURE_WLAN_SCAN_PNO
1967 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1968 if(pMsg->bodyptr)
1969 {
1970 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1971 vos_mem_free(pMsg->bodyptr);
1972 }
1973 else
1974 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001975 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 }
1977 break;
1978#endif // FEATURE_WLAN_SCAN_PNO
1979
1980 case eWNI_SME_TX_PER_HIT_IND:
1981 if (pMac->sme.pTxPerHitCallback)
1982 {
1983 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1984 }
1985 break;
1986
1987 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07001988 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07001989 {
1990 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1991 vos_mem_free(pMsg->bodyptr);
1992 }
1993 else
1994 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07001995 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
1996 }
1997 break;
1998
1999 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2000 if (pMsg->bodyptr)
2001 {
2002 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2003 vos_mem_free(pMsg->bodyptr);
2004 }
2005 else
2006 {
2007 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 }
2009 break;
2010
2011#ifdef WLAN_FEATURE_PACKET_FILTERING
2012 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2013 if(pMsg->bodyptr)
2014 {
2015 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2016 vos_mem_free(pMsg->bodyptr);
2017 }
2018 else
2019 {
2020 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002021 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 }
2023 break;
2024#endif // WLAN_FEATURE_PACKET_FILTERING
2025 case eWNI_SME_PRE_SWITCH_CHL_IND:
2026 {
2027 status = sme_HandlePreChannelSwitchInd(pMac);
2028 break;
2029 }
2030
2031 case eWNI_SME_POST_SWITCH_CHL_IND:
2032 {
2033 status = sme_HandlePostChannelSwitchInd(pMac);
2034 break;
2035 }
2036
2037#ifdef WLAN_WAKEUP_EVENTS
2038 case eWNI_SME_WAKE_REASON_IND:
2039 if(pMsg->bodyptr)
2040 {
2041 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2042 vos_mem_free(pMsg->bodyptr);
2043 }
2044 else
2045 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002046 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 }
2048 break;
2049#endif // WLAN_WAKEUP_EVENTS
2050
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002051#ifdef FEATURE_WLAN_TDLS
2052 /*
2053 * command rescived from PE, SME tdls msg processor shall be called
2054 * to process commands recieved from PE
2055 */
2056 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2057 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002058 case eWNI_SME_TDLS_DEL_STA_RSP:
2059 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002060 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002061 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302062 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002063#ifdef FEATURE_WLAN_TDLS_INTERNAL
2064 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2065 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2066 case eWNI_SME_TDLS_LINK_START_RSP:
2067 case eWNI_SME_TDLS_LINK_START_IND:
2068 case eWNI_SME_TDLS_TEARDOWN_RSP:
2069 case eWNI_SME_TDLS_TEARDOWN_IND:
2070 case eWNI_SME_ADD_TDLS_PEER_IND:
2071 case eWNI_SME_DELETE_TDLS_PEER_IND:
2072#endif
2073 {
2074 if (pMsg->bodyptr)
2075 {
2076 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302077 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002078 }
2079 else
2080 {
2081 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002082 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002083 }
2084 break;
2085 }
2086#endif
2087
Chet Lanctot186b5732013-03-18 10:26:30 -07002088#ifdef WLAN_FEATURE_11W
2089 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2090 if (pMsg->bodyptr)
2091 {
2092 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2093 vos_mem_free(pMsg->bodyptr);
2094 }
2095 else
2096 {
2097 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2098 }
2099 break;
2100#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002101#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
2102 case eWNI_SME_TSM_IE_IND:
2103 {
2104 if (pMsg->bodyptr)
2105 {
2106 sme_TsmIeInd(pMac, pMsg->bodyptr);
2107 vos_mem_free(pMsg->bodyptr);
2108 }
2109 else
2110 {
2111 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2112 }
2113 break;
2114 }
2115#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002116#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2117 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2118 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2119 break;
2120#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002121
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302122#ifdef WLAN_FEATURE_GTK_OFFLOAD
2123 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2124 if (pMsg->bodyptr)
2125 {
2126 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2127 vos_mem_free(pMsg->bodyptr);
2128 }
2129 else
2130 {
2131 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2132 }
2133 break ;
2134#endif
Leo Chang9056f462013-08-01 19:21:11 -07002135
2136#ifdef FEATURE_WLAN_LPHB
2137 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002138 case eWNI_SME_LPHB_IND:
2139 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002140 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002141 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002142 }
2143 vos_mem_free(pMsg->bodyptr);
2144
2145 break;
2146#endif /* FEATURE_WLAN_LPHB */
2147
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 default:
2149
2150 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2151 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2152 {
2153 //CSR
2154 if (pMsg->bodyptr)
2155 {
2156 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302157 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 }
2159 else
2160 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002161 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 }
2163 }
2164 else
2165 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002166 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 pMsg->type);
2168 if (pMsg->bodyptr)
2169 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302170 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 }
2172 }
2173 }//switch
2174 } //SME_IS_START
2175 else
2176 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002177 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 if (pMsg->bodyptr)
2179 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302180 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 }
2182 }
2183 sme_ReleaseGlobalLock( &pMac->sme );
2184 }
2185 else
2186 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002187 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 if (pMsg->bodyptr)
2189 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302190 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 }
2192 }
2193
2194 return status;
2195}
2196
2197
2198//No need to hold the global lock here because this function can only be called
2199//after sme_Stop.
2200v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2201{
2202 if( pMsg )
2203 {
2204 if (pMsg->bodyptr)
2205 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302206 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 }
2208 }
2209
2210}
2211
2212
2213/*--------------------------------------------------------------------------
2214
2215 \brief sme_Stop() - Stop all SME modules and put them at idle state
2216
2217 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2218 return, all modules are at idle state ready to start.
2219
Srinivas Girigowdade697412013-02-14 16:31:48 -08002220 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 \param hHal - The handle returned by macOpen
2222
2223 \return eHAL_STATUS_SUCCESS - SME is stopped.
2224
2225 Other status means SME is failed to stop but caller should still
2226 consider SME is stopped.
2227 \sa
2228
2229 --------------------------------------------------------------------------*/
2230eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
2231{
2232 eHalStatus status = eHAL_STATUS_FAILURE;
2233 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2234 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2235
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2237 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002238 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 status );
2240 fail_status = status;
2241 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002242
2243 p2pStop(hHal);
2244
2245 if(pmcFlag)
2246 {
2247 status = pmcStop(hHal);
2248 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002249 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 status );
2251 fail_status = status;
2252 }
2253 }
2254
2255 status = csrStop(pMac);
2256 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002257 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 status );
2259 fail_status = status;
2260 }
2261
2262 ccmStop(hHal);
2263
2264 purgeSmeCmdList(pMac);
2265
2266 if (!HAL_STATUS_SUCCESS( fail_status )) {
2267 status = fail_status;
2268 }
2269
2270 pMac->sme.state = SME_STATE_STOP;
2271
2272 return status;
2273}
2274
2275/*--------------------------------------------------------------------------
2276
2277 \brief sme_Close() - Release all SME modules and their resources.
2278
2279 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2280 return, all modules are at closed state.
2281
2282 No SME APIs can be involved after smeClose except smeOpen.
2283 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002284 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 \param hHal - The handle returned by macOpen
2286
2287 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2288
2289 Other status means SME is failed to be closed but caller still cannot
2290 call any other SME functions except smeOpen.
2291 \sa
2292
2293 --------------------------------------------------------------------------*/
2294eHalStatus sme_Close(tHalHandle hHal)
2295{
2296 eHalStatus status = eHAL_STATUS_FAILURE;
2297 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2298 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2299
2300 status = csrClose(pMac);
2301 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002302 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 status );
2304 fail_status = status;
2305 }
2306
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2308 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002309 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 status );
2311 fail_status = status;
2312 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002313
2314#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2315 status = btcClose(hHal);
2316 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002317 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 status );
2319 fail_status = status;
2320 }
2321
2322 status = sme_QosClose(pMac);
2323 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002324 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 status );
2326 fail_status = status;
2327 }
2328#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002329#ifdef FEATURE_OEM_DATA_SUPPORT
2330 status = oemData_OemDataReqClose(hHal);
2331 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002332 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002333 status );
2334 fail_status = status;
2335 }
2336#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002337
2338 status = ccmClose(hHal);
2339 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002340 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 status );
2342 fail_status = status;
2343 }
2344
2345 status = pmcClose(hHal);
2346 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002347 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 status );
2349 fail_status = status;
2350 }
2351#if defined WLAN_FEATURE_VOWIFI
2352 status = rrmClose(hHal);
2353 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002354 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 status );
2356 fail_status = status;
2357 }
2358#endif
2359
2360#if defined WLAN_FEATURE_VOWIFI_11R
2361 sme_FTClose(hHal);
2362#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
2365 freeSmeCmdList(pMac);
2366
2367 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2368 {
2369 fail_status = eHAL_STATUS_FAILURE;
2370 }
2371
2372 if (!HAL_STATUS_SUCCESS( fail_status )) {
2373 status = fail_status;
2374 }
2375
2376 pMac->sme.state = SME_STATE_STOP;
2377
2378 return status;
2379}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002380#ifdef FEATURE_WLAN_LFR
2381tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2382{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002383#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002384 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2385 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2386 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2387 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2388 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2389 return eANI_BOOLEAN_FALSE;
2390 default:
2391 return eANI_BOOLEAN_TRUE;
2392 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002393#else
2394 /*
2395 * TODO: always return TRUE for now until
2396 * we figure out why we could be stuck in
2397 * one of the roaming states forever.
2398 */
2399 return eANI_BOOLEAN_TRUE;
2400#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002401}
2402#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002403/* ---------------------------------------------------------------------------
2404 \fn sme_ScanRequest
2405 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002406 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 \param pScanRequestID - pointer to an object to get back the request ID
2408 \param callback - a callback function that scan calls upon finish, will not
2409 be called if csrScanRequest returns error
2410 \param pContext - a pointer passed in for the callback
2411 \return eHalStatus
2412 ---------------------------------------------------------------------------*/
2413eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2414 tANI_U32 *pScanRequestID,
2415 csrScanCompleteCallback callback, void *pContext)
2416{
2417 eHalStatus status = eHAL_STATUS_FAILURE;
2418 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002419 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2420 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002421 smsLog(pMac, LOG2, FL("enter"));
2422 do
2423 {
2424 if(pMac->scan.fScanEnable)
2425 {
2426 status = sme_AcquireGlobalLock( &pMac->sme );
2427 if ( HAL_STATUS_SUCCESS( status ) )
2428 {
2429 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002430#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002431 if(csrIsScanAllowed(pMac))
2432 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002433#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002434 status = csrScanRequest( hHal, sessionId, pscanReq,
2435 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002436#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002437 }
2438 else
2439 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002440 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2441 pMac->roam.neighborRoamInfo.neighborRoamState,
2442 pMac->roam.curSubState[sessionId]);
2443 /*HandOff is in progress. So schedule this scan later*/
2444 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002445 }
2446#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 }
2448
2449 sme_ReleaseGlobalLock( &pMac->sme );
2450 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002451 else
2452 {
2453 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2454 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002456 else
2457 {
2458 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2459 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 } while( 0 );
2461
2462 return (status);
2463
2464
2465}
2466
2467/* ---------------------------------------------------------------------------
2468 \fn sme_ScanGetResult
2469 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002470 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 \param pFilter - If pFilter is NULL, all cached results are returned
2472 \param phResult - an object for the result.
2473 \return eHalStatus
2474 ---------------------------------------------------------------------------*/
2475eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2476 tScanResultHandle *phResult)
2477{
2478 eHalStatus status = eHAL_STATUS_FAILURE;
2479 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2480
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002481 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2482 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 smsLog(pMac, LOG2, FL("enter"));
2484 status = sme_AcquireGlobalLock( &pMac->sme );
2485 if ( HAL_STATUS_SUCCESS( status ) )
2486 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002487 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 sme_ReleaseGlobalLock( &pMac->sme );
2489 }
2490 smsLog(pMac, LOG2, FL("exit status %d"), status);
2491
2492 return (status);
2493}
2494
2495
2496/* ---------------------------------------------------------------------------
2497 \fn sme_ScanFlushResult
2498 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002499 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002500 \return eHalStatus
2501 ---------------------------------------------------------------------------*/
2502eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2503{
2504 eHalStatus status = eHAL_STATUS_FAILURE;
2505 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2506
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002507 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2508 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002509 status = sme_AcquireGlobalLock( &pMac->sme );
2510 if ( HAL_STATUS_SUCCESS( status ) )
2511 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002512 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002513 sme_ReleaseGlobalLock( &pMac->sme );
2514 }
2515
2516 return (status);
2517}
2518
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002519eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2520{
2521 eHalStatus status = eHAL_STATUS_FAILURE;
2522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2523
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002524 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2525 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002526 status = sme_AcquireGlobalLock( &pMac->sme );
2527 if ( HAL_STATUS_SUCCESS( status ) )
2528 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302529 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002530 sme_ReleaseGlobalLock( &pMac->sme );
2531 }
2532
2533 return (status);
2534}
Jeff Johnson295189b2012-06-20 16:38:30 -07002535
2536/* ---------------------------------------------------------------------------
2537 \fn sme_ScanResultGetFirst
2538 \brief a wrapper function to request CSR to returns the first element of
2539 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002540 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002541 \param hScanResult - returned from csrScanGetResult
2542 \return tCsrScanResultInfo * - NULL if no result
2543 ---------------------------------------------------------------------------*/
2544tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2545 tScanResultHandle hScanResult)
2546{
2547 eHalStatus status = eHAL_STATUS_FAILURE;
2548 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2549 tCsrScanResultInfo *pRet = NULL;
2550
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002551 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2552 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 status = sme_AcquireGlobalLock( &pMac->sme );
2554 if ( HAL_STATUS_SUCCESS( status ) )
2555 {
2556 pRet = csrScanResultGetFirst( pMac, hScanResult );
2557 sme_ReleaseGlobalLock( &pMac->sme );
2558 }
2559
2560 return (pRet);
2561}
2562
2563
2564/* ---------------------------------------------------------------------------
2565 \fn sme_ScanResultGetNext
2566 \brief a wrapper function to request CSR to returns the next element of
2567 scan result. It can be called without calling csrScanResultGetFirst
2568 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002569 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 \param hScanResult - returned from csrScanGetResult
2571 \return Null if no result or reach the end
2572 ---------------------------------------------------------------------------*/
2573tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2574 tScanResultHandle hScanResult)
2575{
2576 eHalStatus status = eHAL_STATUS_FAILURE;
2577 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2578 tCsrScanResultInfo *pRet = NULL;
2579
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002580 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME ,
2581 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002582 status = sme_AcquireGlobalLock( &pMac->sme );
2583 if ( HAL_STATUS_SUCCESS( status ) )
2584 {
2585 pRet = csrScanResultGetNext( pMac, hScanResult );
2586 sme_ReleaseGlobalLock( &pMac->sme );
2587 }
2588
2589 return (pRet);
2590}
2591
2592
2593/* ---------------------------------------------------------------------------
2594 \fn sme_ScanSetBGScanparams
2595 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002596 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 \param pScanReq - BG scan request structure
2598 \return eHalStatus
2599 ---------------------------------------------------------------------------*/
2600eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2601{
2602 eHalStatus status = eHAL_STATUS_FAILURE;
2603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2604
2605 if( NULL != pScanReq )
2606 {
2607 status = sme_AcquireGlobalLock( &pMac->sme );
2608 if ( HAL_STATUS_SUCCESS( status ) )
2609 {
2610 status = csrScanSetBGScanparams( hHal, pScanReq );
2611 sme_ReleaseGlobalLock( &pMac->sme );
2612 }
2613 }
2614
2615 return (status);
2616}
2617
2618
2619/* ---------------------------------------------------------------------------
2620 \fn sme_ScanResultPurge
2621 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2622 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002623 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 \param hScanResult - returned from csrScanGetResult. hScanResult is
2625 considered gone by
2626 calling this function and even before this function reutrns.
2627 \return eHalStatus
2628 ---------------------------------------------------------------------------*/
2629eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2630{
2631 eHalStatus status = eHAL_STATUS_FAILURE;
2632 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2633
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002634 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2635 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002636 status = sme_AcquireGlobalLock( &pMac->sme );
2637 if ( HAL_STATUS_SUCCESS( status ) )
2638 {
2639 status = csrScanResultPurge( hHal, hScanResult );
2640 sme_ReleaseGlobalLock( &pMac->sme );
2641 }
2642
2643 return (status);
2644}
2645
2646/* ---------------------------------------------------------------------------
2647 \fn sme_ScanGetPMKIDCandidateList
2648 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002649 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 \param pPmkidList - caller allocated buffer point to an array of
2651 tPmkidCandidateInfo
2652 \param pNumItems - pointer to a variable that has the number of
2653 tPmkidCandidateInfo allocated when retruning, this is
2654 either the number needed or number of items put into
2655 pPmkidList
2656 \return eHalStatus - when fail, it usually means the buffer allocated is not
2657 big enough and pNumItems
2658 has the number of tPmkidCandidateInfo.
2659 \Note: pNumItems is a number of tPmkidCandidateInfo,
2660 not sizeof(tPmkidCandidateInfo) * something
2661 ---------------------------------------------------------------------------*/
2662eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2663 tPmkidCandidateInfo *pPmkidList,
2664 tANI_U32 *pNumItems )
2665{
2666 eHalStatus status = eHAL_STATUS_FAILURE;
2667 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2668
2669 status = sme_AcquireGlobalLock( &pMac->sme );
2670 if ( HAL_STATUS_SUCCESS( status ) )
2671 {
2672 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2673 sme_ReleaseGlobalLock( &pMac->sme );
2674 }
2675
2676 return (status);
2677}
2678
2679/*----------------------------------------------------------------------------
2680 \fn sme_RoamRegisterLinkQualityIndCallback
2681
2682 \brief
2683 a wrapper function to allow HDD to register a callback handler with CSR for
2684 link quality indications.
2685
2686 Only one callback may be registered at any time.
2687 In order to deregister the callback, a NULL cback may be provided.
2688
2689 Registration happens in the task context of the caller.
2690
2691 \param callback - Call back being registered
2692 \param pContext - user data
2693
2694 DEPENDENCIES: After CSR open
2695
2696 \return eHalStatus
2697-----------------------------------------------------------------------------*/
2698eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2699 csrRoamLinkQualityIndCallback callback,
2700 void *pContext)
2701{
2702 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2703}
2704
2705/* ---------------------------------------------------------------------------
2706 \fn sme_RoamRegisterCallback
2707 \brief a wrapper function to allow HDD to register a callback with CSR.
2708 Unlike scan, roam has one callback for all the roam requests
2709 \param callback - a callback function that roam calls upon when state changes
2710 \param pContext - a pointer passed in for the callback
2711 \return eHalStatus
2712 ---------------------------------------------------------------------------*/
2713eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2714 csrRoamCompleteCallback callback,
2715 void *pContext)
2716{
2717 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2718}
2719
2720eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2721{
2722 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2723 return pMac->roam.configParam.phyMode;
2724}
2725
2726/* ---------------------------------------------------------------------------
2727 \fn sme_RoamConnect
2728 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002729 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 \param sessionId - the sessionId returned by sme_OpenSession.
2731 \param pProfile - description of the network to which to connect
2732 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2733 from csrScanGetResult
2734 \param pRoamId - to get back the request ID
2735 \return eHalStatus
2736 ---------------------------------------------------------------------------*/
2737eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2738 tANI_U32 *pRoamId)
2739{
2740 eHalStatus status = eHAL_STATUS_FAILURE;
2741 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2742
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002743 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2744 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 smsLog(pMac, LOG2, FL("enter"));
2746 status = sme_AcquireGlobalLock( &pMac->sme );
2747 if ( HAL_STATUS_SUCCESS( status ) )
2748 {
2749 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2750 {
2751 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2752 }
2753 else
2754 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002755 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 status = eHAL_STATUS_INVALID_PARAMETER;
2757 }
2758 sme_ReleaseGlobalLock( &pMac->sme );
2759 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002760 else
2761 {
2762 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2763 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002764
2765 return (status);
2766}
2767
2768/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302769
2770 \fn sme_SetPhyMode
2771
2772 \brief Changes the PhyMode.
2773
2774 \param hHal - The handle returned by macOpen.
2775
2776 \param phyMode new phyMode which is to set
2777
2778 \return eHalStatus SUCCESS.
2779
2780 -------------------------------------------------------------------------------*/
2781eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2782{
2783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2784
2785 if (NULL == pMac)
2786 {
2787 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2788 "%s: invalid context", __func__);
2789 return eHAL_STATUS_FAILURE;
2790 }
2791
2792 pMac->roam.configParam.phyMode = phyMode;
2793 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2794 pMac->roam.configParam.phyMode,
2795 pMac->roam.configParam.ProprietaryRatesEnabled);
2796
2797 return eHAL_STATUS_SUCCESS;
2798}
2799
2800/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 \fn sme_RoamReassoc
2802 \brief a wrapper function to request CSR to inititiate a re-association
2803 \param pProfile - can be NULL to join the currently connected AP. In that
2804 case modProfileFields should carry the modified field(s) which could trigger
2805 reassoc
2806 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2807 that might need modification dynamically once STA is up & running and this
2808 could trigger a reassoc
2809 \param pRoamId - to get back the request ID
2810 \return eHalStatus
2811 -------------------------------------------------------------------------------*/
2812eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2813 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002814 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002815{
2816 eHalStatus status = eHAL_STATUS_FAILURE;
2817 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2818
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002819 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2820 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 smsLog(pMac, LOG2, FL("enter"));
2822 status = sme_AcquireGlobalLock( &pMac->sme );
2823 if ( HAL_STATUS_SUCCESS( status ) )
2824 {
2825 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2826 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002827 if((NULL == pProfile) && (fForce == 1))
2828 {
2829 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2830 /* to force the AP initiate fresh 802.1x authentication need to clear
2831 * the PMKID cache for that set the following boolean. this is needed
2832 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2833 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002834 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2835 }
2836 else
2837 {
2838 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2839 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002840 }
2841 else
2842 {
2843 status = eHAL_STATUS_INVALID_PARAMETER;
2844 }
2845 sme_ReleaseGlobalLock( &pMac->sme );
2846 }
2847
2848 return (status);
2849}
2850
2851/* ---------------------------------------------------------------------------
2852 \fn sme_RoamConnectToLastProfile
2853 \brief a wrapper function to request CSR to disconnect and reconnect with
2854 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002855 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 \return eHalStatus. It returns fail if currently connected
2857 ---------------------------------------------------------------------------*/
2858eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2859{
2860 eHalStatus status = eHAL_STATUS_FAILURE;
2861 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2862
2863 status = sme_AcquireGlobalLock( &pMac->sme );
2864 if ( HAL_STATUS_SUCCESS( status ) )
2865 {
2866 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2867 {
2868 status = csrRoamConnectToLastProfile( pMac, sessionId );
2869 }
2870 else
2871 {
2872 status = eHAL_STATUS_INVALID_PARAMETER;
2873 }
2874 sme_ReleaseGlobalLock( &pMac->sme );
2875 }
2876
2877 return (status);
2878}
2879
2880/* ---------------------------------------------------------------------------
2881 \fn sme_RoamDisconnect
2882 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002883 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 \param reason -- To indicate the reason for disconnecting. Currently, only
2885 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2886 \return eHalStatus
2887 ---------------------------------------------------------------------------*/
2888eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2889{
2890 eHalStatus status = eHAL_STATUS_FAILURE;
2891 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2892
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07002893 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2894 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 smsLog(pMac, LOG2, FL("enter"));
2896 status = sme_AcquireGlobalLock( &pMac->sme );
2897 if ( HAL_STATUS_SUCCESS( status ) )
2898 {
2899 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2900 {
2901 status = csrRoamDisconnect( pMac, sessionId, reason );
2902 }
2903 else
2904 {
2905 status = eHAL_STATUS_INVALID_PARAMETER;
2906 }
2907 sme_ReleaseGlobalLock( &pMac->sme );
2908 }
2909
2910 return (status);
2911}
2912
Jeff Johnson295189b2012-06-20 16:38:30 -07002913/* ---------------------------------------------------------------------------
2914 \fn sme_RoamStopBss
2915 \brief To stop BSS for Soft AP. This is an asynchronous API.
2916 \param hHal - Global structure
2917 \param sessionId - sessionId of SoftAP
2918 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2919 -------------------------------------------------------------------------------*/
2920eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2921{
2922 eHalStatus status = eHAL_STATUS_FAILURE;
2923 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2924
2925 smsLog(pMac, LOG2, FL("enter"));
2926 status = sme_AcquireGlobalLock( &pMac->sme );
2927 if ( HAL_STATUS_SUCCESS( status ) )
2928 {
2929 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2930 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302931 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002932 }
2933 else
2934 {
2935 status = eHAL_STATUS_INVALID_PARAMETER;
2936 }
2937 sme_ReleaseGlobalLock( &pMac->sme );
2938 }
2939
2940 return (status);
2941}
2942
2943/* ---------------------------------------------------------------------------
2944 \fn sme_RoamDisconnectSta
2945 \brief To disassociate a station. This is an asynchronous API.
2946 \param hHal - Global structure
2947 \param sessionId - sessionId of SoftAP
2948 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2949 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2950 -------------------------------------------------------------------------------*/
2951eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2952 tANI_U8 *pPeerMacAddr)
2953{
2954 eHalStatus status = eHAL_STATUS_FAILURE;
2955 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2956
2957 if ( NULL == pMac )
2958 {
2959 VOS_ASSERT(0);
2960 return status;
2961 }
2962
2963 status = sme_AcquireGlobalLock( &pMac->sme );
2964 if ( HAL_STATUS_SUCCESS( status ) )
2965 {
2966 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2967 {
2968 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302969 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002970 }
2971 else
2972 {
2973 status = eHAL_STATUS_INVALID_PARAMETER;
2974 }
2975 sme_ReleaseGlobalLock( &pMac->sme );
2976 }
2977
2978 return (status);
2979}
2980
2981/* ---------------------------------------------------------------------------
2982 \fn sme_RoamDeauthSta
2983 \brief To disassociate a station. This is an asynchronous API.
2984 \param hHal - Global structure
2985 \param sessionId - sessionId of SoftAP
2986 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2987 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2988 -------------------------------------------------------------------------------*/
2989eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2990 tANI_U8 *pPeerMacAddr)
2991{
2992 eHalStatus status = eHAL_STATUS_FAILURE;
2993 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2994
2995 if ( NULL == pMac )
2996 {
2997 VOS_ASSERT(0);
2998 return status;
2999 }
3000
3001 status = sme_AcquireGlobalLock( &pMac->sme );
3002 if ( HAL_STATUS_SUCCESS( status ) )
3003 {
3004 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3005 {
3006 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303007 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 }
3009 else
3010 {
3011 status = eHAL_STATUS_INVALID_PARAMETER;
3012 }
3013 sme_ReleaseGlobalLock( &pMac->sme );
3014 }
3015
3016 return (status);
3017}
3018
3019/* ---------------------------------------------------------------------------
3020 \fn sme_RoamTKIPCounterMeasures
3021 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3022 \param sessionId - sessionId of SoftAP
3023 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3024 \return eHalStatus
3025 -------------------------------------------------------------------------------*/
3026eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3027 tANI_BOOLEAN bEnable)
3028{
3029 eHalStatus status = eHAL_STATUS_FAILURE;
3030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3031
3032 if ( NULL == pMac )
3033 {
3034 VOS_ASSERT(0);
3035 return status;
3036 }
3037
3038 status = sme_AcquireGlobalLock( &pMac->sme );
3039 if ( HAL_STATUS_SUCCESS( status ) )
3040 {
3041 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3042 {
3043 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3044 }
3045 else
3046 {
3047 status = eHAL_STATUS_INVALID_PARAMETER;
3048 }
3049 sme_ReleaseGlobalLock( &pMac->sme );
3050 }
3051
3052 return (status);
3053}
3054
3055/* ---------------------------------------------------------------------------
3056 \fn sme_RoamGetAssociatedStas
3057 \brief To probe the list of associated stations from various modules of CORE stack.
3058 \This is an asynchronous API.
3059 \param sessionId - sessionId of SoftAP
3060 \param modId - Module from whom list of associtated stations is to be probed.
3061 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3062 \param pUsrContext - Opaque HDD context
3063 \param pfnSapEventCallback - Sap event callback in HDD
3064 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3065 \return eHalStatus
3066 -------------------------------------------------------------------------------*/
3067eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3068 VOS_MODULE_ID modId, void *pUsrContext,
3069 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3070{
3071 eHalStatus status = eHAL_STATUS_FAILURE;
3072 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3073
3074 if ( NULL == pMac )
3075 {
3076 VOS_ASSERT(0);
3077 return status;
3078 }
3079
3080 status = sme_AcquireGlobalLock( &pMac->sme );
3081 if ( HAL_STATUS_SUCCESS( status ) )
3082 {
3083 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3084 {
3085 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3086 }
3087 else
3088 {
3089 status = eHAL_STATUS_INVALID_PARAMETER;
3090 }
3091 sme_ReleaseGlobalLock( &pMac->sme );
3092 }
3093
3094 return (status);
3095}
3096
3097/* ---------------------------------------------------------------------------
3098 \fn sme_RoamGetWpsSessionOverlap
3099 \brief To get the WPS PBC session overlap information.
3100 \This is an asynchronous API.
3101 \param sessionId - sessionId of SoftAP
3102 \param pUsrContext - Opaque HDD context
3103 \param pfnSapEventCallback - Sap event callback in HDD
3104 \pRemoveMac - pointer to Mac address which needs to be removed from session
3105 \return eHalStatus
3106 -------------------------------------------------------------------------------*/
3107eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
3108 void *pUsrContext, void
3109 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3110{
3111 eHalStatus status = eHAL_STATUS_FAILURE;
3112 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3113
3114 if ( NULL == pMac )
3115 {
3116 VOS_ASSERT(0);
3117 return status;
3118 }
3119
3120 status = sme_AcquireGlobalLock( &pMac->sme );
3121 if ( HAL_STATUS_SUCCESS( status ) )
3122 {
3123 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3124 {
3125 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3126 }
3127 else
3128 {
3129 status = eHAL_STATUS_INVALID_PARAMETER;
3130 }
3131 sme_ReleaseGlobalLock( &pMac->sme );
3132 }
3133
3134 return (status);
3135}
3136
Jeff Johnson295189b2012-06-20 16:38:30 -07003137
3138/* ---------------------------------------------------------------------------
3139 \fn sme_RoamGetConnectState
3140 \brief a wrapper function to request CSR to return the current connect state
3141 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003142 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003143 \return eHalStatus
3144 ---------------------------------------------------------------------------*/
3145eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3146{
3147 eHalStatus status = eHAL_STATUS_FAILURE;
3148 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3149
3150 status = sme_AcquireGlobalLock( &pMac->sme );
3151 if ( HAL_STATUS_SUCCESS( status ) )
3152 {
3153 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3154 {
3155 status = csrRoamGetConnectState( pMac, sessionId, pState );
3156 }
3157 else
3158 {
3159 status = eHAL_STATUS_INVALID_PARAMETER;
3160 }
3161 sme_ReleaseGlobalLock( &pMac->sme );
3162 }
3163
3164 return (status);
3165}
3166
3167/* ---------------------------------------------------------------------------
3168 \fn sme_RoamGetConnectProfile
3169 \brief a wrapper function to request CSR to return the current connect
3170 profile. Caller must call csrRoamFreeConnectProfile after it is done
3171 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003172 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 \param pProfile - pointer to a caller allocated structure
3174 tCsrRoamConnectedProfile
3175 \return eHalStatus. Failure if not connected
3176 ---------------------------------------------------------------------------*/
3177eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3178 tCsrRoamConnectedProfile *pProfile)
3179{
3180 eHalStatus status = eHAL_STATUS_FAILURE;
3181 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3182
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003183 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3184 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 status = sme_AcquireGlobalLock( &pMac->sme );
3186 if ( HAL_STATUS_SUCCESS( status ) )
3187 {
3188 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3189 {
3190 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3191 }
3192 else
3193 {
3194 status = eHAL_STATUS_INVALID_PARAMETER;
3195 }
3196 sme_ReleaseGlobalLock( &pMac->sme );
3197 }
3198
3199 return (status);
3200}
3201
3202/* ---------------------------------------------------------------------------
3203 \fn sme_RoamFreeConnectProfile
3204 \brief a wrapper function to request CSR to free and reinitialize the
3205 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003206 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003207 \param pProfile - pointer to a caller allocated structure
3208 tCsrRoamConnectedProfile
3209 \return eHalStatus.
3210 ---------------------------------------------------------------------------*/
3211eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3212 tCsrRoamConnectedProfile *pProfile)
3213{
3214 eHalStatus status = eHAL_STATUS_FAILURE;
3215 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3216
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003217 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3218 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 status = sme_AcquireGlobalLock( &pMac->sme );
3220 if ( HAL_STATUS_SUCCESS( status ) )
3221 {
3222 status = csrRoamFreeConnectProfile( pMac, pProfile );
3223 sme_ReleaseGlobalLock( &pMac->sme );
3224 }
3225
3226 return (status);
3227}
3228
3229/* ---------------------------------------------------------------------------
3230 \fn sme_RoamSetPMKIDCache
3231 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003232 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003233 \param pPMKIDCache - caller allocated buffer point to an array of
3234 tPmkidCacheInfo
3235 \param numItems - a variable that has the number of tPmkidCacheInfo
3236 allocated when retruning, this is either the number needed
3237 or number of items put into pPMKIDCache
3238 \return eHalStatus - when fail, it usually means the buffer allocated is not
3239 big enough and pNumItems has the number of
3240 tPmkidCacheInfo.
3241 \Note: pNumItems is a number of tPmkidCacheInfo,
3242 not sizeof(tPmkidCacheInfo) * something
3243 ---------------------------------------------------------------------------*/
3244eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3245 tANI_U32 numItems )
3246{
3247 eHalStatus status = eHAL_STATUS_FAILURE;
3248 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3249
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003250 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3251 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 status = sme_AcquireGlobalLock( &pMac->sme );
3253 if ( HAL_STATUS_SUCCESS( status ) )
3254 {
3255 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3256 {
3257 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3258 }
3259 else
3260 {
3261 status = eHAL_STATUS_INVALID_PARAMETER;
3262 }
3263 sme_ReleaseGlobalLock( &pMac->sme );
3264 }
3265
3266 return (status);
3267}
3268
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003269eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3270{
3271 eHalStatus status = eHAL_STATUS_FAILURE;
3272 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3273 status = sme_AcquireGlobalLock( &pMac->sme );
3274 if ( HAL_STATUS_SUCCESS( status ) )
3275 {
3276 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3277 {
3278 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3279 }
3280 else
3281 {
3282 status = eHAL_STATUS_INVALID_PARAMETER;
3283 }
3284 sme_ReleaseGlobalLock( &pMac->sme );
3285 }
3286 return (status);
3287}
Jeff Johnson295189b2012-06-20 16:38:30 -07003288/* ---------------------------------------------------------------------------
3289 \fn sme_RoamGetSecurityReqIE
3290 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3291 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003292 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 \param pLen - caller allocated memory that has the length of pBuf as input.
3294 Upon returned, *pLen has the needed or IE length in pBuf.
3295 \param pBuf - Caller allocated memory that contain the IE field, if any,
3296 upon return
3297 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3298 \return eHalStatus - when fail, it usually means the buffer allocated is not
3299 big enough
3300 ---------------------------------------------------------------------------*/
3301eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3302 tANI_U8 *pBuf, eCsrSecurityType secType)
3303{
3304 eHalStatus status = eHAL_STATUS_FAILURE;
3305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3306
3307 status = sme_AcquireGlobalLock( &pMac->sme );
3308 if ( HAL_STATUS_SUCCESS( status ) )
3309 {
3310 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3311 {
3312 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3313 }
3314 else
3315 {
3316 status = eHAL_STATUS_INVALID_PARAMETER;
3317 }
3318 sme_ReleaseGlobalLock( &pMac->sme );
3319 }
3320
3321 return (status);
3322}
3323
3324/* ---------------------------------------------------------------------------
3325 \fn sme_RoamGetSecurityRspIE
3326 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3327 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003328 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 \param pLen - caller allocated memory that has the length of pBuf as input.
3330 Upon returned, *pLen has the needed or IE length in pBuf.
3331 \param pBuf - Caller allocated memory that contain the IE field, if any,
3332 upon return
3333 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3334 \return eHalStatus - when fail, it usually means the buffer allocated is not
3335 big enough
3336 ---------------------------------------------------------------------------*/
3337eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3338 tANI_U8 *pBuf, eCsrSecurityType secType)
3339{
3340 eHalStatus status = eHAL_STATUS_FAILURE;
3341 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3342
3343 status = sme_AcquireGlobalLock( &pMac->sme );
3344 if ( HAL_STATUS_SUCCESS( status ) )
3345 {
3346 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3347 {
3348 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3349 }
3350 else
3351 {
3352 status = eHAL_STATUS_INVALID_PARAMETER;
3353 }
3354 sme_ReleaseGlobalLock( &pMac->sme );
3355 }
3356
3357 return (status);
3358
3359}
3360
3361
3362/* ---------------------------------------------------------------------------
3363 \fn sme_RoamGetNumPMKIDCache
3364 \brief a wrapper function to request CSR to return number of PMKID cache
3365 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003366 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003367 \return tANI_U32 - the number of PMKID cache entries
3368 ---------------------------------------------------------------------------*/
3369tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3370{
3371 eHalStatus status = eHAL_STATUS_FAILURE;
3372 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3373 tANI_U32 numPmkidCache = 0;
3374
3375 status = sme_AcquireGlobalLock( &pMac->sme );
3376 if ( HAL_STATUS_SUCCESS( status ) )
3377 {
3378 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3379 {
3380 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3381 status = eHAL_STATUS_SUCCESS;
3382 }
3383 else
3384 {
3385 status = eHAL_STATUS_INVALID_PARAMETER;
3386 }
3387 sme_ReleaseGlobalLock( &pMac->sme );
3388 }
3389
3390 return (numPmkidCache);
3391}
3392
3393/* ---------------------------------------------------------------------------
3394 \fn sme_RoamGetPMKIDCache
3395 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003396 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 \param pNum - caller allocated memory that has the space of the number of
3398 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3399 needed or actually number in tPmkidCacheInfo.
3400 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3401 any, upon return
3402 \return eHalStatus - when fail, it usually means the buffer allocated is not
3403 big enough
3404 ---------------------------------------------------------------------------*/
3405eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3406 tPmkidCacheInfo *pPmkidCache)
3407{
3408 eHalStatus status = eHAL_STATUS_FAILURE;
3409 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3410
3411 status = sme_AcquireGlobalLock( &pMac->sme );
3412 if ( HAL_STATUS_SUCCESS( status ) )
3413 {
3414 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3415 {
3416 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3417 }
3418 else
3419 {
3420 status = eHAL_STATUS_INVALID_PARAMETER;
3421 }
3422 sme_ReleaseGlobalLock( &pMac->sme );
3423 }
3424
3425 return (status);
3426}
3427
3428
3429/* ---------------------------------------------------------------------------
3430 \fn sme_GetConfigParam
3431 \brief a wrapper function that HDD calls to get the global settings
3432 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003433 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 \param pParam - caller allocated memory
3435 \return eHalStatus
3436 ---------------------------------------------------------------------------*/
3437eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3438{
3439 eHalStatus status = eHAL_STATUS_FAILURE;
3440 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3441
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003442 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3443 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003444 status = sme_AcquireGlobalLock( &pMac->sme );
3445 if ( HAL_STATUS_SUCCESS( status ) )
3446 {
3447 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3448 if (status != eHAL_STATUS_SUCCESS)
3449 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003450 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 sme_ReleaseGlobalLock( &pMac->sme );
3452 return status;
3453 }
3454#if defined WLAN_FEATURE_P2P_INTERNAL
3455 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3456 if (status != eHAL_STATUS_SUCCESS)
3457 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003458 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 sme_ReleaseGlobalLock( &pMac->sme );
3460 return status;
3461 }
3462#endif
3463 sme_ReleaseGlobalLock( &pMac->sme );
3464 }
3465
3466 return (status);
3467}
3468
3469/* ---------------------------------------------------------------------------
3470 \fn sme_CfgSetInt
3471 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003472 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003473 \param cfgId - Configuration Parameter ID (type) for STA.
3474 \param ccmValue - The information related to Configuration Parameter ID
3475 which needs to be saved in CFG
3476 \param callback - To be registered by CSR with CCM. Once the CFG done with
3477 saving the information in the database, it notifies CCM &
3478 then the callback will be invoked to notify.
3479 \param toBeSaved - To save the request for future reference
3480 \return eHalStatus
3481 ---------------------------------------------------------------------------*/
3482eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3483 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3484{
3485 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3486}
3487
3488/* ---------------------------------------------------------------------------
3489 \fn sme_CfgSetStr
3490 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003491 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 \param cfgId - Configuration Parameter ID (type) for STA.
3493 \param pStr - Pointer to the byte array which carries the information needs
3494 to be saved in CFG
3495 \param length - Length of the data to be saved
3496 \param callback - To be registered by CSR with CCM. Once the CFG done with
3497 saving the information in the database, it notifies CCM &
3498 then the callback will be invoked to notify.
3499 \param toBeSaved - To save the request for future reference
3500 \return eHalStatus
3501 ---------------------------------------------------------------------------*/
3502eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3503 tANI_U32 length, tCcmCfgSetCallback callback,
3504 eAniBoolean toBeSaved)
3505{
3506 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3507}
3508
3509/* ---------------------------------------------------------------------------
3510 \fn sme_GetModifyProfileFields
3511 \brief HDD or SME - QOS calls this function to get the current values of
3512 connected profile fields, changing which can cause reassoc.
3513 This function must be called after CFG is downloaded and STA is in connected
3514 state. Also, make sure to call this function to get the current profile
3515 fields before calling the reassoc. So that pModifyProfileFields will have
3516 all the latest values plus the one(s) has been updated as part of reassoc
3517 request.
3518 \param pModifyProfileFields - pointer to the connected profile fields
3519 changing which can cause reassoc
3520
3521 \return eHalStatus
3522 -------------------------------------------------------------------------------*/
3523eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3524 tCsrRoamModifyProfileFields * pModifyProfileFields)
3525{
3526 eHalStatus status = eHAL_STATUS_FAILURE;
3527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3528
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003529 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3530 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003531 status = sme_AcquireGlobalLock( &pMac->sme );
3532 if ( HAL_STATUS_SUCCESS( status ) )
3533 {
3534 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3535 {
3536 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3537 }
3538 else
3539 {
3540 status = eHAL_STATUS_INVALID_PARAMETER;
3541 }
3542 sme_ReleaseGlobalLock( &pMac->sme );
3543 }
3544
3545 return (status);
3546}
3547
3548/*--------------------------------------------------------------------------
3549 \fn sme_SetConfigPowerSave
3550 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3551 For BMPS related configuration, this function also updates the CFG
3552 and sends a message to FW to pick up the new values. Note: Calling
3553 this function only updates the configuration and does not enable
3554 the specified power save mode.
3555 \param hHal - The handle returned by macOpen.
3556 \param psMode - Power Saving mode being modified
3557 \param pConfigParams - a pointer to a caller allocated object of type
3558 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3559 \return eHalStatus
3560 --------------------------------------------------------------------------*/
3561eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3562 void *pConfigParams)
3563{
3564 eHalStatus status = eHAL_STATUS_FAILURE;
3565 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3566
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003567 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3568 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003569 if (NULL == pConfigParams ) {
3570 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3571 "nothing to update");
3572 return eHAL_STATUS_FAILURE;
3573 }
3574
3575 status = sme_AcquireGlobalLock( &pMac->sme );
3576 if ( HAL_STATUS_SUCCESS( status ) )
3577 {
3578 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3579 sme_ReleaseGlobalLock( &pMac->sme );
3580 }
3581
3582 return (status);
3583}
3584
3585/*--------------------------------------------------------------------------
3586 \fn sme_GetConfigPowerSave
3587 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3588 \param hHal - The handle returned by macOpen.
3589 \param psMode - Power Saving mode
3590 \param pConfigParams - a pointer to a caller allocated object of type
3591 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3592 \return eHalStatus
3593 --------------------------------------------------------------------------*/
3594eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3595 void *pConfigParams)
3596{
3597 eHalStatus status = eHAL_STATUS_FAILURE;
3598 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3599
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003600 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3601 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003602 if (NULL == pConfigParams ) {
3603 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3604 "nothing to update");
3605 return eHAL_STATUS_FAILURE;
3606 }
3607
3608 status = sme_AcquireGlobalLock( &pMac->sme );
3609 if ( HAL_STATUS_SUCCESS( status ) )
3610 {
3611 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3612 sme_ReleaseGlobalLock( &pMac->sme );
3613 }
3614
3615 return (status);
3616}
3617
3618/* ---------------------------------------------------------------------------
3619 \fn sme_SignalPowerEvent
3620 \brief Signals to PMC that a power event has occurred. Used for putting
3621 the chip into deep sleep mode.
3622 \param hHal - The handle returned by macOpen.
3623 \param event - the event that has occurred
3624 \return eHalStatus
3625 ---------------------------------------------------------------------------*/
3626eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3627{
3628 eHalStatus status = eHAL_STATUS_FAILURE;
3629 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3630
3631 status = sme_AcquireGlobalLock( &pMac->sme );
3632 if ( HAL_STATUS_SUCCESS( status ) )
3633 {
3634 status = pmcSignalPowerEvent(hHal, event);
3635 sme_ReleaseGlobalLock( &pMac->sme );
3636 }
3637
3638 return (status);
3639}
3640
3641/* ---------------------------------------------------------------------------
3642 \fn sme_EnablePowerSave
3643 \brief Enables one of the power saving modes.
3644 \param hHal - The handle returned by macOpen.
3645 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3646 while the chip is operating in Full Power, PMC will start
3647 a timer that will try to put the chip in BMPS mode after
3648 expiry.
3649 \return eHalStatus
3650 ---------------------------------------------------------------------------*/
3651eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3652{
3653 eHalStatus status = eHAL_STATUS_FAILURE;
3654 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3655
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003656 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3657 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003658 status = sme_AcquireGlobalLock( &pMac->sme );
3659 if ( HAL_STATUS_SUCCESS( status ) )
3660 {
3661 status = pmcEnablePowerSave(hHal, psMode);
3662 sme_ReleaseGlobalLock( &pMac->sme );
3663 }
3664
3665 return (status);
3666}
3667
3668/* ---------------------------------------------------------------------------
3669 \fn sme_DisablePowerSave
3670 \brief Disables one of the power saving modes.
3671 \param hHal - The handle returned by macOpen.
3672 \param psMode - The power saving mode to disable. Disabling does not imply
3673 that device will be brought out of the current PS mode. This
3674 is purely a configuration API.
3675 \return eHalStatus
3676 ---------------------------------------------------------------------------*/
3677eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3678{
3679 eHalStatus status = eHAL_STATUS_FAILURE;
3680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3681
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003682 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3683 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 status = sme_AcquireGlobalLock( &pMac->sme );
3685 if ( HAL_STATUS_SUCCESS( status ) )
3686 {
3687 status = pmcDisablePowerSave(hHal, psMode);
3688 sme_ReleaseGlobalLock( &pMac->sme );
3689 }
3690
3691 return (status);
3692 }
3693
3694/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303695+ \fn sme_SetHostPowerSave
3696+ \brief Enables BMPS logic to be controlled by User level apps
3697+ \param hHal - The handle returned by macOpen.
3698+ \param psMode - The power saving mode to disable. Disabling does not imply
3699+ that device will be brought out of the current PS mode. This
3700+ is purely a configuration API.
3701+ \return eHalStatus
3702+ ---------------------------------------------------------------------------*/
3703eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3704{
3705 eHalStatus status = eHAL_STATUS_FAILURE;
3706 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3707
3708 pMac->pmc.isHostPsEn = psMode;
3709
3710 return (status);
3711}
3712
3713/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 \fn sme_StartAutoBmpsTimer
3715 \brief Starts a timer that periodically polls all the registered
3716 module for entry into Bmps mode. This timer is started only if BMPS is
3717 enabled and whenever the device is in full power.
3718 \param hHal - The handle returned by macOpen.
3719 \return eHalStatus
3720 ---------------------------------------------------------------------------*/
3721eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3722{
3723 eHalStatus status = eHAL_STATUS_FAILURE;
3724 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3725
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003726 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3727 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 status = sme_AcquireGlobalLock( &pMac->sme );
3729 if ( HAL_STATUS_SUCCESS( status ) )
3730 {
3731 status = pmcStartAutoBmpsTimer(hHal);
3732 sme_ReleaseGlobalLock( &pMac->sme );
3733 }
3734
3735 return (status);
3736}
3737/* ---------------------------------------------------------------------------
3738 \fn sme_StopAutoBmpsTimer
3739 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3740 Stopping the timer does not cause a device state change. Only the timer
3741 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3742 \param hHal - The handle returned by macOpen.
3743 \return eHalStatus
3744 ---------------------------------------------------------------------------*/
3745eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3746{
3747 eHalStatus status = eHAL_STATUS_FAILURE;
3748 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3749
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003750 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3751 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003752 status = sme_AcquireGlobalLock( &pMac->sme );
3753 if ( HAL_STATUS_SUCCESS( status ) )
3754 {
3755 status = pmcStopAutoBmpsTimer(hHal);
3756 sme_ReleaseGlobalLock( &pMac->sme );
3757 }
3758
3759 return (status);
3760}
3761/* ---------------------------------------------------------------------------
3762 \fn sme_QueryPowerState
3763 \brief Returns the current power state of the device.
3764 \param hHal - The handle returned by macOpen.
3765 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3766 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3767 \return eHalStatus
3768 ---------------------------------------------------------------------------*/
3769eHalStatus sme_QueryPowerState (
3770 tHalHandle hHal,
3771 tPmcPowerState *pPowerState,
3772 tPmcSwitchState *pSwWlanSwitchState)
3773{
3774 eHalStatus status = eHAL_STATUS_FAILURE;
3775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3776
3777 status = sme_AcquireGlobalLock( &pMac->sme );
3778 if ( HAL_STATUS_SUCCESS( status ) )
3779 {
3780 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3781 sme_ReleaseGlobalLock( &pMac->sme );
3782 }
3783
3784 return (status);
3785}
3786
3787/* ---------------------------------------------------------------------------
3788 \fn sme_IsPowerSaveEnabled
3789 \brief Checks if the device is able to enter a particular power save mode
3790 This does not imply that the device is in a particular PS mode
3791 \param hHal - The handle returned by macOpen.
3792 \param psMode - the power saving mode
3793 \return eHalStatus
3794 ---------------------------------------------------------------------------*/
3795tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3796{
3797 eHalStatus status = eHAL_STATUS_FAILURE;
3798 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3799 tANI_BOOLEAN result = false;
3800
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003801 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3802 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003803 status = sme_AcquireGlobalLock( &pMac->sme );
3804 if ( HAL_STATUS_SUCCESS( status ) )
3805 {
3806 result = pmcIsPowerSaveEnabled(hHal, psMode);
3807 sme_ReleaseGlobalLock( &pMac->sme );
3808 return result;
3809 }
3810
3811 return false;
3812}
3813
3814/* ---------------------------------------------------------------------------
3815 \fn sme_RequestFullPower
3816 \brief Request that the device be brought to full power state. When the
3817 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3818 is enabled. On timer expiry PMC will attempt to put the device in
3819 BMPS mode if following holds true:
3820 - BMPS mode is enabled
3821 - Polling of all modules through the Power Save Check routine passes
3822 - STA is associated to an access point
3823 \param hHal - The handle returned by macOpen.
3824 \param - callbackRoutine Callback routine invoked in case of success/failure
3825 \return eHalStatus - status
3826 eHAL_STATUS_SUCCESS - device brought to full power state
3827 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3828 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3829 ---------------------------------------------------------------------------*/
3830eHalStatus sme_RequestFullPower (
3831 tHalHandle hHal,
3832 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3833 void *callbackContext,
3834 tRequestFullPowerReason fullPowerReason)
3835{
3836 eHalStatus status = eHAL_STATUS_FAILURE;
3837 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3838
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003839 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3840 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 status = sme_AcquireGlobalLock( &pMac->sme );
3842 if ( HAL_STATUS_SUCCESS( status ) )
3843 {
3844 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3845 sme_ReleaseGlobalLock( &pMac->sme );
3846 }
3847
3848 return (status);
3849}
3850
3851/* ---------------------------------------------------------------------------
3852 \fn sme_RequestBmps
3853 \brief Request that the device be put in BMPS state. Request will be
3854 accepted only if BMPS mode is enabled and power save check routine
3855 passes.
3856 \param hHal - The handle returned by macOpen.
3857 \param - callbackRoutine Callback routine invoked in case of success/failure
3858 \return eHalStatus
3859 eHAL_STATUS_SUCCESS - device is in BMPS state
3860 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3861 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3862 ---------------------------------------------------------------------------*/
3863eHalStatus sme_RequestBmps (
3864 tHalHandle hHal,
3865 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3866 void *callbackContext)
3867{
3868 eHalStatus status = eHAL_STATUS_FAILURE;
3869 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3870
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003871 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3872 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003873 status = sme_AcquireGlobalLock( &pMac->sme );
3874 if ( HAL_STATUS_SUCCESS( status ) )
3875 {
3876 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3877 sme_ReleaseGlobalLock( &pMac->sme );
3878 }
3879
3880 return (status);
3881}
3882
3883
3884/* ---------------------------------------------------------------------------
3885 \fn sme_SetDHCPTillPowerActiveFlag
3886 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3887 entry by PMC
3888 \param hHal - The handle returned by macOpen.
3889 ---------------------------------------------------------------------------*/
3890void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3891{
3892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3893
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003894 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3895 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07003896 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3897 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3898}
3899
3900
3901/* ---------------------------------------------------------------------------
3902 \fn sme_StartUapsd
3903 \brief Request that the device be put in UAPSD state. If the device is in
3904 Full Power it will be put in BMPS mode first and then into UAPSD
3905 mode.
3906 \param hHal - The handle returned by macOpen.
3907 \param - callbackRoutine Callback routine invoked in case of success/failure
3908 eHAL_STATUS_SUCCESS - device is in UAPSD state
3909 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3910 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3911 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3912 \return eHalStatus
3913 ---------------------------------------------------------------------------*/
3914eHalStatus sme_StartUapsd (
3915 tHalHandle hHal,
3916 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3917 void *callbackContext)
3918{
3919 eHalStatus status = eHAL_STATUS_FAILURE;
3920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3921
3922 status = sme_AcquireGlobalLock( &pMac->sme );
3923 if ( HAL_STATUS_SUCCESS( status ) )
3924 {
3925 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3926 sme_ReleaseGlobalLock( &pMac->sme );
3927 }
3928
3929 return (status);
3930 }
3931
3932/* ---------------------------------------------------------------------------
3933 \fn sme_StopUapsd
3934 \brief Request that the device be put out of UAPSD state. Device will be
3935 put in in BMPS state after stop UAPSD completes.
3936 \param hHal - The handle returned by macOpen.
3937 \return eHalStatus
3938 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3939 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3940 ---------------------------------------------------------------------------*/
3941eHalStatus sme_StopUapsd (tHalHandle hHal)
3942{
3943 eHalStatus status = eHAL_STATUS_FAILURE;
3944 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3945
3946 status = sme_AcquireGlobalLock( &pMac->sme );
3947 if ( HAL_STATUS_SUCCESS( status ) )
3948 {
3949 status = pmcStopUapsd(hHal);
3950 sme_ReleaseGlobalLock( &pMac->sme );
3951 }
3952
3953 return (status);
3954}
3955
3956/* ---------------------------------------------------------------------------
3957 \fn sme_RequestStandby
3958 \brief Request that the device be put in standby. It is HDD's responsibility
3959 to bring the chip to full power and do a disassoc before calling
3960 this API.
3961 \param hHal - The handle returned by macOpen.
3962 \param - callbackRoutine Callback routine invoked in case of success/failure
3963 \return eHalStatus
3964 eHAL_STATUS_SUCCESS - device is in Standby mode
3965 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3966 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3967 ---------------------------------------------------------------------------*/
3968eHalStatus sme_RequestStandby (
3969 tHalHandle hHal,
3970 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3971 void *callbackContext)
3972{
3973 eHalStatus status = eHAL_STATUS_FAILURE;
3974 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3975
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07003976 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3977 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 smsLog( pMac, LOG1, FL("") );
3979 status = sme_AcquireGlobalLock( &pMac->sme );
3980 if ( HAL_STATUS_SUCCESS( status ) )
3981 {
3982 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3983 sme_ReleaseGlobalLock( &pMac->sme );
3984 }
3985
3986 return (status);
3987}
3988
3989/* ---------------------------------------------------------------------------
3990 \fn sme_RegisterPowerSaveCheck
3991 \brief Register a power save check routine that is called whenever
3992 the device is about to enter one of the power save modes.
3993 \param hHal - The handle returned by macOpen.
3994 \param checkRoutine - Power save check routine to be registered
3995 \return eHalStatus
3996 eHAL_STATUS_SUCCESS - successfully registered
3997 eHAL_STATUS_FAILURE - not successfully registered
3998 ---------------------------------------------------------------------------*/
3999eHalStatus sme_RegisterPowerSaveCheck (
4000 tHalHandle hHal,
4001 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4002{
4003 eHalStatus status = eHAL_STATUS_FAILURE;
4004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4005
4006 status = sme_AcquireGlobalLock( &pMac->sme );
4007 if ( HAL_STATUS_SUCCESS( status ) )
4008 {
4009 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4010 sme_ReleaseGlobalLock( &pMac->sme );
4011 }
4012
4013 return (status);
4014}
4015
4016/* ---------------------------------------------------------------------------
4017 \fn sme_DeregisterPowerSaveCheck
4018 \brief Deregister a power save check routine
4019 \param hHal - The handle returned by macOpen.
4020 \param checkRoutine - Power save check routine to be deregistered
4021 \return eHalStatus
4022 eHAL_STATUS_SUCCESS - successfully deregistered
4023 eHAL_STATUS_FAILURE - not successfully deregistered
4024 ---------------------------------------------------------------------------*/
4025eHalStatus sme_DeregisterPowerSaveCheck (
4026 tHalHandle hHal,
4027 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4028{
4029 eHalStatus status = eHAL_STATUS_FAILURE;
4030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4031
4032 status = sme_AcquireGlobalLock( &pMac->sme );
4033 if ( HAL_STATUS_SUCCESS( status ) )
4034 {
4035 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4036 sme_ReleaseGlobalLock( &pMac->sme );
4037 }
4038
4039 return (status);
4040}
4041
4042/* ---------------------------------------------------------------------------
4043 \fn sme_RegisterDeviceStateUpdateInd
4044 \brief Register a callback routine that is called whenever
4045 the device enters a new device state (Full Power, BMPS, UAPSD)
4046 \param hHal - The handle returned by macOpen.
4047 \param callbackRoutine - Callback routine to be registered
4048 \param callbackContext - Cookie to be passed back during callback
4049 \return eHalStatus
4050 eHAL_STATUS_SUCCESS - successfully registered
4051 eHAL_STATUS_FAILURE - not successfully registered
4052 ---------------------------------------------------------------------------*/
4053eHalStatus sme_RegisterDeviceStateUpdateInd (
4054 tHalHandle hHal,
4055 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4056 void *callbackContext)
4057{
4058 eHalStatus status = eHAL_STATUS_FAILURE;
4059 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4060
4061 status = sme_AcquireGlobalLock( &pMac->sme );
4062 if ( HAL_STATUS_SUCCESS( status ) )
4063 {
4064 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4065 sme_ReleaseGlobalLock( &pMac->sme );
4066 }
4067
4068 return (status);
4069}
4070
4071/* ---------------------------------------------------------------------------
4072 \fn sme_DeregisterDeviceStateUpdateInd
4073 \brief Deregister a routine that was registered for device state changes
4074 \param hHal - The handle returned by macOpen.
4075 \param callbackRoutine - Callback routine to be deregistered
4076 \return eHalStatus
4077 eHAL_STATUS_SUCCESS - successfully deregistered
4078 eHAL_STATUS_FAILURE - not successfully deregistered
4079 ---------------------------------------------------------------------------*/
4080eHalStatus sme_DeregisterDeviceStateUpdateInd (
4081 tHalHandle hHal,
4082 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4083{
4084 eHalStatus status = eHAL_STATUS_FAILURE;
4085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4086
4087 status = sme_AcquireGlobalLock( &pMac->sme );
4088 if ( HAL_STATUS_SUCCESS( status ) )
4089 {
4090 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4091 sme_ReleaseGlobalLock( &pMac->sme );
4092 }
4093
4094 return (status);
4095}
4096
4097/* ---------------------------------------------------------------------------
4098 \fn sme_WowlAddBcastPattern
4099 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4100 do a pattern match on these patterns when Wowl is enabled during BMPS
4101 mode. Note that Firmware performs the pattern matching only on
4102 broadcast frames and while Libra is in BMPS mode.
4103 \param hHal - The handle returned by macOpen.
4104 \param pattern - Pattern to be added
4105 \return eHalStatus
4106 eHAL_STATUS_FAILURE Cannot add pattern
4107 eHAL_STATUS_SUCCESS Request accepted.
4108 ---------------------------------------------------------------------------*/
4109eHalStatus sme_WowlAddBcastPattern (
4110 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004111 tpSirWowlAddBcastPtrn pattern,
4112 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004113{
4114 eHalStatus status = eHAL_STATUS_FAILURE;
4115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004116 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4117 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004118 status = sme_AcquireGlobalLock( &pMac->sme );
4119 if ( HAL_STATUS_SUCCESS( status ) )
4120 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004121 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004122 sme_ReleaseGlobalLock( &pMac->sme );
4123 }
4124
4125 return (status);
4126}
4127
4128/* ---------------------------------------------------------------------------
4129 \fn sme_WowlDelBcastPattern
4130 \brief Delete a pattern that was added for Pattern Byte Matching.
4131 \param hHal - The handle returned by macOpen.
4132 \param pattern - Pattern to be deleted
4133 \return eHalStatus
4134 eHAL_STATUS_FAILURE Cannot delete pattern
4135 eHAL_STATUS_SUCCESS Request accepted.
4136 ---------------------------------------------------------------------------*/
4137eHalStatus sme_WowlDelBcastPattern (
4138 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004139 tpSirWowlDelBcastPtrn pattern,
4140 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004141{
4142 eHalStatus status = eHAL_STATUS_FAILURE;
4143 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004144 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4145 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004146 status = sme_AcquireGlobalLock( &pMac->sme );
4147 if ( HAL_STATUS_SUCCESS( status ) )
4148 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004149 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 sme_ReleaseGlobalLock( &pMac->sme );
4151 }
4152
4153 return (status);
4154}
4155
4156/* ---------------------------------------------------------------------------
4157 \fn sme_EnterWowl
4158 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4159 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4160 SME will will cache the information that WOWL has been enabled and
4161 attempt to put the device in BMPS. On entry into BMPS, SME will
4162 enable the WOWL mode.
4163 Note 1: If we exit BMPS mode (someone requests full power), we
4164 will NOT resume WOWL when we go back to BMPS again. Request for full
4165 power (while in WOWL mode) means disable WOWL and go to full power.
4166 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4167 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4168 are required. Currently there is no requirement or use case to support
4169 UAPSD and WOWL at the same time.
4170
4171 \param hHal - The handle returned by macOpen.
4172 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4173 Used for success/failure notification by SME
4174 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4175 at the time of callback.
4176 \param wakeReasonIndCB - Callback routine provided by HDD.
4177 Used for Wake Reason Indication by SME
4178 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4179 at the time of callback.
4180 \return eHalStatus
4181 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4182 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4183 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4184 BMPS mode is entered.
4185 ---------------------------------------------------------------------------*/
4186eHalStatus sme_EnterWowl (
4187 tHalHandle hHal,
4188 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4189 void *enterWowlCallbackContext,
4190#ifdef WLAN_WAKEUP_EVENTS
4191 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4192 void *wakeIndicationCBContext,
4193#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004194 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004195{
4196 eHalStatus status = eHAL_STATUS_FAILURE;
4197 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004198 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4199 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004200 status = sme_AcquireGlobalLock( &pMac->sme );
4201 if ( HAL_STATUS_SUCCESS( status ) )
4202 {
4203 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
4204#ifdef WLAN_WAKEUP_EVENTS
4205 wakeIndicationCB, wakeIndicationCBContext,
4206#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004207 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 sme_ReleaseGlobalLock( &pMac->sme );
4209 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004210 return (status);
4211}
4212/* ---------------------------------------------------------------------------
4213 \fn sme_ExitWowl
4214 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4215 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4216 mode.
4217 \param hHal - The handle returned by macOpen.
4218 \return eHalStatus
4219 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4220 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4221 ---------------------------------------------------------------------------*/
4222eHalStatus sme_ExitWowl (tHalHandle hHal)
4223{
4224 eHalStatus status = eHAL_STATUS_FAILURE;
4225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004226 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4227 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 status = sme_AcquireGlobalLock( &pMac->sme );
4229 if ( HAL_STATUS_SUCCESS( status ) )
4230 {
4231 status = pmcExitWowl (hHal);
4232 sme_ReleaseGlobalLock( &pMac->sme );
4233 }
4234
4235 return (status);
4236}
4237
4238/* ---------------------------------------------------------------------------
4239
4240 \fn sme_RoamSetKey
4241
4242 \brief To set encryption key. This function should be called only when connected
4243 This is an asynchronous API.
4244
4245 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4246
4247 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4248
4249 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4250
4251 FAILURE or RESOURCES The API finished and failed.
4252
4253 -------------------------------------------------------------------------------*/
4254eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4255{
4256 eHalStatus status = eHAL_STATUS_FAILURE;
4257 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4258 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 tANI_U32 i;
4260 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004261
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004262 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4263 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004264 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4265 {
4266 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4267 return eHAL_STATUS_FAILURE;
4268 }
4269
Jeff Johnson295189b2012-06-20 16:38:30 -07004270 status = sme_AcquireGlobalLock( &pMac->sme );
4271 if ( HAL_STATUS_SUCCESS( status ) )
4272 {
4273 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4274 if(pRoamId)
4275 {
4276 *pRoamId = roamId;
4277 }
4278
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004279 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004280
4281 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004282 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004283
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004284 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004285
4286 pSession = CSR_GET_SESSION(pMac, sessionId);
4287
Jeff Johnson32d95a32012-09-10 13:15:23 -07004288 if(!pSession)
4289 {
4290 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004291 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004292 return eHAL_STATUS_FAILURE;
4293 }
4294
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4296 {
4297 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4298 {
4299 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4300 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4301 {
4302 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4303 }
4304 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4305 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4306 {
4307 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4308 }
4309 }
4310 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004311
4312 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4313 sme_ReleaseGlobalLock( &pMac->sme );
4314 }
4315
4316 return (status);
4317}
4318
4319
4320/* ---------------------------------------------------------------------------
4321
4322 \fn sme_RoamRemoveKey
4323
4324 \brief To set encryption key. This is an asynchronous API.
4325
4326 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4327
4328 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4329
4330 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4331
4332 FAILURE or RESOURCES The API finished and failed.
4333
4334 -------------------------------------------------------------------------------*/
4335eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4336 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4337{
4338 eHalStatus status = eHAL_STATUS_FAILURE;
4339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4340 tANI_U32 roamId;
4341
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004342 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4343 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 status = sme_AcquireGlobalLock( &pMac->sme );
4345 if ( HAL_STATUS_SUCCESS( status ) )
4346 {
4347 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4348 if(pRoamId)
4349 {
4350 *pRoamId = roamId;
4351 }
4352 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4353 sme_ReleaseGlobalLock( &pMac->sme );
4354 }
4355
4356 return (status);
4357}
4358
4359/* ---------------------------------------------------------------------------
4360 \fn sme_GetRssi
4361 \brief a wrapper function that client calls to register a callback to get RSSI
4362
4363 \param callback - SME sends back the requested stats using the callback
4364 \param staId - The station ID for which the stats is requested for
4365 \param pContext - user context to be passed back along with the callback
4366 \param pVosContext - vos context
4367 \return eHalStatus
4368 ---------------------------------------------------------------------------*/
4369eHalStatus sme_GetRssi(tHalHandle hHal,
4370 tCsrRssiCallback callback,
4371 tANI_U8 staId, tCsrBssid bssId,
4372 void *pContext, void* pVosContext)
4373{
4374 eHalStatus status = eHAL_STATUS_FAILURE;
4375 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4376
4377 status = sme_AcquireGlobalLock( &pMac->sme );
4378 if ( HAL_STATUS_SUCCESS( status ) )
4379 {
4380 status = csrGetRssi( pMac, callback,
4381 staId, bssId, pContext, pVosContext);
4382 sme_ReleaseGlobalLock( &pMac->sme );
4383 }
4384 return (status);
4385}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304386
4387/* ---------------------------------------------------------------------------
4388 \fn sme_GetSnr
4389 \brief a wrapper function that client calls to register a callback to
4390 get SNR
4391
4392 \param callback - SME sends back the requested stats using the callback
4393 \param staId - The station ID for which the stats is requested for
4394 \param pContext - user context to be passed back along with the callback
4395 \param pVosContext - vos context
4396 \return eHalStatus
4397 ---------------------------------------------------------------------------*/
4398eHalStatus sme_GetSnr(tHalHandle hHal,
4399 tCsrSnrCallback callback,
4400 tANI_U8 staId, tCsrBssid bssId,
4401 void *pContext)
4402{
4403 eHalStatus status = eHAL_STATUS_FAILURE;
4404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4405
4406 status = sme_AcquireGlobalLock( &pMac->sme );
4407 if ( HAL_STATUS_SUCCESS( status ) )
4408 {
4409 status = csrGetSnr(pMac, callback,
4410 staId, bssId, pContext);
4411 sme_ReleaseGlobalLock( &pMac->sme );
4412 }
4413 return status;
4414}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004415#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4416/* ---------------------------------------------------------------------------
4417 \fn sme_GetRoamRssi
4418 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4419
4420 \param callback - SME sends back the requested stats using the callback
4421 \param staId - The station ID for which the stats is requested for
4422 \param pContext - user context to be passed back along with the callback
4423 \param pVosContext - vos context
4424 \return eHalStatus
4425 ---------------------------------------------------------------------------*/
4426eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4427 tCsrRssiCallback callback,
4428 tANI_U8 staId, tCsrBssid bssId,
4429 void *pContext, void* pVosContext)
4430{
4431 eHalStatus status = eHAL_STATUS_FAILURE;
4432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4433
4434 status = sme_AcquireGlobalLock( &pMac->sme );
4435 if ( HAL_STATUS_SUCCESS( status ) )
4436 {
4437 status = csrGetRoamRssi( pMac, callback,
4438 staId, bssId, pContext, pVosContext);
4439 sme_ReleaseGlobalLock( &pMac->sme );
4440 }
4441 return (status);
4442}
4443#endif
4444
Jeff Johnson295189b2012-06-20 16:38:30 -07004445
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004446#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4447/* ---------------------------------------------------------------------------
4448 \fn sme_GetTsmStats
4449 \brief a wrapper function that client calls to register a callback to get TSM Stats
4450
4451 \param callback - SME sends back the requested stats using the callback
4452 \param staId - The station ID for which the stats is requested for
4453 \param pContext - user context to be passed back along with the callback
4454 \param pVosContext - vos context
4455 \return eHalStatus
4456 ---------------------------------------------------------------------------*/
4457eHalStatus sme_GetTsmStats(tHalHandle hHal,
4458 tCsrTsmStatsCallback callback,
4459 tANI_U8 staId, tCsrBssid bssId,
4460 void *pContext, void* pVosContext, tANI_U8 tid)
4461{
4462 eHalStatus status = eHAL_STATUS_FAILURE;
4463 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4464
4465 status = sme_AcquireGlobalLock( &pMac->sme );
4466 if ( HAL_STATUS_SUCCESS( status ) )
4467 {
4468 status = csrGetTsmStats( pMac, callback,
4469 staId, bssId, pContext, pVosContext, tid);
4470 sme_ReleaseGlobalLock( &pMac->sme );
4471 }
4472 return (status);
4473}
4474#endif
4475
4476
Jeff Johnson295189b2012-06-20 16:38:30 -07004477/* ---------------------------------------------------------------------------
4478 \fn sme_GetStatistics
4479 \brief a wrapper function that client calls to register a callback to get
4480 different PHY level statistics from CSR.
4481
4482 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4483 \param statsMask - The different category/categories of stats requester is looking for
4484 \param callback - SME sends back the requested stats using the callback
4485 \param periodicity - If requester needs periodic update in millisec, 0 means
4486 it's an one time request
4487 \param cache - If requester is happy with cached stats
4488 \param staId - The station ID for which the stats is requested for
4489 \param pContext - user context to be passed back along with the callback
4490 \return eHalStatus
4491 ---------------------------------------------------------------------------*/
4492eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4493 tANI_U32 statsMask,
4494 tCsrStatsCallback callback,
4495 tANI_U32 periodicity, tANI_BOOLEAN cache,
4496 tANI_U8 staId, void *pContext)
4497{
4498 eHalStatus status = eHAL_STATUS_FAILURE;
4499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4500
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004501 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4502 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 status = sme_AcquireGlobalLock( &pMac->sme );
4504 if ( HAL_STATUS_SUCCESS( status ) )
4505 {
4506 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4507 periodicity, cache, staId, pContext);
4508 sme_ReleaseGlobalLock( &pMac->sme );
4509 }
4510
4511 return (status);
4512
4513}
4514
4515/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304516 \fn smeGetTLSTAState
4517 \helper function to get the TL STA State whenever the function is called.
4518
4519 \param staId - The staID to be passed to the TL
4520 to get the relevant TL STA State
4521 \return the state as tANI_U16
4522 ---------------------------------------------------------------------------*/
4523tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4524{
4525 tANI_U16 tlSTAState = TL_INIT_STATE;
4526 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4527 eHalStatus status = eHAL_STATUS_FAILURE;
4528
4529 status = sme_AcquireGlobalLock( &pMac->sme );
4530 if ( HAL_STATUS_SUCCESS( status ) )
4531 {
4532 tlSTAState = csrGetTLSTAState( pMac, staId);
4533 sme_ReleaseGlobalLock( &pMac->sme );
4534 }
4535
4536 return tlSTAState;
4537}
4538
4539/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004540
4541 \fn sme_GetCountryCode
4542
4543 \brief To return the current country code. If no country code is applied, default country code is
4544 used to fill the buffer.
4545 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4546 This is a synchronous API.
4547
4548 \param pBuf - pointer to a caller allocated buffer for returned country code.
4549
4550 \param pbLen For input, this parameter indicates how big is the buffer.
4551 Upon return, this parameter has the number of bytes for country. If pBuf
4552 doesn't have enough space, this function returns
4553 fail status and this parameter contains the number that is needed.
4554
4555 \return eHalStatus SUCCESS.
4556
4557 FAILURE or RESOURCES The API finished and failed.
4558
4559 -------------------------------------------------------------------------------*/
4560eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4561{
4562 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4563
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004564 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4565 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4566
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4568}
4569
4570
4571/* ---------------------------------------------------------------------------
4572
4573 \fn sme_SetCountryCode
4574
4575 \brief To change the current/default country code.
4576 If 11d supported is turned off, an error is return.
4577 This is a synchronous API.
4578
4579 \param pCountry - pointer to a caller allocated buffer for the country code.
4580
4581 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4582 whether a reset is required.
4583
4584 \return eHalStatus SUCCESS.
4585
4586 FAILURE or RESOURCES The API finished and failed.
4587
4588 -------------------------------------------------------------------------------*/
4589eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4590{
4591 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4592
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004593 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4594 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4596}
4597
4598
4599/* ---------------------------------------------------------------------------
4600 \fn sme_ResetCountryCodeInformation
4601 \brief this function is to reset the country code current being used back to EEPROM default
4602 this includes channel list and power setting. This is a synchronous API.
4603 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4604 a restart is needed to apply the change
4605 \return eHalStatus
4606 -------------------------------------------------------------------------------*/
4607eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4608{
4609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4610
4611 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4612}
4613
4614
4615/* ---------------------------------------------------------------------------
4616 \fn sme_GetSupportedCountryCode
4617 \brief this function is to get a list of the country code current being supported
4618 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4619 this has the country code list. 3 bytes for each country code. This may be NULL if
4620 caller wants to know the needed byte count.
4621 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4622 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4623 \return eHalStatus
4624 -------------------------------------------------------------------------------*/
4625eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4626{
4627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4628
4629 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4630}
4631
4632
4633/* ---------------------------------------------------------------------------
4634 \fn sme_GetCurrentRegulatoryDomain
4635 \brief this function is to get the current regulatory domain. This is a synchronous API.
4636 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4637 SME. The function fails if 11d support is turned off.
4638 \param pDomain - Caller allocated buffer to return the current domain.
4639 \return eHalStatus SUCCESS.
4640
4641 FAILURE or RESOURCES The API finished and failed.
4642 -------------------------------------------------------------------------------*/
4643eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4644{
4645 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4646 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4647
4648 if( pDomain )
4649 {
4650 if( csrIs11dSupported( pMac ) )
4651 {
4652 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4653 status = eHAL_STATUS_SUCCESS;
4654 }
4655 else
4656 {
4657 status = eHAL_STATUS_FAILURE;
4658 }
4659 }
4660
4661 return ( status );
4662}
4663
4664
4665/* ---------------------------------------------------------------------------
4666 \fn sme_SetRegulatoryDomain
4667 \brief this function is to set the current regulatory domain.
4668 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4669 SME. This is a synchronous API.
4670 \param domainId - indicate the domain (defined in the driver) needs to set to.
4671 See v_REGDOMAIN_t for definition
4672 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4673 a restart is needed to apply the change
4674 \return eHalStatus
4675 -------------------------------------------------------------------------------*/
4676eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4677{
4678 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4679
4680 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4681}
4682
4683
4684/* ---------------------------------------------------------------------------
4685
4686 \fn sme_GetRegulatoryDomainForCountry
4687
4688 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4689
4690 \param pCountry - pointer to a caller allocated buffer for input country code.
4691
4692 \param pDomainId Upon successful return, it is the domain that country belongs to.
4693 If it is NULL, returning success means that the country code is known.
4694
4695 \return eHalStatus SUCCESS.
4696
4697 FAILURE or RESOURCES The API finished and failed.
4698
4699 -------------------------------------------------------------------------------*/
4700eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4701{
4702 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4703
Kiet Lam6c583332013-10-14 05:37:09 +05304704 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4705 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004706}
4707
4708
4709
4710
4711/* ---------------------------------------------------------------------------
4712
4713 \fn sme_GetSupportedRegulatoryDomains
4714
4715 \brief To return a list of supported regulatory domains. This is a synchronous API.
4716
4717 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4718
4719 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4720 Upon return, this parameter has the number for supported domains. If pDomains
4721 doesn't have enough space for all the supported domains, this function returns
4722 fail status and this parameter contains the number that is needed.
4723
4724 \return eHalStatus SUCCESS.
4725
4726 FAILURE or RESOURCES The API finished and failed.
4727
4728 -------------------------------------------------------------------------------*/
4729eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4730{
4731 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4732
4733 //We support all domains for now
4734 if( pNumDomains )
4735 {
4736 if( NUM_REG_DOMAINS <= *pNumDomains )
4737 {
4738 status = eHAL_STATUS_SUCCESS;
4739 }
4740 *pNumDomains = NUM_REG_DOMAINS;
4741 }
4742 if( HAL_STATUS_SUCCESS( status ) )
4743 {
4744 if( pDomains )
4745 {
4746 pDomains[0] = REGDOMAIN_FCC;
4747 pDomains[1] = REGDOMAIN_ETSI;
4748 pDomains[2] = REGDOMAIN_JAPAN;
4749 pDomains[3] = REGDOMAIN_WORLD;
4750 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4751 pDomains[5] = REGDOMAIN_APAC;
4752 pDomains[6] = REGDOMAIN_KOREA;
4753 pDomains[7] = REGDOMAIN_HI_5GHZ;
4754 pDomains[8] = REGDOMAIN_NO_5GHZ;
4755 }
4756 else
4757 {
4758 status = eHAL_STATUS_INVALID_PARAMETER;
4759 }
4760 }
4761
4762 return ( status );
4763}
4764
4765
4766//some support functions
4767tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4768{
4769 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4770
4771 return ( csrIs11dSupported( pMac ) );
4772}
4773
4774
4775tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4776{
4777 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4778
4779 return ( csrIs11hSupported( pMac ) );
4780}
4781
4782
4783tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4784{
4785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4786
4787 return ( csrIsWmmSupported( pMac ) );
4788}
4789
4790//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4791eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4792{
4793 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4794
4795 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4796}
4797
4798/* ---------------------------------------------------------------------------
4799
4800 \fn sme_ChangeCountryCode
4801
4802 \brief Change Country code from upperlayer during WLAN driver operation.
4803 This is a synchronous API.
4804
4805 \param hHal - The handle returned by macOpen.
4806
4807 \param pCountry New Country Code String
4808
4809 \return eHalStatus SUCCESS.
4810
4811 FAILURE or RESOURCES The API finished and failed.
4812
4813 -------------------------------------------------------------------------------*/
4814eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4815 tSmeChangeCountryCallback callback,
4816 tANI_U8 *pCountry,
4817 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304818 void* pVosContext,
4819 tAniBool countryFromUserSpace )
Jeff Johnson295189b2012-06-20 16:38:30 -07004820{
4821 eHalStatus status = eHAL_STATUS_FAILURE;
4822 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4823 vos_msg_t msg;
4824 tAniChangeCountryCodeReq *pMsg;
4825
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07004826 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
4827 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 status = sme_AcquireGlobalLock( &pMac->sme );
4829 if ( HAL_STATUS_SUCCESS( status ) )
4830 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004831 smsLog(pMac, LOG1, FL(" called"));
Kiet Lam64c1b492013-07-12 13:56:44 +05304832 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
4833 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07004834 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004835 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004836 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05304837 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004838 }
4839
4840 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4841 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05304842 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304843 pMsg->countryFromUserSpace = countryFromUserSpace;
Jeff Johnson295189b2012-06-20 16:38:30 -07004844 pMsg->changeCCCallback = callback;
4845 pMsg->pDevContext = pContext;
4846 pMsg->pVosContext = pVosContext;
4847
4848 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4849 msg.bodyptr = pMsg;
4850 msg.reserved = 0;
4851
4852 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4853 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004854 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05304855 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 status = eHAL_STATUS_FAILURE;
4857 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004858 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 sme_ReleaseGlobalLock( &pMac->sme );
4860 }
4861
4862 return (status);
4863}
Amar Singhal0d15bd52013-10-12 23:13:13 -07004864
4865/*--------------------------------------------------------------------------
4866
4867 \fn sme_GenericChangeCountryCode
4868
4869 \brief Change Country code from upperlayer during WLAN driver operation.
4870 This is a synchronous API.
4871
4872 \param hHal - The handle returned by macOpen.
4873
4874 \param pCountry New Country Code String
4875
4876 \param reg_domain regulatory domain
4877
4878 \return eHalStatus SUCCESS.
4879
4880 FAILURE or RESOURCES The API finished and failed.
4881
4882-----------------------------------------------------------------------------*/
4883eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
4884 tANI_U8 *pCountry,
4885 v_REGDOMAIN_t reg_domain)
4886{
4887 eHalStatus status = eHAL_STATUS_FAILURE;
4888 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4889 vos_msg_t msg;
4890 tAniGenericChangeCountryCodeReq *pMsg;
4891
Kiet Lamcffc5862013-10-30 16:28:45 +05304892 if (NULL == pMac)
4893 {
4894 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
4895 "%s: pMac is null", __func__);
4896 return status;
4897 }
4898
Amar Singhal0d15bd52013-10-12 23:13:13 -07004899 status = sme_AcquireGlobalLock( &pMac->sme );
4900 if ( HAL_STATUS_SUCCESS( status ) )
4901 {
4902 smsLog(pMac, LOG1, FL(" called"));
4903 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg,
4904 sizeof(tAniGenericChangeCountryCodeReq));
4905
4906 if (!HAL_STATUS_SUCCESS(status))
4907 {
4908 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
4909 sme_ReleaseGlobalLock( &pMac->sme );
4910 return status;
4911 }
4912
4913 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
4914 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
4915 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
4916 pMsg->domain_index = reg_domain;
4917
4918 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
4919 msg.bodyptr = pMsg;
4920 msg.reserved = 0;
4921
4922 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4923 {
4924 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
4925 palFreeMemory(pMac->hHdd, (void *)pMsg);
4926 status = eHAL_STATUS_FAILURE;
4927 }
4928 smsLog(pMac, LOG1, FL(" returned"));
4929 sme_ReleaseGlobalLock( &pMac->sme );
4930 }
4931
4932 return (status);
4933}
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05304934/* ---------------------------------------------------------------------------
4935
4936 \fn sme_DHCPStartInd
4937
4938 \brief API to signal the FW about the DHCP Start event.
4939
4940 \param hHal - HAL handle for device.
4941
4942 \param device_mode - mode(AP,SAP etc) of the device.
4943
4944 \param macAddr - MAC address of the device.
4945
4946 \return eHalStatus SUCCESS.
4947
4948 FAILURE or RESOURCES The API finished and failed.
4949 --------------------------------------------------------------------------*/
4950eHalStatus sme_DHCPStartInd( tHalHandle hHal,
4951 tANI_U8 device_mode,
4952 tANI_U8 *macAddr )
4953{
4954 eHalStatus status;
4955 VOS_STATUS vosStatus;
4956 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4957 vos_msg_t vosMessage;
4958 tAniDHCPInd *pMsg;
4959
4960 status = sme_AcquireGlobalLock(&pMac->sme);
4961 if ( eHAL_STATUS_SUCCESS == status)
4962 {
4963 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
4964 if (NULL == pMsg)
4965 {
4966 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4967 "%s: Not able to allocate memory for dhcp start", __func__);
4968 sme_ReleaseGlobalLock( &pMac->sme );
4969 return eHAL_STATUS_FAILURE;
4970 }
4971 pMsg->msgType = WDA_DHCP_START_IND;
4972 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
4973 pMsg->device_mode = device_mode;
4974 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
4975
4976 vosMessage.type = WDA_DHCP_START_IND;
4977 vosMessage.bodyptr = pMsg;
4978 vosMessage.reserved = 0;
4979
4980 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
4981 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
4982 {
4983 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4984 "%s: Post DHCP Start MSG fail", __func__);
4985 vos_mem_free(pMsg);
4986 status = eHAL_STATUS_FAILURE;
4987 }
4988 sme_ReleaseGlobalLock( &pMac->sme );
4989 }
4990 return (status);
4991}
4992/* ---------------------------------------------------------------------------
4993 \fn sme_DHCPStopInd
4994
4995 \brief API to signal the FW about the DHCP complete event.
4996
4997 \param hHal - HAL handle for device.
4998
4999 \param device_mode - mode(AP, SAP etc) of the device.
5000
5001 \param macAddr - MAC address of the device.
5002
5003 \return eHalStatus SUCCESS.
5004 FAILURE or RESOURCES The API finished and failed.
5005 --------------------------------------------------------------------------*/
5006eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5007 tANI_U8 device_mode,
5008 tANI_U8 *macAddr )
5009{
5010 eHalStatus status;
5011 VOS_STATUS vosStatus;
5012 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5013 vos_msg_t vosMessage;
5014 tAniDHCPInd *pMsg;
5015
5016 status = sme_AcquireGlobalLock(&pMac->sme);
5017 if ( eHAL_STATUS_SUCCESS == status)
5018 {
5019 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5020 if (NULL == pMsg)
5021 {
5022 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5023 "%s: Not able to allocate memory for dhcp stop", __func__);
5024 sme_ReleaseGlobalLock( &pMac->sme );
5025 return eHAL_STATUS_FAILURE;
5026 }
5027
5028 pMsg->msgType = WDA_DHCP_STOP_IND;
5029 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5030 pMsg->device_mode = device_mode;
5031 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
5032
5033 vosMessage.type = WDA_DHCP_STOP_IND;
5034 vosMessage.bodyptr = pMsg;
5035 vosMessage.reserved = 0;
5036
5037 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5038 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5039 {
5040 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5041 "%s: Post DHCP Stop MSG fail", __func__);
5042 vos_mem_free(pMsg);
5043 status = eHAL_STATUS_FAILURE;
5044 }
5045
5046 sme_ReleaseGlobalLock( &pMac->sme );
5047 }
5048 return (status);
5049}
5050
Jeff Johnson295189b2012-06-20 16:38:30 -07005051
5052/* ---------------------------------------------------------------------------
5053 \fn sme_BtcSignalBtEvent
5054 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5055 BT event type and the current operating mode of Libra (full power,
5056 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5057 would be employed.
5058 \param hHal - The handle returned by macOpen.
5059 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5060 Caller owns the memory and is responsible for freeing it.
5061 \return VOS_STATUS
5062 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5063 if BTC execution mode is set to BTC_WLAN_ONLY
5064 or BTC_PTA_ONLY.
5065 VOS_STATUS_SUCCESS BT Event passed to HAL
5066 ---------------------------------------------------------------------------*/
5067VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5068{
5069 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005070
Jeff Johnson295189b2012-06-20 16:38:30 -07005071#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5072 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5073
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005074 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5075 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005076 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5077 {
5078 status = btcSignalBTEvent (hHal, pBtEvent);
5079 sme_ReleaseGlobalLock( &pMac->sme );
5080 }
5081#endif
5082 return (status);
5083}
5084
5085/* ---------------------------------------------------------------------------
5086 \fn sme_BtcSetConfig
5087 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5088 This function should be invoked only after CFG download has completed.
5089 Calling it after sme_HDDReadyInd is recommended.
5090 \param hHal - The handle returned by macOpen.
5091 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5092 Caller owns the memory and is responsible for freeing it.
5093 \return VOS_STATUS
5094 VOS_STATUS_E_FAILURE Config not passed to HAL.
5095 VOS_STATUS_SUCCESS Config passed to HAL
5096 ---------------------------------------------------------------------------*/
5097VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5098{
5099 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5100#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005102 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5103 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005104 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5105 {
5106 status = btcSetConfig (hHal, pSmeBtcConfig);
5107 sme_ReleaseGlobalLock( &pMac->sme );
5108 }
5109#endif
5110 return (status);
5111}
5112
5113/* ---------------------------------------------------------------------------
5114 \fn sme_BtcGetConfig
5115 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5116 \param hHal - The handle returned by macOpen.
5117 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5118 tSmeBtcConfig. Caller owns the memory and is responsible
5119 for freeing it.
5120 \return VOS_STATUS
5121 VOS_STATUS_E_FAILURE - failure
5122 VOS_STATUS_SUCCESS success
5123 ---------------------------------------------------------------------------*/
5124VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5125{
5126 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5127#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5128 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5129
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005130 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5131 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005132 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5133 {
5134 status = btcGetConfig (hHal, pSmeBtcConfig);
5135 sme_ReleaseGlobalLock( &pMac->sme );
5136 }
5137#endif
5138 return (status);
5139}
5140/* ---------------------------------------------------------------------------
5141 \fn sme_SetCfgPrivacy
5142 \brief API to set configure privacy parameters
5143 \param hHal - The handle returned by macOpen.
5144 \param pProfile - Pointer CSR Roam profile.
5145 \param fPrivacy - This parameter indicates status of privacy
5146
5147 \return void
5148 ---------------------------------------------------------------------------*/
5149void sme_SetCfgPrivacy( tHalHandle hHal,
5150 tCsrRoamProfile *pProfile,
5151 tANI_BOOLEAN fPrivacy
5152 )
5153{
5154 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005155 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5156 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005157 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5158 {
5159 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5160 sme_ReleaseGlobalLock( &pMac->sme );
5161 }
5162}
5163
5164#if defined WLAN_FEATURE_VOWIFI
5165/* ---------------------------------------------------------------------------
5166 \fn sme_NeighborReportRequest
5167 \brief API to request neighbor report.
5168 \param hHal - The handle returned by macOpen.
5169 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5170 tRrmNeighborReq. Caller owns the memory and is responsible
5171 for freeing it.
5172 \return VOS_STATUS
5173 VOS_STATUS_E_FAILURE - failure
5174 VOS_STATUS_SUCCESS success
5175 ---------------------------------------------------------------------------*/
5176VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5177 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5178{
5179 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005181 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5182 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005183
5184 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5185 {
5186 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5187 sme_ReleaseGlobalLock( &pMac->sme );
5188 }
5189
5190 return (status);
5191}
5192#endif
5193
5194//The following are debug APIs to support direct read/write register/memory
5195//They are placed in SME because HW cannot be access when in LOW_POWER state
5196//AND not connected. The knowledge and synchronization is done in SME
5197
5198//sme_DbgReadRegister
5199//Caller needs to validate the input values
5200VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5201{
5202 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5203 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005204 tPmcPowerState PowerState;
5205 tANI_U32 sessionId = 0;
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005206 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5207 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005208
5209 /* 1) To make Quarky work in FTM mode **************************************/
5210
5211 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5212 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005213 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005214 {
5215 return VOS_STATUS_SUCCESS;
5216 }
5217 return VOS_STATUS_E_FAILURE;
5218 }
5219
5220 /* 2) NON FTM mode driver *************************************************/
5221
5222 /* Acquire SME global lock */
5223 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5224 {
5225 return VOS_STATUS_E_FAILURE;
5226 }
5227
5228 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5229 {
5230 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5231 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5232 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005233 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005234 {
5235 status = VOS_STATUS_SUCCESS;
5236 }
5237 else
5238 {
5239 status = VOS_STATUS_E_FAILURE;
5240 }
5241 }
5242 else
5243 {
5244 status = VOS_STATUS_E_FAILURE;
5245 }
5246 }
5247
5248 /* This is a hack for Qualky/pttWniSocket
5249 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5250 if ( VOS_STATUS_SUCCESS != status )
5251 {
5252 *pRegValue = 0xDEADBEEF;
5253 status = VOS_STATUS_SUCCESS;
5254 }
5255
5256 /* Release SME global lock */
5257 sme_ReleaseGlobalLock(&pMac->sme);
5258
5259 return (status);
5260}
5261
5262
5263//sme_DbgWriteRegister
5264//Caller needs to validate the input values
5265VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5266{
5267 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5268 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005269 tPmcPowerState PowerState;
5270 tANI_U32 sessionId = 0;
5271
5272 /* 1) To make Quarky work in FTM mode **************************************/
5273
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005274 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5275 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005276 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5277 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005278 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005279 {
5280 return VOS_STATUS_SUCCESS;
5281 }
5282 return VOS_STATUS_E_FAILURE;
5283 }
5284
5285 /* 2) NON FTM mode driver *************************************************/
5286
5287 /* Acquire SME global lock */
5288 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5289 {
5290 return VOS_STATUS_E_FAILURE;
5291 }
5292
5293 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5294 {
5295 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5296 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5297 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005298 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005299 {
5300 status = VOS_STATUS_SUCCESS;
5301 }
5302 else
5303 {
5304 status = VOS_STATUS_E_FAILURE;
5305 }
5306 }
5307 else
5308 {
5309 status = VOS_STATUS_E_FAILURE;
5310 }
5311 }
5312
5313 /* Release SME global lock */
5314 sme_ReleaseGlobalLock(&pMac->sme);
5315
5316 return (status);
5317}
5318
5319
5320
5321//sme_DbgReadMemory
5322//Caller needs to validate the input values
5323//pBuf caller allocated buffer has the length of nLen
5324VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5325{
5326 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5327 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005328 tPmcPowerState PowerState;
5329 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005330 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5331 tANI_U32 arg1 = memAddr;
5332 tANI_U32 arg2 = nLen/4;
5333 tANI_U32 arg3 = 4;
5334 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005335 /* 1) To make Quarky work in FTM mode **************************************/
5336
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005337 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5338 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005339 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5340 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005341 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005342 {
5343 return VOS_STATUS_SUCCESS;
5344 }
5345 return VOS_STATUS_E_FAILURE;
5346 }
5347
5348 /* 2) NON FTM mode driver *************************************************/
5349
5350 /* Acquire SME global lock */
5351 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5352 {
5353 return VOS_STATUS_E_FAILURE;
5354 }
5355
5356 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5357 {
5358 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5359 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5360 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005361 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005362 {
5363 status = VOS_STATUS_SUCCESS;
5364 }
5365 else
5366 {
5367 status = VOS_STATUS_E_FAILURE;
5368 }
5369 }
5370 else
5371 {
5372 status = VOS_STATUS_E_FAILURE;
5373 }
5374 }
5375
5376 /* This is a hack for Qualky/pttWniSocket
5377 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5378 if (VOS_STATUS_SUCCESS != status)
5379 {
5380 vos_mem_set(pBuf, nLen, 0xCD);
5381 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005382 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005383 }
5384
5385 /* Release SME lock */
5386 sme_ReleaseGlobalLock(&pMac->sme);
5387
5388 return (status);
5389}
5390
5391
5392//sme_DbgWriteMemory
5393//Caller needs to validate the input values
5394VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5395{
5396 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5397 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005398 tPmcPowerState PowerState;
5399 tANI_U32 sessionId = 0;
5400
5401 /* 1) To make Quarky work in FTM mode **************************************/
5402
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005403 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5404 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005405 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5406 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005407 {
5408 return VOS_STATUS_SUCCESS;
5409 }
5410 return VOS_STATUS_E_FAILURE;
5411 }
5412
5413 /* 2) NON FTM mode driver *************************************************/
5414
5415 /* Acquire SME global lock */
5416 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5417 {
5418 return VOS_STATUS_E_FAILURE;
5419 }
5420
5421 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5422 {
5423 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5424 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5425 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005426 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005427 {
5428 status = VOS_STATUS_SUCCESS;
5429 }
5430 else
5431 {
5432 status = VOS_STATUS_E_FAILURE;
5433 }
5434 }
5435 else
5436 {
5437 status = VOS_STATUS_E_FAILURE;
5438 }
5439 }
5440
5441 /* Release Global lock */
5442 sme_ReleaseGlobalLock(&pMac->sme);
5443
5444 return (status);
5445}
5446
5447
Katya Nigam70d68332013-09-16 16:49:45 +05305448void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5449{
5450 VOS_TRACE_LEVEL vosDebugLevel;
5451 char logBuffer[LOG_SIZE];
5452 va_list marker;
5453
5454 /* getting proper Debug level */
5455 vosDebugLevel = getVosDebugLevel(loglevel);
5456
5457 /* extracting arguments from pstring */
5458 va_start( marker, pString );
5459 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5460
5461 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5462 va_end( marker );
5463}
5464
5465
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005466void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005467{
5468#ifdef WLAN_DEBUG
5469 // Verify against current log level
5470 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5471 return;
5472 else
5473 {
5474 va_list marker;
5475
5476 va_start( marker, pString ); /* Initialize variable arguments. */
5477
5478 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5479
5480 va_end( marker ); /* Reset variable arguments. */
5481 }
5482#endif
5483}
Jeff Johnson295189b2012-06-20 16:38:30 -07005484
Jeff Johnson295189b2012-06-20 16:38:30 -07005485/* ---------------------------------------------------------------------------
5486 \fn sme_GetWcnssWlanCompiledVersion
5487 \brief This API returns the version of the WCNSS WLAN API with
5488 which the HOST driver was built
5489 \param hHal - The handle returned by macOpen.
5490 \param pVersion - Points to the Version structure to be filled
5491 \return VOS_STATUS
5492 VOS_STATUS_E_INVAL - failure
5493 VOS_STATUS_SUCCESS success
5494 ---------------------------------------------------------------------------*/
5495VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5496 tSirVersionType *pVersion)
5497{
5498 VOS_STATUS status = VOS_STATUS_SUCCESS;
5499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5500 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5501
5502 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5503 {
5504 if( pVersion != NULL )
5505 {
5506 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5507 }
5508 else
5509 {
5510 status = VOS_STATUS_E_INVAL;
5511 }
5512 sme_ReleaseGlobalLock( &pMac->sme );
5513 }
5514
5515 return (status);
5516}
5517
5518
5519/* ---------------------------------------------------------------------------
5520 \fn sme_GetWcnssWlanReportedVersion
5521 \brief This API returns the version of the WCNSS WLAN API with
5522 which the WCNSS driver reports it was built
5523 \param hHal - The handle returned by macOpen.
5524 \param pVersion - Points to the Version structure to be filled
5525 \return VOS_STATUS
5526 VOS_STATUS_E_INVAL - failure
5527 VOS_STATUS_SUCCESS success
5528 ---------------------------------------------------------------------------*/
5529VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5530 tSirVersionType *pVersion)
5531{
5532 VOS_STATUS status = VOS_STATUS_SUCCESS;
5533 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5534 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5535
5536 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5537 {
5538 if( pVersion != NULL )
5539 {
5540 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5541 }
5542 else
5543 {
5544 status = VOS_STATUS_E_INVAL;
5545 }
5546 sme_ReleaseGlobalLock( &pMac->sme );
5547 }
5548
5549 return (status);
5550}
5551
5552
5553/* ---------------------------------------------------------------------------
5554 \fn sme_GetWcnssSoftwareVersion
5555 \brief This API returns the version string of the WCNSS driver
5556 \param hHal - The handle returned by macOpen.
5557 \param pVersion - Points to the Version string buffer to be filled
5558 \param versionBufferSize - THe size of the Version string buffer
5559 \return VOS_STATUS
5560 VOS_STATUS_E_INVAL - failure
5561 VOS_STATUS_SUCCESS success
5562 ---------------------------------------------------------------------------*/
5563VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5564 tANI_U8 *pVersion,
5565 tANI_U32 versionBufferSize)
5566{
5567 VOS_STATUS status = VOS_STATUS_SUCCESS;
5568 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5569 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5570
5571 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5572 {
5573 if( pVersion != NULL )
5574 {
5575 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5576 versionBufferSize);
5577 }
5578 else
5579 {
5580 status = VOS_STATUS_E_INVAL;
5581 }
5582 sme_ReleaseGlobalLock( &pMac->sme );
5583 }
5584
5585 return (status);
5586}
5587
5588
5589/* ---------------------------------------------------------------------------
5590 \fn sme_GetWcnssHardwareVersion
5591 \brief This API returns the version string of the WCNSS hardware
5592 \param hHal - The handle returned by macOpen.
5593 \param pVersion - Points to the Version string buffer to be filled
5594 \param versionBufferSize - THe size of the Version string buffer
5595 \return VOS_STATUS
5596 VOS_STATUS_E_INVAL - failure
5597 VOS_STATUS_SUCCESS success
5598 ---------------------------------------------------------------------------*/
5599VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5600 tANI_U8 *pVersion,
5601 tANI_U32 versionBufferSize)
5602{
5603 VOS_STATUS status = VOS_STATUS_SUCCESS;
5604 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5605 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5606
5607 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5608 {
5609 if( pVersion != NULL )
5610 {
5611 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5612 versionBufferSize);
5613 }
5614 else
5615 {
5616 status = VOS_STATUS_E_INVAL;
5617 }
5618 sme_ReleaseGlobalLock( &pMac->sme );
5619 }
5620
5621 return (status);
5622}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005623
Jeff Johnson295189b2012-06-20 16:38:30 -07005624
5625#ifdef FEATURE_WLAN_WAPI
5626/* ---------------------------------------------------------------------------
5627 \fn sme_RoamSetBKIDCache
5628 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5629 candidate list.
5630 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5631 it is opened (by calling halOpen).
5632 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5633 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5634 when retruning, this is the number of items put into pBKIDCache
5635 \return eHalStatus - when fail, it usually means the buffer allocated is not
5636 big enough and pNumItems has the number of tBkidCacheInfo.
5637 ---------------------------------------------------------------------------*/
5638eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5639 tANI_U32 numItems )
5640{
5641 eHalStatus status = eHAL_STATUS_FAILURE;
5642 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5643
5644 status = sme_AcquireGlobalLock( &pMac->sme );
5645 if ( HAL_STATUS_SUCCESS( status ) )
5646 {
5647 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5648 sme_ReleaseGlobalLock( &pMac->sme );
5649 }
5650
5651 return (status);
5652}
5653
5654/* ---------------------------------------------------------------------------
5655 \fn sme_RoamGetBKIDCache
5656 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5657 BKID cache.
5658 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5659 it is opened (by calling halOpen).
5660 \param pNum - caller allocated memory that has the space of the number of
5661 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5662 in SME cache.
5663 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5664 upon return
5665 \return eHalStatus - when fail, it usually means the buffer allocated is not
5666 big enough.
5667 ---------------------------------------------------------------------------*/
5668eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5669 tBkidCacheInfo *pBkidCache)
5670{
5671 eHalStatus status = eHAL_STATUS_FAILURE;
5672 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5673
5674 status = sme_AcquireGlobalLock( &pMac->sme );
5675 if ( HAL_STATUS_SUCCESS( status ) )
5676 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005677 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005678 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5679 sme_ReleaseGlobalLock( &pMac->sme );
5680 }
5681
5682 return (status);
5683}
5684
5685/* ---------------------------------------------------------------------------
5686 \fn sme_RoamGetNumBKIDCache
5687 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5688 number of BKID cache entries.
5689 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5690 it is opened (by calling halOpen).
5691 \return tANI_U32 - the number of BKID cache entries.
5692 ---------------------------------------------------------------------------*/
5693tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5694{
5695 eHalStatus status = eHAL_STATUS_FAILURE;
5696 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5697 tANI_U32 numBkidCache = 0;
5698
5699 status = sme_AcquireGlobalLock( &pMac->sme );
5700 if ( HAL_STATUS_SUCCESS( status ) )
5701 {
5702 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5703 sme_ReleaseGlobalLock( &pMac->sme );
5704 }
5705
5706 return (numBkidCache);
5707}
5708
5709/* ---------------------------------------------------------------------------
5710 \fn sme_ScanGetBKIDCandidateList
5711 \brief a wrapper function to return the BKID candidate list
5712 \param pBkidList - caller allocated buffer point to an array of
5713 tBkidCandidateInfo
5714 \param pNumItems - pointer to a variable that has the number of
5715 tBkidCandidateInfo allocated when retruning, this is
5716 either the number needed or number of items put into
5717 pPmkidList
5718 \return eHalStatus - when fail, it usually means the buffer allocated is not
5719 big enough and pNumItems
5720 has the number of tBkidCandidateInfo.
5721 \Note: pNumItems is a number of tBkidCandidateInfo,
5722 not sizeof(tBkidCandidateInfo) * something
5723 ---------------------------------------------------------------------------*/
5724eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5725 tBkidCandidateInfo *pBkidList,
5726 tANI_U32 *pNumItems )
5727{
5728 eHalStatus status = eHAL_STATUS_FAILURE;
5729 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5730
5731 status = sme_AcquireGlobalLock( &pMac->sme );
5732 if ( HAL_STATUS_SUCCESS( status ) )
5733 {
5734 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5735 sme_ReleaseGlobalLock( &pMac->sme );
5736 }
5737
5738 return (status);
5739}
5740#endif /* FEATURE_WLAN_WAPI */
5741
Jeff Johnsone7245742012-09-05 17:12:55 -07005742#ifdef FEATURE_OEM_DATA_SUPPORT
5743
5744/*****************************************************************************
5745 OEM DATA related modifications and function additions
5746 *****************************************************************************/
5747
5748/* ---------------------------------------------------------------------------
5749 \fn sme_getOemDataRsp
5750 \brief a wrapper function to obtain the OEM DATA RSP
5751 \param pOemDataRsp - A pointer to the response object
5752 \param pContext - a pointer passed in for the callback
5753 \return eHalStatus
5754 ---------------------------------------------------------------------------*/
5755eHalStatus sme_getOemDataRsp(tHalHandle hHal,
5756 tOemDataRsp **pOemDataRsp)
5757{
5758 eHalStatus status = eHAL_STATUS_SUCCESS;
5759 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5760
5761 do
5762 {
5763 //acquire the lock for the sme object
5764 status = sme_AcquireGlobalLock(&pMac->sme);
5765
5766 if(!HAL_STATUS_SUCCESS(status))
5767 {
5768 break;
5769 }
5770
5771 if(pMac->oemData.pOemDataRsp != NULL)
5772 {
5773 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5774 }
5775 else
5776 {
5777 status = eHAL_STATUS_FAILURE;
5778 }
5779
5780 //release the lock for the sme object
5781 sme_ReleaseGlobalLock( &pMac->sme );
5782
5783 } while(0);
5784
5785 return status;
5786}
5787
5788/* ---------------------------------------------------------------------------
5789 \fn sme_OemDataReq
5790 \brief a wrapper function for OEM DATA REQ
5791 \param sessionId - session id to be used.
5792 \param pOemDataReqId - pointer to an object to get back the request ID
5793 \param callback - a callback function that is called upon finish
5794 \param pContext - a pointer passed in for the callback
5795 \return eHalStatus
5796 ---------------------------------------------------------------------------*/
5797eHalStatus sme_OemDataReq(tHalHandle hHal,
5798 tANI_U8 sessionId,
5799 tOemDataReqConfig *pOemDataReqConfig,
5800 tANI_U32 *pOemDataReqID,
5801 oemData_OemDataReqCompleteCallback callback,
5802 void *pContext)
5803{
5804 eHalStatus status = eHAL_STATUS_SUCCESS;
5805 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5806
5807 do
5808 {
5809 //acquire the lock for the sme object
5810 status = sme_AcquireGlobalLock(&pMac->sme);
5811 if(HAL_STATUS_SUCCESS(status))
5812 {
5813 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5814
5815 if(pOemDataReqID)
5816 {
5817 *pOemDataReqID = lOemDataReqId;
5818 }
5819 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005820 {
5821 sme_ReleaseGlobalLock( &pMac->sme );
5822 return eHAL_STATUS_FAILURE;
5823 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005824
5825 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5826
5827 //release the lock for the sme object
5828 sme_ReleaseGlobalLock( &pMac->sme );
5829 }
5830 } while(0);
5831
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005832 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005833
5834 return(status);
5835}
5836
5837#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005838
5839/*--------------------------------------------------------------------------
5840
5841 \brief sme_OpenSession() - Open a session for scan/roam operation.
5842
5843 This is a synchronous API.
5844
5845
5846 \param hHal - The handle returned by macOpen.
5847 \param callback - A pointer to the function caller specifies for roam/connect status indication
5848 \param pContext - The context passed with callback
5849 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5850 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5851
5852 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5853
5854 Other status means SME is failed to open the session.
5855 eHAL_STATUS_RESOURCES - no more session available.
5856 \sa
5857
5858 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005859eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
5860 void *pContext, tANI_U8 *pSelfMacAddr,
5861 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005862{
5863 eHalStatus status;
5864 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5865
5866 if( NULL == pbSessionId )
5867 {
5868 status = eHAL_STATUS_INVALID_PARAMETER;
5869 }
5870 else
5871 {
5872 status = sme_AcquireGlobalLock( &pMac->sme );
5873 if ( HAL_STATUS_SUCCESS( status ) )
5874 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005875 status = csrRoamOpenSession(pMac, callback, pContext,
5876 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005877
5878 sme_ReleaseGlobalLock( &pMac->sme );
5879 }
5880 }
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005881 if( NULL != pbSessionId )
5882 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5883 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005884
5885 return ( status );
5886}
5887
5888
5889/*--------------------------------------------------------------------------
5890
5891 \brief sme_CloseSession() - Open a session for scan/roam operation.
5892
5893 This is a synchronous API.
5894
5895
5896 \param hHal - The handle returned by macOpen.
5897
5898 \param sessionId - A previous opened session's ID.
5899
5900 \return eHAL_STATUS_SUCCESS - session is closed.
5901
5902 Other status means SME is failed to open the session.
5903 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5904 \sa
5905
5906 --------------------------------------------------------------------------*/
5907eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5908 csrRoamSessionCloseCallback callback, void *pContext)
5909{
5910 eHalStatus status;
5911 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5912
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07005913 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
5914 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005915 status = sme_AcquireGlobalLock( &pMac->sme );
5916 if ( HAL_STATUS_SUCCESS( status ) )
5917 {
5918 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5919 callback, pContext );
5920
5921 sme_ReleaseGlobalLock( &pMac->sme );
5922 }
5923
5924 return ( status );
5925}
5926
Jeff Johnson295189b2012-06-20 16:38:30 -07005927/* ---------------------------------------------------------------------------
5928
5929 \fn sme_RoamUpdateAPWPSIE
5930
5931 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5932 This is an asynchronous API.
5933
5934 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5935
5936 \return eHalStatus – SUCCESS –
5937
5938 FAILURE or RESOURCES – The API finished and failed.
5939
5940 -------------------------------------------------------------------------------*/
5941eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5942{
5943
5944 eHalStatus status = eHAL_STATUS_FAILURE;
5945 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5946
5947 status = sme_AcquireGlobalLock( &pMac->sme );
5948 if ( HAL_STATUS_SUCCESS( status ) )
5949 {
5950
5951 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5952
5953 sme_ReleaseGlobalLock( &pMac->sme );
5954 }
5955
5956 return (status);
5957}
5958/* ---------------------------------------------------------------------------
5959
5960 \fn sme_RoamUpdateAPWPARSNIEs
5961
5962 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5963 This is an asynchronous API.
5964
5965 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5966
5967 \return eHalStatus – SUCCESS –
5968
5969 FAILURE or RESOURCES – The API finished and failed.
5970
5971 -------------------------------------------------------------------------------*/
5972eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5973{
5974
5975 eHalStatus status = eHAL_STATUS_FAILURE;
5976 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5977
5978 status = sme_AcquireGlobalLock( &pMac->sme );
5979 if ( HAL_STATUS_SUCCESS( status ) )
5980 {
5981
5982 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5983
5984 sme_ReleaseGlobalLock( &pMac->sme );
5985 }
5986
5987 return (status);
5988}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005989/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005990
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005991 \fn sme_ChangeMCCBeaconInterval
5992
5993 \brief To update P2P-GO beaconInterval. This function should be called after
5994 disassociating all the station is done
5995 This is an asynchronous API.
5996
5997 \param
5998
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005999 \return eHalStatus SUCCESS
6000 FAILURE or RESOURCES
6001 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006002
6003 -------------------------------------------------------------------------------*/
6004eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6005{
6006 eHalStatus status = eHAL_STATUS_FAILURE;
6007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6008
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006009 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006010 status = sme_AcquireGlobalLock( &pMac->sme );
6011 if ( HAL_STATUS_SUCCESS( status ) )
6012 {
6013 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6014 sme_ReleaseGlobalLock( &pMac->sme );
6015 }
6016 return (status);
6017}
Jeff Johnson295189b2012-06-20 16:38:30 -07006018
6019/*-------------------------------------------------------------------------------*
6020
6021 \fn sme_sendBTAmpEvent
6022
6023 \brief to receive the coex priorty request from BT-AMP PAL
6024 and send the BT_AMP link state to HAL
6025
6026 \param btAmpEvent - btAmpEvent
6027
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006028 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006029
6030 FAILURE: API failed
6031
6032-------------------------------------------------------------------------------*/
6033
6034eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6035{
6036 vos_msg_t msg;
6037 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6038 eHalStatus status = eHAL_STATUS_FAILURE;
6039
6040 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
6041 if (NULL == ptrSmeBtAmpEvent)
6042 {
6043 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006044 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006045 return status;
6046 }
6047
6048 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6049 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6050 msg.reserved = 0;
6051 msg.bodyptr = ptrSmeBtAmpEvent;
6052
6053 //status = halFW_SendBTAmpEventMesg(pMac, event);
6054
6055 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6056 {
6057 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006058 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006059 vos_mem_free(ptrSmeBtAmpEvent);
6060 return status;
6061 }
6062
6063 return eHAL_STATUS_SUCCESS;
6064
6065}
6066
6067/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306068 \fn smeIssueFastRoamNeighborAPEvent
6069 \brief API to trigger fast BSS roam independent of RSSI triggers
6070 \param hHal - The handle returned by macOpen.
6071 \param bssid - Pointer to the BSSID to roam to.
6072 \param fastRoamTrig - Trigger to Scan or roam
6073 \return eHalStatus
6074 ---------------------------------------------------------------------------*/
6075eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6076 tANI_U8 *bssid,
6077 tSmeFastRoamTrigger fastRoamTrig)
6078{
6079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6080 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6081 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6082 eHalStatus status = eHAL_STATUS_SUCCESS;
6083
6084 status = sme_AcquireGlobalLock( &pMac->sme );
6085 if ( HAL_STATUS_SUCCESS( status ) )
6086 {
6087 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6088 "%s: invoked", __func__);
6089
6090 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6091 {
6092 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6093 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6094 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6095 (void *)bssid, sizeof(tSirMacAddr));
6096 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID %x %x %x %x %x %x",
6097 pNeighborRoamInfo->cfgRoambssId[0], pNeighborRoamInfo->cfgRoambssId[1],
6098 pNeighborRoamInfo->cfgRoambssId[2], pNeighborRoamInfo->cfgRoambssId[3],
6099 pNeighborRoamInfo->cfgRoambssId[4], pNeighborRoamInfo->cfgRoambssId[5]);
6100
6101 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6102 if (VOS_STATUS_SUCCESS != vosStatus)
6103 {
6104 smsLog(pMac, LOGE,
6105 FL("CFG Channel list scan state failed with status %d "),
6106 vosStatus);
6107 }
6108 }
6109 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6110 {
6111 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6112 (void *)bssid, sizeof(tSirMacAddr));
6113 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
6114 smsLog(pMac, LOG1, "Roam to BSSID %x-%x-%x-%x-%x-%x",
6115 pNeighborRoamInfo->cfgRoambssId[0], pNeighborRoamInfo->cfgRoambssId[1],
6116 pNeighborRoamInfo->cfgRoambssId[2], pNeighborRoamInfo->cfgRoambssId[3],
6117 pNeighborRoamInfo->cfgRoambssId[4], pNeighborRoamInfo->cfgRoambssId[5]);
6118
6119 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6120 0,
6121 pMac,
6122 0);
6123
6124 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6125 {
6126 smsLog(pMac,
6127 LOGE,
6128 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6129 vosStatus);
6130 }
6131 }
6132 sme_ReleaseGlobalLock( &pMac->sme );
6133 }
6134 return vosStatus;
6135}
6136/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006137 \fn sme_SetHostOffload
6138 \brief API to set the host offload feature.
6139 \param hHal - The handle returned by macOpen.
6140 \param pRequest - Pointer to the offload request.
6141 \return eHalStatus
6142 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006143eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
6144 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006145{
6146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006147 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006148
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006149 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6150 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006151 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6152 {
6153#ifdef WLAN_NS_OFFLOAD
6154 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6155 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006156 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006157 }
6158 else
6159#endif //WLAN_NS_OFFLOAD
6160 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006161 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006162 }
6163 sme_ReleaseGlobalLock( &pMac->sme );
6164 }
6165
6166 return (status);
6167}
6168
6169#ifdef WLAN_FEATURE_GTK_OFFLOAD
6170/* ---------------------------------------------------------------------------
6171 \fn sme_SetGTKOffload
6172 \brief API to set GTK offload information.
6173 \param hHal - The handle returned by macOpen.
6174 \param pRequest - Pointer to the GTK offload request.
6175 \return eHalStatus
6176 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006177eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
6178 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006179{
6180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6181 eHalStatus status;
6182
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006183 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6184 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006185 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6186 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006187 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006188 sme_ReleaseGlobalLock( &pMac->sme );
6189 }
6190
6191 return (status);
6192}
6193
6194/* ---------------------------------------------------------------------------
6195 \fn sme_GetGTKOffload
6196 \brief API to get GTK offload information.
6197 \param hHal - The handle returned by macOpen.
6198 \param pRequest - Pointer to the GTK offload response.
6199 \return eHalStatus
6200 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006201eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
6202 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006203{
6204 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6205 eHalStatus status;
6206
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006207 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6208 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006209 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6210 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006211 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006212 sme_ReleaseGlobalLock( &pMac->sme );
6213 }
6214
6215 return (status);
6216}
6217#endif // WLAN_FEATURE_GTK_OFFLOAD
6218
6219/* ---------------------------------------------------------------------------
6220 \fn sme_SetKeepAlive
6221 \brief API to set the Keep Alive feature.
6222 \param hHal - The handle returned by macOpen.
6223 \param pRequest - Pointer to the Keep Alive request.
6224 \return eHalStatus
6225 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006226eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
6227 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006228{
6229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6230 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006231 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6232 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006233 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006234 sme_ReleaseGlobalLock( &pMac->sme );
6235 }
6236
6237 return (status);
6238}
6239
6240#ifdef FEATURE_WLAN_SCAN_PNO
6241/* ---------------------------------------------------------------------------
6242 \fn sme_SetPreferredNetworkList
6243 \brief API to set the Preferred Network List Offload feature.
6244 \param hHal - The handle returned by macOpen.
6245 \param pRequest - Pointer to the offload request.
6246 \return eHalStatus
6247 ---------------------------------------------------------------------------*/
6248eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6249{
6250 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6251 eHalStatus status;
6252
6253 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6254 {
6255 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6256 sme_ReleaseGlobalLock( &pMac->sme );
6257 }
6258
6259 return (status);
6260}
6261
6262eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6263{
6264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6265 eHalStatus status;
6266
6267 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6268 {
6269 pmcSetRssiFilter(hHal, rssiThreshold);
6270 sme_ReleaseGlobalLock( &pMac->sme );
6271 }
6272
6273 return (status);
6274}
6275
6276#endif // FEATURE_WLAN_SCAN_PNO
6277
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006278eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006279{
6280 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6281 eHalStatus status;
6282
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006283 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6284 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006285 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6286 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006287 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006288 sme_ReleaseGlobalLock( &pMac->sme );
6289 }
6290
6291 return (status);
6292}
6293
6294/* ---------------------------------------------------------------------------
6295 \fn sme_AbortMacScan
6296 \brief API to cancel MAC scan.
6297 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306298 \param sessionId - sessionId on which we need to abort scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006299 \return VOS_STATUS
6300 VOS_STATUS_E_FAILURE - failure
6301 VOS_STATUS_SUCCESS success
6302 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306303eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006304{
6305 eHalStatus status;
6306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6307
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006308 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6309 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006310 status = sme_AcquireGlobalLock( &pMac->sme );
6311 if ( HAL_STATUS_SUCCESS( status ) )
6312 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306313 status = csrScanAbortMacScan(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006314
6315 sme_ReleaseGlobalLock( &pMac->sme );
6316 }
6317
6318 return ( status );
6319}
6320
6321/* ----------------------------------------------------------------------------
6322 \fn sme_GetOperationChannel
6323 \brief API to get current channel on which STA is parked
6324 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006325 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006326 \returns eHAL_STATUS_SUCCESS
6327 eHAL_STATUS_FAILURE
6328-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006329eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006330{
Jeff Johnson295189b2012-06-20 16:38:30 -07006331 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6332 tCsrRoamSession *pSession;
6333
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006334 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006335 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006336 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006337
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006338 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
6339 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006340 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006341 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6342 {
6343 *pChannel =pSession->connectedProfile.operationChannel;
6344 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006345 }
6346 }
6347 return eHAL_STATUS_FAILURE;
6348}// sme_GetOperationChannel ends here
6349
Jeff Johnson295189b2012-06-20 16:38:30 -07006350/* ---------------------------------------------------------------------------
6351
6352 \fn sme_RegisterMgtFrame
6353
6354 \brief To register managment frame of specified type and subtype.
6355 \param frameType - type of the frame that needs to be passed to HDD.
6356 \param matchData - data which needs to be matched before passing frame
6357 to HDD.
6358 \param matchDataLen - Length of matched data.
6359 \return eHalStatus
6360 -------------------------------------------------------------------------------*/
6361eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
6362 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6363{
6364 eHalStatus status = eHAL_STATUS_SUCCESS;
6365 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6366
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006367 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6368 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006369 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6370 {
6371 tSirRegisterMgmtFrame *pMsg;
6372 tANI_U16 len;
6373 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006374
6375 if(!pSession)
6376 {
6377 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006378 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006379 return eHAL_STATUS_FAILURE;
6380 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006381
6382 if( !pSession->sessionActive )
6383 {
6384 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006385 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006386 sme_ReleaseGlobalLock( &pMac->sme );
6387 return eHAL_STATUS_FAILURE;
6388 }
6389
6390 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6391
Kiet Lam64c1b492013-07-12 13:56:44 +05306392 pMsg = vos_mem_malloc(len);
6393 if ( NULL == pMsg )
6394 status = eHAL_STATUS_FAILURE;
6395 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006396 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306397 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006398 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6399 pMsg->length = len;
6400 pMsg->sessionId = sessionId;
6401 pMsg->registerFrame = VOS_TRUE;
6402 pMsg->frameType = frameType;
6403 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306404 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006405 status = palSendMBMessage(pMac->hHdd, pMsg);
6406 }
6407 sme_ReleaseGlobalLock( &pMac->sme );
6408 }
6409 return status;
6410}
6411
6412/* ---------------------------------------------------------------------------
6413
6414 \fn sme_DeregisterMgtFrame
6415
6416 \brief To De-register managment frame of specified type and subtype.
6417 \param frameType - type of the frame that needs to be passed to HDD.
6418 \param matchData - data which needs to be matched before passing frame
6419 to HDD.
6420 \param matchDataLen - Length of matched data.
6421 \return eHalStatus
6422 -------------------------------------------------------------------------------*/
6423eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
6424 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6425{
6426 eHalStatus status = eHAL_STATUS_SUCCESS;
6427 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6428
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006429 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6430 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006431 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6432 {
6433 tSirRegisterMgmtFrame *pMsg;
6434 tANI_U16 len;
6435 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006436
6437 if(!pSession)
6438 {
6439 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006440 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006441 return eHAL_STATUS_FAILURE;
6442 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006443
6444 if( !pSession->sessionActive )
6445 {
6446 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006447 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006448 sme_ReleaseGlobalLock( &pMac->sme );
6449 return eHAL_STATUS_FAILURE;
6450 }
6451
6452 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6453
Kiet Lam64c1b492013-07-12 13:56:44 +05306454 pMsg = vos_mem_malloc(len);
6455 if ( NULL == pMsg )
6456 status = eHAL_STATUS_FAILURE;
6457 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006458 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306459 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006460 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6461 pMsg->length = len;
6462 pMsg->registerFrame = VOS_FALSE;
6463 pMsg->frameType = frameType;
6464 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306465 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006466 status = palSendMBMessage(pMac->hHdd, pMsg);
6467 }
6468 sme_ReleaseGlobalLock( &pMac->sme );
6469 }
6470 return status;
6471}
6472
6473/* ---------------------------------------------------------------------------
6474 \fn sme_RemainOnChannel
6475 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6476 \param hHal - The handle returned by macOpen.
6477 \param pRequest - channel
6478 \param duration - duration in ms
6479 \param callback - HDD registered callback to process reaminOnChannelRsp
6480 \param context - HDD Callback param
6481 \return eHalStatus
6482 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006483eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6484 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306485 remainOnChanCallback callback,
6486 void *pContext,
6487 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006488{
6489 eHalStatus status = eHAL_STATUS_SUCCESS;
6490 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6491
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006492 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6493 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006494 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6495 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306496 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6497 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006498#ifdef WLAN_FEATURE_P2P_INTERNAL
6499 , eP2PRemainOnChnReasonUnknown
6500#endif
6501 );
6502 sme_ReleaseGlobalLock( &pMac->sme );
6503 }
6504 return(status);
6505}
6506
6507/* ---------------------------------------------------------------------------
6508 \fn sme_ReportProbeReq
6509 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6510 \param hHal - The handle returned by macOpen.
6511 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6512 \return eHalStatus
6513 ---------------------------------------------------------------------------*/
6514
6515#ifndef WLAN_FEATURE_CONCURRENT_P2P
6516eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6517{
6518 eHalStatus status = eHAL_STATUS_SUCCESS;
6519 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6520
6521 do
6522 {
6523 //acquire the lock for the sme object
6524 status = sme_AcquireGlobalLock(&pMac->sme);
6525 if(HAL_STATUS_SUCCESS(status))
6526 {
6527 /* call set in context */
6528 pMac->p2pContext.probeReqForwarding = flag;
6529 //release the lock for the sme object
6530 sme_ReleaseGlobalLock( &pMac->sme );
6531 }
6532 } while(0);
6533
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006534 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006535
6536 return(status);
6537}
6538
6539/* ---------------------------------------------------------------------------
6540 \fn sme_updateP2pIe
6541 \brief API to set the P2p Ie in p2p context
6542 \param hHal - The handle returned by macOpen.
6543 \param p2pIe - Ptr to p2pIe from HDD.
6544 \param p2pIeLength: length of p2pIe
6545 \return eHalStatus
6546 ---------------------------------------------------------------------------*/
6547
6548eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6549{
6550 eHalStatus status = eHAL_STATUS_SUCCESS;
6551 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6552
6553 //acquire the lock for the sme object
6554 status = sme_AcquireGlobalLock(&pMac->sme);
6555 if(HAL_STATUS_SUCCESS(status))
6556 {
6557 if(NULL != pMac->p2pContext.probeRspIe){
6558 vos_mem_free(pMac->p2pContext.probeRspIe);
6559 pMac->p2pContext.probeRspIeLength = 0;
6560 }
6561
6562 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6563 if (NULL == pMac->p2pContext.probeRspIe)
6564 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006565 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006566 pMac->p2pContext.probeRspIeLength = 0;
6567 status = eHAL_STATUS_FAILURE;
6568 }
6569 else
6570 {
6571 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6572
6573 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6574 pMac->p2pContext.probeRspIe,
6575 pMac->p2pContext.probeRspIeLength );
6576 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6577 p2pIeLength);
6578 }
6579
6580 //release the lock for the sme object
6581 sme_ReleaseGlobalLock( &pMac->sme );
6582 }
6583
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006584 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006585
6586 return(status);
6587}
6588#endif
6589
6590/* ---------------------------------------------------------------------------
6591 \fn sme_sendAction
6592 \brief API to send action frame from supplicant.
6593 \param hHal - The handle returned by macOpen.
6594 \return eHalStatus
6595 ---------------------------------------------------------------------------*/
6596
6597eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006598 const tANI_U8 *pBuf, tANI_U32 len,
6599 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006600{
6601 eHalStatus status = eHAL_STATUS_SUCCESS;
6602 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6603
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006604 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6605 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006606 //acquire the lock for the sme object
6607 status = sme_AcquireGlobalLock(&pMac->sme);
6608 if(HAL_STATUS_SUCCESS(status))
6609 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006610 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006611 //release the lock for the sme object
6612 sme_ReleaseGlobalLock( &pMac->sme );
6613 }
6614
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006615 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006616
6617 return(status);
6618}
6619
6620eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6621{
6622 eHalStatus status = eHAL_STATUS_SUCCESS;
6623 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6624
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006625 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6626 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006627 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6628 {
6629 status = p2pCancelRemainOnChannel (hHal, sessionId);
6630 sme_ReleaseGlobalLock( &pMac->sme );
6631 }
6632 return(status);
6633}
6634
6635//Power Save Related
6636eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6637{
6638 eHalStatus status = eHAL_STATUS_SUCCESS;
6639 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6640
6641 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6642 {
6643 status = p2pSetPs (hHal, data);
6644 sme_ReleaseGlobalLock( &pMac->sme );
6645 }
6646 return(status);
6647}
6648
Jeff Johnson295189b2012-06-20 16:38:30 -07006649
6650/* ---------------------------------------------------------------------------
6651
6652 \fn sme_ConfigureRxpFilter
6653
6654 \brief
6655 SME will pass this request to lower mac to set/reset the filter on RXP for
6656 multicast & broadcast traffic.
6657
6658 \param
6659
6660 hHal - The handle returned by macOpen.
6661
6662 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6663 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6664 on this param. In future we can use this as a mask to set various types of
6665 filters as suggested below:
6666 FILTER_ALL_MULTICAST:
6667 FILTER_ALL_BROADCAST:
6668 FILTER_ALL_MULTICAST_BROADCAST:
6669
6670
6671 \return eHalStatus
6672
6673
6674--------------------------------------------------------------------------- */
6675eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
6676 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6677{
6678 eHalStatus status = eHAL_STATUS_SUCCESS;
6679 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6680 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6681 vos_msg_t vosMessage;
6682
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006683 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6684 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006685 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6686 {
6687 /* serialize the req through MC thread */
6688 vosMessage.bodyptr = wlanRxpFilterParam;
6689 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6690 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6691 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6692 {
6693 status = eHAL_STATUS_FAILURE;
6694 }
6695 sme_ReleaseGlobalLock( &pMac->sme );
6696 }
6697 return(status);
6698}
6699
Jeff Johnson295189b2012-06-20 16:38:30 -07006700/* ---------------------------------------------------------------------------
6701
6702 \fn sme_ConfigureSuspendInd
6703
6704 \brief
6705 SME will pass this request to lower mac to Indicate that the wlan needs to
6706 be suspended
6707
6708 \param
6709
6710 hHal - The handle returned by macOpen.
6711
6712 wlanSuspendParam- Depicts the wlan suspend params
6713
6714
6715 \return eHalStatus
6716
6717
6718--------------------------------------------------------------------------- */
6719eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
6720 tpSirWlanSuspendParam wlanSuspendParam)
6721{
6722 eHalStatus status = eHAL_STATUS_SUCCESS;
6723 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6724 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6725 vos_msg_t vosMessage;
6726
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006727 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6728 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006729 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6730 {
6731 /* serialize the req through MC thread */
6732 vosMessage.bodyptr = wlanSuspendParam;
6733 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6734 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6735 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6736 {
6737 status = eHAL_STATUS_FAILURE;
6738 }
6739 sme_ReleaseGlobalLock( &pMac->sme );
6740 }
6741 return(status);
6742}
6743
6744/* ---------------------------------------------------------------------------
6745
6746 \fn sme_ConfigureResumeReq
6747
6748 \brief
6749 SME will pass this request to lower mac to Indicate that the wlan needs to
6750 be Resumed
6751
6752 \param
6753
6754 hHal - The handle returned by macOpen.
6755
6756 wlanResumeParam- Depicts the wlan resume params
6757
6758
6759 \return eHalStatus
6760
6761
6762--------------------------------------------------------------------------- */
6763eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
6764 tpSirWlanResumeParam wlanResumeParam)
6765{
6766 eHalStatus status = eHAL_STATUS_SUCCESS;
6767 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6768 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6769 vos_msg_t vosMessage;
6770
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07006771 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
6772 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006773 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6774 {
6775 /* serialize the req through MC thread */
6776 vosMessage.bodyptr = wlanResumeParam;
6777 vosMessage.type = WDA_WLAN_RESUME_REQ;
6778 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6779 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6780 {
6781 status = eHAL_STATUS_FAILURE;
6782 }
6783 sme_ReleaseGlobalLock( &pMac->sme );
6784 }
6785 return(status);
6786}
6787
Jeff Johnson295189b2012-06-20 16:38:30 -07006788/* ---------------------------------------------------------------------------
6789
6790 \fn sme_GetInfraSessionId
6791
6792 \brief To get the session ID for infra session, if connected
6793 This is a synchronous API.
6794
6795 \param hHal - The handle returned by macOpen.
6796
6797 \return sessionid, -1 if infra session is not connected
6798
6799 -------------------------------------------------------------------------------*/
6800tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
6801{
6802 eHalStatus status = eHAL_STATUS_FAILURE;
6803 tANI_S8 sessionid = -1;
6804 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6805
6806 status = sme_AcquireGlobalLock( &pMac->sme );
6807 if ( HAL_STATUS_SUCCESS( status ) )
6808 {
6809
6810 sessionid = csrGetInfraSessionId( pMac);
6811
6812 sme_ReleaseGlobalLock( &pMac->sme );
6813 }
6814
6815 return (sessionid);
6816}
6817
6818/* ---------------------------------------------------------------------------
6819
6820 \fn sme_GetInfraOperationChannel
6821
6822 \brief To get the operating channel for infra session, if connected
6823 This is a synchronous API.
6824
6825 \param hHal - The handle returned by macOpen.
6826 \param sessionId - the sessionId returned by sme_OpenSession.
6827
6828 \return operating channel, 0 if infra session is not connected
6829
6830 -------------------------------------------------------------------------------*/
6831tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
6832{
6833 eHalStatus status = eHAL_STATUS_FAILURE;
6834 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6835 tANI_U8 channel = 0;
6836 status = sme_AcquireGlobalLock( &pMac->sme );
6837 if ( HAL_STATUS_SUCCESS( status ) )
6838 {
6839
6840 channel = csrGetInfraOperationChannel( pMac, sessionId);
6841
6842 sme_ReleaseGlobalLock( &pMac->sme );
6843 }
6844
6845 return (channel);
6846}
6847
6848//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
6849//If other BSS is not up or not connected it will return 0
6850tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
6851{
6852 eHalStatus status = eHAL_STATUS_FAILURE;
6853 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6854 tANI_U8 channel = 0;
6855 status = sme_AcquireGlobalLock( &pMac->sme );
6856 if ( HAL_STATUS_SUCCESS( status ) )
6857 {
6858
6859 channel = csrGetConcurrentOperationChannel( pMac );
6860 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006861 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07006862 sme_ReleaseGlobalLock( &pMac->sme );
6863 }
6864
6865 return (channel);
6866}
6867
6868#ifdef FEATURE_WLAN_SCAN_PNO
6869/******************************************************************************
6870*
6871* Name: sme_PreferredNetworkFoundInd
6872*
6873* Description:
6874* Invoke Preferred Network Found Indication
6875*
6876* Parameters:
6877* hHal - HAL handle for device
6878* pMsg - found network description
6879*
6880* Returns: eHalStatus
6881*
6882******************************************************************************/
6883eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
6884{
6885 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6886 eHalStatus status = eHAL_STATUS_SUCCESS;
6887 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07006888 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
6889 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006890
6891 if (NULL == pMsg)
6892 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006893 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006894 status = eHAL_STATUS_FAILURE;
6895 }
6896 else
6897 {
6898 if (pPrefNetworkFoundInd->ssId.length > 0)
6899 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07006900 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
6901 pPrefNetworkFoundInd->ssId.length);
6902 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
6903 dumpSsId[ssIdLength] = 0;
6904 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
6905 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07006906
Srikant Kuppa066904f2013-05-07 13:56:02 -07006907 //Save the frame to scan result
6908 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
6909 {
6910 //we may have a frame
6911 status = csrScanSavePreferredNetworkFound(pMac,
6912 pPrefNetworkFoundInd);
6913 if (!HAL_STATUS_SUCCESS(status))
6914 {
6915 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
6916 }
6917 }
6918 else
6919 {
6920 smsLog(pMac, LOGE, FL(" not enough data length %d needed %d"),
6921 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07006922 }
6923
Srikant Kuppa066904f2013-05-07 13:56:02 -07006924 /* Call Preferred Netowrk Found Indication callback routine. */
6925 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
6926 {
6927 pMac->pmc.prefNetwFoundCB(
6928 pMac->pmc.preferredNetworkFoundIndCallbackContext,
6929 pPrefNetworkFoundInd);
6930 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006931 }
6932 else
6933 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006934 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006935 status = eHAL_STATUS_FAILURE;
6936 }
6937 }
6938
6939
6940 return(status);
6941}
6942
6943#endif // FEATURE_WLAN_SCAN_PNO
6944
6945
6946eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
6947{
6948 eHalStatus status = eHAL_STATUS_FAILURE;
6949 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6950
6951 status = sme_AcquireGlobalLock( &pMac->sme );
6952 if ( HAL_STATUS_SUCCESS( status ) )
6953 {
6954 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6955 sme_ReleaseGlobalLock( &pMac->sme );
6956 }
6957
6958 return (status);
6959}
6960
6961
6962/* ---------------------------------------------------------------------------
6963
6964 \fn sme_SetTxPerTracking
6965
6966 \brief Set Tx PER tracking configuration parameters
6967
6968 \param hHal - The handle returned by macOpen.
6969 \param pTxPerTrackingConf - Tx PER configuration parameters
6970
6971 \return eHalStatus
6972
6973 -------------------------------------------------------------------------------*/
6974eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6975 void (*pCallbackfn) (void *pCallbackContext),
6976 void *pCallbackContext,
6977 tpSirTxPerTrackingParam pTxPerTrackingParam)
6978{
6979 vos_msg_t msg;
6980 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6981 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6982
6983 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6984 {
6985 pMac->sme.pTxPerHitCallback = pCallbackfn;
6986 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6987 sme_ReleaseGlobalLock( &pMac->sme );
6988 }
6989
6990 // free this memory in failure case or WDA request callback function
6991 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6992 if (NULL == pTxPerTrackingParamReq)
6993 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006994 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 -07006995 return eHAL_STATUS_FAILURE;
6996 }
6997
Kiet Lam64c1b492013-07-12 13:56:44 +05306998 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
6999 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007000 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7001 msg.reserved = 0;
7002 msg.bodyptr = pTxPerTrackingParamReq;
7003
7004 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7005 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007006 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 -07007007 vos_mem_free(pTxPerTrackingParamReq);
7008 return eHAL_STATUS_FAILURE;
7009 }
7010
7011 return eHAL_STATUS_SUCCESS;
7012}
7013
7014/* ---------------------------------------------------------------------------
7015
7016 \fn sme_HandleChangeCountryCode
7017
7018 \brief Change Country code, Reg Domain and channel list
7019
7020 \details Country Code Priority
7021 0 = 11D > Configured Country > NV
7022 1 = Configured Country > 11D > NV
7023 If Supplicant country code is priority than 11d is disabled.
7024 If 11D is enabled, we update the country code after every scan.
7025 Hence when Supplicant country code is priority, we don't need 11D info.
7026 Country code from Supplicant is set as current courtry code.
7027 User can send reset command XX (instead of country code) to reset the
7028 country code to default values which is read from NV.
7029 In case of reset, 11D is enabled and default NV code is Set as current country code
7030 If 11D is priority,
7031 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7032
7033 \param pMac - The handle returned by macOpen.
7034 \param pMsgBuf - MSG Buffer
7035
7036 \return eHalStatus
7037
7038 -------------------------------------------------------------------------------*/
7039eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7040{
7041 eHalStatus status = eHAL_STATUS_SUCCESS;
7042 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007043 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007044 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7045 static uNvTables nvTables;
7046 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7047
7048
7049 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7050 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7051 {
7052 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7053
7054 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7055
7056 /* read the country code from NV and use it */
7057 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7058 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307059 vos_mem_copy(pMsg->countryCode,
7060 nvTables.defaultCountryTable.countryCode,
7061 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007062 }
7063 else
7064 {
7065 status = eHAL_STATUS_FAILURE;
7066 return status;
7067 }
7068 }
7069 else
7070 {
7071 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307072 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7073 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007074 {
7075 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7076 }
7077 }
7078
7079 /* WEXT set country code means
7080 * 11D should be supported?
7081 * 11D Channel should be enforced?
7082 * 11D Country code should be matched?
7083 * 11D Reg Domian should be matched?
7084 * Country string changed */
7085 if(pMac->roam.configParam.Is11dSupportEnabled &&
7086 pMac->roam.configParam.fEnforce11dChannels &&
7087 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7088 pMac->roam.configParam.fEnforceDefaultDomain &&
7089 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7090 {
7091 /* All 11D related options are already enabled
7092 * Country string is not changed
7093 * Do not need do anything for country code change request */
7094 return eHAL_STATUS_SUCCESS;
7095 }
7096
7097 /* Set Current Country code and Current Regulatory domain */
7098 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7099 if(eHAL_STATUS_SUCCESS != status)
7100 {
7101 /* Supplicant country code failed. So give 11D priority */
7102 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7103 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
7104 return status;
7105 }
7106
Jeff Johnson295189b2012-06-20 16:38:30 -07007107 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307108 vos_mem_copy(pMac->scan.countryCodeDefault,
7109 pMac->scan.countryCodeCurrent,
7110 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007111
7112 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307113 status = csrGetRegulatoryDomainForCountry(pMac,
7114 pMac->scan.countryCodeCurrent,
7115 (v_REGDOMAIN_t *) &domainIdIoctl,
7116 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007117 if ( status != eHAL_STATUS_SUCCESS )
7118 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007119 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007120 return status;
7121 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007122 else if (REGDOMAIN_WORLD == domainIdIoctl)
7123 {
7124 /* Supplicant country code is invalid, so we are on world mode now. So
7125 give 11D chance to update */
7126 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7127 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7128 }
7129
Jeff Johnson295189b2012-06-20 16:38:30 -07007130
7131 status = WDA_SetRegDomain(pMac, domainIdIoctl);
7132
7133 if ( status != eHAL_STATUS_SUCCESS )
7134 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007135 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007136 return status;
7137 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007138 else
7139 {
7140 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7141 //set again if we find AP with 11d info during scan
7142 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7143 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007144 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007145 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7146 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7147 }
7148 }
Kiet Lam6c583332013-10-14 05:37:09 +05307149#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007150 /* set to default domain ID */
7151 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7152
7153 /* get the channels based on new cc */
7154 status = csrInitGetChannels( pMac );
7155
7156 if ( status != eHAL_STATUS_SUCCESS )
7157 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007158 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007159 return status;
7160 }
7161
7162 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007163 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307164#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007165 if( pMsg->changeCCCallback )
7166 {
7167 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7168 }
7169
7170 return eHAL_STATUS_SUCCESS;
7171}
7172
Amar Singhal0d15bd52013-10-12 23:13:13 -07007173/* ---------------------------------------------------------------------------
7174
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007175 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007176
7177 \brief Change Country code, Reg Domain and channel list
7178
7179 If Supplicant country code is priority than 11d is disabled.
7180 If 11D is enabled, we update the country code after every scan.
7181 Hence when Supplicant country code is priority, we don't need 11D info.
7182 Country code from Supplicant is set as current country code.
7183
7184 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007185 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007186
7187 \return eHalStatus
7188
7189 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007190eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7191 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007192{
7193 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007194 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307195 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007196
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007197 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007198 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7199
Kiet Lam6c583332013-10-14 05:37:09 +05307200 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7201 VOS_COUNTRY_CODE_LEN) == 0)
7202 {
7203 is11dCountry = VOS_TRUE;
7204 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007205
7206 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307207 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007208 {
7209 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7210 }
7211
7212 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, pMsg->countryCode,
7213 WNI_CFG_COUNTRY_CODE_LEN);
7214
Amar Singhal0d15bd52013-10-12 23:13:13 -07007215 status = WDA_SetRegDomain(pMac, reg_domain_id);
7216
Kiet Lam6c583332013-10-14 05:37:09 +05307217 if (VOS_FALSE == is11dCountry )
7218 {
7219 /* overwrite the defualt country code */
7220 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault,
7221 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7222 /* set to default domain ID */
7223 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7224 }
7225
Amar Singhal0d15bd52013-10-12 23:13:13 -07007226 if ( status != eHAL_STATUS_SUCCESS )
7227 {
7228 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307229 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007230 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007231 else
7232 {
7233 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7234 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007235 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7236 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007237 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007238 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007239 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7240 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7241 }
7242 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007243
Amar Singhal0d15bd52013-10-12 23:13:13 -07007244 /* get the channels based on new cc */
7245 status = csrInitGetChannels(pMac);
7246
7247 if ( status != eHAL_STATUS_SUCCESS )
7248 {
7249 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7250 return status;
7251 }
7252
7253 /* reset info based on new cc, and we are done */
7254 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307255 if (VOS_TRUE == is11dCountry)
7256 {
Kiet Lam6c583332013-10-14 05:37:09 +05307257 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7258 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7259 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007260
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307261 // Do active scans after the country is set by User hints or Country IE
7262 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
7263
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007264 smsLog(pMac, LOG1, FL(" returned"));
7265 return eHAL_STATUS_SUCCESS;
7266}
7267
7268/* ---------------------------------------------------------------------------
7269
Kiet Lamcffc5862013-10-30 16:28:45 +05307270 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007271
7272 \brief Update Country code in the driver if set by kernel as world
7273
7274 If 11D is enabled, we update the country code after every scan & notify kernel.
7275 This is to make sure kernel & driver are in sync in case of CC found in
7276 driver but not in kernel database
7277
7278 \param pMac - The handle returned by macOpen.
7279 \param pMsg - Carrying new CC set in kernel
7280
7281 \return eHalStatus
7282
7283 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307284eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007285{
Kiet Lamcffc5862013-10-30 16:28:45 +05307286 eHalStatus status;
7287
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007288 smsLog(pMac, LOG1, FL(" called"));
7289
7290 //this is to make sure kernel & driver are in sync in case of CC found in
7291 //driver but not in kernel database
7292 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7293 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007294 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007295 palCopyMemory(pMac->hHdd, pMac->scan.countryCode11d, pMsg->countryCode,
7296 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007297 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, pMsg->countryCode,
7298 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007299 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307300
7301 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD);
7302
7303 if ( status != eHAL_STATUS_SUCCESS )
7304 {
7305 smsLog( pMac, LOGE, FL(" fail to set regId") );
7306 return status;
7307 }
7308 else
7309 {
7310 status = csrInitGetChannels(pMac);
7311 if ( status != eHAL_STATUS_SUCCESS )
7312 {
7313 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7314 }
7315 else
7316 {
7317 csrInitChannelList(pMac);
7318 }
7319 }
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007320 smsLog(pMac, LOG1, FL(" returned"));
7321 return eHAL_STATUS_SUCCESS;
7322}
7323
7324/* ---------------------------------------------------------------------------
7325
7326 \fn sme_HandleGenericChangeCountryCode
7327
7328 \brief Change Country code, Reg Domain and channel list
7329
7330 If Supplicant country code is priority than 11d is disabled.
7331 If 11D is enabled, we update the country code after every scan.
7332 Hence when Supplicant country code is priority, we don't need 11D info.
7333 Country code from kernel is set as current country code.
7334
7335 \param pMac - The handle returned by macOpen.
7336 \param pMsgBuf - message buffer
7337
7338 \return eHalStatus
7339
7340 -------------------------------------------------------------------------------*/
7341eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7342{
7343 tAniGenericChangeCountryCodeReq *pMsg;
7344 v_REGDOMAIN_t reg_domain_id;
7345
7346 smsLog(pMac, LOG1, FL(" called"));
7347 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7348 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7349
7350 if (REGDOMAIN_COUNT == reg_domain_id)
7351 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307352 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007353 }
7354 else
7355 {
7356 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7357 }
7358 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007359 return eHAL_STATUS_SUCCESS;
7360}
7361
Jeff Johnson295189b2012-06-20 16:38:30 -07007362#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007363eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007364{
7365 tpSirRcvFltMcAddrList pRequestBuf;
7366 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007367 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007368 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007369
7370 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307371 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007372 pMulticastAddrs->ulMulticastAddrCnt,
7373 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007374
7375 /*
7376 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007377 */
7378 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7379 csrIsConnStateInfra(pMac, sessionId))
7380 {
7381 pSession = CSR_GET_SESSION( pMac, sessionId );
7382 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007383
7384 if(pSession == NULL )
7385 {
7386 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007387 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007388 return eHAL_STATUS_FAILURE;
7389 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007390
Jeff Johnson295189b2012-06-20 16:38:30 -07007391 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7392 if (NULL == pRequestBuf)
7393 {
7394 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007395 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007396 return eHAL_STATUS_FAILED_ALLOC;
7397 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007398
7399 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7400 {
7401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7402 "indication as we are not connected", __func__);
7403 vos_mem_free(pRequestBuf);
7404 return eHAL_STATUS_FAILURE;
7405 }
7406
Jeff Johnson295189b2012-06-20 16:38:30 -07007407 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7408
Kiet Lam64c1b492013-07-12 13:56:44 +05307409 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7410 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007411 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7412 sizeof(tSirMacAddr));
7413
Jeff Johnson295189b2012-06-20 16:38:30 -07007414 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7415 msg.reserved = 0;
7416 msg.bodyptr = pRequestBuf;
7417 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7418 {
7419 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007420 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007421 vos_mem_free(pRequestBuf);
7422 return eHAL_STATUS_FAILURE;
7423 }
7424
7425 return eHAL_STATUS_SUCCESS;
7426}
7427
Jeff Johnsone7245742012-09-05 17:12:55 -07007428eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
7429 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007430{
7431 tpSirRcvPktFilterCfgType pRequestBuf;
7432 v_SINT_t allocSize;
7433 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007434 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7435 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007436 v_U8_t idx=0;
7437
7438 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007439 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007440 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
7441
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007442 allocSize = sizeof(tSirRcvPktFilterCfgType);
7443
Jeff Johnson295189b2012-06-20 16:38:30 -07007444 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007445
7446 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007447 {
7448 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007449 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007450 return eHAL_STATUS_FAILED_ALLOC;
7451 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007452
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007453 if( NULL == pSession )
7454 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007455 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007456 vos_mem_free(pRequestBuf);
7457 return eHAL_STATUS_FAILURE;
7458 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007459
Kiet Lam64c1b492013-07-12 13:56:44 +05307460 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7461 sizeof(tSirMacAddr));
7462 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7463 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007464 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7465
Jeff Johnson295189b2012-06-20 16:38:30 -07007466 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7467 msg.reserved = 0;
7468 msg.bodyptr = pRequestBuf;
7469
7470 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
7471 "FT %d FID %d ",
7472 pRequestBuf->filterType, pRequestBuf->filterId);
7473
7474 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
7475 "params %d CT %d",
7476 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
7477
7478 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7479 {
7480
7481 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007482 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007483 pRequestBuf->paramsData[idx].protocolLayer,
7484 pRequestBuf->paramsData[idx].cmpFlag);
7485
7486 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007487 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007488 pRequestBuf->paramsData[idx].dataOffset,
7489 pRequestBuf->paramsData[idx].dataLength);
7490
7491 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007492 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007493 pRequestBuf->paramsData[idx].compareData[0],
7494 pRequestBuf->paramsData[idx].compareData[1],
7495 pRequestBuf->paramsData[idx].compareData[2],
7496 pRequestBuf->paramsData[idx].compareData[3],
7497 pRequestBuf->paramsData[idx].compareData[4],
7498 pRequestBuf->paramsData[idx].compareData[5]);
7499
7500 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007501 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007502 pRequestBuf->paramsData[idx].dataMask[0],
7503 pRequestBuf->paramsData[idx].dataMask[1],
7504 pRequestBuf->paramsData[idx].dataMask[2],
7505 pRequestBuf->paramsData[idx].dataMask[3],
7506 pRequestBuf->paramsData[idx].dataMask[4],
7507 pRequestBuf->paramsData[idx].dataMask[5]);
7508
7509 }
7510
7511 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7512 {
7513 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007514 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007515 vos_mem_free(pRequestBuf);
7516 return eHAL_STATUS_FAILURE;
7517 }
7518
7519 return eHAL_STATUS_SUCCESS;
7520}
7521
7522eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
7523 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007524 void *callbackContext,
7525 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007526{
7527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7528 eHalStatus status;
7529
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007530 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007531
7532 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7533 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007534 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007535 sme_ReleaseGlobalLock( &pMac->sme );
7536 }
7537
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007538 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007539
7540 return (status);
7541}
7542
Jeff Johnsone7245742012-09-05 17:12:55 -07007543eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
7544 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007545{
7546 tpSirRcvFltPktClearParam pRequestBuf;
7547 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007548 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7549 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007550
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007551 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007552 pRcvFltPktClearParam->filterId);
7553
7554 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007555 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007556 {
7557 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7558 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007559 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007560 return eHAL_STATUS_FAILED_ALLOC;
7561 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007562 if( NULL == pSession )
7563 {
7564 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007565 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007566 vos_mem_free(pRequestBuf);
7567 return eHAL_STATUS_FAILURE;
7568 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007569
Kiet Lam64c1b492013-07-12 13:56:44 +05307570 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
7571 sizeof(tSirMacAddr));
7572 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
7573 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007574
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007575 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
7576
Jeff Johnson295189b2012-06-20 16:38:30 -07007577 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
7578 msg.reserved = 0;
7579 msg.bodyptr = pRequestBuf;
7580 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7581 {
7582 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007583 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007584 vos_mem_free(pRequestBuf);
7585 return eHAL_STATUS_FAILURE;
7586 }
7587
7588 return eHAL_STATUS_SUCCESS;
7589}
7590#endif // WLAN_FEATURE_PACKET_FILTERING
7591
7592/* ---------------------------------------------------------------------------
7593 \fn sme_PreChannelSwitchIndFullPowerCB
7594 \brief call back function for the PMC full power request because of pre
7595 channel switch.
7596 \param callbackContext
7597 \param status
7598 ---------------------------------------------------------------------------*/
7599void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
7600 eHalStatus status)
7601{
7602 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
7603 tSirMbMsg *pMsg;
7604 tANI_U16 msgLen;
7605
7606 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05307607 pMsg = vos_mem_malloc(msgLen);
7608 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07007609 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307610 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007611 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
7612 pMsg->msgLen = pal_cpu_to_be16(msgLen);
7613 status = palSendMBMessage(pMac->hHdd, pMsg);
7614 }
7615
7616 return;
7617}
7618
7619/* ---------------------------------------------------------------------------
7620 \fn sme_HandlePreChannelSwitchInd
7621 \brief Processes the indcation from PE for pre-channel switch.
7622 \param hHal
7623 \- The handle returned by macOpen. return eHalStatus
7624 ---------------------------------------------------------------------------*/
7625eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
7626{
7627 eHalStatus status = eHAL_STATUS_FAILURE;
7628 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7629 status = sme_AcquireGlobalLock( &pMac->sme );
7630 if ( HAL_STATUS_SUCCESS( status ) )
7631 {
7632 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
7633 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
7634 sme_ReleaseGlobalLock( &pMac->sme );
7635 }
7636
7637 return (status);
7638}
7639
7640/* ---------------------------------------------------------------------------
7641 \fn sme_HandlePostChannelSwitchInd
7642 \brief Processes the indcation from PE for post-channel switch.
7643 \param hHal
7644 \- The handle returned by macOpen. return eHalStatus
7645 ---------------------------------------------------------------------------*/
7646eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
7647{
7648 eHalStatus status = eHAL_STATUS_FAILURE;
7649 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7650
7651 status = sme_AcquireGlobalLock( &pMac->sme );
7652 if ( HAL_STATUS_SUCCESS( status ) )
7653 {
7654 status = pmcRequestBmps(hHal, NULL, NULL);
7655 sme_ReleaseGlobalLock( &pMac->sme );
7656 }
7657
7658 return (status);
7659}
7660
7661/* ---------------------------------------------------------------------------
7662
7663 \fn sme_IsChannelValid
7664
7665 \brief To check if the channel is valid for currently established domain
7666 This is a synchronous API.
7667
7668 \param hHal - The handle returned by macOpen.
7669 \param channel - channel to verify
7670
7671 \return TRUE/FALSE, TRUE if channel is valid
7672
7673 -------------------------------------------------------------------------------*/
7674tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
7675{
7676 eHalStatus status = eHAL_STATUS_FAILURE;
7677 tANI_BOOLEAN valid = FALSE;
7678 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7679
7680 status = sme_AcquireGlobalLock( &pMac->sme );
7681 if ( HAL_STATUS_SUCCESS( status ) )
7682 {
7683
7684 valid = csrRoamIsChannelValid( pMac, channel);
7685
7686 sme_ReleaseGlobalLock( &pMac->sme );
7687 }
7688
7689 return (valid);
7690}
7691
7692/* ---------------------------------------------------------------------------
7693 \fn sme_SetFreqBand
7694 \brief Used to set frequency band.
7695 \param hHal
7696 \eBand band value to be configured
7697 \- return eHalStatus
7698 -------------------------------------------------------------------------*/
7699eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
7700{
7701 eHalStatus status = eHAL_STATUS_FAILURE;
7702 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7703
7704 status = sme_AcquireGlobalLock( &pMac->sme );
7705 if ( HAL_STATUS_SUCCESS( status ) )
7706 {
7707 status = csrSetBand(hHal, eBand);
7708 sme_ReleaseGlobalLock( &pMac->sme );
7709 }
7710 return status;
7711}
7712
7713/* ---------------------------------------------------------------------------
7714 \fn sme_GetFreqBand
7715 \brief Used to get the current band settings.
7716 \param hHal
7717 \pBand pointer to hold band value
7718 \- return eHalStatus
7719 -------------------------------------------------------------------------*/
7720eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
7721{
7722 eHalStatus status = eHAL_STATUS_FAILURE;
7723 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7724
7725 status = sme_AcquireGlobalLock( &pMac->sme );
7726 if ( HAL_STATUS_SUCCESS( status ) )
7727 {
7728 *pBand = csrGetCurrentBand( hHal );
7729 sme_ReleaseGlobalLock( &pMac->sme );
7730 }
7731 return status;
7732}
7733
7734#ifdef WLAN_WAKEUP_EVENTS
7735/******************************************************************************
7736 \fn sme_WakeReasonIndCallback
7737
7738 \brief
7739 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
7740
7741 \param hHal - HAL handle for device
7742 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
7743
7744 \return eHalStatus
7745******************************************************************************/
7746eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
7747{
7748 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7749 eHalStatus status = eHAL_STATUS_SUCCESS;
7750 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
7751
7752 if (NULL == pMsg)
7753 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007754 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007755 status = eHAL_STATUS_FAILURE;
7756 }
7757 else
7758 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007759 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07007760
7761 /* Call Wake Reason Indication callback routine. */
7762 if (pMac->pmc.wakeReasonIndCB != NULL)
7763 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
7764
7765 pMac->pmc.wakeReasonIndCB = NULL;
7766 pMac->pmc.wakeReasonIndCBContext = NULL;
7767
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007768 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07007769 }
7770
7771 return(status);
7772}
7773#endif // WLAN_WAKEUP_EVENTS
7774
7775
7776/* ---------------------------------------------------------------------------
7777
7778 \fn sme_SetMaxTxPower
7779
7780 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
7781 not persist over reboots.
7782
7783 \param hHal
7784 \param pBssid BSSID to set the power cap for
7785 \param pBssid pSelfMacAddress self MAC Address
7786 \param pBssid power to set in dB
7787 \- return eHalStatus
7788
7789 -------------------------------------------------------------------------------*/
7790eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
7791 tSirMacAddr pSelfMacAddress, v_S7_t dB)
7792{
7793 vos_msg_t msg;
7794 tpMaxTxPowerParams pMaxTxParams = NULL;
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07007795#ifdef LIM_TRACE_RECORD
7796 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7797#endif
7798 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
7799 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007800 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
7801 if (NULL == pMaxTxParams)
7802 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007803 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 -07007804 return eHAL_STATUS_FAILURE;
7805 }
7806
7807 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05307808 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07007809 SIR_MAC_ADDR_LENGTH);
7810 pMaxTxParams->power = dB;
7811
7812 msg.type = WDA_SET_MAX_TX_POWER_REQ;
7813 msg.reserved = 0;
7814 msg.bodyptr = pMaxTxParams;
7815
7816 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7817 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007818 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 -07007819 vos_mem_free(pMaxTxParams);
7820 return eHAL_STATUS_FAILURE;
7821 }
7822
7823 return eHAL_STATUS_SUCCESS;
7824}
7825
Jeff Johnson295189b2012-06-20 16:38:30 -07007826/* ---------------------------------------------------------------------------
7827
Arif Hussaina5ebce02013-08-09 15:09:58 -07007828 \fn sme_SetMaxTxPowerPerBand
7829
7830 \brief Set the Maximum Transmit Power specific to band dynamically.
7831 Note: this setting will not persist over reboots.
7832
7833 \param band
7834 \param power to set in dB
7835 \- return eHalStatus
7836
7837 ----------------------------------------------------------------------------*/
7838eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
7839{
7840 vos_msg_t msg;
7841 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
7842
7843 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
7844 if (NULL == pMaxTxPowerPerBandParams)
7845 {
7846 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7847 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
7848 __func__);
7849 return eHAL_STATUS_FAILURE;
7850 }
7851
7852 pMaxTxPowerPerBandParams->power = dB;
7853 pMaxTxPowerPerBandParams->bandInfo = band;
7854
7855 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
7856 msg.reserved = 0;
7857 msg.bodyptr = pMaxTxPowerPerBandParams;
7858
7859 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7860 {
7861 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7862 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
7863 __func__);
7864 vos_mem_free(pMaxTxPowerPerBandParams);
7865 return eHAL_STATUS_FAILURE;
7866 }
7867
7868 return eHAL_STATUS_SUCCESS;
7869}
7870
7871/* ---------------------------------------------------------------------------
7872
schang86c22c42013-03-13 18:41:24 -07007873 \fn sme_SetTxPower
7874
7875 \brief Set Transmit Power dynamically. Note: this setting will
7876 not persist over reboots.
7877
7878 \param hHal
7879 \param sessionId Target Session ID
7880 \param mW power to set in mW
7881 \- return eHalStatus
7882
7883 -------------------------------------------------------------------------------*/
7884eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
7885{
7886
7887 eHalStatus status = eHAL_STATUS_FAILURE;
7888 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7889
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07007890 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
7891 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07007892 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
7893 status = sme_AcquireGlobalLock(&pMac->sme);
7894 if (HAL_STATUS_SUCCESS(status))
7895 {
7896 status = csrSetTxPower(pMac, sessionId, mW);
7897 sme_ReleaseGlobalLock(&pMac->sme);
7898 }
7899 return status;
7900}
7901
7902/* ---------------------------------------------------------------------------
7903
Jeff Johnson295189b2012-06-20 16:38:30 -07007904 \fn sme_HideSSID
7905
7906 \brief hide/show SSID dynamically. Note: this setting will
7907 not persist over reboots.
7908
7909 \param hHal
7910 \param sessionId
7911 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
7912 \- return eHalStatus
7913
7914 -------------------------------------------------------------------------------*/
7915eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
7916{
7917 eHalStatus status = eHAL_STATUS_SUCCESS;
7918 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7919 tANI_U16 len;
7920
7921 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7922 {
7923 tpSirUpdateParams pMsg;
7924 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007925
7926 if(!pSession)
7927 {
7928 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007929 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007930 return eHAL_STATUS_FAILURE;
7931 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007932
7933 if( !pSession->sessionActive )
7934 VOS_ASSERT(0);
7935
7936 /* Create the message and send to lim */
7937 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05307938 pMsg = vos_mem_malloc(len);
7939 if ( NULL == pMsg )
7940 status = eHAL_STATUS_FAILURE;
7941 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007942 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307943 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007944 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
7945 pMsg->length = len;
7946 /* Data starts from here */
7947 pMsg->sessionId = sessionId;
7948 pMsg->ssidHidden = ssidHidden;
7949 status = palSendMBMessage(pMac->hHdd, pMsg);
7950 }
7951 sme_ReleaseGlobalLock( &pMac->sme );
7952 }
7953 return status;
7954}
Jeff Johnson295189b2012-06-20 16:38:30 -07007955
7956/* ---------------------------------------------------------------------------
7957
7958 \fn sme_SetTmLevel
7959 \brief Set Thermal Mitigation Level to RIVA
7960 \param hHal - The handle returned by macOpen.
7961 \param newTMLevel - new Thermal Mitigation Level
7962 \param tmMode - Thermal Mitigation handle mode, default 0
7963 \return eHalStatus
7964 ---------------------------------------------------------------------------*/
7965eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
7966{
7967 eHalStatus status = eHAL_STATUS_SUCCESS;
7968 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7969 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7970 vos_msg_t vosMessage;
7971 tAniSetTmLevelReq *setTmLevelReq = NULL;
7972
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07007973 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
7974 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007975 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7976 {
7977 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05307978 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07007979 {
7980 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007981 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007982 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07007983 return eHAL_STATUS_FAILURE;
7984 }
7985
7986 setTmLevelReq->tmMode = tmMode;
7987 setTmLevelReq->newTmLevel = newTMLevel;
7988
7989 /* serialize the req through MC thread */
7990 vosMessage.bodyptr = setTmLevelReq;
7991 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
7992 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7993 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7994 {
7995 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007996 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007997 vos_mem_free(setTmLevelReq);
7998 status = eHAL_STATUS_FAILURE;
7999 }
8000 sme_ReleaseGlobalLock( &pMac->sme );
8001 }
8002 return(status);
8003}
8004
8005/*---------------------------------------------------------------------------
8006
8007 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8008 Host and FW.
8009
8010 \param hHal - HAL handle for device
8011
8012 \return NONE
8013
8014---------------------------------------------------------------------------*/
8015void sme_featureCapsExchange( tHalHandle hHal)
8016{
8017 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008018#ifdef LIM_TRACE_RECORD
8019 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8020#endif
8021 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8022 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008023 WDA_featureCapsExchange(vosContext);
8024}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008025
Yathish9f22e662012-12-10 14:21:35 -08008026/*---------------------------------------------------------------------------
8027
8028 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8029 in Host.
8030
8031 \param hHal - HAL handle for device
8032
8033 \return NONE
8034
8035---------------------------------------------------------------------------*/
8036void sme_disableFeatureCapablity(tANI_U8 feature_index)
8037{
8038 WDA_disableCapablityFeature(feature_index);
8039}
8040
8041
Jeff Johnsond13512a2012-07-17 11:42:19 -07008042
8043/* ---------------------------------------------------------------------------
8044
8045 \fn sme_GetDefaultCountryCode
8046
8047 \brief Get the default country code from NV
8048
8049 \param hHal
8050 \param pCountry
8051 \- return eHalStatus
8052
8053 -------------------------------------------------------------------------------*/
8054eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8055{
8056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008057 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8058 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008059 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8060}
8061
8062/* ---------------------------------------------------------------------------
8063
8064 \fn sme_GetCurrentCountryCode
8065
8066 \brief Get the current country code
8067
8068 \param hHal
8069 \param pCountry
8070 \- return eHalStatus
8071
8072 -------------------------------------------------------------------------------*/
8073eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8074{
8075 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008076 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8077 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008078 return csrGetCurrentCountryCode(pMac, pCountry);
8079}
8080
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008081/* ---------------------------------------------------------------------------
8082 \fn sme_transportDebug
8083 \brief Dynamically monitoring Transport channels
8084 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008085 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008086 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008087 \param toggleStallDetect Enable stall detect feature
8088 This feature will take effect to data performance
8089 Not integrate till fully verification
8090 \- return NONE
8091 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008092void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008093{
schang6295e542013-03-12 15:31:23 -07008094 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8095
8096 if (NULL == pMac)
8097 {
8098 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8099 "%s: invalid context", __func__);
8100 return;
8101 }
8102 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008103}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008104
Kiran4a17ebe2013-01-31 10:43:43 -08008105/* ---------------------------------------------------------------------------
8106 \fn sme_ResetPowerValuesFor5G
8107 \brief Reset the power values for 5G band with NV power values.
8108 \param hHal - HAL handle for device
8109 \- return NONE
8110 -------------------------------------------------------------------------*/
8111void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8112{
8113 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008114 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8115 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008116 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8117 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8118}
8119
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008120#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
8121/* ---------------------------------------------------------------------------
8122 \fn sme_UpdateRoamPrefer5GHz
8123 \brief enable/disable Roam prefer 5G runtime option
8124 This function is called through dynamic setConfig callback function
8125 to configure the Roam prefer 5G runtime option
8126 \param hHal - HAL handle for device
8127 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8128 \- return Success or failure
8129 -------------------------------------------------------------------------*/
8130
8131eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8132{
8133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008134 eHalStatus status = eHAL_STATUS_SUCCESS;
8135
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008136 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8137 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008138 status = sme_AcquireGlobalLock( &pMac->sme );
8139 if ( HAL_STATUS_SUCCESS( status ) )
8140 {
8141 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8142 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8143 pMac->roam.configParam.nRoamPrefer5GHz,
8144 nRoamPrefer5GHz);
8145 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8146 sme_ReleaseGlobalLock( &pMac->sme );
8147 }
8148
8149 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008150}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008151
8152/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008153 \fn sme_setRoamIntraBand
8154 \brief enable/disable Intra band roaming
8155 This function is called through dynamic setConfig callback function
8156 to configure the intra band roaming
8157 \param hHal - HAL handle for device
8158 \param nRoamIntraBand Enable/Disable Intra band roaming
8159 \- return Success or failure
8160 -------------------------------------------------------------------------*/
8161eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8162{
8163 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8164 eHalStatus status = eHAL_STATUS_SUCCESS;
8165
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008166 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8167 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008168 status = sme_AcquireGlobalLock( &pMac->sme );
8169 if ( HAL_STATUS_SUCCESS( status ) )
8170 {
8171 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8172 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8173 pMac->roam.configParam.nRoamIntraBand,
8174 nRoamIntraBand);
8175 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8176 sme_ReleaseGlobalLock( &pMac->sme );
8177 }
8178
8179 return status ;
8180}
8181
8182/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008183 \fn sme_UpdateRoamScanNProbes
8184 \brief function to update roam scan N probes
8185 This function is called through dynamic setConfig callback function
8186 to update roam scan N probes
8187 \param hHal - HAL handle for device
8188 \param nProbes number of probe requests to be sent out
8189 \- return Success or failure
8190 -------------------------------------------------------------------------*/
8191eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8192{
8193 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8194 eHalStatus status = eHAL_STATUS_SUCCESS;
8195
8196 status = sme_AcquireGlobalLock( &pMac->sme );
8197 if ( HAL_STATUS_SUCCESS( status ) )
8198 {
8199 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8200 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8201 pMac->roam.configParam.nProbes,
8202 nProbes);
8203 pMac->roam.configParam.nProbes = nProbes;
8204 sme_ReleaseGlobalLock( &pMac->sme );
8205 }
8206#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8207 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8208 {
8209 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8210 REASON_NPROBES_CHANGED);
8211 }
8212#endif
8213 return status ;
8214}
8215
8216/* ---------------------------------------------------------------------------
8217 \fn sme_UpdateRoamScanHomeAwayTime
8218 \brief function to update roam scan Home away time
8219 This function is called through dynamic setConfig callback function
8220 to update roam scan home away time
8221 \param hHal - HAL handle for device
8222 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008223 \param bSendOffloadCmd If TRUE then send offload command to firmware
8224 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008225 \- return Success or failure
8226 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008227eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8228 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008229{
8230 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8231 eHalStatus status = eHAL_STATUS_SUCCESS;
8232
8233 status = sme_AcquireGlobalLock( &pMac->sme );
8234 if ( HAL_STATUS_SUCCESS( status ) )
8235 {
8236 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8237 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8238 pMac->roam.configParam.nRoamScanHomeAwayTime,
8239 nRoamScanHomeAwayTime);
8240 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8241 sme_ReleaseGlobalLock( &pMac->sme );
8242 }
8243
8244#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008245 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008246 {
8247 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8248 REASON_HOME_AWAY_TIME_CHANGED);
8249 }
8250#endif
8251 return status;
8252}
8253
8254
8255/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008256 \fn sme_getRoamIntraBand
8257 \brief get Intra band roaming
8258 \param hHal - HAL handle for device
8259 \- return Success or failure
8260 -------------------------------------------------------------------------*/
8261v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8262{
8263 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008264 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8265 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008266 return pMac->roam.configParam.nRoamIntraBand;
8267}
8268
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008269/* ---------------------------------------------------------------------------
8270 \fn sme_getRoamScanNProbes
8271 \brief get N Probes
8272 \param hHal - HAL handle for device
8273 \- return Success or failure
8274 -------------------------------------------------------------------------*/
8275v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8276{
8277 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8278 return pMac->roam.configParam.nProbes;
8279}
8280
8281/* ---------------------------------------------------------------------------
8282 \fn sme_getRoamScanHomeAwayTime
8283 \brief get Roam scan home away time
8284 \param hHal - HAL handle for device
8285 \- return Success or failure
8286 -------------------------------------------------------------------------*/
8287v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8288{
8289 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8290 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8291}
8292
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008293
8294/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008295 \fn sme_UpdateImmediateRoamRssiDiff
8296 \brief Update nImmediateRoamRssiDiff
8297 This function is called through dynamic setConfig callback function
8298 to configure nImmediateRoamRssiDiff
8299 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8300 \param hHal - HAL handle for device
8301 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
8302 candidate and current AP.
8303 \- return Success or failure
8304 -------------------------------------------------------------------------*/
8305
8306eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8307{
8308 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008309 eHalStatus status = eHAL_STATUS_SUCCESS;
8310
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008311 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8312 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008313 status = sme_AcquireGlobalLock( &pMac->sme );
8314 if ( HAL_STATUS_SUCCESS( status ) )
8315 {
8316 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8317 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
8318 nImmediateRoamRssiDiff,
8319 pMac->roam.configParam.nImmediateRoamRssiDiff,
8320 pMac->roam.neighborRoamInfo.neighborRoamState);
8321 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8322 sme_ReleaseGlobalLock( &pMac->sme );
8323 }
8324
8325 return status ;
8326}
8327
8328/* ---------------------------------------------------------------------------
8329 \fn sme_UpdateRoamRssiDiff
8330 \brief Update RoamRssiDiff
8331 This function is called through dynamic setConfig callback function
8332 to configure RoamRssiDiff
8333 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8334 \param hHal - HAL handle for device
8335 \param RoamRssiDiff - minimum rssi difference between potential
8336 candidate and current AP.
8337 \- return Success or failure
8338 -------------------------------------------------------------------------*/
8339
8340eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8341{
8342 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8343 eHalStatus status = eHAL_STATUS_SUCCESS;
8344
8345 status = sme_AcquireGlobalLock( &pMac->sme );
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008346 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8347 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008348 if ( HAL_STATUS_SUCCESS( status ) )
8349 {
8350 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8351 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
8352 RoamRssiDiff,
8353 pMac->roam.configParam.RoamRssiDiff,
8354 pMac->roam.neighborRoamInfo.neighborRoamState);
8355 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8356 sme_ReleaseGlobalLock( &pMac->sme );
8357 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008358#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8359 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8360 {
8361 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8362 }
8363#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008364 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008365}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008366
8367/*--------------------------------------------------------------------------
8368 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
8369 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8370 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008371 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008372 \param hHal - The handle returned by macOpen.
8373 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8374 Other status means SME is failed to update isFastTransitionEnabled.
8375 \sa
8376 --------------------------------------------------------------------------*/
8377eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
8378 v_BOOL_t isFastTransitionEnabled)
8379{
8380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008381 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008382
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008383 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8384 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008385 status = sme_AcquireGlobalLock( &pMac->sme );
8386 if ( HAL_STATUS_SUCCESS( status ) )
8387 {
8388 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8389 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8390 pMac->roam.configParam.isFastTransitionEnabled,
8391 isFastTransitionEnabled);
8392 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8393 sme_ReleaseGlobalLock( &pMac->sme );
8394 }
8395
8396 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008397}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008398
8399/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008400 \fn sme_UpdateWESMode
8401 \brief Update WES Mode
8402 This function is called through dynamic setConfig callback function
8403 to configure isWESModeEnabled
8404 \param hHal - HAL handle for device
8405 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8406 Other status means SME is failed to update isWESModeEnabled.
8407 -------------------------------------------------------------------------*/
8408
8409eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8410{
8411 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8412 eHalStatus status = eHAL_STATUS_SUCCESS;
8413
8414 status = sme_AcquireGlobalLock( &pMac->sme );
8415 if ( HAL_STATUS_SUCCESS( status ) )
8416 {
8417 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8418 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
8419 isWESModeEnabled,
8420 pMac->roam.configParam.isWESModeEnabled,
8421 pMac->roam.neighborRoamInfo.neighborRoamState);
8422 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8423 sme_ReleaseGlobalLock( &pMac->sme );
8424 }
8425
8426 return status ;
8427}
8428
8429/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008430 \fn sme_SetRoamScanControl
8431 \brief Set roam scan control
8432 This function is called to set roam scan control
8433 if roam scan control is set to 0, roaming scan cache is cleared
8434 any value other than 0 is treated as invalid value
8435 \param hHal - HAL handle for device
8436 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8437 Other status means SME failure to update
8438 -------------------------------------------------------------------------*/
8439eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8440{
8441 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8442 eHalStatus status = eHAL_STATUS_SUCCESS;
8443
Leela Venkata Kiran Kumar Reddy Chiralace438362013-04-10 22:39:51 -07008444 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
8445 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008446 status = sme_AcquireGlobalLock( &pMac->sme );
8447 if ( HAL_STATUS_SUCCESS( status ) )
8448 {
8449 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8450 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
8451 roamScanControl,
8452 pMac->roam.configParam.nRoamScanControl,
8453 pMac->roam.neighborRoamInfo.neighborRoamState);
8454 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8455 if ( 0 == roamScanControl)
8456 {
8457 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8458 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008459 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008460#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8461 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8462 {
8463 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8464 }
8465#endif
8466 }
8467 sme_ReleaseGlobalLock( &pMac->sme );
8468 }
8469 return status ;
8470}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008471#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
8472
8473#ifdef FEATURE_WLAN_LFR
8474/*--------------------------------------------------------------------------
8475 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
8476 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8477 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008478 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008479 \param hHal - The handle returned by macOpen.
8480 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8481 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8482 \sa
8483 --------------------------------------------------------------------------*/
8484eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008485 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008486{
8487 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8488
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008489 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8490 {
8491 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8492 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8493 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8494 isFastRoamIniFeatureEnabled);
8495 return eHAL_STATUS_SUCCESS;
8496 }
8497
Srinivas Girigowdade697412013-02-14 16:31:48 -08008498 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8499 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8500 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8501 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008502 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008503 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008504
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008505 return eHAL_STATUS_SUCCESS;
8506}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008507
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008508/*--------------------------------------------------------------------------
8509 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8510 Enable/disable LFR MAWC support at runtime
8511 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8512 isMAWCIniFeatureEnabled.
8513 This is a synchronous call
8514 \param hHal - The handle returned by macOpen.
8515 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8516 Other status means SME is failed to update MAWCEnabled.
8517 \sa
8518 --------------------------------------------------------------------------*/
8519eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8520 const v_BOOL_t MAWCEnabled)
8521{
8522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8523 eHalStatus status = eHAL_STATUS_SUCCESS;
8524
8525 status = sme_AcquireGlobalLock( &pMac->sme );
8526 if ( HAL_STATUS_SUCCESS( status ) )
8527 {
8528 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8529 "%s: MAWCEnabled is changed from %d to %d", __func__,
8530 pMac->roam.configParam.MAWCEnabled,
8531 MAWCEnabled);
8532 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8533 sme_ReleaseGlobalLock( &pMac->sme );
8534 }
8535
8536 return status ;
8537
8538}
8539
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008540#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8541/*--------------------------------------------------------------------------
8542 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8543 This is a synchronuous call
8544 \param hHal - The handle returned by macOpen.
8545 \return eHAL_STATUS_SUCCESS
8546 Other status means SME is failed
8547 \sa
8548 --------------------------------------------------------------------------*/
8549
8550eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8551 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8552{
8553
8554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8555 eHalStatus status = eHAL_STATUS_SUCCESS;
8556
8557 status = sme_AcquireGlobalLock( &pMac->sme );
8558 if ( HAL_STATUS_SUCCESS( status ) )
8559 {
8560 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
8561 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
8562 {
8563 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
8564 }
8565 sme_ReleaseGlobalLock( &pMac->sme );
8566 }
8567
8568 return status;
8569}
8570#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008571#endif /* FEATURE_WLAN_LFR */
8572
8573#ifdef FEATURE_WLAN_CCX
8574/*--------------------------------------------------------------------------
8575 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
8576 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8577 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008578 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008579 \param hHal - The handle returned by macOpen.
8580 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
8581 Other status means SME is failed to update isCcxIniFeatureEnabled.
8582 \sa
8583 --------------------------------------------------------------------------*/
8584
8585eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008586 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008587{
8588 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8589
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008590 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
8591 {
8592 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8593 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8594 pMac->roam.configParam.isCcxIniFeatureEnabled,
8595 isCcxIniFeatureEnabled);
8596 return eHAL_STATUS_SUCCESS;
8597 }
8598
Srinivas Girigowdade697412013-02-14 16:31:48 -08008599 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8600 "%s: CcxEnabled is changed from %d to %d", __func__,
8601 pMac->roam.configParam.isCcxIniFeatureEnabled,
8602 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008603 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008604 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008605
8606 if(TRUE == isCcxIniFeatureEnabled)
8607 {
8608 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008609 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07008610
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008611#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8612 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8613 {
8614 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
8615 }
8616#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008617 return eHAL_STATUS_SUCCESS;
8618}
8619#endif /* FEATURE_WLAN_CCX */
8620
8621/*--------------------------------------------------------------------------
8622 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
8623 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8624 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008625 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008626 \param hHal - The handle returned by macOpen.
8627 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
8628 Other status means SME is failed to update fEnableFwRssiMonitoring.
8629 \sa
8630 --------------------------------------------------------------------------*/
8631
8632eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
8633 v_BOOL_t fEnableFwRssiMonitoring)
8634{
8635 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
8636
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008637 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
8638 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
8639 {
8640 halStatus = eHAL_STATUS_FAILURE;
8641 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008642 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008643 }
8644
8645 return (halStatus);
8646}
8647
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008648#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08008649/*--------------------------------------------------------------------------
8650 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
8651 This is a synchronous call
8652 \param hHal - The handle returned by macOpen.
8653 \return eHAL_STATUS_SUCCESS - SME update config successful.
8654 Other status means SME is failed to update
8655 \sa
8656 --------------------------------------------------------------------------*/
8657eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
8658 v_U8_t neighborLookupRssiThreshold)
8659{
8660 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8661 eHalStatus status = eHAL_STATUS_SUCCESS;
8662
8663 status = sme_AcquireGlobalLock( &pMac->sme );
8664 if ( HAL_STATUS_SUCCESS( status ) )
8665 {
8666 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
8667 if (HAL_STATUS_SUCCESS(status))
8668 {
8669 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8670 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
8671 neighborLookupRssiThreshold,
8672 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
8673 pMac->roam.neighborRoamInfo.neighborRoamState);
8674 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
8675 neighborLookupRssiThreshold;
8676 }
8677 sme_ReleaseGlobalLock( &pMac->sme );
8678 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008679 return status;
8680}
8681
8682/*--------------------------------------------------------------------------
8683 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
8684 This is a synchronous call
8685 \param hHal - The handle returned by macOpen.
8686 \return eHAL_STATUS_SUCCESS - SME update config successful.
8687 Other status means SME is failed to update
8688 \sa
8689 --------------------------------------------------------------------------*/
8690eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
8691 v_U8_t neighborReassocRssiThreshold)
8692{
8693 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8694 eHalStatus status = eHAL_STATUS_SUCCESS;
8695
8696 status = sme_AcquireGlobalLock( &pMac->sme );
8697 if ( HAL_STATUS_SUCCESS( status ) )
8698 {
8699 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8700 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
8701 neighborReassocRssiThreshold,
8702 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
8703 pMac->roam.neighborRoamInfo.neighborRoamState);
8704 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
8705 neighborReassocRssiThreshold;
8706 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
8707 neighborReassocRssiThreshold;
8708 sme_ReleaseGlobalLock( &pMac->sme );
8709 }
8710
8711 return status ;
8712}
8713
8714
8715/*--------------------------------------------------------------------------
8716 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
8717 This is a synchronous call
8718 \param hHal - The handle returned by macOpen.
8719 \return eHAL_STATUS_SUCCESS - SME update config successful.
8720 Other status means SME is failed to update
8721 \sa
8722 --------------------------------------------------------------------------*/
8723v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
8724{
8725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8726 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
8727}
8728
8729/*--------------------------------------------------------------------------
8730 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
8731 This is a synchronous call
8732 \param hHal - The handle returned by macOpen.
8733 \return eHAL_STATUS_SUCCESS - SME update config successful.
8734 Other status means SME is failed to update
8735 \sa
8736 --------------------------------------------------------------------------*/
8737eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
8738 v_U16_t neighborScanResultsRefreshPeriod)
8739{
8740 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8741 eHalStatus status = eHAL_STATUS_SUCCESS;
8742
8743 status = sme_AcquireGlobalLock( &pMac->sme );
8744 if ( HAL_STATUS_SUCCESS( status ) )
8745 {
8746 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8747 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
8748 neighborScanResultsRefreshPeriod,
8749 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
8750 pMac->roam.neighborRoamInfo.neighborRoamState);
8751 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
8752 neighborScanResultsRefreshPeriod;
8753 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
8754 neighborScanResultsRefreshPeriod;
8755
8756 sme_ReleaseGlobalLock( &pMac->sme );
8757 }
8758
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008759#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8760 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8761 {
8762 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8763 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
8764 }
8765#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008766 return status ;
8767}
8768
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008769#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8770/*--------------------------------------------------------------------------
8771 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
8772 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8773 gRoamScanOffloadEnabled.
8774 This is a synchronous call
8775 \param hHal - The handle returned by macOpen.
8776 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8777 Other status means SME is failed to update.
8778 \sa
8779 --------------------------------------------------------------------------*/
8780
8781eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
8782 v_BOOL_t nRoamScanOffloadEnabled)
8783{
8784 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8785 eHalStatus status = eHAL_STATUS_SUCCESS;
8786
8787 status = sme_AcquireGlobalLock( &pMac->sme );
8788 if ( HAL_STATUS_SUCCESS( status ) )
8789 {
8790 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8791 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
8792 pMac->roam.configParam.isRoamOffloadScanEnabled,
8793 nRoamScanOffloadEnabled);
8794 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
8795 sme_ReleaseGlobalLock( &pMac->sme );
8796 }
8797
8798 return status ;
8799}
8800#endif
8801
Srinivas Girigowdade697412013-02-14 16:31:48 -08008802/*--------------------------------------------------------------------------
8803 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
8804 This is a synchronous call
8805 \param hHal - The handle returned by macOpen.
8806 \return v_U16_t - Neighbor scan results refresh period value
8807 \sa
8808 --------------------------------------------------------------------------*/
8809v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
8810{
8811 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8812 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
8813}
8814
8815/*--------------------------------------------------------------------------
8816 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
8817 This is a synchronuous call
8818 \param hHal - The handle returned by macOpen.
8819 \return eHAL_STATUS_SUCCESS - SME update config successful.
8820 Other status means SME is failed to update
8821 \sa
8822 --------------------------------------------------------------------------*/
8823v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
8824{
8825 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8826 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
8827}
8828
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008829/* ---------------------------------------------------------------------------
8830 \fn sme_UpdateEmptyScanRefreshPeriod
8831 \brief Update nEmptyScanRefreshPeriod
8832 This function is called through dynamic setConfig callback function
8833 to configure nEmptyScanRefreshPeriod
8834 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
8835 \param hHal - HAL handle for device
8836 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
8837 \- return Success or failure
8838 -------------------------------------------------------------------------*/
8839
8840eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
8841{
8842 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8843 eHalStatus status = eHAL_STATUS_SUCCESS;
8844
8845 status = sme_AcquireGlobalLock( &pMac->sme );
8846 if ( HAL_STATUS_SUCCESS( status ) )
8847 {
8848 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8849 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
8850 nEmptyScanRefreshPeriod,
8851 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
8852 pMac->roam.neighborRoamInfo.neighborRoamState);
8853 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
8854 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
8855 sme_ReleaseGlobalLock( &pMac->sme );
8856 }
8857
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008858#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8859 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8860 {
8861 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8862 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
8863 }
8864#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008865 return status ;
8866}
8867
8868/* ---------------------------------------------------------------------------
8869 \fn sme_setNeighborScanMinChanTime
8870 \brief Update nNeighborScanMinChanTime
8871 This function is called through dynamic setConfig callback function
8872 to configure gNeighborScanChannelMinTime
8873 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
8874 \param hHal - HAL handle for device
8875 \param nNeighborScanMinChanTime - Channel minimum dwell time
8876 \- return Success or failure
8877 -------------------------------------------------------------------------*/
8878eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
8879{
8880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8881 eHalStatus status = eHAL_STATUS_SUCCESS;
8882
8883 status = sme_AcquireGlobalLock( &pMac->sme );
8884 if ( HAL_STATUS_SUCCESS( status ) )
8885 {
8886 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8887 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
8888 nNeighborScanMinChanTime,
8889 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
8890 pMac->roam.neighborRoamInfo.neighborRoamState);
8891 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
8892 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
8893 sme_ReleaseGlobalLock( &pMac->sme );
8894 }
8895
8896 return status ;
8897}
8898
8899/* ---------------------------------------------------------------------------
8900 \fn sme_setNeighborScanMaxChanTime
8901 \brief Update nNeighborScanMaxChanTime
8902 This function is called through dynamic setConfig callback function
8903 to configure gNeighborScanChannelMaxTime
8904 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
8905 \param hHal - HAL handle for device
8906 \param nNeighborScanMinChanTime - Channel maximum dwell time
8907 \- return Success or failure
8908 -------------------------------------------------------------------------*/
8909eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
8910{
8911 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8912 eHalStatus status = eHAL_STATUS_SUCCESS;
8913
8914 status = sme_AcquireGlobalLock( &pMac->sme );
8915 if ( HAL_STATUS_SUCCESS( status ) )
8916 {
8917 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8918 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
8919 nNeighborScanMaxChanTime,
8920 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
8921 pMac->roam.neighborRoamInfo.neighborRoamState);
8922 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
8923 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
8924 sme_ReleaseGlobalLock( &pMac->sme );
8925 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008926#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8927 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8928 {
8929 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8930 REASON_SCAN_CH_TIME_CHANGED);
8931 }
8932#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008933
8934 return status ;
8935}
8936
8937/* ---------------------------------------------------------------------------
8938 \fn sme_getNeighborScanMinChanTime
8939 \brief get neighbor scan min channel time
8940 \param hHal - The handle returned by macOpen.
8941 \return v_U16_t - channel min time value
8942 -------------------------------------------------------------------------*/
8943v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
8944{
8945 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8946 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
8947}
8948
8949/* ---------------------------------------------------------------------------
8950 \fn sme_getNeighborScanMaxChanTime
8951 \brief get neighbor scan max channel time
8952 \param hHal - The handle returned by macOpen.
8953 \return v_U16_t - channel max time value
8954 -------------------------------------------------------------------------*/
8955v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
8956{
8957 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8958 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
8959}
8960
8961/* ---------------------------------------------------------------------------
8962 \fn sme_setNeighborScanPeriod
8963 \brief Update nNeighborScanPeriod
8964 This function is called through dynamic setConfig callback function
8965 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008966 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008967 \param hHal - HAL handle for device
8968 \param nNeighborScanPeriod - neighbor scan period
8969 \- return Success or failure
8970 -------------------------------------------------------------------------*/
8971eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
8972{
8973 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8974 eHalStatus status = eHAL_STATUS_SUCCESS;
8975
8976 status = sme_AcquireGlobalLock( &pMac->sme );
8977 if ( HAL_STATUS_SUCCESS( status ) )
8978 {
8979 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8980 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
8981 nNeighborScanPeriod,
8982 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
8983 pMac->roam.neighborRoamInfo.neighborRoamState);
8984 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
8985 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
8986 sme_ReleaseGlobalLock( &pMac->sme );
8987 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008988#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8989 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8990 {
8991 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8992 REASON_SCAN_HOME_TIME_CHANGED);
8993 }
8994#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008995
8996 return status ;
8997}
8998
8999/* ---------------------------------------------------------------------------
9000 \fn sme_getNeighborScanPeriod
9001 \brief get neighbor scan period
9002 \param hHal - The handle returned by macOpen.
9003 \return v_U16_t - neighbor scan period
9004 -------------------------------------------------------------------------*/
9005v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9006{
9007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9008 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9009}
9010
9011#endif
9012
Srinivas Girigowdade697412013-02-14 16:31:48 -08009013#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009014
Srinivas Girigowdade697412013-02-14 16:31:48 -08009015/*--------------------------------------------------------------------------
9016 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9017 This is a synchronous call
9018 \param hHal - The handle returned by macOpen.
9019 \return v_U16_t - Rssi diff value
9020 \sa
9021 --------------------------------------------------------------------------*/
9022v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9023{
9024 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9025 return pMac->roam.configParam.RoamRssiDiff;
9026}
9027
9028/*--------------------------------------------------------------------------
9029 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9030 This is a synchronous call
9031 \param hHal - The handle returned by macOpen.
9032 \return eHAL_STATUS_SUCCESS - SME update config successful.
9033 Other status means SME is failed to update
9034 \sa
9035 --------------------------------------------------------------------------*/
9036eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9037 tANI_U8 numChannels)
9038{
9039 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9040 eHalStatus status = eHAL_STATUS_SUCCESS;
9041 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009042 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309043 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009044 tANI_U8 i = 0, j = 0;
9045
9046 status = sme_AcquireGlobalLock( &pMac->sme );
9047 if ( HAL_STATUS_SUCCESS( status ) )
9048 {
9049 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9050 {
9051 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9052 {
9053 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9054 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9055 }
9056 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009057 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009058 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009059 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
9060
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009061 if ( HAL_STATUS_SUCCESS( status ))
Srinivas Girigowdade697412013-02-14 16:31:48 -08009062 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009063 sme_SetRoamScanControl(hHal, 1);
9064 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009065 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009066 j = 0;
9067 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9068 {
9069 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9070 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9071 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009072 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009073
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009074 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9075 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
9076 newChannelList, oldChannelList,
9077 pMac->roam.neighborRoamInfo.neighborRoamState);
9078 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009079 sme_ReleaseGlobalLock( &pMac->sme );
9080 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009081#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9082 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9083 {
9084 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9085 }
9086#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009087
9088 return status ;
9089}
9090
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009091
9092#ifdef FEATURE_WLAN_CCX_UPLOAD
9093/*--------------------------------------------------------------------------
9094 \brief sme_SetCcxRoamScanChannelList() - set ccx roam scan channel list
9095 This is a synchronuous call
9096 \param hHal - The handle returned by macOpen.
9097 \return eHAL_STATUS_SUCCESS - SME update config successful.
9098 Other status means SME is failed to update
9099 \sa
9100 --------------------------------------------------------------------------*/
9101eHalStatus sme_SetCcxRoamScanChannelList(tHalHandle hHal,
9102 tANI_U8 *pChannelList,
9103 tANI_U8 numChannels)
9104{
9105 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9106 eHalStatus status = eHAL_STATUS_SUCCESS;
9107 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9108 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9109 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9110 tANI_U8 newChannelList[128] = {0};
9111 tANI_U8 i = 0, j = 0;
9112
9113 status = sme_AcquireGlobalLock( &pMac->sme );
9114 if ( HAL_STATUS_SUCCESS( status ) )
9115 {
9116 if (NULL != currChannelListInfo->ChannelList)
9117 {
9118 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9119 {
9120 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9121 currChannelListInfo->ChannelList[i]);
9122 }
9123 }
9124 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9125
9126 if ( HAL_STATUS_SUCCESS( status ))
9127 {
9128 if (NULL != currChannelListInfo->ChannelList)
9129 {
9130 j = 0;
9131 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9132 {
9133 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9134 currChannelListInfo->ChannelList[i]);
9135 }
9136 }
9137
9138 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9139 "CCX roam scan channel list successfully set to %s - old value is %s - roam state is %d",
9140 newChannelList, oldChannelList,
9141 pMac->roam.neighborRoamInfo.neighborRoamState);
9142 }
9143 sme_ReleaseGlobalLock( &pMac->sme );
9144 }
9145#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9146 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9147 {
9148 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9149 }
9150#endif
9151
9152 return status ;
9153}
9154#endif
9155
Srinivas Girigowdade697412013-02-14 16:31:48 -08009156/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009157 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
9158 This is a synchronous call
9159 \param hHal - The handle returned by macOpen.
9160 \return eHAL_STATUS_SUCCESS - SME update config successful.
9161 Other status means SME is failed to update
9162 \sa
9163 --------------------------------------------------------------------------*/
9164eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
9165 eCsrBand eBand)
9166{
9167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9168 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
9169}
9170
9171/*--------------------------------------------------------------------------
9172 \brief sme_getRoamScanChannelList() - get roam scan channel list
9173 This is a synchronous call
9174 \param hHal - The handle returned by macOpen.
9175 \return eHAL_STATUS_SUCCESS - SME update config successful.
9176 Other status means SME is failed to update
9177 \sa
9178 --------------------------------------------------------------------------*/
9179eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9180 tANI_U8 *pNumChannels)
9181{
9182 int i = 0;
9183 tANI_U8 *pOutPtr = pChannelList;
9184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9185 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9186 eHalStatus status = eHAL_STATUS_SUCCESS;
9187
9188 status = sme_AcquireGlobalLock( &pMac->sme );
9189 if ( HAL_STATUS_SUCCESS( status ) )
9190 {
9191 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9192 {
9193 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9194 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009195 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009196 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009197 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009198 }
9199
9200 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9201 for (i = 0; i < (*pNumChannels); i++)
9202 {
9203 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9204 }
9205 pOutPtr[i] = '\0';
9206 sme_ReleaseGlobalLock( &pMac->sme );
9207 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009208 return status ;
9209}
9210
9211/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009212 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
9213 This is a synchronuous call
9214 \param hHal - The handle returned by macOpen.
9215 \return TRUE (1) - if the CCX feature is enabled
9216 FALSE (0) - if feature is disabled (compile or runtime)
9217 \sa
9218 --------------------------------------------------------------------------*/
9219tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009220{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009221#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08009222 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009223 return csrRoamIsCcxIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009224#else
9225 return eANI_BOOLEAN_FALSE;
9226#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009227}
9228
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009229/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009230 \brief sme_GetWESMode() - get WES Mode
9231 This is a synchronous call
9232 \param hHal - The handle returned by macOpen
9233 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9234 \sa
9235 --------------------------------------------------------------------------*/
9236v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9237{
9238 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9239 return pMac->roam.configParam.isWESModeEnabled;
9240}
9241
9242/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009243 \brief sme_GetRoamScanControl() - get scan control
9244 This is a synchronous call
9245 \param hHal - The handle returned by macOpen.
9246 \return v_BOOL_t - Enabled(1)/Disabled(0)
9247 \sa
9248 --------------------------------------------------------------------------*/
9249v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9250{
9251 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9252 return pMac->roam.configParam.nRoamScanControl;
9253}
9254#endif
9255
9256/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009257 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9258 This is a synchronuous call
9259 \param hHal - The handle returned by macOpen.
9260 \return TRUE (1) - if the feature is enabled
9261 FALSE (0) - if feature is disabled (compile or runtime)
9262 \sa
9263 --------------------------------------------------------------------------*/
9264tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9265{
9266#ifdef FEATURE_WLAN_LFR
9267 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9268 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9269#else
9270 return eANI_BOOLEAN_FALSE;
9271#endif
9272}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009273
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009274/*--------------------------------------------------------------------------
9275 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9276 This is a synchronuous call
9277 \param hHal - The handle returned by macOpen.
9278 \return TRUE (1) - if the feature is enabled
9279 FALSE (0) - if feature is disabled (compile or runtime)
9280 \sa
9281 --------------------------------------------------------------------------*/
9282tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9283{
9284#ifdef WLAN_FEATURE_VOWIFI_11R
9285 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9286 return pMac->roam.configParam.isFastTransitionEnabled;
9287#else
9288 return eANI_BOOLEAN_FALSE;
9289#endif
9290}
9291
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009292
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009293/* ---------------------------------------------------------------------------
9294 \fn sme_IsFeatureSupportedByFW
9295 \brief Check if an feature is enabled by FW
9296
9297 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
9298 \- return 1/0 (TRUE/FALSE)
9299 -------------------------------------------------------------------------*/
9300tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9301{
9302 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9303}
9304#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309305
9306/* ---------------------------------------------------------------------------
9307 \fn sme_SendTdlsMgmtFrame
9308 \brief API to send TDLS management frames.
9309
9310 \param peerMac - peer's Mac Adress.
9311 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9312 \- return VOS_STATUS_SUCCES
9313 -------------------------------------------------------------------------*/
9314VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9315 tANI_U8 sessionId,
9316 tSirMacAddr peerMac,
9317 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9318{
9319 eHalStatus status = eHAL_STATUS_SUCCESS;
9320 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9321
9322 status = sme_AcquireGlobalLock( &pMac->sme );
9323
9324 if ( HAL_STATUS_SUCCESS( status ) )
9325 {
9326 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9327 sme_ReleaseGlobalLock( &pMac->sme );
9328 }
9329 return status ;
9330}
9331
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009332/* ---------------------------------------------------------------------------
9333 \fn sme_SendTdlsMgmtFrame
9334 \brief API to send TDLS management frames.
9335
9336 \param peerMac - peer's Mac Adress.
9337 \param frame_type - Type of TDLS mgmt frame to be sent.
9338 \param dialog - dialog token used in the frame.
9339 \param status - status to be incuded in the frame.
9340 \param buf - additional IEs to be included
9341 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009342 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009343 \- return VOS_STATUS_SUCCES
9344 -------------------------------------------------------------------------*/
9345VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08009346 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 -08009347{
9348 eHalStatus status = eHAL_STATUS_SUCCESS;
9349 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9350 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9351
9352 status = sme_AcquireGlobalLock( &pMac->sme );
9353 if ( HAL_STATUS_SUCCESS( status ) )
9354 {
9355 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9356 sendTdlsReq.frameType = frame_type;
9357 sendTdlsReq.buf = buf;
9358 sendTdlsReq.len = len;
9359 sendTdlsReq.dialog = dialog;
9360 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009361 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009362
9363 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9364
9365 sme_ReleaseGlobalLock( &pMac->sme );
9366 }
9367
9368 return status ;
9369
9370}
9371/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009372 \fn sme_ChangeTdlsPeerSta
9373 \brief API to Update TDLS peer sta parameters.
9374
9375 \param peerMac - peer's Mac Adress.
9376 \param staParams - Peer Station Parameters
9377 \- return VOS_STATUS_SUCCES
9378 -------------------------------------------------------------------------*/
9379VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9380 tCsrStaParams *pstaParams)
9381{
9382 eHalStatus status = eHAL_STATUS_SUCCESS;
9383 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9384
9385 status = sme_AcquireGlobalLock( &pMac->sme );
9386 if ( HAL_STATUS_SUCCESS( status ) )
9387 {
9388 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9389
9390 sme_ReleaseGlobalLock( &pMac->sme );
9391 }
9392
9393 return status ;
9394
9395}
9396
9397/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009398 \fn sme_AddTdlsPeerSta
9399 \brief API to Add TDLS peer sta entry.
9400
9401 \param peerMac - peer's Mac Adress.
9402 \- return VOS_STATUS_SUCCES
9403 -------------------------------------------------------------------------*/
9404VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9405{
9406 eHalStatus status = eHAL_STATUS_SUCCESS;
9407 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9408
9409 status = sme_AcquireGlobalLock( &pMac->sme );
9410 if ( HAL_STATUS_SUCCESS( status ) )
9411 {
9412 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9413
9414 sme_ReleaseGlobalLock( &pMac->sme );
9415 }
9416
9417 return status ;
9418
9419}
9420/* ---------------------------------------------------------------------------
9421 \fn sme_DeleteTdlsPeerSta
9422 \brief API to Delete TDLS peer sta entry.
9423
9424 \param peerMac - peer's Mac Adress.
9425 \- return VOS_STATUS_SUCCES
9426 -------------------------------------------------------------------------*/
9427VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9428{
9429 eHalStatus status = eHAL_STATUS_SUCCESS;
9430 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9431
9432 status = sme_AcquireGlobalLock( &pMac->sme );
9433 if ( HAL_STATUS_SUCCESS( status ) )
9434 {
9435 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9436
9437 sme_ReleaseGlobalLock( &pMac->sme );
9438 }
9439
9440 return status ;
9441
9442}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009443/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009444 \fn sme_SetTdlsPowerSaveProhibited
9445 \API to set/reset the isTdlsPowerSaveProhibited.
9446
9447 \- return void
9448 -------------------------------------------------------------------------*/
9449void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9450{
9451 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9452
9453 pMac->isTdlsPowerSaveProhibited = val;
9454 return;
9455}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009456#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309457/* ---------------------------------------------------------------------------
9458 \fn sme_IsPmcBmps
9459 \API to Check if PMC state is BMPS.
9460
9461 \- return v_BOOL_t
9462 -------------------------------------------------------------------------*/
9463v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9464{
9465 return (BMPS == pmcGetPmcState(hHal));
9466}
9467
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009468#ifdef FEATURE_WLAN_TDLS_INTERNAL
9469/*
9470 * SME API to start TDLS discovery Procedure
9471 */
9472VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9473{
9474 VOS_STATUS status = VOS_STATUS_SUCCESS;
9475 tCsrTdlsDisRequest disReq = {{0}} ;
9476 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9477 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9478
9479 return status ;
9480
9481}
9482
9483/*
9484 * Process TDLS discovery results
9485 */
9486v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9487 tSmeTdlsDisResult *disResult, v_U8_t listType)
9488{
9489 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9490 tSirTdlsPeerInfo *peerInfo = NULL ;
9491 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9492 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9493 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9494 tListElem *pEntry = NULL ;
9495 v_U8_t peerCnt = 0 ;
9496
9497 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009498 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009499 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9500 while(pEntry)
9501 {
9502 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9503 tdlsPeerStaLink) ;
9504 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9505
9506 switch(listType)
9507 {
9508 case TDLS_SETUP_LIST:
9509 {
9510 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9511 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309512 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9513 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009514 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9515 peerCnt++ ;
9516 }
9517 break ;
9518 }
9519 case TDLS_DIS_LIST:
9520 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309521 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9522 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009523 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9524 peerCnt++ ;
9525 break ;
9526 }
9527 default:
9528 {
9529 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009530 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009531 break ;
9532 }
9533 }
9534
9535 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
9536 }
9537
9538 return peerCnt ;
9539
9540}
9541
9542/*
9543 * SME API to start TDLS link setup Procedure.
9544 */
9545VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9546{
9547 VOS_STATUS status = VOS_STATUS_SUCCESS;
9548 tCsrTdlsSetupRequest setupReq = {{0}} ;
9549 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9550 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
9551 return status ;
9552
9553}
9554
9555/*
9556 * SME API to start TDLS link Teardown Procedure.
9557 */
9558VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9559{
9560 VOS_STATUS status = VOS_STATUS_SUCCESS;
9561 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
9562 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9563 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
9564 return status ;
9565
9566}
9567
9568#endif /* FEATURE_WLAN_TDLS */
9569
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07009570eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
9571{
9572 eHalStatus status = eHAL_STATUS_FAILURE;
9573 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9574
9575 smsLog(pMac, LOG2, FL("enter"));
9576 status = sme_AcquireGlobalLock( &pMac->sme );
9577 if ( HAL_STATUS_SUCCESS( status ) )
9578 {
9579 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
9580 sme_ReleaseGlobalLock( &pMac->sme );
9581 }
9582 smsLog(pMac, LOG2, FL("exit status %d"), status);
9583
9584 return (status);
9585}
9586
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07009587/*
9588 * SME API to enable/disable WLAN driver initiated SSR
9589 */
9590void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
9591{
9592 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9593 eHalStatus status = eHAL_STATUS_SUCCESS;
9594
9595 status = sme_AcquireGlobalLock(&pMac->sme);
9596 if (HAL_STATUS_SUCCESS(status))
9597 {
9598 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9599 "SSR level is changed %d", enableSSR);
9600 /* not serializing this messsage, as this is only going
9601 * to set a variable in WDA/WDI
9602 */
9603 WDA_SetEnableSSR(enableSSR);
9604 sme_ReleaseGlobalLock(&pMac->sme);
9605 }
9606 return;
9607}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009608
9609/*
9610 * SME API to determine the channel bonding mode
9611 */
9612VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
9613{
9614 tSmeConfigParams smeConfig;
9615 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9616
9617 if (
9618#ifdef WLAN_FEATURE_11AC
9619 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
9620 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
9621#endif
9622 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
9623 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
9624 )
9625 {
9626 return VOS_STATUS_SUCCESS;
9627 }
9628
9629 /* If channel bonding mode is not required */
9630 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
9631 return VOS_STATUS_SUCCESS;
9632 }
9633
9634 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
9635 sme_GetConfigParam(pMac, &smeConfig);
9636
9637#ifdef WLAN_FEATURE_11AC
9638 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
9639 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
9640 {
9641 if ( channel== 36 || channel == 52 || channel == 100 ||
9642 channel == 116 || channel == 149 )
9643 {
9644 smeConfig.csrConfig.channelBondingMode5GHz =
9645 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
9646 }
9647 else if ( channel == 40 || channel == 56 || channel == 104 ||
9648 channel == 120 || channel == 153 )
9649 {
9650 smeConfig.csrConfig.channelBondingMode5GHz =
9651 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
9652 }
9653 else if ( channel == 44 || channel == 60 || channel == 108 ||
9654 channel == 124 || channel == 157 )
9655 {
9656 smeConfig.csrConfig.channelBondingMode5GHz =
9657 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
9658 }
9659 else if ( channel == 48 || channel == 64 || channel == 112 ||
9660 channel == 128 || channel == 161 )
9661 {
9662 smeConfig.csrConfig.channelBondingMode5GHz =
9663 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
9664 }
9665 else if ( channel == 165 )
9666 {
9667 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9668 }
9669 }
9670#endif
9671
9672 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
9673 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
9674 {
9675 if ( channel== 40 || channel == 48 || channel == 56 ||
9676 channel == 64 || channel == 104 || channel == 112 ||
9677 channel == 120 || channel == 128 || channel == 136 ||
9678 channel == 144 || channel == 153 || channel == 161 )
9679 {
9680 smeConfig.csrConfig.channelBondingMode5GHz = 1;
9681 }
9682 else if ( channel== 36 || channel == 44 || channel == 52 ||
9683 channel == 60 || channel == 100 || channel == 108 ||
9684 channel == 116 || channel == 124 || channel == 132 ||
9685 channel == 140 || channel == 149 || channel == 157 )
9686 {
9687 smeConfig.csrConfig.channelBondingMode5GHz = 2;
9688 }
9689 else if ( channel == 165 )
9690 {
9691 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9692 }
9693 }
9694 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonce8ad512013-10-30 12:34:42 -07009695 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009696
9697 sme_UpdateConfig (pMac, &smeConfig);
9698 return VOS_STATUS_SUCCESS;
9699}
9700
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07009701/*--------------------------------------------------------------------------
9702
9703 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
9704 \param hHal - The handle returned by macOpen.
9705 \param currDeviceMode - Current operating device mode.
9706 --------------------------------------------------------------------------*/
9707
9708void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
9709{
9710 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9711 pMac->sme.currDeviceMode = currDeviceMode;
9712 return;
9713}
9714
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07009715#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9716/*--------------------------------------------------------------------------
9717 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
9718 from CSR.
9719 This is a synchronous call
9720 \param hHal - The handle returned by macOpen
9721 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
9722 BSSID, channel etc.)
9723 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
9724 Other status means SME is failed to send the request.
9725 \sa
9726 --------------------------------------------------------------------------*/
9727
9728eHalStatus sme_HandoffRequest(tHalHandle hHal,
9729 tCsrHandoffRequest *pHandoffInfo)
9730{
9731 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9732 eHalStatus status = eHAL_STATUS_SUCCESS;
9733
9734 status = sme_AcquireGlobalLock( &pMac->sme );
9735 if ( HAL_STATUS_SUCCESS( status ) )
9736 {
9737 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9738 "%s: invoked", __func__);
9739 status = csrHandoffRequest(pMac, pHandoffInfo);
9740 sme_ReleaseGlobalLock( &pMac->sme );
9741 }
9742
9743 return status ;
9744}
9745#endif
9746
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07009747/*
9748 * SME API to check if there is any infra station or
9749 * P2P client is connected
9750 */
9751VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
9752{
9753 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9754 if(csrIsInfraConnected(pMac))
9755 {
9756 return VOS_STATUS_SUCCESS;
9757 }
9758 return VOS_STATUS_E_FAILURE;
9759}
9760
Leo Chang9056f462013-08-01 19:21:11 -07009761
9762#ifdef FEATURE_WLAN_LPHB
9763/* ---------------------------------------------------------------------------
9764 \fn sme_LPHBConfigReq
9765 \API to make configuration LPHB within FW.
9766 \param hHal - The handle returned by macOpen
9767 \param lphdReq - LPHB request argument by client
9768 \param pCallbackfn - LPHB timeout notification callback function pointer
9769 \- return Configuration message posting status, SUCCESS or Fail
9770 -------------------------------------------------------------------------*/
9771eHalStatus sme_LPHBConfigReq
9772(
9773 tHalHandle hHal,
9774 tSirLPHBReq *lphdReq,
9775 void (*pCallbackfn)(void *pAdapter, void *indParam)
9776)
9777{
9778 eHalStatus status = eHAL_STATUS_SUCCESS;
9779 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9780 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9781 vos_msg_t vosMessage;
9782
9783 status = sme_AcquireGlobalLock(&pMac->sme);
9784 if (eHAL_STATUS_SUCCESS == status)
9785 {
9786 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
9787 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -07009788 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -07009789 {
9790 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9791 "%s: Indication Call back did not registered", __func__);
9792 sme_ReleaseGlobalLock(&pMac->sme);
9793 return eHAL_STATUS_FAILURE;
9794 }
9795 else if (NULL != pCallbackfn)
9796 {
Leo Changd9df8aa2013-09-26 13:32:26 -07009797 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -07009798 }
9799
9800 /* serialize the req through MC thread */
9801 vosMessage.bodyptr = lphdReq;
9802 vosMessage.type = WDA_LPHB_CONF_REQ;
9803 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
9804 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
9805 {
9806 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9807 "%s: Post Config LPHB MSG fail", __func__);
9808 status = eHAL_STATUS_FAILURE;
9809 }
9810 sme_ReleaseGlobalLock(&pMac->sme);
9811 }
9812
9813 return(status);
9814}
9815#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07009816/*--------------------------------------------------------------------------
9817 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
9818 scan parameter.
9819 This is a synchronous call
9820 \param hHal - The handle returned by macOpen
9821 \return NONE.
9822 \sa
9823 --------------------------------------------------------------------------*/
9824void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
9825 tANI_U8 nNumP2PChan)
9826{
9827 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9828
9829 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
9830 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
9831
9832 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9833 "%s: SCAN nNumStaChanCombinedConc : %d,"
9834 "nNumP2PChanCombinedConc : %d ",
9835 __func__, nNumStaChan, nNumP2PChan);
9836
9837 return;
9838
9839}
Leo Chang9056f462013-08-01 19:21:11 -07009840
Yue Mab9c86f42013-08-14 15:59:08 -07009841/* ---------------------------------------------------------------------------
9842 \fn sme_AddPeriodicTxPtrn
9843 \brief API to Periodic TX Pattern Offload feature
9844 \param hHal - The handle returned by macOpen
9845 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
9846 \return eHalStatus
9847 ---------------------------------------------------------------------------*/
9848eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
9849 *addPeriodicTxPtrnParams)
9850{
9851 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9852 eHalStatus status;
9853 vos_msg_t msg;
9854
9855 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
9856 {
9857 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
9858 msg.bodyptr = addPeriodicTxPtrnParams;
9859
9860 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
9861 {
9862 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
9863 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
9864 __func__);
9865
9866 sme_ReleaseGlobalLock(&pMac->sme);
9867 return eHAL_STATUS_FAILURE;
9868 }
9869
9870 sme_ReleaseGlobalLock(&pMac->sme);
9871 return eHAL_STATUS_SUCCESS;
9872 }
9873
9874 return status;
9875}
9876
9877/* ---------------------------------------------------------------------------
9878 \fn sme_DelPeriodicTxPtrn
9879 \brief API to Periodic TX Pattern Offload feature
9880 \param hHal - The handle returned by macOpen
9881 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
9882 \return eHalStatus
9883 ---------------------------------------------------------------------------*/
9884eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
9885 *delPeriodicTxPtrnParams)
9886{
9887 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9888 eHalStatus status;
9889 vos_msg_t msg;
9890
9891 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
9892 {
9893 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
9894 msg.bodyptr = delPeriodicTxPtrnParams;
9895
9896 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
9897 {
9898 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
9899 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
9900 __func__);
9901
9902 sme_ReleaseGlobalLock(&pMac->sme);
9903 return eHAL_STATUS_FAILURE;
9904 }
9905
9906 sme_ReleaseGlobalLock(&pMac->sme);
9907 return eHAL_STATUS_SUCCESS;
9908 }
9909
9910 return status;
9911}
9912
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -07009913void smeGetCommandQStatus( tHalHandle hHal )
9914{
9915 tSmeCmd *pTempCmd = NULL;
9916 tListElem *pEntry;
9917 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9918
9919 if (NULL == pMac)
9920 {
Kiet Lamcffc5862013-10-30 16:28:45 +05309921 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
9922 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -07009923 return;
9924 }
9925
9926 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
9927 if( pEntry )
9928 {
9929 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
9930 }
9931 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
9932 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
9933 if(pTempCmd)
9934 {
9935 if( eSmeCsrCommandMask & pTempCmd->command )
9936 {
9937 //CSR command is stuck. See what the reason code is for that command
9938 dumpCsrCommandInfo(pMac, pTempCmd);
9939 }
9940 } //if(pTempCmd)
9941
9942 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
9943 csrLLCount(&pMac->sme.smeCmdPendingList));
9944
9945 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
9946 csrLLCount(&pMac->roam.roamCmdPendingList));
9947
9948 return;
9949}
Rajeev79dbe4c2013-10-05 11:03:42 +05309950
9951#ifdef FEATURE_WLAN_BATCH_SCAN
9952/* ---------------------------------------------------------------------------
9953 \fn sme_SetBatchScanReq
9954 \brief API to set batch scan request in FW
9955 \param hHal - The handle returned by macOpen.
9956 \param pRequest - Pointer to the batch request.
9957 \param sessionId - session ID
9958 \param callbackRoutine - HDD callback which needs to be invoked after
9959 getting set batch scan response from FW
9960 \param callbackContext - pAdapter context
9961 \return eHalStatus
9962 ---------------------------------------------------------------------------*/
9963eHalStatus sme_SetBatchScanReq
9964(
9965 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
9966 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
9967 void *callbackContext
9968)
9969{
9970 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9971 eHalStatus status;
9972
9973 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
9974 {
9975 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
9976 callbackContext);
9977 sme_ReleaseGlobalLock( &pMac->sme );
9978 }
9979
9980 return status;
9981}
9982
9983/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -07009984 \fn sme_SendRateUpdateInd
9985 \brief API to Update rate
9986 \param hHal - The handle returned by macOpen
9987 \param rateUpdateParams - Pointer to rate update params
9988 \return eHalStatus
9989 ---------------------------------------------------------------------------*/
9990eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
9991{
9992 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9993 eHalStatus status;
9994 vos_msg_t msg;
9995
9996 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
9997 {
9998 msg.type = WDA_RATE_UPDATE_IND;
9999 msg.bodyptr = rateUpdateParams;
10000
10001 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10002 {
10003 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10004 "to post WDA_SET_RMC_RATE_IND to WDA!",
10005 __func__);
10006
10007 sme_ReleaseGlobalLock(&pMac->sme);
10008 return eHAL_STATUS_FAILURE;
10009 }
10010
10011 sme_ReleaseGlobalLock(&pMac->sme);
10012 return eHAL_STATUS_SUCCESS;
10013 }
10014
10015 return status;
10016}
10017
10018/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010019 \fn sme_TriggerBatchScanResultInd
10020 \brief API to trigger batch scan result indications from FW
10021 \param hHal - The handle returned by macOpen.
10022 \param pRequest - Pointer to get batch request.
10023 \param sessionId - session ID
10024 \param callbackRoutine - HDD callback which needs to be invoked after
10025 getting batch scan result indication from FW
10026 \param callbackContext - pAdapter context
10027 \return eHalStatus
10028 ---------------------------------------------------------------------------*/
10029eHalStatus sme_TriggerBatchScanResultInd
10030(
10031 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10032 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10033 void *callbackContext
10034)
10035{
10036 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10037 eHalStatus status;
10038
10039 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10040 {
10041 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10042 callbackRoutine, callbackContext);
10043 sme_ReleaseGlobalLock( &pMac->sme );
10044 }
10045
10046 return status;
10047}
10048
10049
10050/* ---------------------------------------------------------------------------
10051 \fn sme_StopBatchScanInd
10052 \brief API to stop batch scan request in FW
10053 \param hHal - The handle returned by macOpen.
10054 \param pRequest - Pointer to the batch request.
10055 \param sessionId - session ID
10056 \return eHalStatus
10057 ---------------------------------------------------------------------------*/
10058eHalStatus sme_StopBatchScanInd
10059(
10060 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10061)
10062{
10063 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10064 eHalStatus status;
10065
10066 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10067 {
10068 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10069 sme_ReleaseGlobalLock( &pMac->sme );
10070 }
10071
10072 return status;
10073}
10074
10075#endif