blob: d6764660cc6217eee01ad0dbde6032b189ee83a6 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 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
22/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -080023 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
24 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam0fb93dd2014-02-19 00:32:59 -080026 *
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080027 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080028
29
Jeff Johnson295189b2012-06-20 16:38:30 -070030/**=========================================================================
31
32 \file smeApi.c
33
34 \brief Definitions for SME APIs
35
Kiet Lamaa8e15a2014-02-11 23:30:06 -080036 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
37
38 Qualcomm Confidential and Proprietary.
39
Jeff Johnson295189b2012-06-20 16:38:30 -070040 ========================================================================*/
41
42/*===========================================================================
43
44 EDIT HISTORY FOR FILE
45
46
47 This section contains comments describing changes made to the module.
48 Notice that changes are listed in reverse chronological order.
49
50
51
52 when who what, where, why
53---------- --- --------------------------------------------------------
5406/03/10 js Added support to hostapd driven
55 * deauth/disassoc/mic failure
56
57===========================================================================*/
58
59/*--------------------------------------------------------------------------
60 Include Files
61 ------------------------------------------------------------------------*/
62
Jeff Johnson295189b2012-06-20 16:38:30 -070063
64#include "smsDebug.h"
65#include "sme_Api.h"
66#include "csrInsideApi.h"
67#include "smeInside.h"
68#include "csrInternal.h"
69#include "wlan_qct_wda.h"
70#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053071#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070072#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053073#include "vos_types.h"
74#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070075
Jeff Johnson295189b2012-06-20 16:38:30 -070076#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
79
Jeff Johnson295189b2012-06-20 16:38:30 -070080extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
81
82#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053083#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080084#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053085#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080086
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070087
88#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
89
Jeff Johnson295189b2012-06-20 16:38:30 -070090// TxMB Functions
91extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
92 tANI_U32 size, tSmeCmd **ppCmd );
93extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
94extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070095extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
96extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
97extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
98extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
99extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
100extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700101
102static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
103static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
104
105eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
106
107eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
108
Amar Singhal0d15bd52013-10-12 23:13:13 -0700109eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
112
113eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
114
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700115#ifdef FEATURE_WLAN_LFR
116tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
117#endif
118
Chet Lanctot186b5732013-03-18 10:26:30 -0700119#ifdef WLAN_FEATURE_11W
120eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
121 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
122#endif
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124//Internal SME APIs
125eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
126{
127 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
128
129 if(psSme)
130 {
131 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
132 {
133 status = eHAL_STATUS_SUCCESS;
134 }
135 }
136
137 return (status);
138}
139
140
141eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
142{
143 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
144
145 if(psSme)
146 {
147 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
148 {
149 status = eHAL_STATUS_SUCCESS;
150 }
151 }
152
153 return (status);
154}
155
156
157
158static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
159{
160 eHalStatus status;
161 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530162 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700163 VOS_STATUS vosStatus;
164 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
168 &pMac->sme.smeCmdActiveList)))
169 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530171 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
172 &pMac->sme.smeCmdPendingList)))
173 goto end;
174
175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeScanCmdActiveList)))
177 goto end;
178
179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeScanCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeCmdFreeList)))
185 goto end;
186
Kiet Lam64c1b492013-07-12 13:56:44 +0530187 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
188 if ( NULL == pCmd )
189 status = eHAL_STATUS_FAILURE;
190 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530191 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530192 status = eHAL_STATUS_SUCCESS;
193
194 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
195 pMac->sme.pSmeCmdBufAddr = pCmd;
196
197 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
198 {
199 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530200 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530201 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 }
203
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700204 /* This timer is only to debug the active list command timeout */
205
206 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
207 if (cmdTimeoutTimer)
208 {
209 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
210 vosStatus =
211 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
212 VOS_TIMER_TYPE_SW,
213 activeListCmdTimeoutHandle,
214 (void*) pMac);
215
216 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
217 {
218 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
219 "Init Timer fail for active list command process time out");
220 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
221 }
222 else
223 {
224 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
225 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
226 }
227 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530228end:
229 if (!HAL_STATUS_SUCCESS(status))
230 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
231 status);
232
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 return (status);
234}
235
236
237void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
238{
239 pCmd->command = eSmeNoCommand;
240 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
241}
242
243
244
245static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
246{
247 tListElem *pEntry;
248 tSmeCmd *pCommand;
249
250 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
251 {
252 //TODO: base on command type to call release functions
253 //reinitialize different command types so they can be reused
254 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
255 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
256 }
257}
258
259static void purgeSmeCmdList(tpAniSirGlobal pMac)
260{
261 //release any out standing commands back to free command list
262 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
263 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530264 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
265 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700266}
267
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530268void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
269 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700270{
271 //release any out standing commands back to free command list
272 tListElem *pEntry, *pNext;
273 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 tDblLinkList localList;
275
276 vos_mem_zero(&localList, sizeof(tDblLinkList));
277 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
278 {
279 smsLog(pMac, LOGE, FL(" failed to open list"));
280 return;
281 }
282
283 csrLLLock(pList);
284 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
285 while(pEntry != NULL)
286 {
287 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
288 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
289 if(pCommand->sessionId == sessionId)
290 {
291 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
292 {
293 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
294 }
295 }
296 pEntry = pNext;
297 }
298 csrLLUnlock(pList);
299
300 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
301 {
302 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
303 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
304 }
305 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700306}
307
308
309static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
310{
311 eHalStatus status = eHAL_STATUS_SUCCESS;
312
313 purgeSmeCmdList(pMac);
314 csrLLClose(&pMac->sme.smeCmdPendingList);
315 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530316 csrLLClose(&pMac->sme.smeScanCmdPendingList);
317 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 csrLLClose(&pMac->sme.smeCmdFreeList);
319
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700320 /*destroy active list command time out timer */
321 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
322 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
323 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
324
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800325 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
326 if(status != eHAL_STATUS_SUCCESS)
327 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800328 smsLog(pMac, LOGE,
329 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800330 goto done;
331 }
332
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 if(NULL != pMac->sme.pSmeCmdBufAddr)
334 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530335 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 pMac->sme.pSmeCmdBufAddr = NULL;
337 }
338
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800339 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
340 if(status != eHAL_STATUS_SUCCESS)
341 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800342 smsLog(pMac, LOGE,
343 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800344 }
345done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 return (status);
347}
348
349
350void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
351{
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 switch( pCmd->command )
353 {
354 case eSmeCommandScan:
355 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
356 break;
357
358 case eSmeCommandRoam:
359 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
360 break;
361
362 case eSmeCommandWmStatusChange:
363 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
364 break;
365
366 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800367 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
369 break;
370
371 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800372 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
374 break;
375
376 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700377 smsLog( pMac, LOGE, " default: Unhandled command %d",
378 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 break;
380 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700381}
382
383tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
384{
385 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
386 tListElem *pEntry;
387
388 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
389
390 // If we can get another MS Msg buffer, then we are ok. Just link
391 // the entry onto the linked list. (We are using the linked list
392 // to keep track of tfhe message buffers).
393 if ( pEntry )
394 {
395 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
396 }
397 else {
398 int idx = 1;
399
400 //Cannot change pRetCmd here since it needs to return later.
401 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
402 if( pEntry )
403 {
404 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
405 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800406 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
408 if(pTempCmd)
409 {
410 if( eSmeCsrCommandMask & pTempCmd->command )
411 {
412 //CSR command is stuck. See what the reason code is for that command
413 dumpCsrCommandInfo(pMac, pTempCmd);
414 }
415 } //if(pTempCmd)
416
417 //dump what is in the pending queue
418 csrLLLock(&pMac->sme.smeCmdPendingList);
419 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
420 while(pEntry)
421 {
422 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800423 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 idx++, pTempCmd->command );
425 if( eSmeCsrCommandMask & pTempCmd->command )
426 {
427 //CSR command is stuck. See what the reason code is for that command
428 dumpCsrCommandInfo(pMac, pTempCmd);
429 }
430 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
431 }
432 csrLLUnlock(&pMac->sme.smeCmdPendingList);
433
434 //There may be some more command in CSR's own pending queue
435 csrLLLock(&pMac->roam.roamCmdPendingList);
436 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
437 while(pEntry)
438 {
439 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800440 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 idx++, pTempCmd->command );
442 dumpCsrCommandInfo(pMac, pTempCmd);
443 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
444 }
445 csrLLUnlock(&pMac->roam.roamCmdPendingList);
446 }
447
448 return( pRetCmd );
449}
450
451
452void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
453{
454 if ( fHighPriority )
455 {
456 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
457 }
458 else
459 {
460 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
461 }
462
463 // process the command queue...
464 smeProcessPendingQueue( pMac );
465
466 return;
467}
468
469
470static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
471{
472 eSmeCommandType pmcCommand = eSmeNoCommand;
473 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
474 tPmcState pmcState;
475 eHalStatus status;
476
477 do
478 {
479 pmcState = pmcGetPmcState(pMac);
480
481 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
482 if( !HAL_STATUS_SUCCESS(status) )
483 {
484 //PMC state is not right for the command, drop it
485 return ( eSmeDropCommand );
486 }
487 if( fFullPowerNeeded ) break;
488 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
489 ( eSmeCommandDelTs == pCommand->command ) );
490 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700491#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700492 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700493 eSmeCommandOemDataReq == pCommand->command);
494 if(fFullPowerNeeded) break;
495#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700496 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 eSmeCommandRemainOnChannel == pCommand->command);
498 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 } while(0);
500
501 if( fFullPowerNeeded )
502 {
503 switch( pmcState )
504 {
505 case IMPS:
506 case STANDBY:
507 pmcCommand = eSmeCommandExitImps;
508 break;
509
510 case BMPS:
511 pmcCommand = eSmeCommandExitBmps;
512 break;
513
514 case UAPSD:
515 pmcCommand = eSmeCommandExitUapsd;
516 break;
517
518 case WOWL:
519 pmcCommand = eSmeCommandExitWowl;
520 break;
521
522 default:
523 break;
524 }
525 }
526
527 return ( pmcCommand );
528}
529
530
531//For commands that need to do extra cleanup.
532static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
533{
534 if( eSmePmcCommandMask & pCommand->command )
535 {
536 pmcAbortCommand( pMac, pCommand, fStopping );
537 }
538 else if ( eSmeCsrCommandMask & pCommand->command )
539 {
540 csrAbortCommand( pMac, pCommand, fStopping );
541 }
542 else
543 {
544 switch( pCommand->command )
545 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 case eSmeCommandRemainOnChannel:
547 if (NULL != pCommand->u.remainChlCmd.callback)
548 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700549 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 pCommand->u.remainChlCmd.callback;
551 /* process the msg */
552 if( callback )
553 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700554 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 eCSR_SCAN_ABORT );
556 }
557 }
558 smeReleaseCommand( pMac, pCommand );
559 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 default:
561 smeReleaseCommand( pMac, pCommand );
562 break;
563 }
564 }
565}
566
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530567tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
568 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
569{
570 tListElem *pCurEntry = NULL;
571 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700572
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530573 /* Go through the list and return the command whose session id is not
574 * matching with the current ongoing scan cmd sessionId */
575 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
576 while (pCurEntry)
577 {
578 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
579 if (pCommand->sessionId != sessionId)
580 {
581 smsLog(pMac, LOG1, "selected the command with different sessionId");
582 return pCurEntry;
583 }
584
585 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
586 }
587
588 smsLog(pMac, LOG1, "No command pending with different sessionId");
589 return NULL;
590}
591
592tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
593{
594 tListElem *pEntry;
595 tSmeCmd *pCommand;
596 tListElem *pSmeEntry;
597 tSmeCmd *pSmeCommand;
598 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
599
600 csrLLLock( &pMac->sme.smeScanCmdActiveList );
601 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
602 LL_ACCESS_NOLOCK ))
603 {
604 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
605 LL_ACCESS_LOCK))
606 {
607 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
608 LL_ACCESS_LOCK );
609 if (pEntry)
610 {
611 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
612 //We cannot execute any command in wait-for-key state until setKey is through.
613 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
614 {
615 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
616 {
617 smsLog(pMac, LOGE,
618 " Cannot process command(%d) while waiting for key",
619 pCommand->command);
620 status = eANI_BOOLEAN_FALSE;
621 goto end;
622 }
623 }
624
625 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
626 LL_ACCESS_LOCK )))
627 {
628 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
629 LL_ACCESS_LOCK);
630 if (pEntry)
631 {
632 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
633 Link) ;
634
635 /* if scan is running on one interface and SME recei
636 ves the next command on the same interface then
637 dont the allow the command to be queued to
638 smeCmdPendingList. If next scan is allowed on
639 the same interface the CSR state machine will
640 get screwed up. */
641 if (pSmeCommand->sessionId == pCommand->sessionId)
642 {
643 status = eANI_BOOLEAN_FALSE;
644 goto end;
645 }
646 }
647 }
648 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
649 pEntry, LL_ACCESS_LOCK ) )
650 {
651 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
652 &pCommand->Link, LL_ACCESS_NOLOCK );
653
654 switch (pCommand->command)
655 {
656 case eSmeCommandScan:
657 smsLog(pMac, LOG1,
658 " Processing scan offload command ");
659 csrProcessScanCommand( pMac, pCommand );
660 break;
661 default:
662 smsLog(pMac, LOGE,
663 " Something wrong, wrong command enqueued"
664 " to smeScanCmdPendingList");
665 pEntry = csrLLRemoveHead(
666 &pMac->sme.smeScanCmdActiveList,
667 LL_ACCESS_NOLOCK );
668 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
669 smeReleaseCommand( pMac, pCommand );
670 break;
671 }
672 }
673 }
674 }
675 }
676end:
677 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
678 return status;
679}
Jeff Johnson295189b2012-06-20 16:38:30 -0700680
681tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
682{
683 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
684 eHalStatus status = eHAL_STATUS_SUCCESS;
685 tListElem *pEntry;
686 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530687 tListElem *pSmeEntry;
688 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 eSmeCommandType pmcCommand = eSmeNoCommand;
690
691 // if the ActiveList is empty, then nothing is active so we can process a
692 // pending command...
693 //alwasy lock active list before locking pending list
694 csrLLLock( &pMac->sme.smeCmdActiveList );
695 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
696 {
697 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
698 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530699 /* If scan command is pending in the smeScanCmdActive list
700 * then pick the command from smeCmdPendingList which is
701 * not matching with the scan command session id.
702 * At any point of time only one command will be allowed
703 * on a single session. */
704 if ((pMac->fScanOffload) &&
705 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
706 LL_ACCESS_LOCK)))
707 {
708 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
709 LL_ACCESS_LOCK);
710 if (pSmeEntry)
711 {
712 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
713
714 pEntry = csrGetCmdToProcess(pMac,
715 &pMac->sme.smeCmdPendingList,
716 pSmeCommand->sessionId,
717 LL_ACCESS_LOCK);
718 goto sme_process_cmd;
719 }
720 }
721
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 //Peek the command
723 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530724sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 if( pEntry )
726 {
727 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530728
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 //We cannot execute any command in wait-for-key state until setKey is through.
730 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
731 {
732 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
733 {
734 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800735 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530736 fContinue = eANI_BOOLEAN_FALSE;
737 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 }
739 }
740 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
741 if( eSmeDropCommand == pmcCommand )
742 {
743 //This command is not ok for current PMC state
744 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
745 {
746 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
747 }
748 csrLLUnlock( &pMac->sme.smeCmdActiveList );
749 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530750 fContinue = eANI_BOOLEAN_TRUE;
751 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 }
753 else if( eSmeNoCommand != pmcCommand )
754 {
755 tExitBmpsInfo exitBmpsInfo;
756 void *pv = NULL;
757 tANI_U32 size = 0;
758 tSmeCmd *pPmcCmd = NULL;
759
760 if( eSmeCommandExitBmps == pmcCommand )
761 {
762 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
763 pv = (void *)&exitBmpsInfo;
764 size = sizeof(tExitBmpsInfo);
765 }
766 //pmcCommand has to be one of the exit power save command
767 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
768 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
769 {
770 //Force this command to wake up the chip
771 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
772 csrLLUnlock( &pMac->sme.smeCmdActiveList );
773 fContinue = pmcProcessCommand( pMac, pPmcCmd );
774 if( fContinue )
775 {
776 //The command failed, remove it
777 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
778 {
779 pmcReleaseCommand( pMac, pPmcCmd );
780 }
781 }
782 }
783 else
784 {
785 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800786 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 -0700787 //Let it retry
788 fContinue = eANI_BOOLEAN_TRUE;
789 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530790 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 }
792 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
793 {
794 // we can reuse the pCommand
795
796 // Insert the command onto the ActiveList...
797 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
798
799 // .... and process the command.
800
Katya Nigambcb705f2013-12-26 14:26:22 +0530801 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700802 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 switch ( pCommand->command )
804 {
805
806 case eSmeCommandScan:
807 csrLLUnlock( &pMac->sme.smeCmdActiveList );
808 status = csrProcessScanCommand( pMac, pCommand );
809 break;
810
811 case eSmeCommandRoam:
812 csrLLUnlock( &pMac->sme.smeCmdActiveList );
813 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800814 if(!HAL_STATUS_SUCCESS(status))
815 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700816 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800817 &pCommand->Link, LL_ACCESS_LOCK ) )
818 {
819 csrReleaseCommandRoam( pMac, pCommand );
820 }
821 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 break;
823
824 case eSmeCommandWmStatusChange:
825 csrLLUnlock( &pMac->sme.smeCmdActiveList );
826 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
827 break;
828
829 case eSmeCommandSetKey:
830 csrLLUnlock( &pMac->sme.smeCmdActiveList );
831 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
832 if(!HAL_STATUS_SUCCESS(status))
833 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700834 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 &pCommand->Link, LL_ACCESS_LOCK ) )
836 {
837 csrReleaseCommandSetKey( pMac, pCommand );
838 }
839 }
840 break;
841
842 case eSmeCommandRemoveKey:
843 csrLLUnlock( &pMac->sme.smeCmdActiveList );
844 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
845 if(!HAL_STATUS_SUCCESS(status))
846 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700847 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 &pCommand->Link, LL_ACCESS_LOCK ) )
849 {
850 csrReleaseCommandRemoveKey( pMac, pCommand );
851 }
852 }
853 break;
854
855 case eSmeCommandAddStaSession:
856 csrLLUnlock( &pMac->sme.smeCmdActiveList );
857 csrProcessAddStaSessionCommand( pMac, pCommand );
858 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700859 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 csrLLUnlock( &pMac->sme.smeCmdActiveList );
861 csrProcessDelStaSessionCommand( pMac, pCommand );
862 break;
863
Jeff Johnsone7245742012-09-05 17:12:55 -0700864#ifdef FEATURE_OEM_DATA_SUPPORT
865 case eSmeCommandOemDataReq:
866 csrLLUnlock(&pMac->sme.smeCmdActiveList);
867 oemData_ProcessOemDataReqCommand(pMac, pCommand);
868 break;
869#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700870 case eSmeCommandRemainOnChannel:
871 csrLLUnlock(&pMac->sme.smeCmdActiveList);
872 p2pProcessRemainOnChannelCmd(pMac, pCommand);
873 break;
874 case eSmeCommandNoAUpdate:
875 csrLLUnlock( &pMac->sme.smeCmdActiveList );
876 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 case eSmeCommandEnterImps:
878 case eSmeCommandExitImps:
879 case eSmeCommandEnterBmps:
880 case eSmeCommandExitBmps:
881 case eSmeCommandEnterUapsd:
882 case eSmeCommandExitUapsd:
883 case eSmeCommandEnterWowl:
884 case eSmeCommandExitWowl:
885 csrLLUnlock( &pMac->sme.smeCmdActiveList );
886 fContinue = pmcProcessCommand( pMac, pCommand );
887 if( fContinue )
888 {
889 //The command failed, remove it
890 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
891 &pCommand->Link, LL_ACCESS_LOCK ) )
892 {
893 pmcReleaseCommand( pMac, pCommand );
894 }
895 }
896 break;
897
898 //Treat standby differently here because caller may not be able to handle
899 //the failure so we do our best here
900 case eSmeCommandEnterStandby:
901 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
902 {
903 //It can continue
904 csrLLUnlock( &pMac->sme.smeCmdActiveList );
905 fContinue = pmcProcessCommand( pMac, pCommand );
906 if( fContinue )
907 {
908 //The command failed, remove it
909 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
910 &pCommand->Link, LL_ACCESS_LOCK ) )
911 {
912 pmcReleaseCommand( pMac, pCommand );
913 }
914 }
915 }
916 else
917 {
918 //Need to issue a disconnect first before processing this command
919 tSmeCmd *pNewCmd;
920
921 //We need to re-run the command
922 fContinue = eANI_BOOLEAN_TRUE;
923 //Pull off the standby command first
924 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
925 &pCommand->Link, LL_ACCESS_NOLOCK ) )
926 {
927 csrLLUnlock( &pMac->sme.smeCmdActiveList );
928 //Need to call CSR function here because the disconnect command
929 //is handled by CSR
930 pNewCmd = csrGetCommandBuffer( pMac );
931 if( NULL != pNewCmd )
932 {
933 //Put the standby command to the head of the pending list first
934 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
935 LL_ACCESS_LOCK );
936 pNewCmd->command = eSmeCommandRoam;
937 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
938 //Put the disassoc command before the standby command
939 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
940 LL_ACCESS_LOCK );
941 }
942 else
943 {
944 //Continue the command here
945 fContinue = pmcProcessCommand( pMac, pCommand );
946 if( fContinue )
947 {
948 //The command failed, remove it
949 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
950 &pCommand->Link, LL_ACCESS_LOCK ) )
951 {
952 pmcReleaseCommand( pMac, pCommand );
953 }
954 }
955 }
956 }
957 else
958 {
959 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800960 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 VOS_ASSERT(0);
962 }
963 }
964 break;
965
966 case eSmeCommandAddTs:
967 case eSmeCommandDelTs:
968 csrLLUnlock( &pMac->sme.smeCmdActiveList );
969#ifndef WLAN_MDM_CODE_REDUCTION_OPT
970 fContinue = qosProcessCommand( pMac, pCommand );
971 if( fContinue )
972 {
973 //The command failed, remove it
974 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
975 &pCommand->Link, LL_ACCESS_NOLOCK ) )
976 {
977//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
978 qosReleaseCommand( pMac, pCommand );
979//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
980 }
981 }
982#endif
983 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800984#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700985 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800986 case eSmeCommandTdlsAddPeer:
987 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530988 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800989#ifdef FEATURE_WLAN_TDLS_INTERNAL
990 case eSmeCommandTdlsDiscovery:
991 case eSmeCommandTdlsLinkSetup:
992 case eSmeCommandTdlsLinkTear:
993 case eSmeCommandTdlsEnterUapsd:
994 case eSmeCommandTdlsExitUapsd:
995#endif
996 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800997 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800998 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800999
1000 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1001 status = csrTdlsProcessCmd( pMac, pCommand );
1002 }
1003 break ;
1004#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001005
1006 default:
1007 //something is wrong
1008 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001009 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1011 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1012 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1013 smeReleaseCommand( pMac, pCommand );
1014 status = eHAL_STATUS_FAILURE;
1015 break;
1016 }
1017 if(!HAL_STATUS_SUCCESS(status))
1018 {
1019 fContinue = eANI_BOOLEAN_TRUE;
1020 }
1021 }//if(pEntry)
1022 else
1023 {
1024 //This is odd. Some one else pull off the command.
1025 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1026 }
1027 }
1028 else
1029 {
1030 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1031 }
1032 }
1033 else
1034 {
1035 //No command waiting
1036 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1037 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1038 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1039 {
1040 tANI_U32 nTime = 0;
1041
1042 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1043 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1044 {
1045 csrScanStartIdleScanTimer(pMac, nTime);
1046 }
1047 }
1048 }
1049 }
1050 else {
1051 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1052 }
1053
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301054sme_process_scan_queue:
1055 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1056 fContinue = eANI_BOOLEAN_FALSE;
1057
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 return ( fContinue );
1059}
1060
1061void smeProcessPendingQueue( tpAniSirGlobal pMac )
1062{
1063 while( smeProcessCommand( pMac ) );
1064}
1065
1066
1067tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1068{
1069 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1070 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1071}
1072
1073
1074
1075//Global APIs
1076
1077/*--------------------------------------------------------------------------
1078
1079 \brief sme_Open() - Initialze all SME modules and put them at idle state
1080
1081 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1082 successfully return, all modules are at idle state ready to start.
1083
1084 smeOpen must be called before any other SME APIs can be involved.
1085 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001086 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 \param hHal - The handle returned by macOpen.
1088
1089 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1090
1091 Other status means SME is failed to be initialized
1092 \sa
1093
1094 --------------------------------------------------------------------------*/
1095eHalStatus sme_Open(tHalHandle hHal)
1096{
1097 eHalStatus status = eHAL_STATUS_FAILURE;
1098 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1099
1100 do {
1101 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001102 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1104 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001105 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 status = eHAL_STATUS_FAILURE;
1107 break;
1108 }
1109
1110 status = ccmOpen(hHal);
1111 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1112 smsLog( pMac, LOGE,
1113 "ccmOpen failed during initialization with status=%d", status );
1114 break;
1115 }
1116
1117 status = csrOpen(pMac);
1118 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1119 smsLog( pMac, LOGE,
1120 "csrOpen failed during initialization with status=%d", status );
1121 break;
1122 }
1123
1124 status = pmcOpen(hHal);
1125 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1126 smsLog( pMac, LOGE,
1127 "pmcOpen failed during initialization with status=%d", status );
1128 break;
1129 }
1130
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001131#ifdef FEATURE_WLAN_TDLS
1132 pMac->isTdlsPowerSaveProhibited = 0;
1133#endif
1134
Jeff Johnson295189b2012-06-20 16:38:30 -07001135#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1136 status = sme_QosOpen(pMac);
1137 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1138 smsLog( pMac, LOGE,
1139 "Qos open failed during initialization with status=%d", status );
1140 break;
1141 }
1142
1143 status = btcOpen(pMac);
1144 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1145 smsLog( pMac, LOGE,
1146 "btcOpen open failed during initialization with status=%d", status );
1147 break;
1148 }
1149#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001150#ifdef FEATURE_OEM_DATA_SUPPORT
1151 status = oemData_OemDataReqOpen(pMac);
1152 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1153 smsLog(pMac, LOGE,
1154 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1155 break;
1156 }
1157#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001158
1159 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1160 break;
1161
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 {
1163 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1164 if ( NULL == pvosGCtx ){
1165 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1166 status = eHAL_STATUS_FAILURE;
1167 break;
1168 }
1169
1170 status = WLANSAP_Open( pvosGCtx );
1171 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1172 smsLog( pMac, LOGE,
1173 "WLANSAP_Open open failed during initialization with status=%d", status );
1174 break;
1175 }
1176 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001177#if defined WLAN_FEATURE_VOWIFI
1178 status = rrmOpen(pMac);
1179 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1180 smsLog( pMac, LOGE,
1181 "rrmOpen open failed during initialization with status=%d", status );
1182 break;
1183 }
1184#endif
1185
1186#if defined WLAN_FEATURE_VOWIFI_11R
1187 sme_FTOpen(pMac);
1188#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001190 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001191
1192 }while (0);
1193
1194 return status;
1195}
1196
Jeff Johnson295189b2012-06-20 16:38:30 -07001197/*--------------------------------------------------------------------------
1198
1199 \brief sme_set11dinfo() - Set the 11d information about valid channels
1200 and there power using information from nvRAM
1201 This function is called only for AP.
1202
Srinivas Girigowdade697412013-02-14 16:31:48 -08001203 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001204
1205 \param hHal - The handle returned by macOpen.
1206 \Param pSmeConfigParams - a pointer to a caller allocated object of
1207 typedef struct _smeConfigParams.
1208
1209 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1210
1211 Other status means SME is failed to update the config parameters.
1212 \sa
1213--------------------------------------------------------------------------*/
1214
1215eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1216{
1217 eHalStatus status = eHAL_STATUS_FAILURE;
1218 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1219
Katya Nigambcb705f2013-12-26 14:26:22 +05301220 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001221 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 if (NULL == pSmeConfigParams ) {
1223 smsLog( pMac, LOGE,
1224 "Empty config param structure for SME, nothing to update");
1225 return status;
1226 }
1227
1228 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1229 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001230 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 status );
1232 }
1233 return status;
1234}
1235
1236/*--------------------------------------------------------------------------
1237
1238 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1239
Srinivas Girigowdade697412013-02-14 16:31:48 -08001240 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001241
1242 \param hHal - The handle returned by HostapdAdapter.
1243 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1244
1245 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1246
1247 Other status means, failed to get the current regulatory domain.
1248 \sa
1249--------------------------------------------------------------------------*/
1250
1251eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1252{
1253 eHalStatus status = eHAL_STATUS_FAILURE;
1254 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1255
Katya Nigambcb705f2013-12-26 14:26:22 +05301256 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001257 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001258 if (NULL == domainIdSoftAp ) {
1259 smsLog( pMac, LOGE, "Uninitialized domain Id");
1260 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001261 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
1263 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1264 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001265
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 return status;
1267}
1268
1269
1270eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1271{
1272 eHalStatus status = eHAL_STATUS_FAILURE;
1273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1274
Katya Nigambcb705f2013-12-26 14:26:22 +05301275 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001276 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 if (NULL == apCntryCode ) {
1278 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1279 return status;
1280 }
1281
1282 status = csrSetRegInfo(hHal, apCntryCode );
1283 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001284 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 status );
1286 }
1287 return status;
1288}
1289
Jeff Johnson295189b2012-06-20 16:38:30 -07001290#ifdef FEATURE_WLAN_SCAN_PNO
1291/*--------------------------------------------------------------------------
1292
1293 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001294
1295 It is used at driver start up to inform RIVA of the default channel
1296 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001297
Srinivas Girigowdade697412013-02-14 16:31:48 -08001298 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001299
1300 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001301
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1303
1304 Other status means SME is failed to update the channel config.
1305 \sa
1306
1307 --------------------------------------------------------------------------*/
1308eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1309{
1310 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1311
Katya Nigambcb705f2013-12-26 14:26:22 +05301312 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001313 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1314 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 &pMac->scan.base20MHzChannels, FALSE);
1316 return eHAL_STATUS_SUCCESS;
1317}
1318#endif // FEATURE_WLAN_SCAN_PNLO
1319
1320/*--------------------------------------------------------------------------
1321
1322 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1323
1324 The function updates some configuration for modules in SME, CCM, CSR, etc
1325 during SMEs close open sequence.
1326
1327 Modules inside SME apply the new configuration at the next transaction.
1328
Srinivas Girigowdade697412013-02-14 16:31:48 -08001329 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001330
1331 \param hHal - The handle returned by macOpen.
1332 \Param pSmeConfigParams - a pointer to a caller allocated object of
1333 typedef struct _smeConfigParams.
1334
1335 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1336
1337 Other status means SME is failed to update the config parameters.
1338 \sa
1339
1340 --------------------------------------------------------------------------*/
1341eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1342{
1343 eHalStatus status = eHAL_STATUS_FAILURE;
1344 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1345
Katya Nigambcb705f2013-12-26 14:26:22 +05301346 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001347 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 if (NULL == pSmeConfigParams ) {
1349 smsLog( pMac, LOGE,
1350 "Empty config param structure for SME, nothing to update");
1351 return status;
1352 }
1353
1354 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1355
1356 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001357 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 status );
1359 }
1360#if defined WLAN_FEATURE_P2P_INTERNAL
1361 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1362
1363 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001364 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 status );
1366 }
1367#endif
1368#if defined WLAN_FEATURE_VOWIFI
1369 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1370
1371 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001372 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 status );
1374 }
1375#endif
1376 //For SOC, CFG is set before start
1377 //We don't want to apply global CFG in connect state because that may cause some side affect
1378 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 csrIsAllSessionDisconnected( pMac) )
1380 {
1381 csrSetGlobalCfgs(pMac);
1382 }
1383
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301384 /* update the directed scan offload setting */
1385 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1386
Sandeep Puligilla60342762014-01-30 21:05:37 +05301387 /* Enable channel bonding mode in 2.4GHz */
1388 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1389 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1390 {
1391 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1392 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1393 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1394 "Setting channelBondingMode24GHz:%d " ,
1395 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1396 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301397 if (pMac->fScanOffload)
1398 {
1399 /* If scan offload is enabled then lim has allow the sending of
1400 scan request to firmware even in powersave mode. The firmware has
1401 to take care of exiting from power save mode */
1402 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1403 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1404
1405 if (eHAL_STATUS_SUCCESS != status)
1406 {
1407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1408 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1409 }
1410 }
krunal sonie9002db2013-11-25 14:24:17 -08001411 pMac->isCoalesingInIBSSAllowed =
1412 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001413 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 return status;
1415}
1416
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301417#ifdef WLAN_FEATURE_GTK_OFFLOAD
1418void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1419 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1420{
1421 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1422
1423 if (NULL == pMac)
1424 {
1425 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1426 "%s: pMac is null", __func__);
1427 return ;
1428 }
1429 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1430 {
1431 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1432 "%s: HDD callback is null", __func__);
1433 return ;
1434 }
1435 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1436 pGtkOffloadGetInfoRsp);
1437}
1438#endif
1439
Jeff Johnson295189b2012-06-20 16:38:30 -07001440/* ---------------------------------------------------------------------------
1441 \fn sme_ChangeConfigParams
1442 \brief The SME API exposed for HDD to provide config params to SME during
1443 SMEs stop -> start sequence.
1444
1445 If HDD changed the domain that will cause a reset. This function will
1446 provide the new set of 11d information for the new domain. Currrently this
1447 API provides info regarding 11d only at reset but we can extend this for
1448 other params (PMC, QoS) which needs to be initialized again at reset.
1449
Srinivas Girigowdade697412013-02-14 16:31:48 -08001450 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001451
1452 \param hHal - The handle returned by macOpen.
1453
1454 \Param
1455 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1456 currently provides 11d related information like Country code,
1457 Regulatory domain, valid channel list, Tx power per channel, a
1458 list with active/passive scan allowed per valid channel.
1459
1460 \return eHalStatus
1461 ---------------------------------------------------------------------------*/
1462eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1463 tCsrUpdateConfigParam *pUpdateConfigParam)
1464{
1465 eHalStatus status = eHAL_STATUS_FAILURE;
1466 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1467
1468 if (NULL == pUpdateConfigParam ) {
1469 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001470 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001471 return status;
1472 }
1473
1474 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1475
1476 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001477 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 status );
1479 }
1480
1481 return status;
1482
1483}
1484
1485/*--------------------------------------------------------------------------
1486
1487 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1488 that the NIC is ready tio run.
1489
1490 The function is called by HDD at the end of initialization stage so PE/HAL can
1491 enable the NIC to running state.
1492
Srinivas Girigowdade697412013-02-14 16:31:48 -08001493 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001494 \param hHal - The handle returned by macOpen.
1495
1496 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1497 successfully.
1498
1499 Other status means SME failed to send the message to PE.
1500 \sa
1501
1502 --------------------------------------------------------------------------*/
1503eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1504{
1505 tSirSmeReadyReq Msg;
1506 eHalStatus status = eHAL_STATUS_FAILURE;
1507 tPmcPowerState powerState;
1508 tPmcSwitchState hwWlanSwitchState;
1509 tPmcSwitchState swWlanSwitchState;
1510 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1511
Katya Nigambcb705f2013-12-26 14:26:22 +05301512 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001513 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 do
1515 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001516
1517 Msg.messageType = eWNI_SME_SYS_READY_IND;
1518 Msg.length = sizeof( tSirSmeReadyReq );
1519
1520 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1521 {
1522 status = eHAL_STATUS_SUCCESS;
1523 }
1524 else
1525 {
1526 smsLog( pMac, LOGE,
1527 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1528 break;
1529 }
1530
1531 status = pmcQueryPowerState( hHal, &powerState,
1532 &hwWlanSwitchState, &swWlanSwitchState );
1533 if ( ! HAL_STATUS_SUCCESS( status ) )
1534 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001535 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001536 status );
1537 break;
1538 }
1539
1540 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1541 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1542 {
1543 status = csrReady(pMac);
1544 if ( ! HAL_STATUS_SUCCESS( status ) )
1545 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001546 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 break;
1548 }
1549 status = pmcReady(hHal);
1550 if ( ! HAL_STATUS_SUCCESS( status ) )
1551 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001552 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 break;
1554 }
1555#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1556 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1557 {
1558 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001559 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 break;
1561 }
1562#endif
1563
1564#if defined WLAN_FEATURE_VOWIFI
1565 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1566 {
1567 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001568 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 break;
1570 }
1571#endif
1572 }
1573 pMac->sme.state = SME_STATE_READY;
1574 } while( 0 );
1575
1576 return status;
1577}
1578
1579/*--------------------------------------------------------------------------
1580
1581 \brief sme_Start() - Put all SME modules at ready state.
1582
1583 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1584 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001585 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 \param hHal - The handle returned by macOpen.
1587
1588 \return eHAL_STATUS_SUCCESS - SME is ready.
1589
1590 Other status means SME is failed to start
1591 \sa
1592
1593 --------------------------------------------------------------------------*/
1594eHalStatus sme_Start(tHalHandle hHal)
1595{
1596 eHalStatus status = eHAL_STATUS_FAILURE;
1597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1598
1599 do
1600 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001601 status = csrStart(pMac);
1602 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001603 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 status );
1605 break;
1606 }
1607
1608 status = pmcStart(hHal);
1609 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001610 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 status );
1612 break;
1613 }
1614
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1616 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001617 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 status );
1619 break;
1620 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 pMac->sme.state = SME_STATE_START;
1622 }while (0);
1623
1624 return status;
1625}
1626
1627
1628#ifdef WLAN_FEATURE_PACKET_FILTERING
1629/******************************************************************************
1630*
1631* Name: sme_PCFilterMatchCountResponseHandler
1632*
1633* Description:
1634* Invoke Packet Coalescing Filter Match Count callback routine
1635*
1636* Parameters:
1637* hHal - HAL handle for device
1638* pMsg - Pointer to tRcvFltPktMatchRsp structure
1639*
1640* Returns: eHalStatus
1641*
1642******************************************************************************/
1643eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1644{
1645 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1646 eHalStatus status = eHAL_STATUS_SUCCESS;
1647 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1648
1649 if (NULL == pMsg)
1650 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001651 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 status = eHAL_STATUS_FAILURE;
1653 }
1654 else
1655 {
1656 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001657 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001658
1659 /* Call Packet Coalescing Filter Match Count callback routine. */
1660 if (pMac->pmc.FilterMatchCountCB != NULL)
1661 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1662 pRcvFltPktMatchRsp);
1663
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001664 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 pRcvFltPktMatchRsp->status);
1666
1667 pMac->pmc.FilterMatchCountCB = NULL;
1668 pMac->pmc.FilterMatchCountCBContext = NULL;
1669 }
1670
1671 return(status);
1672}
1673#endif // WLAN_FEATURE_PACKET_FILTERING
1674
1675
Chet Lanctot186b5732013-03-18 10:26:30 -07001676#ifdef WLAN_FEATURE_11W
1677/*------------------------------------------------------------------
1678 *
1679 * Handle the unprotected management frame indication from LIM and
1680 * forward it to HDD.
1681 *
1682 *------------------------------------------------------------------*/
1683
1684eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1685 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1686{
1687 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1688 eHalStatus status = eHAL_STATUS_SUCCESS;
1689 tCsrRoamInfo pRoamInfo = {0};
1690 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1691
1692 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1693 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1694 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1695
1696 /* forward the mgmt frame to HDD */
1697 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1698
1699 return status;
1700}
1701#endif
1702
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001703#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
1704/*------------------------------------------------------------------
1705 *
1706 * Handle the tsm ie indication from LIM and forward it to HDD.
1707 *
1708 *------------------------------------------------------------------*/
1709
1710eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1711{
1712 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1713 eHalStatus status = eHAL_STATUS_SUCCESS;
1714 tCsrRoamInfo pRoamInfo = {0};
1715 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1716
1717 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1718 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1719 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1720
1721 /* forward the tsm ie information to HDD */
1722 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1723
1724 return status;
1725}
1726
1727/* ---------------------------------------------------------------------------
1728 \fn sme_SetCCKMIe
1729 \brief function to store the CCKM IE passed from supplicant and use it while packing
1730 reassociation request
1731 \param hHal - HAL handle for device
1732 \param pCckmIe - pointer to CCKM IE data
1733 \param pCckmIeLen - length of the CCKM IE
1734 \- return Success or failure
1735 -------------------------------------------------------------------------*/
1736eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1737 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1738{
1739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1740 eHalStatus status = eHAL_STATUS_SUCCESS;
1741
1742 status = sme_AcquireGlobalLock( &pMac->sme );
1743 if ( HAL_STATUS_SUCCESS( status ) )
1744 {
1745 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1746 sme_ReleaseGlobalLock( &pMac->sme );
1747 }
1748 return status;
1749}
1750
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001751/* ---------------------------------------------------------------------------
1752 \fn sme_SetCcxBeaconRequest
1753 \brief function to set CCX beacon request parameters
1754 \param hHal - HAL handle for device
1755 \param sessionId - Session id
1756 \param pCcxBcnReq - pointer to CCX beacon request
1757 \- return Success or failure
1758 -------------------------------------------------------------------------*/
1759eHalStatus sme_SetCcxBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1760 const tCsrCcxBeaconReq* pCcxBcnReq)
1761{
1762 eHalStatus status = eSIR_SUCCESS;
1763 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1764 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
1765 tCsrCcxBeaconReqParams *pBeaconReq = NULL;
1766 tANI_U8 counter = 0;
1767 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1768 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1769
1770 /* Store the info in RRM context */
1771 vos_mem_copy(&pSmeRrmContext->ccxBcnReqInfo, pCcxBcnReq, sizeof(tCsrCcxBeaconReq));
1772
1773 //Prepare the request to send to SME.
1774 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1775 if(NULL == pSmeBcnReportReq)
1776 {
1777 smsLog(pMac, LOGP, "Memory Allocation Failure!!! CCX BcnReq Ind to SME");
1778 return eSIR_FAILURE;
1779 }
1780
1781 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1782 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1783
1784 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1785 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1786 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1787 pSmeBcnReportReq->channelInfo.channelNum = 255;
1788 pSmeBcnReportReq->channelList.numChannels = pCcxBcnReq->numBcnReqIe;
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08001789 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_CCX_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001790
1791 for (counter = 0; counter < pCcxBcnReq->numBcnReqIe; counter++)
1792 {
1793 pBeaconReq = (tCsrCcxBeaconReqParams *)&pCcxBcnReq->bcnReq[counter];
1794 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1795 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1796 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1797 }
1798
1799 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1800 return status;
1801}
1802
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001803#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
1804
Chet Lanctot186b5732013-03-18 10:26:30 -07001805
Jeff Johnson295189b2012-06-20 16:38:30 -07001806/*--------------------------------------------------------------------------
1807
1808 \brief sme_ProcessMsg() - The main message processor for SME.
1809
1810 The function is called by a message dispatcher when to process a message
1811 targeted for SME.
1812
Srinivas Girigowdade697412013-02-14 16:31:48 -08001813 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 \param hHal - The handle returned by macOpen.
1815 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1816
1817 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1818
1819 Other status means SME failed to process the message to HAL.
1820 \sa
1821
1822 --------------------------------------------------------------------------*/
1823eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1824{
1825 eHalStatus status = eHAL_STATUS_FAILURE;
1826 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1827
1828 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001829 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 return status;
1831 }
1832
1833 status = sme_AcquireGlobalLock( &pMac->sme );
1834 if ( HAL_STATUS_SUCCESS( status ) )
1835 {
1836 if( SME_IS_START(pMac) )
1837 {
1838 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1839 case eWNI_PMC_ENTER_BMPS_RSP:
1840 case eWNI_PMC_EXIT_BMPS_RSP:
1841 case eWNI_PMC_EXIT_BMPS_IND:
1842 case eWNI_PMC_ENTER_IMPS_RSP:
1843 case eWNI_PMC_EXIT_IMPS_RSP:
1844 case eWNI_PMC_SMPS_STATE_IND:
1845 case eWNI_PMC_ENTER_UAPSD_RSP:
1846 case eWNI_PMC_EXIT_UAPSD_RSP:
1847 case eWNI_PMC_ENTER_WOWL_RSP:
1848 case eWNI_PMC_EXIT_WOWL_RSP:
1849 //PMC
1850 if (pMsg->bodyptr)
1851 {
1852 pmcMessageProcessor(hHal, pMsg->bodyptr);
1853 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301854 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001856 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 }
1858 break;
1859
1860 case WNI_CFG_SET_CNF:
1861 case WNI_CFG_DNLD_CNF:
1862 case WNI_CFG_GET_RSP:
1863 case WNI_CFG_ADD_GRP_ADDR_CNF:
1864 case WNI_CFG_DEL_GRP_ADDR_CNF:
1865 //CCM
1866 if (pMsg->bodyptr)
1867 {
1868 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1869 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301870 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001872 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 }
1874 break;
1875
1876 case eWNI_SME_ADDTS_RSP:
1877 case eWNI_SME_DELTS_RSP:
1878 case eWNI_SME_DELTS_IND:
1879#ifdef WLAN_FEATURE_VOWIFI_11R
1880 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001881#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001882 //QoS
1883 if (pMsg->bodyptr)
1884 {
1885#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1886 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301887 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001888#endif
1889 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001890 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001891 }
1892 break;
1893#if defined WLAN_FEATURE_VOWIFI
1894 case eWNI_SME_NEIGHBOR_REPORT_IND:
1895 case eWNI_SME_BEACON_REPORT_REQ_IND:
1896#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001897 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001898#endif
1899 if ( pMsg->bodyptr )
1900 {
1901 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301902 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 }
1904 else
1905 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001906 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001907 }
1908 break;
1909#endif
1910
Jeff Johnsone7245742012-09-05 17:12:55 -07001911#ifdef FEATURE_OEM_DATA_SUPPORT
1912 //Handle the eWNI_SME_OEM_DATA_RSP:
1913 case eWNI_SME_OEM_DATA_RSP:
1914 if(pMsg->bodyptr)
1915 {
1916 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1917 vos_mem_free(pMsg->bodyptr);
1918 }
1919 else
1920 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001921 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001922 }
1923 smeProcessPendingQueue( pMac );
1924 break;
1925#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001926
1927 case eWNI_SME_ADD_STA_SELF_RSP:
1928 if(pMsg->bodyptr)
1929 {
1930 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1931 vos_mem_free(pMsg->bodyptr);
1932 }
1933 else
1934 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001935 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 }
1937 break;
1938 case eWNI_SME_DEL_STA_SELF_RSP:
1939 if(pMsg->bodyptr)
1940 {
1941 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1942 vos_mem_free(pMsg->bodyptr);
1943 }
1944 else
1945 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001946 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 }
1948 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001949 case eWNI_SME_REMAIN_ON_CHN_RSP:
1950 if(pMsg->bodyptr)
1951 {
1952 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1953 vos_mem_free(pMsg->bodyptr);
1954 }
1955 else
1956 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001957 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 }
1959 break;
1960 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1961 if(pMsg->bodyptr)
1962 {
1963 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1964 vos_mem_free(pMsg->bodyptr);
1965 }
1966 else
1967 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001968 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 -07001969 }
1970 break;
1971 case eWNI_SME_MGMT_FRM_IND:
1972 if(pMsg->bodyptr)
1973 {
1974 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1975 vos_mem_free(pMsg->bodyptr);
1976 }
1977 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001978 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001979 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 }
1981 break;
1982 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1983 if(pMsg->bodyptr)
1984 {
1985 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1986 vos_mem_free(pMsg->bodyptr);
1987 }
1988 else
1989 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001990 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 }
1992 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 case eWNI_SME_COEX_IND:
1994 if(pMsg->bodyptr)
1995 {
1996 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1997 vos_mem_free(pMsg->bodyptr);
1998 }
1999 else
2000 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002001 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002003 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002004
2005#ifdef FEATURE_WLAN_SCAN_PNO
2006 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2007 if(pMsg->bodyptr)
2008 {
2009 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2010 vos_mem_free(pMsg->bodyptr);
2011 }
2012 else
2013 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002014 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 }
2016 break;
2017#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002018
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 case eWNI_SME_TX_PER_HIT_IND:
2020 if (pMac->sme.pTxPerHitCallback)
2021 {
2022 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2023 }
2024 break;
2025
2026 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002027 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 {
2029 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2030 vos_mem_free(pMsg->bodyptr);
2031 }
2032 else
2033 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002034 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2035 }
2036 break;
2037
2038 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2039 if (pMsg->bodyptr)
2040 {
2041 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2042 vos_mem_free(pMsg->bodyptr);
2043 }
2044 else
2045 {
2046 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 }
2048 break;
2049
2050#ifdef WLAN_FEATURE_PACKET_FILTERING
2051 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2052 if(pMsg->bodyptr)
2053 {
2054 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2055 vos_mem_free(pMsg->bodyptr);
2056 }
2057 else
2058 {
2059 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002060 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 }
2062 break;
2063#endif // WLAN_FEATURE_PACKET_FILTERING
2064 case eWNI_SME_PRE_SWITCH_CHL_IND:
2065 {
2066 status = sme_HandlePreChannelSwitchInd(pMac);
2067 break;
2068 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002069
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 case eWNI_SME_POST_SWITCH_CHL_IND:
2071 {
2072 status = sme_HandlePostChannelSwitchInd(pMac);
2073 break;
2074 }
2075
2076#ifdef WLAN_WAKEUP_EVENTS
2077 case eWNI_SME_WAKE_REASON_IND:
2078 if(pMsg->bodyptr)
2079 {
2080 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2081 vos_mem_free(pMsg->bodyptr);
2082 }
2083 else
2084 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002085 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 }
2087 break;
2088#endif // WLAN_WAKEUP_EVENTS
2089
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002090#ifdef FEATURE_WLAN_TDLS
2091 /*
2092 * command rescived from PE, SME tdls msg processor shall be called
2093 * to process commands recieved from PE
2094 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002095 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2096 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002097 case eWNI_SME_TDLS_DEL_STA_RSP:
2098 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002099 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002100 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302101 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002102#ifdef FEATURE_WLAN_TDLS_INTERNAL
2103 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2104 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2105 case eWNI_SME_TDLS_LINK_START_RSP:
2106 case eWNI_SME_TDLS_LINK_START_IND:
2107 case eWNI_SME_TDLS_TEARDOWN_RSP:
2108 case eWNI_SME_TDLS_TEARDOWN_IND:
2109 case eWNI_SME_ADD_TDLS_PEER_IND:
2110 case eWNI_SME_DELETE_TDLS_PEER_IND:
2111#endif
2112 {
2113 if (pMsg->bodyptr)
2114 {
2115 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302116 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002117 }
2118 else
2119 {
2120 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002121 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002122 }
2123 break;
2124 }
2125#endif
2126
Chet Lanctot186b5732013-03-18 10:26:30 -07002127#ifdef WLAN_FEATURE_11W
2128 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2129 if (pMsg->bodyptr)
2130 {
2131 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2132 vos_mem_free(pMsg->bodyptr);
2133 }
2134 else
2135 {
2136 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2137 }
2138 break;
2139#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002140#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
2141 case eWNI_SME_TSM_IE_IND:
2142 {
2143 if (pMsg->bodyptr)
2144 {
2145 sme_TsmIeInd(pMac, pMsg->bodyptr);
2146 vos_mem_free(pMsg->bodyptr);
2147 }
2148 else
2149 {
2150 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2151 }
2152 break;
2153 }
2154#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002155#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2156 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2157 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2158 break;
2159#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002160
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302161#ifdef WLAN_FEATURE_GTK_OFFLOAD
2162 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2163 if (pMsg->bodyptr)
2164 {
2165 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2166 vos_mem_free(pMsg->bodyptr);
2167 }
2168 else
2169 {
2170 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2171 }
2172 break ;
2173#endif
Leo Chang9056f462013-08-01 19:21:11 -07002174
2175#ifdef FEATURE_WLAN_LPHB
2176 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002177 case eWNI_SME_LPHB_IND:
2178 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002179 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002180 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002181 }
2182 vos_mem_free(pMsg->bodyptr);
2183
2184 break;
2185#endif /* FEATURE_WLAN_LPHB */
2186
Leo Chang0b0e45a2013-12-15 15:18:55 -08002187#ifdef FEATURE_WLAN_CH_AVOID
2188 /* LPHB timeout indication arrived, send IND to client */
2189 case eWNI_SME_CH_AVOID_IND:
2190 if (pMac->sme.pChAvoidNotificationCb)
2191 {
2192 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2193 "%s: CH avoid notification", __func__);
2194 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2195 }
2196 vos_mem_free(pMsg->bodyptr);
2197
2198 break;
2199#endif /* FEATURE_WLAN_CH_AVOID */
2200
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 default:
2202
2203 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2204 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2205 {
2206 //CSR
2207 if (pMsg->bodyptr)
2208 {
2209 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302210 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002211 }
2212 else
2213 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002214 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 }
2216 }
2217 else
2218 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002219 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 pMsg->type);
2221 if (pMsg->bodyptr)
2222 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302223 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 }
2225 }
2226 }//switch
2227 } //SME_IS_START
2228 else
2229 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002230 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 if (pMsg->bodyptr)
2232 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302233 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 }
2235 }
2236 sme_ReleaseGlobalLock( &pMac->sme );
2237 }
2238 else
2239 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002240 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 if (pMsg->bodyptr)
2242 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302243 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 }
2245 }
2246
2247 return status;
2248}
2249
2250
2251//No need to hold the global lock here because this function can only be called
2252//after sme_Stop.
2253v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2254{
2255 if( pMsg )
2256 {
2257 if (pMsg->bodyptr)
2258 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302259 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 }
2261 }
2262
2263}
2264
2265
2266/*--------------------------------------------------------------------------
2267
2268 \brief sme_Stop() - Stop all SME modules and put them at idle state
2269
2270 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2271 return, all modules are at idle state ready to start.
2272
Srinivas Girigowdade697412013-02-14 16:31:48 -08002273 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302275 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002276
2277 \return eHAL_STATUS_SUCCESS - SME is stopped.
2278
2279 Other status means SME is failed to stop but caller should still
2280 consider SME is stopped.
2281 \sa
2282
2283 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302284eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002285{
2286 eHalStatus status = eHAL_STATUS_FAILURE;
2287 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2288 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2289
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2291 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002292 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 status );
2294 fail_status = status;
2295 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002296
2297 p2pStop(hHal);
2298
Kiet Lama72a2322013-11-15 11:18:11 +05302299 status = pmcStop(hHal);
2300 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2301 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2302 status );
2303 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 }
2305
Kiet Lama72a2322013-11-15 11:18:11 +05302306 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002308 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 status );
2310 fail_status = status;
2311 }
2312
2313 ccmStop(hHal);
2314
2315 purgeSmeCmdList(pMac);
2316
2317 if (!HAL_STATUS_SUCCESS( fail_status )) {
2318 status = fail_status;
2319 }
2320
2321 pMac->sme.state = SME_STATE_STOP;
2322
2323 return status;
2324}
2325
2326/*--------------------------------------------------------------------------
2327
2328 \brief sme_Close() - Release all SME modules and their resources.
2329
2330 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2331 return, all modules are at closed state.
2332
2333 No SME APIs can be involved after smeClose except smeOpen.
2334 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002335 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 \param hHal - The handle returned by macOpen
2337
2338 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2339
2340 Other status means SME is failed to be closed but caller still cannot
2341 call any other SME functions except smeOpen.
2342 \sa
2343
2344 --------------------------------------------------------------------------*/
2345eHalStatus sme_Close(tHalHandle hHal)
2346{
2347 eHalStatus status = eHAL_STATUS_FAILURE;
2348 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2350
2351 status = csrClose(pMac);
2352 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002353 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 status );
2355 fail_status = status;
2356 }
2357
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2359 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002360 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 status );
2362 fail_status = status;
2363 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
2365#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2366 status = btcClose(hHal);
2367 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002368 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 status );
2370 fail_status = status;
2371 }
2372
2373 status = sme_QosClose(pMac);
2374 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002375 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 status );
2377 fail_status = status;
2378 }
2379#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002380#ifdef FEATURE_OEM_DATA_SUPPORT
2381 status = oemData_OemDataReqClose(hHal);
2382 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002383 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002384 status );
2385 fail_status = status;
2386 }
2387#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002388
2389 status = ccmClose(hHal);
2390 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002391 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002392 status );
2393 fail_status = status;
2394 }
2395
2396 status = pmcClose(hHal);
2397 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002398 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 status );
2400 fail_status = status;
2401 }
2402#if defined WLAN_FEATURE_VOWIFI
2403 status = rrmClose(hHal);
2404 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002405 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002406 status );
2407 fail_status = status;
2408 }
2409#endif
2410
2411#if defined WLAN_FEATURE_VOWIFI_11R
2412 sme_FTClose(hHal);
2413#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002415
2416 freeSmeCmdList(pMac);
2417
2418 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2419 {
2420 fail_status = eHAL_STATUS_FAILURE;
2421 }
2422
2423 if (!HAL_STATUS_SUCCESS( fail_status )) {
2424 status = fail_status;
2425 }
2426
2427 pMac->sme.state = SME_STATE_STOP;
2428
2429 return status;
2430}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002431#ifdef FEATURE_WLAN_LFR
2432tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2433{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002434#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002435 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2436 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2437 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2438 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2439 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2440 return eANI_BOOLEAN_FALSE;
2441 default:
2442 return eANI_BOOLEAN_TRUE;
2443 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002444#else
2445 /*
2446 * TODO: always return TRUE for now until
2447 * we figure out why we could be stuck in
2448 * one of the roaming states forever.
2449 */
2450 return eANI_BOOLEAN_TRUE;
2451#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002452}
2453#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002454/* ---------------------------------------------------------------------------
2455 \fn sme_ScanRequest
2456 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002457 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 \param pScanRequestID - pointer to an object to get back the request ID
2459 \param callback - a callback function that scan calls upon finish, will not
2460 be called if csrScanRequest returns error
2461 \param pContext - a pointer passed in for the callback
2462 \return eHalStatus
2463 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002464eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2465 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 csrScanCompleteCallback callback, void *pContext)
2467{
2468 eHalStatus status = eHAL_STATUS_FAILURE;
2469 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302470 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002471 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002472 smsLog(pMac, LOG2, FL("enter"));
2473 do
2474 {
2475 if(pMac->scan.fScanEnable)
2476 {
2477 status = sme_AcquireGlobalLock( &pMac->sme );
2478 if ( HAL_STATUS_SUCCESS( status ) )
2479 {
2480 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002481#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002482 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002483 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002484#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002485 status = csrScanRequest( hHal, sessionId, pscanReq,
2486 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302487 if ( !HAL_STATUS_SUCCESS( status ) )
2488 {
2489 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2490 " SId=%d"), sessionId);
2491 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002492#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002493 }
2494 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002495 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002496 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2497 pMac->roam.neighborRoamInfo.neighborRoamState,
2498 pMac->roam.curSubState[sessionId]);
2499 /*HandOff is in progress. So schedule this scan later*/
2500 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002501 }
2502#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002504
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 sme_ReleaseGlobalLock( &pMac->sme );
2506 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002507 else
2508 {
2509 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2510 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002512 else
2513 {
2514 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2515 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002516 } while( 0 );
2517
2518 return (status);
2519
2520
2521}
2522
2523/* ---------------------------------------------------------------------------
2524 \fn sme_ScanGetResult
2525 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002526 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 \param pFilter - If pFilter is NULL, all cached results are returned
2528 \param phResult - an object for the result.
2529 \return eHalStatus
2530 ---------------------------------------------------------------------------*/
2531eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2532 tScanResultHandle *phResult)
2533{
2534 eHalStatus status = eHAL_STATUS_FAILURE;
2535 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2536
Katya Nigambcb705f2013-12-26 14:26:22 +05302537 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002538 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 smsLog(pMac, LOG2, FL("enter"));
2540 status = sme_AcquireGlobalLock( &pMac->sme );
2541 if ( HAL_STATUS_SUCCESS( status ) )
2542 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002543 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 sme_ReleaseGlobalLock( &pMac->sme );
2545 }
2546 smsLog(pMac, LOG2, FL("exit status %d"), status);
2547
2548 return (status);
2549}
2550
2551
2552/* ---------------------------------------------------------------------------
2553 \fn sme_ScanFlushResult
2554 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002555 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002556 \return eHalStatus
2557 ---------------------------------------------------------------------------*/
2558eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2559{
2560 eHalStatus status = eHAL_STATUS_FAILURE;
2561 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2562
Katya Nigambcb705f2013-12-26 14:26:22 +05302563 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002564 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 status = sme_AcquireGlobalLock( &pMac->sme );
2566 if ( HAL_STATUS_SUCCESS( status ) )
2567 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002568 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 sme_ReleaseGlobalLock( &pMac->sme );
2570 }
2571
2572 return (status);
2573}
2574
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302575/* ---------------------------------------------------------------------------
2576 \fn sme_FilterScanResults
2577 \brief a wrapper function to request CSR to clear scan results.
2578 This is a synchronous call
2579 \return eHalStatus
2580 ---------------------------------------------------------------------------*/
2581eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2582{
2583 eHalStatus status = eHAL_STATUS_SUCCESS;
2584 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2585
2586 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2587 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2588 status = sme_AcquireGlobalLock( &pMac->sme );
2589 if ( HAL_STATUS_SUCCESS( status ) )
2590 {
2591 csrScanFilterResults(pMac);
2592 sme_ReleaseGlobalLock( &pMac->sme );
2593 }
2594
2595 return (status);
2596}
2597
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002598eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2599{
2600 eHalStatus status = eHAL_STATUS_FAILURE;
2601 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2602
Katya Nigambcb705f2013-12-26 14:26:22 +05302603 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002604 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002605 status = sme_AcquireGlobalLock( &pMac->sme );
2606 if ( HAL_STATUS_SUCCESS( status ) )
2607 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302608 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002609 sme_ReleaseGlobalLock( &pMac->sme );
2610 }
2611
2612 return (status);
2613}
Jeff Johnson295189b2012-06-20 16:38:30 -07002614
2615/* ---------------------------------------------------------------------------
2616 \fn sme_ScanResultGetFirst
2617 \brief a wrapper function to request CSR to returns the first element of
2618 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002619 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 \param hScanResult - returned from csrScanGetResult
2621 \return tCsrScanResultInfo * - NULL if no result
2622 ---------------------------------------------------------------------------*/
2623tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2624 tScanResultHandle hScanResult)
2625{
2626 eHalStatus status = eHAL_STATUS_FAILURE;
2627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2628 tCsrScanResultInfo *pRet = NULL;
2629
Katya Nigambcb705f2013-12-26 14:26:22 +05302630 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002631 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 status = sme_AcquireGlobalLock( &pMac->sme );
2633 if ( HAL_STATUS_SUCCESS( status ) )
2634 {
2635 pRet = csrScanResultGetFirst( pMac, hScanResult );
2636 sme_ReleaseGlobalLock( &pMac->sme );
2637 }
2638
2639 return (pRet);
2640}
2641
2642
2643/* ---------------------------------------------------------------------------
2644 \fn sme_ScanResultGetNext
2645 \brief a wrapper function to request CSR to returns the next element of
2646 scan result. It can be called without calling csrScanResultGetFirst
2647 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002648 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 \param hScanResult - returned from csrScanGetResult
2650 \return Null if no result or reach the end
2651 ---------------------------------------------------------------------------*/
2652tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2653 tScanResultHandle hScanResult)
2654{
2655 eHalStatus status = eHAL_STATUS_FAILURE;
2656 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2657 tCsrScanResultInfo *pRet = NULL;
2658
Katya Nigambcb705f2013-12-26 14:26:22 +05302659 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002660 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 status = sme_AcquireGlobalLock( &pMac->sme );
2662 if ( HAL_STATUS_SUCCESS( status ) )
2663 {
2664 pRet = csrScanResultGetNext( pMac, hScanResult );
2665 sme_ReleaseGlobalLock( &pMac->sme );
2666 }
2667
2668 return (pRet);
2669}
2670
2671
2672/* ---------------------------------------------------------------------------
2673 \fn sme_ScanSetBGScanparams
2674 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002675 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 \param pScanReq - BG scan request structure
2677 \return eHalStatus
2678 ---------------------------------------------------------------------------*/
2679eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2680{
2681 eHalStatus status = eHAL_STATUS_FAILURE;
2682 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2683
2684 if( NULL != pScanReq )
2685 {
2686 status = sme_AcquireGlobalLock( &pMac->sme );
2687 if ( HAL_STATUS_SUCCESS( status ) )
2688 {
2689 status = csrScanSetBGScanparams( hHal, pScanReq );
2690 sme_ReleaseGlobalLock( &pMac->sme );
2691 }
2692 }
2693
2694 return (status);
2695}
2696
2697
2698/* ---------------------------------------------------------------------------
2699 \fn sme_ScanResultPurge
2700 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2701 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002702 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 \param hScanResult - returned from csrScanGetResult. hScanResult is
2704 considered gone by
2705 calling this function and even before this function reutrns.
2706 \return eHalStatus
2707 ---------------------------------------------------------------------------*/
2708eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2709{
2710 eHalStatus status = eHAL_STATUS_FAILURE;
2711 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2712
Katya Nigambcb705f2013-12-26 14:26:22 +05302713 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002714 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002715 status = sme_AcquireGlobalLock( &pMac->sme );
2716 if ( HAL_STATUS_SUCCESS( status ) )
2717 {
2718 status = csrScanResultPurge( hHal, hScanResult );
2719 sme_ReleaseGlobalLock( &pMac->sme );
2720 }
2721
2722 return (status);
2723}
2724
2725/* ---------------------------------------------------------------------------
2726 \fn sme_ScanGetPMKIDCandidateList
2727 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002728 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002729 \param pPmkidList - caller allocated buffer point to an array of
2730 tPmkidCandidateInfo
2731 \param pNumItems - pointer to a variable that has the number of
2732 tPmkidCandidateInfo allocated when retruning, this is
2733 either the number needed or number of items put into
2734 pPmkidList
2735 \return eHalStatus - when fail, it usually means the buffer allocated is not
2736 big enough and pNumItems
2737 has the number of tPmkidCandidateInfo.
2738 \Note: pNumItems is a number of tPmkidCandidateInfo,
2739 not sizeof(tPmkidCandidateInfo) * something
2740 ---------------------------------------------------------------------------*/
2741eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002742 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 tANI_U32 *pNumItems )
2744{
2745 eHalStatus status = eHAL_STATUS_FAILURE;
2746 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2747
2748 status = sme_AcquireGlobalLock( &pMac->sme );
2749 if ( HAL_STATUS_SUCCESS( status ) )
2750 {
2751 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2752 sme_ReleaseGlobalLock( &pMac->sme );
2753 }
2754
2755 return (status);
2756}
2757
2758/*----------------------------------------------------------------------------
2759 \fn sme_RoamRegisterLinkQualityIndCallback
2760
2761 \brief
2762 a wrapper function to allow HDD to register a callback handler with CSR for
2763 link quality indications.
2764
2765 Only one callback may be registered at any time.
2766 In order to deregister the callback, a NULL cback may be provided.
2767
2768 Registration happens in the task context of the caller.
2769
2770 \param callback - Call back being registered
2771 \param pContext - user data
2772
2773 DEPENDENCIES: After CSR open
2774
2775 \return eHalStatus
2776-----------------------------------------------------------------------------*/
2777eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2778 csrRoamLinkQualityIndCallback callback,
2779 void *pContext)
2780{
2781 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2782}
2783
2784/* ---------------------------------------------------------------------------
2785 \fn sme_RoamRegisterCallback
2786 \brief a wrapper function to allow HDD to register a callback with CSR.
2787 Unlike scan, roam has one callback for all the roam requests
2788 \param callback - a callback function that roam calls upon when state changes
2789 \param pContext - a pointer passed in for the callback
2790 \return eHalStatus
2791 ---------------------------------------------------------------------------*/
2792eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2793 csrRoamCompleteCallback callback,
2794 void *pContext)
2795{
2796 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2797}
2798
2799eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2800{
2801 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2802 return pMac->roam.configParam.phyMode;
2803}
2804
2805/* ---------------------------------------------------------------------------
2806 \fn sme_RoamConnect
2807 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002808 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 \param sessionId - the sessionId returned by sme_OpenSession.
2810 \param pProfile - description of the network to which to connect
2811 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2812 from csrScanGetResult
2813 \param pRoamId - to get back the request ID
2814 \return eHalStatus
2815 ---------------------------------------------------------------------------*/
2816eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2817 tANI_U32 *pRoamId)
2818{
2819 eHalStatus status = eHAL_STATUS_FAILURE;
2820 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2821
Katya Nigambcb705f2013-12-26 14:26:22 +05302822 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002823 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002824 smsLog(pMac, LOG2, FL("enter"));
2825 status = sme_AcquireGlobalLock( &pMac->sme );
2826 if ( HAL_STATUS_SUCCESS( status ) )
2827 {
2828 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2829 {
2830 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2831 }
2832 else
2833 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002834 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 status = eHAL_STATUS_INVALID_PARAMETER;
2836 }
2837 sme_ReleaseGlobalLock( &pMac->sme );
2838 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002839 else
2840 {
2841 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2842 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002843
2844 return (status);
2845}
2846
2847/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302848
2849 \fn sme_SetPhyMode
2850
2851 \brief Changes the PhyMode.
2852
2853 \param hHal - The handle returned by macOpen.
2854
2855 \param phyMode new phyMode which is to set
2856
2857 \return eHalStatus SUCCESS.
2858
2859 -------------------------------------------------------------------------------*/
2860eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2861{
2862 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2863
2864 if (NULL == pMac)
2865 {
2866 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2867 "%s: invalid context", __func__);
2868 return eHAL_STATUS_FAILURE;
2869 }
2870
2871 pMac->roam.configParam.phyMode = phyMode;
2872 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2873 pMac->roam.configParam.phyMode,
2874 pMac->roam.configParam.ProprietaryRatesEnabled);
2875
2876 return eHAL_STATUS_SUCCESS;
2877}
2878
2879/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002880 \fn sme_RoamReassoc
2881 \brief a wrapper function to request CSR to inititiate a re-association
2882 \param pProfile - can be NULL to join the currently connected AP. In that
2883 case modProfileFields should carry the modified field(s) which could trigger
2884 reassoc
2885 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2886 that might need modification dynamically once STA is up & running and this
2887 could trigger a reassoc
2888 \param pRoamId - to get back the request ID
2889 \return eHalStatus
2890 -------------------------------------------------------------------------------*/
2891eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2892 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002893 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002894{
2895 eHalStatus status = eHAL_STATUS_FAILURE;
2896 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2897
Katya Nigambcb705f2013-12-26 14:26:22 +05302898 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002899 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002900 smsLog(pMac, LOG2, FL("enter"));
2901 status = sme_AcquireGlobalLock( &pMac->sme );
2902 if ( HAL_STATUS_SUCCESS( status ) )
2903 {
2904 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2905 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002906 if((NULL == pProfile) && (fForce == 1))
2907 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002908 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2909 /* to force the AP initiate fresh 802.1x authentication need to clear
2910 * the PMKID cache for that set the following boolean. this is needed
2911 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2912 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002913 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2914 }
2915 else
2916 {
2917 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002918 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 }
2920 else
2921 {
2922 status = eHAL_STATUS_INVALID_PARAMETER;
2923 }
2924 sme_ReleaseGlobalLock( &pMac->sme );
2925 }
2926
2927 return (status);
2928}
2929
2930/* ---------------------------------------------------------------------------
2931 \fn sme_RoamConnectToLastProfile
2932 \brief a wrapper function to request CSR to disconnect and reconnect with
2933 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002934 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002935 \return eHalStatus. It returns fail if currently connected
2936 ---------------------------------------------------------------------------*/
2937eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2938{
2939 eHalStatus status = eHAL_STATUS_FAILURE;
2940 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2941
2942 status = sme_AcquireGlobalLock( &pMac->sme );
2943 if ( HAL_STATUS_SUCCESS( status ) )
2944 {
2945 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2946 {
2947 status = csrRoamConnectToLastProfile( pMac, sessionId );
2948 }
2949 else
2950 {
2951 status = eHAL_STATUS_INVALID_PARAMETER;
2952 }
2953 sme_ReleaseGlobalLock( &pMac->sme );
2954 }
2955
2956 return (status);
2957}
2958
2959/* ---------------------------------------------------------------------------
2960 \fn sme_RoamDisconnect
2961 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002962 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 \param reason -- To indicate the reason for disconnecting. Currently, only
2964 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2965 \return eHalStatus
2966 ---------------------------------------------------------------------------*/
2967eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2968{
2969 eHalStatus status = eHAL_STATUS_FAILURE;
2970 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2971
Katya Nigambcb705f2013-12-26 14:26:22 +05302972 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002973 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 smsLog(pMac, LOG2, FL("enter"));
2975 status = sme_AcquireGlobalLock( &pMac->sme );
2976 if ( HAL_STATUS_SUCCESS( status ) )
2977 {
2978 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2979 {
2980 status = csrRoamDisconnect( pMac, sessionId, reason );
2981 }
2982 else
2983 {
2984 status = eHAL_STATUS_INVALID_PARAMETER;
2985 }
2986 sme_ReleaseGlobalLock( &pMac->sme );
2987 }
2988
2989 return (status);
2990}
2991
Jeff Johnson295189b2012-06-20 16:38:30 -07002992/* ---------------------------------------------------------------------------
2993 \fn sme_RoamStopBss
2994 \brief To stop BSS for Soft AP. This is an asynchronous API.
2995 \param hHal - Global structure
2996 \param sessionId - sessionId of SoftAP
2997 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2998 -------------------------------------------------------------------------------*/
2999eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3000{
3001 eHalStatus status = eHAL_STATUS_FAILURE;
3002 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3003
3004 smsLog(pMac, LOG2, FL("enter"));
3005 status = sme_AcquireGlobalLock( &pMac->sme );
3006 if ( HAL_STATUS_SUCCESS( status ) )
3007 {
3008 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3009 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303010 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 }
3012 else
3013 {
3014 status = eHAL_STATUS_INVALID_PARAMETER;
3015 }
3016 sme_ReleaseGlobalLock( &pMac->sme );
3017 }
3018
3019 return (status);
3020}
3021
3022/* ---------------------------------------------------------------------------
3023 \fn sme_RoamDisconnectSta
3024 \brief To disassociate a station. This is an asynchronous API.
3025 \param hHal - Global structure
3026 \param sessionId - sessionId of SoftAP
3027 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3028 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3029 -------------------------------------------------------------------------------*/
3030eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3031 tANI_U8 *pPeerMacAddr)
3032{
3033 eHalStatus status = eHAL_STATUS_FAILURE;
3034 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3035
3036 if ( NULL == pMac )
3037 {
3038 VOS_ASSERT(0);
3039 return status;
3040 }
3041
3042 status = sme_AcquireGlobalLock( &pMac->sme );
3043 if ( HAL_STATUS_SUCCESS( status ) )
3044 {
3045 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3046 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003047 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303048 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003049 }
3050 else
3051 {
3052 status = eHAL_STATUS_INVALID_PARAMETER;
3053 }
3054 sme_ReleaseGlobalLock( &pMac->sme );
3055 }
3056
3057 return (status);
3058}
3059
3060/* ---------------------------------------------------------------------------
3061 \fn sme_RoamDeauthSta
3062 \brief To disassociate a station. This is an asynchronous API.
3063 \param hHal - Global structure
3064 \param sessionId - sessionId of SoftAP
3065 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3066 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3067 -------------------------------------------------------------------------------*/
3068eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3069 tANI_U8 *pPeerMacAddr)
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 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003085 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303086 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003087 }
3088 else
3089 {
3090 status = eHAL_STATUS_INVALID_PARAMETER;
3091 }
3092 sme_ReleaseGlobalLock( &pMac->sme );
3093 }
3094
3095 return (status);
3096}
3097
3098/* ---------------------------------------------------------------------------
3099 \fn sme_RoamTKIPCounterMeasures
3100 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3101 \param sessionId - sessionId of SoftAP
3102 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3103 \return eHalStatus
3104 -------------------------------------------------------------------------------*/
3105eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3106 tANI_BOOLEAN bEnable)
3107{
3108 eHalStatus status = eHAL_STATUS_FAILURE;
3109 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3110
3111 if ( NULL == pMac )
3112 {
3113 VOS_ASSERT(0);
3114 return status;
3115 }
3116
3117 status = sme_AcquireGlobalLock( &pMac->sme );
3118 if ( HAL_STATUS_SUCCESS( status ) )
3119 {
3120 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3121 {
3122 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3123 }
3124 else
3125 {
3126 status = eHAL_STATUS_INVALID_PARAMETER;
3127 }
3128 sme_ReleaseGlobalLock( &pMac->sme );
3129 }
3130
3131 return (status);
3132}
3133
3134/* ---------------------------------------------------------------------------
3135 \fn sme_RoamGetAssociatedStas
3136 \brief To probe the list of associated stations from various modules of CORE stack.
3137 \This is an asynchronous API.
3138 \param sessionId - sessionId of SoftAP
3139 \param modId - Module from whom list of associtated stations is to be probed.
3140 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3141 \param pUsrContext - Opaque HDD context
3142 \param pfnSapEventCallback - Sap event callback in HDD
3143 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3144 \return eHalStatus
3145 -------------------------------------------------------------------------------*/
3146eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3147 VOS_MODULE_ID modId, void *pUsrContext,
3148 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3149{
3150 eHalStatus status = eHAL_STATUS_FAILURE;
3151 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3152
3153 if ( NULL == pMac )
3154 {
3155 VOS_ASSERT(0);
3156 return status;
3157 }
3158
3159 status = sme_AcquireGlobalLock( &pMac->sme );
3160 if ( HAL_STATUS_SUCCESS( status ) )
3161 {
3162 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3163 {
3164 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3165 }
3166 else
3167 {
3168 status = eHAL_STATUS_INVALID_PARAMETER;
3169 }
3170 sme_ReleaseGlobalLock( &pMac->sme );
3171 }
3172
3173 return (status);
3174}
3175
3176/* ---------------------------------------------------------------------------
3177 \fn sme_RoamGetWpsSessionOverlap
3178 \brief To get the WPS PBC session overlap information.
3179 \This is an asynchronous API.
3180 \param sessionId - sessionId of SoftAP
3181 \param pUsrContext - Opaque HDD context
3182 \param pfnSapEventCallback - Sap event callback in HDD
3183 \pRemoveMac - pointer to Mac address which needs to be removed from session
3184 \return eHalStatus
3185 -------------------------------------------------------------------------------*/
3186eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003187 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003188 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3189{
3190 eHalStatus status = eHAL_STATUS_FAILURE;
3191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3192
3193 if ( NULL == pMac )
3194 {
3195 VOS_ASSERT(0);
3196 return status;
3197 }
3198
3199 status = sme_AcquireGlobalLock( &pMac->sme );
3200 if ( HAL_STATUS_SUCCESS( status ) )
3201 {
3202 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3203 {
3204 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3205 }
3206 else
3207 {
3208 status = eHAL_STATUS_INVALID_PARAMETER;
3209 }
3210 sme_ReleaseGlobalLock( &pMac->sme );
3211 }
3212
3213 return (status);
3214}
3215
Jeff Johnson295189b2012-06-20 16:38:30 -07003216
3217/* ---------------------------------------------------------------------------
3218 \fn sme_RoamGetConnectState
3219 \brief a wrapper function to request CSR to return the current connect state
3220 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003221 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003222 \return eHalStatus
3223 ---------------------------------------------------------------------------*/
3224eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3225{
3226 eHalStatus status = eHAL_STATUS_FAILURE;
3227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3228
3229 status = sme_AcquireGlobalLock( &pMac->sme );
3230 if ( HAL_STATUS_SUCCESS( status ) )
3231 {
3232 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3233 {
3234 status = csrRoamGetConnectState( pMac, sessionId, pState );
3235 }
3236 else
3237 {
3238 status = eHAL_STATUS_INVALID_PARAMETER;
3239 }
3240 sme_ReleaseGlobalLock( &pMac->sme );
3241 }
3242
3243 return (status);
3244}
3245
3246/* ---------------------------------------------------------------------------
3247 \fn sme_RoamGetConnectProfile
3248 \brief a wrapper function to request CSR to return the current connect
3249 profile. Caller must call csrRoamFreeConnectProfile after it is done
3250 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003251 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 \param pProfile - pointer to a caller allocated structure
3253 tCsrRoamConnectedProfile
3254 \return eHalStatus. Failure if not connected
3255 ---------------------------------------------------------------------------*/
3256eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3257 tCsrRoamConnectedProfile *pProfile)
3258{
3259 eHalStatus status = eHAL_STATUS_FAILURE;
3260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3261
Katya Nigambcb705f2013-12-26 14:26:22 +05303262 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003263 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 status = sme_AcquireGlobalLock( &pMac->sme );
3265 if ( HAL_STATUS_SUCCESS( status ) )
3266 {
3267 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3268 {
3269 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3270 }
3271 else
3272 {
3273 status = eHAL_STATUS_INVALID_PARAMETER;
3274 }
3275 sme_ReleaseGlobalLock( &pMac->sme );
3276 }
3277
3278 return (status);
3279}
3280
3281/* ---------------------------------------------------------------------------
3282 \fn sme_RoamFreeConnectProfile
3283 \brief a wrapper function to request CSR to free and reinitialize the
3284 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003285 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 \param pProfile - pointer to a caller allocated structure
3287 tCsrRoamConnectedProfile
3288 \return eHalStatus.
3289 ---------------------------------------------------------------------------*/
3290eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3291 tCsrRoamConnectedProfile *pProfile)
3292{
3293 eHalStatus status = eHAL_STATUS_FAILURE;
3294 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3295
Katya Nigambcb705f2013-12-26 14:26:22 +05303296 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003297 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 status = sme_AcquireGlobalLock( &pMac->sme );
3299 if ( HAL_STATUS_SUCCESS( status ) )
3300 {
3301 status = csrRoamFreeConnectProfile( pMac, pProfile );
3302 sme_ReleaseGlobalLock( &pMac->sme );
3303 }
3304
3305 return (status);
3306}
3307
3308/* ---------------------------------------------------------------------------
3309 \fn sme_RoamSetPMKIDCache
3310 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003311 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 \param pPMKIDCache - caller allocated buffer point to an array of
3313 tPmkidCacheInfo
3314 \param numItems - a variable that has the number of tPmkidCacheInfo
3315 allocated when retruning, this is either the number needed
3316 or number of items put into pPMKIDCache
3317 \return eHalStatus - when fail, it usually means the buffer allocated is not
3318 big enough and pNumItems has the number of
3319 tPmkidCacheInfo.
3320 \Note: pNumItems is a number of tPmkidCacheInfo,
3321 not sizeof(tPmkidCacheInfo) * something
3322 ---------------------------------------------------------------------------*/
3323eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3324 tANI_U32 numItems )
3325{
3326 eHalStatus status = eHAL_STATUS_FAILURE;
3327 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3328
Katya Nigambcb705f2013-12-26 14:26:22 +05303329 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003330 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 status = sme_AcquireGlobalLock( &pMac->sme );
3332 if ( HAL_STATUS_SUCCESS( status ) )
3333 {
3334 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3335 {
3336 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3337 }
3338 else
3339 {
3340 status = eHAL_STATUS_INVALID_PARAMETER;
3341 }
3342 sme_ReleaseGlobalLock( &pMac->sme );
3343 }
3344
3345 return (status);
3346}
3347
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003348eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3349{
3350 eHalStatus status = eHAL_STATUS_FAILURE;
3351 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3352 status = sme_AcquireGlobalLock( &pMac->sme );
3353 if ( HAL_STATUS_SUCCESS( status ) )
3354 {
3355 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3356 {
3357 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3358 }
3359 else
3360 {
3361 status = eHAL_STATUS_INVALID_PARAMETER;
3362 }
3363 sme_ReleaseGlobalLock( &pMac->sme );
3364 }
3365 return (status);
3366}
Wilson Yang47b58192013-12-11 11:40:19 -08003367
Jeff Johnson295189b2012-06-20 16:38:30 -07003368/* ---------------------------------------------------------------------------
3369 \fn sme_RoamGetSecurityReqIE
3370 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3371 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003372 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003373 \param pLen - caller allocated memory that has the length of pBuf as input.
3374 Upon returned, *pLen has the needed or IE length in pBuf.
3375 \param pBuf - Caller allocated memory that contain the IE field, if any,
3376 upon return
3377 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3378 \return eHalStatus - when fail, it usually means the buffer allocated is not
3379 big enough
3380 ---------------------------------------------------------------------------*/
3381eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3382 tANI_U8 *pBuf, eCsrSecurityType secType)
3383{
3384 eHalStatus status = eHAL_STATUS_FAILURE;
3385 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3386
3387 status = sme_AcquireGlobalLock( &pMac->sme );
3388 if ( HAL_STATUS_SUCCESS( status ) )
3389 {
3390 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3391 {
3392 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3393 }
3394 else
3395 {
3396 status = eHAL_STATUS_INVALID_PARAMETER;
3397 }
3398 sme_ReleaseGlobalLock( &pMac->sme );
3399 }
3400
3401 return (status);
3402}
3403
3404/* ---------------------------------------------------------------------------
3405 \fn sme_RoamGetSecurityRspIE
3406 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3407 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003408 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 \param pLen - caller allocated memory that has the length of pBuf as input.
3410 Upon returned, *pLen has the needed or IE length in pBuf.
3411 \param pBuf - Caller allocated memory that contain the IE field, if any,
3412 upon return
3413 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3414 \return eHalStatus - when fail, it usually means the buffer allocated is not
3415 big enough
3416 ---------------------------------------------------------------------------*/
3417eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3418 tANI_U8 *pBuf, eCsrSecurityType secType)
3419{
3420 eHalStatus status = eHAL_STATUS_FAILURE;
3421 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3422
3423 status = sme_AcquireGlobalLock( &pMac->sme );
3424 if ( HAL_STATUS_SUCCESS( status ) )
3425 {
3426 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3427 {
3428 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3429 }
3430 else
3431 {
3432 status = eHAL_STATUS_INVALID_PARAMETER;
3433 }
3434 sme_ReleaseGlobalLock( &pMac->sme );
3435 }
3436
3437 return (status);
3438
3439}
3440
3441
3442/* ---------------------------------------------------------------------------
3443 \fn sme_RoamGetNumPMKIDCache
3444 \brief a wrapper function to request CSR to return number of PMKID cache
3445 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003446 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 \return tANI_U32 - the number of PMKID cache entries
3448 ---------------------------------------------------------------------------*/
3449tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3450{
3451 eHalStatus status = eHAL_STATUS_FAILURE;
3452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3453 tANI_U32 numPmkidCache = 0;
3454
3455 status = sme_AcquireGlobalLock( &pMac->sme );
3456 if ( HAL_STATUS_SUCCESS( status ) )
3457 {
3458 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3459 {
3460 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3461 status = eHAL_STATUS_SUCCESS;
3462 }
3463 else
3464 {
3465 status = eHAL_STATUS_INVALID_PARAMETER;
3466 }
3467 sme_ReleaseGlobalLock( &pMac->sme );
3468 }
3469
3470 return (numPmkidCache);
3471}
3472
3473/* ---------------------------------------------------------------------------
3474 \fn sme_RoamGetPMKIDCache
3475 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003476 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 \param pNum - caller allocated memory that has the space of the number of
3478 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3479 needed or actually number in tPmkidCacheInfo.
3480 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3481 any, upon return
3482 \return eHalStatus - when fail, it usually means the buffer allocated is not
3483 big enough
3484 ---------------------------------------------------------------------------*/
3485eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3486 tPmkidCacheInfo *pPmkidCache)
3487{
3488 eHalStatus status = eHAL_STATUS_FAILURE;
3489 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3490
3491 status = sme_AcquireGlobalLock( &pMac->sme );
3492 if ( HAL_STATUS_SUCCESS( status ) )
3493 {
3494 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3495 {
3496 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3497 }
3498 else
3499 {
3500 status = eHAL_STATUS_INVALID_PARAMETER;
3501 }
3502 sme_ReleaseGlobalLock( &pMac->sme );
3503 }
3504
3505 return (status);
3506}
3507
3508
3509/* ---------------------------------------------------------------------------
3510 \fn sme_GetConfigParam
3511 \brief a wrapper function that HDD calls to get the global settings
3512 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003513 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003514 \param pParam - caller allocated memory
3515 \return eHalStatus
3516 ---------------------------------------------------------------------------*/
3517eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3518{
3519 eHalStatus status = eHAL_STATUS_FAILURE;
3520 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3521
Katya Nigambcb705f2013-12-26 14:26:22 +05303522 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003523 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003524 status = sme_AcquireGlobalLock( &pMac->sme );
3525 if ( HAL_STATUS_SUCCESS( status ) )
3526 {
3527 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3528 if (status != eHAL_STATUS_SUCCESS)
3529 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003530 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003531 sme_ReleaseGlobalLock( &pMac->sme );
3532 return status;
3533 }
3534#if defined WLAN_FEATURE_P2P_INTERNAL
3535 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3536 if (status != eHAL_STATUS_SUCCESS)
3537 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003538 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003539 sme_ReleaseGlobalLock( &pMac->sme );
3540 return status;
3541 }
3542#endif
3543 sme_ReleaseGlobalLock( &pMac->sme );
3544 }
3545
3546 return (status);
3547}
3548
3549/* ---------------------------------------------------------------------------
3550 \fn sme_CfgSetInt
3551 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003552 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 \param cfgId - Configuration Parameter ID (type) for STA.
3554 \param ccmValue - The information related to Configuration Parameter ID
3555 which needs to be saved in CFG
3556 \param callback - To be registered by CSR with CCM. Once the CFG done with
3557 saving the information in the database, it notifies CCM &
3558 then the callback will be invoked to notify.
3559 \param toBeSaved - To save the request for future reference
3560 \return eHalStatus
3561 ---------------------------------------------------------------------------*/
3562eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3563 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3564{
3565 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3566}
3567
3568/* ---------------------------------------------------------------------------
3569 \fn sme_CfgSetStr
3570 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003571 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 \param cfgId - Configuration Parameter ID (type) for STA.
3573 \param pStr - Pointer to the byte array which carries the information needs
3574 to be saved in CFG
3575 \param length - Length of the data to be saved
3576 \param callback - To be registered by CSR with CCM. Once the CFG done with
3577 saving the information in the database, it notifies CCM &
3578 then the callback will be invoked to notify.
3579 \param toBeSaved - To save the request for future reference
3580 \return eHalStatus
3581 ---------------------------------------------------------------------------*/
3582eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3583 tANI_U32 length, tCcmCfgSetCallback callback,
3584 eAniBoolean toBeSaved)
3585{
3586 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3587}
3588
3589/* ---------------------------------------------------------------------------
3590 \fn sme_GetModifyProfileFields
3591 \brief HDD or SME - QOS calls this function to get the current values of
3592 connected profile fields, changing which can cause reassoc.
3593 This function must be called after CFG is downloaded and STA is in connected
3594 state. Also, make sure to call this function to get the current profile
3595 fields before calling the reassoc. So that pModifyProfileFields will have
3596 all the latest values plus the one(s) has been updated as part of reassoc
3597 request.
3598 \param pModifyProfileFields - pointer to the connected profile fields
3599 changing which can cause reassoc
3600
3601 \return eHalStatus
3602 -------------------------------------------------------------------------------*/
3603eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3604 tCsrRoamModifyProfileFields * pModifyProfileFields)
3605{
3606 eHalStatus status = eHAL_STATUS_FAILURE;
3607 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3608
Katya Nigambcb705f2013-12-26 14:26:22 +05303609 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003610 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 status = sme_AcquireGlobalLock( &pMac->sme );
3612 if ( HAL_STATUS_SUCCESS( status ) )
3613 {
3614 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3615 {
3616 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3617 }
3618 else
3619 {
3620 status = eHAL_STATUS_INVALID_PARAMETER;
3621 }
3622 sme_ReleaseGlobalLock( &pMac->sme );
3623 }
3624
3625 return (status);
3626}
3627
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303628/* ---------------------------------------------------------------------------
3629 \fn sme_HT40StopOBSSScan
3630 \brief HDD or SME - Command to stop the OBSS scan
3631 THis is implemented only for debugging purpose.
3632 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3633 \param sessionId - sessionId
3634 changing which can cause reassoc
3635
3636 \return eHalStatus
3637 -------------------------------------------------------------------------------*/
3638eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3639{
3640 eHalStatus status = eHAL_STATUS_FAILURE;
3641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3642
3643 smsLog(pMac, LOG2, FL("enter"));
3644 status = sme_AcquireGlobalLock( &pMac->sme );
3645 if ( HAL_STATUS_SUCCESS( status ) )
3646 {
3647 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3648 {
3649 csrHT40StopOBSSScan( pMac, sessionId );
3650 }
3651 else
3652 {
3653 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3654 "%s: Invalid session sessionId %d", __func__,sessionId);
3655 status = eHAL_STATUS_INVALID_PARAMETER;
3656 }
3657 sme_ReleaseGlobalLock( &pMac->sme );
3658 }
3659 return (status);
3660}
3661
Jeff Johnson295189b2012-06-20 16:38:30 -07003662/*--------------------------------------------------------------------------
3663 \fn sme_SetConfigPowerSave
3664 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3665 For BMPS related configuration, this function also updates the CFG
3666 and sends a message to FW to pick up the new values. Note: Calling
3667 this function only updates the configuration and does not enable
3668 the specified power save mode.
3669 \param hHal - The handle returned by macOpen.
3670 \param psMode - Power Saving mode being modified
3671 \param pConfigParams - a pointer to a caller allocated object of type
3672 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3673 \return eHalStatus
3674 --------------------------------------------------------------------------*/
3675eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3676 void *pConfigParams)
3677{
3678 eHalStatus status = eHAL_STATUS_FAILURE;
3679 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3680
Katya Nigambcb705f2013-12-26 14:26:22 +05303681 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003682 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 if (NULL == pConfigParams ) {
3684 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3685 "nothing to update");
3686 return eHAL_STATUS_FAILURE;
3687 }
3688
3689 status = sme_AcquireGlobalLock( &pMac->sme );
3690 if ( HAL_STATUS_SUCCESS( status ) )
3691 {
3692 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3693 sme_ReleaseGlobalLock( &pMac->sme );
3694 }
3695
3696 return (status);
3697}
3698
3699/*--------------------------------------------------------------------------
3700 \fn sme_GetConfigPowerSave
3701 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3702 \param hHal - The handle returned by macOpen.
3703 \param psMode - Power Saving mode
3704 \param pConfigParams - a pointer to a caller allocated object of type
3705 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3706 \return eHalStatus
3707 --------------------------------------------------------------------------*/
3708eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3709 void *pConfigParams)
3710{
3711 eHalStatus status = eHAL_STATUS_FAILURE;
3712 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3713
Katya Nigambcb705f2013-12-26 14:26:22 +05303714 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003715 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003716 if (NULL == pConfigParams ) {
3717 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3718 "nothing to update");
3719 return eHAL_STATUS_FAILURE;
3720 }
3721
3722 status = sme_AcquireGlobalLock( &pMac->sme );
3723 if ( HAL_STATUS_SUCCESS( status ) )
3724 {
3725 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3726 sme_ReleaseGlobalLock( &pMac->sme );
3727 }
3728
3729 return (status);
3730}
3731
3732/* ---------------------------------------------------------------------------
3733 \fn sme_SignalPowerEvent
3734 \brief Signals to PMC that a power event has occurred. Used for putting
3735 the chip into deep sleep mode.
3736 \param hHal - The handle returned by macOpen.
3737 \param event - the event that has occurred
3738 \return eHalStatus
3739 ---------------------------------------------------------------------------*/
3740eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3741{
3742 eHalStatus status = eHAL_STATUS_FAILURE;
3743 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3744
3745 status = sme_AcquireGlobalLock( &pMac->sme );
3746 if ( HAL_STATUS_SUCCESS( status ) )
3747 {
3748 status = pmcSignalPowerEvent(hHal, event);
3749 sme_ReleaseGlobalLock( &pMac->sme );
3750 }
3751
3752 return (status);
3753}
3754
3755/* ---------------------------------------------------------------------------
3756 \fn sme_EnablePowerSave
3757 \brief Enables one of the power saving modes.
3758 \param hHal - The handle returned by macOpen.
3759 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3760 while the chip is operating in Full Power, PMC will start
3761 a timer that will try to put the chip in BMPS mode after
3762 expiry.
3763 \return eHalStatus
3764 ---------------------------------------------------------------------------*/
3765eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3766{
3767 eHalStatus status = eHAL_STATUS_FAILURE;
3768 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3769
Katya Nigambcb705f2013-12-26 14:26:22 +05303770 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003771 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 status = sme_AcquireGlobalLock( &pMac->sme );
3773 if ( HAL_STATUS_SUCCESS( status ) )
3774 {
3775 status = pmcEnablePowerSave(hHal, psMode);
3776 sme_ReleaseGlobalLock( &pMac->sme );
3777 }
3778
3779 return (status);
3780}
3781
3782/* ---------------------------------------------------------------------------
3783 \fn sme_DisablePowerSave
3784 \brief Disables one of the power saving modes.
3785 \param hHal - The handle returned by macOpen.
3786 \param psMode - The power saving mode to disable. Disabling does not imply
3787 that device will be brought out of the current PS mode. This
3788 is purely a configuration API.
3789 \return eHalStatus
3790 ---------------------------------------------------------------------------*/
3791eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3792{
3793 eHalStatus status = eHAL_STATUS_FAILURE;
3794 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3795
Katya Nigambcb705f2013-12-26 14:26:22 +05303796 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003797 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003798 status = sme_AcquireGlobalLock( &pMac->sme );
3799 if ( HAL_STATUS_SUCCESS( status ) )
3800 {
3801 status = pmcDisablePowerSave(hHal, psMode);
3802 sme_ReleaseGlobalLock( &pMac->sme );
3803 }
3804
3805 return (status);
3806 }
3807
3808/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303809+ \fn sme_SetHostPowerSave
3810+ \brief Enables BMPS logic to be controlled by User level apps
3811+ \param hHal - The handle returned by macOpen.
3812+ \param psMode - The power saving mode to disable. Disabling does not imply
3813+ that device will be brought out of the current PS mode. This
3814+ is purely a configuration API.
3815+ \return eHalStatus
3816+ ---------------------------------------------------------------------------*/
3817eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3818{
3819 eHalStatus status = eHAL_STATUS_FAILURE;
3820 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3821
3822 pMac->pmc.isHostPsEn = psMode;
3823
3824 return (status);
3825}
3826
3827/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003828 \fn sme_StartAutoBmpsTimer
3829 \brief Starts a timer that periodically polls all the registered
3830 module for entry into Bmps mode. This timer is started only if BMPS is
3831 enabled and whenever the device is in full power.
3832 \param hHal - The handle returned by macOpen.
3833 \return eHalStatus
3834 ---------------------------------------------------------------------------*/
3835eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3836{
3837 eHalStatus status = eHAL_STATUS_FAILURE;
3838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3839
Katya Nigambcb705f2013-12-26 14:26:22 +05303840 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003841 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003842 status = sme_AcquireGlobalLock( &pMac->sme );
3843 if ( HAL_STATUS_SUCCESS( status ) )
3844 {
3845 status = pmcStartAutoBmpsTimer(hHal);
3846 sme_ReleaseGlobalLock( &pMac->sme );
3847 }
3848
3849 return (status);
3850}
3851/* ---------------------------------------------------------------------------
3852 \fn sme_StopAutoBmpsTimer
3853 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3854 Stopping the timer does not cause a device state change. Only the timer
3855 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3856 \param hHal - The handle returned by macOpen.
3857 \return eHalStatus
3858 ---------------------------------------------------------------------------*/
3859eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3860{
3861 eHalStatus status = eHAL_STATUS_FAILURE;
3862 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3863
Katya Nigambcb705f2013-12-26 14:26:22 +05303864 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003865 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003866 status = sme_AcquireGlobalLock( &pMac->sme );
3867 if ( HAL_STATUS_SUCCESS( status ) )
3868 {
3869 status = pmcStopAutoBmpsTimer(hHal);
3870 sme_ReleaseGlobalLock( &pMac->sme );
3871 }
3872
3873 return (status);
3874}
3875/* ---------------------------------------------------------------------------
3876 \fn sme_QueryPowerState
3877 \brief Returns the current power state of the device.
3878 \param hHal - The handle returned by macOpen.
3879 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3880 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3881 \return eHalStatus
3882 ---------------------------------------------------------------------------*/
3883eHalStatus sme_QueryPowerState (
3884 tHalHandle hHal,
3885 tPmcPowerState *pPowerState,
3886 tPmcSwitchState *pSwWlanSwitchState)
3887{
3888 eHalStatus status = eHAL_STATUS_FAILURE;
3889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3890
3891 status = sme_AcquireGlobalLock( &pMac->sme );
3892 if ( HAL_STATUS_SUCCESS( status ) )
3893 {
3894 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3895 sme_ReleaseGlobalLock( &pMac->sme );
3896 }
3897
3898 return (status);
3899}
3900
3901/* ---------------------------------------------------------------------------
3902 \fn sme_IsPowerSaveEnabled
3903 \brief Checks if the device is able to enter a particular power save mode
3904 This does not imply that the device is in a particular PS mode
3905 \param hHal - The handle returned by macOpen.
3906 \param psMode - the power saving mode
3907 \return eHalStatus
3908 ---------------------------------------------------------------------------*/
3909tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3910{
3911 eHalStatus status = eHAL_STATUS_FAILURE;
3912 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3913 tANI_BOOLEAN result = false;
3914
Katya Nigambcb705f2013-12-26 14:26:22 +05303915 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003916 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 status = sme_AcquireGlobalLock( &pMac->sme );
3918 if ( HAL_STATUS_SUCCESS( status ) )
3919 {
3920 result = pmcIsPowerSaveEnabled(hHal, psMode);
3921 sme_ReleaseGlobalLock( &pMac->sme );
3922 return result;
3923 }
3924
3925 return false;
3926}
3927
3928/* ---------------------------------------------------------------------------
3929 \fn sme_RequestFullPower
3930 \brief Request that the device be brought to full power state. When the
3931 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3932 is enabled. On timer expiry PMC will attempt to put the device in
3933 BMPS mode if following holds true:
3934 - BMPS mode is enabled
3935 - Polling of all modules through the Power Save Check routine passes
3936 - STA is associated to an access point
3937 \param hHal - The handle returned by macOpen.
3938 \param - callbackRoutine Callback routine invoked in case of success/failure
3939 \return eHalStatus - status
3940 eHAL_STATUS_SUCCESS - device brought to full power state
3941 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3942 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3943 ---------------------------------------------------------------------------*/
3944eHalStatus sme_RequestFullPower (
3945 tHalHandle hHal,
3946 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3947 void *callbackContext,
3948 tRequestFullPowerReason fullPowerReason)
3949{
3950 eHalStatus status = eHAL_STATUS_FAILURE;
3951 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3952
Katya Nigambcb705f2013-12-26 14:26:22 +05303953 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003954 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 status = sme_AcquireGlobalLock( &pMac->sme );
3956 if ( HAL_STATUS_SUCCESS( status ) )
3957 {
3958 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3959 sme_ReleaseGlobalLock( &pMac->sme );
3960 }
3961
3962 return (status);
3963}
3964
3965/* ---------------------------------------------------------------------------
3966 \fn sme_RequestBmps
3967 \brief Request that the device be put in BMPS state. Request will be
3968 accepted only if BMPS mode is enabled and power save check routine
3969 passes.
3970 \param hHal - The handle returned by macOpen.
3971 \param - callbackRoutine Callback routine invoked in case of success/failure
3972 \return eHalStatus
3973 eHAL_STATUS_SUCCESS - device is in BMPS state
3974 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3975 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3976 ---------------------------------------------------------------------------*/
3977eHalStatus sme_RequestBmps (
3978 tHalHandle hHal,
3979 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3980 void *callbackContext)
3981{
3982 eHalStatus status = eHAL_STATUS_FAILURE;
3983 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3984
Katya Nigambcb705f2013-12-26 14:26:22 +05303985 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003986 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003987 status = sme_AcquireGlobalLock( &pMac->sme );
3988 if ( HAL_STATUS_SUCCESS( status ) )
3989 {
3990 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3991 sme_ReleaseGlobalLock( &pMac->sme );
3992 }
3993
3994 return (status);
3995}
3996
3997
3998/* ---------------------------------------------------------------------------
3999 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004000 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4001 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004002 \param hHal - The handle returned by macOpen.
4003 ---------------------------------------------------------------------------*/
4004void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4005{
4006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4007
Katya Nigambcb705f2013-12-26 14:26:22 +05304008 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004009 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4011 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4012}
4013
4014
4015/* ---------------------------------------------------------------------------
4016 \fn sme_StartUapsd
4017 \brief Request that the device be put in UAPSD state. If the device is in
4018 Full Power it will be put in BMPS mode first and then into UAPSD
4019 mode.
4020 \param hHal - The handle returned by macOpen.
4021 \param - callbackRoutine Callback routine invoked in case of success/failure
4022 eHAL_STATUS_SUCCESS - device is in UAPSD state
4023 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4024 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4025 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4026 \return eHalStatus
4027 ---------------------------------------------------------------------------*/
4028eHalStatus sme_StartUapsd (
4029 tHalHandle hHal,
4030 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4031 void *callbackContext)
4032{
4033 eHalStatus status = eHAL_STATUS_FAILURE;
4034 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4035
4036 status = sme_AcquireGlobalLock( &pMac->sme );
4037 if ( HAL_STATUS_SUCCESS( status ) )
4038 {
4039 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4040 sme_ReleaseGlobalLock( &pMac->sme );
4041 }
4042
4043 return (status);
4044 }
4045
4046/* ---------------------------------------------------------------------------
4047 \fn sme_StopUapsd
4048 \brief Request that the device be put out of UAPSD state. Device will be
4049 put in in BMPS state after stop UAPSD completes.
4050 \param hHal - The handle returned by macOpen.
4051 \return eHalStatus
4052 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4053 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4054 ---------------------------------------------------------------------------*/
4055eHalStatus sme_StopUapsd (tHalHandle hHal)
4056{
4057 eHalStatus status = eHAL_STATUS_FAILURE;
4058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4059
4060 status = sme_AcquireGlobalLock( &pMac->sme );
4061 if ( HAL_STATUS_SUCCESS( status ) )
4062 {
4063 status = pmcStopUapsd(hHal);
4064 sme_ReleaseGlobalLock( &pMac->sme );
4065 }
4066
4067 return (status);
4068}
4069
4070/* ---------------------------------------------------------------------------
4071 \fn sme_RequestStandby
4072 \brief Request that the device be put in standby. It is HDD's responsibility
4073 to bring the chip to full power and do a disassoc before calling
4074 this API.
4075 \param hHal - The handle returned by macOpen.
4076 \param - callbackRoutine Callback routine invoked in case of success/failure
4077 \return eHalStatus
4078 eHAL_STATUS_SUCCESS - device is in Standby mode
4079 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4080 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4081 ---------------------------------------------------------------------------*/
4082eHalStatus sme_RequestStandby (
4083 tHalHandle hHal,
4084 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4085 void *callbackContext)
4086{
4087 eHalStatus status = eHAL_STATUS_FAILURE;
4088 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4089
Katya Nigambcb705f2013-12-26 14:26:22 +05304090 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004091 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304092 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 status = sme_AcquireGlobalLock( &pMac->sme );
4094 if ( HAL_STATUS_SUCCESS( status ) )
4095 {
4096 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4097 sme_ReleaseGlobalLock( &pMac->sme );
4098 }
4099
4100 return (status);
4101}
4102
4103/* ---------------------------------------------------------------------------
4104 \fn sme_RegisterPowerSaveCheck
4105 \brief Register a power save check routine that is called whenever
4106 the device is about to enter one of the power save modes.
4107 \param hHal - The handle returned by macOpen.
4108 \param checkRoutine - Power save check routine to be registered
4109 \return eHalStatus
4110 eHAL_STATUS_SUCCESS - successfully registered
4111 eHAL_STATUS_FAILURE - not successfully registered
4112 ---------------------------------------------------------------------------*/
4113eHalStatus sme_RegisterPowerSaveCheck (
4114 tHalHandle hHal,
4115 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4116{
4117 eHalStatus status = eHAL_STATUS_FAILURE;
4118 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4119
4120 status = sme_AcquireGlobalLock( &pMac->sme );
4121 if ( HAL_STATUS_SUCCESS( status ) )
4122 {
4123 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4124 sme_ReleaseGlobalLock( &pMac->sme );
4125 }
4126
4127 return (status);
4128}
4129
4130/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304131 \fn sme_Register11dScanDoneCallback
4132 \brief Register a routine of type csrScanCompleteCallback which is
4133 called whenever an 11d scan is done
4134 \param hHal - The handle returned by macOpen.
4135 \param callback - 11d scan complete routine to be registered
4136 \return eHalStatus
4137 ---------------------------------------------------------------------------*/
4138eHalStatus sme_Register11dScanDoneCallback (
4139 tHalHandle hHal,
4140 csrScanCompleteCallback callback)
4141{
4142 eHalStatus status = eHAL_STATUS_SUCCESS;
4143 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4144
4145 pMac->scan.callback11dScanDone = callback;
4146
4147 return (status);
4148}
4149
4150/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 \fn sme_DeregisterPowerSaveCheck
4152 \brief Deregister a power save check routine
4153 \param hHal - The handle returned by macOpen.
4154 \param checkRoutine - Power save check routine to be deregistered
4155 \return eHalStatus
4156 eHAL_STATUS_SUCCESS - successfully deregistered
4157 eHAL_STATUS_FAILURE - not successfully deregistered
4158 ---------------------------------------------------------------------------*/
4159eHalStatus sme_DeregisterPowerSaveCheck (
4160 tHalHandle hHal,
4161 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4162{
4163 eHalStatus status = eHAL_STATUS_FAILURE;
4164 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4165
4166 status = sme_AcquireGlobalLock( &pMac->sme );
4167 if ( HAL_STATUS_SUCCESS( status ) )
4168 {
4169 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4170 sme_ReleaseGlobalLock( &pMac->sme );
4171 }
4172
4173 return (status);
4174}
4175
4176/* ---------------------------------------------------------------------------
4177 \fn sme_RegisterDeviceStateUpdateInd
4178 \brief Register a callback routine that is called whenever
4179 the device enters a new device state (Full Power, BMPS, UAPSD)
4180 \param hHal - The handle returned by macOpen.
4181 \param callbackRoutine - Callback routine to be registered
4182 \param callbackContext - Cookie to be passed back during callback
4183 \return eHalStatus
4184 eHAL_STATUS_SUCCESS - successfully registered
4185 eHAL_STATUS_FAILURE - not successfully registered
4186 ---------------------------------------------------------------------------*/
4187eHalStatus sme_RegisterDeviceStateUpdateInd (
4188 tHalHandle hHal,
4189 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4190 void *callbackContext)
4191{
4192 eHalStatus status = eHAL_STATUS_FAILURE;
4193 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4194
4195 status = sme_AcquireGlobalLock( &pMac->sme );
4196 if ( HAL_STATUS_SUCCESS( status ) )
4197 {
4198 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4199 sme_ReleaseGlobalLock( &pMac->sme );
4200 }
4201
4202 return (status);
4203}
4204
4205/* ---------------------------------------------------------------------------
4206 \fn sme_DeregisterDeviceStateUpdateInd
4207 \brief Deregister a routine that was registered for device state changes
4208 \param hHal - The handle returned by macOpen.
4209 \param callbackRoutine - Callback routine to be deregistered
4210 \return eHalStatus
4211 eHAL_STATUS_SUCCESS - successfully deregistered
4212 eHAL_STATUS_FAILURE - not successfully deregistered
4213 ---------------------------------------------------------------------------*/
4214eHalStatus sme_DeregisterDeviceStateUpdateInd (
4215 tHalHandle hHal,
4216 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4217{
4218 eHalStatus status = eHAL_STATUS_FAILURE;
4219 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4220
4221 status = sme_AcquireGlobalLock( &pMac->sme );
4222 if ( HAL_STATUS_SUCCESS( status ) )
4223 {
4224 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4225 sme_ReleaseGlobalLock( &pMac->sme );
4226 }
4227
4228 return (status);
4229}
4230
4231/* ---------------------------------------------------------------------------
4232 \fn sme_WowlAddBcastPattern
4233 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4234 do a pattern match on these patterns when Wowl is enabled during BMPS
4235 mode. Note that Firmware performs the pattern matching only on
4236 broadcast frames and while Libra is in BMPS mode.
4237 \param hHal - The handle returned by macOpen.
4238 \param pattern - Pattern to be added
4239 \return eHalStatus
4240 eHAL_STATUS_FAILURE Cannot add pattern
4241 eHAL_STATUS_SUCCESS Request accepted.
4242 ---------------------------------------------------------------------------*/
4243eHalStatus sme_WowlAddBcastPattern (
4244 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004245 tpSirWowlAddBcastPtrn pattern,
4246 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004247{
4248 eHalStatus status = eHAL_STATUS_FAILURE;
4249 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304250 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004251 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 status = sme_AcquireGlobalLock( &pMac->sme );
4253 if ( HAL_STATUS_SUCCESS( status ) )
4254 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004255 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004256 sme_ReleaseGlobalLock( &pMac->sme );
4257 }
4258
4259 return (status);
4260}
4261
4262/* ---------------------------------------------------------------------------
4263 \fn sme_WowlDelBcastPattern
4264 \brief Delete a pattern that was added for Pattern Byte Matching.
4265 \param hHal - The handle returned by macOpen.
4266 \param pattern - Pattern to be deleted
4267 \return eHalStatus
4268 eHAL_STATUS_FAILURE Cannot delete pattern
4269 eHAL_STATUS_SUCCESS Request accepted.
4270 ---------------------------------------------------------------------------*/
4271eHalStatus sme_WowlDelBcastPattern (
4272 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004273 tpSirWowlDelBcastPtrn pattern,
4274 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004275{
4276 eHalStatus status = eHAL_STATUS_FAILURE;
4277 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304278 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004279 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 status = sme_AcquireGlobalLock( &pMac->sme );
4281 if ( HAL_STATUS_SUCCESS( status ) )
4282 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004283 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 sme_ReleaseGlobalLock( &pMac->sme );
4285 }
4286
4287 return (status);
4288}
4289
4290/* ---------------------------------------------------------------------------
4291 \fn sme_EnterWowl
4292 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4293 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4294 SME will will cache the information that WOWL has been enabled and
4295 attempt to put the device in BMPS. On entry into BMPS, SME will
4296 enable the WOWL mode.
4297 Note 1: If we exit BMPS mode (someone requests full power), we
4298 will NOT resume WOWL when we go back to BMPS again. Request for full
4299 power (while in WOWL mode) means disable WOWL and go to full power.
4300 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4301 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4302 are required. Currently there is no requirement or use case to support
4303 UAPSD and WOWL at the same time.
4304
4305 \param hHal - The handle returned by macOpen.
4306 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4307 Used for success/failure notification by SME
4308 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4309 at the time of callback.
4310 \param wakeReasonIndCB - Callback routine provided by HDD.
4311 Used for Wake Reason Indication by SME
4312 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4313 at the time of callback.
4314 \return eHalStatus
4315 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4316 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4317 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4318 BMPS mode is entered.
4319 ---------------------------------------------------------------------------*/
4320eHalStatus sme_EnterWowl (
4321 tHalHandle hHal,
4322 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4323 void *enterWowlCallbackContext,
4324#ifdef WLAN_WAKEUP_EVENTS
4325 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4326 void *wakeIndicationCBContext,
4327#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004328 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004329{
4330 eHalStatus status = eHAL_STATUS_FAILURE;
4331 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304332 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004333 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 status = sme_AcquireGlobalLock( &pMac->sme );
4335 if ( HAL_STATUS_SUCCESS( status ) )
4336 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004337 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004338#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004339 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004340#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004341 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004342 sme_ReleaseGlobalLock( &pMac->sme );
4343 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 return (status);
4345}
4346/* ---------------------------------------------------------------------------
4347 \fn sme_ExitWowl
4348 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4349 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4350 mode.
4351 \param hHal - The handle returned by macOpen.
4352 \return eHalStatus
4353 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4354 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4355 ---------------------------------------------------------------------------*/
4356eHalStatus sme_ExitWowl (tHalHandle hHal)
4357{
4358 eHalStatus status = eHAL_STATUS_FAILURE;
4359 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304360 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004361 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004362 status = sme_AcquireGlobalLock( &pMac->sme );
4363 if ( HAL_STATUS_SUCCESS( status ) )
4364 {
4365 status = pmcExitWowl (hHal);
4366 sme_ReleaseGlobalLock( &pMac->sme );
4367 }
4368
4369 return (status);
4370}
4371
4372/* ---------------------------------------------------------------------------
4373
4374 \fn sme_RoamSetKey
4375
4376 \brief To set encryption key. This function should be called only when connected
4377 This is an asynchronous API.
4378
4379 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4380
4381 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4382
4383 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4384
4385 FAILURE or RESOURCES The API finished and failed.
4386
4387 -------------------------------------------------------------------------------*/
4388eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4389{
4390 eHalStatus status = eHAL_STATUS_FAILURE;
4391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4392 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004393 tANI_U32 i;
4394 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004395
Katya Nigambcb705f2013-12-26 14:26:22 +05304396 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004397 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004398 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4399 {
4400 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4401 return eHAL_STATUS_FAILURE;
4402 }
4403
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 status = sme_AcquireGlobalLock( &pMac->sme );
4405 if ( HAL_STATUS_SUCCESS( status ) )
4406 {
4407 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4408 if(pRoamId)
4409 {
4410 *pRoamId = roamId;
4411 }
4412
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004413 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004414
4415 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004416 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004417
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004418 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004419
4420 pSession = CSR_GET_SESSION(pMac, sessionId);
4421
Jeff Johnson32d95a32012-09-10 13:15:23 -07004422 if(!pSession)
4423 {
4424 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004425 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004426 return eHAL_STATUS_FAILURE;
4427 }
4428
Jeff Johnson295189b2012-06-20 16:38:30 -07004429 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4430 {
4431 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4432 {
4433 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4434 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4435 {
4436 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4437 }
4438 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4439 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4440 {
4441 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4442 }
4443 }
4444 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004445
4446 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4447 sme_ReleaseGlobalLock( &pMac->sme );
4448 }
4449
4450 return (status);
4451}
4452
4453
4454/* ---------------------------------------------------------------------------
4455
4456 \fn sme_RoamRemoveKey
4457
4458 \brief To set encryption key. This is an asynchronous API.
4459
4460 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4461
4462 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4463
4464 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4465
4466 FAILURE or RESOURCES The API finished and failed.
4467
4468 -------------------------------------------------------------------------------*/
4469eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4470 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4471{
4472 eHalStatus status = eHAL_STATUS_FAILURE;
4473 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4474 tANI_U32 roamId;
4475
Katya Nigambcb705f2013-12-26 14:26:22 +05304476 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004477 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 status = sme_AcquireGlobalLock( &pMac->sme );
4479 if ( HAL_STATUS_SUCCESS( status ) )
4480 {
4481 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4482 if(pRoamId)
4483 {
4484 *pRoamId = roamId;
4485 }
4486 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4487 sme_ReleaseGlobalLock( &pMac->sme );
4488 }
4489
4490 return (status);
4491}
4492
4493/* ---------------------------------------------------------------------------
4494 \fn sme_GetRssi
4495 \brief a wrapper function that client calls to register a callback to get RSSI
4496
4497 \param callback - SME sends back the requested stats using the callback
4498 \param staId - The station ID for which the stats is requested for
4499 \param pContext - user context to be passed back along with the callback
4500 \param pVosContext - vos context
4501 \return eHalStatus
4502 ---------------------------------------------------------------------------*/
4503eHalStatus sme_GetRssi(tHalHandle hHal,
4504 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004505 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 void *pContext, void* pVosContext)
4507{
4508 eHalStatus status = eHAL_STATUS_FAILURE;
4509 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4510
4511 status = sme_AcquireGlobalLock( &pMac->sme );
4512 if ( HAL_STATUS_SUCCESS( status ) )
4513 {
4514 status = csrGetRssi( pMac, callback,
4515 staId, bssId, pContext, pVosContext);
4516 sme_ReleaseGlobalLock( &pMac->sme );
4517 }
4518 return (status);
4519}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304520
4521/* ---------------------------------------------------------------------------
4522 \fn sme_GetSnr
4523 \brief a wrapper function that client calls to register a callback to
4524 get SNR
4525
4526 \param callback - SME sends back the requested stats using the callback
4527 \param staId - The station ID for which the stats is requested for
4528 \param pContext - user context to be passed back along with the callback
4529 \param pVosContext - vos context
4530 \return eHalStatus
4531 ---------------------------------------------------------------------------*/
4532eHalStatus sme_GetSnr(tHalHandle hHal,
4533 tCsrSnrCallback callback,
4534 tANI_U8 staId, tCsrBssid bssId,
4535 void *pContext)
4536{
4537 eHalStatus status = eHAL_STATUS_FAILURE;
4538 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4539
4540 status = sme_AcquireGlobalLock( &pMac->sme );
4541 if ( HAL_STATUS_SUCCESS( status ) )
4542 {
4543 status = csrGetSnr(pMac, callback,
4544 staId, bssId, pContext);
4545 sme_ReleaseGlobalLock( &pMac->sme );
4546 }
4547 return status;
4548}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004549#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4550/* ---------------------------------------------------------------------------
4551 \fn sme_GetRoamRssi
4552 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4553
4554 \param callback - SME sends back the requested stats using the callback
4555 \param staId - The station ID for which the stats is requested for
4556 \param pContext - user context to be passed back along with the callback
4557 \param pVosContext - vos context
4558 \return eHalStatus
4559 ---------------------------------------------------------------------------*/
4560eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4561 tCsrRssiCallback callback,
4562 tANI_U8 staId, tCsrBssid bssId,
4563 void *pContext, void* pVosContext)
4564{
4565 eHalStatus status = eHAL_STATUS_FAILURE;
4566 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4567
4568 status = sme_AcquireGlobalLock( &pMac->sme );
4569 if ( HAL_STATUS_SUCCESS( status ) )
4570 {
4571 status = csrGetRoamRssi( pMac, callback,
4572 staId, bssId, pContext, pVosContext);
4573 sme_ReleaseGlobalLock( &pMac->sme );
4574 }
4575 return (status);
4576}
4577#endif
4578
Jeff Johnson295189b2012-06-20 16:38:30 -07004579
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004580#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4581/* ---------------------------------------------------------------------------
4582 \fn sme_GetTsmStats
4583 \brief a wrapper function that client calls to register a callback to get TSM Stats
4584
4585 \param callback - SME sends back the requested stats using the callback
4586 \param staId - The station ID for which the stats is requested for
4587 \param pContext - user context to be passed back along with the callback
4588 \param pVosContext - vos context
4589 \return eHalStatus
4590 ---------------------------------------------------------------------------*/
4591eHalStatus sme_GetTsmStats(tHalHandle hHal,
4592 tCsrTsmStatsCallback callback,
4593 tANI_U8 staId, tCsrBssid bssId,
4594 void *pContext, void* pVosContext, tANI_U8 tid)
4595{
4596 eHalStatus status = eHAL_STATUS_FAILURE;
4597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4598
4599 status = sme_AcquireGlobalLock( &pMac->sme );
4600 if ( HAL_STATUS_SUCCESS( status ) )
4601 {
4602 status = csrGetTsmStats( pMac, callback,
4603 staId, bssId, pContext, pVosContext, tid);
4604 sme_ReleaseGlobalLock( &pMac->sme );
4605 }
4606 return (status);
4607}
4608#endif
4609
4610
Jeff Johnson295189b2012-06-20 16:38:30 -07004611/* ---------------------------------------------------------------------------
4612 \fn sme_GetStatistics
4613 \brief a wrapper function that client calls to register a callback to get
4614 different PHY level statistics from CSR.
4615
4616 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4617 \param statsMask - The different category/categories of stats requester is looking for
4618 \param callback - SME sends back the requested stats using the callback
4619 \param periodicity - If requester needs periodic update in millisec, 0 means
4620 it's an one time request
4621 \param cache - If requester is happy with cached stats
4622 \param staId - The station ID for which the stats is requested for
4623 \param pContext - user context to be passed back along with the callback
4624 \return eHalStatus
4625 ---------------------------------------------------------------------------*/
4626eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4627 tANI_U32 statsMask,
4628 tCsrStatsCallback callback,
4629 tANI_U32 periodicity, tANI_BOOLEAN cache,
4630 tANI_U8 staId, void *pContext)
4631{
4632 eHalStatus status = eHAL_STATUS_FAILURE;
4633 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4634
Katya Nigambcb705f2013-12-26 14:26:22 +05304635 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004636 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004637 status = sme_AcquireGlobalLock( &pMac->sme );
4638 if ( HAL_STATUS_SUCCESS( status ) )
4639 {
4640 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4641 periodicity, cache, staId, pContext);
4642 sme_ReleaseGlobalLock( &pMac->sme );
4643 }
4644
4645 return (status);
4646
4647}
4648
4649/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304650 \fn smeGetTLSTAState
4651 \helper function to get the TL STA State whenever the function is called.
4652
4653 \param staId - The staID to be passed to the TL
4654 to get the relevant TL STA State
4655 \return the state as tANI_U16
4656 ---------------------------------------------------------------------------*/
4657tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4658{
4659 tANI_U16 tlSTAState = TL_INIT_STATE;
4660 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4661 eHalStatus status = eHAL_STATUS_FAILURE;
4662
4663 status = sme_AcquireGlobalLock( &pMac->sme );
4664 if ( HAL_STATUS_SUCCESS( status ) )
4665 {
4666 tlSTAState = csrGetTLSTAState( pMac, staId);
4667 sme_ReleaseGlobalLock( &pMac->sme );
4668 }
4669
4670 return tlSTAState;
4671}
4672
4673/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004674
4675 \fn sme_GetCountryCode
4676
4677 \brief To return the current country code. If no country code is applied, default country code is
4678 used to fill the buffer.
4679 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4680 This is a synchronous API.
4681
4682 \param pBuf - pointer to a caller allocated buffer for returned country code.
4683
4684 \param pbLen For input, this parameter indicates how big is the buffer.
4685 Upon return, this parameter has the number of bytes for country. If pBuf
4686 doesn't have enough space, this function returns
4687 fail status and this parameter contains the number that is needed.
4688
4689 \return eHalStatus SUCCESS.
4690
4691 FAILURE or RESOURCES The API finished and failed.
4692
4693 -------------------------------------------------------------------------------*/
4694eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4695{
4696 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4697
Katya Nigambcb705f2013-12-26 14:26:22 +05304698 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004699 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4700
Jeff Johnson295189b2012-06-20 16:38:30 -07004701 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4702}
4703
4704
4705/* ---------------------------------------------------------------------------
4706
4707 \fn sme_SetCountryCode
4708
4709 \brief To change the current/default country code.
4710 If 11d supported is turned off, an error is return.
4711 This is a synchronous API.
4712
4713 \param pCountry - pointer to a caller allocated buffer for the country code.
4714
4715 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4716 whether a reset is required.
4717
4718 \return eHalStatus SUCCESS.
4719
4720 FAILURE or RESOURCES The API finished and failed.
4721
4722 -------------------------------------------------------------------------------*/
4723eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4724{
4725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4726
Katya Nigambcb705f2013-12-26 14:26:22 +05304727 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004728 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004729 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4730}
4731
4732
4733/* ---------------------------------------------------------------------------
4734 \fn sme_ResetCountryCodeInformation
4735 \brief this function is to reset the country code current being used back to EEPROM default
4736 this includes channel list and power setting. This is a synchronous API.
4737 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4738 a restart is needed to apply the change
4739 \return eHalStatus
4740 -------------------------------------------------------------------------------*/
4741eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4742{
4743 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4744
4745 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4746}
4747
4748
4749/* ---------------------------------------------------------------------------
4750 \fn sme_GetSupportedCountryCode
4751 \brief this function is to get a list of the country code current being supported
4752 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4753 this has the country code list. 3 bytes for each country code. This may be NULL if
4754 caller wants to know the needed byte count.
4755 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4756 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4757 \return eHalStatus
4758 -------------------------------------------------------------------------------*/
4759eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4760{
4761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4762
4763 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4764}
4765
4766
4767/* ---------------------------------------------------------------------------
4768 \fn sme_GetCurrentRegulatoryDomain
4769 \brief this function is to get the current regulatory domain. This is a synchronous API.
4770 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4771 SME. The function fails if 11d support is turned off.
4772 \param pDomain - Caller allocated buffer to return the current domain.
4773 \return eHalStatus SUCCESS.
4774
4775 FAILURE or RESOURCES The API finished and failed.
4776 -------------------------------------------------------------------------------*/
4777eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4778{
4779 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4780 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4781
4782 if( pDomain )
4783 {
4784 if( csrIs11dSupported( pMac ) )
4785 {
4786 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4787 status = eHAL_STATUS_SUCCESS;
4788 }
4789 else
4790 {
4791 status = eHAL_STATUS_FAILURE;
4792 }
4793 }
4794
4795 return ( status );
4796}
4797
4798
4799/* ---------------------------------------------------------------------------
4800 \fn sme_SetRegulatoryDomain
4801 \brief this function is to set the current regulatory domain.
4802 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4803 SME. This is a synchronous API.
4804 \param domainId - indicate the domain (defined in the driver) needs to set to.
4805 See v_REGDOMAIN_t for definition
4806 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4807 a restart is needed to apply the change
4808 \return eHalStatus
4809 -------------------------------------------------------------------------------*/
4810eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4811{
4812 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4813
4814 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4815}
4816
4817
4818/* ---------------------------------------------------------------------------
4819
4820 \fn sme_GetRegulatoryDomainForCountry
4821
4822 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4823
4824 \param pCountry - pointer to a caller allocated buffer for input country code.
4825
4826 \param pDomainId Upon successful return, it is the domain that country belongs to.
4827 If it is NULL, returning success means that the country code is known.
4828
4829 \return eHalStatus SUCCESS.
4830
4831 FAILURE or RESOURCES The API finished and failed.
4832
4833 -------------------------------------------------------------------------------*/
4834eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4835{
4836 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4837
Kiet Lam6c583332013-10-14 05:37:09 +05304838 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4839 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004840}
4841
4842
4843
4844
4845/* ---------------------------------------------------------------------------
4846
4847 \fn sme_GetSupportedRegulatoryDomains
4848
4849 \brief To return a list of supported regulatory domains. This is a synchronous API.
4850
4851 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4852
4853 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4854 Upon return, this parameter has the number for supported domains. If pDomains
4855 doesn't have enough space for all the supported domains, this function returns
4856 fail status and this parameter contains the number that is needed.
4857
4858 \return eHalStatus SUCCESS.
4859
4860 FAILURE or RESOURCES The API finished and failed.
4861
4862 -------------------------------------------------------------------------------*/
4863eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4864{
4865 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4866
4867 //We support all domains for now
4868 if( pNumDomains )
4869 {
4870 if( NUM_REG_DOMAINS <= *pNumDomains )
4871 {
4872 status = eHAL_STATUS_SUCCESS;
4873 }
4874 *pNumDomains = NUM_REG_DOMAINS;
4875 }
4876 if( HAL_STATUS_SUCCESS( status ) )
4877 {
4878 if( pDomains )
4879 {
4880 pDomains[0] = REGDOMAIN_FCC;
4881 pDomains[1] = REGDOMAIN_ETSI;
4882 pDomains[2] = REGDOMAIN_JAPAN;
4883 pDomains[3] = REGDOMAIN_WORLD;
4884 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4885 pDomains[5] = REGDOMAIN_APAC;
4886 pDomains[6] = REGDOMAIN_KOREA;
4887 pDomains[7] = REGDOMAIN_HI_5GHZ;
4888 pDomains[8] = REGDOMAIN_NO_5GHZ;
4889 }
4890 else
4891 {
4892 status = eHAL_STATUS_INVALID_PARAMETER;
4893 }
4894 }
4895
4896 return ( status );
4897}
4898
4899
4900//some support functions
4901tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4902{
4903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4904
4905 return ( csrIs11dSupported( pMac ) );
4906}
4907
4908
4909tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4910{
4911 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4912
4913 return ( csrIs11hSupported( pMac ) );
4914}
4915
4916
4917tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4918{
4919 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4920
4921 return ( csrIsWmmSupported( pMac ) );
4922}
4923
4924//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4925eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4926{
4927 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4928
4929 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4930}
4931
4932/* ---------------------------------------------------------------------------
4933
4934 \fn sme_ChangeCountryCode
4935
4936 \brief Change Country code from upperlayer during WLAN driver operation.
4937 This is a synchronous API.
4938
4939 \param hHal - The handle returned by macOpen.
4940
4941 \param pCountry New Country Code String
4942
Abhishek Singha306a442013-11-07 18:39:01 +05304943 \param sendRegHint If we want to send reg hint to nl80211
4944
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 \return eHalStatus SUCCESS.
4946
4947 FAILURE or RESOURCES The API finished and failed.
4948
4949 -------------------------------------------------------------------------------*/
4950eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4951 tSmeChangeCountryCallback callback,
4952 tANI_U8 *pCountry,
4953 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304954 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05304955 tAniBool countryFromUserSpace,
4956 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07004957{
4958 eHalStatus status = eHAL_STATUS_FAILURE;
4959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4960 vos_msg_t msg;
4961 tAniChangeCountryCodeReq *pMsg;
4962
Katya Nigambcb705f2013-12-26 14:26:22 +05304963 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004964 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004965 status = sme_AcquireGlobalLock( &pMac->sme );
4966 if ( HAL_STATUS_SUCCESS( status ) )
4967 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004968 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08004969
4970 if ((csrGetInfraSessionId(pMac) != -1) &&
4971 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
4972 {
4973
4974 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
4975
4976 sme_ReleaseGlobalLock( &pMac->sme );
4977 status = eHAL_STATUS_FAILURE;
4978 return status;
4979 }
4980
Kiet Lam64c1b492013-07-12 13:56:44 +05304981 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
4982 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07004983 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004984 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004985 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05304986 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004987 }
4988
4989 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4990 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05304991 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304992 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05304993 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07004994 pMsg->changeCCCallback = callback;
4995 pMsg->pDevContext = pContext;
4996 pMsg->pVosContext = pVosContext;
4997
4998 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4999 msg.bodyptr = pMsg;
5000 msg.reserved = 0;
5001
5002 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5003 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005004 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305005 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005006 status = eHAL_STATUS_FAILURE;
5007 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005008 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005009 sme_ReleaseGlobalLock( &pMac->sme );
5010 }
5011
5012 return (status);
5013}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005014
5015/*--------------------------------------------------------------------------
5016
5017 \fn sme_GenericChangeCountryCode
5018
5019 \brief Change Country code from upperlayer during WLAN driver operation.
5020 This is a synchronous API.
5021
5022 \param hHal - The handle returned by macOpen.
5023
5024 \param pCountry New Country Code String
5025
5026 \param reg_domain regulatory domain
5027
5028 \return eHalStatus SUCCESS.
5029
5030 FAILURE or RESOURCES The API finished and failed.
5031
5032-----------------------------------------------------------------------------*/
5033eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5034 tANI_U8 *pCountry,
5035 v_REGDOMAIN_t reg_domain)
5036{
5037 eHalStatus status = eHAL_STATUS_FAILURE;
5038 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5039 vos_msg_t msg;
5040 tAniGenericChangeCountryCodeReq *pMsg;
5041
Kiet Lamcffc5862013-10-30 16:28:45 +05305042 if (NULL == pMac)
5043 {
5044 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5045 "%s: pMac is null", __func__);
5046 return status;
5047 }
5048
Amar Singhal0d15bd52013-10-12 23:13:13 -07005049 status = sme_AcquireGlobalLock( &pMac->sme );
5050 if ( HAL_STATUS_SUCCESS( status ) )
5051 {
5052 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305053 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5054 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005055 {
5056 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5057 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305058 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005059 }
5060
5061 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5062 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005063 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005064 pMsg->domain_index = reg_domain;
5065
5066 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5067 msg.bodyptr = pMsg;
5068 msg.reserved = 0;
5069
5070 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5071 {
5072 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305073 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005074 status = eHAL_STATUS_FAILURE;
5075 }
5076 smsLog(pMac, LOG1, FL(" returned"));
5077 sme_ReleaseGlobalLock( &pMac->sme );
5078 }
5079
5080 return (status);
5081}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305082
5083/* ---------------------------------------------------------------------------
5084
5085 \fn sme_InitChannels
5086
5087 \brief Used to initialize CSR channel lists while driver loading
5088
5089 \param hHal - global pMac structure
5090
5091 \return eHalStatus SUCCESS.
5092
5093 FAILURE or RESOURCES The API finished and failed.
5094
5095 -------------------------------------------------------------------------------*/
5096eHalStatus sme_InitChannels(tHalHandle hHal)
5097{
5098 eHalStatus status = eHAL_STATUS_FAILURE;
5099 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5100
5101 if (NULL == pMac)
5102 {
5103 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5104 "%s: pMac is null", __func__);
5105 return status;
5106 }
5107
5108 status = sme_AcquireGlobalLock(&pMac->sme);
5109 if (HAL_STATUS_SUCCESS(status))
5110 {
5111 status = csrInitChannels(pMac);
5112 sme_ReleaseGlobalLock(&pMac->sme);
5113 }
5114 return status;
5115}
5116
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305117/* ---------------------------------------------------------------------------
5118
5119 \fn sme_DHCPStartInd
5120
5121 \brief API to signal the FW about the DHCP Start event.
5122
5123 \param hHal - HAL handle for device.
5124
5125 \param device_mode - mode(AP,SAP etc) of the device.
5126
5127 \param macAddr - MAC address of the device.
5128
5129 \return eHalStatus SUCCESS.
5130
5131 FAILURE or RESOURCES The API finished and failed.
5132 --------------------------------------------------------------------------*/
5133eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5134 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305135 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305136{
5137 eHalStatus status;
5138 VOS_STATUS vosStatus;
5139 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5140 vos_msg_t vosMessage;
5141 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305142 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305143
5144 status = sme_AcquireGlobalLock(&pMac->sme);
5145 if ( eHAL_STATUS_SUCCESS == status)
5146 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305147 pSession = CSR_GET_SESSION( pMac, sessionId );
5148
5149 if (!pSession)
5150 {
5151 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5152 sme_ReleaseGlobalLock( &pMac->sme );
5153 return eHAL_STATUS_FAILURE;
5154 }
5155
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305156 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5157 if (NULL == pMsg)
5158 {
5159 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5160 "%s: Not able to allocate memory for dhcp start", __func__);
5161 sme_ReleaseGlobalLock( &pMac->sme );
5162 return eHAL_STATUS_FAILURE;
5163 }
5164 pMsg->msgType = WDA_DHCP_START_IND;
5165 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5166 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305167 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5168 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305169 vosMessage.type = WDA_DHCP_START_IND;
5170 vosMessage.bodyptr = pMsg;
5171 vosMessage.reserved = 0;
5172
5173 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5174 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5175 {
5176 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5177 "%s: Post DHCP Start MSG fail", __func__);
5178 vos_mem_free(pMsg);
5179 status = eHAL_STATUS_FAILURE;
5180 }
5181 sme_ReleaseGlobalLock( &pMac->sme );
5182 }
5183 return (status);
5184}
5185/* ---------------------------------------------------------------------------
5186 \fn sme_DHCPStopInd
5187
5188 \brief API to signal the FW about the DHCP complete event.
5189
5190 \param hHal - HAL handle for device.
5191
5192 \param device_mode - mode(AP, SAP etc) of the device.
5193
5194 \param macAddr - MAC address of the device.
5195
5196 \return eHalStatus SUCCESS.
5197 FAILURE or RESOURCES The API finished and failed.
5198 --------------------------------------------------------------------------*/
5199eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5200 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305201 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305202{
5203 eHalStatus status;
5204 VOS_STATUS vosStatus;
5205 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5206 vos_msg_t vosMessage;
5207 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305208 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305209
5210 status = sme_AcquireGlobalLock(&pMac->sme);
5211 if ( eHAL_STATUS_SUCCESS == status)
5212 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305213 pSession = CSR_GET_SESSION( pMac, sessionId );
5214
5215 if (!pSession)
5216 {
5217 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5218 sme_ReleaseGlobalLock( &pMac->sme );
5219 return eHAL_STATUS_FAILURE;
5220 }
5221
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305222 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5223 if (NULL == pMsg)
5224 {
5225 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5226 "%s: Not able to allocate memory for dhcp stop", __func__);
5227 sme_ReleaseGlobalLock( &pMac->sme );
5228 return eHAL_STATUS_FAILURE;
5229 }
5230
5231 pMsg->msgType = WDA_DHCP_STOP_IND;
5232 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5233 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305234 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5235 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305236
5237 vosMessage.type = WDA_DHCP_STOP_IND;
5238 vosMessage.bodyptr = pMsg;
5239 vosMessage.reserved = 0;
5240
5241 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5242 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5243 {
5244 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5245 "%s: Post DHCP Stop MSG fail", __func__);
5246 vos_mem_free(pMsg);
5247 status = eHAL_STATUS_FAILURE;
5248 }
5249
5250 sme_ReleaseGlobalLock( &pMac->sme );
5251 }
5252 return (status);
5253}
5254
Jeff Johnson295189b2012-06-20 16:38:30 -07005255
5256/* ---------------------------------------------------------------------------
5257 \fn sme_BtcSignalBtEvent
5258 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5259 BT event type and the current operating mode of Libra (full power,
5260 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5261 would be employed.
5262 \param hHal - The handle returned by macOpen.
5263 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5264 Caller owns the memory and is responsible for freeing it.
5265 \return VOS_STATUS
5266 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5267 if BTC execution mode is set to BTC_WLAN_ONLY
5268 or BTC_PTA_ONLY.
5269 VOS_STATUS_SUCCESS BT Event passed to HAL
5270 ---------------------------------------------------------------------------*/
5271VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5272{
5273 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005274
Jeff Johnson295189b2012-06-20 16:38:30 -07005275#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5276 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5277
Katya Nigambcb705f2013-12-26 14:26:22 +05305278 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005279 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005280 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5281 {
5282 status = btcSignalBTEvent (hHal, pBtEvent);
5283 sme_ReleaseGlobalLock( &pMac->sme );
5284 }
5285#endif
5286 return (status);
5287}
5288
5289/* ---------------------------------------------------------------------------
5290 \fn sme_BtcSetConfig
5291 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5292 This function should be invoked only after CFG download has completed.
5293 Calling it after sme_HDDReadyInd is recommended.
5294 \param hHal - The handle returned by macOpen.
5295 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5296 Caller owns the memory and is responsible for freeing it.
5297 \return VOS_STATUS
5298 VOS_STATUS_E_FAILURE Config not passed to HAL.
5299 VOS_STATUS_SUCCESS Config passed to HAL
5300 ---------------------------------------------------------------------------*/
5301VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5302{
5303 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5304#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305306 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005307 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005308 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5309 {
5310 status = btcSetConfig (hHal, pSmeBtcConfig);
5311 sme_ReleaseGlobalLock( &pMac->sme );
5312 }
5313#endif
5314 return (status);
5315}
5316
5317/* ---------------------------------------------------------------------------
5318 \fn sme_BtcGetConfig
5319 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5320 \param hHal - The handle returned by macOpen.
5321 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5322 tSmeBtcConfig. Caller owns the memory and is responsible
5323 for freeing it.
5324 \return VOS_STATUS
5325 VOS_STATUS_E_FAILURE - failure
5326 VOS_STATUS_SUCCESS success
5327 ---------------------------------------------------------------------------*/
5328VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5329{
5330 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5331#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5333
Katya Nigambcb705f2013-12-26 14:26:22 +05305334 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005335 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005336 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5337 {
5338 status = btcGetConfig (hHal, pSmeBtcConfig);
5339 sme_ReleaseGlobalLock( &pMac->sme );
5340 }
5341#endif
5342 return (status);
5343}
5344/* ---------------------------------------------------------------------------
5345 \fn sme_SetCfgPrivacy
5346 \brief API to set configure privacy parameters
5347 \param hHal - The handle returned by macOpen.
5348 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005349 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005350
5351 \return void
5352 ---------------------------------------------------------------------------*/
5353void sme_SetCfgPrivacy( tHalHandle hHal,
5354 tCsrRoamProfile *pProfile,
5355 tANI_BOOLEAN fPrivacy
5356 )
5357{
5358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305359 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005360 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005361 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5362 {
5363 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5364 sme_ReleaseGlobalLock( &pMac->sme );
5365 }
5366}
5367
5368#if defined WLAN_FEATURE_VOWIFI
5369/* ---------------------------------------------------------------------------
5370 \fn sme_NeighborReportRequest
5371 \brief API to request neighbor report.
5372 \param hHal - The handle returned by macOpen.
5373 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5374 tRrmNeighborReq. Caller owns the memory and is responsible
5375 for freeing it.
5376 \return VOS_STATUS
5377 VOS_STATUS_E_FAILURE - failure
5378 VOS_STATUS_SUCCESS success
5379 ---------------------------------------------------------------------------*/
5380VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5381 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5382{
5383 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5384 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305385 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005386 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005387
5388 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5389 {
5390 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5391 sme_ReleaseGlobalLock( &pMac->sme );
5392 }
5393
5394 return (status);
5395}
5396#endif
5397
5398//The following are debug APIs to support direct read/write register/memory
5399//They are placed in SME because HW cannot be access when in LOW_POWER state
5400//AND not connected. The knowledge and synchronization is done in SME
5401
5402//sme_DbgReadRegister
5403//Caller needs to validate the input values
5404VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5405{
5406 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5407 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005408 tPmcPowerState PowerState;
5409 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305410 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005411 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005412
5413 /* 1) To make Quarky work in FTM mode **************************************/
5414
5415 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5416 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005417 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005418 {
5419 return VOS_STATUS_SUCCESS;
5420 }
5421 return VOS_STATUS_E_FAILURE;
5422 }
5423
5424 /* 2) NON FTM mode driver *************************************************/
5425
5426 /* Acquire SME global lock */
5427 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5428 {
5429 return VOS_STATUS_E_FAILURE;
5430 }
5431
5432 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5433 {
5434 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5435 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5436 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005437 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005438 {
5439 status = VOS_STATUS_SUCCESS;
5440 }
5441 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005442 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005443 status = VOS_STATUS_E_FAILURE;
5444 }
5445 }
5446 else
5447 {
5448 status = VOS_STATUS_E_FAILURE;
5449 }
5450 }
5451
5452 /* This is a hack for Qualky/pttWniSocket
5453 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5454 if ( VOS_STATUS_SUCCESS != status )
5455 {
5456 *pRegValue = 0xDEADBEEF;
5457 status = VOS_STATUS_SUCCESS;
5458 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005459
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 /* Release SME global lock */
5461 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005462
Jeff Johnson295189b2012-06-20 16:38:30 -07005463 return (status);
5464}
5465
5466
5467//sme_DbgWriteRegister
5468//Caller needs to validate the input values
5469VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5470{
5471 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5472 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005473 tPmcPowerState PowerState;
5474 tANI_U32 sessionId = 0;
5475
5476 /* 1) To make Quarky work in FTM mode **************************************/
5477
Katya Nigambcb705f2013-12-26 14:26:22 +05305478 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005479 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5481 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005482 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005483 {
5484 return VOS_STATUS_SUCCESS;
5485 }
5486 return VOS_STATUS_E_FAILURE;
5487 }
5488
5489 /* 2) NON FTM mode driver *************************************************/
5490
5491 /* Acquire SME global lock */
5492 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5493 {
5494 return VOS_STATUS_E_FAILURE;
5495 }
5496
5497 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5498 {
5499 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5500 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5501 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005502 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005503 {
5504 status = VOS_STATUS_SUCCESS;
5505 }
5506 else
5507 {
5508 status = VOS_STATUS_E_FAILURE;
5509 }
5510 }
5511 else
5512 {
5513 status = VOS_STATUS_E_FAILURE;
5514 }
5515 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005516
Jeff Johnson295189b2012-06-20 16:38:30 -07005517 /* Release SME global lock */
5518 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005519
Jeff Johnson295189b2012-06-20 16:38:30 -07005520 return (status);
5521}
5522
5523
5524
5525//sme_DbgReadMemory
5526//Caller needs to validate the input values
5527//pBuf caller allocated buffer has the length of nLen
5528VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5529{
5530 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5531 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005532 tPmcPowerState PowerState;
5533 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005534 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5535 tANI_U32 arg1 = memAddr;
5536 tANI_U32 arg2 = nLen/4;
5537 tANI_U32 arg3 = 4;
5538 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005539 /* 1) To make Quarky work in FTM mode **************************************/
5540
Katya Nigambcb705f2013-12-26 14:26:22 +05305541 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005542 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005543 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5544 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005545 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005546 {
5547 return VOS_STATUS_SUCCESS;
5548 }
5549 return VOS_STATUS_E_FAILURE;
5550 }
5551
5552 /* 2) NON FTM mode driver *************************************************/
5553
5554 /* Acquire SME global lock */
5555 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5556 {
5557 return VOS_STATUS_E_FAILURE;
5558 }
5559
5560 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5561 {
5562 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5563 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5564 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005565 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005566 {
5567 status = VOS_STATUS_SUCCESS;
5568 }
5569 else
5570 {
5571 status = VOS_STATUS_E_FAILURE;
5572 }
5573 }
5574 else
5575 {
5576 status = VOS_STATUS_E_FAILURE;
5577 }
5578 }
5579
5580 /* This is a hack for Qualky/pttWniSocket
5581 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5582 if (VOS_STATUS_SUCCESS != status)
5583 {
5584 vos_mem_set(pBuf, nLen, 0xCD);
5585 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005586 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005587 }
5588
5589 /* Release SME lock */
5590 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005591
Jeff Johnson295189b2012-06-20 16:38:30 -07005592 return (status);
5593}
5594
5595
5596//sme_DbgWriteMemory
5597//Caller needs to validate the input values
5598VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5599{
5600 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5601 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005602 tPmcPowerState PowerState;
5603 tANI_U32 sessionId = 0;
5604
5605 /* 1) To make Quarky work in FTM mode **************************************/
5606
Katya Nigambcb705f2013-12-26 14:26:22 +05305607 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005608 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005609 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5610 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005611 {
5612 return VOS_STATUS_SUCCESS;
5613 }
5614 return VOS_STATUS_E_FAILURE;
5615 }
5616
5617 /* 2) NON FTM mode driver *************************************************/
5618
5619 /* Acquire SME global lock */
5620 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5621 {
5622 return VOS_STATUS_E_FAILURE;
5623 }
5624
5625 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5626 {
5627 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5628 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5629 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005630 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005631 {
5632 status = VOS_STATUS_SUCCESS;
5633 }
5634 else
5635 {
5636 status = VOS_STATUS_E_FAILURE;
5637 }
5638 }
5639 else
5640 {
5641 status = VOS_STATUS_E_FAILURE;
5642 }
5643 }
5644
5645 /* Release Global lock */
5646 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005647
Jeff Johnson295189b2012-06-20 16:38:30 -07005648 return (status);
5649}
5650
5651
Katya Nigam70d68332013-09-16 16:49:45 +05305652void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5653{
5654 VOS_TRACE_LEVEL vosDebugLevel;
5655 char logBuffer[LOG_SIZE];
5656 va_list marker;
5657
5658 /* getting proper Debug level */
5659 vosDebugLevel = getVosDebugLevel(loglevel);
5660
5661 /* extracting arguments from pstring */
5662 va_start( marker, pString );
5663 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5664
5665 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5666 va_end( marker );
5667}
5668
5669
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005670void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005671{
5672#ifdef WLAN_DEBUG
5673 // Verify against current log level
5674 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5675 return;
5676 else
5677 {
5678 va_list marker;
5679
5680 va_start( marker, pString ); /* Initialize variable arguments. */
5681
5682 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5683
5684 va_end( marker ); /* Reset variable arguments. */
5685 }
5686#endif
5687}
Jeff Johnson295189b2012-06-20 16:38:30 -07005688
Jeff Johnson295189b2012-06-20 16:38:30 -07005689/* ---------------------------------------------------------------------------
5690 \fn sme_GetWcnssWlanCompiledVersion
5691 \brief This API returns the version of the WCNSS WLAN API with
5692 which the HOST driver was built
5693 \param hHal - The handle returned by macOpen.
5694 \param pVersion - Points to the Version structure to be filled
5695 \return VOS_STATUS
5696 VOS_STATUS_E_INVAL - failure
5697 VOS_STATUS_SUCCESS success
5698 ---------------------------------------------------------------------------*/
5699VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5700 tSirVersionType *pVersion)
5701{
5702 VOS_STATUS status = VOS_STATUS_SUCCESS;
5703 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5704 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5705
5706 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5707 {
5708 if( pVersion != NULL )
5709 {
5710 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5711 }
5712 else
5713 {
5714 status = VOS_STATUS_E_INVAL;
5715 }
5716 sme_ReleaseGlobalLock( &pMac->sme );
5717 }
5718
5719 return (status);
5720}
5721
5722
5723/* ---------------------------------------------------------------------------
5724 \fn sme_GetWcnssWlanReportedVersion
5725 \brief This API returns the version of the WCNSS WLAN API with
5726 which the WCNSS driver reports it was built
5727 \param hHal - The handle returned by macOpen.
5728 \param pVersion - Points to the Version structure to be filled
5729 \return VOS_STATUS
5730 VOS_STATUS_E_INVAL - failure
5731 VOS_STATUS_SUCCESS success
5732 ---------------------------------------------------------------------------*/
5733VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5734 tSirVersionType *pVersion)
5735{
5736 VOS_STATUS status = VOS_STATUS_SUCCESS;
5737 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5738 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5739
5740 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5741 {
5742 if( pVersion != NULL )
5743 {
5744 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5745 }
5746 else
5747 {
5748 status = VOS_STATUS_E_INVAL;
5749 }
5750 sme_ReleaseGlobalLock( &pMac->sme );
5751 }
5752
5753 return (status);
5754}
5755
5756
5757/* ---------------------------------------------------------------------------
5758 \fn sme_GetWcnssSoftwareVersion
5759 \brief This API returns the version string of the WCNSS driver
5760 \param hHal - The handle returned by macOpen.
5761 \param pVersion - Points to the Version string buffer to be filled
5762 \param versionBufferSize - THe size of the Version string buffer
5763 \return VOS_STATUS
5764 VOS_STATUS_E_INVAL - failure
5765 VOS_STATUS_SUCCESS success
5766 ---------------------------------------------------------------------------*/
5767VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5768 tANI_U8 *pVersion,
5769 tANI_U32 versionBufferSize)
5770{
5771 VOS_STATUS status = VOS_STATUS_SUCCESS;
5772 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5773 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5774
5775 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5776 {
5777 if( pVersion != NULL )
5778 {
5779 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5780 versionBufferSize);
5781 }
5782 else
5783 {
5784 status = VOS_STATUS_E_INVAL;
5785 }
5786 sme_ReleaseGlobalLock( &pMac->sme );
5787 }
5788
5789 return (status);
5790}
5791
5792
5793/* ---------------------------------------------------------------------------
5794 \fn sme_GetWcnssHardwareVersion
5795 \brief This API returns the version string of the WCNSS hardware
5796 \param hHal - The handle returned by macOpen.
5797 \param pVersion - Points to the Version string buffer to be filled
5798 \param versionBufferSize - THe size of the Version string buffer
5799 \return VOS_STATUS
5800 VOS_STATUS_E_INVAL - failure
5801 VOS_STATUS_SUCCESS success
5802 ---------------------------------------------------------------------------*/
5803VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5804 tANI_U8 *pVersion,
5805 tANI_U32 versionBufferSize)
5806{
5807 VOS_STATUS status = VOS_STATUS_SUCCESS;
5808 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5809 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5810
5811 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5812 {
5813 if( pVersion != NULL )
5814 {
5815 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5816 versionBufferSize);
5817 }
5818 else
5819 {
5820 status = VOS_STATUS_E_INVAL;
5821 }
5822 sme_ReleaseGlobalLock( &pMac->sme );
5823 }
5824
5825 return (status);
5826}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005827
Jeff Johnson295189b2012-06-20 16:38:30 -07005828
5829#ifdef FEATURE_WLAN_WAPI
5830/* ---------------------------------------------------------------------------
5831 \fn sme_RoamSetBKIDCache
5832 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5833 candidate list.
5834 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5835 it is opened (by calling halOpen).
5836 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5837 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5838 when retruning, this is the number of items put into pBKIDCache
5839 \return eHalStatus - when fail, it usually means the buffer allocated is not
5840 big enough and pNumItems has the number of tBkidCacheInfo.
5841 ---------------------------------------------------------------------------*/
5842eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5843 tANI_U32 numItems )
5844{
5845 eHalStatus status = eHAL_STATUS_FAILURE;
5846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5847
5848 status = sme_AcquireGlobalLock( &pMac->sme );
5849 if ( HAL_STATUS_SUCCESS( status ) )
5850 {
5851 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5852 sme_ReleaseGlobalLock( &pMac->sme );
5853 }
5854
5855 return (status);
5856}
5857
5858/* ---------------------------------------------------------------------------
5859 \fn sme_RoamGetBKIDCache
5860 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5861 BKID cache.
5862 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5863 it is opened (by calling halOpen).
5864 \param pNum - caller allocated memory that has the space of the number of
5865 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5866 in SME cache.
5867 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5868 upon return
5869 \return eHalStatus - when fail, it usually means the buffer allocated is not
5870 big enough.
5871 ---------------------------------------------------------------------------*/
5872eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5873 tBkidCacheInfo *pBkidCache)
5874{
5875 eHalStatus status = eHAL_STATUS_FAILURE;
5876 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5877
5878 status = sme_AcquireGlobalLock( &pMac->sme );
5879 if ( HAL_STATUS_SUCCESS( status ) )
5880 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005881 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005882 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5883 sme_ReleaseGlobalLock( &pMac->sme );
5884 }
5885
5886 return (status);
5887}
5888
5889/* ---------------------------------------------------------------------------
5890 \fn sme_RoamGetNumBKIDCache
5891 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5892 number of BKID cache entries.
5893 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5894 it is opened (by calling halOpen).
5895 \return tANI_U32 - the number of BKID cache entries.
5896 ---------------------------------------------------------------------------*/
5897tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5898{
5899 eHalStatus status = eHAL_STATUS_FAILURE;
5900 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5901 tANI_U32 numBkidCache = 0;
5902
5903 status = sme_AcquireGlobalLock( &pMac->sme );
5904 if ( HAL_STATUS_SUCCESS( status ) )
5905 {
5906 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5907 sme_ReleaseGlobalLock( &pMac->sme );
5908 }
5909
5910 return (numBkidCache);
5911}
5912
5913/* ---------------------------------------------------------------------------
5914 \fn sme_ScanGetBKIDCandidateList
5915 \brief a wrapper function to return the BKID candidate list
5916 \param pBkidList - caller allocated buffer point to an array of
5917 tBkidCandidateInfo
5918 \param pNumItems - pointer to a variable that has the number of
5919 tBkidCandidateInfo allocated when retruning, this is
5920 either the number needed or number of items put into
5921 pPmkidList
5922 \return eHalStatus - when fail, it usually means the buffer allocated is not
5923 big enough and pNumItems
5924 has the number of tBkidCandidateInfo.
5925 \Note: pNumItems is a number of tBkidCandidateInfo,
5926 not sizeof(tBkidCandidateInfo) * something
5927 ---------------------------------------------------------------------------*/
5928eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5929 tBkidCandidateInfo *pBkidList,
5930 tANI_U32 *pNumItems )
5931{
5932 eHalStatus status = eHAL_STATUS_FAILURE;
5933 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5934
5935 status = sme_AcquireGlobalLock( &pMac->sme );
5936 if ( HAL_STATUS_SUCCESS( status ) )
5937 {
5938 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5939 sme_ReleaseGlobalLock( &pMac->sme );
5940 }
5941
5942 return (status);
5943}
5944#endif /* FEATURE_WLAN_WAPI */
5945
Jeff Johnsone7245742012-09-05 17:12:55 -07005946#ifdef FEATURE_OEM_DATA_SUPPORT
5947
5948/*****************************************************************************
5949 OEM DATA related modifications and function additions
5950 *****************************************************************************/
5951
5952/* ---------------------------------------------------------------------------
5953 \fn sme_getOemDataRsp
5954 \brief a wrapper function to obtain the OEM DATA RSP
5955 \param pOemDataRsp - A pointer to the response object
5956 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005957 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07005958 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005959eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07005960 tOemDataRsp **pOemDataRsp)
5961{
5962 eHalStatus status = eHAL_STATUS_SUCCESS;
5963 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5964
5965 do
5966 {
5967 //acquire the lock for the sme object
5968 status = sme_AcquireGlobalLock(&pMac->sme);
5969
5970 if(!HAL_STATUS_SUCCESS(status))
5971 {
5972 break;
5973 }
5974
5975 if(pMac->oemData.pOemDataRsp != NULL)
5976 {
5977 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5978 }
5979 else
5980 {
5981 status = eHAL_STATUS_FAILURE;
5982 }
5983
5984 //release the lock for the sme object
5985 sme_ReleaseGlobalLock( &pMac->sme );
5986
5987 } while(0);
5988
5989 return status;
5990}
5991
5992/* ---------------------------------------------------------------------------
5993 \fn sme_OemDataReq
5994 \brief a wrapper function for OEM DATA REQ
5995 \param sessionId - session id to be used.
5996 \param pOemDataReqId - pointer to an object to get back the request ID
5997 \param callback - a callback function that is called upon finish
5998 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005999 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006000 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006001eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006002 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006003 tOemDataReqConfig *pOemDataReqConfig,
6004 tANI_U32 *pOemDataReqID,
6005 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006006 void *pContext)
6007{
6008 eHalStatus status = eHAL_STATUS_SUCCESS;
6009 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6010
6011 do
6012 {
6013 //acquire the lock for the sme object
6014 status = sme_AcquireGlobalLock(&pMac->sme);
6015 if(HAL_STATUS_SUCCESS(status))
6016 {
6017 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6018
6019 if(pOemDataReqID)
6020 {
6021 *pOemDataReqID = lOemDataReqId;
6022 }
6023 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006024 {
6025 sme_ReleaseGlobalLock( &pMac->sme );
6026 return eHAL_STATUS_FAILURE;
6027 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006028
6029 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6030
6031 //release the lock for the sme object
6032 sme_ReleaseGlobalLock( &pMac->sme );
6033 }
6034 } while(0);
6035
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006036 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006037
6038 return(status);
6039}
6040
6041#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006042
6043/*--------------------------------------------------------------------------
6044
6045 \brief sme_OpenSession() - Open a session for scan/roam operation.
6046
6047 This is a synchronous API.
6048
6049
6050 \param hHal - The handle returned by macOpen.
6051 \param callback - A pointer to the function caller specifies for roam/connect status indication
6052 \param pContext - The context passed with callback
6053 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6054 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6055
6056 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6057
6058 Other status means SME is failed to open the session.
6059 eHAL_STATUS_RESOURCES - no more session available.
6060 \sa
6061
6062 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006063eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6064 void *pContext, tANI_U8 *pSelfMacAddr,
6065 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006066{
6067 eHalStatus status;
6068 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6069
6070 if( NULL == pbSessionId )
6071 {
6072 status = eHAL_STATUS_INVALID_PARAMETER;
6073 }
6074 else
6075 {
6076 status = sme_AcquireGlobalLock( &pMac->sme );
6077 if ( HAL_STATUS_SUCCESS( status ) )
6078 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006079 status = csrRoamOpenSession(pMac, callback, pContext,
6080 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006081
6082 sme_ReleaseGlobalLock( &pMac->sme );
6083 }
6084 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006085 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306086 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006087 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006088
6089 return ( status );
6090}
6091
6092
6093/*--------------------------------------------------------------------------
6094
6095 \brief sme_CloseSession() - Open a session for scan/roam operation.
6096
6097 This is a synchronous API.
6098
6099
6100 \param hHal - The handle returned by macOpen.
6101
6102 \param sessionId - A previous opened session's ID.
6103
6104 \return eHAL_STATUS_SUCCESS - session is closed.
6105
6106 Other status means SME is failed to open the session.
6107 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6108 \sa
6109
6110 --------------------------------------------------------------------------*/
6111eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6112 csrRoamSessionCloseCallback callback, void *pContext)
6113{
6114 eHalStatus status;
6115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6116
Katya Nigambcb705f2013-12-26 14:26:22 +05306117 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006118 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006119 status = sme_AcquireGlobalLock( &pMac->sme );
6120 if ( HAL_STATUS_SUCCESS( status ) )
6121 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006122 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006123 callback, pContext );
6124
6125 sme_ReleaseGlobalLock( &pMac->sme );
6126 }
6127
6128 return ( status );
6129}
6130
Jeff Johnson295189b2012-06-20 16:38:30 -07006131/* ---------------------------------------------------------------------------
6132
6133 \fn sme_RoamUpdateAPWPSIE
6134
6135 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6136 This is an asynchronous API.
6137
6138 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6139
6140 \return eHalStatus – SUCCESS –
6141
6142 FAILURE or RESOURCES – The API finished and failed.
6143
6144 -------------------------------------------------------------------------------*/
6145eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6146{
6147
6148 eHalStatus status = eHAL_STATUS_FAILURE;
6149 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6150
6151 status = sme_AcquireGlobalLock( &pMac->sme );
6152 if ( HAL_STATUS_SUCCESS( status ) )
6153 {
6154
6155 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6156
6157 sme_ReleaseGlobalLock( &pMac->sme );
6158 }
6159
6160 return (status);
6161}
6162/* ---------------------------------------------------------------------------
6163
6164 \fn sme_RoamUpdateAPWPARSNIEs
6165
6166 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6167 This is an asynchronous API.
6168
6169 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6170
6171 \return eHalStatus – SUCCESS –
6172
6173 FAILURE or RESOURCES – The API finished and failed.
6174
6175 -------------------------------------------------------------------------------*/
6176eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6177{
6178
6179 eHalStatus status = eHAL_STATUS_FAILURE;
6180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6181
6182 status = sme_AcquireGlobalLock( &pMac->sme );
6183 if ( HAL_STATUS_SUCCESS( status ) )
6184 {
6185
6186 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6187
6188 sme_ReleaseGlobalLock( &pMac->sme );
6189 }
6190
6191 return (status);
6192}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006193/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006194
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006195 \fn sme_ChangeMCCBeaconInterval
6196
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006197 \brief To update P2P-GO beaconInterval. This function should be called after
6198 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006199 This is an asynchronous API.
6200
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006201 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006202
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006203 \return eHalStatus SUCCESS
6204 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006205 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006206
6207 -------------------------------------------------------------------------------*/
6208eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6209{
6210 eHalStatus status = eHAL_STATUS_FAILURE;
6211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6212
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006213 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006214 status = sme_AcquireGlobalLock( &pMac->sme );
6215 if ( HAL_STATUS_SUCCESS( status ) )
6216 {
6217 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6218 sme_ReleaseGlobalLock( &pMac->sme );
6219 }
6220 return (status);
6221}
Jeff Johnson295189b2012-06-20 16:38:30 -07006222
6223/*-------------------------------------------------------------------------------*
6224
6225 \fn sme_sendBTAmpEvent
6226
6227 \brief to receive the coex priorty request from BT-AMP PAL
6228 and send the BT_AMP link state to HAL
6229
6230 \param btAmpEvent - btAmpEvent
6231
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006232 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006233
6234 FAILURE: API failed
6235
6236-------------------------------------------------------------------------------*/
6237
6238eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6239{
6240 vos_msg_t msg;
6241 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6242 eHalStatus status = eHAL_STATUS_FAILURE;
6243
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006244 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006245 if (NULL == ptrSmeBtAmpEvent)
6246 {
6247 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006248 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006249 return status;
6250 }
6251
6252 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6253 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6254 msg.reserved = 0;
6255 msg.bodyptr = ptrSmeBtAmpEvent;
6256
6257 //status = halFW_SendBTAmpEventMesg(pMac, event);
6258
6259 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6260 {
6261 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006262 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006263 vos_mem_free(ptrSmeBtAmpEvent);
6264 return status;
6265 }
6266
6267 return eHAL_STATUS_SUCCESS;
6268
6269}
6270
6271/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306272 \fn smeIssueFastRoamNeighborAPEvent
6273 \brief API to trigger fast BSS roam independent of RSSI triggers
6274 \param hHal - The handle returned by macOpen.
6275 \param bssid - Pointer to the BSSID to roam to.
6276 \param fastRoamTrig - Trigger to Scan or roam
6277 \return eHalStatus
6278 ---------------------------------------------------------------------------*/
6279eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6280 tANI_U8 *bssid,
6281 tSmeFastRoamTrigger fastRoamTrig)
6282{
6283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6284 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6285 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6286 eHalStatus status = eHAL_STATUS_SUCCESS;
6287
6288 status = sme_AcquireGlobalLock( &pMac->sme );
6289 if ( HAL_STATUS_SUCCESS( status ) )
6290 {
6291 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6292 "%s: invoked", __func__);
6293
6294 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6295 {
6296 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6297 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6298 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6299 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006300 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6301 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306302
6303 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6304 if (VOS_STATUS_SUCCESS != vosStatus)
6305 {
6306 smsLog(pMac, LOGE,
6307 FL("CFG Channel list scan state failed with status %d "),
6308 vosStatus);
6309 }
6310 }
6311 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6312 {
6313 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6314 (void *)bssid, sizeof(tSirMacAddr));
6315 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006316 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6317 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306318
6319 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6320 0,
6321 pMac,
6322 0);
6323
6324 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6325 {
6326 smsLog(pMac,
6327 LOGE,
6328 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6329 vosStatus);
6330 }
6331 }
6332 sme_ReleaseGlobalLock( &pMac->sme );
6333 }
6334 return vosStatus;
6335}
6336/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006337 \fn sme_SetHostOffload
6338 \brief API to set the host offload feature.
6339 \param hHal - The handle returned by macOpen.
6340 \param pRequest - Pointer to the offload request.
6341 \return eHalStatus
6342 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006343eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006344 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006345{
6346 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006347 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006348
Katya Nigambcb705f2013-12-26 14:26:22 +05306349 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006350 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006351 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6352 {
6353#ifdef WLAN_NS_OFFLOAD
6354 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6355 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006356 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006357 }
6358 else
6359#endif //WLAN_NS_OFFLOAD
6360 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006361 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006362 }
6363 sme_ReleaseGlobalLock( &pMac->sme );
6364 }
6365
6366 return (status);
6367}
6368
6369#ifdef WLAN_FEATURE_GTK_OFFLOAD
6370/* ---------------------------------------------------------------------------
6371 \fn sme_SetGTKOffload
6372 \brief API to set GTK offload information.
6373 \param hHal - The handle returned by macOpen.
6374 \param pRequest - Pointer to the GTK offload request.
6375 \return eHalStatus
6376 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006377eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006378 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006379{
6380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6381 eHalStatus status;
6382
Katya Nigambcb705f2013-12-26 14:26:22 +05306383 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006384 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006385 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6386 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006387 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006388 sme_ReleaseGlobalLock( &pMac->sme );
6389 }
6390
6391 return (status);
6392}
6393
6394/* ---------------------------------------------------------------------------
6395 \fn sme_GetGTKOffload
6396 \brief API to get GTK offload information.
6397 \param hHal - The handle returned by macOpen.
6398 \param pRequest - Pointer to the GTK offload response.
6399 \return eHalStatus
6400 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006401eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006402 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006403{
6404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6405 eHalStatus status;
6406
Katya Nigambcb705f2013-12-26 14:26:22 +05306407 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006408 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006409 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6410 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006411 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006412 sme_ReleaseGlobalLock( &pMac->sme );
6413 }
6414
6415 return (status);
6416}
6417#endif // WLAN_FEATURE_GTK_OFFLOAD
6418
6419/* ---------------------------------------------------------------------------
6420 \fn sme_SetKeepAlive
6421 \brief API to set the Keep Alive feature.
6422 \param hHal - The handle returned by macOpen.
6423 \param pRequest - Pointer to the Keep Alive request.
6424 \return eHalStatus
6425 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006426eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006427 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006428{
6429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6430 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006431 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6432 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006433 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006434 sme_ReleaseGlobalLock( &pMac->sme );
6435 }
6436
6437 return (status);
6438}
6439
6440#ifdef FEATURE_WLAN_SCAN_PNO
6441/* ---------------------------------------------------------------------------
6442 \fn sme_SetPreferredNetworkList
6443 \brief API to set the Preferred Network List Offload feature.
6444 \param hHal - The handle returned by macOpen.
6445 \param pRequest - Pointer to the offload request.
6446 \return eHalStatus
6447 ---------------------------------------------------------------------------*/
6448eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6449{
6450 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6451 eHalStatus status;
6452
6453 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6454 {
6455 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6456 sme_ReleaseGlobalLock( &pMac->sme );
6457 }
6458
6459 return (status);
6460}
6461
6462eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6463{
6464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6465 eHalStatus status;
6466
6467 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6468 {
6469 pmcSetRssiFilter(hHal, rssiThreshold);
6470 sme_ReleaseGlobalLock( &pMac->sme );
6471 }
6472
6473 return (status);
6474}
6475
6476#endif // FEATURE_WLAN_SCAN_PNO
6477
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006478eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006479{
6480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6481 eHalStatus status;
6482
Katya Nigambcb705f2013-12-26 14:26:22 +05306483 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006484 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006485 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6486 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006487 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006488 sme_ReleaseGlobalLock( &pMac->sme );
6489 }
6490
6491 return (status);
6492}
6493
6494/* ---------------------------------------------------------------------------
6495 \fn sme_AbortMacScan
6496 \brief API to cancel MAC scan.
6497 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306498 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306499 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006500 \return VOS_STATUS
6501 VOS_STATUS_E_FAILURE - failure
6502 VOS_STATUS_SUCCESS success
6503 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306504eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6505 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006506{
6507 eHalStatus status;
6508 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6509
Katya Nigambcb705f2013-12-26 14:26:22 +05306510 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006511 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006512 status = sme_AcquireGlobalLock( &pMac->sme );
6513 if ( HAL_STATUS_SUCCESS( status ) )
6514 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306515 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006516
Jeff Johnson295189b2012-06-20 16:38:30 -07006517 sme_ReleaseGlobalLock( &pMac->sme );
6518 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006519
Jeff Johnson295189b2012-06-20 16:38:30 -07006520 return ( status );
6521}
6522
6523/* ----------------------------------------------------------------------------
6524 \fn sme_GetOperationChannel
6525 \brief API to get current channel on which STA is parked
6526 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006527 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006528 \returns eHAL_STATUS_SUCCESS
6529 eHAL_STATUS_FAILURE
6530-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006531eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006532{
Jeff Johnson295189b2012-06-20 16:38:30 -07006533 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6534 tCsrRoamSession *pSession;
6535
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006536 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006537 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006538 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006539
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006540 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006541 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006542 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006543 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6544 {
6545 *pChannel =pSession->connectedProfile.operationChannel;
6546 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006547 }
6548 }
6549 return eHAL_STATUS_FAILURE;
6550}// sme_GetOperationChannel ends here
6551
Jeff Johnson295189b2012-06-20 16:38:30 -07006552/* ---------------------------------------------------------------------------
6553
6554 \fn sme_RegisterMgtFrame
6555
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006556 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006557 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006558 \param matchData - data which needs to be matched before passing frame
6559 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006560 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006561 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006562 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006563eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006564 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6565{
6566 eHalStatus status = eHAL_STATUS_SUCCESS;
6567 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6568
Katya Nigambcb705f2013-12-26 14:26:22 +05306569 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006570 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006571 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6572 {
6573 tSirRegisterMgmtFrame *pMsg;
6574 tANI_U16 len;
6575 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006576
6577 if(!pSession)
6578 {
6579 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006580 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006581 return eHAL_STATUS_FAILURE;
6582 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006583
Jeff Johnson295189b2012-06-20 16:38:30 -07006584 if( !pSession->sessionActive )
6585 {
6586 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006587 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006588 sme_ReleaseGlobalLock( &pMac->sme );
6589 return eHAL_STATUS_FAILURE;
6590 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006591
Jeff Johnson295189b2012-06-20 16:38:30 -07006592 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6593
Kiet Lam64c1b492013-07-12 13:56:44 +05306594 pMsg = vos_mem_malloc(len);
6595 if ( NULL == pMsg )
6596 status = eHAL_STATUS_FAILURE;
6597 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006598 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306599 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006600 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6601 pMsg->length = len;
6602 pMsg->sessionId = sessionId;
6603 pMsg->registerFrame = VOS_TRUE;
6604 pMsg->frameType = frameType;
6605 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306606 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006607 status = palSendMBMessage(pMac->hHdd, pMsg);
6608 }
6609 sme_ReleaseGlobalLock( &pMac->sme );
6610 }
6611 return status;
6612}
6613
6614/* ---------------------------------------------------------------------------
6615
6616 \fn sme_DeregisterMgtFrame
6617
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006618 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006619 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006620 \param matchData - data which needs to be matched before passing frame
6621 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006622 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006623 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006624 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006625eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006626 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6627{
6628 eHalStatus status = eHAL_STATUS_SUCCESS;
6629 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6630
Katya Nigambcb705f2013-12-26 14:26:22 +05306631 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006632 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006633 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6634 {
6635 tSirRegisterMgmtFrame *pMsg;
6636 tANI_U16 len;
6637 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006638
6639 if(!pSession)
6640 {
6641 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006642 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006643 return eHAL_STATUS_FAILURE;
6644 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006645
6646 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006647 {
6648 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006649 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006650 sme_ReleaseGlobalLock( &pMac->sme );
6651 return eHAL_STATUS_FAILURE;
6652 }
6653
6654 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6655
Kiet Lam64c1b492013-07-12 13:56:44 +05306656 pMsg = vos_mem_malloc(len);
6657 if ( NULL == pMsg )
6658 status = eHAL_STATUS_FAILURE;
6659 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306661 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006662 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006663 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006664 pMsg->registerFrame = VOS_FALSE;
6665 pMsg->frameType = frameType;
6666 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306667 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006668 status = palSendMBMessage(pMac->hHdd, pMsg);
6669 }
6670 sme_ReleaseGlobalLock( &pMac->sme );
6671 }
6672 return status;
6673}
6674
6675/* ---------------------------------------------------------------------------
6676 \fn sme_RemainOnChannel
6677 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6678 \param hHal - The handle returned by macOpen.
6679 \param pRequest - channel
6680 \param duration - duration in ms
6681 \param callback - HDD registered callback to process reaminOnChannelRsp
6682 \param context - HDD Callback param
6683 \return eHalStatus
6684 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006685eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6686 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306687 remainOnChanCallback callback,
6688 void *pContext,
6689 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006690{
6691 eHalStatus status = eHAL_STATUS_SUCCESS;
6692 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6693
Katya Nigambcb705f2013-12-26 14:26:22 +05306694 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006695 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006696 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6697 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306698 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6699 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006700#ifdef WLAN_FEATURE_P2P_INTERNAL
6701 , eP2PRemainOnChnReasonUnknown
6702#endif
6703 );
6704 sme_ReleaseGlobalLock( &pMac->sme );
6705 }
6706 return(status);
6707}
6708
6709/* ---------------------------------------------------------------------------
6710 \fn sme_ReportProbeReq
6711 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6712 \param hHal - The handle returned by macOpen.
6713 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6714 \return eHalStatus
6715 ---------------------------------------------------------------------------*/
6716
6717#ifndef WLAN_FEATURE_CONCURRENT_P2P
6718eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6719{
6720 eHalStatus status = eHAL_STATUS_SUCCESS;
6721 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6722
6723 do
6724 {
6725 //acquire the lock for the sme object
6726 status = sme_AcquireGlobalLock(&pMac->sme);
6727 if(HAL_STATUS_SUCCESS(status))
6728 {
6729 /* call set in context */
6730 pMac->p2pContext.probeReqForwarding = flag;
6731 //release the lock for the sme object
6732 sme_ReleaseGlobalLock( &pMac->sme );
6733 }
6734 } while(0);
6735
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006736 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006737
6738 return(status);
6739}
6740
6741/* ---------------------------------------------------------------------------
6742 \fn sme_updateP2pIe
6743 \brief API to set the P2p Ie in p2p context
6744 \param hHal - The handle returned by macOpen.
6745 \param p2pIe - Ptr to p2pIe from HDD.
6746 \param p2pIeLength: length of p2pIe
6747 \return eHalStatus
6748 ---------------------------------------------------------------------------*/
6749
6750eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6751{
6752 eHalStatus status = eHAL_STATUS_SUCCESS;
6753 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6754
6755 //acquire the lock for the sme object
6756 status = sme_AcquireGlobalLock(&pMac->sme);
6757 if(HAL_STATUS_SUCCESS(status))
6758 {
6759 if(NULL != pMac->p2pContext.probeRspIe){
6760 vos_mem_free(pMac->p2pContext.probeRspIe);
6761 pMac->p2pContext.probeRspIeLength = 0;
6762 }
6763
6764 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6765 if (NULL == pMac->p2pContext.probeRspIe)
6766 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006767 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 pMac->p2pContext.probeRspIeLength = 0;
6769 status = eHAL_STATUS_FAILURE;
6770 }
6771 else
6772 {
6773 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6774
6775 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6776 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006777 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07006778 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6779 p2pIeLength);
6780 }
6781
6782 //release the lock for the sme object
6783 sme_ReleaseGlobalLock( &pMac->sme );
6784 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006785
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006786 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006787
6788 return(status);
6789}
6790#endif
6791
6792/* ---------------------------------------------------------------------------
6793 \fn sme_sendAction
6794 \brief API to send action frame from supplicant.
6795 \param hHal - The handle returned by macOpen.
6796 \return eHalStatus
6797 ---------------------------------------------------------------------------*/
6798
6799eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006800 const tANI_U8 *pBuf, tANI_U32 len,
6801 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006802{
6803 eHalStatus status = eHAL_STATUS_SUCCESS;
6804 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6805
Katya Nigambcb705f2013-12-26 14:26:22 +05306806 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006807 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006808 //acquire the lock for the sme object
6809 status = sme_AcquireGlobalLock(&pMac->sme);
6810 if(HAL_STATUS_SUCCESS(status))
6811 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006812 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006813 //release the lock for the sme object
6814 sme_ReleaseGlobalLock( &pMac->sme );
6815 }
6816
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006817 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006818
6819 return(status);
6820}
6821
6822eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6823{
6824 eHalStatus status = eHAL_STATUS_SUCCESS;
6825 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6826
Katya Nigambcb705f2013-12-26 14:26:22 +05306827 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006828 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006829 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6830 {
6831 status = p2pCancelRemainOnChannel (hHal, sessionId);
6832 sme_ReleaseGlobalLock( &pMac->sme );
6833 }
6834 return(status);
6835}
6836
6837//Power Save Related
6838eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6839{
6840 eHalStatus status = eHAL_STATUS_SUCCESS;
6841 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6842
6843 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6844 {
6845 status = p2pSetPs (hHal, data);
6846 sme_ReleaseGlobalLock( &pMac->sme );
6847 }
6848 return(status);
6849}
6850
Jeff Johnson295189b2012-06-20 16:38:30 -07006851
6852/* ---------------------------------------------------------------------------
6853
6854 \fn sme_ConfigureRxpFilter
6855
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006856 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07006857 SME will pass this request to lower mac to set/reset the filter on RXP for
6858 multicast & broadcast traffic.
6859
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006860 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006861
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006862 hHal - The handle returned by macOpen.
6863
Jeff Johnson295189b2012-06-20 16:38:30 -07006864 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6865 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6866 on this param. In future we can use this as a mask to set various types of
6867 filters as suggested below:
6868 FILTER_ALL_MULTICAST:
6869 FILTER_ALL_BROADCAST:
6870 FILTER_ALL_MULTICAST_BROADCAST:
6871
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006872
6873 \return eHalStatus
6874
6875
Jeff Johnson295189b2012-06-20 16:38:30 -07006876--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006877eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006878 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6879{
6880 eHalStatus status = eHAL_STATUS_SUCCESS;
6881 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6882 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6883 vos_msg_t vosMessage;
6884
Katya Nigambcb705f2013-12-26 14:26:22 +05306885 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006886 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006887 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6888 {
6889 /* serialize the req through MC thread */
6890 vosMessage.bodyptr = wlanRxpFilterParam;
6891 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6892 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6893 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6894 {
6895 status = eHAL_STATUS_FAILURE;
6896 }
6897 sme_ReleaseGlobalLock( &pMac->sme );
6898 }
6899 return(status);
6900}
6901
Jeff Johnson295189b2012-06-20 16:38:30 -07006902/* ---------------------------------------------------------------------------
6903
6904 \fn sme_ConfigureSuspendInd
6905
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006906 \brief
6907 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006908 be suspended
6909
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006910 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006911
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006912 hHal - The handle returned by macOpen.
6913
Jeff Johnson295189b2012-06-20 16:38:30 -07006914 wlanSuspendParam- Depicts the wlan suspend params
6915
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006916
6917 \return eHalStatus
6918
6919
Jeff Johnson295189b2012-06-20 16:38:30 -07006920--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006921eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006922 tpSirWlanSuspendParam wlanSuspendParam)
6923{
6924 eHalStatus status = eHAL_STATUS_SUCCESS;
6925 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6926 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6927 vos_msg_t vosMessage;
6928
Katya Nigambcb705f2013-12-26 14:26:22 +05306929 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006930 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006931 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6932 {
6933 /* serialize the req through MC thread */
6934 vosMessage.bodyptr = wlanSuspendParam;
6935 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6936 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6937 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6938 {
6939 status = eHAL_STATUS_FAILURE;
6940 }
6941 sme_ReleaseGlobalLock( &pMac->sme );
6942 }
6943 return(status);
6944}
6945
6946/* ---------------------------------------------------------------------------
6947
6948 \fn sme_ConfigureResumeReq
6949
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006950 \brief
6951 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006952 be Resumed
6953
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006954 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006955
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006956 hHal - The handle returned by macOpen.
6957
Jeff Johnson295189b2012-06-20 16:38:30 -07006958 wlanResumeParam- Depicts the wlan resume params
6959
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006960
6961 \return eHalStatus
6962
6963
Jeff Johnson295189b2012-06-20 16:38:30 -07006964--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006965eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006966 tpSirWlanResumeParam wlanResumeParam)
6967{
6968 eHalStatus status = eHAL_STATUS_SUCCESS;
6969 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6970 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6971 vos_msg_t vosMessage;
6972
Katya Nigambcb705f2013-12-26 14:26:22 +05306973 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006974 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006975 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6976 {
6977 /* serialize the req through MC thread */
6978 vosMessage.bodyptr = wlanResumeParam;
6979 vosMessage.type = WDA_WLAN_RESUME_REQ;
6980 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6981 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6982 {
6983 status = eHAL_STATUS_FAILURE;
6984 }
6985 sme_ReleaseGlobalLock( &pMac->sme );
6986 }
6987 return(status);
6988}
6989
Jeff Johnson295189b2012-06-20 16:38:30 -07006990/* ---------------------------------------------------------------------------
6991
6992 \fn sme_GetInfraSessionId
6993
6994 \brief To get the session ID for infra session, if connected
6995 This is a synchronous API.
6996
6997 \param hHal - The handle returned by macOpen.
6998
6999 \return sessionid, -1 if infra session is not connected
7000
7001 -------------------------------------------------------------------------------*/
7002tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7003{
7004 eHalStatus status = eHAL_STATUS_FAILURE;
7005 tANI_S8 sessionid = -1;
7006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007007
Jeff Johnson295189b2012-06-20 16:38:30 -07007008 status = sme_AcquireGlobalLock( &pMac->sme );
7009 if ( HAL_STATUS_SUCCESS( status ) )
7010 {
7011
7012 sessionid = csrGetInfraSessionId( pMac);
7013
7014 sme_ReleaseGlobalLock( &pMac->sme );
7015 }
7016
7017 return (sessionid);
7018}
7019
7020/* ---------------------------------------------------------------------------
7021
7022 \fn sme_GetInfraOperationChannel
7023
7024 \brief To get the operating channel for infra session, if connected
7025 This is a synchronous API.
7026
7027 \param hHal - The handle returned by macOpen.
7028 \param sessionId - the sessionId returned by sme_OpenSession.
7029
7030 \return operating channel, 0 if infra session is not connected
7031
7032 -------------------------------------------------------------------------------*/
7033tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7034{
7035 eHalStatus status = eHAL_STATUS_FAILURE;
7036 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7037 tANI_U8 channel = 0;
7038 status = sme_AcquireGlobalLock( &pMac->sme );
7039 if ( HAL_STATUS_SUCCESS( status ) )
7040 {
7041
7042 channel = csrGetInfraOperationChannel( pMac, sessionId);
7043
7044 sme_ReleaseGlobalLock( &pMac->sme );
7045 }
7046
7047 return (channel);
7048}
7049
7050//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007051//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007052tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7053{
7054 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007056 tANI_U8 channel = 0;
7057 status = sme_AcquireGlobalLock( &pMac->sme );
7058 if ( HAL_STATUS_SUCCESS( status ) )
7059 {
7060
7061 channel = csrGetConcurrentOperationChannel( pMac );
7062 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007063 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007064 sme_ReleaseGlobalLock( &pMac->sme );
7065 }
7066
7067 return (channel);
7068}
7069
7070#ifdef FEATURE_WLAN_SCAN_PNO
7071/******************************************************************************
7072*
7073* Name: sme_PreferredNetworkFoundInd
7074*
7075* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007076* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007077*
7078* Parameters:
7079* hHal - HAL handle for device
7080* pMsg - found network description
7081*
7082* Returns: eHalStatus
7083*
7084******************************************************************************/
7085eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7086{
7087 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7088 eHalStatus status = eHAL_STATUS_SUCCESS;
7089 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007090 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7091 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007092
7093 if (NULL == pMsg)
7094 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007095 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007096 status = eHAL_STATUS_FAILURE;
7097 }
7098 else
7099 {
7100 if (pPrefNetworkFoundInd->ssId.length > 0)
7101 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007102 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7103 pPrefNetworkFoundInd->ssId.length);
7104 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7105 dumpSsId[ssIdLength] = 0;
7106 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
7107 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007108
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307109 /* Flush scan results, So as to avoid indication/updation of
7110 * stale entries, which may not have aged out during APPS collapse
7111 */
7112 sme_ScanFlushResult(hHal,0);
7113
Srikant Kuppa066904f2013-05-07 13:56:02 -07007114 //Save the frame to scan result
7115 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7116 {
7117 //we may have a frame
7118 status = csrScanSavePreferredNetworkFound(pMac,
7119 pPrefNetworkFoundInd);
7120 if (!HAL_STATUS_SUCCESS(status))
7121 {
7122 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7123 }
7124 }
7125 else
7126 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007127 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007128 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007129 }
7130
Srikant Kuppa066904f2013-05-07 13:56:02 -07007131 /* Call Preferred Netowrk Found Indication callback routine. */
7132 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7133 {
7134 pMac->pmc.prefNetwFoundCB(
7135 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7136 pPrefNetworkFoundInd);
7137 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007138 }
7139 else
7140 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007141 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007142 status = eHAL_STATUS_FAILURE;
7143 }
7144 }
7145
7146
7147 return(status);
7148}
7149
7150#endif // FEATURE_WLAN_SCAN_PNO
7151
7152
7153eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7154{
7155 eHalStatus status = eHAL_STATUS_FAILURE;
7156 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007157
Jeff Johnson295189b2012-06-20 16:38:30 -07007158 status = sme_AcquireGlobalLock( &pMac->sme );
7159 if ( HAL_STATUS_SUCCESS( status ) )
7160 {
7161 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7162 sme_ReleaseGlobalLock( &pMac->sme );
7163 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007164
Jeff Johnson295189b2012-06-20 16:38:30 -07007165 return (status);
7166}
7167
7168
7169/* ---------------------------------------------------------------------------
7170
7171 \fn sme_SetTxPerTracking
7172
7173 \brief Set Tx PER tracking configuration parameters
7174
7175 \param hHal - The handle returned by macOpen.
7176 \param pTxPerTrackingConf - Tx PER configuration parameters
7177
7178 \return eHalStatus
7179
7180 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007181eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7182 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007183 void *pCallbackContext,
7184 tpSirTxPerTrackingParam pTxPerTrackingParam)
7185{
7186 vos_msg_t msg;
7187 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7188 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7189
7190 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7191 {
7192 pMac->sme.pTxPerHitCallback = pCallbackfn;
7193 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7194 sme_ReleaseGlobalLock( &pMac->sme );
7195 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007196
Jeff Johnson295189b2012-06-20 16:38:30 -07007197 // free this memory in failure case or WDA request callback function
7198 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7199 if (NULL == pTxPerTrackingParamReq)
7200 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007201 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 -07007202 return eHAL_STATUS_FAILURE;
7203 }
7204
Kiet Lam64c1b492013-07-12 13:56:44 +05307205 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7206 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007207 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7208 msg.reserved = 0;
7209 msg.bodyptr = pTxPerTrackingParamReq;
7210
7211 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7212 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007213 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 -07007214 vos_mem_free(pTxPerTrackingParamReq);
7215 return eHAL_STATUS_FAILURE;
7216 }
7217
7218 return eHAL_STATUS_SUCCESS;
7219}
7220
7221/* ---------------------------------------------------------------------------
7222
7223 \fn sme_HandleChangeCountryCode
7224
7225 \brief Change Country code, Reg Domain and channel list
7226
7227 \details Country Code Priority
7228 0 = 11D > Configured Country > NV
7229 1 = Configured Country > 11D > NV
7230 If Supplicant country code is priority than 11d is disabled.
7231 If 11D is enabled, we update the country code after every scan.
7232 Hence when Supplicant country code is priority, we don't need 11D info.
7233 Country code from Supplicant is set as current courtry code.
7234 User can send reset command XX (instead of country code) to reset the
7235 country code to default values which is read from NV.
7236 In case of reset, 11D is enabled and default NV code is Set as current country code
7237 If 11D is priority,
7238 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7239
7240 \param pMac - The handle returned by macOpen.
7241 \param pMsgBuf - MSG Buffer
7242
7243 \return eHalStatus
7244
7245 -------------------------------------------------------------------------------*/
7246eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7247{
7248 eHalStatus status = eHAL_STATUS_SUCCESS;
7249 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007250 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007251 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7252 static uNvTables nvTables;
7253 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7254
7255
7256 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7257 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7258 {
7259 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7260
7261 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7262
7263 /* read the country code from NV and use it */
7264 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7265 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307266 vos_mem_copy(pMsg->countryCode,
7267 nvTables.defaultCountryTable.countryCode,
7268 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007269 }
7270 else
7271 {
7272 status = eHAL_STATUS_FAILURE;
7273 return status;
7274 }
7275 }
7276 else
7277 {
7278 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307279 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7280 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007281 {
7282 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7283 }
7284 }
7285
7286 /* WEXT set country code means
7287 * 11D should be supported?
7288 * 11D Channel should be enforced?
7289 * 11D Country code should be matched?
7290 * 11D Reg Domian should be matched?
7291 * Country string changed */
7292 if(pMac->roam.configParam.Is11dSupportEnabled &&
7293 pMac->roam.configParam.fEnforce11dChannels &&
7294 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7295 pMac->roam.configParam.fEnforceDefaultDomain &&
7296 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7297 {
7298 /* All 11D related options are already enabled
7299 * Country string is not changed
7300 * Do not need do anything for country code change request */
7301 return eHAL_STATUS_SUCCESS;
7302 }
7303
7304 /* Set Current Country code and Current Regulatory domain */
7305 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7306 if(eHAL_STATUS_SUCCESS != status)
7307 {
7308 /* Supplicant country code failed. So give 11D priority */
7309 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7310 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007311 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007312 }
7313
Jeff Johnson295189b2012-06-20 16:38:30 -07007314 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307315 vos_mem_copy(pMac->scan.countryCodeDefault,
7316 pMac->scan.countryCodeCurrent,
7317 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007318
7319 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307320 status = csrGetRegulatoryDomainForCountry(pMac,
7321 pMac->scan.countryCodeCurrent,
7322 (v_REGDOMAIN_t *) &domainIdIoctl,
7323 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007324 if ( status != eHAL_STATUS_SUCCESS )
7325 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007326 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007327 return status;
7328 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007329 else if (REGDOMAIN_WORLD == domainIdIoctl)
7330 {
7331 /* Supplicant country code is invalid, so we are on world mode now. So
7332 give 11D chance to update */
7333 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7334 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7335 }
7336
Jeff Johnson295189b2012-06-20 16:38:30 -07007337
Abhishek Singha306a442013-11-07 18:39:01 +05307338 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007339
7340 if ( status != eHAL_STATUS_SUCCESS )
7341 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007342 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007343 return status;
7344 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007345 else
7346 {
7347 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7348 //set again if we find AP with 11d info during scan
7349 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7350 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007351 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007352 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7353 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7354 }
7355 }
Kiet Lam6c583332013-10-14 05:37:09 +05307356#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007357 /* set to default domain ID */
7358 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7359
7360 /* get the channels based on new cc */
7361 status = csrInitGetChannels( pMac );
7362
7363 if ( status != eHAL_STATUS_SUCCESS )
7364 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007365 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007366 return status;
7367 }
7368
7369 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007370 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307371 /* Country code Changed, Purge Only scan result
7372 * which does not have channel number belong to 11d
7373 * channel list
7374 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307375 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307376
Kiet Lam6c583332013-10-14 05:37:09 +05307377#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007378 if( pMsg->changeCCCallback )
7379 {
7380 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7381 }
7382
7383 return eHAL_STATUS_SUCCESS;
7384}
7385
Amar Singhal0d15bd52013-10-12 23:13:13 -07007386/* ---------------------------------------------------------------------------
7387
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007388 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007389
7390 \brief Change Country code, Reg Domain and channel list
7391
7392 If Supplicant country code is priority than 11d is disabled.
7393 If 11D is enabled, we update the country code after every scan.
7394 Hence when Supplicant country code is priority, we don't need 11D info.
7395 Country code from Supplicant is set as current country code.
7396
7397 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007398 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007399
7400 \return eHalStatus
7401
7402 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007403eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7404 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007405{
7406 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007407 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307408 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007409
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007410 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007411 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7412
Kiet Lam6c583332013-10-14 05:37:09 +05307413 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7414 VOS_COUNTRY_CODE_LEN) == 0)
7415 {
7416 is11dCountry = VOS_TRUE;
7417 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007418
Amar Singhal97a2d992013-11-19 10:58:07 -08007419 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7420 (csrGetInfraSessionId(pMac) != -1 ))
7421 {
7422
7423 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
7424
7425 /* we have got a request for a country that should not have been added since the
7426 STA is associated; nullify this request */
7427 status = csrGetRegulatoryDomainForCountry(pMac,
7428 pMac->scan.countryCode11d,
7429 (v_REGDOMAIN_t *) &reg_domain_id,
7430 COUNTRY_IE);
7431
7432 return eHAL_STATUS_FAILURE;
7433 }
7434
Amar Singhal0d15bd52013-10-12 23:13:13 -07007435 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307436 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007437 {
7438 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7439 }
7440
Kiet Lamf2f201e2013-11-16 21:24:16 +05307441 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007442 WNI_CFG_COUNTRY_CODE_LEN);
7443
Abhishek Singha306a442013-11-07 18:39:01 +05307444 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007445
Kiet Lam6c583332013-10-14 05:37:09 +05307446 if (VOS_FALSE == is11dCountry )
7447 {
7448 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307449 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307450 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7451 /* set to default domain ID */
7452 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7453 }
7454
Amar Singhal0d15bd52013-10-12 23:13:13 -07007455 if ( status != eHAL_STATUS_SUCCESS )
7456 {
7457 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307458 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007459 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007460 else
7461 {
7462 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7463 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007464 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7465 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007466 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007467 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007468 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7469 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7470 }
7471 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007472
Amar Singhal0d15bd52013-10-12 23:13:13 -07007473 /* get the channels based on new cc */
7474 status = csrInitGetChannels(pMac);
7475
7476 if ( status != eHAL_STATUS_SUCCESS )
7477 {
7478 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7479 return status;
7480 }
7481
7482 /* reset info based on new cc, and we are done */
7483 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307484 if (VOS_TRUE == is11dCountry)
7485 {
Kiet Lam6c583332013-10-14 05:37:09 +05307486 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7487 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7488 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307489 /* Country code Changed, Purge Only scan result
7490 * which does not have channel number belong to 11d
7491 * channel list
7492 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307493 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307494 // Do active scans after the country is set by User hints or Country IE
7495 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
7496
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007497 smsLog(pMac, LOG1, FL(" returned"));
7498 return eHAL_STATUS_SUCCESS;
7499}
7500
7501/* ---------------------------------------------------------------------------
7502
Kiet Lamcffc5862013-10-30 16:28:45 +05307503 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007504
7505 \brief Update Country code in the driver if set by kernel as world
7506
7507 If 11D is enabled, we update the country code after every scan & notify kernel.
7508 This is to make sure kernel & driver are in sync in case of CC found in
7509 driver but not in kernel database
7510
7511 \param pMac - The handle returned by macOpen.
7512 \param pMsg - Carrying new CC set in kernel
7513
7514 \return eHalStatus
7515
7516 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307517eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007518{
Kiet Lamcffc5862013-10-30 16:28:45 +05307519 eHalStatus status;
7520
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007521 smsLog(pMac, LOG1, FL(" called"));
7522
7523 //this is to make sure kernel & driver are in sync in case of CC found in
7524 //driver but not in kernel database
7525 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7526 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007527 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307528 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007529 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307530 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007531 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007532 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307533
Abhishek Singha306a442013-11-07 18:39:01 +05307534 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307535
7536 if ( status != eHAL_STATUS_SUCCESS )
7537 {
7538 smsLog( pMac, LOGE, FL(" fail to set regId") );
7539 return status;
7540 }
7541 else
7542 {
7543 status = csrInitGetChannels(pMac);
7544 if ( status != eHAL_STATUS_SUCCESS )
7545 {
7546 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7547 }
7548 else
7549 {
7550 csrInitChannelList(pMac);
7551 }
7552 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307553 /* Country code Changed, Purge Only scan result
7554 * which does not have channel number belong to 11d
7555 * channel list
7556 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307557 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007558 smsLog(pMac, LOG1, FL(" returned"));
7559 return eHAL_STATUS_SUCCESS;
7560}
7561
7562/* ---------------------------------------------------------------------------
7563
7564 \fn sme_HandleGenericChangeCountryCode
7565
7566 \brief Change Country code, Reg Domain and channel list
7567
7568 If Supplicant country code is priority than 11d is disabled.
7569 If 11D is enabled, we update the country code after every scan.
7570 Hence when Supplicant country code is priority, we don't need 11D info.
7571 Country code from kernel is set as current country code.
7572
7573 \param pMac - The handle returned by macOpen.
7574 \param pMsgBuf - message buffer
7575
7576 \return eHalStatus
7577
7578 -------------------------------------------------------------------------------*/
7579eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7580{
7581 tAniGenericChangeCountryCodeReq *pMsg;
7582 v_REGDOMAIN_t reg_domain_id;
7583
7584 smsLog(pMac, LOG1, FL(" called"));
7585 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7586 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7587
7588 if (REGDOMAIN_COUNT == reg_domain_id)
7589 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307590 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007591 }
7592 else
7593 {
7594 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7595 }
7596 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007597 return eHAL_STATUS_SUCCESS;
7598}
7599
Jeff Johnson295189b2012-06-20 16:38:30 -07007600#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007601eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007602{
7603 tpSirRcvFltMcAddrList pRequestBuf;
7604 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007605 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007606 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007607
7608 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307609 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007610 pMulticastAddrs->ulMulticastAddrCnt,
7611 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007612
7613 /*
7614 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007615 */
7616 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7617 csrIsConnStateInfra(pMac, sessionId))
7618 {
7619 pSession = CSR_GET_SESSION( pMac, sessionId );
7620 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007621
7622 if(pSession == NULL )
7623 {
7624 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007625 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007626 return eHAL_STATUS_FAILURE;
7627 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007628
Jeff Johnson295189b2012-06-20 16:38:30 -07007629 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7630 if (NULL == pRequestBuf)
7631 {
7632 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007633 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007634 return eHAL_STATUS_FAILED_ALLOC;
7635 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007636
7637 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7638 {
7639 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7640 "indication as we are not connected", __func__);
7641 vos_mem_free(pRequestBuf);
7642 return eHAL_STATUS_FAILURE;
7643 }
7644
Jeff Johnson295189b2012-06-20 16:38:30 -07007645 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7646
Kiet Lam64c1b492013-07-12 13:56:44 +05307647 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7648 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007649 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7650 sizeof(tSirMacAddr));
7651
Jeff Johnson295189b2012-06-20 16:38:30 -07007652 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7653 msg.reserved = 0;
7654 msg.bodyptr = pRequestBuf;
7655 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7656 {
7657 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007658 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007659 vos_mem_free(pRequestBuf);
7660 return eHAL_STATUS_FAILURE;
7661 }
7662
7663 return eHAL_STATUS_SUCCESS;
7664}
7665
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007666eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007667 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007668{
7669 tpSirRcvPktFilterCfgType pRequestBuf;
7670 v_SINT_t allocSize;
7671 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007672 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7673 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007674 v_U8_t idx=0;
7675
7676 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007677 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007678 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007679
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007680 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007681
Jeff Johnson295189b2012-06-20 16:38:30 -07007682 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007683
7684 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007685 {
7686 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007687 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007688 return eHAL_STATUS_FAILED_ALLOC;
7689 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007690
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007691 if( NULL == pSession )
7692 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007693 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007694 vos_mem_free(pRequestBuf);
7695 return eHAL_STATUS_FAILURE;
7696 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007697
Kiet Lam64c1b492013-07-12 13:56:44 +05307698 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7699 sizeof(tSirMacAddr));
7700 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7701 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007702 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7703
Jeff Johnson295189b2012-06-20 16:38:30 -07007704 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7705 msg.reserved = 0;
7706 msg.bodyptr = pRequestBuf;
7707
7708 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007709 "FT %d FID %d ",
7710 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007711
7712 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007713 "params %d CT %d",
7714 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07007715
7716 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7717 {
7718
7719 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007720 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007721 pRequestBuf->paramsData[idx].protocolLayer,
7722 pRequestBuf->paramsData[idx].cmpFlag);
7723
7724 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007725 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007726 pRequestBuf->paramsData[idx].dataOffset,
7727 pRequestBuf->paramsData[idx].dataLength);
7728
7729 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007730 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007731 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007732 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007733 pRequestBuf->paramsData[idx].compareData[2],
7734 pRequestBuf->paramsData[idx].compareData[3],
7735 pRequestBuf->paramsData[idx].compareData[4],
7736 pRequestBuf->paramsData[idx].compareData[5]);
7737
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007738 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007739 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007740 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007741 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007742 pRequestBuf->paramsData[idx].dataMask[2],
7743 pRequestBuf->paramsData[idx].dataMask[3],
7744 pRequestBuf->paramsData[idx].dataMask[4],
7745 pRequestBuf->paramsData[idx].dataMask[5]);
7746
7747 }
7748
7749 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7750 {
7751 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007752 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007753 vos_mem_free(pRequestBuf);
7754 return eHAL_STATUS_FAILURE;
7755 }
7756
7757 return eHAL_STATUS_SUCCESS;
7758}
7759
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007760eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007761 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007762 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007763 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007764{
7765 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7766 eHalStatus status;
7767
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007768 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007769
7770 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7771 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007772 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007773 sme_ReleaseGlobalLock( &pMac->sme );
7774 }
7775
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007776 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007777
7778 return (status);
7779}
7780
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007781eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07007782 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007783{
7784 tpSirRcvFltPktClearParam pRequestBuf;
7785 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007786 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7787 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007788
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007789 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007790 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007791
Jeff Johnson295189b2012-06-20 16:38:30 -07007792 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007793 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007794 {
7795 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7796 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007797 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007798 return eHAL_STATUS_FAILED_ALLOC;
7799 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007800 if( NULL == pSession )
7801 {
7802 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007803 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007804 vos_mem_free(pRequestBuf);
7805 return eHAL_STATUS_FAILURE;
7806 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007807
Kiet Lam64c1b492013-07-12 13:56:44 +05307808 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
7809 sizeof(tSirMacAddr));
7810 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
7811 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007812
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007813 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
7814
Jeff Johnson295189b2012-06-20 16:38:30 -07007815 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
7816 msg.reserved = 0;
7817 msg.bodyptr = pRequestBuf;
7818 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7819 {
7820 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007821 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007822 vos_mem_free(pRequestBuf);
7823 return eHAL_STATUS_FAILURE;
7824 }
7825
7826 return eHAL_STATUS_SUCCESS;
7827}
7828#endif // WLAN_FEATURE_PACKET_FILTERING
7829
7830/* ---------------------------------------------------------------------------
7831 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007832 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07007833 channel switch.
7834 \param callbackContext
7835 \param status
7836 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007837void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07007838 eHalStatus status)
7839{
7840 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
7841 tSirMbMsg *pMsg;
7842 tANI_U16 msgLen;
7843
7844 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05307845 pMsg = vos_mem_malloc(msgLen);
7846 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07007847 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307848 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007849 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
7850 pMsg->msgLen = pal_cpu_to_be16(msgLen);
7851 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007852 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007853
7854 return;
7855}
7856
7857/* ---------------------------------------------------------------------------
7858 \fn sme_HandlePreChannelSwitchInd
7859 \brief Processes the indcation from PE for pre-channel switch.
7860 \param hHal
7861 \- The handle returned by macOpen. return eHalStatus
7862 ---------------------------------------------------------------------------*/
7863eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
7864{
7865 eHalStatus status = eHAL_STATUS_FAILURE;
7866 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7867 status = sme_AcquireGlobalLock( &pMac->sme );
7868 if ( HAL_STATUS_SUCCESS( status ) )
7869 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007870 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
7871 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07007872 sme_ReleaseGlobalLock( &pMac->sme );
7873 }
7874
7875 return (status);
7876}
7877
7878/* ---------------------------------------------------------------------------
7879 \fn sme_HandlePostChannelSwitchInd
7880 \brief Processes the indcation from PE for post-channel switch.
7881 \param hHal
7882 \- The handle returned by macOpen. return eHalStatus
7883 ---------------------------------------------------------------------------*/
7884eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
7885{
7886 eHalStatus status = eHAL_STATUS_FAILURE;
7887 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7888
7889 status = sme_AcquireGlobalLock( &pMac->sme );
7890 if ( HAL_STATUS_SUCCESS( status ) )
7891 {
7892 status = pmcRequestBmps(hHal, NULL, NULL);
7893 sme_ReleaseGlobalLock( &pMac->sme );
7894 }
7895
7896 return (status);
7897}
7898
7899/* ---------------------------------------------------------------------------
7900
7901 \fn sme_IsChannelValid
7902
7903 \brief To check if the channel is valid for currently established domain
7904 This is a synchronous API.
7905
7906 \param hHal - The handle returned by macOpen.
7907 \param channel - channel to verify
7908
7909 \return TRUE/FALSE, TRUE if channel is valid
7910
7911 -------------------------------------------------------------------------------*/
7912tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
7913{
7914 eHalStatus status = eHAL_STATUS_FAILURE;
7915 tANI_BOOLEAN valid = FALSE;
7916 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007917
Jeff Johnson295189b2012-06-20 16:38:30 -07007918 status = sme_AcquireGlobalLock( &pMac->sme );
7919 if ( HAL_STATUS_SUCCESS( status ) )
7920 {
7921
7922 valid = csrRoamIsChannelValid( pMac, channel);
7923
7924 sme_ReleaseGlobalLock( &pMac->sme );
7925 }
7926
7927 return (valid);
7928}
7929
7930/* ---------------------------------------------------------------------------
7931 \fn sme_SetFreqBand
7932 \brief Used to set frequency band.
7933 \param hHal
7934 \eBand band value to be configured
7935 \- return eHalStatus
7936 -------------------------------------------------------------------------*/
7937eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
7938{
7939 eHalStatus status = eHAL_STATUS_FAILURE;
7940 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7941
7942 status = sme_AcquireGlobalLock( &pMac->sme );
7943 if ( HAL_STATUS_SUCCESS( status ) )
7944 {
7945 status = csrSetBand(hHal, eBand);
7946 sme_ReleaseGlobalLock( &pMac->sme );
7947 }
7948 return status;
7949}
7950
7951/* ---------------------------------------------------------------------------
7952 \fn sme_GetFreqBand
7953 \brief Used to get the current band settings.
7954 \param hHal
7955 \pBand pointer to hold band value
7956 \- return eHalStatus
7957 -------------------------------------------------------------------------*/
7958eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
7959{
7960 eHalStatus status = eHAL_STATUS_FAILURE;
7961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7962
7963 status = sme_AcquireGlobalLock( &pMac->sme );
7964 if ( HAL_STATUS_SUCCESS( status ) )
7965 {
7966 *pBand = csrGetCurrentBand( hHal );
7967 sme_ReleaseGlobalLock( &pMac->sme );
7968 }
7969 return status;
7970}
7971
7972#ifdef WLAN_WAKEUP_EVENTS
7973/******************************************************************************
7974 \fn sme_WakeReasonIndCallback
7975
7976 \brief
7977 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
7978
7979 \param hHal - HAL handle for device
7980 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
7981
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007982 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007983******************************************************************************/
7984eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
7985{
7986 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7987 eHalStatus status = eHAL_STATUS_SUCCESS;
7988 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
7989
7990 if (NULL == pMsg)
7991 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007992 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007993 status = eHAL_STATUS_FAILURE;
7994 }
7995 else
7996 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007997 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07007998
7999 /* Call Wake Reason Indication callback routine. */
8000 if (pMac->pmc.wakeReasonIndCB != NULL)
8001 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008002
Jeff Johnson295189b2012-06-20 16:38:30 -07008003 pMac->pmc.wakeReasonIndCB = NULL;
8004 pMac->pmc.wakeReasonIndCBContext = NULL;
8005
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008006 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008007 }
8008
8009 return(status);
8010}
8011#endif // WLAN_WAKEUP_EVENTS
8012
8013
8014/* ---------------------------------------------------------------------------
8015
8016 \fn sme_SetMaxTxPower
8017
8018 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8019 not persist over reboots.
8020
8021 \param hHal
8022 \param pBssid BSSID to set the power cap for
8023 \param pBssid pSelfMacAddress self MAC Address
8024 \param pBssid power to set in dB
8025 \- return eHalStatus
8026
8027 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008028eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008029 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8030{
8031 vos_msg_t msg;
8032 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308033 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008034 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008035 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8036 if (NULL == pMaxTxParams)
8037 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008038 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 -07008039 return eHAL_STATUS_FAILURE;
8040 }
8041
8042 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308043 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008044 SIR_MAC_ADDR_LENGTH);
8045 pMaxTxParams->power = dB;
8046
8047 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8048 msg.reserved = 0;
8049 msg.bodyptr = pMaxTxParams;
8050
8051 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8052 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008053 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 -07008054 vos_mem_free(pMaxTxParams);
8055 return eHAL_STATUS_FAILURE;
8056 }
8057
8058 return eHAL_STATUS_SUCCESS;
8059}
8060
Jeff Johnson295189b2012-06-20 16:38:30 -07008061/* ---------------------------------------------------------------------------
8062
Arif Hussaina5ebce02013-08-09 15:09:58 -07008063 \fn sme_SetMaxTxPowerPerBand
8064
8065 \brief Set the Maximum Transmit Power specific to band dynamically.
8066 Note: this setting will not persist over reboots.
8067
8068 \param band
8069 \param power to set in dB
8070 \- return eHalStatus
8071
8072 ----------------------------------------------------------------------------*/
8073eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8074{
8075 vos_msg_t msg;
8076 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8077
8078 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8079 if (NULL == pMaxTxPowerPerBandParams)
8080 {
8081 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8082 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8083 __func__);
8084 return eHAL_STATUS_FAILURE;
8085 }
8086
8087 pMaxTxPowerPerBandParams->power = dB;
8088 pMaxTxPowerPerBandParams->bandInfo = band;
8089
8090 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8091 msg.reserved = 0;
8092 msg.bodyptr = pMaxTxPowerPerBandParams;
8093
8094 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8095 {
8096 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8097 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8098 __func__);
8099 vos_mem_free(pMaxTxPowerPerBandParams);
8100 return eHAL_STATUS_FAILURE;
8101 }
8102
8103 return eHAL_STATUS_SUCCESS;
8104}
8105
8106/* ---------------------------------------------------------------------------
8107
schang86c22c42013-03-13 18:41:24 -07008108 \fn sme_SetTxPower
8109
8110 \brief Set Transmit Power dynamically. Note: this setting will
8111 not persist over reboots.
8112
8113 \param hHal
8114 \param sessionId Target Session ID
8115 \param mW power to set in mW
8116 \- return eHalStatus
8117
8118 -------------------------------------------------------------------------------*/
8119eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8120{
8121
8122 eHalStatus status = eHAL_STATUS_FAILURE;
8123 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8124
Katya Nigambcb705f2013-12-26 14:26:22 +05308125 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008126 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008127 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8128 status = sme_AcquireGlobalLock(&pMac->sme);
8129 if (HAL_STATUS_SUCCESS(status))
8130 {
8131 status = csrSetTxPower(pMac, sessionId, mW);
8132 sme_ReleaseGlobalLock(&pMac->sme);
8133 }
8134 return status;
8135}
8136
8137/* ---------------------------------------------------------------------------
8138
Jeff Johnson295189b2012-06-20 16:38:30 -07008139 \fn sme_HideSSID
8140
8141 \brief hide/show SSID dynamically. Note: this setting will
8142 not persist over reboots.
8143
8144 \param hHal
8145 \param sessionId
8146 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8147 \- return eHalStatus
8148
8149 -------------------------------------------------------------------------------*/
8150eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8151{
8152 eHalStatus status = eHAL_STATUS_SUCCESS;
8153 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8154 tANI_U16 len;
8155
8156 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8157 {
8158 tpSirUpdateParams pMsg;
8159 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008160
8161 if(!pSession)
8162 {
8163 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008164 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008165 return eHAL_STATUS_FAILURE;
8166 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008167
8168 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008169 VOS_ASSERT(0);
8170
8171 /* Create the message and send to lim */
8172 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308173 pMsg = vos_mem_malloc(len);
8174 if ( NULL == pMsg )
8175 status = eHAL_STATUS_FAILURE;
8176 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008177 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308178 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008179 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8180 pMsg->length = len;
8181 /* Data starts from here */
8182 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008183 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008184 status = palSendMBMessage(pMac->hHdd, pMsg);
8185 }
8186 sme_ReleaseGlobalLock( &pMac->sme );
8187 }
8188 return status;
8189}
Jeff Johnson295189b2012-06-20 16:38:30 -07008190
8191/* ---------------------------------------------------------------------------
8192
8193 \fn sme_SetTmLevel
8194 \brief Set Thermal Mitigation Level to RIVA
8195 \param hHal - The handle returned by macOpen.
8196 \param newTMLevel - new Thermal Mitigation Level
8197 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008198 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008199 ---------------------------------------------------------------------------*/
8200eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8201{
8202 eHalStatus status = eHAL_STATUS_SUCCESS;
8203 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8204 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8205 vos_msg_t vosMessage;
8206 tAniSetTmLevelReq *setTmLevelReq = NULL;
8207
Katya Nigambcb705f2013-12-26 14:26:22 +05308208 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008209 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008210 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8211 {
8212 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308213 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008214 {
8215 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008216 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008217 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008218 return eHAL_STATUS_FAILURE;
8219 }
8220
8221 setTmLevelReq->tmMode = tmMode;
8222 setTmLevelReq->newTmLevel = newTMLevel;
8223
8224 /* serialize the req through MC thread */
8225 vosMessage.bodyptr = setTmLevelReq;
8226 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8227 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8228 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8229 {
8230 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008231 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008232 vos_mem_free(setTmLevelReq);
8233 status = eHAL_STATUS_FAILURE;
8234 }
8235 sme_ReleaseGlobalLock( &pMac->sme );
8236 }
8237 return(status);
8238}
8239
8240/*---------------------------------------------------------------------------
8241
8242 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8243 Host and FW.
8244
8245 \param hHal - HAL handle for device
8246
8247 \return NONE
8248
8249---------------------------------------------------------------------------*/
8250void sme_featureCapsExchange( tHalHandle hHal)
8251{
8252 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308253 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008254 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008255 WDA_featureCapsExchange(vosContext);
8256}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008257
Yathish9f22e662012-12-10 14:21:35 -08008258/*---------------------------------------------------------------------------
8259
8260 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8261 in Host.
8262
8263 \param hHal - HAL handle for device
8264
8265 \return NONE
8266
8267---------------------------------------------------------------------------*/
8268void sme_disableFeatureCapablity(tANI_U8 feature_index)
8269{
8270 WDA_disableCapablityFeature(feature_index);
8271}
8272
Jeff Johnsond13512a2012-07-17 11:42:19 -07008273/* ---------------------------------------------------------------------------
8274
8275 \fn sme_GetDefaultCountryCode
8276
8277 \brief Get the default country code from NV
8278
8279 \param hHal
8280 \param pCountry
8281 \- return eHalStatus
8282
8283 -------------------------------------------------------------------------------*/
8284eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8285{
8286 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308287 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008288 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008289 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8290}
8291
8292/* ---------------------------------------------------------------------------
8293
8294 \fn sme_GetCurrentCountryCode
8295
8296 \brief Get the current country code
8297
8298 \param hHal
8299 \param pCountry
8300 \- return eHalStatus
8301
8302 -------------------------------------------------------------------------------*/
8303eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8304{
8305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308306 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008307 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008308 return csrGetCurrentCountryCode(pMac, pCountry);
8309}
8310
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008311/* ---------------------------------------------------------------------------
8312 \fn sme_transportDebug
8313 \brief Dynamically monitoring Transport channels
8314 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008315 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008316 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008317 \param toggleStallDetect Enable stall detect feature
8318 This feature will take effect to data performance
8319 Not integrate till fully verification
8320 \- return NONE
8321 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008322void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008323{
schang6295e542013-03-12 15:31:23 -07008324 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8325
8326 if (NULL == pMac)
8327 {
8328 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8329 "%s: invalid context", __func__);
8330 return;
8331 }
8332 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008333}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008334
Kiran4a17ebe2013-01-31 10:43:43 -08008335/* ---------------------------------------------------------------------------
8336 \fn sme_ResetPowerValuesFor5G
8337 \brief Reset the power values for 5G band with NV power values.
8338 \param hHal - HAL handle for device
8339 \- return NONE
8340 -------------------------------------------------------------------------*/
8341void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8342{
8343 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308344 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008345 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008346 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8347 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8348}
8349
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008350#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
8351/* ---------------------------------------------------------------------------
8352 \fn sme_UpdateRoamPrefer5GHz
8353 \brief enable/disable Roam prefer 5G runtime option
8354 This function is called through dynamic setConfig callback function
8355 to configure the Roam prefer 5G runtime option
8356 \param hHal - HAL handle for device
8357 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8358 \- return Success or failure
8359 -------------------------------------------------------------------------*/
8360
8361eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8362{
8363 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008364 eHalStatus status = eHAL_STATUS_SUCCESS;
8365
Katya Nigambcb705f2013-12-26 14:26:22 +05308366 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008367 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008368 status = sme_AcquireGlobalLock( &pMac->sme );
8369 if ( HAL_STATUS_SUCCESS( status ) )
8370 {
8371 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8372 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8373 pMac->roam.configParam.nRoamPrefer5GHz,
8374 nRoamPrefer5GHz);
8375 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8376 sme_ReleaseGlobalLock( &pMac->sme );
8377 }
8378
8379 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008380}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008381
8382/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008383 \fn sme_setRoamIntraBand
8384 \brief enable/disable Intra band roaming
8385 This function is called through dynamic setConfig callback function
8386 to configure the intra band roaming
8387 \param hHal - HAL handle for device
8388 \param nRoamIntraBand Enable/Disable Intra band roaming
8389 \- return Success or failure
8390 -------------------------------------------------------------------------*/
8391eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8392{
8393 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8394 eHalStatus status = eHAL_STATUS_SUCCESS;
8395
Katya Nigambcb705f2013-12-26 14:26:22 +05308396 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008397 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008398 status = sme_AcquireGlobalLock( &pMac->sme );
8399 if ( HAL_STATUS_SUCCESS( status ) )
8400 {
8401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8402 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8403 pMac->roam.configParam.nRoamIntraBand,
8404 nRoamIntraBand);
8405 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8406 sme_ReleaseGlobalLock( &pMac->sme );
8407 }
8408
8409 return status ;
8410}
8411
8412/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008413 \fn sme_UpdateRoamScanNProbes
8414 \brief function to update roam scan N probes
8415 This function is called through dynamic setConfig callback function
8416 to update roam scan N probes
8417 \param hHal - HAL handle for device
8418 \param nProbes number of probe requests to be sent out
8419 \- return Success or failure
8420 -------------------------------------------------------------------------*/
8421eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8422{
8423 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8424 eHalStatus status = eHAL_STATUS_SUCCESS;
8425
8426 status = sme_AcquireGlobalLock( &pMac->sme );
8427 if ( HAL_STATUS_SUCCESS( status ) )
8428 {
8429 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8430 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8431 pMac->roam.configParam.nProbes,
8432 nProbes);
8433 pMac->roam.configParam.nProbes = nProbes;
8434 sme_ReleaseGlobalLock( &pMac->sme );
8435 }
8436#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8437 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8438 {
8439 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8440 REASON_NPROBES_CHANGED);
8441 }
8442#endif
8443 return status ;
8444}
8445
8446/* ---------------------------------------------------------------------------
8447 \fn sme_UpdateRoamScanHomeAwayTime
8448 \brief function to update roam scan Home away time
8449 This function is called through dynamic setConfig callback function
8450 to update roam scan home away time
8451 \param hHal - HAL handle for device
8452 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008453 \param bSendOffloadCmd If TRUE then send offload command to firmware
8454 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008455 \- return Success or failure
8456 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008457eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8458 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008459{
8460 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8461 eHalStatus status = eHAL_STATUS_SUCCESS;
8462
8463 status = sme_AcquireGlobalLock( &pMac->sme );
8464 if ( HAL_STATUS_SUCCESS( status ) )
8465 {
8466 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8467 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8468 pMac->roam.configParam.nRoamScanHomeAwayTime,
8469 nRoamScanHomeAwayTime);
8470 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8471 sme_ReleaseGlobalLock( &pMac->sme );
8472 }
8473
8474#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008475 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008476 {
8477 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8478 REASON_HOME_AWAY_TIME_CHANGED);
8479 }
8480#endif
8481 return status;
8482}
8483
8484
8485/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008486 \fn sme_getRoamIntraBand
8487 \brief get Intra band roaming
8488 \param hHal - HAL handle for device
8489 \- return Success or failure
8490 -------------------------------------------------------------------------*/
8491v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8492{
8493 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308494 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008495 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008496 return pMac->roam.configParam.nRoamIntraBand;
8497}
8498
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008499/* ---------------------------------------------------------------------------
8500 \fn sme_getRoamScanNProbes
8501 \brief get N Probes
8502 \param hHal - HAL handle for device
8503 \- return Success or failure
8504 -------------------------------------------------------------------------*/
8505v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8506{
8507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8508 return pMac->roam.configParam.nProbes;
8509}
8510
8511/* ---------------------------------------------------------------------------
8512 \fn sme_getRoamScanHomeAwayTime
8513 \brief get Roam scan home away time
8514 \param hHal - HAL handle for device
8515 \- return Success or failure
8516 -------------------------------------------------------------------------*/
8517v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8518{
8519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8520 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8521}
8522
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008523
8524/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008525 \fn sme_UpdateImmediateRoamRssiDiff
8526 \brief Update nImmediateRoamRssiDiff
8527 This function is called through dynamic setConfig callback function
8528 to configure nImmediateRoamRssiDiff
8529 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8530 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008531 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008532 candidate and current AP.
8533 \- return Success or failure
8534 -------------------------------------------------------------------------*/
8535
8536eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8537{
8538 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008539 eHalStatus status = eHAL_STATUS_SUCCESS;
8540
Katya Nigambcb705f2013-12-26 14:26:22 +05308541 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008542 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008543 status = sme_AcquireGlobalLock( &pMac->sme );
8544 if ( HAL_STATUS_SUCCESS( status ) )
8545 {
8546 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8547 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
8548 nImmediateRoamRssiDiff,
8549 pMac->roam.configParam.nImmediateRoamRssiDiff,
8550 pMac->roam.neighborRoamInfo.neighborRoamState);
8551 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8552 sme_ReleaseGlobalLock( &pMac->sme );
8553 }
8554
8555 return status ;
8556}
8557
8558/* ---------------------------------------------------------------------------
8559 \fn sme_UpdateRoamRssiDiff
8560 \brief Update RoamRssiDiff
8561 This function is called through dynamic setConfig callback function
8562 to configure RoamRssiDiff
8563 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8564 \param hHal - HAL handle for device
8565 \param RoamRssiDiff - minimum rssi difference between potential
8566 candidate and current AP.
8567 \- return Success or failure
8568 -------------------------------------------------------------------------*/
8569
8570eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8571{
8572 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8573 eHalStatus status = eHAL_STATUS_SUCCESS;
8574
8575 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308576 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008577 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008578 if ( HAL_STATUS_SUCCESS( status ) )
8579 {
8580 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8581 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
8582 RoamRssiDiff,
8583 pMac->roam.configParam.RoamRssiDiff,
8584 pMac->roam.neighborRoamInfo.neighborRoamState);
8585 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8586 sme_ReleaseGlobalLock( &pMac->sme );
8587 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008588#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8589 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8590 {
8591 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8592 }
8593#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008594 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008595}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008596
8597/*--------------------------------------------------------------------------
8598 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008599 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008600 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008601 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008602 \param hHal - The handle returned by macOpen.
8603 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8604 Other status means SME is failed to update isFastTransitionEnabled.
8605 \sa
8606 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008607eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008608 v_BOOL_t isFastTransitionEnabled)
8609{
8610 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008611 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008612
Katya Nigambcb705f2013-12-26 14:26:22 +05308613 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008614 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008615 status = sme_AcquireGlobalLock( &pMac->sme );
8616 if ( HAL_STATUS_SUCCESS( status ) )
8617 {
8618 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8619 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8620 pMac->roam.configParam.isFastTransitionEnabled,
8621 isFastTransitionEnabled);
8622 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8623 sme_ReleaseGlobalLock( &pMac->sme );
8624 }
8625
8626 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008627}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008628
8629/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008630 \fn sme_UpdateWESMode
8631 \brief Update WES Mode
8632 This function is called through dynamic setConfig callback function
8633 to configure isWESModeEnabled
8634 \param hHal - HAL handle for device
8635 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8636 Other status means SME is failed to update isWESModeEnabled.
8637 -------------------------------------------------------------------------*/
8638
8639eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8640{
8641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8642 eHalStatus status = eHAL_STATUS_SUCCESS;
8643
8644 status = sme_AcquireGlobalLock( &pMac->sme );
8645 if ( HAL_STATUS_SUCCESS( status ) )
8646 {
8647 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8648 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
8649 isWESModeEnabled,
8650 pMac->roam.configParam.isWESModeEnabled,
8651 pMac->roam.neighborRoamInfo.neighborRoamState);
8652 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8653 sme_ReleaseGlobalLock( &pMac->sme );
8654 }
8655
8656 return status ;
8657}
8658
8659/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008660 \fn sme_SetRoamScanControl
8661 \brief Set roam scan control
8662 This function is called to set roam scan control
8663 if roam scan control is set to 0, roaming scan cache is cleared
8664 any value other than 0 is treated as invalid value
8665 \param hHal - HAL handle for device
8666 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8667 Other status means SME failure to update
8668 -------------------------------------------------------------------------*/
8669eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8670{
8671 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8672 eHalStatus status = eHAL_STATUS_SUCCESS;
8673
Katya Nigambcb705f2013-12-26 14:26:22 +05308674 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008675 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008676 status = sme_AcquireGlobalLock( &pMac->sme );
8677 if ( HAL_STATUS_SUCCESS( status ) )
8678 {
8679 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8680 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
8681 roamScanControl,
8682 pMac->roam.configParam.nRoamScanControl,
8683 pMac->roam.neighborRoamInfo.neighborRoamState);
8684 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8685 if ( 0 == roamScanControl)
8686 {
8687 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8688 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008689 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008690#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8691 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8692 {
8693 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8694 }
8695#endif
8696 }
8697 sme_ReleaseGlobalLock( &pMac->sme );
8698 }
8699 return status ;
8700}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008701#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
8702
8703#ifdef FEATURE_WLAN_LFR
8704/*--------------------------------------------------------------------------
8705 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008706 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008707 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008708 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008709 \param hHal - The handle returned by macOpen.
8710 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8711 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8712 \sa
8713 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008714eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008715 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008716{
8717 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8718
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008719 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8720 {
8721 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8722 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8723 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8724 isFastRoamIniFeatureEnabled);
8725 return eHAL_STATUS_SUCCESS;
8726 }
8727
Srinivas Girigowdade697412013-02-14 16:31:48 -08008728 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8729 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8730 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8731 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008732 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008733 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008734
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008735 return eHAL_STATUS_SUCCESS;
8736}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008737
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008738/*--------------------------------------------------------------------------
8739 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8740 Enable/disable LFR MAWC support at runtime
8741 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8742 isMAWCIniFeatureEnabled.
8743 This is a synchronous call
8744 \param hHal - The handle returned by macOpen.
8745 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8746 Other status means SME is failed to update MAWCEnabled.
8747 \sa
8748 --------------------------------------------------------------------------*/
8749eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8750 const v_BOOL_t MAWCEnabled)
8751{
8752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8753 eHalStatus status = eHAL_STATUS_SUCCESS;
8754
8755 status = sme_AcquireGlobalLock( &pMac->sme );
8756 if ( HAL_STATUS_SUCCESS( status ) )
8757 {
8758 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8759 "%s: MAWCEnabled is changed from %d to %d", __func__,
8760 pMac->roam.configParam.MAWCEnabled,
8761 MAWCEnabled);
8762 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8763 sme_ReleaseGlobalLock( &pMac->sme );
8764 }
8765
8766 return status ;
8767
8768}
8769
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008770#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8771/*--------------------------------------------------------------------------
8772 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8773 This is a synchronuous call
8774 \param hHal - The handle returned by macOpen.
8775 \return eHAL_STATUS_SUCCESS
8776 Other status means SME is failed
8777 \sa
8778 --------------------------------------------------------------------------*/
8779
8780eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8781 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8782{
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 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
8791 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
8792 {
8793 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
8794 }
8795 sme_ReleaseGlobalLock( &pMac->sme );
8796 }
8797
8798 return status;
8799}
8800#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008801#endif /* FEATURE_WLAN_LFR */
8802
8803#ifdef FEATURE_WLAN_CCX
8804/*--------------------------------------------------------------------------
8805 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
8806 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8807 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008808 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008809 \param hHal - The handle returned by macOpen.
8810 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
8811 Other status means SME is failed to update isCcxIniFeatureEnabled.
8812 \sa
8813 --------------------------------------------------------------------------*/
8814
8815eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008816 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008817{
8818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8819
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008820 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
8821 {
8822 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8823 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8824 pMac->roam.configParam.isCcxIniFeatureEnabled,
8825 isCcxIniFeatureEnabled);
8826 return eHAL_STATUS_SUCCESS;
8827 }
8828
Srinivas Girigowdade697412013-02-14 16:31:48 -08008829 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8830 "%s: CcxEnabled is changed from %d to %d", __func__,
8831 pMac->roam.configParam.isCcxIniFeatureEnabled,
8832 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008833 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008834 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008835
8836 if(TRUE == isCcxIniFeatureEnabled)
8837 {
8838 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008839 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07008840
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008841#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8842 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8843 {
8844 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
8845 }
8846#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008847 return eHAL_STATUS_SUCCESS;
8848}
8849#endif /* FEATURE_WLAN_CCX */
8850
8851/*--------------------------------------------------------------------------
8852 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
8853 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8854 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008855 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008856 \param hHal - The handle returned by macOpen.
8857 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
8858 Other status means SME is failed to update fEnableFwRssiMonitoring.
8859 \sa
8860 --------------------------------------------------------------------------*/
8861
8862eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
8863 v_BOOL_t fEnableFwRssiMonitoring)
8864{
8865 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
8866
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008867 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
8868 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
8869 {
8870 halStatus = eHAL_STATUS_FAILURE;
8871 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008872 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008873 }
8874
8875 return (halStatus);
8876}
8877
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008878#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08008879/*--------------------------------------------------------------------------
8880 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
8881 This is a synchronous call
8882 \param hHal - The handle returned by macOpen.
8883 \return eHAL_STATUS_SUCCESS - SME update config successful.
8884 Other status means SME is failed to update
8885 \sa
8886 --------------------------------------------------------------------------*/
8887eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
8888 v_U8_t neighborLookupRssiThreshold)
8889{
8890 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8891 eHalStatus status = eHAL_STATUS_SUCCESS;
8892
8893 status = sme_AcquireGlobalLock( &pMac->sme );
8894 if ( HAL_STATUS_SUCCESS( status ) )
8895 {
8896 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
8897 if (HAL_STATUS_SUCCESS(status))
8898 {
8899 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8900 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
8901 neighborLookupRssiThreshold,
8902 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
8903 pMac->roam.neighborRoamInfo.neighborRoamState);
8904 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
8905 neighborLookupRssiThreshold;
8906 }
8907 sme_ReleaseGlobalLock( &pMac->sme );
8908 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008909 return status;
8910}
8911
8912/*--------------------------------------------------------------------------
8913 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
8914 This is a synchronous call
8915 \param hHal - The handle returned by macOpen.
8916 \return eHAL_STATUS_SUCCESS - SME update config successful.
8917 Other status means SME is failed to update
8918 \sa
8919 --------------------------------------------------------------------------*/
8920eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
8921 v_U8_t neighborReassocRssiThreshold)
8922{
8923 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8924 eHalStatus status = eHAL_STATUS_SUCCESS;
8925
8926 status = sme_AcquireGlobalLock( &pMac->sme );
8927 if ( HAL_STATUS_SUCCESS( status ) )
8928 {
8929 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8930 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
8931 neighborReassocRssiThreshold,
8932 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
8933 pMac->roam.neighborRoamInfo.neighborRoamState);
8934 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
8935 neighborReassocRssiThreshold;
8936 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
8937 neighborReassocRssiThreshold;
8938 sme_ReleaseGlobalLock( &pMac->sme );
8939 }
8940
8941 return status ;
8942}
8943
8944
8945/*--------------------------------------------------------------------------
8946 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
8947 This is a synchronous call
8948 \param hHal - The handle returned by macOpen.
8949 \return eHAL_STATUS_SUCCESS - SME update config successful.
8950 Other status means SME is failed to update
8951 \sa
8952 --------------------------------------------------------------------------*/
8953v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
8954{
8955 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8956 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
8957}
8958
8959/*--------------------------------------------------------------------------
8960 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
8961 This is a synchronous call
8962 \param hHal - The handle returned by macOpen.
8963 \return eHAL_STATUS_SUCCESS - SME update config successful.
8964 Other status means SME is failed to update
8965 \sa
8966 --------------------------------------------------------------------------*/
8967eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
8968 v_U16_t neighborScanResultsRefreshPeriod)
8969{
8970 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8971 eHalStatus status = eHAL_STATUS_SUCCESS;
8972
8973 status = sme_AcquireGlobalLock( &pMac->sme );
8974 if ( HAL_STATUS_SUCCESS( status ) )
8975 {
8976 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8977 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
8978 neighborScanResultsRefreshPeriod,
8979 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
8980 pMac->roam.neighborRoamInfo.neighborRoamState);
8981 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
8982 neighborScanResultsRefreshPeriod;
8983 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
8984 neighborScanResultsRefreshPeriod;
8985
8986 sme_ReleaseGlobalLock( &pMac->sme );
8987 }
8988
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008989#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8990 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8991 {
8992 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8993 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
8994 }
8995#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008996 return status ;
8997}
8998
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008999#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9000/*--------------------------------------------------------------------------
9001 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9002 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9003 gRoamScanOffloadEnabled.
9004 This is a synchronous call
9005 \param hHal - The handle returned by macOpen.
9006 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9007 Other status means SME is failed to update.
9008 \sa
9009 --------------------------------------------------------------------------*/
9010
9011eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9012 v_BOOL_t nRoamScanOffloadEnabled)
9013{
9014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9015 eHalStatus status = eHAL_STATUS_SUCCESS;
9016
9017 status = sme_AcquireGlobalLock( &pMac->sme );
9018 if ( HAL_STATUS_SUCCESS( status ) )
9019 {
9020 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9021 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9022 pMac->roam.configParam.isRoamOffloadScanEnabled,
9023 nRoamScanOffloadEnabled);
9024 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9025 sme_ReleaseGlobalLock( &pMac->sme );
9026 }
9027
9028 return status ;
9029}
9030#endif
9031
Srinivas Girigowdade697412013-02-14 16:31:48 -08009032/*--------------------------------------------------------------------------
9033 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9034 This is a synchronous call
9035 \param hHal - The handle returned by macOpen.
9036 \return v_U16_t - Neighbor scan results refresh period value
9037 \sa
9038 --------------------------------------------------------------------------*/
9039v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9040{
9041 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9042 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9043}
9044
9045/*--------------------------------------------------------------------------
9046 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9047 This is a synchronuous call
9048 \param hHal - The handle returned by macOpen.
9049 \return eHAL_STATUS_SUCCESS - SME update config successful.
9050 Other status means SME is failed to update
9051 \sa
9052 --------------------------------------------------------------------------*/
9053v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9054{
9055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9056 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9057}
9058
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009059/* ---------------------------------------------------------------------------
9060 \fn sme_UpdateEmptyScanRefreshPeriod
9061 \brief Update nEmptyScanRefreshPeriod
9062 This function is called through dynamic setConfig callback function
9063 to configure nEmptyScanRefreshPeriod
9064 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9065 \param hHal - HAL handle for device
9066 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9067 \- return Success or failure
9068 -------------------------------------------------------------------------*/
9069
9070eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9071{
9072 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9073 eHalStatus status = eHAL_STATUS_SUCCESS;
9074
9075 status = sme_AcquireGlobalLock( &pMac->sme );
9076 if ( HAL_STATUS_SUCCESS( status ) )
9077 {
9078 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9079 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
9080 nEmptyScanRefreshPeriod,
9081 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
9082 pMac->roam.neighborRoamInfo.neighborRoamState);
9083 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9084 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9085 sme_ReleaseGlobalLock( &pMac->sme );
9086 }
9087
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009088#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9089 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9090 {
9091 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9092 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9093 }
9094#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009095 return status ;
9096}
9097
9098/* ---------------------------------------------------------------------------
9099 \fn sme_setNeighborScanMinChanTime
9100 \brief Update nNeighborScanMinChanTime
9101 This function is called through dynamic setConfig callback function
9102 to configure gNeighborScanChannelMinTime
9103 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9104 \param hHal - HAL handle for device
9105 \param nNeighborScanMinChanTime - Channel minimum dwell time
9106 \- return Success or failure
9107 -------------------------------------------------------------------------*/
9108eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9109{
9110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9111 eHalStatus status = eHAL_STATUS_SUCCESS;
9112
9113 status = sme_AcquireGlobalLock( &pMac->sme );
9114 if ( HAL_STATUS_SUCCESS( status ) )
9115 {
9116 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9117 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
9118 nNeighborScanMinChanTime,
9119 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
9120 pMac->roam.neighborRoamInfo.neighborRoamState);
9121 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9122 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9123 sme_ReleaseGlobalLock( &pMac->sme );
9124 }
9125
9126 return status ;
9127}
9128
9129/* ---------------------------------------------------------------------------
9130 \fn sme_setNeighborScanMaxChanTime
9131 \brief Update nNeighborScanMaxChanTime
9132 This function is called through dynamic setConfig callback function
9133 to configure gNeighborScanChannelMaxTime
9134 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9135 \param hHal - HAL handle for device
9136 \param nNeighborScanMinChanTime - Channel maximum dwell time
9137 \- return Success or failure
9138 -------------------------------------------------------------------------*/
9139eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9140{
9141 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9142 eHalStatus status = eHAL_STATUS_SUCCESS;
9143
9144 status = sme_AcquireGlobalLock( &pMac->sme );
9145 if ( HAL_STATUS_SUCCESS( status ) )
9146 {
9147 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9148 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
9149 nNeighborScanMaxChanTime,
9150 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
9151 pMac->roam.neighborRoamInfo.neighborRoamState);
9152 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9153 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9154 sme_ReleaseGlobalLock( &pMac->sme );
9155 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009156#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9157 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9158 {
9159 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9160 REASON_SCAN_CH_TIME_CHANGED);
9161 }
9162#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009163
9164 return status ;
9165}
9166
9167/* ---------------------------------------------------------------------------
9168 \fn sme_getNeighborScanMinChanTime
9169 \brief get neighbor scan min channel time
9170 \param hHal - The handle returned by macOpen.
9171 \return v_U16_t - channel min time value
9172 -------------------------------------------------------------------------*/
9173v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9174{
9175 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9176 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9177}
9178
9179/* ---------------------------------------------------------------------------
9180 \fn sme_getNeighborScanMaxChanTime
9181 \brief get neighbor scan max channel time
9182 \param hHal - The handle returned by macOpen.
9183 \return v_U16_t - channel max time value
9184 -------------------------------------------------------------------------*/
9185v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9186{
9187 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9188 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9189}
9190
9191/* ---------------------------------------------------------------------------
9192 \fn sme_setNeighborScanPeriod
9193 \brief Update nNeighborScanPeriod
9194 This function is called through dynamic setConfig callback function
9195 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009196 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009197 \param hHal - HAL handle for device
9198 \param nNeighborScanPeriod - neighbor scan period
9199 \- return Success or failure
9200 -------------------------------------------------------------------------*/
9201eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9202{
9203 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9204 eHalStatus status = eHAL_STATUS_SUCCESS;
9205
9206 status = sme_AcquireGlobalLock( &pMac->sme );
9207 if ( HAL_STATUS_SUCCESS( status ) )
9208 {
9209 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9210 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
9211 nNeighborScanPeriod,
9212 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
9213 pMac->roam.neighborRoamInfo.neighborRoamState);
9214 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9215 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9216 sme_ReleaseGlobalLock( &pMac->sme );
9217 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009218#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9219 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9220 {
9221 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9222 REASON_SCAN_HOME_TIME_CHANGED);
9223 }
9224#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009225
9226 return status ;
9227}
9228
9229/* ---------------------------------------------------------------------------
9230 \fn sme_getNeighborScanPeriod
9231 \brief get neighbor scan period
9232 \param hHal - The handle returned by macOpen.
9233 \return v_U16_t - neighbor scan period
9234 -------------------------------------------------------------------------*/
9235v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9236{
9237 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9238 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9239}
9240
9241#endif
9242
Srinivas Girigowdade697412013-02-14 16:31:48 -08009243#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009244
Srinivas Girigowdade697412013-02-14 16:31:48 -08009245/*--------------------------------------------------------------------------
9246 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9247 This is a synchronous call
9248 \param hHal - The handle returned by macOpen.
9249 \return v_U16_t - Rssi diff value
9250 \sa
9251 --------------------------------------------------------------------------*/
9252v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9253{
9254 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9255 return pMac->roam.configParam.RoamRssiDiff;
9256}
9257
9258/*--------------------------------------------------------------------------
9259 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9260 This is a synchronous call
9261 \param hHal - The handle returned by macOpen.
9262 \return eHAL_STATUS_SUCCESS - SME update config successful.
9263 Other status means SME is failed to update
9264 \sa
9265 --------------------------------------------------------------------------*/
9266eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9267 tANI_U8 numChannels)
9268{
9269 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9270 eHalStatus status = eHAL_STATUS_SUCCESS;
9271 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009272 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309273 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009274 tANI_U8 i = 0, j = 0;
9275
9276 status = sme_AcquireGlobalLock( &pMac->sme );
9277 if ( HAL_STATUS_SUCCESS( status ) )
9278 {
9279 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9280 {
9281 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9282 {
9283 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9284 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9285 }
9286 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009287 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009288 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009289 sme_SetRoamScanControl(hHal, 1);
9290 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009291 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009292 j = 0;
9293 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009294 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009295 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9296 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009297 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009298 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009299
9300 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9301 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
9302 newChannelList, oldChannelList,
9303 pMac->roam.neighborRoamInfo.neighborRoamState);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009304 sme_ReleaseGlobalLock( &pMac->sme );
9305 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009306#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9307 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9308 {
9309 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9310 }
9311#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009312
9313 return status ;
9314}
9315
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009316
9317#ifdef FEATURE_WLAN_CCX_UPLOAD
9318/*--------------------------------------------------------------------------
9319 \brief sme_SetCcxRoamScanChannelList() - set ccx roam scan channel list
9320 This is a synchronuous call
9321 \param hHal - The handle returned by macOpen.
9322 \return eHAL_STATUS_SUCCESS - SME update config successful.
9323 Other status means SME is failed to update
9324 \sa
9325 --------------------------------------------------------------------------*/
9326eHalStatus sme_SetCcxRoamScanChannelList(tHalHandle hHal,
9327 tANI_U8 *pChannelList,
9328 tANI_U8 numChannels)
9329{
9330 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9331 eHalStatus status = eHAL_STATUS_SUCCESS;
9332 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9333 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9334 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9335 tANI_U8 newChannelList[128] = {0};
9336 tANI_U8 i = 0, j = 0;
9337
9338 status = sme_AcquireGlobalLock( &pMac->sme );
9339 if ( HAL_STATUS_SUCCESS( status ) )
9340 {
9341 if (NULL != currChannelListInfo->ChannelList)
9342 {
9343 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9344 {
9345 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9346 currChannelListInfo->ChannelList[i]);
9347 }
9348 }
9349 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9350
9351 if ( HAL_STATUS_SUCCESS( status ))
9352 {
9353 if (NULL != currChannelListInfo->ChannelList)
9354 {
9355 j = 0;
9356 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9357 {
9358 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9359 currChannelListInfo->ChannelList[i]);
9360 }
9361 }
9362
9363 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9364 "CCX roam scan channel list successfully set to %s - old value is %s - roam state is %d",
9365 newChannelList, oldChannelList,
9366 pMac->roam.neighborRoamInfo.neighborRoamState);
9367 }
9368 sme_ReleaseGlobalLock( &pMac->sme );
9369 }
9370#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9371 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9372 {
9373 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9374 }
9375#endif
9376
9377 return status ;
9378}
9379#endif
9380
Srinivas Girigowdade697412013-02-14 16:31:48 -08009381/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009382 \brief sme_getRoamScanChannelList() - get roam scan channel list
9383 This is a synchronous call
9384 \param hHal - The handle returned by macOpen.
9385 \return eHAL_STATUS_SUCCESS - SME update config successful.
9386 Other status means SME is failed to update
9387 \sa
9388 --------------------------------------------------------------------------*/
9389eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9390 tANI_U8 *pNumChannels)
9391{
9392 int i = 0;
9393 tANI_U8 *pOutPtr = pChannelList;
9394 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9395 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9396 eHalStatus status = eHAL_STATUS_SUCCESS;
9397
9398 status = sme_AcquireGlobalLock( &pMac->sme );
9399 if ( HAL_STATUS_SUCCESS( status ) )
9400 {
9401 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9402 {
9403 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9404 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009405 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009406 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009407 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009408 }
9409
9410 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9411 for (i = 0; i < (*pNumChannels); i++)
9412 {
9413 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9414 }
9415 pOutPtr[i] = '\0';
9416 sme_ReleaseGlobalLock( &pMac->sme );
9417 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009418 return status ;
9419}
9420
9421/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009422 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
9423 This is a synchronuous call
9424 \param hHal - The handle returned by macOpen.
9425 \return TRUE (1) - if the CCX feature is enabled
9426 FALSE (0) - if feature is disabled (compile or runtime)
9427 \sa
9428 --------------------------------------------------------------------------*/
9429tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009430{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009431#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08009432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009433 return csrRoamIsCcxIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009434#else
9435 return eANI_BOOLEAN_FALSE;
9436#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009437}
9438
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009439/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009440 \brief sme_GetWESMode() - get WES Mode
9441 This is a synchronous call
9442 \param hHal - The handle returned by macOpen
9443 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9444 \sa
9445 --------------------------------------------------------------------------*/
9446v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9447{
9448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9449 return pMac->roam.configParam.isWESModeEnabled;
9450}
9451
9452/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009453 \brief sme_GetRoamScanControl() - get scan control
9454 This is a synchronous call
9455 \param hHal - The handle returned by macOpen.
9456 \return v_BOOL_t - Enabled(1)/Disabled(0)
9457 \sa
9458 --------------------------------------------------------------------------*/
9459v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9460{
9461 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9462 return pMac->roam.configParam.nRoamScanControl;
9463}
9464#endif
9465
9466/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009467 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9468 This is a synchronuous call
9469 \param hHal - The handle returned by macOpen.
9470 \return TRUE (1) - if the feature is enabled
9471 FALSE (0) - if feature is disabled (compile or runtime)
9472 \sa
9473 --------------------------------------------------------------------------*/
9474tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9475{
9476#ifdef FEATURE_WLAN_LFR
9477 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9478 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9479#else
9480 return eANI_BOOLEAN_FALSE;
9481#endif
9482}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009483
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009484/*--------------------------------------------------------------------------
9485 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9486 This is a synchronuous call
9487 \param hHal - The handle returned by macOpen.
9488 \return TRUE (1) - if the feature is enabled
9489 FALSE (0) - if feature is disabled (compile or runtime)
9490 \sa
9491 --------------------------------------------------------------------------*/
9492tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9493{
9494#ifdef WLAN_FEATURE_VOWIFI_11R
9495 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9496 return pMac->roam.configParam.isFastTransitionEnabled;
9497#else
9498 return eANI_BOOLEAN_FALSE;
9499#endif
9500}
9501
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009502/* ---------------------------------------------------------------------------
9503 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009504
Kiet Lam0f320422013-11-21 19:29:17 +05309505 \brief Check if a feature is enabled by FW
9506
9507 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009508
Kiet Lam0f320422013-11-21 19:29:17 +05309509 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009510 -------------------------------------------------------------------------*/
9511tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9512{
9513 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9514}
Kiet Lam0f320422013-11-21 19:29:17 +05309515
9516/* ---------------------------------------------------------------------------
9517 \fn sme_IsFeatureSupportedByDriver
9518 \brief Check if a feature is enabled by Driver
9519
9520 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9521 \- return 1/0 (TRUE/FALSE)
9522 -------------------------------------------------------------------------*/
9523
9524tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9525{
9526 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9527}
9528
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009529#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309530
9531/* ---------------------------------------------------------------------------
9532 \fn sme_SendTdlsMgmtFrame
9533 \brief API to send TDLS management frames.
9534
9535 \param peerMac - peer's Mac Adress.
9536 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9537 \- return VOS_STATUS_SUCCES
9538 -------------------------------------------------------------------------*/
9539VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9540 tANI_U8 sessionId,
9541 tSirMacAddr peerMac,
9542 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9543{
9544 eHalStatus status = eHAL_STATUS_SUCCESS;
9545 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9546
9547 status = sme_AcquireGlobalLock( &pMac->sme );
9548
9549 if ( HAL_STATUS_SUCCESS( status ) )
9550 {
9551 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9552 sme_ReleaseGlobalLock( &pMac->sme );
9553 }
9554 return status ;
9555}
9556
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009557/* ---------------------------------------------------------------------------
9558 \fn sme_SendTdlsMgmtFrame
9559 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009560
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009561 \param peerMac - peer's Mac Adress.
9562 \param frame_type - Type of TDLS mgmt frame to be sent.
9563 \param dialog - dialog token used in the frame.
9564 \param status - status to be incuded in the frame.
9565 \param buf - additional IEs to be included
9566 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009567 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009568 \- return VOS_STATUS_SUCCES
9569 -------------------------------------------------------------------------*/
9570VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08009571 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 -08009572{
9573 eHalStatus status = eHAL_STATUS_SUCCESS;
9574 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9575 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9576
9577 status = sme_AcquireGlobalLock( &pMac->sme );
9578 if ( HAL_STATUS_SUCCESS( status ) )
9579 {
9580 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9581 sendTdlsReq.frameType = frame_type;
9582 sendTdlsReq.buf = buf;
9583 sendTdlsReq.len = len;
9584 sendTdlsReq.dialog = dialog;
9585 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009586 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009587
9588 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9589
9590 sme_ReleaseGlobalLock( &pMac->sme );
9591 }
9592
9593 return status ;
9594
9595}
9596/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009597 \fn sme_ChangeTdlsPeerSta
9598 \brief API to Update TDLS peer sta parameters.
9599
9600 \param peerMac - peer's Mac Adress.
9601 \param staParams - Peer Station Parameters
9602 \- return VOS_STATUS_SUCCES
9603 -------------------------------------------------------------------------*/
9604VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9605 tCsrStaParams *pstaParams)
9606{
9607 eHalStatus status = eHAL_STATUS_SUCCESS;
9608 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9609
9610 status = sme_AcquireGlobalLock( &pMac->sme );
9611 if ( HAL_STATUS_SUCCESS( status ) )
9612 {
9613 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9614
9615 sme_ReleaseGlobalLock( &pMac->sme );
9616 }
9617
9618 return status ;
9619
9620}
9621
9622/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009623 \fn sme_AddTdlsPeerSta
9624 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009625
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009626 \param peerMac - peer's Mac Adress.
9627 \- return VOS_STATUS_SUCCES
9628 -------------------------------------------------------------------------*/
9629VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9630{
9631 eHalStatus status = eHAL_STATUS_SUCCESS;
9632 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9633
9634 status = sme_AcquireGlobalLock( &pMac->sme );
9635 if ( HAL_STATUS_SUCCESS( status ) )
9636 {
9637 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9638
9639 sme_ReleaseGlobalLock( &pMac->sme );
9640 }
9641
9642 return status ;
9643
9644}
9645/* ---------------------------------------------------------------------------
9646 \fn sme_DeleteTdlsPeerSta
9647 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009648
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009649 \param peerMac - peer's Mac Adress.
9650 \- return VOS_STATUS_SUCCES
9651 -------------------------------------------------------------------------*/
9652VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9653{
9654 eHalStatus status = eHAL_STATUS_SUCCESS;
9655 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9656
9657 status = sme_AcquireGlobalLock( &pMac->sme );
9658 if ( HAL_STATUS_SUCCESS( status ) )
9659 {
9660 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9661
9662 sme_ReleaseGlobalLock( &pMac->sme );
9663 }
9664
9665 return status ;
9666
9667}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009668/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009669 \fn sme_SetTdlsPowerSaveProhibited
9670 \API to set/reset the isTdlsPowerSaveProhibited.
9671
9672 \- return void
9673 -------------------------------------------------------------------------*/
9674void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9675{
9676 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9677
9678 pMac->isTdlsPowerSaveProhibited = val;
9679 return;
9680}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009681#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309682/* ---------------------------------------------------------------------------
9683 \fn sme_IsPmcBmps
9684 \API to Check if PMC state is BMPS.
9685
9686 \- return v_BOOL_t
9687 -------------------------------------------------------------------------*/
9688v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9689{
9690 return (BMPS == pmcGetPmcState(hHal));
9691}
9692
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009693#ifdef FEATURE_WLAN_TDLS_INTERNAL
9694/*
9695 * SME API to start TDLS discovery Procedure
9696 */
9697VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9698{
9699 VOS_STATUS status = VOS_STATUS_SUCCESS;
9700 tCsrTdlsDisRequest disReq = {{0}} ;
9701 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9702 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9703
9704 return status ;
9705
9706}
9707
9708/*
9709 * Process TDLS discovery results
9710 */
9711v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9712 tSmeTdlsDisResult *disResult, v_U8_t listType)
9713{
9714 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9715 tSirTdlsPeerInfo *peerInfo = NULL ;
9716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9717 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9718 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9719 tListElem *pEntry = NULL ;
9720 v_U8_t peerCnt = 0 ;
9721
9722 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009723 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009724 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9725 while(pEntry)
9726 {
9727 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9728 tdlsPeerStaLink) ;
9729 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9730
9731 switch(listType)
9732 {
9733 case TDLS_SETUP_LIST:
9734 {
9735 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9736 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309737 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9738 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009739 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9740 peerCnt++ ;
9741 }
9742 break ;
9743 }
9744 case TDLS_DIS_LIST:
9745 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309746 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9747 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009748 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9749 peerCnt++ ;
9750 break ;
9751 }
9752 default:
9753 {
9754 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009755 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009756 break ;
9757 }
9758 }
9759
9760 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
9761 }
9762
9763 return peerCnt ;
9764
9765}
9766
9767/*
9768 * SME API to start TDLS link setup Procedure.
9769 */
9770VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9771{
9772 VOS_STATUS status = VOS_STATUS_SUCCESS;
9773 tCsrTdlsSetupRequest setupReq = {{0}} ;
9774 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9775 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
9776 return status ;
9777
9778}
9779
9780/*
9781 * SME API to start TDLS link Teardown Procedure.
9782 */
9783VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9784{
9785 VOS_STATUS status = VOS_STATUS_SUCCESS;
9786 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
9787 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9788 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
9789 return status ;
9790
9791}
9792
9793#endif /* FEATURE_WLAN_TDLS */
9794
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07009795eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
9796{
9797 eHalStatus status = eHAL_STATUS_FAILURE;
9798 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9799
9800 smsLog(pMac, LOG2, FL("enter"));
9801 status = sme_AcquireGlobalLock( &pMac->sme );
9802 if ( HAL_STATUS_SUCCESS( status ) )
9803 {
9804 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
9805 sme_ReleaseGlobalLock( &pMac->sme );
9806 }
9807 smsLog(pMac, LOG2, FL("exit status %d"), status);
9808
9809 return (status);
9810}
9811
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07009812/*
9813 * SME API to enable/disable WLAN driver initiated SSR
9814 */
9815void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
9816{
9817 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9818 eHalStatus status = eHAL_STATUS_SUCCESS;
9819
9820 status = sme_AcquireGlobalLock(&pMac->sme);
9821 if (HAL_STATUS_SUCCESS(status))
9822 {
9823 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9824 "SSR level is changed %d", enableSSR);
9825 /* not serializing this messsage, as this is only going
9826 * to set a variable in WDA/WDI
9827 */
9828 WDA_SetEnableSSR(enableSSR);
9829 sme_ReleaseGlobalLock(&pMac->sme);
9830 }
9831 return;
9832}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009833
9834/*
9835 * SME API to determine the channel bonding mode
9836 */
9837VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
9838{
9839 tSmeConfigParams smeConfig;
9840 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9841
9842 if (
9843#ifdef WLAN_FEATURE_11AC
9844 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
9845 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
9846#endif
9847 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
9848 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
9849 )
9850 {
9851 return VOS_STATUS_SUCCESS;
9852 }
9853
9854 /* If channel bonding mode is not required */
9855 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
9856 return VOS_STATUS_SUCCESS;
9857 }
9858
9859 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
9860 sme_GetConfigParam(pMac, &smeConfig);
9861
9862#ifdef WLAN_FEATURE_11AC
9863 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
9864 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
9865 {
9866 if ( channel== 36 || channel == 52 || channel == 100 ||
9867 channel == 116 || channel == 149 )
9868 {
9869 smeConfig.csrConfig.channelBondingMode5GHz =
9870 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
9871 }
9872 else if ( channel == 40 || channel == 56 || channel == 104 ||
9873 channel == 120 || channel == 153 )
9874 {
9875 smeConfig.csrConfig.channelBondingMode5GHz =
9876 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
9877 }
9878 else if ( channel == 44 || channel == 60 || channel == 108 ||
9879 channel == 124 || channel == 157 )
9880 {
9881 smeConfig.csrConfig.channelBondingMode5GHz =
9882 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
9883 }
9884 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -08009885 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009886 {
9887 smeConfig.csrConfig.channelBondingMode5GHz =
9888 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
9889 }
9890 else if ( channel == 165 )
9891 {
9892 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9893 }
9894 }
9895#endif
9896
9897 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
9898 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
9899 {
9900 if ( channel== 40 || channel == 48 || channel == 56 ||
9901 channel == 64 || channel == 104 || channel == 112 ||
9902 channel == 120 || channel == 128 || channel == 136 ||
9903 channel == 144 || channel == 153 || channel == 161 )
9904 {
9905 smeConfig.csrConfig.channelBondingMode5GHz = 1;
9906 }
9907 else if ( channel== 36 || channel == 44 || channel == 52 ||
9908 channel == 60 || channel == 100 || channel == 108 ||
9909 channel == 116 || channel == 124 || channel == 132 ||
9910 channel == 140 || channel == 149 || channel == 157 )
9911 {
9912 smeConfig.csrConfig.channelBondingMode5GHz = 2;
9913 }
9914 else if ( channel == 165 )
9915 {
9916 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9917 }
9918 }
9919 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonce8ad512013-10-30 12:34:42 -07009920 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009921
9922 sme_UpdateConfig (pMac, &smeConfig);
9923 return VOS_STATUS_SUCCESS;
9924}
9925
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07009926/*--------------------------------------------------------------------------
9927
9928 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
9929 \param hHal - The handle returned by macOpen.
9930 \param currDeviceMode - Current operating device mode.
9931 --------------------------------------------------------------------------*/
9932
9933void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
9934{
9935 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9936 pMac->sme.currDeviceMode = currDeviceMode;
9937 return;
9938}
9939
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07009940#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9941/*--------------------------------------------------------------------------
9942 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
9943 from CSR.
9944 This is a synchronous call
9945 \param hHal - The handle returned by macOpen
9946 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
9947 BSSID, channel etc.)
9948 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
9949 Other status means SME is failed to send the request.
9950 \sa
9951 --------------------------------------------------------------------------*/
9952
9953eHalStatus sme_HandoffRequest(tHalHandle hHal,
9954 tCsrHandoffRequest *pHandoffInfo)
9955{
9956 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9957 eHalStatus status = eHAL_STATUS_SUCCESS;
9958
9959 status = sme_AcquireGlobalLock( &pMac->sme );
9960 if ( HAL_STATUS_SUCCESS( status ) )
9961 {
9962 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9963 "%s: invoked", __func__);
9964 status = csrHandoffRequest(pMac, pHandoffInfo);
9965 sme_ReleaseGlobalLock( &pMac->sme );
9966 }
9967
9968 return status ;
9969}
9970#endif
9971
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07009972/*
9973 * SME API to check if there is any infra station or
9974 * P2P client is connected
9975 */
9976VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
9977{
9978 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9979 if(csrIsInfraConnected(pMac))
9980 {
9981 return VOS_STATUS_SUCCESS;
9982 }
9983 return VOS_STATUS_E_FAILURE;
9984}
9985
Leo Chang9056f462013-08-01 19:21:11 -07009986
9987#ifdef FEATURE_WLAN_LPHB
9988/* ---------------------------------------------------------------------------
9989 \fn sme_LPHBConfigReq
9990 \API to make configuration LPHB within FW.
9991 \param hHal - The handle returned by macOpen
9992 \param lphdReq - LPHB request argument by client
9993 \param pCallbackfn - LPHB timeout notification callback function pointer
9994 \- return Configuration message posting status, SUCCESS or Fail
9995 -------------------------------------------------------------------------*/
9996eHalStatus sme_LPHBConfigReq
9997(
9998 tHalHandle hHal,
9999 tSirLPHBReq *lphdReq,
10000 void (*pCallbackfn)(void *pAdapter, void *indParam)
10001)
10002{
10003 eHalStatus status = eHAL_STATUS_SUCCESS;
10004 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10005 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10006 vos_msg_t vosMessage;
10007
10008 status = sme_AcquireGlobalLock(&pMac->sme);
10009 if (eHAL_STATUS_SUCCESS == status)
10010 {
10011 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10012 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010013 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010014 {
10015 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10016 "%s: Indication Call back did not registered", __func__);
10017 sme_ReleaseGlobalLock(&pMac->sme);
10018 return eHAL_STATUS_FAILURE;
10019 }
10020 else if (NULL != pCallbackfn)
10021 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010022 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010023 }
10024
10025 /* serialize the req through MC thread */
10026 vosMessage.bodyptr = lphdReq;
10027 vosMessage.type = WDA_LPHB_CONF_REQ;
10028 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10029 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10030 {
10031 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10032 "%s: Post Config LPHB MSG fail", __func__);
10033 status = eHAL_STATUS_FAILURE;
10034 }
10035 sme_ReleaseGlobalLock(&pMac->sme);
10036 }
10037
10038 return(status);
10039}
10040#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010041/*--------------------------------------------------------------------------
10042 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10043 scan parameter.
10044 This is a synchronous call
10045 \param hHal - The handle returned by macOpen
10046 \return NONE.
10047 \sa
10048 --------------------------------------------------------------------------*/
10049void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10050 tANI_U8 nNumP2PChan)
10051{
10052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10053
10054 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10055 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10056
10057 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10058 "%s: SCAN nNumStaChanCombinedConc : %d,"
10059 "nNumP2PChanCombinedConc : %d ",
10060 __func__, nNumStaChan, nNumP2PChan);
10061
10062 return;
10063
10064}
Leo Chang9056f462013-08-01 19:21:11 -070010065
Yue Mab9c86f42013-08-14 15:59:08 -070010066/* ---------------------------------------------------------------------------
10067 \fn sme_AddPeriodicTxPtrn
10068 \brief API to Periodic TX Pattern Offload feature
10069 \param hHal - The handle returned by macOpen
10070 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10071 \return eHalStatus
10072 ---------------------------------------------------------------------------*/
10073eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10074 *addPeriodicTxPtrnParams)
10075{
10076 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10077 eHalStatus status;
10078 vos_msg_t msg;
10079
10080 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10081 {
10082 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10083 msg.bodyptr = addPeriodicTxPtrnParams;
10084
10085 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10086 {
10087 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10088 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10089 __func__);
10090
10091 sme_ReleaseGlobalLock(&pMac->sme);
10092 return eHAL_STATUS_FAILURE;
10093 }
10094
10095 sme_ReleaseGlobalLock(&pMac->sme);
10096 return eHAL_STATUS_SUCCESS;
10097 }
10098
10099 return status;
10100}
10101
10102/* ---------------------------------------------------------------------------
10103 \fn sme_DelPeriodicTxPtrn
10104 \brief API to Periodic TX Pattern Offload feature
10105 \param hHal - The handle returned by macOpen
10106 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10107 \return eHalStatus
10108 ---------------------------------------------------------------------------*/
10109eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10110 *delPeriodicTxPtrnParams)
10111{
10112 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10113 eHalStatus status;
10114 vos_msg_t msg;
10115
10116 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10117 {
10118 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10119 msg.bodyptr = delPeriodicTxPtrnParams;
10120
10121 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10122 {
10123 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10124 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10125 __func__);
10126
10127 sme_ReleaseGlobalLock(&pMac->sme);
10128 return eHAL_STATUS_FAILURE;
10129 }
10130
10131 sme_ReleaseGlobalLock(&pMac->sme);
10132 return eHAL_STATUS_SUCCESS;
10133 }
10134
10135 return status;
10136}
10137
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010138void smeGetCommandQStatus( tHalHandle hHal )
10139{
10140 tSmeCmd *pTempCmd = NULL;
10141 tListElem *pEntry;
10142 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10143
10144 if (NULL == pMac)
10145 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010146 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10147 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010148 return;
10149 }
10150
10151 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10152 if( pEntry )
10153 {
10154 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10155 }
10156 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10157 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10158 if(pTempCmd)
10159 {
10160 if( eSmeCsrCommandMask & pTempCmd->command )
10161 {
10162 //CSR command is stuck. See what the reason code is for that command
10163 dumpCsrCommandInfo(pMac, pTempCmd);
10164 }
10165 } //if(pTempCmd)
10166
10167 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10168 csrLLCount(&pMac->sme.smeCmdPendingList));
10169
10170 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10171 csrLLCount(&pMac->roam.roamCmdPendingList));
10172
10173 return;
10174}
Rajeev79dbe4c2013-10-05 11:03:42 +053010175
10176#ifdef FEATURE_WLAN_BATCH_SCAN
10177/* ---------------------------------------------------------------------------
10178 \fn sme_SetBatchScanReq
10179 \brief API to set batch scan request in FW
10180 \param hHal - The handle returned by macOpen.
10181 \param pRequest - Pointer to the batch request.
10182 \param sessionId - session ID
10183 \param callbackRoutine - HDD callback which needs to be invoked after
10184 getting set batch scan response from FW
10185 \param callbackContext - pAdapter context
10186 \return eHalStatus
10187 ---------------------------------------------------------------------------*/
10188eHalStatus sme_SetBatchScanReq
10189(
10190 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10191 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10192 void *callbackContext
10193)
10194{
10195 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10196 eHalStatus status;
10197
10198 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10199 {
10200 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10201 callbackContext);
10202 sme_ReleaseGlobalLock( &pMac->sme );
10203 }
10204
10205 return status;
10206}
10207
10208/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010209 \fn sme_SendRateUpdateInd
10210 \brief API to Update rate
10211 \param hHal - The handle returned by macOpen
10212 \param rateUpdateParams - Pointer to rate update params
10213 \return eHalStatus
10214 ---------------------------------------------------------------------------*/
10215eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10216{
10217 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10218 eHalStatus status;
10219 vos_msg_t msg;
10220
10221 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10222 {
10223 msg.type = WDA_RATE_UPDATE_IND;
10224 msg.bodyptr = rateUpdateParams;
10225
10226 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10227 {
10228 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10229 "to post WDA_SET_RMC_RATE_IND to WDA!",
10230 __func__);
10231
10232 sme_ReleaseGlobalLock(&pMac->sme);
10233 return eHAL_STATUS_FAILURE;
10234 }
10235
10236 sme_ReleaseGlobalLock(&pMac->sme);
10237 return eHAL_STATUS_SUCCESS;
10238 }
10239
10240 return status;
10241}
10242
10243/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010244 \fn sme_TriggerBatchScanResultInd
10245 \brief API to trigger batch scan result indications from FW
10246 \param hHal - The handle returned by macOpen.
10247 \param pRequest - Pointer to get batch request.
10248 \param sessionId - session ID
10249 \param callbackRoutine - HDD callback which needs to be invoked after
10250 getting batch scan result indication from FW
10251 \param callbackContext - pAdapter context
10252 \return eHalStatus
10253 ---------------------------------------------------------------------------*/
10254eHalStatus sme_TriggerBatchScanResultInd
10255(
10256 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10257 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10258 void *callbackContext
10259)
10260{
10261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10262 eHalStatus status;
10263
10264 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10265 {
10266 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10267 callbackRoutine, callbackContext);
10268 sme_ReleaseGlobalLock( &pMac->sme );
10269 }
10270
10271 return status;
10272}
10273
10274
10275/* ---------------------------------------------------------------------------
10276 \fn sme_StopBatchScanInd
10277 \brief API to stop batch scan request in FW
10278 \param hHal - The handle returned by macOpen.
10279 \param pRequest - Pointer to the batch request.
10280 \param sessionId - session ID
10281 \return eHalStatus
10282 ---------------------------------------------------------------------------*/
10283eHalStatus sme_StopBatchScanInd
10284(
10285 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10286)
10287{
10288 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10289 eHalStatus status;
10290
10291 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10292 {
10293 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10294 sme_ReleaseGlobalLock( &pMac->sme );
10295 }
10296
10297 return status;
10298}
10299
10300#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010301
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010302
Leo Chang0b0e45a2013-12-15 15:18:55 -080010303#ifdef FEATURE_WLAN_CH_AVOID
10304/* ---------------------------------------------------------------------------
10305 \fn sme_AddChAvoidCallback
10306 \brief Used to plug in callback function
10307 Which notify channel may not be used with SAP or P2PGO mode.
10308 Notification come from FW.
10309 \param hHal
10310 \param pCallbackfn : callback function pointer should be plugged in
10311 \- return eHalStatus
10312 -------------------------------------------------------------------------*/
10313eHalStatus sme_AddChAvoidCallback
10314(
10315 tHalHandle hHal,
10316 void (*pCallbackfn)(void *pAdapter, void *indParam)
10317)
10318{
10319 eHalStatus status = eHAL_STATUS_SUCCESS;
10320 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10321
10322 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10323 "%s: Plug in CH AVOID CB", __func__);
10324
10325 status = sme_AcquireGlobalLock(&pMac->sme);
10326 if (eHAL_STATUS_SUCCESS == status)
10327 {
10328 if (NULL != pCallbackfn)
10329 {
10330 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10331 }
10332 sme_ReleaseGlobalLock(&pMac->sme);
10333 }
10334
10335 return(status);
10336}
10337#endif /* FEATURE_WLAN_CH_AVOID */
10338
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010339
10340void activeListCmdTimeoutHandle(void *userData)
10341{
10342 if (NULL == userData)
10343 return;
10344 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10345 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010346 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010347 smeGetCommandQStatus((tHalHandle) userData);
10348}
10349
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010350eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10351{
10352 eHalStatus status = eHAL_STATUS_SUCCESS;
10353 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10354 pMac->fEnableDebugLog = set_value;
10355 return (status);
10356}
10357