blob: 08a93a2abfd4debb3f02f43b11a116a34c051574 [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 Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/**=========================================================================
32
33 \file smeApi.c
34
35 \brief Definitions for SME APIs
36
Kiet Lamaa8e15a2014-02-11 23:30:06 -080037 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
38
39 Qualcomm Confidential and Proprietary.
40
Jeff Johnson295189b2012-06-20 16:38:30 -070041 ========================================================================*/
42
43/*===========================================================================
44
45 EDIT HISTORY FOR FILE
46
47
48 This section contains comments describing changes made to the module.
49 Notice that changes are listed in reverse chronological order.
50
51
52
53 when who what, where, why
54---------- --- --------------------------------------------------------
5506/03/10 js Added support to hostapd driven
56 * deauth/disassoc/mic failure
57
58===========================================================================*/
59
60/*--------------------------------------------------------------------------
61 Include Files
62 ------------------------------------------------------------------------*/
63
Jeff Johnson295189b2012-06-20 16:38:30 -070064
65#include "smsDebug.h"
66#include "sme_Api.h"
67#include "csrInsideApi.h"
68#include "smeInside.h"
69#include "csrInternal.h"
70#include "wlan_qct_wda.h"
71#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053072#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070073#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053074#include "vos_types.h"
75#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070076#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053077#include "macTrace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070078
79
Mukul Sharmabe91e2f2014-06-29 22:09:20 +053080#ifdef DEBUG_ROAM_DELAY
81#include "vos_utils.h"
82#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070083
Jeff Johnson295189b2012-06-20 16:38:30 -070084extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
85
86#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053087#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080088#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053089#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080090
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070091
92#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
93
Jeff Johnson295189b2012-06-20 16:38:30 -070094// TxMB Functions
95extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
96 tANI_U32 size, tSmeCmd **ppCmd );
97extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
98extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070099extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
100extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
101extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
102extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
103extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700105
106static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
107static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
108
109eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
110
111eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
112
Sushant Kaushik1d732562014-05-21 14:15:37 +0530113void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
114
Amar Singhal0d15bd52013-10-12 23:13:13 -0700115eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
116
Jeff Johnson295189b2012-06-20 16:38:30 -0700117eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
118
119eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
120
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700121#ifdef FEATURE_WLAN_LFR
122tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
123#endif
124
Chet Lanctot186b5732013-03-18 10:26:30 -0700125#ifdef WLAN_FEATURE_11W
126eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
127 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
128#endif
129
Jeff Johnson295189b2012-06-20 16:38:30 -0700130//Internal SME APIs
131eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
132{
133 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
134
135 if(psSme)
136 {
137 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
138 {
139 status = eHAL_STATUS_SUCCESS;
140 }
141 }
142
143 return (status);
144}
145
146
147eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
148{
149 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
150
151 if(psSme)
152 {
153 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
154 {
155 status = eHAL_STATUS_SUCCESS;
156 }
157 }
158
159 return (status);
160}
161
162
163
164static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
165{
166 eHalStatus status;
167 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530168 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700169 VOS_STATUS vosStatus;
170 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700171
172 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530173 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
174 &pMac->sme.smeCmdActiveList)))
175 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700176
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530177 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
178 &pMac->sme.smeCmdPendingList)))
179 goto end;
180
181 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
182 &pMac->sme.smeScanCmdActiveList)))
183 goto end;
184
185 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
186 &pMac->sme.smeScanCmdPendingList)))
187 goto end;
188
189 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
190 &pMac->sme.smeCmdFreeList)))
191 goto end;
192
Kiet Lam64c1b492013-07-12 13:56:44 +0530193 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
194 if ( NULL == pCmd )
195 status = eHAL_STATUS_FAILURE;
196 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530197 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530198 status = eHAL_STATUS_SUCCESS;
199
200 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
201 pMac->sme.pSmeCmdBufAddr = pCmd;
202
203 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
204 {
205 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530206 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530207 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 }
209
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700210 /* This timer is only to debug the active list command timeout */
211
212 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
213 if (cmdTimeoutTimer)
214 {
215 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
216 vosStatus =
217 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
218 VOS_TIMER_TYPE_SW,
219 activeListCmdTimeoutHandle,
220 (void*) pMac);
221
222 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
223 {
224 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
225 "Init Timer fail for active list command process time out");
226 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
227 }
228 else
229 {
230 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
231 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
232 }
233 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530234end:
235 if (!HAL_STATUS_SUCCESS(status))
236 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
237 status);
238
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 return (status);
240}
241
242
243void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
244{
245 pCmd->command = eSmeNoCommand;
246 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
247}
248
249
250
251static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
252{
253 tListElem *pEntry;
254 tSmeCmd *pCommand;
255
256 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
257 {
258 //TODO: base on command type to call release functions
259 //reinitialize different command types so they can be reused
260 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
261 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
262 }
263}
264
265static void purgeSmeCmdList(tpAniSirGlobal pMac)
266{
267 //release any out standing commands back to free command list
268 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
269 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530270 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
271 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700272}
273
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530274void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
275 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700276{
277 //release any out standing commands back to free command list
278 tListElem *pEntry, *pNext;
279 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 tDblLinkList localList;
281
282 vos_mem_zero(&localList, sizeof(tDblLinkList));
283 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
284 {
285 smsLog(pMac, LOGE, FL(" failed to open list"));
286 return;
287 }
288
289 csrLLLock(pList);
290 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
291 while(pEntry != NULL)
292 {
293 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
294 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
295 if(pCommand->sessionId == sessionId)
296 {
297 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
298 {
299 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
300 }
301 }
302 pEntry = pNext;
303 }
304 csrLLUnlock(pList);
305
306 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
307 {
308 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
309 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
310 }
311 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700312}
313
314
315static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
316{
317 eHalStatus status = eHAL_STATUS_SUCCESS;
318
319 purgeSmeCmdList(pMac);
320 csrLLClose(&pMac->sme.smeCmdPendingList);
321 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530322 csrLLClose(&pMac->sme.smeScanCmdPendingList);
323 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 csrLLClose(&pMac->sme.smeCmdFreeList);
325
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700326 /*destroy active list command time out timer */
327 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
328 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
329 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
330
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800331 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
332 if(status != eHAL_STATUS_SUCCESS)
333 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800334 smsLog(pMac, LOGE,
335 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800336 goto done;
337 }
338
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 if(NULL != pMac->sme.pSmeCmdBufAddr)
340 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530341 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 pMac->sme.pSmeCmdBufAddr = NULL;
343 }
344
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800345 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
346 if(status != eHAL_STATUS_SUCCESS)
347 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800348 smsLog(pMac, LOGE,
349 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800350 }
351done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 return (status);
353}
354
355
356void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
357{
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 switch( pCmd->command )
359 {
360 case eSmeCommandScan:
361 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
362 break;
363
364 case eSmeCommandRoam:
365 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
366 break;
367
368 case eSmeCommandWmStatusChange:
369 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
370 break;
371
372 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800373 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
375 break;
376
377 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800378 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
380 break;
381
382 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700383 smsLog( pMac, LOGE, " default: Unhandled command %d",
384 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 break;
386 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700387}
388
389tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
390{
391 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
392 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530393 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700394 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
395
396 // If we can get another MS Msg buffer, then we are ok. Just link
397 // the entry onto the linked list. (We are using the linked list
398 // to keep track of tfhe message buffers).
399 if ( pEntry )
400 {
401 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530402 /* reset when free list is available */
403 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
405 else {
406 int idx = 1;
407
408 //Cannot change pRetCmd here since it needs to return later.
409 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
410 if( pEntry )
411 {
412 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
413 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800414 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
416 if(pTempCmd)
417 {
418 if( eSmeCsrCommandMask & pTempCmd->command )
419 {
420 //CSR command is stuck. See what the reason code is for that command
421 dumpCsrCommandInfo(pMac, pTempCmd);
422 }
423 } //if(pTempCmd)
424
425 //dump what is in the pending queue
426 csrLLLock(&pMac->sme.smeCmdPendingList);
427 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530428 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 {
430 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530431 /* Print only 1st five commands from pending queue. */
432 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800433 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530434 idx, pTempCmd->command );
435 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 if( eSmeCsrCommandMask & pTempCmd->command )
437 {
438 //CSR command is stuck. See what the reason code is for that command
439 dumpCsrCommandInfo(pMac, pTempCmd);
440 }
441 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
442 }
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530443 /* Increament static variable so that it prints pending command only once*/
444 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 csrLLUnlock(&pMac->sme.smeCmdPendingList);
446
447 //There may be some more command in CSR's own pending queue
448 csrLLLock(&pMac->roam.roamCmdPendingList);
449 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
450 while(pEntry)
451 {
452 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800453 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 idx++, pTempCmd->command );
455 dumpCsrCommandInfo(pMac, pTempCmd);
456 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
457 }
458 csrLLUnlock(&pMac->roam.roamCmdPendingList);
459 }
460
461 return( pRetCmd );
462}
463
464
465void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
466{
467 if ( fHighPriority )
468 {
469 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
470 }
471 else
472 {
473 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
474 }
475
476 // process the command queue...
477 smeProcessPendingQueue( pMac );
478
479 return;
480}
481
482
483static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
484{
485 eSmeCommandType pmcCommand = eSmeNoCommand;
486 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
487 tPmcState pmcState;
488 eHalStatus status;
489
490 do
491 {
492 pmcState = pmcGetPmcState(pMac);
493
494 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
495 if( !HAL_STATUS_SUCCESS(status) )
496 {
497 //PMC state is not right for the command, drop it
498 return ( eSmeDropCommand );
499 }
500 if( fFullPowerNeeded ) break;
501 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
502 ( eSmeCommandDelTs == pCommand->command ) );
503 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700504#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700505 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700506 eSmeCommandOemDataReq == pCommand->command);
507 if(fFullPowerNeeded) break;
508#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700509 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 eSmeCommandRemainOnChannel == pCommand->command);
511 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 } while(0);
513
514 if( fFullPowerNeeded )
515 {
516 switch( pmcState )
517 {
518 case IMPS:
519 case STANDBY:
520 pmcCommand = eSmeCommandExitImps;
521 break;
522
523 case BMPS:
524 pmcCommand = eSmeCommandExitBmps;
525 break;
526
527 case UAPSD:
528 pmcCommand = eSmeCommandExitUapsd;
529 break;
530
531 case WOWL:
532 pmcCommand = eSmeCommandExitWowl;
533 break;
534
535 default:
536 break;
537 }
538 }
539
540 return ( pmcCommand );
541}
542
543
544//For commands that need to do extra cleanup.
545static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
546{
547 if( eSmePmcCommandMask & pCommand->command )
548 {
549 pmcAbortCommand( pMac, pCommand, fStopping );
550 }
551 else if ( eSmeCsrCommandMask & pCommand->command )
552 {
553 csrAbortCommand( pMac, pCommand, fStopping );
554 }
555 else
556 {
557 switch( pCommand->command )
558 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eSmeCommandRemainOnChannel:
560 if (NULL != pCommand->u.remainChlCmd.callback)
561 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700562 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 pCommand->u.remainChlCmd.callback;
564 /* process the msg */
565 if( callback )
566 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700567 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 eCSR_SCAN_ABORT );
569 }
570 }
571 smeReleaseCommand( pMac, pCommand );
572 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 default:
574 smeReleaseCommand( pMac, pCommand );
575 break;
576 }
577 }
578}
579
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530580tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
581 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
582{
583 tListElem *pCurEntry = NULL;
584 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700585
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530586 /* Go through the list and return the command whose session id is not
587 * matching with the current ongoing scan cmd sessionId */
588 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
589 while (pCurEntry)
590 {
591 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
592 if (pCommand->sessionId != sessionId)
593 {
594 smsLog(pMac, LOG1, "selected the command with different sessionId");
595 return pCurEntry;
596 }
597
598 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
599 }
600
601 smsLog(pMac, LOG1, "No command pending with different sessionId");
602 return NULL;
603}
604
605tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
606{
607 tListElem *pEntry;
608 tSmeCmd *pCommand;
609 tListElem *pSmeEntry;
610 tSmeCmd *pSmeCommand;
611 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
612
613 csrLLLock( &pMac->sme.smeScanCmdActiveList );
614 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
615 LL_ACCESS_NOLOCK ))
616 {
617 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
618 LL_ACCESS_LOCK))
619 {
620 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
621 LL_ACCESS_LOCK );
622 if (pEntry)
623 {
624 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
625 //We cannot execute any command in wait-for-key state until setKey is through.
626 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
627 {
628 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
629 {
630 smsLog(pMac, LOGE,
631 " Cannot process command(%d) while waiting for key",
632 pCommand->command);
633 status = eANI_BOOLEAN_FALSE;
634 goto end;
635 }
636 }
637
638 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
639 LL_ACCESS_LOCK )))
640 {
641 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
642 LL_ACCESS_LOCK);
643 if (pEntry)
644 {
645 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
646 Link) ;
647
648 /* if scan is running on one interface and SME recei
649 ves the next command on the same interface then
650 dont the allow the command to be queued to
651 smeCmdPendingList. If next scan is allowed on
652 the same interface the CSR state machine will
653 get screwed up. */
654 if (pSmeCommand->sessionId == pCommand->sessionId)
655 {
656 status = eANI_BOOLEAN_FALSE;
657 goto end;
658 }
659 }
660 }
661 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
662 pEntry, LL_ACCESS_LOCK ) )
663 {
664 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
665 &pCommand->Link, LL_ACCESS_NOLOCK );
666
667 switch (pCommand->command)
668 {
669 case eSmeCommandScan:
670 smsLog(pMac, LOG1,
671 " Processing scan offload command ");
672 csrProcessScanCommand( pMac, pCommand );
673 break;
674 default:
675 smsLog(pMac, LOGE,
676 " Something wrong, wrong command enqueued"
677 " to smeScanCmdPendingList");
678 pEntry = csrLLRemoveHead(
679 &pMac->sme.smeScanCmdActiveList,
680 LL_ACCESS_NOLOCK );
681 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
682 smeReleaseCommand( pMac, pCommand );
683 break;
684 }
685 }
686 }
687 }
688 }
689end:
690 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
691 return status;
692}
Jeff Johnson295189b2012-06-20 16:38:30 -0700693
694tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
695{
696 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
697 eHalStatus status = eHAL_STATUS_SUCCESS;
698 tListElem *pEntry;
699 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530700 tListElem *pSmeEntry;
701 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 eSmeCommandType pmcCommand = eSmeNoCommand;
703
704 // if the ActiveList is empty, then nothing is active so we can process a
705 // pending command...
706 //alwasy lock active list before locking pending list
707 csrLLLock( &pMac->sme.smeCmdActiveList );
708 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
709 {
710 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
711 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530712 /* If scan command is pending in the smeScanCmdActive list
713 * then pick the command from smeCmdPendingList which is
714 * not matching with the scan command session id.
715 * At any point of time only one command will be allowed
716 * on a single session. */
717 if ((pMac->fScanOffload) &&
718 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
719 LL_ACCESS_LOCK)))
720 {
721 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
722 LL_ACCESS_LOCK);
723 if (pSmeEntry)
724 {
725 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
726
727 pEntry = csrGetCmdToProcess(pMac,
728 &pMac->sme.smeCmdPendingList,
729 pSmeCommand->sessionId,
730 LL_ACCESS_LOCK);
731 goto sme_process_cmd;
732 }
733 }
734
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 //Peek the command
736 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530737sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 if( pEntry )
739 {
740 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530741
Abhishek Singhf4669da2014-05-26 15:07:49 +0530742 /* Allow only disconnect command
743 * in wait-for-key state until setKey is through.
744 */
745 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
746 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 {
748 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
749 {
750 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530751 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
752 "command(%d) while waiting for key"),
753 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530754 fContinue = eANI_BOOLEAN_FALSE;
755 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 }
757 }
758 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
759 if( eSmeDropCommand == pmcCommand )
760 {
761 //This command is not ok for current PMC state
762 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
763 {
764 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
765 }
766 csrLLUnlock( &pMac->sme.smeCmdActiveList );
767 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530768 fContinue = eANI_BOOLEAN_TRUE;
769 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 }
771 else if( eSmeNoCommand != pmcCommand )
772 {
773 tExitBmpsInfo exitBmpsInfo;
774 void *pv = NULL;
775 tANI_U32 size = 0;
776 tSmeCmd *pPmcCmd = NULL;
777
778 if( eSmeCommandExitBmps == pmcCommand )
779 {
780 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
781 pv = (void *)&exitBmpsInfo;
782 size = sizeof(tExitBmpsInfo);
783 }
784 //pmcCommand has to be one of the exit power save command
785 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
786 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
787 {
788 //Force this command to wake up the chip
789 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
790 csrLLUnlock( &pMac->sme.smeCmdActiveList );
791 fContinue = pmcProcessCommand( pMac, pPmcCmd );
792 if( fContinue )
793 {
794 //The command failed, remove it
795 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
796 {
797 pmcReleaseCommand( pMac, pPmcCmd );
798 }
799 }
800 }
801 else
802 {
803 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800804 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 -0700805 //Let it retry
806 fContinue = eANI_BOOLEAN_TRUE;
807 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530808 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 }
810 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
811 {
812 // we can reuse the pCommand
813
814 // Insert the command onto the ActiveList...
815 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
816
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530817 if( pMac->deferImps )
818 {
819 /* IMPS timer is already running so stop it and
820 * it will get restarted when no command is pending
821 */
822 csrScanStopIdleScanTimer( pMac );
823 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
824 pMac->deferImps = eANI_BOOLEAN_FALSE;
825 }
826
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 // .... and process the command.
828
Katya Nigambcb705f2013-12-26 14:26:22 +0530829 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700830 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 switch ( pCommand->command )
832 {
833
834 case eSmeCommandScan:
835 csrLLUnlock( &pMac->sme.smeCmdActiveList );
836 status = csrProcessScanCommand( pMac, pCommand );
837 break;
838
839 case eSmeCommandRoam:
840 csrLLUnlock( &pMac->sme.smeCmdActiveList );
841 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800842 if(!HAL_STATUS_SUCCESS(status))
843 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700844 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800845 &pCommand->Link, LL_ACCESS_LOCK ) )
846 {
847 csrReleaseCommandRoam( pMac, pCommand );
848 }
849 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 break;
851
852 case eSmeCommandWmStatusChange:
853 csrLLUnlock( &pMac->sme.smeCmdActiveList );
854 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
855 break;
856
857 case eSmeCommandSetKey:
858 csrLLUnlock( &pMac->sme.smeCmdActiveList );
859 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
860 if(!HAL_STATUS_SUCCESS(status))
861 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700862 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 &pCommand->Link, LL_ACCESS_LOCK ) )
864 {
865 csrReleaseCommandSetKey( pMac, pCommand );
866 }
867 }
868 break;
869
870 case eSmeCommandRemoveKey:
871 csrLLUnlock( &pMac->sme.smeCmdActiveList );
872 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
873 if(!HAL_STATUS_SUCCESS(status))
874 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700875 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 &pCommand->Link, LL_ACCESS_LOCK ) )
877 {
878 csrReleaseCommandRemoveKey( pMac, pCommand );
879 }
880 }
881 break;
882
883 case eSmeCommandAddStaSession:
884 csrLLUnlock( &pMac->sme.smeCmdActiveList );
885 csrProcessAddStaSessionCommand( pMac, pCommand );
886 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700887 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 csrLLUnlock( &pMac->sme.smeCmdActiveList );
889 csrProcessDelStaSessionCommand( pMac, pCommand );
890 break;
891
Jeff Johnsone7245742012-09-05 17:12:55 -0700892#ifdef FEATURE_OEM_DATA_SUPPORT
893 case eSmeCommandOemDataReq:
894 csrLLUnlock(&pMac->sme.smeCmdActiveList);
895 oemData_ProcessOemDataReqCommand(pMac, pCommand);
896 break;
897#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 case eSmeCommandRemainOnChannel:
899 csrLLUnlock(&pMac->sme.smeCmdActiveList);
900 p2pProcessRemainOnChannelCmd(pMac, pCommand);
901 break;
902 case eSmeCommandNoAUpdate:
903 csrLLUnlock( &pMac->sme.smeCmdActiveList );
904 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 case eSmeCommandEnterImps:
906 case eSmeCommandExitImps:
907 case eSmeCommandEnterBmps:
908 case eSmeCommandExitBmps:
909 case eSmeCommandEnterUapsd:
910 case eSmeCommandExitUapsd:
911 case eSmeCommandEnterWowl:
912 case eSmeCommandExitWowl:
913 csrLLUnlock( &pMac->sme.smeCmdActiveList );
914 fContinue = pmcProcessCommand( pMac, pCommand );
915 if( fContinue )
916 {
917 //The command failed, remove it
918 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
919 &pCommand->Link, LL_ACCESS_LOCK ) )
920 {
921 pmcReleaseCommand( pMac, pCommand );
922 }
923 }
924 break;
925
926 //Treat standby differently here because caller may not be able to handle
927 //the failure so we do our best here
928 case eSmeCommandEnterStandby:
929 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
930 {
931 //It can continue
932 csrLLUnlock( &pMac->sme.smeCmdActiveList );
933 fContinue = pmcProcessCommand( pMac, pCommand );
934 if( fContinue )
935 {
936 //The command failed, remove it
937 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
938 &pCommand->Link, LL_ACCESS_LOCK ) )
939 {
940 pmcReleaseCommand( pMac, pCommand );
941 }
942 }
943 }
944 else
945 {
946 //Need to issue a disconnect first before processing this command
947 tSmeCmd *pNewCmd;
948
949 //We need to re-run the command
950 fContinue = eANI_BOOLEAN_TRUE;
951 //Pull off the standby command first
952 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
953 &pCommand->Link, LL_ACCESS_NOLOCK ) )
954 {
955 csrLLUnlock( &pMac->sme.smeCmdActiveList );
956 //Need to call CSR function here because the disconnect command
957 //is handled by CSR
958 pNewCmd = csrGetCommandBuffer( pMac );
959 if( NULL != pNewCmd )
960 {
961 //Put the standby command to the head of the pending list first
962 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
963 LL_ACCESS_LOCK );
964 pNewCmd->command = eSmeCommandRoam;
965 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
966 //Put the disassoc command before the standby command
967 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
968 LL_ACCESS_LOCK );
969 }
970 else
971 {
972 //Continue the command here
973 fContinue = pmcProcessCommand( pMac, pCommand );
974 if( fContinue )
975 {
976 //The command failed, remove it
977 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
978 &pCommand->Link, LL_ACCESS_LOCK ) )
979 {
980 pmcReleaseCommand( pMac, pCommand );
981 }
982 }
983 }
984 }
985 else
986 {
987 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800988 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 VOS_ASSERT(0);
990 }
991 }
992 break;
993
994 case eSmeCommandAddTs:
995 case eSmeCommandDelTs:
996 csrLLUnlock( &pMac->sme.smeCmdActiveList );
997#ifndef WLAN_MDM_CODE_REDUCTION_OPT
998 fContinue = qosProcessCommand( pMac, pCommand );
999 if( fContinue )
1000 {
1001 //The command failed, remove it
1002 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1003 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1004 {
1005//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1006 qosReleaseCommand( pMac, pCommand );
1007//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1008 }
1009 }
1010#endif
1011 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001012#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001013 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001014 case eSmeCommandTdlsAddPeer:
1015 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301016 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001017#ifdef FEATURE_WLAN_TDLS_INTERNAL
1018 case eSmeCommandTdlsDiscovery:
1019 case eSmeCommandTdlsLinkSetup:
1020 case eSmeCommandTdlsLinkTear:
1021 case eSmeCommandTdlsEnterUapsd:
1022 case eSmeCommandTdlsExitUapsd:
1023#endif
1024 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001025 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001026 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001027
1028 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1029 status = csrTdlsProcessCmd( pMac, pCommand );
1030 }
1031 break ;
1032#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001033
1034 default:
1035 //something is wrong
1036 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001037 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1039 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1040 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1041 smeReleaseCommand( pMac, pCommand );
1042 status = eHAL_STATUS_FAILURE;
1043 break;
1044 }
1045 if(!HAL_STATUS_SUCCESS(status))
1046 {
1047 fContinue = eANI_BOOLEAN_TRUE;
1048 }
1049 }//if(pEntry)
1050 else
1051 {
1052 //This is odd. Some one else pull off the command.
1053 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1054 }
1055 }
1056 else
1057 {
1058 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1059 }
1060 }
1061 else
1062 {
1063 //No command waiting
1064 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1065 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1066 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1067 {
1068 tANI_U32 nTime = 0;
1069
1070 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1071 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1072 {
1073 csrScanStartIdleScanTimer(pMac, nTime);
1074 }
1075 }
1076 }
1077 }
1078 else {
1079 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1080 }
1081
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301082sme_process_scan_queue:
1083 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1084 fContinue = eANI_BOOLEAN_FALSE;
1085
Jeff Johnson295189b2012-06-20 16:38:30 -07001086 return ( fContinue );
1087}
1088
1089void smeProcessPendingQueue( tpAniSirGlobal pMac )
1090{
1091 while( smeProcessCommand( pMac ) );
1092}
1093
1094
1095tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1096{
1097 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1098 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1099}
1100
1101
1102
1103//Global APIs
1104
1105/*--------------------------------------------------------------------------
1106
1107 \brief sme_Open() - Initialze all SME modules and put them at idle state
1108
1109 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1110 successfully return, all modules are at idle state ready to start.
1111
1112 smeOpen must be called before any other SME APIs can be involved.
1113 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001114 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 \param hHal - The handle returned by macOpen.
1116
1117 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1118
1119 Other status means SME is failed to be initialized
1120 \sa
1121
1122 --------------------------------------------------------------------------*/
1123eHalStatus sme_Open(tHalHandle hHal)
1124{
1125 eHalStatus status = eHAL_STATUS_FAILURE;
1126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1127
1128 do {
1129 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001130 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1132 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001133 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 status = eHAL_STATUS_FAILURE;
1135 break;
1136 }
1137
1138 status = ccmOpen(hHal);
1139 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1140 smsLog( pMac, LOGE,
1141 "ccmOpen failed during initialization with status=%d", status );
1142 break;
1143 }
1144
1145 status = csrOpen(pMac);
1146 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1147 smsLog( pMac, LOGE,
1148 "csrOpen failed during initialization with status=%d", status );
1149 break;
1150 }
1151
1152 status = pmcOpen(hHal);
1153 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1154 smsLog( pMac, LOGE,
1155 "pmcOpen failed during initialization with status=%d", status );
1156 break;
1157 }
1158
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001159#ifdef FEATURE_WLAN_TDLS
1160 pMac->isTdlsPowerSaveProhibited = 0;
1161#endif
1162
Jeff Johnson295189b2012-06-20 16:38:30 -07001163#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1164 status = sme_QosOpen(pMac);
1165 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1166 smsLog( pMac, LOGE,
1167 "Qos open failed during initialization with status=%d", status );
1168 break;
1169 }
1170
1171 status = btcOpen(pMac);
1172 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1173 smsLog( pMac, LOGE,
1174 "btcOpen open failed during initialization with status=%d", status );
1175 break;
1176 }
1177#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001178#ifdef FEATURE_OEM_DATA_SUPPORT
1179 status = oemData_OemDataReqOpen(pMac);
1180 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1181 smsLog(pMac, LOGE,
1182 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1183 break;
1184 }
1185#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001186
1187 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1188 break;
1189
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 {
1191 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1192 if ( NULL == pvosGCtx ){
1193 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1194 status = eHAL_STATUS_FAILURE;
1195 break;
1196 }
1197
1198 status = WLANSAP_Open( pvosGCtx );
1199 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1200 smsLog( pMac, LOGE,
1201 "WLANSAP_Open open failed during initialization with status=%d", status );
1202 break;
1203 }
1204 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001205#if defined WLAN_FEATURE_VOWIFI
1206 status = rrmOpen(pMac);
1207 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1208 smsLog( pMac, LOGE,
1209 "rrmOpen open failed during initialization with status=%d", status );
1210 break;
1211 }
1212#endif
1213
1214#if defined WLAN_FEATURE_VOWIFI_11R
1215 sme_FTOpen(pMac);
1216#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001218 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001219
1220 }while (0);
1221
1222 return status;
1223}
1224
Jeff Johnson295189b2012-06-20 16:38:30 -07001225/*--------------------------------------------------------------------------
1226
1227 \brief sme_set11dinfo() - Set the 11d information about valid channels
1228 and there power using information from nvRAM
1229 This function is called only for AP.
1230
Srinivas Girigowdade697412013-02-14 16:31:48 -08001231 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001232
1233 \param hHal - The handle returned by macOpen.
1234 \Param pSmeConfigParams - a pointer to a caller allocated object of
1235 typedef struct _smeConfigParams.
1236
1237 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1238
1239 Other status means SME is failed to update the config parameters.
1240 \sa
1241--------------------------------------------------------------------------*/
1242
1243eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1244{
1245 eHalStatus status = eHAL_STATUS_FAILURE;
1246 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1247
Katya Nigambcb705f2013-12-26 14:26:22 +05301248 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001249 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 if (NULL == pSmeConfigParams ) {
1251 smsLog( pMac, LOGE,
1252 "Empty config param structure for SME, nothing to update");
1253 return status;
1254 }
1255
1256 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1257 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001258 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 status );
1260 }
1261 return status;
1262}
1263
1264/*--------------------------------------------------------------------------
1265
1266 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1267
Srinivas Girigowdade697412013-02-14 16:31:48 -08001268 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001269
1270 \param hHal - The handle returned by HostapdAdapter.
1271 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1272
1273 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1274
1275 Other status means, failed to get the current regulatory domain.
1276 \sa
1277--------------------------------------------------------------------------*/
1278
1279eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1280{
1281 eHalStatus status = eHAL_STATUS_FAILURE;
1282 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1283
Katya Nigambcb705f2013-12-26 14:26:22 +05301284 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001285 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 if (NULL == domainIdSoftAp ) {
1287 smsLog( pMac, LOGE, "Uninitialized domain Id");
1288 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001289 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001290
1291 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1292 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001293
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 return status;
1295}
1296
1297
1298eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1299{
1300 eHalStatus status = eHAL_STATUS_FAILURE;
1301 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1302
Katya Nigambcb705f2013-12-26 14:26:22 +05301303 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001304 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 if (NULL == apCntryCode ) {
1306 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1307 return status;
1308 }
1309
1310 status = csrSetRegInfo(hHal, apCntryCode );
1311 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001312 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 status );
1314 }
1315 return status;
1316}
1317
Jeff Johnson295189b2012-06-20 16:38:30 -07001318#ifdef FEATURE_WLAN_SCAN_PNO
1319/*--------------------------------------------------------------------------
1320
1321 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001322
1323 It is used at driver start up to inform RIVA of the default channel
1324 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001325
Srinivas Girigowdade697412013-02-14 16:31:48 -08001326 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001327
1328 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001329
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1331
1332 Other status means SME is failed to update the channel config.
1333 \sa
1334
1335 --------------------------------------------------------------------------*/
1336eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1337{
1338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1339
Katya Nigambcb705f2013-12-26 14:26:22 +05301340 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001341 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1342 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 &pMac->scan.base20MHzChannels, FALSE);
1344 return eHAL_STATUS_SUCCESS;
1345}
1346#endif // FEATURE_WLAN_SCAN_PNLO
1347
1348/*--------------------------------------------------------------------------
1349
1350 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1351
1352 The function updates some configuration for modules in SME, CCM, CSR, etc
1353 during SMEs close open sequence.
1354
1355 Modules inside SME apply the new configuration at the next transaction.
1356
Srinivas Girigowdade697412013-02-14 16:31:48 -08001357 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
1359 \param hHal - The handle returned by macOpen.
1360 \Param pSmeConfigParams - a pointer to a caller allocated object of
1361 typedef struct _smeConfigParams.
1362
1363 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1364
1365 Other status means SME is failed to update the config parameters.
1366 \sa
1367
1368 --------------------------------------------------------------------------*/
1369eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1370{
1371 eHalStatus status = eHAL_STATUS_FAILURE;
1372 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1373
Katya Nigambcb705f2013-12-26 14:26:22 +05301374 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001375 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 if (NULL == pSmeConfigParams ) {
1377 smsLog( pMac, LOGE,
1378 "Empty config param structure for SME, nothing to update");
1379 return status;
1380 }
1381
1382 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1383
1384 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001385 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 status );
1387 }
1388#if defined WLAN_FEATURE_P2P_INTERNAL
1389 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1390
1391 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001392 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 status );
1394 }
1395#endif
1396#if defined WLAN_FEATURE_VOWIFI
1397 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1398
1399 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001400 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 status );
1402 }
1403#endif
1404 //For SOC, CFG is set before start
1405 //We don't want to apply global CFG in connect state because that may cause some side affect
1406 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 csrIsAllSessionDisconnected( pMac) )
1408 {
1409 csrSetGlobalCfgs(pMac);
1410 }
1411
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301412 /* update the directed scan offload setting */
1413 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1414
Sandeep Puligilla60342762014-01-30 21:05:37 +05301415 /* Enable channel bonding mode in 2.4GHz */
1416 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1417 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1418 {
1419 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1420 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1422 "Setting channelBondingMode24GHz:%d " ,
1423 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1424 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301425 if (pMac->fScanOffload)
1426 {
1427 /* If scan offload is enabled then lim has allow the sending of
1428 scan request to firmware even in powersave mode. The firmware has
1429 to take care of exiting from power save mode */
1430 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1431 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1432
1433 if (eHAL_STATUS_SUCCESS != status)
1434 {
1435 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1436 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1437 }
1438 }
krunal sonie9002db2013-11-25 14:24:17 -08001439 pMac->isCoalesingInIBSSAllowed =
1440 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001441 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301442 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
1443
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 return status;
1445}
1446
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301447#ifdef WLAN_FEATURE_GTK_OFFLOAD
1448void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1449 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1450{
1451 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1452
1453 if (NULL == pMac)
1454 {
1455 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1456 "%s: pMac is null", __func__);
1457 return ;
1458 }
1459 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1460 {
1461 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1462 "%s: HDD callback is null", __func__);
1463 return ;
1464 }
1465 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1466 pGtkOffloadGetInfoRsp);
1467}
1468#endif
1469
Jeff Johnson295189b2012-06-20 16:38:30 -07001470/* ---------------------------------------------------------------------------
1471 \fn sme_ChangeConfigParams
1472 \brief The SME API exposed for HDD to provide config params to SME during
1473 SMEs stop -> start sequence.
1474
1475 If HDD changed the domain that will cause a reset. This function will
1476 provide the new set of 11d information for the new domain. Currrently this
1477 API provides info regarding 11d only at reset but we can extend this for
1478 other params (PMC, QoS) which needs to be initialized again at reset.
1479
Srinivas Girigowdade697412013-02-14 16:31:48 -08001480 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001481
1482 \param hHal - The handle returned by macOpen.
1483
1484 \Param
1485 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1486 currently provides 11d related information like Country code,
1487 Regulatory domain, valid channel list, Tx power per channel, a
1488 list with active/passive scan allowed per valid channel.
1489
1490 \return eHalStatus
1491 ---------------------------------------------------------------------------*/
1492eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1493 tCsrUpdateConfigParam *pUpdateConfigParam)
1494{
1495 eHalStatus status = eHAL_STATUS_FAILURE;
1496 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1497
1498 if (NULL == pUpdateConfigParam ) {
1499 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001500 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 return status;
1502 }
1503
1504 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1505
1506 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001507 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 status );
1509 }
1510
1511 return status;
1512
1513}
1514
1515/*--------------------------------------------------------------------------
1516
1517 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1518 that the NIC is ready tio run.
1519
1520 The function is called by HDD at the end of initialization stage so PE/HAL can
1521 enable the NIC to running state.
1522
Srinivas Girigowdade697412013-02-14 16:31:48 -08001523 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001524 \param hHal - The handle returned by macOpen.
1525
1526 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1527 successfully.
1528
1529 Other status means SME failed to send the message to PE.
1530 \sa
1531
1532 --------------------------------------------------------------------------*/
1533eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1534{
1535 tSirSmeReadyReq Msg;
1536 eHalStatus status = eHAL_STATUS_FAILURE;
1537 tPmcPowerState powerState;
1538 tPmcSwitchState hwWlanSwitchState;
1539 tPmcSwitchState swWlanSwitchState;
1540 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1541
Katya Nigambcb705f2013-12-26 14:26:22 +05301542 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001543 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 do
1545 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001546
1547 Msg.messageType = eWNI_SME_SYS_READY_IND;
1548 Msg.length = sizeof( tSirSmeReadyReq );
1549
1550 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1551 {
1552 status = eHAL_STATUS_SUCCESS;
1553 }
1554 else
1555 {
1556 smsLog( pMac, LOGE,
1557 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1558 break;
1559 }
1560
1561 status = pmcQueryPowerState( hHal, &powerState,
1562 &hwWlanSwitchState, &swWlanSwitchState );
1563 if ( ! HAL_STATUS_SUCCESS( status ) )
1564 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001565 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 status );
1567 break;
1568 }
1569
1570 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1571 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1572 {
1573 status = csrReady(pMac);
1574 if ( ! HAL_STATUS_SUCCESS( status ) )
1575 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001576 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 break;
1578 }
1579 status = pmcReady(hHal);
1580 if ( ! HAL_STATUS_SUCCESS( status ) )
1581 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001582 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 break;
1584 }
1585#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1586 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1587 {
1588 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001589 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001590 break;
1591 }
1592#endif
1593
1594#if defined WLAN_FEATURE_VOWIFI
1595 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1596 {
1597 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001598 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 break;
1600 }
1601#endif
1602 }
1603 pMac->sme.state = SME_STATE_READY;
1604 } while( 0 );
1605
1606 return status;
1607}
1608
1609/*--------------------------------------------------------------------------
1610
1611 \brief sme_Start() - Put all SME modules at ready state.
1612
1613 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1614 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001615 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 \param hHal - The handle returned by macOpen.
1617
1618 \return eHAL_STATUS_SUCCESS - SME is ready.
1619
1620 Other status means SME is failed to start
1621 \sa
1622
1623 --------------------------------------------------------------------------*/
1624eHalStatus sme_Start(tHalHandle hHal)
1625{
1626 eHalStatus status = eHAL_STATUS_FAILURE;
1627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1628
1629 do
1630 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001631 status = csrStart(pMac);
1632 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001633 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 status );
1635 break;
1636 }
1637
1638 status = pmcStart(hHal);
1639 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001640 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 status );
1642 break;
1643 }
1644
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1646 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001647 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 status );
1649 break;
1650 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001651 pMac->sme.state = SME_STATE_START;
1652 }while (0);
1653
1654 return status;
1655}
1656
1657
1658#ifdef WLAN_FEATURE_PACKET_FILTERING
1659/******************************************************************************
1660*
1661* Name: sme_PCFilterMatchCountResponseHandler
1662*
1663* Description:
1664* Invoke Packet Coalescing Filter Match Count callback routine
1665*
1666* Parameters:
1667* hHal - HAL handle for device
1668* pMsg - Pointer to tRcvFltPktMatchRsp structure
1669*
1670* Returns: eHalStatus
1671*
1672******************************************************************************/
1673eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1674{
1675 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1676 eHalStatus status = eHAL_STATUS_SUCCESS;
1677 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1678
1679 if (NULL == pMsg)
1680 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001681 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 status = eHAL_STATUS_FAILURE;
1683 }
1684 else
1685 {
1686 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001687 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001688
1689 /* Call Packet Coalescing Filter Match Count callback routine. */
1690 if (pMac->pmc.FilterMatchCountCB != NULL)
1691 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1692 pRcvFltPktMatchRsp);
1693
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001694 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 pRcvFltPktMatchRsp->status);
1696
1697 pMac->pmc.FilterMatchCountCB = NULL;
1698 pMac->pmc.FilterMatchCountCBContext = NULL;
1699 }
1700
1701 return(status);
1702}
1703#endif // WLAN_FEATURE_PACKET_FILTERING
1704
1705
Chet Lanctot186b5732013-03-18 10:26:30 -07001706#ifdef WLAN_FEATURE_11W
1707/*------------------------------------------------------------------
1708 *
1709 * Handle the unprotected management frame indication from LIM and
1710 * forward it to HDD.
1711 *
1712 *------------------------------------------------------------------*/
1713
1714eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1715 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1716{
1717 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1718 eHalStatus status = eHAL_STATUS_SUCCESS;
1719 tCsrRoamInfo pRoamInfo = {0};
1720 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1721
1722 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1723 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1724 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1725
1726 /* forward the mgmt frame to HDD */
1727 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1728
1729 return status;
1730}
1731#endif
1732
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001733#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001734/*------------------------------------------------------------------
1735 *
1736 * Handle the tsm ie indication from LIM and forward it to HDD.
1737 *
1738 *------------------------------------------------------------------*/
1739
1740eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1741{
1742 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1743 eHalStatus status = eHAL_STATUS_SUCCESS;
1744 tCsrRoamInfo pRoamInfo = {0};
1745 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1746
1747 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1748 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1749 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1750
1751 /* forward the tsm ie information to HDD */
1752 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1753
1754 return status;
1755}
1756
1757/* ---------------------------------------------------------------------------
1758 \fn sme_SetCCKMIe
1759 \brief function to store the CCKM IE passed from supplicant and use it while packing
1760 reassociation request
1761 \param hHal - HAL handle for device
1762 \param pCckmIe - pointer to CCKM IE data
1763 \param pCckmIeLen - length of the CCKM IE
1764 \- return Success or failure
1765 -------------------------------------------------------------------------*/
1766eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1767 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1768{
1769 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1770 eHalStatus status = eHAL_STATUS_SUCCESS;
1771
1772 status = sme_AcquireGlobalLock( &pMac->sme );
1773 if ( HAL_STATUS_SUCCESS( status ) )
1774 {
1775 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1776 sme_ReleaseGlobalLock( &pMac->sme );
1777 }
1778 return status;
1779}
1780
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001781/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001782 \fn sme_SetEseBeaconRequest
1783 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001784 \param hHal - HAL handle for device
1785 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001786 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001787 \- return Success or failure
1788 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001789eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1790 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001791{
1792 eHalStatus status = eSIR_SUCCESS;
1793 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1794 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001795 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001796 tANI_U8 counter = 0;
1797 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1798 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1799
1800 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001801 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001802
1803 //Prepare the request to send to SME.
1804 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1805 if(NULL == pSmeBcnReportReq)
1806 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001807 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001808 return eSIR_FAILURE;
1809 }
1810
1811 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1812 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1813
1814 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1815 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1816 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1817 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001818 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1819 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001820
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001821 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001822 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001823 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001824 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1825 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1826 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1827 }
1828
1829 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1830 return status;
1831}
1832
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001833#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001834
Chet Lanctot186b5732013-03-18 10:26:30 -07001835
c_hpothu92367912014-05-01 15:18:17 +05301836/* ---------------------------------------------------------------------------
1837 \fn sme_getBcnMissRate
1838 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1839 \param hHal - HAL handle for device.
1840 \param sessionId - session ID.
1841 \- return Success or Failure.
1842 -------------------------------------------------------------------------*/
1843
1844eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1845{
1846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1847 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1848 vos_msg_t vosMessage;
1849 tSirBcnMissRateReq *pMsg;
1850 tCsrRoamSession *pSession;
1851
1852 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1853 {
1854 pSession = CSR_GET_SESSION( pMac, sessionId );
1855
1856 if (!pSession)
1857 {
1858 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1859 sme_ReleaseGlobalLock( &pMac->sme );
1860 return eHAL_STATUS_FAILURE;
1861 }
1862
c_hpothu402de812014-07-10 15:55:45 +05301863 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05301864 if (NULL == pMsg)
1865 {
1866 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1867 sme_ReleaseGlobalLock( &pMac->sme );
1868 return eHAL_STATUS_FAILURE;
1869 }
1870
1871 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1872 sizeof(tSirMacAddr));
1873
1874 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1875 pMsg->callback = callback;
1876 pMsg->data = data;
1877
1878 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1879 vosMessage.bodyptr = pMsg;
1880 vosMessage.reserved = 0;
1881 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1882 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1883 {
1884 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1885 "%s: Post Set TM Level MSG fail", __func__);
1886 vos_mem_free(pMsg);
1887 sme_ReleaseGlobalLock( &pMac->sme );
1888 return eHAL_STATUS_FAILURE;
1889 }
1890 sme_ReleaseGlobalLock( &pMac->sme);
1891 return eHAL_STATUS_SUCCESS;
1892 }
1893 return eHAL_STATUS_FAILURE;
1894}
1895
Jeff Johnson295189b2012-06-20 16:38:30 -07001896/*--------------------------------------------------------------------------
1897
1898 \brief sme_ProcessMsg() - The main message processor for SME.
1899
1900 The function is called by a message dispatcher when to process a message
1901 targeted for SME.
1902
Srinivas Girigowdade697412013-02-14 16:31:48 -08001903 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001904 \param hHal - The handle returned by macOpen.
1905 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1906
1907 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1908
1909 Other status means SME failed to process the message to HAL.
1910 \sa
1911
1912 --------------------------------------------------------------------------*/
1913eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1914{
1915 eHalStatus status = eHAL_STATUS_FAILURE;
1916 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1917
1918 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001919 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 return status;
1921 }
1922
1923 status = sme_AcquireGlobalLock( &pMac->sme );
1924 if ( HAL_STATUS_SUCCESS( status ) )
1925 {
1926 if( SME_IS_START(pMac) )
1927 {
1928 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1929 case eWNI_PMC_ENTER_BMPS_RSP:
1930 case eWNI_PMC_EXIT_BMPS_RSP:
1931 case eWNI_PMC_EXIT_BMPS_IND:
1932 case eWNI_PMC_ENTER_IMPS_RSP:
1933 case eWNI_PMC_EXIT_IMPS_RSP:
1934 case eWNI_PMC_SMPS_STATE_IND:
1935 case eWNI_PMC_ENTER_UAPSD_RSP:
1936 case eWNI_PMC_EXIT_UAPSD_RSP:
1937 case eWNI_PMC_ENTER_WOWL_RSP:
1938 case eWNI_PMC_EXIT_WOWL_RSP:
1939 //PMC
1940 if (pMsg->bodyptr)
1941 {
1942 pmcMessageProcessor(hHal, pMsg->bodyptr);
1943 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301944 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001946 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 }
1948 break;
1949
1950 case WNI_CFG_SET_CNF:
1951 case WNI_CFG_DNLD_CNF:
1952 case WNI_CFG_GET_RSP:
1953 case WNI_CFG_ADD_GRP_ADDR_CNF:
1954 case WNI_CFG_DEL_GRP_ADDR_CNF:
1955 //CCM
1956 if (pMsg->bodyptr)
1957 {
1958 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1959 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301960 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001962 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 }
1964 break;
1965
1966 case eWNI_SME_ADDTS_RSP:
1967 case eWNI_SME_DELTS_RSP:
1968 case eWNI_SME_DELTS_IND:
1969#ifdef WLAN_FEATURE_VOWIFI_11R
1970 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001971#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 //QoS
1973 if (pMsg->bodyptr)
1974 {
1975#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1976 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301977 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001978#endif
1979 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001980 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001981 }
1982 break;
1983#if defined WLAN_FEATURE_VOWIFI
1984 case eWNI_SME_NEIGHBOR_REPORT_IND:
1985 case eWNI_SME_BEACON_REPORT_REQ_IND:
1986#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001987 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001988#endif
1989 if ( pMsg->bodyptr )
1990 {
1991 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301992 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 }
1994 else
1995 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001996 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 }
1998 break;
1999#endif
2000
Jeff Johnsone7245742012-09-05 17:12:55 -07002001#ifdef FEATURE_OEM_DATA_SUPPORT
2002 //Handle the eWNI_SME_OEM_DATA_RSP:
2003 case eWNI_SME_OEM_DATA_RSP:
2004 if(pMsg->bodyptr)
2005 {
2006 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2007 vos_mem_free(pMsg->bodyptr);
2008 }
2009 else
2010 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002011 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002012 }
2013 smeProcessPendingQueue( pMac );
2014 break;
2015#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002016
2017 case eWNI_SME_ADD_STA_SELF_RSP:
2018 if(pMsg->bodyptr)
2019 {
2020 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2021 vos_mem_free(pMsg->bodyptr);
2022 }
2023 else
2024 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002025 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002026 }
2027 break;
2028 case eWNI_SME_DEL_STA_SELF_RSP:
2029 if(pMsg->bodyptr)
2030 {
2031 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2032 vos_mem_free(pMsg->bodyptr);
2033 }
2034 else
2035 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002036 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 }
2038 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 case eWNI_SME_REMAIN_ON_CHN_RSP:
2040 if(pMsg->bodyptr)
2041 {
2042 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2043 vos_mem_free(pMsg->bodyptr);
2044 }
2045 else
2046 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002047 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 }
2049 break;
2050 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2051 if(pMsg->bodyptr)
2052 {
2053 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2054 vos_mem_free(pMsg->bodyptr);
2055 }
2056 else
2057 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002058 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 -07002059 }
2060 break;
2061 case eWNI_SME_MGMT_FRM_IND:
2062 if(pMsg->bodyptr)
2063 {
2064 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2065 vos_mem_free(pMsg->bodyptr);
2066 }
2067 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002068 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002069 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 }
2071 break;
2072 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2073 if(pMsg->bodyptr)
2074 {
2075 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2076 vos_mem_free(pMsg->bodyptr);
2077 }
2078 else
2079 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002080 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002081 }
2082 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 case eWNI_SME_COEX_IND:
2084 if(pMsg->bodyptr)
2085 {
2086 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2087 vos_mem_free(pMsg->bodyptr);
2088 }
2089 else
2090 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002091 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002092 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002093 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002094
2095#ifdef FEATURE_WLAN_SCAN_PNO
2096 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2097 if(pMsg->bodyptr)
2098 {
2099 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2100 vos_mem_free(pMsg->bodyptr);
2101 }
2102 else
2103 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002104 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 }
2106 break;
2107#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002108
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 case eWNI_SME_TX_PER_HIT_IND:
2110 if (pMac->sme.pTxPerHitCallback)
2111 {
2112 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2113 }
2114 break;
2115
2116 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002117 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 {
2119 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2120 vos_mem_free(pMsg->bodyptr);
2121 }
2122 else
2123 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002124 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2125 }
2126 break;
2127
2128 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2129 if (pMsg->bodyptr)
2130 {
2131 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2132 vos_mem_free(pMsg->bodyptr);
2133 }
2134 else
2135 {
2136 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 }
2138 break;
2139
2140#ifdef WLAN_FEATURE_PACKET_FILTERING
2141 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2142 if(pMsg->bodyptr)
2143 {
2144 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2145 vos_mem_free(pMsg->bodyptr);
2146 }
2147 else
2148 {
2149 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002150 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 }
2152 break;
2153#endif // WLAN_FEATURE_PACKET_FILTERING
2154 case eWNI_SME_PRE_SWITCH_CHL_IND:
2155 {
2156 status = sme_HandlePreChannelSwitchInd(pMac);
2157 break;
2158 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002159
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 case eWNI_SME_POST_SWITCH_CHL_IND:
2161 {
2162 status = sme_HandlePostChannelSwitchInd(pMac);
2163 break;
2164 }
2165
2166#ifdef WLAN_WAKEUP_EVENTS
2167 case eWNI_SME_WAKE_REASON_IND:
2168 if(pMsg->bodyptr)
2169 {
2170 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2171 vos_mem_free(pMsg->bodyptr);
2172 }
2173 else
2174 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002175 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 }
2177 break;
2178#endif // WLAN_WAKEUP_EVENTS
2179
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002180#ifdef FEATURE_WLAN_TDLS
2181 /*
2182 * command rescived from PE, SME tdls msg processor shall be called
2183 * to process commands recieved from PE
2184 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002185 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2186 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002187 case eWNI_SME_TDLS_DEL_STA_RSP:
2188 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002189 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002190 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302191 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002192#ifdef FEATURE_WLAN_TDLS_INTERNAL
2193 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2194 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2195 case eWNI_SME_TDLS_LINK_START_RSP:
2196 case eWNI_SME_TDLS_LINK_START_IND:
2197 case eWNI_SME_TDLS_TEARDOWN_RSP:
2198 case eWNI_SME_TDLS_TEARDOWN_IND:
2199 case eWNI_SME_ADD_TDLS_PEER_IND:
2200 case eWNI_SME_DELETE_TDLS_PEER_IND:
2201#endif
2202 {
2203 if (pMsg->bodyptr)
2204 {
2205 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302206 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002207 }
2208 else
2209 {
2210 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002211 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002212 }
2213 break;
2214 }
2215#endif
2216
Chet Lanctot186b5732013-03-18 10:26:30 -07002217#ifdef WLAN_FEATURE_11W
2218 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2219 if (pMsg->bodyptr)
2220 {
2221 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2222 vos_mem_free(pMsg->bodyptr);
2223 }
2224 else
2225 {
2226 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2227 }
2228 break;
2229#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002230#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002231 case eWNI_SME_TSM_IE_IND:
2232 {
2233 if (pMsg->bodyptr)
2234 {
2235 sme_TsmIeInd(pMac, pMsg->bodyptr);
2236 vos_mem_free(pMsg->bodyptr);
2237 }
2238 else
2239 {
2240 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2241 }
2242 break;
2243 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002244#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002245#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2246 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2247 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2248 break;
2249#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002250
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302251#ifdef WLAN_FEATURE_GTK_OFFLOAD
2252 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2253 if (pMsg->bodyptr)
2254 {
2255 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2256 vos_mem_free(pMsg->bodyptr);
2257 }
2258 else
2259 {
2260 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2261 }
2262 break ;
2263#endif
Leo Chang9056f462013-08-01 19:21:11 -07002264
2265#ifdef FEATURE_WLAN_LPHB
2266 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002267 case eWNI_SME_LPHB_IND:
2268 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002269 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002270 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002271 }
2272 vos_mem_free(pMsg->bodyptr);
2273
2274 break;
2275#endif /* FEATURE_WLAN_LPHB */
2276
Leo Chang0b0e45a2013-12-15 15:18:55 -08002277#ifdef FEATURE_WLAN_CH_AVOID
2278 /* LPHB timeout indication arrived, send IND to client */
2279 case eWNI_SME_CH_AVOID_IND:
2280 if (pMac->sme.pChAvoidNotificationCb)
2281 {
2282 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2283 "%s: CH avoid notification", __func__);
2284 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2285 }
2286 vos_mem_free(pMsg->bodyptr);
2287
2288 break;
2289#endif /* FEATURE_WLAN_CH_AVOID */
2290
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 default:
2292
2293 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2294 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2295 {
2296 //CSR
2297 if (pMsg->bodyptr)
2298 {
2299 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302300 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 }
2302 else
2303 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002304 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 }
2306 }
2307 else
2308 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002309 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 pMsg->type);
2311 if (pMsg->bodyptr)
2312 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302313 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002314 }
2315 }
2316 }//switch
2317 } //SME_IS_START
2318 else
2319 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002320 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 if (pMsg->bodyptr)
2322 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302323 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002324 }
2325 }
2326 sme_ReleaseGlobalLock( &pMac->sme );
2327 }
2328 else
2329 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002330 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 if (pMsg->bodyptr)
2332 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302333 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 }
2335 }
2336
2337 return status;
2338}
2339
2340
2341//No need to hold the global lock here because this function can only be called
2342//after sme_Stop.
2343v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2344{
2345 if( pMsg )
2346 {
2347 if (pMsg->bodyptr)
2348 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302349 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 }
2351 }
2352
2353}
2354
2355
2356/*--------------------------------------------------------------------------
2357
2358 \brief sme_Stop() - Stop all SME modules and put them at idle state
2359
2360 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2361 return, all modules are at idle state ready to start.
2362
Srinivas Girigowdade697412013-02-14 16:31:48 -08002363 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302365 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002366
2367 \return eHAL_STATUS_SUCCESS - SME is stopped.
2368
2369 Other status means SME is failed to stop but caller should still
2370 consider SME is stopped.
2371 \sa
2372
2373 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302374eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002375{
2376 eHalStatus status = eHAL_STATUS_FAILURE;
2377 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2379
Jeff Johnson295189b2012-06-20 16:38:30 -07002380 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2381 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002382 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 status );
2384 fail_status = status;
2385 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002386
2387 p2pStop(hHal);
2388
Kiet Lama72a2322013-11-15 11:18:11 +05302389 status = pmcStop(hHal);
2390 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2391 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2392 status );
2393 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002394 }
2395
Kiet Lama72a2322013-11-15 11:18:11 +05302396 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002398 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 status );
2400 fail_status = status;
2401 }
2402
2403 ccmStop(hHal);
2404
2405 purgeSmeCmdList(pMac);
2406
2407 if (!HAL_STATUS_SUCCESS( fail_status )) {
2408 status = fail_status;
2409 }
2410
2411 pMac->sme.state = SME_STATE_STOP;
2412
2413 return status;
2414}
2415
2416/*--------------------------------------------------------------------------
2417
2418 \brief sme_Close() - Release all SME modules and their resources.
2419
2420 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2421 return, all modules are at closed state.
2422
2423 No SME APIs can be involved after smeClose except smeOpen.
2424 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002425 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 \param hHal - The handle returned by macOpen
2427
2428 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2429
2430 Other status means SME is failed to be closed but caller still cannot
2431 call any other SME functions except smeOpen.
2432 \sa
2433
2434 --------------------------------------------------------------------------*/
2435eHalStatus sme_Close(tHalHandle hHal)
2436{
2437 eHalStatus status = eHAL_STATUS_FAILURE;
2438 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2439 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2440
2441 status = csrClose(pMac);
2442 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002443 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002444 status );
2445 fail_status = status;
2446 }
2447
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2449 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002450 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002451 status );
2452 fail_status = status;
2453 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002454
2455#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2456 status = btcClose(hHal);
2457 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002458 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 status );
2460 fail_status = status;
2461 }
2462
2463 status = sme_QosClose(pMac);
2464 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002465 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 status );
2467 fail_status = status;
2468 }
2469#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002470#ifdef FEATURE_OEM_DATA_SUPPORT
2471 status = oemData_OemDataReqClose(hHal);
2472 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002473 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002474 status );
2475 fail_status = status;
2476 }
2477#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002478
2479 status = ccmClose(hHal);
2480 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002481 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 status );
2483 fail_status = status;
2484 }
2485
2486 status = pmcClose(hHal);
2487 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002488 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002489 status );
2490 fail_status = status;
2491 }
2492#if defined WLAN_FEATURE_VOWIFI
2493 status = rrmClose(hHal);
2494 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002495 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002496 status );
2497 fail_status = status;
2498 }
2499#endif
2500
2501#if defined WLAN_FEATURE_VOWIFI_11R
2502 sme_FTClose(hHal);
2503#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002505
2506 freeSmeCmdList(pMac);
2507
2508 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2509 {
2510 fail_status = eHAL_STATUS_FAILURE;
2511 }
2512
2513 if (!HAL_STATUS_SUCCESS( fail_status )) {
2514 status = fail_status;
2515 }
2516
2517 pMac->sme.state = SME_STATE_STOP;
2518
2519 return status;
2520}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002521#ifdef FEATURE_WLAN_LFR
2522tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2523{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002524#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002525 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2526 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2527 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2528 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2529 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2530 return eANI_BOOLEAN_FALSE;
2531 default:
2532 return eANI_BOOLEAN_TRUE;
2533 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002534#else
2535 /*
2536 * TODO: always return TRUE for now until
2537 * we figure out why we could be stuck in
2538 * one of the roaming states forever.
2539 */
2540 return eANI_BOOLEAN_TRUE;
2541#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002542}
2543#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002544/* ---------------------------------------------------------------------------
2545 \fn sme_ScanRequest
2546 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002547 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 \param pScanRequestID - pointer to an object to get back the request ID
2549 \param callback - a callback function that scan calls upon finish, will not
2550 be called if csrScanRequest returns error
2551 \param pContext - a pointer passed in for the callback
2552 \return eHalStatus
2553 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002554eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2555 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002556 csrScanCompleteCallback callback, void *pContext)
2557{
2558 eHalStatus status = eHAL_STATUS_FAILURE;
2559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302560 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002561 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002562 smsLog(pMac, LOG2, FL("enter"));
2563 do
2564 {
2565 if(pMac->scan.fScanEnable)
2566 {
2567 status = sme_AcquireGlobalLock( &pMac->sme );
2568 if ( HAL_STATUS_SUCCESS( status ) )
2569 {
2570 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002571#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002572 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002573 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002574#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002575 status = csrScanRequest( hHal, sessionId, pscanReq,
2576 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302577 if ( !HAL_STATUS_SUCCESS( status ) )
2578 {
2579 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2580 " SId=%d"), sessionId);
2581 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002582#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002583 }
2584 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002585 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302586 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302587 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302588 macTraceGetNeighbourRoamState(
2589 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302590 macTraceGetcsrRoamSubState(
2591 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002592 /*HandOff is in progress. So schedule this scan later*/
2593 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002594 }
2595#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002597
Jeff Johnson295189b2012-06-20 16:38:30 -07002598 sme_ReleaseGlobalLock( &pMac->sme );
2599 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002600 else
2601 {
2602 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2603 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002605 else
2606 {
2607 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2608 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002609 } while( 0 );
2610
2611 return (status);
2612
2613
2614}
2615
2616/* ---------------------------------------------------------------------------
2617 \fn sme_ScanGetResult
2618 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002619 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 \param pFilter - If pFilter is NULL, all cached results are returned
2621 \param phResult - an object for the result.
2622 \return eHalStatus
2623 ---------------------------------------------------------------------------*/
2624eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2625 tScanResultHandle *phResult)
2626{
2627 eHalStatus status = eHAL_STATUS_FAILURE;
2628 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 smsLog(pMac, LOG2, FL("enter"));
2633 status = sme_AcquireGlobalLock( &pMac->sme );
2634 if ( HAL_STATUS_SUCCESS( status ) )
2635 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002636 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 sme_ReleaseGlobalLock( &pMac->sme );
2638 }
2639 smsLog(pMac, LOG2, FL("exit status %d"), status);
2640
2641 return (status);
2642}
2643
2644
2645/* ---------------------------------------------------------------------------
2646 \fn sme_ScanFlushResult
2647 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002648 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 \return eHalStatus
2650 ---------------------------------------------------------------------------*/
2651eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2652{
2653 eHalStatus status = eHAL_STATUS_FAILURE;
2654 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2655
Katya Nigambcb705f2013-12-26 14:26:22 +05302656 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002657 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 status = sme_AcquireGlobalLock( &pMac->sme );
2659 if ( HAL_STATUS_SUCCESS( status ) )
2660 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002661 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 sme_ReleaseGlobalLock( &pMac->sme );
2663 }
2664
2665 return (status);
2666}
2667
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302668/* ---------------------------------------------------------------------------
2669 \fn sme_FilterScanResults
2670 \brief a wrapper function to request CSR to clear scan results.
2671 This is a synchronous call
2672 \return eHalStatus
2673 ---------------------------------------------------------------------------*/
2674eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2675{
2676 eHalStatus status = eHAL_STATUS_SUCCESS;
2677 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2678
2679 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2680 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2681 status = sme_AcquireGlobalLock( &pMac->sme );
2682 if ( HAL_STATUS_SUCCESS( status ) )
2683 {
2684 csrScanFilterResults(pMac);
2685 sme_ReleaseGlobalLock( &pMac->sme );
2686 }
2687
2688 return (status);
2689}
2690
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002691eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2692{
2693 eHalStatus status = eHAL_STATUS_FAILURE;
2694 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2695
Katya Nigambcb705f2013-12-26 14:26:22 +05302696 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002697 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002698 status = sme_AcquireGlobalLock( &pMac->sme );
2699 if ( HAL_STATUS_SUCCESS( status ) )
2700 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302701 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002702 sme_ReleaseGlobalLock( &pMac->sme );
2703 }
2704
2705 return (status);
2706}
Jeff Johnson295189b2012-06-20 16:38:30 -07002707
2708/* ---------------------------------------------------------------------------
2709 \fn sme_ScanResultGetFirst
2710 \brief a wrapper function to request CSR to returns the first element of
2711 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002712 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 \param hScanResult - returned from csrScanGetResult
2714 \return tCsrScanResultInfo * - NULL if no result
2715 ---------------------------------------------------------------------------*/
2716tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2717 tScanResultHandle hScanResult)
2718{
2719 eHalStatus status = eHAL_STATUS_FAILURE;
2720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2721 tCsrScanResultInfo *pRet = NULL;
2722
Katya Nigambcb705f2013-12-26 14:26:22 +05302723 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002724 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 status = sme_AcquireGlobalLock( &pMac->sme );
2726 if ( HAL_STATUS_SUCCESS( status ) )
2727 {
2728 pRet = csrScanResultGetFirst( pMac, hScanResult );
2729 sme_ReleaseGlobalLock( &pMac->sme );
2730 }
2731
2732 return (pRet);
2733}
2734
2735
2736/* ---------------------------------------------------------------------------
2737 \fn sme_ScanResultGetNext
2738 \brief a wrapper function to request CSR to returns the next element of
2739 scan result. It can be called without calling csrScanResultGetFirst
2740 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002741 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 \param hScanResult - returned from csrScanGetResult
2743 \return Null if no result or reach the end
2744 ---------------------------------------------------------------------------*/
2745tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2746 tScanResultHandle hScanResult)
2747{
2748 eHalStatus status = eHAL_STATUS_FAILURE;
2749 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2750 tCsrScanResultInfo *pRet = NULL;
2751
Katya Nigambcb705f2013-12-26 14:26:22 +05302752 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002753 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 status = sme_AcquireGlobalLock( &pMac->sme );
2755 if ( HAL_STATUS_SUCCESS( status ) )
2756 {
2757 pRet = csrScanResultGetNext( pMac, hScanResult );
2758 sme_ReleaseGlobalLock( &pMac->sme );
2759 }
2760
2761 return (pRet);
2762}
2763
2764
2765/* ---------------------------------------------------------------------------
2766 \fn sme_ScanSetBGScanparams
2767 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002768 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002769 \param pScanReq - BG scan request structure
2770 \return eHalStatus
2771 ---------------------------------------------------------------------------*/
2772eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2773{
2774 eHalStatus status = eHAL_STATUS_FAILURE;
2775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2776
2777 if( NULL != pScanReq )
2778 {
2779 status = sme_AcquireGlobalLock( &pMac->sme );
2780 if ( HAL_STATUS_SUCCESS( status ) )
2781 {
2782 status = csrScanSetBGScanparams( hHal, pScanReq );
2783 sme_ReleaseGlobalLock( &pMac->sme );
2784 }
2785 }
2786
2787 return (status);
2788}
2789
2790
2791/* ---------------------------------------------------------------------------
2792 \fn sme_ScanResultPurge
2793 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2794 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002795 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 \param hScanResult - returned from csrScanGetResult. hScanResult is
2797 considered gone by
2798 calling this function and even before this function reutrns.
2799 \return eHalStatus
2800 ---------------------------------------------------------------------------*/
2801eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2802{
2803 eHalStatus status = eHAL_STATUS_FAILURE;
2804 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2805
Katya Nigambcb705f2013-12-26 14:26:22 +05302806 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002807 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002808 status = sme_AcquireGlobalLock( &pMac->sme );
2809 if ( HAL_STATUS_SUCCESS( status ) )
2810 {
2811 status = csrScanResultPurge( hHal, hScanResult );
2812 sme_ReleaseGlobalLock( &pMac->sme );
2813 }
2814
2815 return (status);
2816}
2817
2818/* ---------------------------------------------------------------------------
2819 \fn sme_ScanGetPMKIDCandidateList
2820 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002821 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 \param pPmkidList - caller allocated buffer point to an array of
2823 tPmkidCandidateInfo
2824 \param pNumItems - pointer to a variable that has the number of
2825 tPmkidCandidateInfo allocated when retruning, this is
2826 either the number needed or number of items put into
2827 pPmkidList
2828 \return eHalStatus - when fail, it usually means the buffer allocated is not
2829 big enough and pNumItems
2830 has the number of tPmkidCandidateInfo.
2831 \Note: pNumItems is a number of tPmkidCandidateInfo,
2832 not sizeof(tPmkidCandidateInfo) * something
2833 ---------------------------------------------------------------------------*/
2834eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002835 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002836 tANI_U32 *pNumItems )
2837{
2838 eHalStatus status = eHAL_STATUS_FAILURE;
2839 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2840
2841 status = sme_AcquireGlobalLock( &pMac->sme );
2842 if ( HAL_STATUS_SUCCESS( status ) )
2843 {
2844 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2845 sme_ReleaseGlobalLock( &pMac->sme );
2846 }
2847
2848 return (status);
2849}
2850
2851/*----------------------------------------------------------------------------
2852 \fn sme_RoamRegisterLinkQualityIndCallback
2853
2854 \brief
2855 a wrapper function to allow HDD to register a callback handler with CSR for
2856 link quality indications.
2857
2858 Only one callback may be registered at any time.
2859 In order to deregister the callback, a NULL cback may be provided.
2860
2861 Registration happens in the task context of the caller.
2862
2863 \param callback - Call back being registered
2864 \param pContext - user data
2865
2866 DEPENDENCIES: After CSR open
2867
2868 \return eHalStatus
2869-----------------------------------------------------------------------------*/
2870eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2871 csrRoamLinkQualityIndCallback callback,
2872 void *pContext)
2873{
2874 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2875}
2876
2877/* ---------------------------------------------------------------------------
2878 \fn sme_RoamRegisterCallback
2879 \brief a wrapper function to allow HDD to register a callback with CSR.
2880 Unlike scan, roam has one callback for all the roam requests
2881 \param callback - a callback function that roam calls upon when state changes
2882 \param pContext - a pointer passed in for the callback
2883 \return eHalStatus
2884 ---------------------------------------------------------------------------*/
2885eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2886 csrRoamCompleteCallback callback,
2887 void *pContext)
2888{
2889 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2890}
2891
2892eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2893{
2894 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2895 return pMac->roam.configParam.phyMode;
2896}
2897
2898/* ---------------------------------------------------------------------------
2899 \fn sme_RoamConnect
2900 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002901 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002902 \param sessionId - the sessionId returned by sme_OpenSession.
2903 \param pProfile - description of the network to which to connect
2904 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2905 from csrScanGetResult
2906 \param pRoamId - to get back the request ID
2907 \return eHalStatus
2908 ---------------------------------------------------------------------------*/
2909eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2910 tANI_U32 *pRoamId)
2911{
2912 eHalStatus status = eHAL_STATUS_FAILURE;
2913 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2914
Yue Mae36e3552014-03-05 17:06:20 -08002915 if (!pMac)
2916 {
2917 return eHAL_STATUS_FAILURE;
2918 }
2919
Katya Nigambcb705f2013-12-26 14:26:22 +05302920 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002921 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002922 smsLog(pMac, LOG2, FL("enter"));
2923 status = sme_AcquireGlobalLock( &pMac->sme );
2924 if ( HAL_STATUS_SUCCESS( status ) )
2925 {
2926 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2927 {
2928 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2929 }
2930 else
2931 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002932 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002933 status = eHAL_STATUS_INVALID_PARAMETER;
2934 }
2935 sme_ReleaseGlobalLock( &pMac->sme );
2936 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002937 else
2938 {
2939 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2940 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002941
2942 return (status);
2943}
2944
2945/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302946
2947 \fn sme_SetPhyMode
2948
2949 \brief Changes the PhyMode.
2950
2951 \param hHal - The handle returned by macOpen.
2952
2953 \param phyMode new phyMode which is to set
2954
2955 \return eHalStatus SUCCESS.
2956
2957 -------------------------------------------------------------------------------*/
2958eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2959{
2960 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2961
2962 if (NULL == pMac)
2963 {
2964 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2965 "%s: invalid context", __func__);
2966 return eHAL_STATUS_FAILURE;
2967 }
2968
2969 pMac->roam.configParam.phyMode = phyMode;
2970 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2971 pMac->roam.configParam.phyMode,
2972 pMac->roam.configParam.ProprietaryRatesEnabled);
2973
2974 return eHAL_STATUS_SUCCESS;
2975}
2976
2977/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 \fn sme_RoamReassoc
2979 \brief a wrapper function to request CSR to inititiate a re-association
2980 \param pProfile - can be NULL to join the currently connected AP. In that
2981 case modProfileFields should carry the modified field(s) which could trigger
2982 reassoc
2983 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2984 that might need modification dynamically once STA is up & running and this
2985 could trigger a reassoc
2986 \param pRoamId - to get back the request ID
2987 \return eHalStatus
2988 -------------------------------------------------------------------------------*/
2989eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2990 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002991 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002992{
2993 eHalStatus status = eHAL_STATUS_FAILURE;
2994 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2995
Katya Nigambcb705f2013-12-26 14:26:22 +05302996 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002997 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 smsLog(pMac, LOG2, FL("enter"));
2999 status = sme_AcquireGlobalLock( &pMac->sme );
3000 if ( HAL_STATUS_SUCCESS( status ) )
3001 {
3002 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3003 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003004 if((NULL == pProfile) && (fForce == 1))
3005 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003006 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3007 /* to force the AP initiate fresh 802.1x authentication need to clear
3008 * the PMKID cache for that set the following boolean. this is needed
3009 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3010 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003011 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3012 }
3013 else
3014 {
3015 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003016 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003017 }
3018 else
3019 {
3020 status = eHAL_STATUS_INVALID_PARAMETER;
3021 }
3022 sme_ReleaseGlobalLock( &pMac->sme );
3023 }
3024
3025 return (status);
3026}
3027
3028/* ---------------------------------------------------------------------------
3029 \fn sme_RoamConnectToLastProfile
3030 \brief a wrapper function to request CSR to disconnect and reconnect with
3031 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003032 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 \return eHalStatus. It returns fail if currently connected
3034 ---------------------------------------------------------------------------*/
3035eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3036{
3037 eHalStatus status = eHAL_STATUS_FAILURE;
3038 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3039
3040 status = sme_AcquireGlobalLock( &pMac->sme );
3041 if ( HAL_STATUS_SUCCESS( status ) )
3042 {
3043 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3044 {
3045 status = csrRoamConnectToLastProfile( pMac, sessionId );
3046 }
3047 else
3048 {
3049 status = eHAL_STATUS_INVALID_PARAMETER;
3050 }
3051 sme_ReleaseGlobalLock( &pMac->sme );
3052 }
3053
3054 return (status);
3055}
3056
3057/* ---------------------------------------------------------------------------
3058 \fn sme_RoamDisconnect
3059 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003060 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 \param reason -- To indicate the reason for disconnecting. Currently, only
3062 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3063 \return eHalStatus
3064 ---------------------------------------------------------------------------*/
3065eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3066{
3067 eHalStatus status = eHAL_STATUS_FAILURE;
3068 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3069
Katya Nigambcb705f2013-12-26 14:26:22 +05303070 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003071 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 smsLog(pMac, LOG2, FL("enter"));
3073 status = sme_AcquireGlobalLock( &pMac->sme );
3074 if ( HAL_STATUS_SUCCESS( status ) )
3075 {
3076 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3077 {
3078 status = csrRoamDisconnect( pMac, sessionId, reason );
3079 }
3080 else
3081 {
3082 status = eHAL_STATUS_INVALID_PARAMETER;
3083 }
3084 sme_ReleaseGlobalLock( &pMac->sme );
3085 }
3086
3087 return (status);
3088}
3089
Jeff Johnson295189b2012-06-20 16:38:30 -07003090/* ---------------------------------------------------------------------------
3091 \fn sme_RoamStopBss
3092 \brief To stop BSS for Soft AP. This is an asynchronous API.
3093 \param hHal - Global structure
3094 \param sessionId - sessionId of SoftAP
3095 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3096 -------------------------------------------------------------------------------*/
3097eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3098{
3099 eHalStatus status = eHAL_STATUS_FAILURE;
3100 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3101
3102 smsLog(pMac, LOG2, FL("enter"));
3103 status = sme_AcquireGlobalLock( &pMac->sme );
3104 if ( HAL_STATUS_SUCCESS( status ) )
3105 {
3106 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3107 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303108 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003109 }
3110 else
3111 {
3112 status = eHAL_STATUS_INVALID_PARAMETER;
3113 }
3114 sme_ReleaseGlobalLock( &pMac->sme );
3115 }
3116
3117 return (status);
3118}
3119
3120/* ---------------------------------------------------------------------------
3121 \fn sme_RoamDisconnectSta
3122 \brief To disassociate a station. This is an asynchronous API.
3123 \param hHal - Global structure
3124 \param sessionId - sessionId of SoftAP
3125 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3126 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3127 -------------------------------------------------------------------------------*/
3128eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3129 tANI_U8 *pPeerMacAddr)
3130{
3131 eHalStatus status = eHAL_STATUS_FAILURE;
3132 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3133
3134 if ( NULL == pMac )
3135 {
3136 VOS_ASSERT(0);
3137 return status;
3138 }
3139
3140 status = sme_AcquireGlobalLock( &pMac->sme );
3141 if ( HAL_STATUS_SUCCESS( status ) )
3142 {
3143 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3144 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003145 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303146 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 }
3148 else
3149 {
3150 status = eHAL_STATUS_INVALID_PARAMETER;
3151 }
3152 sme_ReleaseGlobalLock( &pMac->sme );
3153 }
3154
3155 return (status);
3156}
3157
3158/* ---------------------------------------------------------------------------
3159 \fn sme_RoamDeauthSta
3160 \brief To disassociate a station. This is an asynchronous API.
3161 \param hHal - Global structure
3162 \param sessionId - sessionId of SoftAP
3163 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3164 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3165 -------------------------------------------------------------------------------*/
3166eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3167 tANI_U8 *pPeerMacAddr)
3168{
3169 eHalStatus status = eHAL_STATUS_FAILURE;
3170 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3171
3172 if ( NULL == pMac )
3173 {
3174 VOS_ASSERT(0);
3175 return status;
3176 }
3177
3178 status = sme_AcquireGlobalLock( &pMac->sme );
3179 if ( HAL_STATUS_SUCCESS( status ) )
3180 {
3181 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3182 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003183 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303184 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 }
3186 else
3187 {
3188 status = eHAL_STATUS_INVALID_PARAMETER;
3189 }
3190 sme_ReleaseGlobalLock( &pMac->sme );
3191 }
3192
3193 return (status);
3194}
3195
3196/* ---------------------------------------------------------------------------
3197 \fn sme_RoamTKIPCounterMeasures
3198 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3199 \param sessionId - sessionId of SoftAP
3200 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3201 \return eHalStatus
3202 -------------------------------------------------------------------------------*/
3203eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3204 tANI_BOOLEAN bEnable)
3205{
3206 eHalStatus status = eHAL_STATUS_FAILURE;
3207 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3208
3209 if ( NULL == pMac )
3210 {
3211 VOS_ASSERT(0);
3212 return status;
3213 }
3214
3215 status = sme_AcquireGlobalLock( &pMac->sme );
3216 if ( HAL_STATUS_SUCCESS( status ) )
3217 {
3218 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3219 {
3220 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3221 }
3222 else
3223 {
3224 status = eHAL_STATUS_INVALID_PARAMETER;
3225 }
3226 sme_ReleaseGlobalLock( &pMac->sme );
3227 }
3228
3229 return (status);
3230}
3231
3232/* ---------------------------------------------------------------------------
3233 \fn sme_RoamGetAssociatedStas
3234 \brief To probe the list of associated stations from various modules of CORE stack.
3235 \This is an asynchronous API.
3236 \param sessionId - sessionId of SoftAP
3237 \param modId - Module from whom list of associtated stations is to be probed.
3238 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3239 \param pUsrContext - Opaque HDD context
3240 \param pfnSapEventCallback - Sap event callback in HDD
3241 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3242 \return eHalStatus
3243 -------------------------------------------------------------------------------*/
3244eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3245 VOS_MODULE_ID modId, void *pUsrContext,
3246 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3247{
3248 eHalStatus status = eHAL_STATUS_FAILURE;
3249 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3250
3251 if ( NULL == pMac )
3252 {
3253 VOS_ASSERT(0);
3254 return status;
3255 }
3256
3257 status = sme_AcquireGlobalLock( &pMac->sme );
3258 if ( HAL_STATUS_SUCCESS( status ) )
3259 {
3260 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3261 {
3262 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3263 }
3264 else
3265 {
3266 status = eHAL_STATUS_INVALID_PARAMETER;
3267 }
3268 sme_ReleaseGlobalLock( &pMac->sme );
3269 }
3270
3271 return (status);
3272}
3273
3274/* ---------------------------------------------------------------------------
3275 \fn sme_RoamGetWpsSessionOverlap
3276 \brief To get the WPS PBC session overlap information.
3277 \This is an asynchronous API.
3278 \param sessionId - sessionId of SoftAP
3279 \param pUsrContext - Opaque HDD context
3280 \param pfnSapEventCallback - Sap event callback in HDD
3281 \pRemoveMac - pointer to Mac address which needs to be removed from session
3282 \return eHalStatus
3283 -------------------------------------------------------------------------------*/
3284eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003285 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3287{
3288 eHalStatus status = eHAL_STATUS_FAILURE;
3289 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3290
3291 if ( NULL == pMac )
3292 {
3293 VOS_ASSERT(0);
3294 return status;
3295 }
3296
3297 status = sme_AcquireGlobalLock( &pMac->sme );
3298 if ( HAL_STATUS_SUCCESS( status ) )
3299 {
3300 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3301 {
3302 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3303 }
3304 else
3305 {
3306 status = eHAL_STATUS_INVALID_PARAMETER;
3307 }
3308 sme_ReleaseGlobalLock( &pMac->sme );
3309 }
3310
3311 return (status);
3312}
3313
Jeff Johnson295189b2012-06-20 16:38:30 -07003314
3315/* ---------------------------------------------------------------------------
3316 \fn sme_RoamGetConnectState
3317 \brief a wrapper function to request CSR to return the current connect state
3318 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003319 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003320 \return eHalStatus
3321 ---------------------------------------------------------------------------*/
3322eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3323{
3324 eHalStatus status = eHAL_STATUS_FAILURE;
3325 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3326
3327 status = sme_AcquireGlobalLock( &pMac->sme );
3328 if ( HAL_STATUS_SUCCESS( status ) )
3329 {
3330 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3331 {
3332 status = csrRoamGetConnectState( pMac, sessionId, pState );
3333 }
3334 else
3335 {
3336 status = eHAL_STATUS_INVALID_PARAMETER;
3337 }
3338 sme_ReleaseGlobalLock( &pMac->sme );
3339 }
3340
3341 return (status);
3342}
3343
3344/* ---------------------------------------------------------------------------
3345 \fn sme_RoamGetConnectProfile
3346 \brief a wrapper function to request CSR to return the current connect
3347 profile. Caller must call csrRoamFreeConnectProfile after it is done
3348 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003349 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003350 \param pProfile - pointer to a caller allocated structure
3351 tCsrRoamConnectedProfile
3352 \return eHalStatus. Failure if not connected
3353 ---------------------------------------------------------------------------*/
3354eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3355 tCsrRoamConnectedProfile *pProfile)
3356{
3357 eHalStatus status = eHAL_STATUS_FAILURE;
3358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3359
Katya Nigambcb705f2013-12-26 14:26:22 +05303360 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003361 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 status = sme_AcquireGlobalLock( &pMac->sme );
3363 if ( HAL_STATUS_SUCCESS( status ) )
3364 {
3365 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3366 {
3367 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3368 }
3369 else
3370 {
3371 status = eHAL_STATUS_INVALID_PARAMETER;
3372 }
3373 sme_ReleaseGlobalLock( &pMac->sme );
3374 }
3375
3376 return (status);
3377}
3378
3379/* ---------------------------------------------------------------------------
3380 \fn sme_RoamFreeConnectProfile
3381 \brief a wrapper function to request CSR to free and reinitialize the
3382 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003383 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 \param pProfile - pointer to a caller allocated structure
3385 tCsrRoamConnectedProfile
3386 \return eHalStatus.
3387 ---------------------------------------------------------------------------*/
3388eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3389 tCsrRoamConnectedProfile *pProfile)
3390{
3391 eHalStatus status = eHAL_STATUS_FAILURE;
3392 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3393
Katya Nigambcb705f2013-12-26 14:26:22 +05303394 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003395 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003396 status = sme_AcquireGlobalLock( &pMac->sme );
3397 if ( HAL_STATUS_SUCCESS( status ) )
3398 {
3399 status = csrRoamFreeConnectProfile( pMac, pProfile );
3400 sme_ReleaseGlobalLock( &pMac->sme );
3401 }
3402
3403 return (status);
3404}
3405
3406/* ---------------------------------------------------------------------------
3407 \fn sme_RoamSetPMKIDCache
3408 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003409 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003410 \param pPMKIDCache - caller allocated buffer point to an array of
3411 tPmkidCacheInfo
3412 \param numItems - a variable that has the number of tPmkidCacheInfo
3413 allocated when retruning, this is either the number needed
3414 or number of items put into pPMKIDCache
3415 \return eHalStatus - when fail, it usually means the buffer allocated is not
3416 big enough and pNumItems has the number of
3417 tPmkidCacheInfo.
3418 \Note: pNumItems is a number of tPmkidCacheInfo,
3419 not sizeof(tPmkidCacheInfo) * something
3420 ---------------------------------------------------------------------------*/
3421eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3422 tANI_U32 numItems )
3423{
3424 eHalStatus status = eHAL_STATUS_FAILURE;
3425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3426
Katya Nigambcb705f2013-12-26 14:26:22 +05303427 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003428 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 status = sme_AcquireGlobalLock( &pMac->sme );
3430 if ( HAL_STATUS_SUCCESS( status ) )
3431 {
3432 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3433 {
3434 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3435 }
3436 else
3437 {
3438 status = eHAL_STATUS_INVALID_PARAMETER;
3439 }
3440 sme_ReleaseGlobalLock( &pMac->sme );
3441 }
3442
3443 return (status);
3444}
3445
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003446eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3447{
3448 eHalStatus status = eHAL_STATUS_FAILURE;
3449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3450 status = sme_AcquireGlobalLock( &pMac->sme );
3451 if ( HAL_STATUS_SUCCESS( status ) )
3452 {
3453 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3454 {
3455 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3456 }
3457 else
3458 {
3459 status = eHAL_STATUS_INVALID_PARAMETER;
3460 }
3461 sme_ReleaseGlobalLock( &pMac->sme );
3462 }
3463 return (status);
3464}
Wilson Yang47b58192013-12-11 11:40:19 -08003465
Jeff Johnson295189b2012-06-20 16:38:30 -07003466/* ---------------------------------------------------------------------------
3467 \fn sme_RoamGetSecurityReqIE
3468 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3469 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003470 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003471 \param pLen - caller allocated memory that has the length of pBuf as input.
3472 Upon returned, *pLen has the needed or IE length in pBuf.
3473 \param pBuf - Caller allocated memory that contain the IE field, if any,
3474 upon return
3475 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3476 \return eHalStatus - when fail, it usually means the buffer allocated is not
3477 big enough
3478 ---------------------------------------------------------------------------*/
3479eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3480 tANI_U8 *pBuf, eCsrSecurityType secType)
3481{
3482 eHalStatus status = eHAL_STATUS_FAILURE;
3483 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3484
3485 status = sme_AcquireGlobalLock( &pMac->sme );
3486 if ( HAL_STATUS_SUCCESS( status ) )
3487 {
3488 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3489 {
3490 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3491 }
3492 else
3493 {
3494 status = eHAL_STATUS_INVALID_PARAMETER;
3495 }
3496 sme_ReleaseGlobalLock( &pMac->sme );
3497 }
3498
3499 return (status);
3500}
3501
3502/* ---------------------------------------------------------------------------
3503 \fn sme_RoamGetSecurityRspIE
3504 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3505 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003506 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 \param pLen - caller allocated memory that has the length of pBuf as input.
3508 Upon returned, *pLen has the needed or IE length in pBuf.
3509 \param pBuf - Caller allocated memory that contain the IE field, if any,
3510 upon return
3511 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3512 \return eHalStatus - when fail, it usually means the buffer allocated is not
3513 big enough
3514 ---------------------------------------------------------------------------*/
3515eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3516 tANI_U8 *pBuf, eCsrSecurityType secType)
3517{
3518 eHalStatus status = eHAL_STATUS_FAILURE;
3519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3520
3521 status = sme_AcquireGlobalLock( &pMac->sme );
3522 if ( HAL_STATUS_SUCCESS( status ) )
3523 {
3524 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3525 {
3526 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3527 }
3528 else
3529 {
3530 status = eHAL_STATUS_INVALID_PARAMETER;
3531 }
3532 sme_ReleaseGlobalLock( &pMac->sme );
3533 }
3534
3535 return (status);
3536
3537}
3538
3539
3540/* ---------------------------------------------------------------------------
3541 \fn sme_RoamGetNumPMKIDCache
3542 \brief a wrapper function to request CSR to return number of PMKID cache
3543 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003544 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003545 \return tANI_U32 - the number of PMKID cache entries
3546 ---------------------------------------------------------------------------*/
3547tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3548{
3549 eHalStatus status = eHAL_STATUS_FAILURE;
3550 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3551 tANI_U32 numPmkidCache = 0;
3552
3553 status = sme_AcquireGlobalLock( &pMac->sme );
3554 if ( HAL_STATUS_SUCCESS( status ) )
3555 {
3556 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3557 {
3558 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3559 status = eHAL_STATUS_SUCCESS;
3560 }
3561 else
3562 {
3563 status = eHAL_STATUS_INVALID_PARAMETER;
3564 }
3565 sme_ReleaseGlobalLock( &pMac->sme );
3566 }
3567
3568 return (numPmkidCache);
3569}
3570
3571/* ---------------------------------------------------------------------------
3572 \fn sme_RoamGetPMKIDCache
3573 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003574 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003575 \param pNum - caller allocated memory that has the space of the number of
3576 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3577 needed or actually number in tPmkidCacheInfo.
3578 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3579 any, upon return
3580 \return eHalStatus - when fail, it usually means the buffer allocated is not
3581 big enough
3582 ---------------------------------------------------------------------------*/
3583eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3584 tPmkidCacheInfo *pPmkidCache)
3585{
3586 eHalStatus status = eHAL_STATUS_FAILURE;
3587 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3588
3589 status = sme_AcquireGlobalLock( &pMac->sme );
3590 if ( HAL_STATUS_SUCCESS( status ) )
3591 {
3592 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3593 {
3594 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3595 }
3596 else
3597 {
3598 status = eHAL_STATUS_INVALID_PARAMETER;
3599 }
3600 sme_ReleaseGlobalLock( &pMac->sme );
3601 }
3602
3603 return (status);
3604}
3605
3606
3607/* ---------------------------------------------------------------------------
3608 \fn sme_GetConfigParam
3609 \brief a wrapper function that HDD calls to get the global settings
3610 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003611 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003612 \param pParam - caller allocated memory
3613 \return eHalStatus
3614 ---------------------------------------------------------------------------*/
3615eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3616{
3617 eHalStatus status = eHAL_STATUS_FAILURE;
3618 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3619
Katya Nigambcb705f2013-12-26 14:26:22 +05303620 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003621 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 status = sme_AcquireGlobalLock( &pMac->sme );
3623 if ( HAL_STATUS_SUCCESS( status ) )
3624 {
3625 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3626 if (status != eHAL_STATUS_SUCCESS)
3627 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003628 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003629 sme_ReleaseGlobalLock( &pMac->sme );
3630 return status;
3631 }
3632#if defined WLAN_FEATURE_P2P_INTERNAL
3633 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3634 if (status != eHAL_STATUS_SUCCESS)
3635 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003636 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 sme_ReleaseGlobalLock( &pMac->sme );
3638 return status;
3639 }
3640#endif
3641 sme_ReleaseGlobalLock( &pMac->sme );
3642 }
3643
3644 return (status);
3645}
3646
3647/* ---------------------------------------------------------------------------
3648 \fn sme_CfgSetInt
3649 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003650 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 \param cfgId - Configuration Parameter ID (type) for STA.
3652 \param ccmValue - The information related to Configuration Parameter ID
3653 which needs to be saved in CFG
3654 \param callback - To be registered by CSR with CCM. Once the CFG done with
3655 saving the information in the database, it notifies CCM &
3656 then the callback will be invoked to notify.
3657 \param toBeSaved - To save the request for future reference
3658 \return eHalStatus
3659 ---------------------------------------------------------------------------*/
3660eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3661 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3662{
3663 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3664}
3665
3666/* ---------------------------------------------------------------------------
3667 \fn sme_CfgSetStr
3668 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003669 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 \param cfgId - Configuration Parameter ID (type) for STA.
3671 \param pStr - Pointer to the byte array which carries the information needs
3672 to be saved in CFG
3673 \param length - Length of the data to be saved
3674 \param callback - To be registered by CSR with CCM. Once the CFG done with
3675 saving the information in the database, it notifies CCM &
3676 then the callback will be invoked to notify.
3677 \param toBeSaved - To save the request for future reference
3678 \return eHalStatus
3679 ---------------------------------------------------------------------------*/
3680eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3681 tANI_U32 length, tCcmCfgSetCallback callback,
3682 eAniBoolean toBeSaved)
3683{
3684 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3685}
3686
3687/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05303688 \fn sme_GetModifyProfileFields
3689 \brief HDD or SME - QOS calls this function to get the current values of
3690 connected profile fields, changing which can cause reassoc.
3691 This function must be called after CFG is downloaded and STA is in connected
3692 state. Also, make sure to call this function to get the current profile
3693 fields before calling the reassoc. So that pModifyProfileFields will have
3694 all the latest values plus the one(s) has been updated as part of reassoc
3695 request.
3696 \param pModifyProfileFields - pointer to the connected profile fields
3697 changing which can cause reassoc
3698
3699 \return eHalStatus
3700 -------------------------------------------------------------------------------*/
3701eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3702 tCsrRoamModifyProfileFields * pModifyProfileFields)
3703{
3704 eHalStatus status = eHAL_STATUS_FAILURE;
3705 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3706
3707 MTRACE(vos_trace(VOS_MODULE_ID_SME,
3708 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
3709 status = sme_AcquireGlobalLock( &pMac->sme );
3710 if ( HAL_STATUS_SUCCESS( status ) )
3711 {
3712 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3713 {
3714 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3715 }
3716 else
3717 {
3718 status = eHAL_STATUS_INVALID_PARAMETER;
3719 }
3720 sme_ReleaseGlobalLock( &pMac->sme );
3721 }
3722
3723 return (status);
3724}
3725
3726/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303727 \fn sme_HT40StopOBSSScan
3728 \brief HDD or SME - Command to stop the OBSS scan
3729 THis is implemented only for debugging purpose.
3730 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3731 \param sessionId - sessionId
3732 changing which can cause reassoc
3733
3734 \return eHalStatus
3735 -------------------------------------------------------------------------------*/
3736eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3737{
3738 eHalStatus status = eHAL_STATUS_FAILURE;
3739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3740
3741 smsLog(pMac, LOG2, FL("enter"));
3742 status = sme_AcquireGlobalLock( &pMac->sme );
3743 if ( HAL_STATUS_SUCCESS( status ) )
3744 {
3745 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3746 {
3747 csrHT40StopOBSSScan( pMac, sessionId );
3748 }
3749 else
3750 {
3751 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3752 "%s: Invalid session sessionId %d", __func__,sessionId);
3753 status = eHAL_STATUS_INVALID_PARAMETER;
3754 }
3755 sme_ReleaseGlobalLock( &pMac->sme );
3756 }
3757 return (status);
3758}
3759
Jeff Johnson295189b2012-06-20 16:38:30 -07003760/*--------------------------------------------------------------------------
3761 \fn sme_SetConfigPowerSave
3762 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3763 For BMPS related configuration, this function also updates the CFG
3764 and sends a message to FW to pick up the new values. Note: Calling
3765 this function only updates the configuration and does not enable
3766 the specified power save mode.
3767 \param hHal - The handle returned by macOpen.
3768 \param psMode - Power Saving mode being modified
3769 \param pConfigParams - a pointer to a caller allocated object of type
3770 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3771 \return eHalStatus
3772 --------------------------------------------------------------------------*/
3773eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3774 void *pConfigParams)
3775{
3776 eHalStatus status = eHAL_STATUS_FAILURE;
3777 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3778
Katya Nigambcb705f2013-12-26 14:26:22 +05303779 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003780 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003781 if (NULL == pConfigParams ) {
3782 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3783 "nothing to update");
3784 return eHAL_STATUS_FAILURE;
3785 }
3786
3787 status = sme_AcquireGlobalLock( &pMac->sme );
3788 if ( HAL_STATUS_SUCCESS( status ) )
3789 {
3790 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3791 sme_ReleaseGlobalLock( &pMac->sme );
3792 }
3793
3794 return (status);
3795}
3796
3797/*--------------------------------------------------------------------------
3798 \fn sme_GetConfigPowerSave
3799 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3800 \param hHal - The handle returned by macOpen.
3801 \param psMode - Power Saving mode
3802 \param pConfigParams - a pointer to a caller allocated object of type
3803 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3804 \return eHalStatus
3805 --------------------------------------------------------------------------*/
3806eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3807 void *pConfigParams)
3808{
3809 eHalStatus status = eHAL_STATUS_FAILURE;
3810 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3811
Katya Nigambcb705f2013-12-26 14:26:22 +05303812 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003813 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 if (NULL == pConfigParams ) {
3815 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3816 "nothing to update");
3817 return eHAL_STATUS_FAILURE;
3818 }
3819
3820 status = sme_AcquireGlobalLock( &pMac->sme );
3821 if ( HAL_STATUS_SUCCESS( status ) )
3822 {
3823 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3824 sme_ReleaseGlobalLock( &pMac->sme );
3825 }
3826
3827 return (status);
3828}
3829
3830/* ---------------------------------------------------------------------------
3831 \fn sme_SignalPowerEvent
3832 \brief Signals to PMC that a power event has occurred. Used for putting
3833 the chip into deep sleep mode.
3834 \param hHal - The handle returned by macOpen.
3835 \param event - the event that has occurred
3836 \return eHalStatus
3837 ---------------------------------------------------------------------------*/
3838eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3839{
3840 eHalStatus status = eHAL_STATUS_FAILURE;
3841 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3842
3843 status = sme_AcquireGlobalLock( &pMac->sme );
3844 if ( HAL_STATUS_SUCCESS( status ) )
3845 {
3846 status = pmcSignalPowerEvent(hHal, event);
3847 sme_ReleaseGlobalLock( &pMac->sme );
3848 }
3849
3850 return (status);
3851}
3852
3853/* ---------------------------------------------------------------------------
3854 \fn sme_EnablePowerSave
3855 \brief Enables one of the power saving modes.
3856 \param hHal - The handle returned by macOpen.
3857 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3858 while the chip is operating in Full Power, PMC will start
3859 a timer that will try to put the chip in BMPS mode after
3860 expiry.
3861 \return eHalStatus
3862 ---------------------------------------------------------------------------*/
3863eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3864{
3865 eHalStatus status = eHAL_STATUS_FAILURE;
3866 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3867
Katya Nigambcb705f2013-12-26 14:26:22 +05303868 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003869 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 status = sme_AcquireGlobalLock( &pMac->sme );
3871 if ( HAL_STATUS_SUCCESS( status ) )
3872 {
3873 status = pmcEnablePowerSave(hHal, psMode);
3874 sme_ReleaseGlobalLock( &pMac->sme );
3875 }
3876
3877 return (status);
3878}
3879
3880/* ---------------------------------------------------------------------------
3881 \fn sme_DisablePowerSave
3882 \brief Disables one of the power saving modes.
3883 \param hHal - The handle returned by macOpen.
3884 \param psMode - The power saving mode to disable. Disabling does not imply
3885 that device will be brought out of the current PS mode. This
3886 is purely a configuration API.
3887 \return eHalStatus
3888 ---------------------------------------------------------------------------*/
3889eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3890{
3891 eHalStatus status = eHAL_STATUS_FAILURE;
3892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3893
Katya Nigambcb705f2013-12-26 14:26:22 +05303894 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003895 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003896 status = sme_AcquireGlobalLock( &pMac->sme );
3897 if ( HAL_STATUS_SUCCESS( status ) )
3898 {
3899 status = pmcDisablePowerSave(hHal, psMode);
3900 sme_ReleaseGlobalLock( &pMac->sme );
3901 }
3902
3903 return (status);
3904 }
3905
3906/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303907+ \fn sme_SetHostPowerSave
3908+ \brief Enables BMPS logic to be controlled by User level apps
3909+ \param hHal - The handle returned by macOpen.
3910+ \param psMode - The power saving mode to disable. Disabling does not imply
3911+ that device will be brought out of the current PS mode. This
3912+ is purely a configuration API.
3913+ \return eHalStatus
3914+ ---------------------------------------------------------------------------*/
3915eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3916{
3917 eHalStatus status = eHAL_STATUS_FAILURE;
3918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3919
3920 pMac->pmc.isHostPsEn = psMode;
3921
3922 return (status);
3923}
3924
3925/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 \fn sme_StartAutoBmpsTimer
3927 \brief Starts a timer that periodically polls all the registered
3928 module for entry into Bmps mode. This timer is started only if BMPS is
3929 enabled and whenever the device is in full power.
3930 \param hHal - The handle returned by macOpen.
3931 \return eHalStatus
3932 ---------------------------------------------------------------------------*/
3933eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3934{
3935 eHalStatus status = eHAL_STATUS_FAILURE;
3936 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3937
Katya Nigambcb705f2013-12-26 14:26:22 +05303938 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003939 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 status = sme_AcquireGlobalLock( &pMac->sme );
3941 if ( HAL_STATUS_SUCCESS( status ) )
3942 {
3943 status = pmcStartAutoBmpsTimer(hHal);
3944 sme_ReleaseGlobalLock( &pMac->sme );
3945 }
3946
3947 return (status);
3948}
3949/* ---------------------------------------------------------------------------
3950 \fn sme_StopAutoBmpsTimer
3951 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3952 Stopping the timer does not cause a device state change. Only the timer
3953 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3954 \param hHal - The handle returned by macOpen.
3955 \return eHalStatus
3956 ---------------------------------------------------------------------------*/
3957eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3958{
3959 eHalStatus status = eHAL_STATUS_FAILURE;
3960 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3961
Katya Nigambcb705f2013-12-26 14:26:22 +05303962 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003963 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 status = sme_AcquireGlobalLock( &pMac->sme );
3965 if ( HAL_STATUS_SUCCESS( status ) )
3966 {
3967 status = pmcStopAutoBmpsTimer(hHal);
3968 sme_ReleaseGlobalLock( &pMac->sme );
3969 }
3970
3971 return (status);
3972}
3973/* ---------------------------------------------------------------------------
3974 \fn sme_QueryPowerState
3975 \brief Returns the current power state of the device.
3976 \param hHal - The handle returned by macOpen.
3977 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3978 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3979 \return eHalStatus
3980 ---------------------------------------------------------------------------*/
3981eHalStatus sme_QueryPowerState (
3982 tHalHandle hHal,
3983 tPmcPowerState *pPowerState,
3984 tPmcSwitchState *pSwWlanSwitchState)
3985{
3986 eHalStatus status = eHAL_STATUS_FAILURE;
3987 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3988
3989 status = sme_AcquireGlobalLock( &pMac->sme );
3990 if ( HAL_STATUS_SUCCESS( status ) )
3991 {
3992 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3993 sme_ReleaseGlobalLock( &pMac->sme );
3994 }
3995
3996 return (status);
3997}
3998
3999/* ---------------------------------------------------------------------------
4000 \fn sme_IsPowerSaveEnabled
4001 \brief Checks if the device is able to enter a particular power save mode
4002 This does not imply that the device is in a particular PS mode
4003 \param hHal - The handle returned by macOpen.
4004 \param psMode - the power saving mode
4005 \return eHalStatus
4006 ---------------------------------------------------------------------------*/
4007tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4008{
4009 eHalStatus status = eHAL_STATUS_FAILURE;
4010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4011 tANI_BOOLEAN result = false;
4012
Katya Nigambcb705f2013-12-26 14:26:22 +05304013 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004014 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004015 status = sme_AcquireGlobalLock( &pMac->sme );
4016 if ( HAL_STATUS_SUCCESS( status ) )
4017 {
4018 result = pmcIsPowerSaveEnabled(hHal, psMode);
4019 sme_ReleaseGlobalLock( &pMac->sme );
4020 return result;
4021 }
4022
4023 return false;
4024}
4025
4026/* ---------------------------------------------------------------------------
4027 \fn sme_RequestFullPower
4028 \brief Request that the device be brought to full power state. When the
4029 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4030 is enabled. On timer expiry PMC will attempt to put the device in
4031 BMPS mode if following holds true:
4032 - BMPS mode is enabled
4033 - Polling of all modules through the Power Save Check routine passes
4034 - STA is associated to an access point
4035 \param hHal - The handle returned by macOpen.
4036 \param - callbackRoutine Callback routine invoked in case of success/failure
4037 \return eHalStatus - status
4038 eHAL_STATUS_SUCCESS - device brought to full power state
4039 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4040 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4041 ---------------------------------------------------------------------------*/
4042eHalStatus sme_RequestFullPower (
4043 tHalHandle hHal,
4044 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4045 void *callbackContext,
4046 tRequestFullPowerReason fullPowerReason)
4047{
4048 eHalStatus status = eHAL_STATUS_FAILURE;
4049 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4050
Katya Nigambcb705f2013-12-26 14:26:22 +05304051 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004052 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004053 status = sme_AcquireGlobalLock( &pMac->sme );
4054 if ( HAL_STATUS_SUCCESS( status ) )
4055 {
4056 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4057 sme_ReleaseGlobalLock( &pMac->sme );
4058 }
4059
4060 return (status);
4061}
4062
4063/* ---------------------------------------------------------------------------
4064 \fn sme_RequestBmps
4065 \brief Request that the device be put in BMPS state. Request will be
4066 accepted only if BMPS mode is enabled and power save check routine
4067 passes.
4068 \param hHal - The handle returned by macOpen.
4069 \param - callbackRoutine Callback routine invoked in case of success/failure
4070 \return eHalStatus
4071 eHAL_STATUS_SUCCESS - device is in BMPS state
4072 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4073 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4074 ---------------------------------------------------------------------------*/
4075eHalStatus sme_RequestBmps (
4076 tHalHandle hHal,
4077 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4078 void *callbackContext)
4079{
4080 eHalStatus status = eHAL_STATUS_FAILURE;
4081 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4082
Katya Nigambcb705f2013-12-26 14:26:22 +05304083 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004084 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 status = sme_AcquireGlobalLock( &pMac->sme );
4086 if ( HAL_STATUS_SUCCESS( status ) )
4087 {
4088 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4089 sme_ReleaseGlobalLock( &pMac->sme );
4090 }
4091
4092 return (status);
4093}
4094
4095
4096/* ---------------------------------------------------------------------------
4097 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004098 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4099 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004100 \param hHal - The handle returned by macOpen.
4101 ---------------------------------------------------------------------------*/
4102void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4103{
4104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4105
Katya Nigambcb705f2013-12-26 14:26:22 +05304106 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004107 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4109 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4110}
4111
4112
4113/* ---------------------------------------------------------------------------
4114 \fn sme_StartUapsd
4115 \brief Request that the device be put in UAPSD state. If the device is in
4116 Full Power it will be put in BMPS mode first and then into UAPSD
4117 mode.
4118 \param hHal - The handle returned by macOpen.
4119 \param - callbackRoutine Callback routine invoked in case of success/failure
4120 eHAL_STATUS_SUCCESS - device is in UAPSD state
4121 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4122 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4123 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4124 \return eHalStatus
4125 ---------------------------------------------------------------------------*/
4126eHalStatus sme_StartUapsd (
4127 tHalHandle hHal,
4128 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4129 void *callbackContext)
4130{
4131 eHalStatus status = eHAL_STATUS_FAILURE;
4132 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4133
4134 status = sme_AcquireGlobalLock( &pMac->sme );
4135 if ( HAL_STATUS_SUCCESS( status ) )
4136 {
4137 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4138 sme_ReleaseGlobalLock( &pMac->sme );
4139 }
4140
4141 return (status);
4142 }
4143
4144/* ---------------------------------------------------------------------------
4145 \fn sme_StopUapsd
4146 \brief Request that the device be put out of UAPSD state. Device will be
4147 put in in BMPS state after stop UAPSD completes.
4148 \param hHal - The handle returned by macOpen.
4149 \return eHalStatus
4150 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4151 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4152 ---------------------------------------------------------------------------*/
4153eHalStatus sme_StopUapsd (tHalHandle hHal)
4154{
4155 eHalStatus status = eHAL_STATUS_FAILURE;
4156 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4157
4158 status = sme_AcquireGlobalLock( &pMac->sme );
4159 if ( HAL_STATUS_SUCCESS( status ) )
4160 {
4161 status = pmcStopUapsd(hHal);
4162 sme_ReleaseGlobalLock( &pMac->sme );
4163 }
4164
4165 return (status);
4166}
4167
4168/* ---------------------------------------------------------------------------
4169 \fn sme_RequestStandby
4170 \brief Request that the device be put in standby. It is HDD's responsibility
4171 to bring the chip to full power and do a disassoc before calling
4172 this API.
4173 \param hHal - The handle returned by macOpen.
4174 \param - callbackRoutine Callback routine invoked in case of success/failure
4175 \return eHalStatus
4176 eHAL_STATUS_SUCCESS - device is in Standby mode
4177 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4178 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4179 ---------------------------------------------------------------------------*/
4180eHalStatus sme_RequestStandby (
4181 tHalHandle hHal,
4182 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4183 void *callbackContext)
4184{
4185 eHalStatus status = eHAL_STATUS_FAILURE;
4186 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4187
Katya Nigambcb705f2013-12-26 14:26:22 +05304188 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004189 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304190 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004191 status = sme_AcquireGlobalLock( &pMac->sme );
4192 if ( HAL_STATUS_SUCCESS( status ) )
4193 {
4194 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4195 sme_ReleaseGlobalLock( &pMac->sme );
4196 }
4197
4198 return (status);
4199}
4200
4201/* ---------------------------------------------------------------------------
4202 \fn sme_RegisterPowerSaveCheck
4203 \brief Register a power save check routine that is called whenever
4204 the device is about to enter one of the power save modes.
4205 \param hHal - The handle returned by macOpen.
4206 \param checkRoutine - Power save check routine to be registered
4207 \return eHalStatus
4208 eHAL_STATUS_SUCCESS - successfully registered
4209 eHAL_STATUS_FAILURE - not successfully registered
4210 ---------------------------------------------------------------------------*/
4211eHalStatus sme_RegisterPowerSaveCheck (
4212 tHalHandle hHal,
4213 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4214{
4215 eHalStatus status = eHAL_STATUS_FAILURE;
4216 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4217
4218 status = sme_AcquireGlobalLock( &pMac->sme );
4219 if ( HAL_STATUS_SUCCESS( status ) )
4220 {
4221 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4222 sme_ReleaseGlobalLock( &pMac->sme );
4223 }
4224
4225 return (status);
4226}
4227
4228/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304229 \fn sme_Register11dScanDoneCallback
4230 \brief Register a routine of type csrScanCompleteCallback which is
4231 called whenever an 11d scan is done
4232 \param hHal - The handle returned by macOpen.
4233 \param callback - 11d scan complete routine to be registered
4234 \return eHalStatus
4235 ---------------------------------------------------------------------------*/
4236eHalStatus sme_Register11dScanDoneCallback (
4237 tHalHandle hHal,
4238 csrScanCompleteCallback callback)
4239{
4240 eHalStatus status = eHAL_STATUS_SUCCESS;
4241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4242
4243 pMac->scan.callback11dScanDone = callback;
4244
4245 return (status);
4246}
4247
4248/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004249 \fn sme_DeregisterPowerSaveCheck
4250 \brief Deregister a power save check routine
4251 \param hHal - The handle returned by macOpen.
4252 \param checkRoutine - Power save check routine to be deregistered
4253 \return eHalStatus
4254 eHAL_STATUS_SUCCESS - successfully deregistered
4255 eHAL_STATUS_FAILURE - not successfully deregistered
4256 ---------------------------------------------------------------------------*/
4257eHalStatus sme_DeregisterPowerSaveCheck (
4258 tHalHandle hHal,
4259 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4260{
4261 eHalStatus status = eHAL_STATUS_FAILURE;
4262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4263
4264 status = sme_AcquireGlobalLock( &pMac->sme );
4265 if ( HAL_STATUS_SUCCESS( status ) )
4266 {
4267 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4268 sme_ReleaseGlobalLock( &pMac->sme );
4269 }
4270
4271 return (status);
4272}
4273
4274/* ---------------------------------------------------------------------------
4275 \fn sme_RegisterDeviceStateUpdateInd
4276 \brief Register a callback routine that is called whenever
4277 the device enters a new device state (Full Power, BMPS, UAPSD)
4278 \param hHal - The handle returned by macOpen.
4279 \param callbackRoutine - Callback routine to be registered
4280 \param callbackContext - Cookie to be passed back during callback
4281 \return eHalStatus
4282 eHAL_STATUS_SUCCESS - successfully registered
4283 eHAL_STATUS_FAILURE - not successfully registered
4284 ---------------------------------------------------------------------------*/
4285eHalStatus sme_RegisterDeviceStateUpdateInd (
4286 tHalHandle hHal,
4287 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4288 void *callbackContext)
4289{
4290 eHalStatus status = eHAL_STATUS_FAILURE;
4291 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4292
4293 status = sme_AcquireGlobalLock( &pMac->sme );
4294 if ( HAL_STATUS_SUCCESS( status ) )
4295 {
4296 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4297 sme_ReleaseGlobalLock( &pMac->sme );
4298 }
4299
4300 return (status);
4301}
4302
4303/* ---------------------------------------------------------------------------
4304 \fn sme_DeregisterDeviceStateUpdateInd
4305 \brief Deregister a routine that was registered for device state changes
4306 \param hHal - The handle returned by macOpen.
4307 \param callbackRoutine - Callback routine to be deregistered
4308 \return eHalStatus
4309 eHAL_STATUS_SUCCESS - successfully deregistered
4310 eHAL_STATUS_FAILURE - not successfully deregistered
4311 ---------------------------------------------------------------------------*/
4312eHalStatus sme_DeregisterDeviceStateUpdateInd (
4313 tHalHandle hHal,
4314 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4315{
4316 eHalStatus status = eHAL_STATUS_FAILURE;
4317 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4318
4319 status = sme_AcquireGlobalLock( &pMac->sme );
4320 if ( HAL_STATUS_SUCCESS( status ) )
4321 {
4322 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4323 sme_ReleaseGlobalLock( &pMac->sme );
4324 }
4325
4326 return (status);
4327}
4328
4329/* ---------------------------------------------------------------------------
4330 \fn sme_WowlAddBcastPattern
4331 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4332 do a pattern match on these patterns when Wowl is enabled during BMPS
4333 mode. Note that Firmware performs the pattern matching only on
4334 broadcast frames and while Libra is in BMPS mode.
4335 \param hHal - The handle returned by macOpen.
4336 \param pattern - Pattern to be added
4337 \return eHalStatus
4338 eHAL_STATUS_FAILURE Cannot add pattern
4339 eHAL_STATUS_SUCCESS Request accepted.
4340 ---------------------------------------------------------------------------*/
4341eHalStatus sme_WowlAddBcastPattern (
4342 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004343 tpSirWowlAddBcastPtrn pattern,
4344 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004345{
4346 eHalStatus status = eHAL_STATUS_FAILURE;
4347 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304348 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004349 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004350 status = sme_AcquireGlobalLock( &pMac->sme );
4351 if ( HAL_STATUS_SUCCESS( status ) )
4352 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004353 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004354 sme_ReleaseGlobalLock( &pMac->sme );
4355 }
4356
4357 return (status);
4358}
4359
4360/* ---------------------------------------------------------------------------
4361 \fn sme_WowlDelBcastPattern
4362 \brief Delete a pattern that was added for Pattern Byte Matching.
4363 \param hHal - The handle returned by macOpen.
4364 \param pattern - Pattern to be deleted
4365 \return eHalStatus
4366 eHAL_STATUS_FAILURE Cannot delete pattern
4367 eHAL_STATUS_SUCCESS Request accepted.
4368 ---------------------------------------------------------------------------*/
4369eHalStatus sme_WowlDelBcastPattern (
4370 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004371 tpSirWowlDelBcastPtrn pattern,
4372 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004373{
4374 eHalStatus status = eHAL_STATUS_FAILURE;
4375 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304376 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004377 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004378 status = sme_AcquireGlobalLock( &pMac->sme );
4379 if ( HAL_STATUS_SUCCESS( status ) )
4380 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004381 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 sme_ReleaseGlobalLock( &pMac->sme );
4383 }
4384
4385 return (status);
4386}
4387
4388/* ---------------------------------------------------------------------------
4389 \fn sme_EnterWowl
4390 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4391 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4392 SME will will cache the information that WOWL has been enabled and
4393 attempt to put the device in BMPS. On entry into BMPS, SME will
4394 enable the WOWL mode.
4395 Note 1: If we exit BMPS mode (someone requests full power), we
4396 will NOT resume WOWL when we go back to BMPS again. Request for full
4397 power (while in WOWL mode) means disable WOWL and go to full power.
4398 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4399 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4400 are required. Currently there is no requirement or use case to support
4401 UAPSD and WOWL at the same time.
4402
4403 \param hHal - The handle returned by macOpen.
4404 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4405 Used for success/failure notification by SME
4406 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4407 at the time of callback.
4408 \param wakeReasonIndCB - Callback routine provided by HDD.
4409 Used for Wake Reason Indication by SME
4410 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4411 at the time of callback.
4412 \return eHalStatus
4413 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4414 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4415 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4416 BMPS mode is entered.
4417 ---------------------------------------------------------------------------*/
4418eHalStatus sme_EnterWowl (
4419 tHalHandle hHal,
4420 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4421 void *enterWowlCallbackContext,
4422#ifdef WLAN_WAKEUP_EVENTS
4423 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4424 void *wakeIndicationCBContext,
4425#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004426 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004427{
4428 eHalStatus status = eHAL_STATUS_FAILURE;
4429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304430 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004431 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004432 status = sme_AcquireGlobalLock( &pMac->sme );
4433 if ( HAL_STATUS_SUCCESS( status ) )
4434 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004435 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004436#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004437 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004438#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004439 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 sme_ReleaseGlobalLock( &pMac->sme );
4441 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004442 return (status);
4443}
4444/* ---------------------------------------------------------------------------
4445 \fn sme_ExitWowl
4446 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4447 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4448 mode.
4449 \param hHal - The handle returned by macOpen.
4450 \return eHalStatus
4451 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4452 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4453 ---------------------------------------------------------------------------*/
4454eHalStatus sme_ExitWowl (tHalHandle hHal)
4455{
4456 eHalStatus status = eHAL_STATUS_FAILURE;
4457 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304458 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004459 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004460 status = sme_AcquireGlobalLock( &pMac->sme );
4461 if ( HAL_STATUS_SUCCESS( status ) )
4462 {
4463 status = pmcExitWowl (hHal);
4464 sme_ReleaseGlobalLock( &pMac->sme );
4465 }
4466
4467 return (status);
4468}
4469
4470/* ---------------------------------------------------------------------------
4471
4472 \fn sme_RoamSetKey
4473
4474 \brief To set encryption key. This function should be called only when connected
4475 This is an asynchronous API.
4476
4477 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4478
4479 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4480
4481 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4482
4483 FAILURE or RESOURCES The API finished and failed.
4484
4485 -------------------------------------------------------------------------------*/
4486eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4487{
4488 eHalStatus status = eHAL_STATUS_FAILURE;
4489 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4490 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 tANI_U32 i;
4492 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004493
Katya Nigambcb705f2013-12-26 14:26:22 +05304494 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004495 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004496 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4497 {
4498 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4499 return eHAL_STATUS_FAILURE;
4500 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304501 /*Once Setkey is done, we can go in BMPS*/
4502 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304503 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304504 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304505 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4506 " to allow BMPS"));
4507 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004508
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 status = sme_AcquireGlobalLock( &pMac->sme );
4510 if ( HAL_STATUS_SUCCESS( status ) )
4511 {
4512 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4513 if(pRoamId)
4514 {
4515 *pRoamId = roamId;
4516 }
4517
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004518 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004519
4520 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004521 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004522
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004523 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004524
4525 pSession = CSR_GET_SESSION(pMac, sessionId);
4526
Jeff Johnson32d95a32012-09-10 13:15:23 -07004527 if(!pSession)
4528 {
4529 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004530 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004531 return eHAL_STATUS_FAILURE;
4532 }
4533
Jeff Johnson295189b2012-06-20 16:38:30 -07004534 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4535 {
4536 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4537 {
4538 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4539 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4540 {
4541 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4542 }
4543 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4544 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4545 {
4546 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4547 }
4548 }
4549 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004550
4551 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4552 sme_ReleaseGlobalLock( &pMac->sme );
4553 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304554#ifdef DEBUG_ROAM_DELAY
4555 //Store sent PTK key time
4556 if(pSetKey->keyDirection == eSIR_TX_RX)
4557 {
4558 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4559 }
4560 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4561 {
4562 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4563 }
4564 else
4565 {
4566 return (status);
4567 }
4568#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004569
4570 return (status);
4571}
4572
4573
4574/* ---------------------------------------------------------------------------
4575
4576 \fn sme_RoamRemoveKey
4577
4578 \brief To set encryption key. This is an asynchronous API.
4579
4580 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4581
4582 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4583
4584 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4585
4586 FAILURE or RESOURCES The API finished and failed.
4587
4588 -------------------------------------------------------------------------------*/
4589eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4590 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4591{
4592 eHalStatus status = eHAL_STATUS_FAILURE;
4593 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4594 tANI_U32 roamId;
4595
Katya Nigambcb705f2013-12-26 14:26:22 +05304596 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004597 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 status = sme_AcquireGlobalLock( &pMac->sme );
4599 if ( HAL_STATUS_SUCCESS( status ) )
4600 {
4601 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4602 if(pRoamId)
4603 {
4604 *pRoamId = roamId;
4605 }
4606 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4607 sme_ReleaseGlobalLock( &pMac->sme );
4608 }
4609
4610 return (status);
4611}
4612
4613/* ---------------------------------------------------------------------------
4614 \fn sme_GetRssi
4615 \brief a wrapper function that client calls to register a callback to get RSSI
4616
4617 \param callback - SME sends back the requested stats using the callback
4618 \param staId - The station ID for which the stats is requested for
4619 \param pContext - user context to be passed back along with the callback
4620 \param pVosContext - vos context
4621 \return eHalStatus
4622 ---------------------------------------------------------------------------*/
4623eHalStatus sme_GetRssi(tHalHandle hHal,
4624 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004625 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 void *pContext, void* pVosContext)
4627{
4628 eHalStatus status = eHAL_STATUS_FAILURE;
4629 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4630
4631 status = sme_AcquireGlobalLock( &pMac->sme );
4632 if ( HAL_STATUS_SUCCESS( status ) )
4633 {
4634 status = csrGetRssi( pMac, callback,
4635 staId, bssId, pContext, pVosContext);
4636 sme_ReleaseGlobalLock( &pMac->sme );
4637 }
4638 return (status);
4639}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304640
4641/* ---------------------------------------------------------------------------
4642 \fn sme_GetSnr
4643 \brief a wrapper function that client calls to register a callback to
4644 get SNR
4645
4646 \param callback - SME sends back the requested stats using the callback
4647 \param staId - The station ID for which the stats is requested for
4648 \param pContext - user context to be passed back along with the callback
4649 \param pVosContext - vos context
4650 \return eHalStatus
4651 ---------------------------------------------------------------------------*/
4652eHalStatus sme_GetSnr(tHalHandle hHal,
4653 tCsrSnrCallback callback,
4654 tANI_U8 staId, tCsrBssid bssId,
4655 void *pContext)
4656{
4657 eHalStatus status = eHAL_STATUS_FAILURE;
4658 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4659
4660 status = sme_AcquireGlobalLock( &pMac->sme );
4661 if ( HAL_STATUS_SUCCESS( status ) )
4662 {
4663 status = csrGetSnr(pMac, callback,
4664 staId, bssId, pContext);
4665 sme_ReleaseGlobalLock( &pMac->sme );
4666 }
4667 return status;
4668}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004669#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004670/* ---------------------------------------------------------------------------
4671 \fn sme_GetRoamRssi
4672 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4673
4674 \param callback - SME sends back the requested stats using the callback
4675 \param staId - The station ID for which the stats is requested for
4676 \param pContext - user context to be passed back along with the callback
4677 \param pVosContext - vos context
4678 \return eHalStatus
4679 ---------------------------------------------------------------------------*/
4680eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4681 tCsrRssiCallback callback,
4682 tANI_U8 staId, tCsrBssid bssId,
4683 void *pContext, void* pVosContext)
4684{
4685 eHalStatus status = eHAL_STATUS_FAILURE;
4686 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4687
4688 status = sme_AcquireGlobalLock( &pMac->sme );
4689 if ( HAL_STATUS_SUCCESS( status ) )
4690 {
4691 status = csrGetRoamRssi( pMac, callback,
4692 staId, bssId, pContext, pVosContext);
4693 sme_ReleaseGlobalLock( &pMac->sme );
4694 }
4695 return (status);
4696}
4697#endif
4698
Jeff Johnson295189b2012-06-20 16:38:30 -07004699
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004700#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004701/* ---------------------------------------------------------------------------
4702 \fn sme_GetTsmStats
4703 \brief a wrapper function that client calls to register a callback to get TSM Stats
4704
4705 \param callback - SME sends back the requested stats using the callback
4706 \param staId - The station ID for which the stats is requested for
4707 \param pContext - user context to be passed back along with the callback
4708 \param pVosContext - vos context
4709 \return eHalStatus
4710 ---------------------------------------------------------------------------*/
4711eHalStatus sme_GetTsmStats(tHalHandle hHal,
4712 tCsrTsmStatsCallback callback,
4713 tANI_U8 staId, tCsrBssid bssId,
4714 void *pContext, void* pVosContext, tANI_U8 tid)
4715{
4716 eHalStatus status = eHAL_STATUS_FAILURE;
4717 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4718
4719 status = sme_AcquireGlobalLock( &pMac->sme );
4720 if ( HAL_STATUS_SUCCESS( status ) )
4721 {
4722 status = csrGetTsmStats( pMac, callback,
4723 staId, bssId, pContext, pVosContext, tid);
4724 sme_ReleaseGlobalLock( &pMac->sme );
4725 }
4726 return (status);
4727}
4728#endif
4729
4730
Jeff Johnson295189b2012-06-20 16:38:30 -07004731/* ---------------------------------------------------------------------------
4732 \fn sme_GetStatistics
4733 \brief a wrapper function that client calls to register a callback to get
4734 different PHY level statistics from CSR.
4735
4736 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4737 \param statsMask - The different category/categories of stats requester is looking for
4738 \param callback - SME sends back the requested stats using the callback
4739 \param periodicity - If requester needs periodic update in millisec, 0 means
4740 it's an one time request
4741 \param cache - If requester is happy with cached stats
4742 \param staId - The station ID for which the stats is requested for
4743 \param pContext - user context to be passed back along with the callback
4744 \return eHalStatus
4745 ---------------------------------------------------------------------------*/
4746eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4747 tANI_U32 statsMask,
4748 tCsrStatsCallback callback,
4749 tANI_U32 periodicity, tANI_BOOLEAN cache,
4750 tANI_U8 staId, void *pContext)
4751{
4752 eHalStatus status = eHAL_STATUS_FAILURE;
4753 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4754
Katya Nigambcb705f2013-12-26 14:26:22 +05304755 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004756 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004757 status = sme_AcquireGlobalLock( &pMac->sme );
4758 if ( HAL_STATUS_SUCCESS( status ) )
4759 {
4760 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4761 periodicity, cache, staId, pContext);
4762 sme_ReleaseGlobalLock( &pMac->sme );
4763 }
4764
4765 return (status);
4766
4767}
4768
4769/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304770 \fn smeGetTLSTAState
4771 \helper function to get the TL STA State whenever the function is called.
4772
4773 \param staId - The staID to be passed to the TL
4774 to get the relevant TL STA State
4775 \return the state as tANI_U16
4776 ---------------------------------------------------------------------------*/
4777tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4778{
4779 tANI_U16 tlSTAState = TL_INIT_STATE;
4780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4781 eHalStatus status = eHAL_STATUS_FAILURE;
4782
4783 status = sme_AcquireGlobalLock( &pMac->sme );
4784 if ( HAL_STATUS_SUCCESS( status ) )
4785 {
4786 tlSTAState = csrGetTLSTAState( pMac, staId);
4787 sme_ReleaseGlobalLock( &pMac->sme );
4788 }
4789
4790 return tlSTAState;
4791}
4792
4793/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004794
4795 \fn sme_GetCountryCode
4796
4797 \brief To return the current country code. If no country code is applied, default country code is
4798 used to fill the buffer.
4799 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4800 This is a synchronous API.
4801
4802 \param pBuf - pointer to a caller allocated buffer for returned country code.
4803
4804 \param pbLen For input, this parameter indicates how big is the buffer.
4805 Upon return, this parameter has the number of bytes for country. If pBuf
4806 doesn't have enough space, this function returns
4807 fail status and this parameter contains the number that is needed.
4808
4809 \return eHalStatus SUCCESS.
4810
4811 FAILURE or RESOURCES The API finished and failed.
4812
4813 -------------------------------------------------------------------------------*/
4814eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4815{
4816 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4817
Katya Nigambcb705f2013-12-26 14:26:22 +05304818 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004819 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4820
Jeff Johnson295189b2012-06-20 16:38:30 -07004821 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4822}
4823
4824
4825/* ---------------------------------------------------------------------------
4826
4827 \fn sme_SetCountryCode
4828
4829 \brief To change the current/default country code.
4830 If 11d supported is turned off, an error is return.
4831 This is a synchronous API.
4832
4833 \param pCountry - pointer to a caller allocated buffer for the country code.
4834
4835 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4836 whether a reset is required.
4837
4838 \return eHalStatus SUCCESS.
4839
4840 FAILURE or RESOURCES The API finished and failed.
4841
4842 -------------------------------------------------------------------------------*/
4843eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4844{
4845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4846
Katya Nigambcb705f2013-12-26 14:26:22 +05304847 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004848 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4850}
4851
4852
4853/* ---------------------------------------------------------------------------
4854 \fn sme_ResetCountryCodeInformation
4855 \brief this function is to reset the country code current being used back to EEPROM default
4856 this includes channel list and power setting. This is a synchronous API.
4857 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4858 a restart is needed to apply the change
4859 \return eHalStatus
4860 -------------------------------------------------------------------------------*/
4861eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4862{
4863 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4864
4865 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4866}
4867
4868
4869/* ---------------------------------------------------------------------------
4870 \fn sme_GetSupportedCountryCode
4871 \brief this function is to get a list of the country code current being supported
4872 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4873 this has the country code list. 3 bytes for each country code. This may be NULL if
4874 caller wants to know the needed byte count.
4875 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4876 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4877 \return eHalStatus
4878 -------------------------------------------------------------------------------*/
4879eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4880{
4881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4882
4883 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4884}
4885
4886
4887/* ---------------------------------------------------------------------------
4888 \fn sme_GetCurrentRegulatoryDomain
4889 \brief this function is to get the current regulatory domain. This is a synchronous API.
4890 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4891 SME. The function fails if 11d support is turned off.
4892 \param pDomain - Caller allocated buffer to return the current domain.
4893 \return eHalStatus SUCCESS.
4894
4895 FAILURE or RESOURCES The API finished and failed.
4896 -------------------------------------------------------------------------------*/
4897eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4898{
4899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4900 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4901
4902 if( pDomain )
4903 {
4904 if( csrIs11dSupported( pMac ) )
4905 {
4906 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4907 status = eHAL_STATUS_SUCCESS;
4908 }
4909 else
4910 {
4911 status = eHAL_STATUS_FAILURE;
4912 }
4913 }
4914
4915 return ( status );
4916}
4917
4918
4919/* ---------------------------------------------------------------------------
4920 \fn sme_SetRegulatoryDomain
4921 \brief this function is to set the current regulatory domain.
4922 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4923 SME. This is a synchronous API.
4924 \param domainId - indicate the domain (defined in the driver) needs to set to.
4925 See v_REGDOMAIN_t for definition
4926 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4927 a restart is needed to apply the change
4928 \return eHalStatus
4929 -------------------------------------------------------------------------------*/
4930eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4931{
4932 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4933
4934 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4935}
4936
4937
4938/* ---------------------------------------------------------------------------
4939
4940 \fn sme_GetRegulatoryDomainForCountry
4941
4942 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4943
4944 \param pCountry - pointer to a caller allocated buffer for input country code.
4945
4946 \param pDomainId Upon successful return, it is the domain that country belongs to.
4947 If it is NULL, returning success means that the country code is known.
4948
4949 \return eHalStatus SUCCESS.
4950
4951 FAILURE or RESOURCES The API finished and failed.
4952
4953 -------------------------------------------------------------------------------*/
4954eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4955{
4956 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4957
Kiet Lam6c583332013-10-14 05:37:09 +05304958 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4959 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004960}
4961
4962
4963
4964
4965/* ---------------------------------------------------------------------------
4966
4967 \fn sme_GetSupportedRegulatoryDomains
4968
4969 \brief To return a list of supported regulatory domains. This is a synchronous API.
4970
4971 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4972
4973 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4974 Upon return, this parameter has the number for supported domains. If pDomains
4975 doesn't have enough space for all the supported domains, this function returns
4976 fail status and this parameter contains the number that is needed.
4977
4978 \return eHalStatus SUCCESS.
4979
4980 FAILURE or RESOURCES The API finished and failed.
4981
4982 -------------------------------------------------------------------------------*/
4983eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4984{
4985 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4986
4987 //We support all domains for now
4988 if( pNumDomains )
4989 {
4990 if( NUM_REG_DOMAINS <= *pNumDomains )
4991 {
4992 status = eHAL_STATUS_SUCCESS;
4993 }
4994 *pNumDomains = NUM_REG_DOMAINS;
4995 }
4996 if( HAL_STATUS_SUCCESS( status ) )
4997 {
4998 if( pDomains )
4999 {
5000 pDomains[0] = REGDOMAIN_FCC;
5001 pDomains[1] = REGDOMAIN_ETSI;
5002 pDomains[2] = REGDOMAIN_JAPAN;
5003 pDomains[3] = REGDOMAIN_WORLD;
5004 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5005 pDomains[5] = REGDOMAIN_APAC;
5006 pDomains[6] = REGDOMAIN_KOREA;
5007 pDomains[7] = REGDOMAIN_HI_5GHZ;
5008 pDomains[8] = REGDOMAIN_NO_5GHZ;
5009 }
5010 else
5011 {
5012 status = eHAL_STATUS_INVALID_PARAMETER;
5013 }
5014 }
5015
5016 return ( status );
5017}
5018
5019
5020//some support functions
5021tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5022{
5023 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5024
5025 return ( csrIs11dSupported( pMac ) );
5026}
5027
5028
5029tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5030{
5031 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5032
5033 return ( csrIs11hSupported( pMac ) );
5034}
5035
5036
5037tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5038{
5039 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5040
5041 return ( csrIsWmmSupported( pMac ) );
5042}
5043
5044//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5045eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5046{
5047 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5048
5049 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5050}
5051
5052/* ---------------------------------------------------------------------------
5053
5054 \fn sme_ChangeCountryCode
5055
5056 \brief Change Country code from upperlayer during WLAN driver operation.
5057 This is a synchronous API.
5058
5059 \param hHal - The handle returned by macOpen.
5060
5061 \param pCountry New Country Code String
5062
Abhishek Singha306a442013-11-07 18:39:01 +05305063 \param sendRegHint If we want to send reg hint to nl80211
5064
Jeff Johnson295189b2012-06-20 16:38:30 -07005065 \return eHalStatus SUCCESS.
5066
5067 FAILURE or RESOURCES The API finished and failed.
5068
5069 -------------------------------------------------------------------------------*/
5070eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5071 tSmeChangeCountryCallback callback,
5072 tANI_U8 *pCountry,
5073 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305074 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305075 tAniBool countryFromUserSpace,
5076 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005077{
5078 eHalStatus status = eHAL_STATUS_FAILURE;
5079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5080 vos_msg_t msg;
5081 tAniChangeCountryCodeReq *pMsg;
5082
Katya Nigambcb705f2013-12-26 14:26:22 +05305083 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005084 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005085 status = sme_AcquireGlobalLock( &pMac->sme );
5086 if ( HAL_STATUS_SUCCESS( status ) )
5087 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005088 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005089
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305090 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005091 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5092 {
5093
5094 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5095
5096 sme_ReleaseGlobalLock( &pMac->sme );
5097 status = eHAL_STATUS_FAILURE;
5098 return status;
5099 }
5100
Kiet Lam64c1b492013-07-12 13:56:44 +05305101 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5102 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005104 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005105 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305106 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005107 }
5108
5109 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5110 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305111 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305112 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305113 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005114 pMsg->changeCCCallback = callback;
5115 pMsg->pDevContext = pContext;
5116 pMsg->pVosContext = pVosContext;
5117
5118 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5119 msg.bodyptr = pMsg;
5120 msg.reserved = 0;
5121
5122 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5123 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005124 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305125 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005126 status = eHAL_STATUS_FAILURE;
5127 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005128 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005129 sme_ReleaseGlobalLock( &pMac->sme );
5130 }
5131
5132 return (status);
5133}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005134
5135/*--------------------------------------------------------------------------
5136
5137 \fn sme_GenericChangeCountryCode
5138
5139 \brief Change Country code from upperlayer during WLAN driver operation.
5140 This is a synchronous API.
5141
5142 \param hHal - The handle returned by macOpen.
5143
5144 \param pCountry New Country Code String
5145
5146 \param reg_domain regulatory domain
5147
5148 \return eHalStatus SUCCESS.
5149
5150 FAILURE or RESOURCES The API finished and failed.
5151
5152-----------------------------------------------------------------------------*/
5153eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5154 tANI_U8 *pCountry,
5155 v_REGDOMAIN_t reg_domain)
5156{
5157 eHalStatus status = eHAL_STATUS_FAILURE;
5158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5159 vos_msg_t msg;
5160 tAniGenericChangeCountryCodeReq *pMsg;
5161
Kiet Lamcffc5862013-10-30 16:28:45 +05305162 if (NULL == pMac)
5163 {
5164 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5165 "%s: pMac is null", __func__);
5166 return status;
5167 }
5168
Amar Singhal0d15bd52013-10-12 23:13:13 -07005169 status = sme_AcquireGlobalLock( &pMac->sme );
5170 if ( HAL_STATUS_SUCCESS( status ) )
5171 {
5172 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305173 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5174 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005175 {
5176 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5177 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305178 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005179 }
5180
5181 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5182 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005183 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005184 pMsg->domain_index = reg_domain;
5185
5186 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5187 msg.bodyptr = pMsg;
5188 msg.reserved = 0;
5189
5190 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5191 {
5192 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305193 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005194 status = eHAL_STATUS_FAILURE;
5195 }
5196 smsLog(pMac, LOG1, FL(" returned"));
5197 sme_ReleaseGlobalLock( &pMac->sme );
5198 }
5199
5200 return (status);
5201}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305202
5203/* ---------------------------------------------------------------------------
5204
5205 \fn sme_InitChannels
5206
5207 \brief Used to initialize CSR channel lists while driver loading
5208
5209 \param hHal - global pMac structure
5210
5211 \return eHalStatus SUCCESS.
5212
5213 FAILURE or RESOURCES The API finished and failed.
5214
5215 -------------------------------------------------------------------------------*/
5216eHalStatus sme_InitChannels(tHalHandle hHal)
5217{
5218 eHalStatus status = eHAL_STATUS_FAILURE;
5219 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5220
5221 if (NULL == pMac)
5222 {
5223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5224 "%s: pMac is null", __func__);
5225 return status;
5226 }
5227
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305228 status = csrInitChannels(pMac);
5229
Mihir Shetee1093ba2014-01-21 20:13:32 +05305230 return status;
5231}
5232
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305233/*-------------------------------------------------------------------------
5234 \fn sme_InitChannelsForCC
5235
5236 \brief Used to issue regulatory hint to user
5237
5238 \param hHal - global pMac structure
5239
5240 \return eHalStatus SUCCESS.
5241
5242 FAILURE or RESOURCES The API finished and failed.
5243--------------------------------------------------------------------------*/
5244
5245eHalStatus sme_InitChannelsForCC(tHalHandle hHal)
5246{
5247 eHalStatus status = eHAL_STATUS_FAILURE;
5248 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5249
5250 if (NULL == pMac)
5251 {
5252 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5253 "%s: pMac is null", __func__);
5254 return status;
5255 }
5256 status = csrInitChannelsForCC(pMac);
5257
5258 return status;
5259}
5260
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305261/* ---------------------------------------------------------------------------
5262
5263 \fn sme_DHCPStartInd
5264
5265 \brief API to signal the FW about the DHCP Start event.
5266
5267 \param hHal - HAL handle for device.
5268
5269 \param device_mode - mode(AP,SAP etc) of the device.
5270
5271 \param macAddr - MAC address of the device.
5272
5273 \return eHalStatus SUCCESS.
5274
5275 FAILURE or RESOURCES The API finished and failed.
5276 --------------------------------------------------------------------------*/
5277eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5278 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305279 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305280{
5281 eHalStatus status;
5282 VOS_STATUS vosStatus;
5283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5284 vos_msg_t vosMessage;
5285 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305286 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305287
5288 status = sme_AcquireGlobalLock(&pMac->sme);
5289 if ( eHAL_STATUS_SUCCESS == status)
5290 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305291 pSession = CSR_GET_SESSION( pMac, sessionId );
5292
5293 if (!pSession)
5294 {
5295 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5296 sme_ReleaseGlobalLock( &pMac->sme );
5297 return eHAL_STATUS_FAILURE;
5298 }
5299
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305300 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5301 if (NULL == pMsg)
5302 {
5303 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5304 "%s: Not able to allocate memory for dhcp start", __func__);
5305 sme_ReleaseGlobalLock( &pMac->sme );
5306 return eHAL_STATUS_FAILURE;
5307 }
5308 pMsg->msgType = WDA_DHCP_START_IND;
5309 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5310 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305311 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5312 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305313 vosMessage.type = WDA_DHCP_START_IND;
5314 vosMessage.bodyptr = pMsg;
5315 vosMessage.reserved = 0;
5316
5317 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5318 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5319 {
5320 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5321 "%s: Post DHCP Start MSG fail", __func__);
5322 vos_mem_free(pMsg);
5323 status = eHAL_STATUS_FAILURE;
5324 }
5325 sme_ReleaseGlobalLock( &pMac->sme );
5326 }
5327 return (status);
5328}
5329/* ---------------------------------------------------------------------------
5330 \fn sme_DHCPStopInd
5331
5332 \brief API to signal the FW about the DHCP complete event.
5333
5334 \param hHal - HAL handle for device.
5335
5336 \param device_mode - mode(AP, SAP etc) of the device.
5337
5338 \param macAddr - MAC address of the device.
5339
5340 \return eHalStatus SUCCESS.
5341 FAILURE or RESOURCES The API finished and failed.
5342 --------------------------------------------------------------------------*/
5343eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5344 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305345 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305346{
5347 eHalStatus status;
5348 VOS_STATUS vosStatus;
5349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5350 vos_msg_t vosMessage;
5351 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305352 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305353
5354 status = sme_AcquireGlobalLock(&pMac->sme);
5355 if ( eHAL_STATUS_SUCCESS == status)
5356 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305357 pSession = CSR_GET_SESSION( pMac, sessionId );
5358
5359 if (!pSession)
5360 {
5361 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5362 sme_ReleaseGlobalLock( &pMac->sme );
5363 return eHAL_STATUS_FAILURE;
5364 }
5365
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305366 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5367 if (NULL == pMsg)
5368 {
5369 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5370 "%s: Not able to allocate memory for dhcp stop", __func__);
5371 sme_ReleaseGlobalLock( &pMac->sme );
5372 return eHAL_STATUS_FAILURE;
5373 }
5374
5375 pMsg->msgType = WDA_DHCP_STOP_IND;
5376 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5377 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305378 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5379 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305380
5381 vosMessage.type = WDA_DHCP_STOP_IND;
5382 vosMessage.bodyptr = pMsg;
5383 vosMessage.reserved = 0;
5384
5385 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5386 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5387 {
5388 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5389 "%s: Post DHCP Stop MSG fail", __func__);
5390 vos_mem_free(pMsg);
5391 status = eHAL_STATUS_FAILURE;
5392 }
5393
5394 sme_ReleaseGlobalLock( &pMac->sme );
5395 }
5396 return (status);
5397}
5398
Jeff Johnson295189b2012-06-20 16:38:30 -07005399
5400/* ---------------------------------------------------------------------------
5401 \fn sme_BtcSignalBtEvent
5402 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5403 BT event type and the current operating mode of Libra (full power,
5404 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5405 would be employed.
5406 \param hHal - The handle returned by macOpen.
5407 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5408 Caller owns the memory and is responsible for freeing it.
5409 \return VOS_STATUS
5410 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5411 if BTC execution mode is set to BTC_WLAN_ONLY
5412 or BTC_PTA_ONLY.
5413 VOS_STATUS_SUCCESS BT Event passed to HAL
5414 ---------------------------------------------------------------------------*/
5415VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5416{
5417 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005418
Jeff Johnson295189b2012-06-20 16:38:30 -07005419#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5420 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5421
Katya Nigambcb705f2013-12-26 14:26:22 +05305422 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005423 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005424 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5425 {
5426 status = btcSignalBTEvent (hHal, pBtEvent);
5427 sme_ReleaseGlobalLock( &pMac->sme );
5428 }
5429#endif
5430 return (status);
5431}
5432
5433/* ---------------------------------------------------------------------------
5434 \fn sme_BtcSetConfig
5435 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5436 This function should be invoked only after CFG download has completed.
5437 Calling it after sme_HDDReadyInd is recommended.
5438 \param hHal - The handle returned by macOpen.
5439 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5440 Caller owns the memory and is responsible for freeing it.
5441 \return VOS_STATUS
5442 VOS_STATUS_E_FAILURE Config not passed to HAL.
5443 VOS_STATUS_SUCCESS Config passed to HAL
5444 ---------------------------------------------------------------------------*/
5445VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5446{
5447 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5448#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305450 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005451 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005452 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5453 {
5454 status = btcSetConfig (hHal, pSmeBtcConfig);
5455 sme_ReleaseGlobalLock( &pMac->sme );
5456 }
5457#endif
5458 return (status);
5459}
5460
5461/* ---------------------------------------------------------------------------
5462 \fn sme_BtcGetConfig
5463 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5464 \param hHal - The handle returned by macOpen.
5465 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5466 tSmeBtcConfig. Caller owns the memory and is responsible
5467 for freeing it.
5468 \return VOS_STATUS
5469 VOS_STATUS_E_FAILURE - failure
5470 VOS_STATUS_SUCCESS success
5471 ---------------------------------------------------------------------------*/
5472VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5473{
5474 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5475#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5476 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5481 {
5482 status = btcGetConfig (hHal, pSmeBtcConfig);
5483 sme_ReleaseGlobalLock( &pMac->sme );
5484 }
5485#endif
5486 return (status);
5487}
5488/* ---------------------------------------------------------------------------
5489 \fn sme_SetCfgPrivacy
5490 \brief API to set configure privacy parameters
5491 \param hHal - The handle returned by macOpen.
5492 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005493 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005494
5495 \return void
5496 ---------------------------------------------------------------------------*/
5497void sme_SetCfgPrivacy( tHalHandle hHal,
5498 tCsrRoamProfile *pProfile,
5499 tANI_BOOLEAN fPrivacy
5500 )
5501{
5502 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305503 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005504 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005505 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5506 {
5507 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5508 sme_ReleaseGlobalLock( &pMac->sme );
5509 }
5510}
5511
5512#if defined WLAN_FEATURE_VOWIFI
5513/* ---------------------------------------------------------------------------
5514 \fn sme_NeighborReportRequest
5515 \brief API to request neighbor report.
5516 \param hHal - The handle returned by macOpen.
5517 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5518 tRrmNeighborReq. Caller owns the memory and is responsible
5519 for freeing it.
5520 \return VOS_STATUS
5521 VOS_STATUS_E_FAILURE - failure
5522 VOS_STATUS_SUCCESS success
5523 ---------------------------------------------------------------------------*/
5524VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5525 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5526{
5527 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5528 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305529 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005530 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005531
5532 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5533 {
5534 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5535 sme_ReleaseGlobalLock( &pMac->sme );
5536 }
5537
5538 return (status);
5539}
5540#endif
5541
5542//The following are debug APIs to support direct read/write register/memory
5543//They are placed in SME because HW cannot be access when in LOW_POWER state
5544//AND not connected. The knowledge and synchronization is done in SME
5545
5546//sme_DbgReadRegister
5547//Caller needs to validate the input values
5548VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5549{
5550 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5551 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005552 tPmcPowerState PowerState;
5553 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305554 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005555 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005556
5557 /* 1) To make Quarky work in FTM mode **************************************/
5558
5559 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5560 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005561 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005562 {
5563 return VOS_STATUS_SUCCESS;
5564 }
5565 return VOS_STATUS_E_FAILURE;
5566 }
5567
5568 /* 2) NON FTM mode driver *************************************************/
5569
5570 /* Acquire SME global lock */
5571 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5572 {
5573 return VOS_STATUS_E_FAILURE;
5574 }
5575
5576 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5577 {
5578 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5579 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5580 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005581 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005582 {
5583 status = VOS_STATUS_SUCCESS;
5584 }
5585 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005586 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005587 status = VOS_STATUS_E_FAILURE;
5588 }
5589 }
5590 else
5591 {
5592 status = VOS_STATUS_E_FAILURE;
5593 }
5594 }
5595
5596 /* This is a hack for Qualky/pttWniSocket
5597 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5598 if ( VOS_STATUS_SUCCESS != status )
5599 {
5600 *pRegValue = 0xDEADBEEF;
5601 status = VOS_STATUS_SUCCESS;
5602 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005603
Jeff Johnson295189b2012-06-20 16:38:30 -07005604 /* Release SME global lock */
5605 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005606
Jeff Johnson295189b2012-06-20 16:38:30 -07005607 return (status);
5608}
5609
5610
5611//sme_DbgWriteRegister
5612//Caller needs to validate the input values
5613VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5614{
5615 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5616 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005617 tPmcPowerState PowerState;
5618 tANI_U32 sessionId = 0;
5619
5620 /* 1) To make Quarky work in FTM mode **************************************/
5621
Katya Nigambcb705f2013-12-26 14:26:22 +05305622 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005623 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005624 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5625 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005626 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005627 {
5628 return VOS_STATUS_SUCCESS;
5629 }
5630 return VOS_STATUS_E_FAILURE;
5631 }
5632
5633 /* 2) NON FTM mode driver *************************************************/
5634
5635 /* Acquire SME global lock */
5636 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5637 {
5638 return VOS_STATUS_E_FAILURE;
5639 }
5640
5641 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5642 {
5643 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5644 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5645 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005646 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005647 {
5648 status = VOS_STATUS_SUCCESS;
5649 }
5650 else
5651 {
5652 status = VOS_STATUS_E_FAILURE;
5653 }
5654 }
5655 else
5656 {
5657 status = VOS_STATUS_E_FAILURE;
5658 }
5659 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005660
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 /* Release SME global lock */
5662 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005663
Jeff Johnson295189b2012-06-20 16:38:30 -07005664 return (status);
5665}
5666
5667
5668
5669//sme_DbgReadMemory
5670//Caller needs to validate the input values
5671//pBuf caller allocated buffer has the length of nLen
5672VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5673{
5674 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5675 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005676 tPmcPowerState PowerState;
5677 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005678 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5679 tANI_U32 arg1 = memAddr;
5680 tANI_U32 arg2 = nLen/4;
5681 tANI_U32 arg3 = 4;
5682 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 /* 1) To make Quarky work in FTM mode **************************************/
5684
Katya Nigambcb705f2013-12-26 14:26:22 +05305685 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005686 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005687 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5688 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005689 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005690 {
5691 return VOS_STATUS_SUCCESS;
5692 }
5693 return VOS_STATUS_E_FAILURE;
5694 }
5695
5696 /* 2) NON FTM mode driver *************************************************/
5697
5698 /* Acquire SME global lock */
5699 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5700 {
5701 return VOS_STATUS_E_FAILURE;
5702 }
5703
5704 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5705 {
5706 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5707 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5708 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005709 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005710 {
5711 status = VOS_STATUS_SUCCESS;
5712 }
5713 else
5714 {
5715 status = VOS_STATUS_E_FAILURE;
5716 }
5717 }
5718 else
5719 {
5720 status = VOS_STATUS_E_FAILURE;
5721 }
5722 }
5723
5724 /* This is a hack for Qualky/pttWniSocket
5725 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5726 if (VOS_STATUS_SUCCESS != status)
5727 {
5728 vos_mem_set(pBuf, nLen, 0xCD);
5729 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005730 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005731 }
5732
5733 /* Release SME lock */
5734 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005735
Jeff Johnson295189b2012-06-20 16:38:30 -07005736 return (status);
5737}
5738
5739
5740//sme_DbgWriteMemory
5741//Caller needs to validate the input values
5742VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5743{
5744 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5745 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005746 tPmcPowerState PowerState;
5747 tANI_U32 sessionId = 0;
5748
5749 /* 1) To make Quarky work in FTM mode **************************************/
5750
Katya Nigambcb705f2013-12-26 14:26:22 +05305751 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005752 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005753 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5754 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005755 {
5756 return VOS_STATUS_SUCCESS;
5757 }
5758 return VOS_STATUS_E_FAILURE;
5759 }
5760
5761 /* 2) NON FTM mode driver *************************************************/
5762
5763 /* Acquire SME global lock */
5764 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5765 {
5766 return VOS_STATUS_E_FAILURE;
5767 }
5768
5769 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5770 {
5771 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5772 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5773 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005774 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005775 {
5776 status = VOS_STATUS_SUCCESS;
5777 }
5778 else
5779 {
5780 status = VOS_STATUS_E_FAILURE;
5781 }
5782 }
5783 else
5784 {
5785 status = VOS_STATUS_E_FAILURE;
5786 }
5787 }
5788
5789 /* Release Global lock */
5790 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005791
Jeff Johnson295189b2012-06-20 16:38:30 -07005792 return (status);
5793}
5794
5795
Katya Nigam70d68332013-09-16 16:49:45 +05305796void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5797{
5798 VOS_TRACE_LEVEL vosDebugLevel;
5799 char logBuffer[LOG_SIZE];
5800 va_list marker;
5801
5802 /* getting proper Debug level */
5803 vosDebugLevel = getVosDebugLevel(loglevel);
5804
5805 /* extracting arguments from pstring */
5806 va_start( marker, pString );
5807 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5808
5809 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5810 va_end( marker );
5811}
5812
5813
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005814void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005815{
5816#ifdef WLAN_DEBUG
5817 // Verify against current log level
5818 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5819 return;
5820 else
5821 {
5822 va_list marker;
5823
5824 va_start( marker, pString ); /* Initialize variable arguments. */
5825
5826 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5827
5828 va_end( marker ); /* Reset variable arguments. */
5829 }
5830#endif
5831}
Jeff Johnson295189b2012-06-20 16:38:30 -07005832
Jeff Johnson295189b2012-06-20 16:38:30 -07005833/* ---------------------------------------------------------------------------
5834 \fn sme_GetWcnssWlanCompiledVersion
5835 \brief This API returns the version of the WCNSS WLAN API with
5836 which the HOST driver was built
5837 \param hHal - The handle returned by macOpen.
5838 \param pVersion - Points to the Version structure to be filled
5839 \return VOS_STATUS
5840 VOS_STATUS_E_INVAL - failure
5841 VOS_STATUS_SUCCESS success
5842 ---------------------------------------------------------------------------*/
5843VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5844 tSirVersionType *pVersion)
5845{
5846 VOS_STATUS status = VOS_STATUS_SUCCESS;
5847 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5848 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5849
5850 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5851 {
5852 if( pVersion != NULL )
5853 {
5854 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5855 }
5856 else
5857 {
5858 status = VOS_STATUS_E_INVAL;
5859 }
5860 sme_ReleaseGlobalLock( &pMac->sme );
5861 }
5862
5863 return (status);
5864}
5865
5866
5867/* ---------------------------------------------------------------------------
5868 \fn sme_GetWcnssWlanReportedVersion
5869 \brief This API returns the version of the WCNSS WLAN API with
5870 which the WCNSS driver reports it was built
5871 \param hHal - The handle returned by macOpen.
5872 \param pVersion - Points to the Version structure to be filled
5873 \return VOS_STATUS
5874 VOS_STATUS_E_INVAL - failure
5875 VOS_STATUS_SUCCESS success
5876 ---------------------------------------------------------------------------*/
5877VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5878 tSirVersionType *pVersion)
5879{
5880 VOS_STATUS status = VOS_STATUS_SUCCESS;
5881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5882 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5883
5884 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5885 {
5886 if( pVersion != NULL )
5887 {
5888 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5889 }
5890 else
5891 {
5892 status = VOS_STATUS_E_INVAL;
5893 }
5894 sme_ReleaseGlobalLock( &pMac->sme );
5895 }
5896
5897 return (status);
5898}
5899
5900
5901/* ---------------------------------------------------------------------------
5902 \fn sme_GetWcnssSoftwareVersion
5903 \brief This API returns the version string of the WCNSS driver
5904 \param hHal - The handle returned by macOpen.
5905 \param pVersion - Points to the Version string buffer to be filled
5906 \param versionBufferSize - THe size of the Version string buffer
5907 \return VOS_STATUS
5908 VOS_STATUS_E_INVAL - failure
5909 VOS_STATUS_SUCCESS success
5910 ---------------------------------------------------------------------------*/
5911VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5912 tANI_U8 *pVersion,
5913 tANI_U32 versionBufferSize)
5914{
5915 VOS_STATUS status = VOS_STATUS_SUCCESS;
5916 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5917 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5918
5919 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5920 {
5921 if( pVersion != NULL )
5922 {
5923 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5924 versionBufferSize);
5925 }
5926 else
5927 {
5928 status = VOS_STATUS_E_INVAL;
5929 }
5930 sme_ReleaseGlobalLock( &pMac->sme );
5931 }
5932
5933 return (status);
5934}
5935
5936
5937/* ---------------------------------------------------------------------------
5938 \fn sme_GetWcnssHardwareVersion
5939 \brief This API returns the version string of the WCNSS hardware
5940 \param hHal - The handle returned by macOpen.
5941 \param pVersion - Points to the Version string buffer to be filled
5942 \param versionBufferSize - THe size of the Version string buffer
5943 \return VOS_STATUS
5944 VOS_STATUS_E_INVAL - failure
5945 VOS_STATUS_SUCCESS success
5946 ---------------------------------------------------------------------------*/
5947VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5948 tANI_U8 *pVersion,
5949 tANI_U32 versionBufferSize)
5950{
5951 VOS_STATUS status = VOS_STATUS_SUCCESS;
5952 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5953 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5954
5955 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5956 {
5957 if( pVersion != NULL )
5958 {
5959 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5960 versionBufferSize);
5961 }
5962 else
5963 {
5964 status = VOS_STATUS_E_INVAL;
5965 }
5966 sme_ReleaseGlobalLock( &pMac->sme );
5967 }
5968
5969 return (status);
5970}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005971
Jeff Johnson295189b2012-06-20 16:38:30 -07005972
5973#ifdef FEATURE_WLAN_WAPI
5974/* ---------------------------------------------------------------------------
5975 \fn sme_RoamSetBKIDCache
5976 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5977 candidate list.
5978 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5979 it is opened (by calling halOpen).
5980 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5981 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5982 when retruning, this is the number of items put into pBKIDCache
5983 \return eHalStatus - when fail, it usually means the buffer allocated is not
5984 big enough and pNumItems has the number of tBkidCacheInfo.
5985 ---------------------------------------------------------------------------*/
5986eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5987 tANI_U32 numItems )
5988{
5989 eHalStatus status = eHAL_STATUS_FAILURE;
5990 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5991
5992 status = sme_AcquireGlobalLock( &pMac->sme );
5993 if ( HAL_STATUS_SUCCESS( status ) )
5994 {
5995 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5996 sme_ReleaseGlobalLock( &pMac->sme );
5997 }
5998
5999 return (status);
6000}
6001
6002/* ---------------------------------------------------------------------------
6003 \fn sme_RoamGetBKIDCache
6004 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6005 BKID cache.
6006 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6007 it is opened (by calling halOpen).
6008 \param pNum - caller allocated memory that has the space of the number of
6009 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6010 in SME cache.
6011 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6012 upon return
6013 \return eHalStatus - when fail, it usually means the buffer allocated is not
6014 big enough.
6015 ---------------------------------------------------------------------------*/
6016eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6017 tBkidCacheInfo *pBkidCache)
6018{
6019 eHalStatus status = eHAL_STATUS_FAILURE;
6020 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6021
6022 status = sme_AcquireGlobalLock( &pMac->sme );
6023 if ( HAL_STATUS_SUCCESS( status ) )
6024 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006025 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006026 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6027 sme_ReleaseGlobalLock( &pMac->sme );
6028 }
6029
6030 return (status);
6031}
6032
6033/* ---------------------------------------------------------------------------
6034 \fn sme_RoamGetNumBKIDCache
6035 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6036 number of BKID cache entries.
6037 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6038 it is opened (by calling halOpen).
6039 \return tANI_U32 - the number of BKID cache entries.
6040 ---------------------------------------------------------------------------*/
6041tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6042{
6043 eHalStatus status = eHAL_STATUS_FAILURE;
6044 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6045 tANI_U32 numBkidCache = 0;
6046
6047 status = sme_AcquireGlobalLock( &pMac->sme );
6048 if ( HAL_STATUS_SUCCESS( status ) )
6049 {
6050 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6051 sme_ReleaseGlobalLock( &pMac->sme );
6052 }
6053
6054 return (numBkidCache);
6055}
6056
6057/* ---------------------------------------------------------------------------
6058 \fn sme_ScanGetBKIDCandidateList
6059 \brief a wrapper function to return the BKID candidate list
6060 \param pBkidList - caller allocated buffer point to an array of
6061 tBkidCandidateInfo
6062 \param pNumItems - pointer to a variable that has the number of
6063 tBkidCandidateInfo allocated when retruning, this is
6064 either the number needed or number of items put into
6065 pPmkidList
6066 \return eHalStatus - when fail, it usually means the buffer allocated is not
6067 big enough and pNumItems
6068 has the number of tBkidCandidateInfo.
6069 \Note: pNumItems is a number of tBkidCandidateInfo,
6070 not sizeof(tBkidCandidateInfo) * something
6071 ---------------------------------------------------------------------------*/
6072eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6073 tBkidCandidateInfo *pBkidList,
6074 tANI_U32 *pNumItems )
6075{
6076 eHalStatus status = eHAL_STATUS_FAILURE;
6077 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6078
6079 status = sme_AcquireGlobalLock( &pMac->sme );
6080 if ( HAL_STATUS_SUCCESS( status ) )
6081 {
6082 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6083 sme_ReleaseGlobalLock( &pMac->sme );
6084 }
6085
6086 return (status);
6087}
6088#endif /* FEATURE_WLAN_WAPI */
6089
Jeff Johnsone7245742012-09-05 17:12:55 -07006090#ifdef FEATURE_OEM_DATA_SUPPORT
6091
6092/*****************************************************************************
6093 OEM DATA related modifications and function additions
6094 *****************************************************************************/
6095
6096/* ---------------------------------------------------------------------------
6097 \fn sme_getOemDataRsp
6098 \brief a wrapper function to obtain the OEM DATA RSP
6099 \param pOemDataRsp - A pointer to the response object
6100 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006101 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006102 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006103eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006104 tOemDataRsp **pOemDataRsp)
6105{
6106 eHalStatus status = eHAL_STATUS_SUCCESS;
6107 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6108
6109 do
6110 {
6111 //acquire the lock for the sme object
6112 status = sme_AcquireGlobalLock(&pMac->sme);
6113
6114 if(!HAL_STATUS_SUCCESS(status))
6115 {
6116 break;
6117 }
6118
6119 if(pMac->oemData.pOemDataRsp != NULL)
6120 {
6121 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6122 }
6123 else
6124 {
6125 status = eHAL_STATUS_FAILURE;
6126 }
6127
6128 //release the lock for the sme object
6129 sme_ReleaseGlobalLock( &pMac->sme );
6130
6131 } while(0);
6132
6133 return status;
6134}
6135
6136/* ---------------------------------------------------------------------------
6137 \fn sme_OemDataReq
6138 \brief a wrapper function for OEM DATA REQ
6139 \param sessionId - session id to be used.
6140 \param pOemDataReqId - pointer to an object to get back the request ID
6141 \param callback - a callback function that is called upon finish
6142 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006143 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006144 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006145eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006146 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006147 tOemDataReqConfig *pOemDataReqConfig,
6148 tANI_U32 *pOemDataReqID,
6149 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006150 void *pContext)
6151{
6152 eHalStatus status = eHAL_STATUS_SUCCESS;
6153 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6154
6155 do
6156 {
6157 //acquire the lock for the sme object
6158 status = sme_AcquireGlobalLock(&pMac->sme);
6159 if(HAL_STATUS_SUCCESS(status))
6160 {
6161 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6162
6163 if(pOemDataReqID)
6164 {
6165 *pOemDataReqID = lOemDataReqId;
6166 }
6167 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006168 {
6169 sme_ReleaseGlobalLock( &pMac->sme );
6170 return eHAL_STATUS_FAILURE;
6171 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006172
6173 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6174
6175 //release the lock for the sme object
6176 sme_ReleaseGlobalLock( &pMac->sme );
6177 }
6178 } while(0);
6179
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006180 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006181
6182 return(status);
6183}
6184
6185#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006186
6187/*--------------------------------------------------------------------------
6188
6189 \brief sme_OpenSession() - Open a session for scan/roam operation.
6190
6191 This is a synchronous API.
6192
6193
6194 \param hHal - The handle returned by macOpen.
6195 \param callback - A pointer to the function caller specifies for roam/connect status indication
6196 \param pContext - The context passed with callback
6197 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6198 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6199
6200 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6201
6202 Other status means SME is failed to open the session.
6203 eHAL_STATUS_RESOURCES - no more session available.
6204 \sa
6205
6206 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006207eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6208 void *pContext, tANI_U8 *pSelfMacAddr,
6209 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006210{
6211 eHalStatus status;
6212 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6213
6214 if( NULL == pbSessionId )
6215 {
6216 status = eHAL_STATUS_INVALID_PARAMETER;
6217 }
6218 else
6219 {
6220 status = sme_AcquireGlobalLock( &pMac->sme );
6221 if ( HAL_STATUS_SUCCESS( status ) )
6222 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006223 status = csrRoamOpenSession(pMac, callback, pContext,
6224 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006225
6226 sme_ReleaseGlobalLock( &pMac->sme );
6227 }
6228 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006229 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306230 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006231 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006232
6233 return ( status );
6234}
6235
6236
6237/*--------------------------------------------------------------------------
6238
6239 \brief sme_CloseSession() - Open a session for scan/roam operation.
6240
6241 This is a synchronous API.
6242
6243
6244 \param hHal - The handle returned by macOpen.
6245
6246 \param sessionId - A previous opened session's ID.
6247
6248 \return eHAL_STATUS_SUCCESS - session is closed.
6249
6250 Other status means SME is failed to open the session.
6251 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6252 \sa
6253
6254 --------------------------------------------------------------------------*/
6255eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6256 csrRoamSessionCloseCallback callback, void *pContext)
6257{
6258 eHalStatus status;
6259 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6260
Katya Nigambcb705f2013-12-26 14:26:22 +05306261 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006262 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006263 status = sme_AcquireGlobalLock( &pMac->sme );
6264 if ( HAL_STATUS_SUCCESS( status ) )
6265 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006266 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006267 callback, pContext );
6268
6269 sme_ReleaseGlobalLock( &pMac->sme );
6270 }
6271
6272 return ( status );
6273}
6274
Jeff Johnson295189b2012-06-20 16:38:30 -07006275/* ---------------------------------------------------------------------------
6276
6277 \fn sme_RoamUpdateAPWPSIE
6278
6279 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6280 This is an asynchronous API.
6281
6282 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6283
6284 \return eHalStatus – SUCCESS –
6285
6286 FAILURE or RESOURCES – The API finished and failed.
6287
6288 -------------------------------------------------------------------------------*/
6289eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6290{
6291
6292 eHalStatus status = eHAL_STATUS_FAILURE;
6293 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6294
6295 status = sme_AcquireGlobalLock( &pMac->sme );
6296 if ( HAL_STATUS_SUCCESS( status ) )
6297 {
6298
6299 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6300
6301 sme_ReleaseGlobalLock( &pMac->sme );
6302 }
6303
6304 return (status);
6305}
6306/* ---------------------------------------------------------------------------
6307
6308 \fn sme_RoamUpdateAPWPARSNIEs
6309
6310 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6311 This is an asynchronous API.
6312
6313 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6314
6315 \return eHalStatus – SUCCESS –
6316
6317 FAILURE or RESOURCES – The API finished and failed.
6318
6319 -------------------------------------------------------------------------------*/
6320eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6321{
6322
6323 eHalStatus status = eHAL_STATUS_FAILURE;
6324 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6325
6326 status = sme_AcquireGlobalLock( &pMac->sme );
6327 if ( HAL_STATUS_SUCCESS( status ) )
6328 {
6329
6330 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6331
6332 sme_ReleaseGlobalLock( &pMac->sme );
6333 }
6334
6335 return (status);
6336}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006337/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006338
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006339 \fn sme_ChangeMCCBeaconInterval
6340
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006341 \brief To update P2P-GO beaconInterval. This function should be called after
6342 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006343 This is an asynchronous API.
6344
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006345 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006346
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006347 \return eHalStatus SUCCESS
6348 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006349 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006350
6351 -------------------------------------------------------------------------------*/
6352eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6353{
6354 eHalStatus status = eHAL_STATUS_FAILURE;
6355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6356
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006357 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006358 status = sme_AcquireGlobalLock( &pMac->sme );
6359 if ( HAL_STATUS_SUCCESS( status ) )
6360 {
6361 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6362 sme_ReleaseGlobalLock( &pMac->sme );
6363 }
6364 return (status);
6365}
Jeff Johnson295189b2012-06-20 16:38:30 -07006366
6367/*-------------------------------------------------------------------------------*
6368
6369 \fn sme_sendBTAmpEvent
6370
6371 \brief to receive the coex priorty request from BT-AMP PAL
6372 and send the BT_AMP link state to HAL
6373
6374 \param btAmpEvent - btAmpEvent
6375
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006376 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006377
6378 FAILURE: API failed
6379
6380-------------------------------------------------------------------------------*/
6381
6382eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6383{
6384 vos_msg_t msg;
6385 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6386 eHalStatus status = eHAL_STATUS_FAILURE;
6387
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006388 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006389 if (NULL == ptrSmeBtAmpEvent)
6390 {
6391 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006392 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006393 return status;
6394 }
6395
6396 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6397 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6398 msg.reserved = 0;
6399 msg.bodyptr = ptrSmeBtAmpEvent;
6400
6401 //status = halFW_SendBTAmpEventMesg(pMac, event);
6402
6403 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6404 {
6405 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006406 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006407 vos_mem_free(ptrSmeBtAmpEvent);
6408 return status;
6409 }
6410
6411 return eHAL_STATUS_SUCCESS;
6412
6413}
6414
6415/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306416 \fn smeIssueFastRoamNeighborAPEvent
6417 \brief API to trigger fast BSS roam independent of RSSI triggers
6418 \param hHal - The handle returned by macOpen.
6419 \param bssid - Pointer to the BSSID to roam to.
6420 \param fastRoamTrig - Trigger to Scan or roam
6421 \return eHalStatus
6422 ---------------------------------------------------------------------------*/
6423eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6424 tANI_U8 *bssid,
6425 tSmeFastRoamTrigger fastRoamTrig)
6426{
6427 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6428 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6429 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6430 eHalStatus status = eHAL_STATUS_SUCCESS;
6431
6432 status = sme_AcquireGlobalLock( &pMac->sme );
6433 if ( HAL_STATUS_SUCCESS( status ) )
6434 {
6435 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6436 "%s: invoked", __func__);
6437
6438 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6439 {
6440 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6441 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6442 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6443 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006444 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6445 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306446
6447 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6448 if (VOS_STATUS_SUCCESS != vosStatus)
6449 {
6450 smsLog(pMac, LOGE,
6451 FL("CFG Channel list scan state failed with status %d "),
6452 vosStatus);
6453 }
6454 }
6455 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6456 {
6457 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6458 (void *)bssid, sizeof(tSirMacAddr));
6459 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006460 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6461 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306462
6463 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6464 0,
6465 pMac,
6466 0);
6467
6468 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6469 {
6470 smsLog(pMac,
6471 LOGE,
6472 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6473 vosStatus);
6474 }
6475 }
6476 sme_ReleaseGlobalLock( &pMac->sme );
6477 }
6478 return vosStatus;
6479}
6480/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006481 \fn sme_SetHostOffload
6482 \brief API to set the host offload feature.
6483 \param hHal - The handle returned by macOpen.
6484 \param pRequest - Pointer to the offload request.
6485 \return eHalStatus
6486 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006487eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006488 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006489{
6490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006491 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006492
Katya Nigambcb705f2013-12-26 14:26:22 +05306493 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006494 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006495 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6496 {
6497#ifdef WLAN_NS_OFFLOAD
6498 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6499 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006500 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006501 }
6502 else
6503#endif //WLAN_NS_OFFLOAD
6504 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006505 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006506 }
6507 sme_ReleaseGlobalLock( &pMac->sme );
6508 }
6509
6510 return (status);
6511}
6512
6513#ifdef WLAN_FEATURE_GTK_OFFLOAD
6514/* ---------------------------------------------------------------------------
6515 \fn sme_SetGTKOffload
6516 \brief API to set GTK offload information.
6517 \param hHal - The handle returned by macOpen.
6518 \param pRequest - Pointer to the GTK offload request.
6519 \return eHalStatus
6520 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006521eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006522 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006523{
6524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6525 eHalStatus status;
6526
Katya Nigambcb705f2013-12-26 14:26:22 +05306527 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006528 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006529 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6530 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006531 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006532 sme_ReleaseGlobalLock( &pMac->sme );
6533 }
6534
6535 return (status);
6536}
6537
6538/* ---------------------------------------------------------------------------
6539 \fn sme_GetGTKOffload
6540 \brief API to get GTK offload information.
6541 \param hHal - The handle returned by macOpen.
6542 \param pRequest - Pointer to the GTK offload response.
6543 \return eHalStatus
6544 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006545eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006546 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006547{
6548 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6549 eHalStatus status;
6550
Katya Nigambcb705f2013-12-26 14:26:22 +05306551 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006552 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006553 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6554 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006555 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006556 sme_ReleaseGlobalLock( &pMac->sme );
6557 }
6558
6559 return (status);
6560}
6561#endif // WLAN_FEATURE_GTK_OFFLOAD
6562
6563/* ---------------------------------------------------------------------------
6564 \fn sme_SetKeepAlive
6565 \brief API to set the Keep Alive feature.
6566 \param hHal - The handle returned by macOpen.
6567 \param pRequest - Pointer to the Keep Alive request.
6568 \return eHalStatus
6569 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006570eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006571 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006572{
6573 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6574 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006575 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6576 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006577 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006578 sme_ReleaseGlobalLock( &pMac->sme );
6579 }
6580
6581 return (status);
6582}
6583
6584#ifdef FEATURE_WLAN_SCAN_PNO
6585/* ---------------------------------------------------------------------------
6586 \fn sme_SetPreferredNetworkList
6587 \brief API to set the Preferred Network List Offload feature.
6588 \param hHal - The handle returned by macOpen.
6589 \param pRequest - Pointer to the offload request.
6590 \return eHalStatus
6591 ---------------------------------------------------------------------------*/
6592eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6593{
6594 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6595 eHalStatus status;
6596
6597 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6598 {
6599 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6600 sme_ReleaseGlobalLock( &pMac->sme );
6601 }
6602
6603 return (status);
6604}
6605
6606eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6607{
6608 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6609 eHalStatus status;
6610
6611 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6612 {
6613 pmcSetRssiFilter(hHal, rssiThreshold);
6614 sme_ReleaseGlobalLock( &pMac->sme );
6615 }
6616
6617 return (status);
6618}
6619
6620#endif // FEATURE_WLAN_SCAN_PNO
6621
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006622eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006623{
6624 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6625 eHalStatus status;
6626
Katya Nigambcb705f2013-12-26 14:26:22 +05306627 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006628 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006629 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6630 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006631 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006632 sme_ReleaseGlobalLock( &pMac->sme );
6633 }
6634
6635 return (status);
6636}
6637
6638/* ---------------------------------------------------------------------------
6639 \fn sme_AbortMacScan
6640 \brief API to cancel MAC scan.
6641 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306642 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306643 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006644 \return VOS_STATUS
6645 VOS_STATUS_E_FAILURE - failure
6646 VOS_STATUS_SUCCESS success
6647 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306648eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6649 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006650{
6651 eHalStatus status;
6652 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6653
Katya Nigambcb705f2013-12-26 14:26:22 +05306654 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006655 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006656 status = sme_AcquireGlobalLock( &pMac->sme );
6657 if ( HAL_STATUS_SUCCESS( status ) )
6658 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306659 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006660
Jeff Johnson295189b2012-06-20 16:38:30 -07006661 sme_ReleaseGlobalLock( &pMac->sme );
6662 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006663
Jeff Johnson295189b2012-06-20 16:38:30 -07006664 return ( status );
6665}
6666
6667/* ----------------------------------------------------------------------------
6668 \fn sme_GetOperationChannel
6669 \brief API to get current channel on which STA is parked
6670 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006671 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006672 \returns eHAL_STATUS_SUCCESS
6673 eHAL_STATUS_FAILURE
6674-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006675eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006676{
Jeff Johnson295189b2012-06-20 16:38:30 -07006677 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6678 tCsrRoamSession *pSession;
6679
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006680 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006681 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006682 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006683
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006684 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006685 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006686 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006687 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6688 {
6689 *pChannel =pSession->connectedProfile.operationChannel;
6690 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006691 }
6692 }
6693 return eHAL_STATUS_FAILURE;
6694}// sme_GetOperationChannel ends here
6695
Jeff Johnson295189b2012-06-20 16:38:30 -07006696/* ---------------------------------------------------------------------------
6697
6698 \fn sme_RegisterMgtFrame
6699
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006700 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006701 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006702 \param matchData - data which needs to be matched before passing frame
6703 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006704 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006705 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006706 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006707eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006708 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6709{
6710 eHalStatus status = eHAL_STATUS_SUCCESS;
6711 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6712
Katya Nigambcb705f2013-12-26 14:26:22 +05306713 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006714 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006715 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6716 {
6717 tSirRegisterMgmtFrame *pMsg;
6718 tANI_U16 len;
6719 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006720
6721 if(!pSession)
6722 {
6723 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006724 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006725 return eHAL_STATUS_FAILURE;
6726 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006727
Jeff Johnson295189b2012-06-20 16:38:30 -07006728 if( !pSession->sessionActive )
6729 {
6730 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006731 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006732 sme_ReleaseGlobalLock( &pMac->sme );
6733 return eHAL_STATUS_FAILURE;
6734 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006735
Jeff Johnson295189b2012-06-20 16:38:30 -07006736 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6737
Kiet Lam64c1b492013-07-12 13:56:44 +05306738 pMsg = vos_mem_malloc(len);
6739 if ( NULL == pMsg )
6740 status = eHAL_STATUS_FAILURE;
6741 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006742 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306743 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006744 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6745 pMsg->length = len;
6746 pMsg->sessionId = sessionId;
6747 pMsg->registerFrame = VOS_TRUE;
6748 pMsg->frameType = frameType;
6749 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306750 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006751 status = palSendMBMessage(pMac->hHdd, pMsg);
6752 }
6753 sme_ReleaseGlobalLock( &pMac->sme );
6754 }
6755 return status;
6756}
6757
6758/* ---------------------------------------------------------------------------
6759
6760 \fn sme_DeregisterMgtFrame
6761
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006762 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006764 \param matchData - data which needs to be matched before passing frame
6765 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006766 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006767 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006769eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006770 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6771{
6772 eHalStatus status = eHAL_STATUS_SUCCESS;
6773 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6774
Katya Nigambcb705f2013-12-26 14:26:22 +05306775 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006776 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006777 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6778 {
6779 tSirRegisterMgmtFrame *pMsg;
6780 tANI_U16 len;
6781 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006782
6783 if(!pSession)
6784 {
6785 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006786 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006787 return eHAL_STATUS_FAILURE;
6788 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006789
6790 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006791 {
6792 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006793 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006794 sme_ReleaseGlobalLock( &pMac->sme );
6795 return eHAL_STATUS_FAILURE;
6796 }
6797
6798 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6799
Kiet Lam64c1b492013-07-12 13:56:44 +05306800 pMsg = vos_mem_malloc(len);
6801 if ( NULL == pMsg )
6802 status = eHAL_STATUS_FAILURE;
6803 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006804 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306805 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006806 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006807 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006808 pMsg->registerFrame = VOS_FALSE;
6809 pMsg->frameType = frameType;
6810 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306811 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006812 status = palSendMBMessage(pMac->hHdd, pMsg);
6813 }
6814 sme_ReleaseGlobalLock( &pMac->sme );
6815 }
6816 return status;
6817}
6818
6819/* ---------------------------------------------------------------------------
6820 \fn sme_RemainOnChannel
6821 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6822 \param hHal - The handle returned by macOpen.
6823 \param pRequest - channel
6824 \param duration - duration in ms
6825 \param callback - HDD registered callback to process reaminOnChannelRsp
6826 \param context - HDD Callback param
6827 \return eHalStatus
6828 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006829eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6830 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306831 remainOnChanCallback callback,
6832 void *pContext,
6833 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006834{
6835 eHalStatus status = eHAL_STATUS_SUCCESS;
6836 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6837
Katya Nigambcb705f2013-12-26 14:26:22 +05306838 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006839 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006840 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6841 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306842 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6843 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006844#ifdef WLAN_FEATURE_P2P_INTERNAL
6845 , eP2PRemainOnChnReasonUnknown
6846#endif
6847 );
6848 sme_ReleaseGlobalLock( &pMac->sme );
6849 }
6850 return(status);
6851}
6852
6853/* ---------------------------------------------------------------------------
6854 \fn sme_ReportProbeReq
6855 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6856 \param hHal - The handle returned by macOpen.
6857 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6858 \return eHalStatus
6859 ---------------------------------------------------------------------------*/
6860
6861#ifndef WLAN_FEATURE_CONCURRENT_P2P
6862eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6863{
6864 eHalStatus status = eHAL_STATUS_SUCCESS;
6865 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6866
6867 do
6868 {
6869 //acquire the lock for the sme object
6870 status = sme_AcquireGlobalLock(&pMac->sme);
6871 if(HAL_STATUS_SUCCESS(status))
6872 {
6873 /* call set in context */
6874 pMac->p2pContext.probeReqForwarding = flag;
6875 //release the lock for the sme object
6876 sme_ReleaseGlobalLock( &pMac->sme );
6877 }
6878 } while(0);
6879
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006880 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006881
6882 return(status);
6883}
6884
6885/* ---------------------------------------------------------------------------
6886 \fn sme_updateP2pIe
6887 \brief API to set the P2p Ie in p2p context
6888 \param hHal - The handle returned by macOpen.
6889 \param p2pIe - Ptr to p2pIe from HDD.
6890 \param p2pIeLength: length of p2pIe
6891 \return eHalStatus
6892 ---------------------------------------------------------------------------*/
6893
6894eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6895{
6896 eHalStatus status = eHAL_STATUS_SUCCESS;
6897 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6898
6899 //acquire the lock for the sme object
6900 status = sme_AcquireGlobalLock(&pMac->sme);
6901 if(HAL_STATUS_SUCCESS(status))
6902 {
6903 if(NULL != pMac->p2pContext.probeRspIe){
6904 vos_mem_free(pMac->p2pContext.probeRspIe);
6905 pMac->p2pContext.probeRspIeLength = 0;
6906 }
6907
6908 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6909 if (NULL == pMac->p2pContext.probeRspIe)
6910 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006911 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006912 pMac->p2pContext.probeRspIeLength = 0;
6913 status = eHAL_STATUS_FAILURE;
6914 }
6915 else
6916 {
6917 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6918
6919 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6920 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006921 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07006922 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6923 p2pIeLength);
6924 }
6925
6926 //release the lock for the sme object
6927 sme_ReleaseGlobalLock( &pMac->sme );
6928 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006929
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006930 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006931
6932 return(status);
6933}
6934#endif
6935
6936/* ---------------------------------------------------------------------------
6937 \fn sme_sendAction
6938 \brief API to send action frame from supplicant.
6939 \param hHal - The handle returned by macOpen.
6940 \return eHalStatus
6941 ---------------------------------------------------------------------------*/
6942
6943eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006944 const tANI_U8 *pBuf, tANI_U32 len,
6945 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006946{
6947 eHalStatus status = eHAL_STATUS_SUCCESS;
6948 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6949
Katya Nigambcb705f2013-12-26 14:26:22 +05306950 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006951 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006952 //acquire the lock for the sme object
6953 status = sme_AcquireGlobalLock(&pMac->sme);
6954 if(HAL_STATUS_SUCCESS(status))
6955 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006956 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006957 //release the lock for the sme object
6958 sme_ReleaseGlobalLock( &pMac->sme );
6959 }
6960
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006961 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006962
6963 return(status);
6964}
6965
6966eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6967{
6968 eHalStatus status = eHAL_STATUS_SUCCESS;
6969 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6970
Katya Nigambcb705f2013-12-26 14:26:22 +05306971 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006972 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006973 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6974 {
6975 status = p2pCancelRemainOnChannel (hHal, sessionId);
6976 sme_ReleaseGlobalLock( &pMac->sme );
6977 }
6978 return(status);
6979}
6980
6981//Power Save Related
6982eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6983{
6984 eHalStatus status = eHAL_STATUS_SUCCESS;
6985 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6986
6987 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6988 {
6989 status = p2pSetPs (hHal, data);
6990 sme_ReleaseGlobalLock( &pMac->sme );
6991 }
6992 return(status);
6993}
6994
Jeff Johnson295189b2012-06-20 16:38:30 -07006995
6996/* ---------------------------------------------------------------------------
6997
6998 \fn sme_ConfigureRxpFilter
6999
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007000 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007001 SME will pass this request to lower mac to set/reset the filter on RXP for
7002 multicast & broadcast traffic.
7003
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007004 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007005
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007006 hHal - The handle returned by macOpen.
7007
Jeff Johnson295189b2012-06-20 16:38:30 -07007008 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7009 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7010 on this param. In future we can use this as a mask to set various types of
7011 filters as suggested below:
7012 FILTER_ALL_MULTICAST:
7013 FILTER_ALL_BROADCAST:
7014 FILTER_ALL_MULTICAST_BROADCAST:
7015
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007016
7017 \return eHalStatus
7018
7019
Jeff Johnson295189b2012-06-20 16:38:30 -07007020--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007021eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007022 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7023{
7024 eHalStatus status = eHAL_STATUS_SUCCESS;
7025 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7026 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7027 vos_msg_t vosMessage;
7028
Katya Nigambcb705f2013-12-26 14:26:22 +05307029 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007030 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007031 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7032 {
7033 /* serialize the req through MC thread */
7034 vosMessage.bodyptr = wlanRxpFilterParam;
7035 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7036 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7037 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7038 {
7039 status = eHAL_STATUS_FAILURE;
7040 }
7041 sme_ReleaseGlobalLock( &pMac->sme );
7042 }
7043 return(status);
7044}
7045
Jeff Johnson295189b2012-06-20 16:38:30 -07007046/* ---------------------------------------------------------------------------
7047
7048 \fn sme_ConfigureSuspendInd
7049
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007050 \brief
7051 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007052 be suspended
7053
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007054 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007055
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007056 hHal - The handle returned by macOpen.
7057
Jeff Johnson295189b2012-06-20 16:38:30 -07007058 wlanSuspendParam- Depicts the wlan suspend params
7059
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007060
7061 \return eHalStatus
7062
7063
Jeff Johnson295189b2012-06-20 16:38:30 -07007064--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007065eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007066 tpSirWlanSuspendParam wlanSuspendParam)
7067{
7068 eHalStatus status = eHAL_STATUS_SUCCESS;
7069 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7070 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7071 vos_msg_t vosMessage;
7072
Katya Nigambcb705f2013-12-26 14:26:22 +05307073 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007074 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007075 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7076 {
7077 /* serialize the req through MC thread */
7078 vosMessage.bodyptr = wlanSuspendParam;
7079 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7080 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7081 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7082 {
7083 status = eHAL_STATUS_FAILURE;
7084 }
7085 sme_ReleaseGlobalLock( &pMac->sme );
7086 }
7087 return(status);
7088}
7089
7090/* ---------------------------------------------------------------------------
7091
7092 \fn sme_ConfigureResumeReq
7093
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007094 \brief
7095 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007096 be Resumed
7097
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007098 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007099
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007100 hHal - The handle returned by macOpen.
7101
Jeff Johnson295189b2012-06-20 16:38:30 -07007102 wlanResumeParam- Depicts the wlan resume params
7103
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007104
7105 \return eHalStatus
7106
7107
Jeff Johnson295189b2012-06-20 16:38:30 -07007108--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007109eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007110 tpSirWlanResumeParam wlanResumeParam)
7111{
7112 eHalStatus status = eHAL_STATUS_SUCCESS;
7113 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7114 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7115 vos_msg_t vosMessage;
7116
Katya Nigambcb705f2013-12-26 14:26:22 +05307117 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007118 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007119 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7120 {
7121 /* serialize the req through MC thread */
7122 vosMessage.bodyptr = wlanResumeParam;
7123 vosMessage.type = WDA_WLAN_RESUME_REQ;
7124 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7125 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7126 {
7127 status = eHAL_STATUS_FAILURE;
7128 }
7129 sme_ReleaseGlobalLock( &pMac->sme );
7130 }
7131 return(status);
7132}
7133
Jeff Johnson295189b2012-06-20 16:38:30 -07007134/* ---------------------------------------------------------------------------
7135
7136 \fn sme_GetInfraSessionId
7137
7138 \brief To get the session ID for infra session, if connected
7139 This is a synchronous API.
7140
7141 \param hHal - The handle returned by macOpen.
7142
7143 \return sessionid, -1 if infra session is not connected
7144
7145 -------------------------------------------------------------------------------*/
7146tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7147{
7148 eHalStatus status = eHAL_STATUS_FAILURE;
7149 tANI_S8 sessionid = -1;
7150 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007151
Jeff Johnson295189b2012-06-20 16:38:30 -07007152 status = sme_AcquireGlobalLock( &pMac->sme );
7153 if ( HAL_STATUS_SUCCESS( status ) )
7154 {
7155
7156 sessionid = csrGetInfraSessionId( pMac);
7157
7158 sme_ReleaseGlobalLock( &pMac->sme );
7159 }
7160
7161 return (sessionid);
7162}
7163
7164/* ---------------------------------------------------------------------------
7165
7166 \fn sme_GetInfraOperationChannel
7167
7168 \brief To get the operating channel for infra session, if connected
7169 This is a synchronous API.
7170
7171 \param hHal - The handle returned by macOpen.
7172 \param sessionId - the sessionId returned by sme_OpenSession.
7173
7174 \return operating channel, 0 if infra session is not connected
7175
7176 -------------------------------------------------------------------------------*/
7177tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7178{
7179 eHalStatus status = eHAL_STATUS_FAILURE;
7180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7181 tANI_U8 channel = 0;
7182 status = sme_AcquireGlobalLock( &pMac->sme );
7183 if ( HAL_STATUS_SUCCESS( status ) )
7184 {
7185
7186 channel = csrGetInfraOperationChannel( pMac, sessionId);
7187
7188 sme_ReleaseGlobalLock( &pMac->sme );
7189 }
7190
7191 return (channel);
7192}
7193
7194//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 -07007195//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007196tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7197{
7198 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007200 tANI_U8 channel = 0;
7201 status = sme_AcquireGlobalLock( &pMac->sme );
7202 if ( HAL_STATUS_SUCCESS( status ) )
7203 {
7204
7205 channel = csrGetConcurrentOperationChannel( pMac );
7206 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007207 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007208 sme_ReleaseGlobalLock( &pMac->sme );
7209 }
7210
7211 return (channel);
7212}
7213
7214#ifdef FEATURE_WLAN_SCAN_PNO
7215/******************************************************************************
7216*
7217* Name: sme_PreferredNetworkFoundInd
7218*
7219* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007220* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007221*
7222* Parameters:
7223* hHal - HAL handle for device
7224* pMsg - found network description
7225*
7226* Returns: eHalStatus
7227*
7228******************************************************************************/
7229eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7230{
7231 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7232 eHalStatus status = eHAL_STATUS_SUCCESS;
7233 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007234 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7235 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007236
7237 if (NULL == pMsg)
7238 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007239 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007240 status = eHAL_STATUS_FAILURE;
7241 }
7242 else
7243 {
7244 if (pPrefNetworkFoundInd->ssId.length > 0)
7245 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007246 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7247 pPrefNetworkFoundInd->ssId.length);
7248 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7249 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307250 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7251 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007252
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307253 /* Flush scan results, So as to avoid indication/updation of
7254 * stale entries, which may not have aged out during APPS collapse
7255 */
7256 sme_ScanFlushResult(hHal,0);
7257
Srikant Kuppa066904f2013-05-07 13:56:02 -07007258 //Save the frame to scan result
7259 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7260 {
7261 //we may have a frame
7262 status = csrScanSavePreferredNetworkFound(pMac,
7263 pPrefNetworkFoundInd);
7264 if (!HAL_STATUS_SUCCESS(status))
7265 {
7266 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7267 }
7268 }
7269 else
7270 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007271 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007272 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007273 }
7274
Srikant Kuppa066904f2013-05-07 13:56:02 -07007275 /* Call Preferred Netowrk Found Indication callback routine. */
7276 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7277 {
7278 pMac->pmc.prefNetwFoundCB(
7279 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7280 pPrefNetworkFoundInd);
7281 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007282 }
7283 else
7284 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007285 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007286 status = eHAL_STATUS_FAILURE;
7287 }
7288 }
7289
7290
7291 return(status);
7292}
7293
7294#endif // FEATURE_WLAN_SCAN_PNO
7295
7296
7297eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7298{
7299 eHalStatus status = eHAL_STATUS_FAILURE;
7300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007301
Jeff Johnson295189b2012-06-20 16:38:30 -07007302 status = sme_AcquireGlobalLock( &pMac->sme );
7303 if ( HAL_STATUS_SUCCESS( status ) )
7304 {
7305 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7306 sme_ReleaseGlobalLock( &pMac->sme );
7307 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007308
Jeff Johnson295189b2012-06-20 16:38:30 -07007309 return (status);
7310}
7311
7312
7313/* ---------------------------------------------------------------------------
7314
7315 \fn sme_SetTxPerTracking
7316
7317 \brief Set Tx PER tracking configuration parameters
7318
7319 \param hHal - The handle returned by macOpen.
7320 \param pTxPerTrackingConf - Tx PER configuration parameters
7321
7322 \return eHalStatus
7323
7324 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007325eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7326 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007327 void *pCallbackContext,
7328 tpSirTxPerTrackingParam pTxPerTrackingParam)
7329{
7330 vos_msg_t msg;
7331 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7333
7334 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7335 {
7336 pMac->sme.pTxPerHitCallback = pCallbackfn;
7337 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7338 sme_ReleaseGlobalLock( &pMac->sme );
7339 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007340
Jeff Johnson295189b2012-06-20 16:38:30 -07007341 // free this memory in failure case or WDA request callback function
7342 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7343 if (NULL == pTxPerTrackingParamReq)
7344 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007345 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 -07007346 return eHAL_STATUS_FAILURE;
7347 }
7348
Kiet Lam64c1b492013-07-12 13:56:44 +05307349 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7350 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007351 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7352 msg.reserved = 0;
7353 msg.bodyptr = pTxPerTrackingParamReq;
7354
7355 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7356 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007357 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 -07007358 vos_mem_free(pTxPerTrackingParamReq);
7359 return eHAL_STATUS_FAILURE;
7360 }
7361
7362 return eHAL_STATUS_SUCCESS;
7363}
7364
7365/* ---------------------------------------------------------------------------
7366
7367 \fn sme_HandleChangeCountryCode
7368
7369 \brief Change Country code, Reg Domain and channel list
7370
7371 \details Country Code Priority
7372 0 = 11D > Configured Country > NV
7373 1 = Configured Country > 11D > NV
7374 If Supplicant country code is priority than 11d is disabled.
7375 If 11D is enabled, we update the country code after every scan.
7376 Hence when Supplicant country code is priority, we don't need 11D info.
7377 Country code from Supplicant is set as current courtry code.
7378 User can send reset command XX (instead of country code) to reset the
7379 country code to default values which is read from NV.
7380 In case of reset, 11D is enabled and default NV code is Set as current country code
7381 If 11D is priority,
7382 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7383
7384 \param pMac - The handle returned by macOpen.
7385 \param pMsgBuf - MSG Buffer
7386
7387 \return eHalStatus
7388
7389 -------------------------------------------------------------------------------*/
7390eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7391{
7392 eHalStatus status = eHAL_STATUS_SUCCESS;
7393 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007394 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007395 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7396 static uNvTables nvTables;
7397 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7398
7399
7400 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7401 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7402 {
7403 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7404
7405 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7406
7407 /* read the country code from NV and use it */
7408 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7409 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307410 vos_mem_copy(pMsg->countryCode,
7411 nvTables.defaultCountryTable.countryCode,
7412 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007413 }
7414 else
7415 {
7416 status = eHAL_STATUS_FAILURE;
7417 return status;
7418 }
7419 }
7420 else
7421 {
7422 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307423 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7424 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007425 {
7426 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7427 }
7428 }
7429
7430 /* WEXT set country code means
7431 * 11D should be supported?
7432 * 11D Channel should be enforced?
7433 * 11D Country code should be matched?
7434 * 11D Reg Domian should be matched?
7435 * Country string changed */
7436 if(pMac->roam.configParam.Is11dSupportEnabled &&
7437 pMac->roam.configParam.fEnforce11dChannels &&
7438 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7439 pMac->roam.configParam.fEnforceDefaultDomain &&
7440 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7441 {
7442 /* All 11D related options are already enabled
7443 * Country string is not changed
7444 * Do not need do anything for country code change request */
7445 return eHAL_STATUS_SUCCESS;
7446 }
7447
7448 /* Set Current Country code and Current Regulatory domain */
7449 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7450 if(eHAL_STATUS_SUCCESS != status)
7451 {
7452 /* Supplicant country code failed. So give 11D priority */
7453 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7454 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007455 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007456 }
7457
Jeff Johnson295189b2012-06-20 16:38:30 -07007458 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307459 vos_mem_copy(pMac->scan.countryCodeDefault,
7460 pMac->scan.countryCodeCurrent,
7461 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007462
7463 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307464 status = csrGetRegulatoryDomainForCountry(pMac,
7465 pMac->scan.countryCodeCurrent,
7466 (v_REGDOMAIN_t *) &domainIdIoctl,
7467 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007468 if ( status != eHAL_STATUS_SUCCESS )
7469 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007470 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007471 return status;
7472 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007473 else if (REGDOMAIN_WORLD == domainIdIoctl)
7474 {
7475 /* Supplicant country code is invalid, so we are on world mode now. So
7476 give 11D chance to update */
7477 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7478 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7479 }
7480
Jeff Johnson295189b2012-06-20 16:38:30 -07007481
Abhishek Singha306a442013-11-07 18:39:01 +05307482 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007483
7484 if ( status != eHAL_STATUS_SUCCESS )
7485 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007486 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007487 return status;
7488 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007489 else
7490 {
7491 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7492 //set again if we find AP with 11d info during scan
7493 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7494 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007495 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007496 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7497 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7498 }
7499 }
Kiet Lam6c583332013-10-14 05:37:09 +05307500#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007501 /* set to default domain ID */
7502 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7503
7504 /* get the channels based on new cc */
7505 status = csrInitGetChannels( pMac );
7506
7507 if ( status != eHAL_STATUS_SUCCESS )
7508 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007509 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007510 return status;
7511 }
7512
7513 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007514 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307515 /* Country code Changed, Purge Only scan result
7516 * which does not have channel number belong to 11d
7517 * channel list
7518 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307519 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307520
Kiet Lam6c583332013-10-14 05:37:09 +05307521#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007522 if( pMsg->changeCCCallback )
7523 {
7524 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7525 }
7526
7527 return eHAL_STATUS_SUCCESS;
7528}
7529
Amar Singhal0d15bd52013-10-12 23:13:13 -07007530/* ---------------------------------------------------------------------------
7531
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007532 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007533
7534 \brief Change Country code, Reg Domain and channel list
7535
7536 If Supplicant country code is priority than 11d is disabled.
7537 If 11D is enabled, we update the country code after every scan.
7538 Hence when Supplicant country code is priority, we don't need 11D info.
7539 Country code from Supplicant is set as current country code.
7540
7541 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007542 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007543
7544 \return eHalStatus
7545
7546 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007547eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7548 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007549{
7550 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007551 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307552 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007553
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007554 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007555 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7556
Kiet Lam6c583332013-10-14 05:37:09 +05307557 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7558 VOS_COUNTRY_CODE_LEN) == 0)
7559 {
7560 is11dCountry = VOS_TRUE;
7561 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007562
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307563 /* Set the country code given by userspace when 11dOriginal is FALSE
7564 * when 11doriginal is True,is11dCountry =0 and
7565 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7566 * and return failure
7567 */
7568 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007569 {
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307570 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
7571 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007572
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307573 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007574
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307575 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007576 pMac->scan.countryCode11d,
7577 (v_REGDOMAIN_t *) &reg_domain_id,
7578 COUNTRY_IE);
7579
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307580 return eHAL_STATUS_FAILURE;
7581 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007582 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007583 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307584 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007585 {
7586 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05307587 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007588 }
7589
Kiet Lamf2f201e2013-11-16 21:24:16 +05307590 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007591 WNI_CFG_COUNTRY_CODE_LEN);
7592
Abhishek Singha306a442013-11-07 18:39:01 +05307593 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007594
Kiet Lam6c583332013-10-14 05:37:09 +05307595 if (VOS_FALSE == is11dCountry )
7596 {
7597 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307598 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307599 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7600 /* set to default domain ID */
7601 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7602 }
7603
Amar Singhal0d15bd52013-10-12 23:13:13 -07007604 if ( status != eHAL_STATUS_SUCCESS )
7605 {
7606 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307607 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007608 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007609 else
7610 {
7611 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7612 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007613 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7614 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007615 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007616 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007617 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7618 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7619 }
7620 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007621
Amar Singhal0d15bd52013-10-12 23:13:13 -07007622 /* get the channels based on new cc */
7623 status = csrInitGetChannels(pMac);
7624
7625 if ( status != eHAL_STATUS_SUCCESS )
7626 {
7627 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7628 return status;
7629 }
7630
7631 /* reset info based on new cc, and we are done */
7632 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307633 if (VOS_TRUE == is11dCountry)
7634 {
Kiet Lam6c583332013-10-14 05:37:09 +05307635 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7636 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7637 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307638 /* Country code Changed, Purge Only scan result
7639 * which does not have channel number belong to 11d
7640 * channel list
7641 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307642 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307643 // Do active scans after the country is set by User hints or Country IE
7644 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05307645 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007646 smsLog(pMac, LOG1, FL(" returned"));
7647 return eHAL_STATUS_SUCCESS;
7648}
7649
7650/* ---------------------------------------------------------------------------
7651
Kiet Lamcffc5862013-10-30 16:28:45 +05307652 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007653
7654 \brief Update Country code in the driver if set by kernel as world
7655
7656 If 11D is enabled, we update the country code after every scan & notify kernel.
7657 This is to make sure kernel & driver are in sync in case of CC found in
7658 driver but not in kernel database
7659
7660 \param pMac - The handle returned by macOpen.
7661 \param pMsg - Carrying new CC set in kernel
7662
7663 \return eHalStatus
7664
7665 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307666eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007667{
Kiet Lamcffc5862013-10-30 16:28:45 +05307668 eHalStatus status;
7669
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007670 smsLog(pMac, LOG1, FL(" called"));
7671
7672 //this is to make sure kernel & driver are in sync in case of CC found in
7673 //driver but not in kernel database
7674 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7675 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007676 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307677 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007678 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307679 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007680 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007681 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307682
Abhishek Singha306a442013-11-07 18:39:01 +05307683 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307684
7685 if ( status != eHAL_STATUS_SUCCESS )
7686 {
7687 smsLog( pMac, LOGE, FL(" fail to set regId") );
7688 return status;
7689 }
7690 else
7691 {
7692 status = csrInitGetChannels(pMac);
7693 if ( status != eHAL_STATUS_SUCCESS )
7694 {
7695 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7696 }
7697 else
7698 {
7699 csrInitChannelList(pMac);
7700 }
7701 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307702 /* Country code Changed, Purge Only scan result
7703 * which does not have channel number belong to 11d
7704 * channel list
7705 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307706 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007707 smsLog(pMac, LOG1, FL(" returned"));
7708 return eHAL_STATUS_SUCCESS;
7709}
7710
7711/* ---------------------------------------------------------------------------
7712
Sushant Kaushik1d732562014-05-21 14:15:37 +05307713 \fn sme_DisconnectConnectedSessions
7714
7715 \brief Disconnect STA and P2P client session if channel is not supported
7716
7717 If new country code does not support the channel on which STA/P2P client
7718 is connetced, it sends the disconnect to the AP/P2P GO
7719
7720 \param pMac - The handle returned by macOpen
7721
7722 \return eHalStatus
7723
7724 -------------------------------------------------------------------------------*/
7725
7726void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
7727{
7728 v_U8_t i, sessionId, isChanFound = false;
7729 tANI_U8 currChannel;
7730
7731 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
7732 {
7733 if (csrIsSessionClientAndConnected(pMac, sessionId))
7734 {
7735 isChanFound = false;
7736 //Session is connected.Check the channel
7737 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
7738 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
7739 currChannel, sessionId);
7740 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
7741 {
7742 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
7743 {
7744 isChanFound = true;
7745 break;
7746 }
7747 }
7748
7749 if (!isChanFound)
7750 {
7751 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
7752 {
7753 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
7754 {
7755 isChanFound = true;
7756 break;
7757 }
7758 }
7759 }
7760 if (!isChanFound)
7761 {
7762 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
7763 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
7764 }
7765 }
7766 }
7767}
7768/* ---------------------------------------------------------------------------
7769
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007770 \fn sme_HandleGenericChangeCountryCode
7771
7772 \brief Change Country code, Reg Domain and channel list
7773
7774 If Supplicant country code is priority than 11d is disabled.
7775 If 11D is enabled, we update the country code after every scan.
7776 Hence when Supplicant country code is priority, we don't need 11D info.
7777 Country code from kernel is set as current country code.
7778
7779 \param pMac - The handle returned by macOpen.
7780 \param pMsgBuf - message buffer
7781
7782 \return eHalStatus
7783
7784 -------------------------------------------------------------------------------*/
7785eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7786{
7787 tAniGenericChangeCountryCodeReq *pMsg;
7788 v_REGDOMAIN_t reg_domain_id;
7789
7790 smsLog(pMac, LOG1, FL(" called"));
7791 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7792 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7793
7794 if (REGDOMAIN_COUNT == reg_domain_id)
7795 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307796 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007797 }
7798 else
7799 {
7800 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7801 }
7802 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007803 return eHAL_STATUS_SUCCESS;
7804}
7805
Jeff Johnson295189b2012-06-20 16:38:30 -07007806#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007807eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007808{
7809 tpSirRcvFltMcAddrList pRequestBuf;
7810 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007811 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007812 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007813
7814 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307815 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007816 pMulticastAddrs->ulMulticastAddrCnt,
7817 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007818
7819 /*
7820 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007821 */
7822 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7823 csrIsConnStateInfra(pMac, sessionId))
7824 {
7825 pSession = CSR_GET_SESSION( pMac, sessionId );
7826 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007827
7828 if(pSession == NULL )
7829 {
7830 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007831 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007832 return eHAL_STATUS_FAILURE;
7833 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007834
Jeff Johnson295189b2012-06-20 16:38:30 -07007835 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7836 if (NULL == pRequestBuf)
7837 {
7838 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007839 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007840 return eHAL_STATUS_FAILED_ALLOC;
7841 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007842
7843 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7844 {
7845 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7846 "indication as we are not connected", __func__);
7847 vos_mem_free(pRequestBuf);
7848 return eHAL_STATUS_FAILURE;
7849 }
7850
Jeff Johnson295189b2012-06-20 16:38:30 -07007851 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7852
Kiet Lam64c1b492013-07-12 13:56:44 +05307853 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7854 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007855 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7856 sizeof(tSirMacAddr));
7857
Jeff Johnson295189b2012-06-20 16:38:30 -07007858 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7859 msg.reserved = 0;
7860 msg.bodyptr = pRequestBuf;
7861 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7862 {
7863 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007864 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007865 vos_mem_free(pRequestBuf);
7866 return eHAL_STATUS_FAILURE;
7867 }
7868
7869 return eHAL_STATUS_SUCCESS;
7870}
7871
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007872eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007873 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007874{
7875 tpSirRcvPktFilterCfgType pRequestBuf;
7876 v_SINT_t allocSize;
7877 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007878 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7879 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007880 v_U8_t idx=0;
7881
7882 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007883 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007884 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007885
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007886 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007887
Jeff Johnson295189b2012-06-20 16:38:30 -07007888 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007889
7890 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007891 {
7892 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007893 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007894 return eHAL_STATUS_FAILED_ALLOC;
7895 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007896
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007897 if( NULL == pSession )
7898 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007899 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007900 vos_mem_free(pRequestBuf);
7901 return eHAL_STATUS_FAILURE;
7902 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007903
Kiet Lam64c1b492013-07-12 13:56:44 +05307904 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7905 sizeof(tSirMacAddr));
7906 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7907 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007908 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7909
Jeff Johnson295189b2012-06-20 16:38:30 -07007910 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7911 msg.reserved = 0;
7912 msg.bodyptr = pRequestBuf;
7913
7914 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007915 "FT %d FID %d ",
7916 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007917
7918 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007919 "params %d CT %d",
7920 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07007921
7922 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7923 {
7924
7925 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007926 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007927 pRequestBuf->paramsData[idx].protocolLayer,
7928 pRequestBuf->paramsData[idx].cmpFlag);
7929
7930 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007931 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007932 pRequestBuf->paramsData[idx].dataOffset,
7933 pRequestBuf->paramsData[idx].dataLength);
7934
7935 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007936 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007937 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007938 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007939 pRequestBuf->paramsData[idx].compareData[2],
7940 pRequestBuf->paramsData[idx].compareData[3],
7941 pRequestBuf->paramsData[idx].compareData[4],
7942 pRequestBuf->paramsData[idx].compareData[5]);
7943
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007944 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007945 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007946 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007947 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007948 pRequestBuf->paramsData[idx].dataMask[2],
7949 pRequestBuf->paramsData[idx].dataMask[3],
7950 pRequestBuf->paramsData[idx].dataMask[4],
7951 pRequestBuf->paramsData[idx].dataMask[5]);
7952
7953 }
7954
7955 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7956 {
7957 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007958 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007959 vos_mem_free(pRequestBuf);
7960 return eHAL_STATUS_FAILURE;
7961 }
7962
7963 return eHAL_STATUS_SUCCESS;
7964}
7965
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007966eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007967 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007968 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007969 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007970{
7971 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7972 eHalStatus status;
7973
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007974 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007975
7976 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7977 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007978 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007979 sme_ReleaseGlobalLock( &pMac->sme );
7980 }
7981
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007982 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007983
7984 return (status);
7985}
7986
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007987eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07007988 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007989{
7990 tpSirRcvFltPktClearParam pRequestBuf;
7991 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007992 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7993 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007994
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007995 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007996 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007997
Jeff Johnson295189b2012-06-20 16:38:30 -07007998 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007999 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008000 {
8001 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8002 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008003 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008004 return eHAL_STATUS_FAILED_ALLOC;
8005 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008006 if( NULL == pSession )
8007 {
8008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008009 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008010 vos_mem_free(pRequestBuf);
8011 return eHAL_STATUS_FAILURE;
8012 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008013
Kiet Lam64c1b492013-07-12 13:56:44 +05308014 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8015 sizeof(tSirMacAddr));
8016 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8017 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008018
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008019 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8020
Jeff Johnson295189b2012-06-20 16:38:30 -07008021 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8022 msg.reserved = 0;
8023 msg.bodyptr = pRequestBuf;
8024 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8025 {
8026 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008027 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008028 vos_mem_free(pRequestBuf);
8029 return eHAL_STATUS_FAILURE;
8030 }
8031
8032 return eHAL_STATUS_SUCCESS;
8033}
8034#endif // WLAN_FEATURE_PACKET_FILTERING
8035
8036/* ---------------------------------------------------------------------------
8037 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008038 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008039 channel switch.
8040 \param callbackContext
8041 \param status
8042 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008043void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008044 eHalStatus status)
8045{
8046 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8047 tSirMbMsg *pMsg;
8048 tANI_U16 msgLen;
8049
8050 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308051 pMsg = vos_mem_malloc(msgLen);
8052 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008053 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308054 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008055 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8056 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8057 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008058 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008059
8060 return;
8061}
8062
8063/* ---------------------------------------------------------------------------
8064 \fn sme_HandlePreChannelSwitchInd
8065 \brief Processes the indcation from PE for pre-channel switch.
8066 \param hHal
8067 \- The handle returned by macOpen. return eHalStatus
8068 ---------------------------------------------------------------------------*/
8069eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8070{
8071 eHalStatus status = eHAL_STATUS_FAILURE;
8072 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8073 status = sme_AcquireGlobalLock( &pMac->sme );
8074 if ( HAL_STATUS_SUCCESS( status ) )
8075 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008076 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8077 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008078 sme_ReleaseGlobalLock( &pMac->sme );
8079 }
8080
8081 return (status);
8082}
8083
8084/* ---------------------------------------------------------------------------
8085 \fn sme_HandlePostChannelSwitchInd
8086 \brief Processes the indcation from PE for post-channel switch.
8087 \param hHal
8088 \- The handle returned by macOpen. return eHalStatus
8089 ---------------------------------------------------------------------------*/
8090eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8091{
8092 eHalStatus status = eHAL_STATUS_FAILURE;
8093 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8094
8095 status = sme_AcquireGlobalLock( &pMac->sme );
8096 if ( HAL_STATUS_SUCCESS( status ) )
8097 {
8098 status = pmcRequestBmps(hHal, NULL, NULL);
8099 sme_ReleaseGlobalLock( &pMac->sme );
8100 }
8101
8102 return (status);
8103}
8104
8105/* ---------------------------------------------------------------------------
8106
8107 \fn sme_IsChannelValid
8108
8109 \brief To check if the channel is valid for currently established domain
8110 This is a synchronous API.
8111
8112 \param hHal - The handle returned by macOpen.
8113 \param channel - channel to verify
8114
8115 \return TRUE/FALSE, TRUE if channel is valid
8116
8117 -------------------------------------------------------------------------------*/
8118tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8119{
8120 eHalStatus status = eHAL_STATUS_FAILURE;
8121 tANI_BOOLEAN valid = FALSE;
8122 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008123
Jeff Johnson295189b2012-06-20 16:38:30 -07008124 status = sme_AcquireGlobalLock( &pMac->sme );
8125 if ( HAL_STATUS_SUCCESS( status ) )
8126 {
8127
8128 valid = csrRoamIsChannelValid( pMac, channel);
8129
8130 sme_ReleaseGlobalLock( &pMac->sme );
8131 }
8132
8133 return (valid);
8134}
8135
8136/* ---------------------------------------------------------------------------
8137 \fn sme_SetFreqBand
8138 \brief Used to set frequency band.
8139 \param hHal
8140 \eBand band value to be configured
8141 \- return eHalStatus
8142 -------------------------------------------------------------------------*/
8143eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8144{
8145 eHalStatus status = eHAL_STATUS_FAILURE;
8146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8147
8148 status = sme_AcquireGlobalLock( &pMac->sme );
8149 if ( HAL_STATUS_SUCCESS( status ) )
8150 {
8151 status = csrSetBand(hHal, eBand);
8152 sme_ReleaseGlobalLock( &pMac->sme );
8153 }
8154 return status;
8155}
8156
8157/* ---------------------------------------------------------------------------
8158 \fn sme_GetFreqBand
8159 \brief Used to get the current band settings.
8160 \param hHal
8161 \pBand pointer to hold band value
8162 \- return eHalStatus
8163 -------------------------------------------------------------------------*/
8164eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8165{
8166 eHalStatus status = eHAL_STATUS_FAILURE;
8167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8168
8169 status = sme_AcquireGlobalLock( &pMac->sme );
8170 if ( HAL_STATUS_SUCCESS( status ) )
8171 {
8172 *pBand = csrGetCurrentBand( hHal );
8173 sme_ReleaseGlobalLock( &pMac->sme );
8174 }
8175 return status;
8176}
8177
8178#ifdef WLAN_WAKEUP_EVENTS
8179/******************************************************************************
8180 \fn sme_WakeReasonIndCallback
8181
8182 \brief
8183 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8184
8185 \param hHal - HAL handle for device
8186 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8187
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008188 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008189******************************************************************************/
8190eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8191{
8192 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8193 eHalStatus status = eHAL_STATUS_SUCCESS;
8194 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8195
8196 if (NULL == pMsg)
8197 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008198 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008199 status = eHAL_STATUS_FAILURE;
8200 }
8201 else
8202 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008203 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008204
8205 /* Call Wake Reason Indication callback routine. */
8206 if (pMac->pmc.wakeReasonIndCB != NULL)
8207 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008208
Jeff Johnson295189b2012-06-20 16:38:30 -07008209 pMac->pmc.wakeReasonIndCB = NULL;
8210 pMac->pmc.wakeReasonIndCBContext = NULL;
8211
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008212 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008213 }
8214
8215 return(status);
8216}
8217#endif // WLAN_WAKEUP_EVENTS
8218
8219
8220/* ---------------------------------------------------------------------------
8221
8222 \fn sme_SetMaxTxPower
8223
8224 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8225 not persist over reboots.
8226
8227 \param hHal
8228 \param pBssid BSSID to set the power cap for
8229 \param pBssid pSelfMacAddress self MAC Address
8230 \param pBssid power to set in dB
8231 \- return eHalStatus
8232
8233 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008234eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008235 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8236{
8237 vos_msg_t msg;
8238 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308239 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008240 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008241 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8242 if (NULL == pMaxTxParams)
8243 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008244 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 -07008245 return eHAL_STATUS_FAILURE;
8246 }
8247
8248 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308249 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008250 SIR_MAC_ADDR_LENGTH);
8251 pMaxTxParams->power = dB;
8252
8253 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8254 msg.reserved = 0;
8255 msg.bodyptr = pMaxTxParams;
8256
8257 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8258 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008259 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 -07008260 vos_mem_free(pMaxTxParams);
8261 return eHAL_STATUS_FAILURE;
8262 }
8263
8264 return eHAL_STATUS_SUCCESS;
8265}
8266
Jeff Johnson295189b2012-06-20 16:38:30 -07008267/* ---------------------------------------------------------------------------
8268
Arif Hussaina5ebce02013-08-09 15:09:58 -07008269 \fn sme_SetMaxTxPowerPerBand
8270
8271 \brief Set the Maximum Transmit Power specific to band dynamically.
8272 Note: this setting will not persist over reboots.
8273
8274 \param band
8275 \param power to set in dB
8276 \- return eHalStatus
8277
8278 ----------------------------------------------------------------------------*/
8279eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8280{
8281 vos_msg_t msg;
8282 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8283
8284 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8285 if (NULL == pMaxTxPowerPerBandParams)
8286 {
8287 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8288 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8289 __func__);
8290 return eHAL_STATUS_FAILURE;
8291 }
8292
8293 pMaxTxPowerPerBandParams->power = dB;
8294 pMaxTxPowerPerBandParams->bandInfo = band;
8295
8296 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8297 msg.reserved = 0;
8298 msg.bodyptr = pMaxTxPowerPerBandParams;
8299
8300 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8301 {
8302 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8303 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8304 __func__);
8305 vos_mem_free(pMaxTxPowerPerBandParams);
8306 return eHAL_STATUS_FAILURE;
8307 }
8308
8309 return eHAL_STATUS_SUCCESS;
8310}
8311
8312/* ---------------------------------------------------------------------------
8313
schang86c22c42013-03-13 18:41:24 -07008314 \fn sme_SetTxPower
8315
8316 \brief Set Transmit Power dynamically. Note: this setting will
8317 not persist over reboots.
8318
8319 \param hHal
8320 \param sessionId Target Session ID
8321 \param mW power to set in mW
8322 \- return eHalStatus
8323
8324 -------------------------------------------------------------------------------*/
8325eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8326{
8327
8328 eHalStatus status = eHAL_STATUS_FAILURE;
8329 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8330
Katya Nigambcb705f2013-12-26 14:26:22 +05308331 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008332 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008333 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8334 status = sme_AcquireGlobalLock(&pMac->sme);
8335 if (HAL_STATUS_SUCCESS(status))
8336 {
8337 status = csrSetTxPower(pMac, sessionId, mW);
8338 sme_ReleaseGlobalLock(&pMac->sme);
8339 }
8340 return status;
8341}
8342
8343/* ---------------------------------------------------------------------------
8344
Jeff Johnson295189b2012-06-20 16:38:30 -07008345 \fn sme_HideSSID
8346
8347 \brief hide/show SSID dynamically. Note: this setting will
8348 not persist over reboots.
8349
8350 \param hHal
8351 \param sessionId
8352 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8353 \- return eHalStatus
8354
8355 -------------------------------------------------------------------------------*/
8356eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8357{
8358 eHalStatus status = eHAL_STATUS_SUCCESS;
8359 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8360 tANI_U16 len;
8361
8362 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8363 {
8364 tpSirUpdateParams pMsg;
8365 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008366
8367 if(!pSession)
8368 {
8369 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008370 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008371 return eHAL_STATUS_FAILURE;
8372 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008373
8374 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008375 VOS_ASSERT(0);
8376
8377 /* Create the message and send to lim */
8378 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308379 pMsg = vos_mem_malloc(len);
8380 if ( NULL == pMsg )
8381 status = eHAL_STATUS_FAILURE;
8382 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008383 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308384 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008385 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8386 pMsg->length = len;
8387 /* Data starts from here */
8388 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008389 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008390 status = palSendMBMessage(pMac->hHdd, pMsg);
8391 }
8392 sme_ReleaseGlobalLock( &pMac->sme );
8393 }
8394 return status;
8395}
Jeff Johnson295189b2012-06-20 16:38:30 -07008396
8397/* ---------------------------------------------------------------------------
8398
8399 \fn sme_SetTmLevel
8400 \brief Set Thermal Mitigation Level to RIVA
8401 \param hHal - The handle returned by macOpen.
8402 \param newTMLevel - new Thermal Mitigation Level
8403 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008404 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008405 ---------------------------------------------------------------------------*/
8406eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8407{
8408 eHalStatus status = eHAL_STATUS_SUCCESS;
8409 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8410 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8411 vos_msg_t vosMessage;
8412 tAniSetTmLevelReq *setTmLevelReq = NULL;
8413
Katya Nigambcb705f2013-12-26 14:26:22 +05308414 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008415 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008416 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8417 {
8418 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308419 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008420 {
8421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008422 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008423 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008424 return eHAL_STATUS_FAILURE;
8425 }
8426
8427 setTmLevelReq->tmMode = tmMode;
8428 setTmLevelReq->newTmLevel = newTMLevel;
8429
8430 /* serialize the req through MC thread */
8431 vosMessage.bodyptr = setTmLevelReq;
8432 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8433 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8434 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8435 {
8436 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008437 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008438 vos_mem_free(setTmLevelReq);
8439 status = eHAL_STATUS_FAILURE;
8440 }
8441 sme_ReleaseGlobalLock( &pMac->sme );
8442 }
8443 return(status);
8444}
8445
8446/*---------------------------------------------------------------------------
8447
8448 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8449 Host and FW.
8450
8451 \param hHal - HAL handle for device
8452
8453 \return NONE
8454
8455---------------------------------------------------------------------------*/
8456void sme_featureCapsExchange( tHalHandle hHal)
8457{
8458 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308459 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008460 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008461 WDA_featureCapsExchange(vosContext);
8462}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008463
Yathish9f22e662012-12-10 14:21:35 -08008464/*---------------------------------------------------------------------------
8465
8466 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8467 in Host.
8468
8469 \param hHal - HAL handle for device
8470
8471 \return NONE
8472
8473---------------------------------------------------------------------------*/
8474void sme_disableFeatureCapablity(tANI_U8 feature_index)
8475{
8476 WDA_disableCapablityFeature(feature_index);
8477}
8478
Jeff Johnsond13512a2012-07-17 11:42:19 -07008479/* ---------------------------------------------------------------------------
8480
8481 \fn sme_GetDefaultCountryCode
8482
8483 \brief Get the default country code from NV
8484
8485 \param hHal
8486 \param pCountry
8487 \- return eHalStatus
8488
8489 -------------------------------------------------------------------------------*/
8490eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8491{
8492 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308493 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008494 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008495 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8496}
8497
8498/* ---------------------------------------------------------------------------
8499
8500 \fn sme_GetCurrentCountryCode
8501
8502 \brief Get the current country code
8503
8504 \param hHal
8505 \param pCountry
8506 \- return eHalStatus
8507
8508 -------------------------------------------------------------------------------*/
8509eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8510{
8511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308512 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008513 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008514 return csrGetCurrentCountryCode(pMac, pCountry);
8515}
8516
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008517/* ---------------------------------------------------------------------------
8518 \fn sme_transportDebug
8519 \brief Dynamically monitoring Transport channels
8520 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008521 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008522 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008523 \param toggleStallDetect Enable stall detect feature
8524 This feature will take effect to data performance
8525 Not integrate till fully verification
8526 \- return NONE
8527 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008528void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008529{
schang6295e542013-03-12 15:31:23 -07008530 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8531
8532 if (NULL == pMac)
8533 {
8534 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8535 "%s: invalid context", __func__);
8536 return;
8537 }
8538 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008539}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008540
Kiran4a17ebe2013-01-31 10:43:43 -08008541/* ---------------------------------------------------------------------------
8542 \fn sme_ResetPowerValuesFor5G
8543 \brief Reset the power values for 5G band with NV power values.
8544 \param hHal - HAL handle for device
8545 \- return NONE
8546 -------------------------------------------------------------------------*/
8547void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8548{
8549 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308550 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008551 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008552 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8553 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8554}
8555
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008556#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008557/* ---------------------------------------------------------------------------
8558 \fn sme_UpdateRoamPrefer5GHz
8559 \brief enable/disable Roam prefer 5G runtime option
8560 This function is called through dynamic setConfig callback function
8561 to configure the Roam prefer 5G runtime option
8562 \param hHal - HAL handle for device
8563 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8564 \- return Success or failure
8565 -------------------------------------------------------------------------*/
8566
8567eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8568{
8569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008570 eHalStatus status = eHAL_STATUS_SUCCESS;
8571
Katya Nigambcb705f2013-12-26 14:26:22 +05308572 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008573 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008574 status = sme_AcquireGlobalLock( &pMac->sme );
8575 if ( HAL_STATUS_SUCCESS( status ) )
8576 {
8577 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8578 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8579 pMac->roam.configParam.nRoamPrefer5GHz,
8580 nRoamPrefer5GHz);
8581 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8582 sme_ReleaseGlobalLock( &pMac->sme );
8583 }
8584
8585 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008586}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008587
8588/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008589 \fn sme_setRoamIntraBand
8590 \brief enable/disable Intra band roaming
8591 This function is called through dynamic setConfig callback function
8592 to configure the intra band roaming
8593 \param hHal - HAL handle for device
8594 \param nRoamIntraBand Enable/Disable Intra band roaming
8595 \- return Success or failure
8596 -------------------------------------------------------------------------*/
8597eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8598{
8599 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8600 eHalStatus status = eHAL_STATUS_SUCCESS;
8601
Katya Nigambcb705f2013-12-26 14:26:22 +05308602 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008603 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008604 status = sme_AcquireGlobalLock( &pMac->sme );
8605 if ( HAL_STATUS_SUCCESS( status ) )
8606 {
8607 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8608 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8609 pMac->roam.configParam.nRoamIntraBand,
8610 nRoamIntraBand);
8611 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8612 sme_ReleaseGlobalLock( &pMac->sme );
8613 }
8614
8615 return status ;
8616}
8617
8618/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008619 \fn sme_UpdateRoamScanNProbes
8620 \brief function to update roam scan N probes
8621 This function is called through dynamic setConfig callback function
8622 to update roam scan N probes
8623 \param hHal - HAL handle for device
8624 \param nProbes number of probe requests to be sent out
8625 \- return Success or failure
8626 -------------------------------------------------------------------------*/
8627eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8628{
8629 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8630 eHalStatus status = eHAL_STATUS_SUCCESS;
8631
8632 status = sme_AcquireGlobalLock( &pMac->sme );
8633 if ( HAL_STATUS_SUCCESS( status ) )
8634 {
8635 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8636 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8637 pMac->roam.configParam.nProbes,
8638 nProbes);
8639 pMac->roam.configParam.nProbes = nProbes;
8640 sme_ReleaseGlobalLock( &pMac->sme );
8641 }
8642#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8643 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8644 {
8645 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8646 REASON_NPROBES_CHANGED);
8647 }
8648#endif
8649 return status ;
8650}
8651
8652/* ---------------------------------------------------------------------------
8653 \fn sme_UpdateRoamScanHomeAwayTime
8654 \brief function to update roam scan Home away time
8655 This function is called through dynamic setConfig callback function
8656 to update roam scan home away time
8657 \param hHal - HAL handle for device
8658 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008659 \param bSendOffloadCmd If TRUE then send offload command to firmware
8660 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008661 \- return Success or failure
8662 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008663eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8664 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008665{
8666 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8667 eHalStatus status = eHAL_STATUS_SUCCESS;
8668
8669 status = sme_AcquireGlobalLock( &pMac->sme );
8670 if ( HAL_STATUS_SUCCESS( status ) )
8671 {
8672 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8673 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8674 pMac->roam.configParam.nRoamScanHomeAwayTime,
8675 nRoamScanHomeAwayTime);
8676 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8677 sme_ReleaseGlobalLock( &pMac->sme );
8678 }
8679
8680#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008681 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008682 {
8683 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8684 REASON_HOME_AWAY_TIME_CHANGED);
8685 }
8686#endif
8687 return status;
8688}
8689
8690
8691/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008692 \fn sme_getRoamIntraBand
8693 \brief get Intra band roaming
8694 \param hHal - HAL handle for device
8695 \- return Success or failure
8696 -------------------------------------------------------------------------*/
8697v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8698{
8699 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308700 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008701 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008702 return pMac->roam.configParam.nRoamIntraBand;
8703}
8704
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008705/* ---------------------------------------------------------------------------
8706 \fn sme_getRoamScanNProbes
8707 \brief get N Probes
8708 \param hHal - HAL handle for device
8709 \- return Success or failure
8710 -------------------------------------------------------------------------*/
8711v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8712{
8713 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8714 return pMac->roam.configParam.nProbes;
8715}
8716
8717/* ---------------------------------------------------------------------------
8718 \fn sme_getRoamScanHomeAwayTime
8719 \brief get Roam scan home away time
8720 \param hHal - HAL handle for device
8721 \- return Success or failure
8722 -------------------------------------------------------------------------*/
8723v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8724{
8725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8726 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8727}
8728
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008729
8730/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008731 \fn sme_UpdateImmediateRoamRssiDiff
8732 \brief Update nImmediateRoamRssiDiff
8733 This function is called through dynamic setConfig callback function
8734 to configure nImmediateRoamRssiDiff
8735 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8736 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008737 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008738 candidate and current AP.
8739 \- return Success or failure
8740 -------------------------------------------------------------------------*/
8741
8742eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8743{
8744 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008745 eHalStatus status = eHAL_STATUS_SUCCESS;
8746
Katya Nigambcb705f2013-12-26 14:26:22 +05308747 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008748 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008749 status = sme_AcquireGlobalLock( &pMac->sme );
8750 if ( HAL_STATUS_SUCCESS( status ) )
8751 {
8752 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308753 "LFR runtime successfully set immediate roam rssi diff to"
8754 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008755 nImmediateRoamRssiDiff,
8756 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308757 macTraceGetNeighbourRoamState(
8758 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008759 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8760 sme_ReleaseGlobalLock( &pMac->sme );
8761 }
8762
8763 return status ;
8764}
8765
8766/* ---------------------------------------------------------------------------
8767 \fn sme_UpdateRoamRssiDiff
8768 \brief Update RoamRssiDiff
8769 This function is called through dynamic setConfig callback function
8770 to configure RoamRssiDiff
8771 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8772 \param hHal - HAL handle for device
8773 \param RoamRssiDiff - minimum rssi difference between potential
8774 candidate and current AP.
8775 \- return Success or failure
8776 -------------------------------------------------------------------------*/
8777
8778eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8779{
8780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8781 eHalStatus status = eHAL_STATUS_SUCCESS;
8782
8783 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308784 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008785 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008786 if ( HAL_STATUS_SUCCESS( status ) )
8787 {
8788 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308789 "LFR runtime successfully set roam rssi diff to %d"
8790 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008791 RoamRssiDiff,
8792 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308793 macTraceGetNeighbourRoamState(
8794 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008795 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8796 sme_ReleaseGlobalLock( &pMac->sme );
8797 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008798#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8799 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8800 {
8801 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8802 }
8803#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008804 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008805}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008806
8807/*--------------------------------------------------------------------------
8808 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008809 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008810 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008811 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008812 \param hHal - The handle returned by macOpen.
8813 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8814 Other status means SME is failed to update isFastTransitionEnabled.
8815 \sa
8816 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008817eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008818 v_BOOL_t isFastTransitionEnabled)
8819{
8820 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008821 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008822
Katya Nigambcb705f2013-12-26 14:26:22 +05308823 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008824 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008825 status = sme_AcquireGlobalLock( &pMac->sme );
8826 if ( HAL_STATUS_SUCCESS( status ) )
8827 {
8828 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8829 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8830 pMac->roam.configParam.isFastTransitionEnabled,
8831 isFastTransitionEnabled);
8832 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8833 sme_ReleaseGlobalLock( &pMac->sme );
8834 }
8835
8836 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008837}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008838
8839/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008840 \fn sme_UpdateWESMode
8841 \brief Update WES Mode
8842 This function is called through dynamic setConfig callback function
8843 to configure isWESModeEnabled
8844 \param hHal - HAL handle for device
8845 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8846 Other status means SME is failed to update isWESModeEnabled.
8847 -------------------------------------------------------------------------*/
8848
8849eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8850{
8851 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8852 eHalStatus status = eHAL_STATUS_SUCCESS;
8853
8854 status = sme_AcquireGlobalLock( &pMac->sme );
8855 if ( HAL_STATUS_SUCCESS( status ) )
8856 {
8857 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308858 "LFR runtime successfully set WES Mode to %d"
8859 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008860 isWESModeEnabled,
8861 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308862 macTraceGetNeighbourRoamState(
8863 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008864 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8865 sme_ReleaseGlobalLock( &pMac->sme );
8866 }
8867
8868 return status ;
8869}
8870
8871/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008872 \fn sme_SetRoamScanControl
8873 \brief Set roam scan control
8874 This function is called to set roam scan control
8875 if roam scan control is set to 0, roaming scan cache is cleared
8876 any value other than 0 is treated as invalid value
8877 \param hHal - HAL handle for device
8878 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8879 Other status means SME failure to update
8880 -------------------------------------------------------------------------*/
8881eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8882{
8883 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8884 eHalStatus status = eHAL_STATUS_SUCCESS;
8885
Katya Nigambcb705f2013-12-26 14:26:22 +05308886 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008887 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008888 status = sme_AcquireGlobalLock( &pMac->sme );
8889 if ( HAL_STATUS_SUCCESS( status ) )
8890 {
8891 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308892 "LFR runtime successfully set roam scan control to %d"
8893 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008894 roamScanControl,
8895 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308896 macTraceGetNeighbourRoamState(
8897 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008898 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8899 if ( 0 == roamScanControl)
8900 {
8901 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8902 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008903 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008904#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8905 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8906 {
8907 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8908 }
8909#endif
8910 }
8911 sme_ReleaseGlobalLock( &pMac->sme );
8912 }
8913 return status ;
8914}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008915#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008916
8917#ifdef FEATURE_WLAN_LFR
8918/*--------------------------------------------------------------------------
8919 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008920 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008921 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008922 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008923 \param hHal - The handle returned by macOpen.
8924 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8925 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8926 \sa
8927 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008928eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008929 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008930{
8931 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8932
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008933 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8934 {
8935 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8936 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8937 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8938 isFastRoamIniFeatureEnabled);
8939 return eHAL_STATUS_SUCCESS;
8940 }
8941
Srinivas Girigowdade697412013-02-14 16:31:48 -08008942 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8943 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8944 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8945 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008946 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008947 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008948
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008949 return eHAL_STATUS_SUCCESS;
8950}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008951
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008952/*--------------------------------------------------------------------------
8953 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8954 Enable/disable LFR MAWC support at runtime
8955 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8956 isMAWCIniFeatureEnabled.
8957 This is a synchronous call
8958 \param hHal - The handle returned by macOpen.
8959 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8960 Other status means SME is failed to update MAWCEnabled.
8961 \sa
8962 --------------------------------------------------------------------------*/
8963eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8964 const v_BOOL_t MAWCEnabled)
8965{
8966 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8967 eHalStatus status = eHAL_STATUS_SUCCESS;
8968
8969 status = sme_AcquireGlobalLock( &pMac->sme );
8970 if ( HAL_STATUS_SUCCESS( status ) )
8971 {
8972 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8973 "%s: MAWCEnabled is changed from %d to %d", __func__,
8974 pMac->roam.configParam.MAWCEnabled,
8975 MAWCEnabled);
8976 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8977 sme_ReleaseGlobalLock( &pMac->sme );
8978 }
8979
8980 return status ;
8981
8982}
8983
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008984#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8985/*--------------------------------------------------------------------------
8986 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8987 This is a synchronuous call
8988 \param hHal - The handle returned by macOpen.
8989 \return eHAL_STATUS_SUCCESS
8990 Other status means SME is failed
8991 \sa
8992 --------------------------------------------------------------------------*/
8993
8994eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8995 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8996{
8997
8998 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8999 eHalStatus status = eHAL_STATUS_SUCCESS;
9000
9001 status = sme_AcquireGlobalLock( &pMac->sme );
9002 if ( HAL_STATUS_SUCCESS( status ) )
9003 {
9004 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9005 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9006 {
9007 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9008 }
9009 sme_ReleaseGlobalLock( &pMac->sme );
9010 }
9011
9012 return status;
9013}
9014#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009015#endif /* FEATURE_WLAN_LFR */
9016
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009017#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009018/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009019 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009020 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009021 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009022 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009023 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009024 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9025 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009026 \sa
9027 --------------------------------------------------------------------------*/
9028
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009029eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9030 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009031{
9032 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9033
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009034 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009035 {
9036 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009037 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9038 pMac->roam.configParam.isEseIniFeatureEnabled,
9039 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009040 return eHAL_STATUS_SUCCESS;
9041 }
9042
Srinivas Girigowdade697412013-02-14 16:31:48 -08009043 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009044 "%s: EseEnabled is changed from %d to %d", __func__,
9045 pMac->roam.configParam.isEseIniFeatureEnabled,
9046 isEseIniFeatureEnabled);
9047 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9048 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009049
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009050 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009051 {
9052 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009053 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009054
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009055#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9056 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9057 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009058 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009059 }
9060#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009061 return eHAL_STATUS_SUCCESS;
9062}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009063#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009064
9065/*--------------------------------------------------------------------------
9066 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9067 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9068 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009069 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009070 \param hHal - The handle returned by macOpen.
9071 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9072 Other status means SME is failed to update fEnableFwRssiMonitoring.
9073 \sa
9074 --------------------------------------------------------------------------*/
9075
9076eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9077 v_BOOL_t fEnableFwRssiMonitoring)
9078{
9079 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9080
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009081 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9082 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9083 {
9084 halStatus = eHAL_STATUS_FAILURE;
9085 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009086 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009087 }
9088
9089 return (halStatus);
9090}
9091
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009092#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009093/*--------------------------------------------------------------------------
9094 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9095 This is a synchronous call
9096 \param hHal - The handle returned by macOpen.
9097 \return eHAL_STATUS_SUCCESS - SME update config successful.
9098 Other status means SME is failed to update
9099 \sa
9100 --------------------------------------------------------------------------*/
9101eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9102 v_U8_t neighborLookupRssiThreshold)
9103{
9104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9105 eHalStatus status = eHAL_STATUS_SUCCESS;
9106
9107 status = sme_AcquireGlobalLock( &pMac->sme );
9108 if ( HAL_STATUS_SUCCESS( status ) )
9109 {
9110 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9111 if (HAL_STATUS_SUCCESS(status))
9112 {
9113 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309114 "LFR runtime successfully set Lookup threshold to %d"
9115 " - old value is %d - roam state is %s",
9116 neighborLookupRssiThreshold,
9117 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9118 macTraceGetNeighbourRoamState(
9119 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009120 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9121 neighborLookupRssiThreshold;
9122 }
9123 sme_ReleaseGlobalLock( &pMac->sme );
9124 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009125 return status;
9126}
9127
9128/*--------------------------------------------------------------------------
9129 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9130 This is a synchronous call
9131 \param hHal - The handle returned by macOpen.
9132 \return eHAL_STATUS_SUCCESS - SME update config successful.
9133 Other status means SME is failed to update
9134 \sa
9135 --------------------------------------------------------------------------*/
9136eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9137 v_U8_t neighborReassocRssiThreshold)
9138{
9139 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9140 eHalStatus status = eHAL_STATUS_SUCCESS;
9141
9142 status = sme_AcquireGlobalLock( &pMac->sme );
9143 if ( HAL_STATUS_SUCCESS( status ) )
9144 {
9145 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309146 "LFR runtime successfully set Reassoc threshold to %d"
9147 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009148 neighborReassocRssiThreshold,
9149 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309150 macTraceGetNeighbourRoamState(
9151 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009152 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9153 neighborReassocRssiThreshold;
9154 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9155 neighborReassocRssiThreshold;
9156 sme_ReleaseGlobalLock( &pMac->sme );
9157 }
9158
9159 return status ;
9160}
9161
9162
9163/*--------------------------------------------------------------------------
9164 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9165 This is a synchronous call
9166 \param hHal - The handle returned by macOpen.
9167 \return eHAL_STATUS_SUCCESS - SME update config successful.
9168 Other status means SME is failed to update
9169 \sa
9170 --------------------------------------------------------------------------*/
9171v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9172{
9173 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9174 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9175}
9176
9177/*--------------------------------------------------------------------------
9178 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9179 This is a synchronous call
9180 \param hHal - The handle returned by macOpen.
9181 \return eHAL_STATUS_SUCCESS - SME update config successful.
9182 Other status means SME is failed to update
9183 \sa
9184 --------------------------------------------------------------------------*/
9185eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9186 v_U16_t neighborScanResultsRefreshPeriod)
9187{
9188 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9189 eHalStatus status = eHAL_STATUS_SUCCESS;
9190
9191 status = sme_AcquireGlobalLock( &pMac->sme );
9192 if ( HAL_STATUS_SUCCESS( status ) )
9193 {
9194 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309195 "LFR runtime successfully set roam scan refresh period to %d"
9196 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009197 neighborScanResultsRefreshPeriod,
9198 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309199 macTraceGetNeighbourRoamState(
9200 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009201 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9202 neighborScanResultsRefreshPeriod;
9203 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9204 neighborScanResultsRefreshPeriod;
9205
9206 sme_ReleaseGlobalLock( &pMac->sme );
9207 }
9208
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009209#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9210 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9211 {
9212 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9213 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9214 }
9215#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009216 return status ;
9217}
9218
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009219#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9220/*--------------------------------------------------------------------------
9221 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9222 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9223 gRoamScanOffloadEnabled.
9224 This is a synchronous call
9225 \param hHal - The handle returned by macOpen.
9226 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9227 Other status means SME is failed to update.
9228 \sa
9229 --------------------------------------------------------------------------*/
9230
9231eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9232 v_BOOL_t nRoamScanOffloadEnabled)
9233{
9234 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9235 eHalStatus status = eHAL_STATUS_SUCCESS;
9236
9237 status = sme_AcquireGlobalLock( &pMac->sme );
9238 if ( HAL_STATUS_SUCCESS( status ) )
9239 {
9240 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9241 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9242 pMac->roam.configParam.isRoamOffloadScanEnabled,
9243 nRoamScanOffloadEnabled);
9244 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9245 sme_ReleaseGlobalLock( &pMac->sme );
9246 }
9247
9248 return status ;
9249}
9250#endif
9251
Srinivas Girigowdade697412013-02-14 16:31:48 -08009252/*--------------------------------------------------------------------------
9253 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9254 This is a synchronous call
9255 \param hHal - The handle returned by macOpen.
9256 \return v_U16_t - Neighbor scan results refresh period value
9257 \sa
9258 --------------------------------------------------------------------------*/
9259v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9260{
9261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9262 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9263}
9264
9265/*--------------------------------------------------------------------------
9266 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9267 This is a synchronuous call
9268 \param hHal - The handle returned by macOpen.
9269 \return eHAL_STATUS_SUCCESS - SME update config successful.
9270 Other status means SME is failed to update
9271 \sa
9272 --------------------------------------------------------------------------*/
9273v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9274{
9275 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9276 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9277}
9278
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009279/* ---------------------------------------------------------------------------
9280 \fn sme_UpdateEmptyScanRefreshPeriod
9281 \brief Update nEmptyScanRefreshPeriod
9282 This function is called through dynamic setConfig callback function
9283 to configure nEmptyScanRefreshPeriod
9284 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9285 \param hHal - HAL handle for device
9286 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9287 \- return Success or failure
9288 -------------------------------------------------------------------------*/
9289
9290eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9291{
9292 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9293 eHalStatus status = eHAL_STATUS_SUCCESS;
9294
9295 status = sme_AcquireGlobalLock( &pMac->sme );
9296 if ( HAL_STATUS_SUCCESS( status ) )
9297 {
9298 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309299 "LFR runtime successfully set roam scan period to %d -"
9300 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009301 nEmptyScanRefreshPeriod,
9302 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309303 macTraceGetNeighbourRoamState(
9304 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009305 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9306 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9307 sme_ReleaseGlobalLock( &pMac->sme );
9308 }
9309
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009310#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9311 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9312 {
9313 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9314 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9315 }
9316#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009317 return status ;
9318}
9319
9320/* ---------------------------------------------------------------------------
9321 \fn sme_setNeighborScanMinChanTime
9322 \brief Update nNeighborScanMinChanTime
9323 This function is called through dynamic setConfig callback function
9324 to configure gNeighborScanChannelMinTime
9325 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9326 \param hHal - HAL handle for device
9327 \param nNeighborScanMinChanTime - Channel minimum dwell time
9328 \- return Success or failure
9329 -------------------------------------------------------------------------*/
9330eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9331{
9332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9333 eHalStatus status = eHAL_STATUS_SUCCESS;
9334
9335 status = sme_AcquireGlobalLock( &pMac->sme );
9336 if ( HAL_STATUS_SUCCESS( status ) )
9337 {
9338 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309339 "LFR runtime successfully set channel min dwell time to %d"
9340 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009341 nNeighborScanMinChanTime,
9342 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309343 macTraceGetNeighbourRoamState(
9344 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009345 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9346 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9347 sme_ReleaseGlobalLock( &pMac->sme );
9348 }
9349
9350 return status ;
9351}
9352
9353/* ---------------------------------------------------------------------------
9354 \fn sme_setNeighborScanMaxChanTime
9355 \brief Update nNeighborScanMaxChanTime
9356 This function is called through dynamic setConfig callback function
9357 to configure gNeighborScanChannelMaxTime
9358 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9359 \param hHal - HAL handle for device
9360 \param nNeighborScanMinChanTime - Channel maximum dwell time
9361 \- return Success or failure
9362 -------------------------------------------------------------------------*/
9363eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9364{
9365 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9366 eHalStatus status = eHAL_STATUS_SUCCESS;
9367
9368 status = sme_AcquireGlobalLock( &pMac->sme );
9369 if ( HAL_STATUS_SUCCESS( status ) )
9370 {
9371 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309372 "LFR runtime successfully set channel max dwell time to %d"
9373 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009374 nNeighborScanMaxChanTime,
9375 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309376 macTraceGetNeighbourRoamState(
9377 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009378 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9379 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9380 sme_ReleaseGlobalLock( &pMac->sme );
9381 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009382#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9383 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9384 {
9385 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9386 REASON_SCAN_CH_TIME_CHANGED);
9387 }
9388#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009389
9390 return status ;
9391}
9392
9393/* ---------------------------------------------------------------------------
9394 \fn sme_getNeighborScanMinChanTime
9395 \brief get neighbor scan min channel time
9396 \param hHal - The handle returned by macOpen.
9397 \return v_U16_t - channel min time value
9398 -------------------------------------------------------------------------*/
9399v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9400{
9401 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9402 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9403}
9404
9405/* ---------------------------------------------------------------------------
9406 \fn sme_getNeighborScanMaxChanTime
9407 \brief get neighbor scan max channel time
9408 \param hHal - The handle returned by macOpen.
9409 \return v_U16_t - channel max time value
9410 -------------------------------------------------------------------------*/
9411v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9412{
9413 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9414 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9415}
9416
9417/* ---------------------------------------------------------------------------
9418 \fn sme_setNeighborScanPeriod
9419 \brief Update nNeighborScanPeriod
9420 This function is called through dynamic setConfig callback function
9421 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009422 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009423 \param hHal - HAL handle for device
9424 \param nNeighborScanPeriod - neighbor scan period
9425 \- return Success or failure
9426 -------------------------------------------------------------------------*/
9427eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9428{
9429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9430 eHalStatus status = eHAL_STATUS_SUCCESS;
9431
9432 status = sme_AcquireGlobalLock( &pMac->sme );
9433 if ( HAL_STATUS_SUCCESS( status ) )
9434 {
9435 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309436 "LFR runtime successfully set neighbor scan period to %d"
9437 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009438 nNeighborScanPeriod,
9439 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309440 macTraceGetNeighbourRoamState(
9441 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009442 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9443 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9444 sme_ReleaseGlobalLock( &pMac->sme );
9445 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009446#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9447 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9448 {
9449 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9450 REASON_SCAN_HOME_TIME_CHANGED);
9451 }
9452#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009453
9454 return status ;
9455}
9456
9457/* ---------------------------------------------------------------------------
9458 \fn sme_getNeighborScanPeriod
9459 \brief get neighbor scan period
9460 \param hHal - The handle returned by macOpen.
9461 \return v_U16_t - neighbor scan period
9462 -------------------------------------------------------------------------*/
9463v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9464{
9465 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9466 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9467}
9468
9469#endif
9470
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009471#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009472
Srinivas Girigowdade697412013-02-14 16:31:48 -08009473/*--------------------------------------------------------------------------
9474 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9475 This is a synchronous call
9476 \param hHal - The handle returned by macOpen.
9477 \return v_U16_t - Rssi diff value
9478 \sa
9479 --------------------------------------------------------------------------*/
9480v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9481{
9482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9483 return pMac->roam.configParam.RoamRssiDiff;
9484}
9485
9486/*--------------------------------------------------------------------------
9487 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9488 This is a synchronous call
9489 \param hHal - The handle returned by macOpen.
9490 \return eHAL_STATUS_SUCCESS - SME update config successful.
9491 Other status means SME is failed to update
9492 \sa
9493 --------------------------------------------------------------------------*/
9494eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9495 tANI_U8 numChannels)
9496{
9497 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9498 eHalStatus status = eHAL_STATUS_SUCCESS;
9499 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009500 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309501 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009502 tANI_U8 i = 0, j = 0;
9503
9504 status = sme_AcquireGlobalLock( &pMac->sme );
9505 if ( HAL_STATUS_SUCCESS( status ) )
9506 {
9507 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9508 {
9509 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9510 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309511 if (j < sizeof(oldChannelList))
9512 {
9513 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9514 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9515 }
9516 else
9517 {
9518 break;
9519 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009520 }
9521 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009522 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009523 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009524 sme_SetRoamScanControl(hHal, 1);
9525 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009526 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009527 j = 0;
9528 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009529 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309530 if (j < sizeof(oldChannelList))
9531 {
9532 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9533 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9534 }
9535 else
9536 {
9537 break;
9538 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009539 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009540 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009541
9542 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309543 "LFR runtime successfully set roam scan channels to %s"
9544 "- old value is %s - roam state is %s",
9545 newChannelList, oldChannelList,
9546 macTraceGetNeighbourRoamState(
9547 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009548 sme_ReleaseGlobalLock( &pMac->sme );
9549 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009550#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9551 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9552 {
9553 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9554 }
9555#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009556
9557 return status ;
9558}
9559
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009560
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009561#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009562/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009563 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009564 This is a synchronuous call
9565 \param hHal - The handle returned by macOpen.
9566 \return eHAL_STATUS_SUCCESS - SME update config successful.
9567 Other status means SME is failed to update
9568 \sa
9569 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009570eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009571 tANI_U8 *pChannelList,
9572 tANI_U8 numChannels)
9573{
9574 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9575 eHalStatus status = eHAL_STATUS_SUCCESS;
9576 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9577 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9578 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9579 tANI_U8 newChannelList[128] = {0};
9580 tANI_U8 i = 0, j = 0;
9581
9582 status = sme_AcquireGlobalLock( &pMac->sme );
9583 if ( HAL_STATUS_SUCCESS( status ) )
9584 {
9585 if (NULL != currChannelListInfo->ChannelList)
9586 {
9587 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9588 {
9589 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9590 currChannelListInfo->ChannelList[i]);
9591 }
9592 }
9593 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9594
9595 if ( HAL_STATUS_SUCCESS( status ))
9596 {
9597 if (NULL != currChannelListInfo->ChannelList)
9598 {
9599 j = 0;
9600 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9601 {
9602 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9603 currChannelListInfo->ChannelList[i]);
9604 }
9605 }
9606
9607 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009608 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
9609 newChannelList, oldChannelList,
9610 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009611 }
9612 sme_ReleaseGlobalLock( &pMac->sme );
9613 }
9614#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9615 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9616 {
9617 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9618 }
9619#endif
9620
9621 return status ;
9622}
9623#endif
9624
Srinivas Girigowdade697412013-02-14 16:31:48 -08009625/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009626 \brief sme_getRoamScanChannelList() - get roam scan channel list
9627 This is a synchronous call
9628 \param hHal - The handle returned by macOpen.
9629 \return eHAL_STATUS_SUCCESS - SME update config successful.
9630 Other status means SME is failed to update
9631 \sa
9632 --------------------------------------------------------------------------*/
9633eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9634 tANI_U8 *pNumChannels)
9635{
9636 int i = 0;
9637 tANI_U8 *pOutPtr = pChannelList;
9638 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9639 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9640 eHalStatus status = eHAL_STATUS_SUCCESS;
9641
9642 status = sme_AcquireGlobalLock( &pMac->sme );
9643 if ( HAL_STATUS_SUCCESS( status ) )
9644 {
9645 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9646 {
9647 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9648 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009649 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009650 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009651 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009652 }
9653
9654 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9655 for (i = 0; i < (*pNumChannels); i++)
9656 {
9657 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9658 }
9659 pOutPtr[i] = '\0';
9660 sme_ReleaseGlobalLock( &pMac->sme );
9661 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009662 return status ;
9663}
9664
9665/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009666 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009667 This is a synchronuous call
9668 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009669 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009670 FALSE (0) - if feature is disabled (compile or runtime)
9671 \sa
9672 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009673tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009674{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009675#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -08009676 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009677 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009678#else
9679 return eANI_BOOLEAN_FALSE;
9680#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009681}
9682
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009683/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009684 \brief sme_GetWESMode() - get WES Mode
9685 This is a synchronous call
9686 \param hHal - The handle returned by macOpen
9687 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9688 \sa
9689 --------------------------------------------------------------------------*/
9690v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9691{
9692 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9693 return pMac->roam.configParam.isWESModeEnabled;
9694}
9695
9696/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009697 \brief sme_GetRoamScanControl() - get scan control
9698 This is a synchronous call
9699 \param hHal - The handle returned by macOpen.
9700 \return v_BOOL_t - Enabled(1)/Disabled(0)
9701 \sa
9702 --------------------------------------------------------------------------*/
9703v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9704{
9705 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9706 return pMac->roam.configParam.nRoamScanControl;
9707}
9708#endif
9709
9710/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009711 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9712 This is a synchronuous call
9713 \param hHal - The handle returned by macOpen.
9714 \return TRUE (1) - if the feature is enabled
9715 FALSE (0) - if feature is disabled (compile or runtime)
9716 \sa
9717 --------------------------------------------------------------------------*/
9718tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9719{
9720#ifdef FEATURE_WLAN_LFR
9721 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9722 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9723#else
9724 return eANI_BOOLEAN_FALSE;
9725#endif
9726}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009727
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009728/*--------------------------------------------------------------------------
9729 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9730 This is a synchronuous call
9731 \param hHal - The handle returned by macOpen.
9732 \return TRUE (1) - if the feature is enabled
9733 FALSE (0) - if feature is disabled (compile or runtime)
9734 \sa
9735 --------------------------------------------------------------------------*/
9736tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9737{
9738#ifdef WLAN_FEATURE_VOWIFI_11R
9739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9740 return pMac->roam.configParam.isFastTransitionEnabled;
9741#else
9742 return eANI_BOOLEAN_FALSE;
9743#endif
9744}
9745
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009746/* ---------------------------------------------------------------------------
9747 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009748
Kiet Lam0f320422013-11-21 19:29:17 +05309749 \brief Check if a feature is enabled by FW
9750
9751 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009752
Kiet Lam0f320422013-11-21 19:29:17 +05309753 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009754 -------------------------------------------------------------------------*/
9755tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9756{
9757 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9758}
Kiet Lam0f320422013-11-21 19:29:17 +05309759
9760/* ---------------------------------------------------------------------------
9761 \fn sme_IsFeatureSupportedByDriver
9762 \brief Check if a feature is enabled by Driver
9763
9764 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9765 \- return 1/0 (TRUE/FALSE)
9766 -------------------------------------------------------------------------*/
9767
9768tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9769{
9770 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9771}
9772
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009773#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309774
9775/* ---------------------------------------------------------------------------
9776 \fn sme_SendTdlsMgmtFrame
9777 \brief API to send TDLS management frames.
9778
9779 \param peerMac - peer's Mac Adress.
9780 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9781 \- return VOS_STATUS_SUCCES
9782 -------------------------------------------------------------------------*/
9783VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9784 tANI_U8 sessionId,
9785 tSirMacAddr peerMac,
9786 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9787{
9788 eHalStatus status = eHAL_STATUS_SUCCESS;
9789 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9790
9791 status = sme_AcquireGlobalLock( &pMac->sme );
9792
9793 if ( HAL_STATUS_SUCCESS( status ) )
9794 {
9795 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9796 sme_ReleaseGlobalLock( &pMac->sme );
9797 }
9798 return status ;
9799}
9800
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009801/* ---------------------------------------------------------------------------
9802 \fn sme_SendTdlsMgmtFrame
9803 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009804
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009805 \param peerMac - peer's Mac Adress.
9806 \param frame_type - Type of TDLS mgmt frame to be sent.
9807 \param dialog - dialog token used in the frame.
9808 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309809 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009810 \param buf - additional IEs to be included
9811 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009812 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009813 \- return VOS_STATUS_SUCCES
9814 -------------------------------------------------------------------------*/
9815VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309816 tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U32 peerCapability, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009817{
9818 eHalStatus status = eHAL_STATUS_SUCCESS;
9819 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9820 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9821
9822 status = sme_AcquireGlobalLock( &pMac->sme );
9823 if ( HAL_STATUS_SUCCESS( status ) )
9824 {
9825 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9826 sendTdlsReq.frameType = frame_type;
9827 sendTdlsReq.buf = buf;
9828 sendTdlsReq.len = len;
9829 sendTdlsReq.dialog = dialog;
9830 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009831 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309832 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009833
9834 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9835
9836 sme_ReleaseGlobalLock( &pMac->sme );
9837 }
9838
9839 return status ;
9840
9841}
9842/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009843 \fn sme_ChangeTdlsPeerSta
9844 \brief API to Update TDLS peer sta parameters.
9845
9846 \param peerMac - peer's Mac Adress.
9847 \param staParams - Peer Station Parameters
9848 \- return VOS_STATUS_SUCCES
9849 -------------------------------------------------------------------------*/
9850VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9851 tCsrStaParams *pstaParams)
9852{
9853 eHalStatus status = eHAL_STATUS_SUCCESS;
9854 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9855
Sushant Kaushikd62d9782014-02-19 15:39:40 +05309856 if (NULL == pstaParams)
9857 {
9858 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9859 "%s :pstaParams is NULL",__func__);
9860 return eHAL_STATUS_FAILURE;
9861 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009862 status = sme_AcquireGlobalLock( &pMac->sme );
9863 if ( HAL_STATUS_SUCCESS( status ) )
9864 {
9865 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9866
9867 sme_ReleaseGlobalLock( &pMac->sme );
9868 }
9869
9870 return status ;
9871
9872}
9873
9874/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009875 \fn sme_AddTdlsPeerSta
9876 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009877
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009878 \param peerMac - peer's Mac Adress.
9879 \- return VOS_STATUS_SUCCES
9880 -------------------------------------------------------------------------*/
9881VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9882{
9883 eHalStatus status = eHAL_STATUS_SUCCESS;
9884 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9885
9886 status = sme_AcquireGlobalLock( &pMac->sme );
9887 if ( HAL_STATUS_SUCCESS( status ) )
9888 {
9889 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9890
9891 sme_ReleaseGlobalLock( &pMac->sme );
9892 }
9893
9894 return status ;
9895
9896}
9897/* ---------------------------------------------------------------------------
9898 \fn sme_DeleteTdlsPeerSta
9899 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009900
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009901 \param peerMac - peer's Mac Adress.
9902 \- return VOS_STATUS_SUCCES
9903 -------------------------------------------------------------------------*/
9904VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9905{
9906 eHalStatus status = eHAL_STATUS_SUCCESS;
9907 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9908
9909 status = sme_AcquireGlobalLock( &pMac->sme );
9910 if ( HAL_STATUS_SUCCESS( status ) )
9911 {
9912 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9913
9914 sme_ReleaseGlobalLock( &pMac->sme );
9915 }
9916
9917 return status ;
9918
9919}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009920/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009921 \fn sme_SetTdlsPowerSaveProhibited
9922 \API to set/reset the isTdlsPowerSaveProhibited.
9923
9924 \- return void
9925 -------------------------------------------------------------------------*/
9926void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9927{
9928 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9929
9930 pMac->isTdlsPowerSaveProhibited = val;
9931 return;
9932}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009933#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309934/* ---------------------------------------------------------------------------
9935 \fn sme_IsPmcBmps
9936 \API to Check if PMC state is BMPS.
9937
9938 \- return v_BOOL_t
9939 -------------------------------------------------------------------------*/
9940v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9941{
9942 return (BMPS == pmcGetPmcState(hHal));
9943}
9944
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009945#ifdef FEATURE_WLAN_TDLS_INTERNAL
9946/*
9947 * SME API to start TDLS discovery Procedure
9948 */
9949VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9950{
9951 VOS_STATUS status = VOS_STATUS_SUCCESS;
9952 tCsrTdlsDisRequest disReq = {{0}} ;
9953 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9954 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9955
9956 return status ;
9957
9958}
9959
9960/*
9961 * Process TDLS discovery results
9962 */
9963v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9964 tSmeTdlsDisResult *disResult, v_U8_t listType)
9965{
9966 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9967 tSirTdlsPeerInfo *peerInfo = NULL ;
9968 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9969 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9970 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9971 tListElem *pEntry = NULL ;
9972 v_U8_t peerCnt = 0 ;
9973
9974 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009975 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009976 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9977 while(pEntry)
9978 {
9979 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9980 tdlsPeerStaLink) ;
9981 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9982
9983 switch(listType)
9984 {
9985 case TDLS_SETUP_LIST:
9986 {
9987 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9988 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309989 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9990 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009991 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9992 peerCnt++ ;
9993 }
9994 break ;
9995 }
9996 case TDLS_DIS_LIST:
9997 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309998 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9999 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010000 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10001 peerCnt++ ;
10002 break ;
10003 }
10004 default:
10005 {
10006 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010007 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010008 break ;
10009 }
10010 }
10011
10012 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10013 }
10014
10015 return peerCnt ;
10016
10017}
10018
10019/*
10020 * SME API to start TDLS link setup Procedure.
10021 */
10022VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10023{
10024 VOS_STATUS status = VOS_STATUS_SUCCESS;
10025 tCsrTdlsSetupRequest setupReq = {{0}} ;
10026 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10027 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10028 return status ;
10029
10030}
10031
10032/*
10033 * SME API to start TDLS link Teardown Procedure.
10034 */
10035VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10036{
10037 VOS_STATUS status = VOS_STATUS_SUCCESS;
10038 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10039 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10040 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10041 return status ;
10042
10043}
10044
10045#endif /* FEATURE_WLAN_TDLS */
10046
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010047eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10048{
10049 eHalStatus status = eHAL_STATUS_FAILURE;
10050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10051
10052 smsLog(pMac, LOG2, FL("enter"));
10053 status = sme_AcquireGlobalLock( &pMac->sme );
10054 if ( HAL_STATUS_SUCCESS( status ) )
10055 {
10056 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10057 sme_ReleaseGlobalLock( &pMac->sme );
10058 }
10059 smsLog(pMac, LOG2, FL("exit status %d"), status);
10060
10061 return (status);
10062}
10063
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010064/*
10065 * SME API to enable/disable WLAN driver initiated SSR
10066 */
10067void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10068{
10069 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10070 eHalStatus status = eHAL_STATUS_SUCCESS;
10071
10072 status = sme_AcquireGlobalLock(&pMac->sme);
10073 if (HAL_STATUS_SUCCESS(status))
10074 {
10075 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10076 "SSR level is changed %d", enableSSR);
10077 /* not serializing this messsage, as this is only going
10078 * to set a variable in WDA/WDI
10079 */
10080 WDA_SetEnableSSR(enableSSR);
10081 sme_ReleaseGlobalLock(&pMac->sme);
10082 }
10083 return;
10084}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010085
10086/*
10087 * SME API to determine the channel bonding mode
10088 */
10089VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10090{
10091 tSmeConfigParams smeConfig;
10092 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10093
10094 if (
10095#ifdef WLAN_FEATURE_11AC
10096 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10097 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10098#endif
10099 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010100 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10101
10102 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10103 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10104
10105 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010106 )
10107 {
10108 return VOS_STATUS_SUCCESS;
10109 }
10110
10111 /* If channel bonding mode is not required */
10112 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
10113 return VOS_STATUS_SUCCESS;
10114 }
10115
10116 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
10117 sme_GetConfigParam(pMac, &smeConfig);
10118
10119#ifdef WLAN_FEATURE_11AC
10120 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10121 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10122 {
10123 if ( channel== 36 || channel == 52 || channel == 100 ||
10124 channel == 116 || channel == 149 )
10125 {
10126 smeConfig.csrConfig.channelBondingMode5GHz =
10127 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
10128 }
10129 else if ( channel == 40 || channel == 56 || channel == 104 ||
10130 channel == 120 || channel == 153 )
10131 {
10132 smeConfig.csrConfig.channelBondingMode5GHz =
10133 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
10134 }
10135 else if ( channel == 44 || channel == 60 || channel == 108 ||
10136 channel == 124 || channel == 157 )
10137 {
10138 smeConfig.csrConfig.channelBondingMode5GHz =
10139 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
10140 }
10141 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010142 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010143 {
10144 smeConfig.csrConfig.channelBondingMode5GHz =
10145 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
10146 }
10147 else if ( channel == 165 )
10148 {
10149 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10150 }
10151 }
10152#endif
10153
10154 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10155 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10156 {
10157 if ( channel== 40 || channel == 48 || channel == 56 ||
10158 channel == 64 || channel == 104 || channel == 112 ||
10159 channel == 120 || channel == 128 || channel == 136 ||
10160 channel == 144 || channel == 153 || channel == 161 )
10161 {
10162 smeConfig.csrConfig.channelBondingMode5GHz = 1;
10163 }
10164 else if ( channel== 36 || channel == 44 || channel == 52 ||
10165 channel == 60 || channel == 100 || channel == 108 ||
10166 channel == 116 || channel == 124 || channel == 132 ||
10167 channel == 140 || channel == 149 || channel == 157 )
10168 {
10169 smeConfig.csrConfig.channelBondingMode5GHz = 2;
10170 }
10171 else if ( channel == 165 )
10172 {
10173 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10174 }
10175 }
krunal soni634aba32014-03-06 17:46:50 -080010176
10177 /*
10178 for 802.11a phy mode, channel bonding should be zero.
10179 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10180 through csrChangeDefaultConfigParam function. We will override this
10181 value here.
10182 */
10183 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10184 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10185 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10186 {
10187 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10188 }
10189
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010190 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Jeff Johnsonce8ad512013-10-30 12:34:42 -070010191 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010192
10193 sme_UpdateConfig (pMac, &smeConfig);
10194 return VOS_STATUS_SUCCESS;
10195}
10196
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010197/*--------------------------------------------------------------------------
10198
10199 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10200 \param hHal - The handle returned by macOpen.
10201 \param currDeviceMode - Current operating device mode.
10202 --------------------------------------------------------------------------*/
10203
10204void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10205{
10206 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10207 pMac->sme.currDeviceMode = currDeviceMode;
10208 return;
10209}
10210
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010211#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10212/*--------------------------------------------------------------------------
10213 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10214 from CSR.
10215 This is a synchronous call
10216 \param hHal - The handle returned by macOpen
10217 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10218 BSSID, channel etc.)
10219 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10220 Other status means SME is failed to send the request.
10221 \sa
10222 --------------------------------------------------------------------------*/
10223
10224eHalStatus sme_HandoffRequest(tHalHandle hHal,
10225 tCsrHandoffRequest *pHandoffInfo)
10226{
10227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10228 eHalStatus status = eHAL_STATUS_SUCCESS;
10229
10230 status = sme_AcquireGlobalLock( &pMac->sme );
10231 if ( HAL_STATUS_SUCCESS( status ) )
10232 {
10233 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10234 "%s: invoked", __func__);
10235 status = csrHandoffRequest(pMac, pHandoffInfo);
10236 sme_ReleaseGlobalLock( &pMac->sme );
10237 }
10238
10239 return status ;
10240}
10241#endif
10242
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010243/*
10244 * SME API to check if there is any infra station or
10245 * P2P client is connected
10246 */
10247VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10248{
10249 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10250 if(csrIsInfraConnected(pMac))
10251 {
10252 return VOS_STATUS_SUCCESS;
10253 }
10254 return VOS_STATUS_E_FAILURE;
10255}
10256
Leo Chang9056f462013-08-01 19:21:11 -070010257
10258#ifdef FEATURE_WLAN_LPHB
10259/* ---------------------------------------------------------------------------
10260 \fn sme_LPHBConfigReq
10261 \API to make configuration LPHB within FW.
10262 \param hHal - The handle returned by macOpen
10263 \param lphdReq - LPHB request argument by client
10264 \param pCallbackfn - LPHB timeout notification callback function pointer
10265 \- return Configuration message posting status, SUCCESS or Fail
10266 -------------------------------------------------------------------------*/
10267eHalStatus sme_LPHBConfigReq
10268(
10269 tHalHandle hHal,
10270 tSirLPHBReq *lphdReq,
10271 void (*pCallbackfn)(void *pAdapter, void *indParam)
10272)
10273{
10274 eHalStatus status = eHAL_STATUS_SUCCESS;
10275 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10276 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10277 vos_msg_t vosMessage;
10278
10279 status = sme_AcquireGlobalLock(&pMac->sme);
10280 if (eHAL_STATUS_SUCCESS == status)
10281 {
10282 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10283 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010284 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010285 {
10286 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10287 "%s: Indication Call back did not registered", __func__);
10288 sme_ReleaseGlobalLock(&pMac->sme);
10289 return eHAL_STATUS_FAILURE;
10290 }
10291 else if (NULL != pCallbackfn)
10292 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010293 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010294 }
10295
10296 /* serialize the req through MC thread */
10297 vosMessage.bodyptr = lphdReq;
10298 vosMessage.type = WDA_LPHB_CONF_REQ;
10299 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10300 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10301 {
10302 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10303 "%s: Post Config LPHB MSG fail", __func__);
10304 status = eHAL_STATUS_FAILURE;
10305 }
10306 sme_ReleaseGlobalLock(&pMac->sme);
10307 }
10308
10309 return(status);
10310}
10311#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010312/*--------------------------------------------------------------------------
10313 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10314 scan parameter.
10315 This is a synchronous call
10316 \param hHal - The handle returned by macOpen
10317 \return NONE.
10318 \sa
10319 --------------------------------------------------------------------------*/
10320void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10321 tANI_U8 nNumP2PChan)
10322{
10323 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10324
10325 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10326 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10327
10328 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10329 "%s: SCAN nNumStaChanCombinedConc : %d,"
10330 "nNumP2PChanCombinedConc : %d ",
10331 __func__, nNumStaChan, nNumP2PChan);
10332
10333 return;
10334
10335}
Leo Chang9056f462013-08-01 19:21:11 -070010336
Yue Mab9c86f42013-08-14 15:59:08 -070010337/* ---------------------------------------------------------------------------
10338 \fn sme_AddPeriodicTxPtrn
10339 \brief API to Periodic TX Pattern Offload feature
10340 \param hHal - The handle returned by macOpen
10341 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10342 \return eHalStatus
10343 ---------------------------------------------------------------------------*/
10344eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10345 *addPeriodicTxPtrnParams)
10346{
10347 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10348 eHalStatus status;
10349 vos_msg_t msg;
10350
10351 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10352 {
10353 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10354 msg.bodyptr = addPeriodicTxPtrnParams;
10355
10356 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10357 {
10358 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10359 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10360 __func__);
10361
10362 sme_ReleaseGlobalLock(&pMac->sme);
10363 return eHAL_STATUS_FAILURE;
10364 }
10365
10366 sme_ReleaseGlobalLock(&pMac->sme);
10367 return eHAL_STATUS_SUCCESS;
10368 }
10369
10370 return status;
10371}
10372
10373/* ---------------------------------------------------------------------------
10374 \fn sme_DelPeriodicTxPtrn
10375 \brief API to Periodic TX Pattern Offload feature
10376 \param hHal - The handle returned by macOpen
10377 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10378 \return eHalStatus
10379 ---------------------------------------------------------------------------*/
10380eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10381 *delPeriodicTxPtrnParams)
10382{
10383 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10384 eHalStatus status;
10385 vos_msg_t msg;
10386
10387 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10388 {
10389 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10390 msg.bodyptr = delPeriodicTxPtrnParams;
10391
10392 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10393 {
10394 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10395 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10396 __func__);
10397
10398 sme_ReleaseGlobalLock(&pMac->sme);
10399 return eHAL_STATUS_FAILURE;
10400 }
10401
10402 sme_ReleaseGlobalLock(&pMac->sme);
10403 return eHAL_STATUS_SUCCESS;
10404 }
10405
10406 return status;
10407}
10408
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010409void smeGetCommandQStatus( tHalHandle hHal )
10410{
10411 tSmeCmd *pTempCmd = NULL;
10412 tListElem *pEntry;
10413 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10414
10415 if (NULL == pMac)
10416 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010417 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10418 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010419 return;
10420 }
10421
10422 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10423 if( pEntry )
10424 {
10425 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10426 }
10427 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10428 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10429 if(pTempCmd)
10430 {
10431 if( eSmeCsrCommandMask & pTempCmd->command )
10432 {
10433 //CSR command is stuck. See what the reason code is for that command
10434 dumpCsrCommandInfo(pMac, pTempCmd);
10435 }
10436 } //if(pTempCmd)
10437
10438 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10439 csrLLCount(&pMac->sme.smeCmdPendingList));
10440
10441 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10442 csrLLCount(&pMac->roam.roamCmdPendingList));
10443
10444 return;
10445}
Rajeev79dbe4c2013-10-05 11:03:42 +053010446
10447#ifdef FEATURE_WLAN_BATCH_SCAN
10448/* ---------------------------------------------------------------------------
10449 \fn sme_SetBatchScanReq
10450 \brief API to set batch scan request in FW
10451 \param hHal - The handle returned by macOpen.
10452 \param pRequest - Pointer to the batch request.
10453 \param sessionId - session ID
10454 \param callbackRoutine - HDD callback which needs to be invoked after
10455 getting set batch scan response from FW
10456 \param callbackContext - pAdapter context
10457 \return eHalStatus
10458 ---------------------------------------------------------------------------*/
10459eHalStatus sme_SetBatchScanReq
10460(
10461 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10462 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10463 void *callbackContext
10464)
10465{
10466 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10467 eHalStatus status;
10468
Yue Mae36e3552014-03-05 17:06:20 -080010469 if (!pMac)
10470 {
10471 return eHAL_STATUS_FAILURE;
10472 }
10473
Rajeev79dbe4c2013-10-05 11:03:42 +053010474 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10475 {
10476 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10477 callbackContext);
10478 sme_ReleaseGlobalLock( &pMac->sme );
10479 }
10480
10481 return status;
10482}
10483
10484/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010485 \fn sme_SendRateUpdateInd
10486 \brief API to Update rate
10487 \param hHal - The handle returned by macOpen
10488 \param rateUpdateParams - Pointer to rate update params
10489 \return eHalStatus
10490 ---------------------------------------------------------------------------*/
10491eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10492{
10493 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10494 eHalStatus status;
10495 vos_msg_t msg;
10496
10497 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10498 {
10499 msg.type = WDA_RATE_UPDATE_IND;
10500 msg.bodyptr = rateUpdateParams;
10501
10502 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10503 {
10504 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10505 "to post WDA_SET_RMC_RATE_IND to WDA!",
10506 __func__);
10507
10508 sme_ReleaseGlobalLock(&pMac->sme);
10509 return eHAL_STATUS_FAILURE;
10510 }
10511
10512 sme_ReleaseGlobalLock(&pMac->sme);
10513 return eHAL_STATUS_SUCCESS;
10514 }
10515
10516 return status;
10517}
10518
10519/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010520 \fn sme_TriggerBatchScanResultInd
10521 \brief API to trigger batch scan result indications from FW
10522 \param hHal - The handle returned by macOpen.
10523 \param pRequest - Pointer to get batch request.
10524 \param sessionId - session ID
10525 \param callbackRoutine - HDD callback which needs to be invoked after
10526 getting batch scan result indication from FW
10527 \param callbackContext - pAdapter context
10528 \return eHalStatus
10529 ---------------------------------------------------------------------------*/
10530eHalStatus sme_TriggerBatchScanResultInd
10531(
10532 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10533 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10534 void *callbackContext
10535)
10536{
10537 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10538 eHalStatus status;
10539
10540 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10541 {
10542 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10543 callbackRoutine, callbackContext);
10544 sme_ReleaseGlobalLock( &pMac->sme );
10545 }
10546
10547 return status;
10548}
10549
10550
10551/* ---------------------------------------------------------------------------
10552 \fn sme_StopBatchScanInd
10553 \brief API to stop batch scan request in FW
10554 \param hHal - The handle returned by macOpen.
10555 \param pRequest - Pointer to the batch request.
10556 \param sessionId - session ID
10557 \return eHalStatus
10558 ---------------------------------------------------------------------------*/
10559eHalStatus sme_StopBatchScanInd
10560(
10561 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10562)
10563{
10564 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10565 eHalStatus status;
10566
10567 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10568 {
10569 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10570 sme_ReleaseGlobalLock( &pMac->sme );
10571 }
10572
10573 return status;
10574}
10575
10576#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010577
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010578
Leo Chang0b0e45a2013-12-15 15:18:55 -080010579#ifdef FEATURE_WLAN_CH_AVOID
10580/* ---------------------------------------------------------------------------
10581 \fn sme_AddChAvoidCallback
10582 \brief Used to plug in callback function
10583 Which notify channel may not be used with SAP or P2PGO mode.
10584 Notification come from FW.
10585 \param hHal
10586 \param pCallbackfn : callback function pointer should be plugged in
10587 \- return eHalStatus
10588 -------------------------------------------------------------------------*/
10589eHalStatus sme_AddChAvoidCallback
10590(
10591 tHalHandle hHal,
10592 void (*pCallbackfn)(void *pAdapter, void *indParam)
10593)
10594{
10595 eHalStatus status = eHAL_STATUS_SUCCESS;
10596 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10597
10598 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10599 "%s: Plug in CH AVOID CB", __func__);
10600
10601 status = sme_AcquireGlobalLock(&pMac->sme);
10602 if (eHAL_STATUS_SUCCESS == status)
10603 {
10604 if (NULL != pCallbackfn)
10605 {
10606 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10607 }
10608 sme_ReleaseGlobalLock(&pMac->sme);
10609 }
10610
10611 return(status);
10612}
10613#endif /* FEATURE_WLAN_CH_AVOID */
10614
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010615void activeListCmdTimeoutHandle(void *userData)
10616{
10617 if (NULL == userData)
10618 return;
10619 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10620 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010621 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010622 smeGetCommandQStatus((tHalHandle) userData);
10623}
10624
Sunil Duttc69bccb2014-05-26 21:30:20 +053010625#ifdef WLAN_FEATURE_LINK_LAYER_STATS
10626
10627/* ---------------------------------------------------------------------------
10628 \fn sme_LLStatsSetReq
10629 \brief API to set link layer stats request to FW
10630 \param hHal - The handle returned by macOpen.
10631
10632 \Param pStatsReq - a pointer to a caller allocated object of
10633 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
10634 stats set.
10635
10636 \return eHalStatus
10637 ---------------------------------------------------------------------------*/
10638eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
10639 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
10640{
10641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10642 vos_msg_t msg;
10643 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010644 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010645
Dino Mycledf0a5d92014-07-04 09:41:55 +053010646 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
10647 if ( !plinkLayerSetReq)
10648 {
10649 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10650 "%s: Not able to allocate memory for "
10651 "WDA_LINK_LAYER_STATS_SET_REQ",
10652 __func__);
10653 return eHAL_STATUS_FAILURE;
10654 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053010655
Dino Mycledf0a5d92014-07-04 09:41:55 +053010656 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
10657
Sunil Duttc69bccb2014-05-26 21:30:20 +053010658
10659 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10660 {
10661 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
10662 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010663 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010664
10665 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10666 {
10667 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10668 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
10669 status = eHAL_STATUS_FAILURE;
10670 }
10671 sme_ReleaseGlobalLock( &pMac->sme );
10672 }
10673 else
10674 {
10675 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10676 "sme_AcquireGlobalLock error", __func__);
10677 }
10678 return status;
10679}
10680
10681/* ---------------------------------------------------------------------------
10682 \fn sme_LLStatsGetReq
10683 \brief API to get link layer stats request to FW
10684 \param hHal - The handle returned by macOpen.
10685
10686 \Param pStatsReq - a pointer to a caller allocated object of
10687 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
10688 stats get.
10689
10690 \return eHalStatus
10691 ---------------------------------------------------------------------------*/
10692eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
10693 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
10694{
10695 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10696 vos_msg_t msg;
10697 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010698 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010699
Dino Mycledf0a5d92014-07-04 09:41:55 +053010700 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
10701 if ( !pGetStatsReq)
10702 {
10703 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10704 "%s: Not able to allocate memory for "
10705 "WDA_LINK_LAYER_STATS_GET_REQ",
10706 __func__);
10707 return eHAL_STATUS_FAILURE;
10708 }
10709 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010710
10711 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10712 {
10713 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
10714 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010715 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010716 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10717 {
10718 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10719 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
10720 status = eHAL_STATUS_FAILURE;
10721 }
10722 sme_ReleaseGlobalLock( &pMac->sme );
10723 }
10724 else
10725 {
10726 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10727 "sme_AcquireGlobalLock error", __func__);
10728 }
10729 return status;
10730}
10731
10732/* ---------------------------------------------------------------------------
10733 \fn sme_LLStatsClearReq
10734 \brief API to clear link layer stats request to FW
10735 \param hHal - The handle returned by macOpen.
10736
10737 \Param pStatsReq - a pointer to a caller allocated object of
10738 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
10739 stats clear.
10740
10741 \return eHalStatus
10742 ---------------------------------------------------------------------------*/
10743eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
10744 tSirLLStatsClearReq *pLinkLayerStatsClear)
10745{
10746 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10747 vos_msg_t msg;
10748 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010749 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010750
10751
Sunil Duttc69bccb2014-05-26 21:30:20 +053010752
Dino Mycledf0a5d92014-07-04 09:41:55 +053010753 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
10754 if ( !pClearStatsReq)
10755 {
10756 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10757 "%s: Not able to allocate memory for "
10758 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
10759 __func__);
10760 return eHAL_STATUS_FAILURE;
10761 }
10762
10763 *pClearStatsReq = *pLinkLayerStatsClear;
10764
Sunil Duttc69bccb2014-05-26 21:30:20 +053010765 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10766 {
10767 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
10768 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010769 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010770
10771 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10772 {
10773 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10774 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
10775 status = eHAL_STATUS_FAILURE;
10776 }
10777 sme_ReleaseGlobalLock( &pMac->sme );
10778 }
10779 else
10780 {
10781 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10782 "sme_AcquireGlobalLock error", __func__);
10783 }
10784
10785 return status;
10786}
10787
10788/* ---------------------------------------------------------------------------
10789 \fn sme_SetLinkLayerStatsIndCB
10790 \brief API to trigger Link Layer Statistic indications from FW
10791 \param hHal - The handle returned by macOpen.
10792 \param sessionId - session ID
10793 \param callbackRoutine - HDD callback which needs to be invoked after
10794 getting Link Layer Statistics from FW
10795 \param callbackContext - pAdapter context
10796 \return eHalStatus
10797 ---------------------------------------------------------------------------*/
10798eHalStatus sme_SetLinkLayerStatsIndCB
10799(
Dino Mycled3d50022014-07-07 12:58:25 +053010800 tHalHandle hHal,
10801 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
10802 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053010803)
10804{
10805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10806 eHalStatus status;
10807
10808 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10809 {
10810 if (NULL != callbackRoutine)
10811 {
10812 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010813 }
10814 sme_ReleaseGlobalLock( &pMac->sme );
10815 }
10816
10817 return status;
10818}
10819#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
10820
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010821eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10822{
10823 eHalStatus status = eHAL_STATUS_SUCCESS;
10824 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10825 pMac->fEnableDebugLog = set_value;
10826 return (status);
10827}
10828
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010829VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070010830 sme_QosWmmUpType *dscpmapping,
10831 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010832{
10833 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070010834 eHalStatus status = eHAL_STATUS_SUCCESS;
10835 v_U8_t i, j, peSessionId;
10836 tCsrRoamSession *pCsrSession = NULL;
10837 tpPESession pSession = NULL;
10838
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010839 status = sme_AcquireGlobalLock( &pMac->sme );
10840 if ( HAL_STATUS_SUCCESS( status ) )
10841 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010842 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
10843 {
10844 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10845 "%s: Invalid session Id %u", __func__, sessionId);
10846 sme_ReleaseGlobalLock( &pMac->sme);
10847 return eHAL_STATUS_FAILURE;
10848 }
10849 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
10850
10851 if (pCsrSession == NULL)
10852 {
10853 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10854 "%s: CSR Session lookup fails %u", __func__, sessionId);
10855 sme_ReleaseGlobalLock( &pMac->sme);
10856 return eHAL_STATUS_FAILURE;
10857 }
10858
10859 pSession = peFindSessionByBssid( pMac,
10860 pCsrSession->connectedProfile.bssid, &peSessionId );
10861
10862 if (pSession == NULL)
10863 {
10864 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10865 "%s: Session lookup fails for BSSID", __func__);
10866 sme_ReleaseGlobalLock( &pMac->sme);
10867 return eHAL_STATUS_FAILURE;
10868 }
10869
10870 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010871 {
10872 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10873 "%s: QOS Mapping IE not present", __func__);
10874 sme_ReleaseGlobalLock( &pMac->sme);
10875 return eHAL_STATUS_FAILURE;
10876 }
10877 else
10878 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010879 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010880 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010881 for (j = pSession->QosMapSet.dscp_range[i][0];
10882 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010883 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010884 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
10885 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010886 {
10887 dscpmapping[j]= 0;
10888 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10889 "%s: User Priority %d is not used in mapping",
10890 __func__, i);
10891 break;
10892 }
10893 else
10894 {
10895 dscpmapping[j]= i;
10896 }
10897 }
10898 }
Kumar Anand82c009f2014-05-29 00:29:42 -070010899 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010900 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010901 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010902 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010903 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
10904 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010905 }
10906 }
10907 }
10908 }
10909 sme_ReleaseGlobalLock( &pMac->sme);
10910 return status;
10911}
Agarwal Ashish5e414792014-06-08 15:25:23 +053010912
Agarwal Ashish5e414792014-06-08 15:25:23 +053010913tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
10914{
10915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10916
10917 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
10918 pMac->scan.countryCode11d, 2))
10919 {
10920 return eANI_BOOLEAN_TRUE;
10921 }
10922 else
10923 {
10924 return eANI_BOOLEAN_FALSE;
10925 }
10926}
Dino Mycle2c198072014-06-10 10:15:52 +053010927
10928#ifdef WLAN_FEATURE_EXTSCAN
10929/* ---------------------------------------------------------------------------
10930 \fn sme_GetValidChannelsByBand
10931 \brief SME API to fetch all valid channel filtered by band
10932 \param hHal
10933 \param wifiBand: RF band information
10934 \param aValidChannels: Array to store channel info
10935 \param len: number of channels
10936 \- return eHalStatus
10937 -------------------------------------------------------------------------*/
10938eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
10939 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
10940{
10941 eHalStatus status = eHAL_STATUS_SUCCESS;
10942 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
10943 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10944 tANI_U8 numChannels = 0;
10945 tANI_U8 i = 0;
10946 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
10947
10948 if (!aValidChannels || !pNumChannels) {
10949 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
10950 FL("Output channel list/NumChannels is NULL"));
10951 return eHAL_STATUS_INVALID_PARAMETER;
10952 }
10953
10954 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
10955 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
10956 FL("Invalid wifiBand (%d)"), wifiBand);
10957 return eHAL_STATUS_INVALID_PARAMETER;
10958 }
10959
10960 status = sme_GetCfgValidChannels(hHal, &chanList[0],
10961 &totValidChannels);
10962 if (!HAL_STATUS_SUCCESS(status)) {
10963 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
10964 FL("Failed to get valid channel list (err=%d)"), status);
10965 return status;
10966 }
10967
10968 switch (wifiBand) {
10969 case WIFI_BAND_UNSPECIFIED:
10970 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
10971 "return all (%d) valid channels"), totValidChannels);
10972 numChannels = totValidChannels;
10973 for (i = 0; i < numChannels; i++)
10974 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
10975 break;
10976
10977 case WIFI_BAND_BG:
10978 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
10979 for (i = 0; i < totValidChannels; i++)
10980 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
10981 aValidChannels[numChannels++] =
10982 vos_chan_to_freq(chanList[i]);
10983 break;
10984
10985 case WIFI_BAND_A:
10986 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
10987 FL("WIFI_BAND_A (5 GHz without DFS)"));
10988 for (i = 0; i < totValidChannels; i++)
10989 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
10990 !CSR_IS_CHANNEL_DFS(chanList[i]))
10991 aValidChannels[numChannels++] =
10992 vos_chan_to_freq(chanList[i]);
10993 break;
10994
10995 case WIFI_BAND_ABG:
10996 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
10997 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
10998 for (i = 0; i < totValidChannels; i++)
10999 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11000 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11001 !CSR_IS_CHANNEL_DFS(chanList[i]))
11002 aValidChannels[numChannels++] =
11003 vos_chan_to_freq(chanList[i]);
11004 break;
11005
11006 case WIFI_BAND_A_DFS_ONLY:
11007 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11008 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11009 for (i = 0; i < totValidChannels; i++)
11010 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11011 CSR_IS_CHANNEL_DFS(chanList[i]))
11012 aValidChannels[numChannels++] =
11013 vos_chan_to_freq(chanList[i]);
11014 break;
11015
11016 case WIFI_BAND_A_WITH_DFS:
11017 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11018 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11019 for (i = 0; i < totValidChannels; i++)
11020 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11021 aValidChannels[numChannels++] =
11022 vos_chan_to_freq(chanList[i]);
11023 break;
11024
11025 case WIFI_BAND_ABG_WITH_DFS:
11026 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11027 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11028 for (i = 0; i < totValidChannels; i++)
11029 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11030 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11031 aValidChannels[numChannels++] =
11032 vos_chan_to_freq(chanList[i]);
11033 break;
11034
11035 default:
11036 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11037 FL("Unknown wifiBand (%d))"), wifiBand);
11038 return eHAL_STATUS_INVALID_PARAMETER;
11039 break;
11040 }
11041 *pNumChannels = numChannels;
11042
11043 return status;
11044}
11045/* ---------------------------------------------------------------------------
11046 \fn sme_EXTScanGetCapabilities
11047 \brief SME API to fetch Extended Scan capabilities
11048 \param hHal
11049 \param pReq: Extended Scan capabilities structure
11050 \- return eHalStatus
11051 -------------------------------------------------------------------------*/
11052eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11053 tSirGetEXTScanCapabilitiesReqParams *pReq)
11054{
11055 eHalStatus status = eHAL_STATUS_SUCCESS;
11056 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11057 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11058 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011059 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11060
11061 pGetEXTScanCapabilitiesReq =
11062 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11063 if ( !pGetEXTScanCapabilitiesReq)
11064 {
11065 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11066 "%s: Not able to allocate memory for "
11067 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11068 __func__);
11069 return eHAL_STATUS_FAILURE;
11070 }
11071
11072 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011073
11074 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11075 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11076 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11077 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011078 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011079 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11080 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11081 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11082 status = eHAL_STATUS_FAILURE;
11083
11084 sme_ReleaseGlobalLock(&pMac->sme);
11085 }
11086 return(status);
11087}
11088
11089/* ---------------------------------------------------------------------------
11090 \fn sme_EXTScanStart
11091 \brief SME API to issue Extended Scan start
11092 \param hHal
11093 \param pStartCmd: Extended Scan start structure
11094 \- return eHalStatus
11095 -------------------------------------------------------------------------*/
11096eHalStatus sme_EXTScanStart (tHalHandle hHal,
11097 tSirEXTScanStartReqParams *pStartCmd)
11098{
11099 eHalStatus status = eHAL_STATUS_SUCCESS;
11100 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11101 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11102 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011103 tSirEXTScanStartReqParams *pextScanStartReq;
11104
11105 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11106 if ( !pextScanStartReq)
11107 {
11108 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11109 "%s: Not able to allocate memory for "
11110 "WDA_EXTSCAN_START_REQ",
11111 __func__);
11112 return eHAL_STATUS_FAILURE;
11113 }
11114
11115 *pextScanStartReq = *pStartCmd;
11116
Dino Mycle2c198072014-06-10 10:15:52 +053011117
11118 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11119 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11120 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11121 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011122 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011123 vosMessage.type = WDA_EXTSCAN_START_REQ;
11124 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11125 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11126 status = eHAL_STATUS_FAILURE;
11127
11128 sme_ReleaseGlobalLock(&pMac->sme);
11129 }
11130 return(status);
11131}
11132
11133/* ---------------------------------------------------------------------------
11134 \fn sme_EXTScanStop
11135 \brief SME API to issue Extended Scan stop
11136 \param hHal
11137 \param pStopReq: Extended Scan stop structure
11138 \- return eHalStatus
11139 -------------------------------------------------------------------------*/
11140eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11141{
11142 eHalStatus status = eHAL_STATUS_SUCCESS;
11143 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11144 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11145 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011146 tSirEXTScanStopReqParams *pEXTScanStopReq;
11147
11148 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11149 if ( !pEXTScanStopReq)
11150 {
11151 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11152 "%s: Not able to allocate memory for "
11153 "WDA_EXTSCAN_STOP_REQ",
11154 __func__);
11155 return eHAL_STATUS_FAILURE;
11156 }
11157
11158 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011159
11160 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11161 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11162 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11163 {
11164 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011165 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011166 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11167 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11168 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11169 {
11170 status = eHAL_STATUS_FAILURE;
11171 }
11172 sme_ReleaseGlobalLock(&pMac->sme);
11173 }
11174 return(status);
11175}
11176
11177/* ---------------------------------------------------------------------------
11178 \fn sme_SetBssHotlist
11179 \brief SME API to set BSSID hotlist
11180 \param hHal
11181 \param pSetHotListReq: Extended Scan set hotlist structure
11182 \- return eHalStatus
11183 -------------------------------------------------------------------------*/
11184eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11185 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11186{
11187 eHalStatus status = eHAL_STATUS_SUCCESS;
11188 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11189 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11190 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011191 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11192
11193 pEXTScanSetBssidHotlistReq =
11194 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11195 if ( !pEXTScanSetBssidHotlistReq)
11196 {
11197 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11198 "%s: Not able to allocate memory for "
11199 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11200 __func__);
11201 return eHAL_STATUS_FAILURE;
11202 }
11203
11204 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011205
11206 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11207 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11208 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11209 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011210 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011211 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11212 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11213 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11214 status = eHAL_STATUS_FAILURE;
11215
11216 sme_ReleaseGlobalLock(&pMac->sme);
11217 }
11218
11219 return(status);
11220}
11221
11222/* ---------------------------------------------------------------------------
11223 \fn sme_ResetBssHotlist
11224 \brief SME API to reset BSSID hotlist
11225 \param hHal
11226 \param pSetHotListReq: Extended Scan set hotlist structure
11227 \- return eHalStatus
11228 -------------------------------------------------------------------------*/
11229eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11230 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11231{
11232 eHalStatus status = eHAL_STATUS_SUCCESS;
11233 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11234 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11235 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011236 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11237
11238 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11239 if ( !pEXTScanHotlistResetReq)
11240 {
11241 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11242 "%s: Not able to allocate memory for "
11243 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11244 __func__);
11245 return eHAL_STATUS_FAILURE;
11246 }
11247
11248 *pEXTScanHotlistResetReq = *pResetReq;
11249
Dino Mycle2c198072014-06-10 10:15:52 +053011250
11251 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11252 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11253 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11254 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011255 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011256 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11257 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11258 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11259 status = eHAL_STATUS_FAILURE;
11260
11261 sme_ReleaseGlobalLock(&pMac->sme);
11262 }
11263 return(status);
11264}
11265
11266/* ---------------------------------------------------------------------------
11267 \fn sme_SetSignificantChange
11268 \brief SME API to set significant change
11269 \param hHal
11270 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11271 \- return eHalStatus
11272 -------------------------------------------------------------------------*/
11273eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11274 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11275{
11276 eHalStatus status = eHAL_STATUS_SUCCESS;
11277 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11278 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11279 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011280 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11281
11282 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11283 if ( !pEXTScanSetSignificantReq)
11284 {
11285 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11286 "%s: Not able to allocate memory for "
11287 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11288 __func__);
11289 return eHAL_STATUS_FAILURE;
11290 }
11291
11292 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11293
11294
Dino Mycle2c198072014-06-10 10:15:52 +053011295
11296 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11297 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11298 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11299 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011300 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011301 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11302 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11303 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11304 status = eHAL_STATUS_FAILURE;
11305
11306 sme_ReleaseGlobalLock(&pMac->sme);
11307 }
11308 return(status);
11309}
11310
11311/* ---------------------------------------------------------------------------
11312 \fn sme_ResetSignificantChange
11313 \brief SME API to reset significant change
11314 \param hHal
11315 \param pResetReq: Extended Scan reset significant change structure
11316 \- return eHalStatus
11317 -------------------------------------------------------------------------*/
11318eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11319 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11320{
11321 eHalStatus status = eHAL_STATUS_SUCCESS;
11322 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11323 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11324 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011325 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11326
11327 pEXTScanResetSignificantReq =
11328 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11329 if ( !pEXTScanResetSignificantReq)
11330 {
11331 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11332 "%s: Not able to allocate memory for "
11333 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11334 __func__);
11335 return eHAL_STATUS_FAILURE;
11336 }
11337
11338 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011339
11340 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11341 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11342 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11343 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011344 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011345 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11346 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11347 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11348 status = eHAL_STATUS_FAILURE;
11349
11350 sme_ReleaseGlobalLock(&pMac->sme);
11351 }
11352 return(status);
11353}
11354
11355/* ---------------------------------------------------------------------------
11356 \fn sme_getCachedResults
11357 \brief SME API to get cached results
11358 \param hHal
11359 \param pCachedResultsReq: Extended Scan get cached results structure
11360 \- return eHalStatus
11361 -------------------------------------------------------------------------*/
11362eHalStatus sme_getCachedResults (tHalHandle hHal,
11363 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11364{
11365 eHalStatus status = eHAL_STATUS_SUCCESS;
11366 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11367 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11368 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011369 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11370
11371 pEXTScanCachedResultsReq =
11372 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11373 if ( !pEXTScanCachedResultsReq)
11374 {
11375 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11376 "%s: Not able to allocate memory for "
11377 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11378 __func__);
11379 return eHAL_STATUS_FAILURE;
11380 }
11381
11382 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11383
Dino Mycle2c198072014-06-10 10:15:52 +053011384
11385 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11386 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11387 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11388 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011389 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011390 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11391 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11392 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11393 status = eHAL_STATUS_FAILURE;
11394
11395 sme_ReleaseGlobalLock(&pMac->sme);
11396 }
11397 return(status);
11398}
11399
11400eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
11401 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
11402 void *callbackContext)
11403{
11404 eHalStatus status = eHAL_STATUS_SUCCESS;
11405 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11406
11407 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11408 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
11409 pMac->sme.pEXTScanCallbackContext = callbackContext;
11410 sme_ReleaseGlobalLock(&pMac->sme);
11411 }
11412 return(status);
11413}
11414
11415#endif /* WLAN_FEATURE_EXTSCAN */