blob: fcf5d1b43f97616a53a396b86340f1d6cc134da8 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -080023 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
24 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam0fb93dd2014-02-19 00:32:59 -080026 *
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080027 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080028
29
Jeff Johnson295189b2012-06-20 16:38:30 -070030/**=========================================================================
31
32 \file smeApi.c
33
34 \brief Definitions for SME APIs
35
Kiet Lamaa8e15a2014-02-11 23:30:06 -080036 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
37
38 Qualcomm Confidential and Proprietary.
39
Jeff Johnson295189b2012-06-20 16:38:30 -070040 ========================================================================*/
41
42/*===========================================================================
43
44 EDIT HISTORY FOR FILE
45
46
47 This section contains comments describing changes made to the module.
48 Notice that changes are listed in reverse chronological order.
49
50
51
52 when who what, where, why
53---------- --- --------------------------------------------------------
5406/03/10 js Added support to hostapd driven
55 * deauth/disassoc/mic failure
56
57===========================================================================*/
58
59/*--------------------------------------------------------------------------
60 Include Files
61 ------------------------------------------------------------------------*/
62
Jeff Johnson295189b2012-06-20 16:38:30 -070063
64#include "smsDebug.h"
65#include "sme_Api.h"
66#include "csrInsideApi.h"
67#include "smeInside.h"
68#include "csrInternal.h"
69#include "wlan_qct_wda.h"
70#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053071#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070072#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053073#include "vos_types.h"
74#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053076#include "macTrace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
Mukul Sharmabe91e2f2014-06-29 22:09:20 +053079#ifdef DEBUG_ROAM_DELAY
80#include "vos_utils.h"
81#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070082
Jeff Johnson295189b2012-06-20 16:38:30 -070083extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
84
85#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053086#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080087#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053088#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080089
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070090
91#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
92
Jeff Johnson295189b2012-06-20 16:38:30 -070093// TxMB Functions
94extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
95 tANI_U32 size, tSmeCmd **ppCmd );
96extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
97extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070098extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
99extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
100extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
101extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
102extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
103extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
105static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
106static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
107
108eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
109
110eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
111
Sushant Kaushik1d732562014-05-21 14:15:37 +0530112void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
113
Amar Singhal0d15bd52013-10-12 23:13:13 -0700114eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
115
Jeff Johnson295189b2012-06-20 16:38:30 -0700116eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
117
118eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
119
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700120#ifdef FEATURE_WLAN_LFR
121tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
122#endif
123
Chet Lanctot186b5732013-03-18 10:26:30 -0700124#ifdef WLAN_FEATURE_11W
125eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
126 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
127#endif
128
Jeff Johnson295189b2012-06-20 16:38:30 -0700129//Internal SME APIs
130eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
131{
132 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
133
134 if(psSme)
135 {
136 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
137 {
138 status = eHAL_STATUS_SUCCESS;
139 }
140 }
141
142 return (status);
143}
144
145
146eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
147{
148 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
149
150 if(psSme)
151 {
152 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
153 {
154 status = eHAL_STATUS_SUCCESS;
155 }
156 }
157
158 return (status);
159}
160
161
162
163static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
164{
165 eHalStatus status;
166 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700168 VOS_STATUS vosStatus;
169 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
171 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530172 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
173 &pMac->sme.smeCmdActiveList)))
174 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700175
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530176 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
177 &pMac->sme.smeCmdPendingList)))
178 goto end;
179
180 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
181 &pMac->sme.smeScanCmdActiveList)))
182 goto end;
183
184 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
185 &pMac->sme.smeScanCmdPendingList)))
186 goto end;
187
188 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
189 &pMac->sme.smeCmdFreeList)))
190 goto end;
191
Kiet Lam64c1b492013-07-12 13:56:44 +0530192 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
193 if ( NULL == pCmd )
194 status = eHAL_STATUS_FAILURE;
195 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530196 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530197 status = eHAL_STATUS_SUCCESS;
198
199 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
200 pMac->sme.pSmeCmdBufAddr = pCmd;
201
202 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
203 {
204 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530205 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530206 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 }
208
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700209 /* This timer is only to debug the active list command timeout */
210
211 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
212 if (cmdTimeoutTimer)
213 {
214 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
215 vosStatus =
216 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
217 VOS_TIMER_TYPE_SW,
218 activeListCmdTimeoutHandle,
219 (void*) pMac);
220
221 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
222 {
223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
224 "Init Timer fail for active list command process time out");
225 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
226 }
227 else
228 {
229 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
230 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
231 }
232 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530233end:
234 if (!HAL_STATUS_SUCCESS(status))
235 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
236 status);
237
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 return (status);
239}
240
241
242void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
243{
244 pCmd->command = eSmeNoCommand;
245 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
246}
247
248
249
250static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
251{
252 tListElem *pEntry;
253 tSmeCmd *pCommand;
254
255 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
256 {
257 //TODO: base on command type to call release functions
258 //reinitialize different command types so they can be reused
259 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
260 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
261 }
262}
263
264static void purgeSmeCmdList(tpAniSirGlobal pMac)
265{
266 //release any out standing commands back to free command list
267 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
268 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530269 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
270 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700271}
272
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530273void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
274 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275{
276 //release any out standing commands back to free command list
277 tListElem *pEntry, *pNext;
278 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 tDblLinkList localList;
280
281 vos_mem_zero(&localList, sizeof(tDblLinkList));
282 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
283 {
284 smsLog(pMac, LOGE, FL(" failed to open list"));
285 return;
286 }
287
288 csrLLLock(pList);
289 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
290 while(pEntry != NULL)
291 {
292 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
293 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
294 if(pCommand->sessionId == sessionId)
295 {
296 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
297 {
298 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
299 }
300 }
301 pEntry = pNext;
302 }
303 csrLLUnlock(pList);
304
305 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
306 {
307 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
308 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
309 }
310 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700311}
312
313
314static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
315{
316 eHalStatus status = eHAL_STATUS_SUCCESS;
317
318 purgeSmeCmdList(pMac);
319 csrLLClose(&pMac->sme.smeCmdPendingList);
320 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530321 csrLLClose(&pMac->sme.smeScanCmdPendingList);
322 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 csrLLClose(&pMac->sme.smeCmdFreeList);
324
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700325 /*destroy active list command time out timer */
326 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
327 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
328 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
329
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800330 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
331 if(status != eHAL_STATUS_SUCCESS)
332 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800333 smsLog(pMac, LOGE,
334 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800335 goto done;
336 }
337
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 if(NULL != pMac->sme.pSmeCmdBufAddr)
339 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530340 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 pMac->sme.pSmeCmdBufAddr = NULL;
342 }
343
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800344 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
345 if(status != eHAL_STATUS_SUCCESS)
346 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800347 smsLog(pMac, LOGE,
348 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800349 }
350done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 return (status);
352}
353
354
355void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
356{
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 switch( pCmd->command )
358 {
359 case eSmeCommandScan:
360 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
361 break;
362
363 case eSmeCommandRoam:
364 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
365 break;
366
367 case eSmeCommandWmStatusChange:
368 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
369 break;
370
371 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800372 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
374 break;
375
376 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800377 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
379 break;
380
381 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700382 smsLog( pMac, LOGE, " default: Unhandled command %d",
383 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 break;
385 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700386}
387
388tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
389{
390 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
391 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530392 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
394
395 // If we can get another MS Msg buffer, then we are ok. Just link
396 // the entry onto the linked list. (We are using the linked list
397 // to keep track of tfhe message buffers).
398 if ( pEntry )
399 {
400 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530401 /* reset when free list is available */
402 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404 else {
405 int idx = 1;
406
407 //Cannot change pRetCmd here since it needs to return later.
408 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
409 if( pEntry )
410 {
411 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
412 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800413 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
415 if(pTempCmd)
416 {
417 if( eSmeCsrCommandMask & pTempCmd->command )
418 {
419 //CSR command is stuck. See what the reason code is for that command
420 dumpCsrCommandInfo(pMac, pTempCmd);
421 }
422 } //if(pTempCmd)
423
424 //dump what is in the pending queue
425 csrLLLock(&pMac->sme.smeCmdPendingList);
426 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530427 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 {
429 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530430 /* Print only 1st five commands from pending queue. */
431 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800432 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530433 idx, pTempCmd->command );
434 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 if( eSmeCsrCommandMask & pTempCmd->command )
436 {
437 //CSR command is stuck. See what the reason code is for that command
438 dumpCsrCommandInfo(pMac, pTempCmd);
439 }
440 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
441 }
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530442 /* Increament static variable so that it prints pending command only once*/
443 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 csrLLUnlock(&pMac->sme.smeCmdPendingList);
445
446 //There may be some more command in CSR's own pending queue
447 csrLLLock(&pMac->roam.roamCmdPendingList);
448 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
449 while(pEntry)
450 {
451 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800452 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 idx++, pTempCmd->command );
454 dumpCsrCommandInfo(pMac, pTempCmd);
455 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
456 }
457 csrLLUnlock(&pMac->roam.roamCmdPendingList);
458 }
459
460 return( pRetCmd );
461}
462
463
464void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
465{
466 if ( fHighPriority )
467 {
468 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
469 }
470 else
471 {
472 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
473 }
474
475 // process the command queue...
476 smeProcessPendingQueue( pMac );
477
478 return;
479}
480
481
482static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
483{
484 eSmeCommandType pmcCommand = eSmeNoCommand;
485 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
486 tPmcState pmcState;
487 eHalStatus status;
488
489 do
490 {
491 pmcState = pmcGetPmcState(pMac);
492
493 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
494 if( !HAL_STATUS_SUCCESS(status) )
495 {
496 //PMC state is not right for the command, drop it
497 return ( eSmeDropCommand );
498 }
499 if( fFullPowerNeeded ) break;
500 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
501 ( eSmeCommandDelTs == pCommand->command ) );
502 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700503#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700504 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700505 eSmeCommandOemDataReq == pCommand->command);
506 if(fFullPowerNeeded) break;
507#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700508 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 eSmeCommandRemainOnChannel == pCommand->command);
510 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 } while(0);
512
513 if( fFullPowerNeeded )
514 {
515 switch( pmcState )
516 {
517 case IMPS:
518 case STANDBY:
519 pmcCommand = eSmeCommandExitImps;
520 break;
521
522 case BMPS:
523 pmcCommand = eSmeCommandExitBmps;
524 break;
525
526 case UAPSD:
527 pmcCommand = eSmeCommandExitUapsd;
528 break;
529
530 case WOWL:
531 pmcCommand = eSmeCommandExitWowl;
532 break;
533
534 default:
535 break;
536 }
537 }
538
539 return ( pmcCommand );
540}
541
542
543//For commands that need to do extra cleanup.
544static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
545{
546 if( eSmePmcCommandMask & pCommand->command )
547 {
548 pmcAbortCommand( pMac, pCommand, fStopping );
549 }
550 else if ( eSmeCsrCommandMask & pCommand->command )
551 {
552 csrAbortCommand( pMac, pCommand, fStopping );
553 }
554 else
555 {
556 switch( pCommand->command )
557 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 case eSmeCommandRemainOnChannel:
559 if (NULL != pCommand->u.remainChlCmd.callback)
560 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700561 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 pCommand->u.remainChlCmd.callback;
563 /* process the msg */
564 if( callback )
565 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700566 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 eCSR_SCAN_ABORT );
568 }
569 }
570 smeReleaseCommand( pMac, pCommand );
571 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 default:
573 smeReleaseCommand( pMac, pCommand );
574 break;
575 }
576 }
577}
578
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530579tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
580 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
581{
582 tListElem *pCurEntry = NULL;
583 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700584
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530585 /* Go through the list and return the command whose session id is not
586 * matching with the current ongoing scan cmd sessionId */
587 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
588 while (pCurEntry)
589 {
590 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
591 if (pCommand->sessionId != sessionId)
592 {
593 smsLog(pMac, LOG1, "selected the command with different sessionId");
594 return pCurEntry;
595 }
596
597 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
598 }
599
600 smsLog(pMac, LOG1, "No command pending with different sessionId");
601 return NULL;
602}
603
604tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
605{
606 tListElem *pEntry;
607 tSmeCmd *pCommand;
608 tListElem *pSmeEntry;
609 tSmeCmd *pSmeCommand;
610 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
611
612 csrLLLock( &pMac->sme.smeScanCmdActiveList );
613 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
614 LL_ACCESS_NOLOCK ))
615 {
616 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
617 LL_ACCESS_LOCK))
618 {
619 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
620 LL_ACCESS_LOCK );
621 if (pEntry)
622 {
623 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
624 //We cannot execute any command in wait-for-key state until setKey is through.
625 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
626 {
627 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
628 {
629 smsLog(pMac, LOGE,
630 " Cannot process command(%d) while waiting for key",
631 pCommand->command);
632 status = eANI_BOOLEAN_FALSE;
633 goto end;
634 }
635 }
636
637 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
638 LL_ACCESS_LOCK )))
639 {
640 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
641 LL_ACCESS_LOCK);
642 if (pEntry)
643 {
644 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
645 Link) ;
646
647 /* if scan is running on one interface and SME recei
648 ves the next command on the same interface then
649 dont the allow the command to be queued to
650 smeCmdPendingList. If next scan is allowed on
651 the same interface the CSR state machine will
652 get screwed up. */
653 if (pSmeCommand->sessionId == pCommand->sessionId)
654 {
655 status = eANI_BOOLEAN_FALSE;
656 goto end;
657 }
658 }
659 }
660 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
661 pEntry, LL_ACCESS_LOCK ) )
662 {
663 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
664 &pCommand->Link, LL_ACCESS_NOLOCK );
665
666 switch (pCommand->command)
667 {
668 case eSmeCommandScan:
669 smsLog(pMac, LOG1,
670 " Processing scan offload command ");
671 csrProcessScanCommand( pMac, pCommand );
672 break;
673 default:
674 smsLog(pMac, LOGE,
675 " Something wrong, wrong command enqueued"
676 " to smeScanCmdPendingList");
677 pEntry = csrLLRemoveHead(
678 &pMac->sme.smeScanCmdActiveList,
679 LL_ACCESS_NOLOCK );
680 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
681 smeReleaseCommand( pMac, pCommand );
682 break;
683 }
684 }
685 }
686 }
687 }
688end:
689 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
690 return status;
691}
Jeff Johnson295189b2012-06-20 16:38:30 -0700692
693tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
694{
695 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
696 eHalStatus status = eHAL_STATUS_SUCCESS;
697 tListElem *pEntry;
698 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530699 tListElem *pSmeEntry;
700 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 eSmeCommandType pmcCommand = eSmeNoCommand;
702
703 // if the ActiveList is empty, then nothing is active so we can process a
704 // pending command...
705 //alwasy lock active list before locking pending list
706 csrLLLock( &pMac->sme.smeCmdActiveList );
707 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
708 {
709 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
710 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530711 /* If scan command is pending in the smeScanCmdActive list
712 * then pick the command from smeCmdPendingList which is
713 * not matching with the scan command session id.
714 * At any point of time only one command will be allowed
715 * on a single session. */
716 if ((pMac->fScanOffload) &&
717 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
718 LL_ACCESS_LOCK)))
719 {
720 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
721 LL_ACCESS_LOCK);
722 if (pSmeEntry)
723 {
724 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
725
726 pEntry = csrGetCmdToProcess(pMac,
727 &pMac->sme.smeCmdPendingList,
728 pSmeCommand->sessionId,
729 LL_ACCESS_LOCK);
730 goto sme_process_cmd;
731 }
732 }
733
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 //Peek the command
735 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530736sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 if( pEntry )
738 {
739 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530740
Abhishek Singhf4669da2014-05-26 15:07:49 +0530741 /* Allow only disconnect command
742 * in wait-for-key state until setKey is through.
743 */
744 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
745 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 {
747 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
748 {
749 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530750 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
751 "command(%d) while waiting for key"),
752 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530753 fContinue = eANI_BOOLEAN_FALSE;
754 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 }
756 }
757 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
758 if( eSmeDropCommand == pmcCommand )
759 {
760 //This command is not ok for current PMC state
761 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
762 {
763 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
764 }
765 csrLLUnlock( &pMac->sme.smeCmdActiveList );
766 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530767 fContinue = eANI_BOOLEAN_TRUE;
768 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 }
770 else if( eSmeNoCommand != pmcCommand )
771 {
772 tExitBmpsInfo exitBmpsInfo;
773 void *pv = NULL;
774 tANI_U32 size = 0;
775 tSmeCmd *pPmcCmd = NULL;
776
777 if( eSmeCommandExitBmps == pmcCommand )
778 {
779 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
780 pv = (void *)&exitBmpsInfo;
781 size = sizeof(tExitBmpsInfo);
782 }
783 //pmcCommand has to be one of the exit power save command
784 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
785 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
786 {
787 //Force this command to wake up the chip
788 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
789 csrLLUnlock( &pMac->sme.smeCmdActiveList );
790 fContinue = pmcProcessCommand( pMac, pPmcCmd );
791 if( fContinue )
792 {
793 //The command failed, remove it
794 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
795 {
796 pmcReleaseCommand( pMac, pPmcCmd );
797 }
798 }
799 }
800 else
801 {
802 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800803 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 -0700804 //Let it retry
805 fContinue = eANI_BOOLEAN_TRUE;
806 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530807 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 }
809 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
810 {
811 // we can reuse the pCommand
812
813 // Insert the command onto the ActiveList...
814 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
815
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530816 if( pMac->deferImps )
817 {
818 /* IMPS timer is already running so stop it and
819 * it will get restarted when no command is pending
820 */
821 csrScanStopIdleScanTimer( pMac );
822 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
823 pMac->deferImps = eANI_BOOLEAN_FALSE;
824 }
825
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 // .... and process the command.
827
Katya Nigambcb705f2013-12-26 14:26:22 +0530828 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700829 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 switch ( pCommand->command )
831 {
832
833 case eSmeCommandScan:
834 csrLLUnlock( &pMac->sme.smeCmdActiveList );
835 status = csrProcessScanCommand( pMac, pCommand );
836 break;
837
838 case eSmeCommandRoam:
839 csrLLUnlock( &pMac->sme.smeCmdActiveList );
840 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800841 if(!HAL_STATUS_SUCCESS(status))
842 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700843 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800844 &pCommand->Link, LL_ACCESS_LOCK ) )
845 {
846 csrReleaseCommandRoam( pMac, pCommand );
847 }
848 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 break;
850
851 case eSmeCommandWmStatusChange:
852 csrLLUnlock( &pMac->sme.smeCmdActiveList );
853 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
854 break;
855
856 case eSmeCommandSetKey:
857 csrLLUnlock( &pMac->sme.smeCmdActiveList );
858 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
859 if(!HAL_STATUS_SUCCESS(status))
860 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700861 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 &pCommand->Link, LL_ACCESS_LOCK ) )
863 {
864 csrReleaseCommandSetKey( pMac, pCommand );
865 }
866 }
867 break;
868
869 case eSmeCommandRemoveKey:
870 csrLLUnlock( &pMac->sme.smeCmdActiveList );
871 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
872 if(!HAL_STATUS_SUCCESS(status))
873 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700874 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 &pCommand->Link, LL_ACCESS_LOCK ) )
876 {
877 csrReleaseCommandRemoveKey( pMac, pCommand );
878 }
879 }
880 break;
881
882 case eSmeCommandAddStaSession:
883 csrLLUnlock( &pMac->sme.smeCmdActiveList );
884 csrProcessAddStaSessionCommand( pMac, pCommand );
885 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700886 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 csrLLUnlock( &pMac->sme.smeCmdActiveList );
888 csrProcessDelStaSessionCommand( pMac, pCommand );
889 break;
890
Jeff Johnsone7245742012-09-05 17:12:55 -0700891#ifdef FEATURE_OEM_DATA_SUPPORT
892 case eSmeCommandOemDataReq:
893 csrLLUnlock(&pMac->sme.smeCmdActiveList);
894 oemData_ProcessOemDataReqCommand(pMac, pCommand);
895 break;
896#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 case eSmeCommandRemainOnChannel:
898 csrLLUnlock(&pMac->sme.smeCmdActiveList);
899 p2pProcessRemainOnChannelCmd(pMac, pCommand);
900 break;
901 case eSmeCommandNoAUpdate:
902 csrLLUnlock( &pMac->sme.smeCmdActiveList );
903 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 case eSmeCommandEnterImps:
905 case eSmeCommandExitImps:
906 case eSmeCommandEnterBmps:
907 case eSmeCommandExitBmps:
908 case eSmeCommandEnterUapsd:
909 case eSmeCommandExitUapsd:
910 case eSmeCommandEnterWowl:
911 case eSmeCommandExitWowl:
912 csrLLUnlock( &pMac->sme.smeCmdActiveList );
913 fContinue = pmcProcessCommand( pMac, pCommand );
914 if( fContinue )
915 {
916 //The command failed, remove it
917 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
918 &pCommand->Link, LL_ACCESS_LOCK ) )
919 {
920 pmcReleaseCommand( pMac, pCommand );
921 }
922 }
923 break;
924
925 //Treat standby differently here because caller may not be able to handle
926 //the failure so we do our best here
927 case eSmeCommandEnterStandby:
928 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
929 {
930 //It can continue
931 csrLLUnlock( &pMac->sme.smeCmdActiveList );
932 fContinue = pmcProcessCommand( pMac, pCommand );
933 if( fContinue )
934 {
935 //The command failed, remove it
936 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
937 &pCommand->Link, LL_ACCESS_LOCK ) )
938 {
939 pmcReleaseCommand( pMac, pCommand );
940 }
941 }
942 }
943 else
944 {
945 //Need to issue a disconnect first before processing this command
946 tSmeCmd *pNewCmd;
947
948 //We need to re-run the command
949 fContinue = eANI_BOOLEAN_TRUE;
950 //Pull off the standby command first
951 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
952 &pCommand->Link, LL_ACCESS_NOLOCK ) )
953 {
954 csrLLUnlock( &pMac->sme.smeCmdActiveList );
955 //Need to call CSR function here because the disconnect command
956 //is handled by CSR
957 pNewCmd = csrGetCommandBuffer( pMac );
958 if( NULL != pNewCmd )
959 {
960 //Put the standby command to the head of the pending list first
961 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
962 LL_ACCESS_LOCK );
963 pNewCmd->command = eSmeCommandRoam;
964 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
965 //Put the disassoc command before the standby command
966 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
967 LL_ACCESS_LOCK );
968 }
969 else
970 {
971 //Continue the command here
972 fContinue = pmcProcessCommand( pMac, pCommand );
973 if( fContinue )
974 {
975 //The command failed, remove it
976 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
977 &pCommand->Link, LL_ACCESS_LOCK ) )
978 {
979 pmcReleaseCommand( pMac, pCommand );
980 }
981 }
982 }
983 }
984 else
985 {
986 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800987 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 VOS_ASSERT(0);
989 }
990 }
991 break;
992
993 case eSmeCommandAddTs:
994 case eSmeCommandDelTs:
995 csrLLUnlock( &pMac->sme.smeCmdActiveList );
996#ifndef WLAN_MDM_CODE_REDUCTION_OPT
997 fContinue = qosProcessCommand( pMac, pCommand );
998 if( fContinue )
999 {
1000 //The command failed, remove it
1001 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1002 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1003 {
1004//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1005 qosReleaseCommand( pMac, pCommand );
1006//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1007 }
1008 }
1009#endif
1010 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001011#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001012 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001013 case eSmeCommandTdlsAddPeer:
1014 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301015 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001016#ifdef FEATURE_WLAN_TDLS_INTERNAL
1017 case eSmeCommandTdlsDiscovery:
1018 case eSmeCommandTdlsLinkSetup:
1019 case eSmeCommandTdlsLinkTear:
1020 case eSmeCommandTdlsEnterUapsd:
1021 case eSmeCommandTdlsExitUapsd:
1022#endif
1023 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001024 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001025 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001026
1027 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1028 status = csrTdlsProcessCmd( pMac, pCommand );
1029 }
1030 break ;
1031#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001032
1033 default:
1034 //something is wrong
1035 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001036 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1038 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1039 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1040 smeReleaseCommand( pMac, pCommand );
1041 status = eHAL_STATUS_FAILURE;
1042 break;
1043 }
1044 if(!HAL_STATUS_SUCCESS(status))
1045 {
1046 fContinue = eANI_BOOLEAN_TRUE;
1047 }
1048 }//if(pEntry)
1049 else
1050 {
1051 //This is odd. Some one else pull off the command.
1052 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1053 }
1054 }
1055 else
1056 {
1057 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1058 }
1059 }
1060 else
1061 {
1062 //No command waiting
1063 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1064 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1065 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1066 {
1067 tANI_U32 nTime = 0;
1068
1069 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1070 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1071 {
1072 csrScanStartIdleScanTimer(pMac, nTime);
1073 }
1074 }
1075 }
1076 }
1077 else {
1078 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1079 }
1080
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301081sme_process_scan_queue:
1082 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1083 fContinue = eANI_BOOLEAN_FALSE;
1084
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 return ( fContinue );
1086}
1087
1088void smeProcessPendingQueue( tpAniSirGlobal pMac )
1089{
1090 while( smeProcessCommand( pMac ) );
1091}
1092
1093
1094tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1095{
1096 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1097 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1098}
1099
1100
1101
1102//Global APIs
1103
1104/*--------------------------------------------------------------------------
1105
1106 \brief sme_Open() - Initialze all SME modules and put them at idle state
1107
1108 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1109 successfully return, all modules are at idle state ready to start.
1110
1111 smeOpen must be called before any other SME APIs can be involved.
1112 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001113 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 \param hHal - The handle returned by macOpen.
1115
1116 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1117
1118 Other status means SME is failed to be initialized
1119 \sa
1120
1121 --------------------------------------------------------------------------*/
1122eHalStatus sme_Open(tHalHandle hHal)
1123{
1124 eHalStatus status = eHAL_STATUS_FAILURE;
1125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1126
1127 do {
1128 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001129 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1131 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001132 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 status = eHAL_STATUS_FAILURE;
1134 break;
1135 }
1136
1137 status = ccmOpen(hHal);
1138 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1139 smsLog( pMac, LOGE,
1140 "ccmOpen failed during initialization with status=%d", status );
1141 break;
1142 }
1143
1144 status = csrOpen(pMac);
1145 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1146 smsLog( pMac, LOGE,
1147 "csrOpen failed during initialization with status=%d", status );
1148 break;
1149 }
1150
1151 status = pmcOpen(hHal);
1152 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1153 smsLog( pMac, LOGE,
1154 "pmcOpen failed during initialization with status=%d", status );
1155 break;
1156 }
1157
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001158#ifdef FEATURE_WLAN_TDLS
1159 pMac->isTdlsPowerSaveProhibited = 0;
1160#endif
1161
Jeff Johnson295189b2012-06-20 16:38:30 -07001162#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1163 status = sme_QosOpen(pMac);
1164 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1165 smsLog( pMac, LOGE,
1166 "Qos open failed during initialization with status=%d", status );
1167 break;
1168 }
1169
1170 status = btcOpen(pMac);
1171 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1172 smsLog( pMac, LOGE,
1173 "btcOpen open failed during initialization with status=%d", status );
1174 break;
1175 }
1176#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001177#ifdef FEATURE_OEM_DATA_SUPPORT
1178 status = oemData_OemDataReqOpen(pMac);
1179 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1180 smsLog(pMac, LOGE,
1181 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1182 break;
1183 }
1184#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001185
1186 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1187 break;
1188
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 {
1190 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1191 if ( NULL == pvosGCtx ){
1192 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1193 status = eHAL_STATUS_FAILURE;
1194 break;
1195 }
1196
1197 status = WLANSAP_Open( pvosGCtx );
1198 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1199 smsLog( pMac, LOGE,
1200 "WLANSAP_Open open failed during initialization with status=%d", status );
1201 break;
1202 }
1203 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001204#if defined WLAN_FEATURE_VOWIFI
1205 status = rrmOpen(pMac);
1206 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1207 smsLog( pMac, LOGE,
1208 "rrmOpen open failed during initialization with status=%d", status );
1209 break;
1210 }
1211#endif
1212
1213#if defined WLAN_FEATURE_VOWIFI_11R
1214 sme_FTOpen(pMac);
1215#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001216 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001217 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001218
1219 }while (0);
1220
1221 return status;
1222}
1223
Jeff Johnson295189b2012-06-20 16:38:30 -07001224/*--------------------------------------------------------------------------
1225
1226 \brief sme_set11dinfo() - Set the 11d information about valid channels
1227 and there power using information from nvRAM
1228 This function is called only for AP.
1229
Srinivas Girigowdade697412013-02-14 16:31:48 -08001230 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001231
1232 \param hHal - The handle returned by macOpen.
1233 \Param pSmeConfigParams - a pointer to a caller allocated object of
1234 typedef struct _smeConfigParams.
1235
1236 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1237
1238 Other status means SME is failed to update the config parameters.
1239 \sa
1240--------------------------------------------------------------------------*/
1241
1242eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1243{
1244 eHalStatus status = eHAL_STATUS_FAILURE;
1245 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1246
Katya Nigambcb705f2013-12-26 14:26:22 +05301247 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001248 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001249 if (NULL == pSmeConfigParams ) {
1250 smsLog( pMac, LOGE,
1251 "Empty config param structure for SME, nothing to update");
1252 return status;
1253 }
1254
1255 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1256 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001257 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001258 status );
1259 }
1260 return status;
1261}
1262
1263/*--------------------------------------------------------------------------
1264
1265 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1266
Srinivas Girigowdade697412013-02-14 16:31:48 -08001267 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001268
1269 \param hHal - The handle returned by HostapdAdapter.
1270 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1271
1272 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1273
1274 Other status means, failed to get the current regulatory domain.
1275 \sa
1276--------------------------------------------------------------------------*/
1277
1278eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1279{
1280 eHalStatus status = eHAL_STATUS_FAILURE;
1281 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1282
Katya Nigambcb705f2013-12-26 14:26:22 +05301283 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001284 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 if (NULL == domainIdSoftAp ) {
1286 smsLog( pMac, LOGE, "Uninitialized domain Id");
1287 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001288 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001289
1290 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1291 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001292
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 return status;
1294}
1295
1296
1297eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1298{
1299 eHalStatus status = eHAL_STATUS_FAILURE;
1300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1301
Katya Nigambcb705f2013-12-26 14:26:22 +05301302 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001303 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 if (NULL == apCntryCode ) {
1305 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1306 return status;
1307 }
1308
1309 status = csrSetRegInfo(hHal, apCntryCode );
1310 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001311 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001312 status );
1313 }
1314 return status;
1315}
1316
Jeff Johnson295189b2012-06-20 16:38:30 -07001317#ifdef FEATURE_WLAN_SCAN_PNO
1318/*--------------------------------------------------------------------------
1319
1320 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001321
1322 It is used at driver start up to inform RIVA of the default channel
1323 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001324
Srinivas Girigowdade697412013-02-14 16:31:48 -08001325 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001326
1327 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001328
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1330
1331 Other status means SME is failed to update the channel config.
1332 \sa
1333
1334 --------------------------------------------------------------------------*/
1335eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1336{
1337 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1338
Katya Nigambcb705f2013-12-26 14:26:22 +05301339 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001340 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1341 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 &pMac->scan.base20MHzChannels, FALSE);
1343 return eHAL_STATUS_SUCCESS;
1344}
1345#endif // FEATURE_WLAN_SCAN_PNLO
1346
1347/*--------------------------------------------------------------------------
1348
1349 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1350
1351 The function updates some configuration for modules in SME, CCM, CSR, etc
1352 during SMEs close open sequence.
1353
1354 Modules inside SME apply the new configuration at the next transaction.
1355
Srinivas Girigowdade697412013-02-14 16:31:48 -08001356 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001357
1358 \param hHal - The handle returned by macOpen.
1359 \Param pSmeConfigParams - a pointer to a caller allocated object of
1360 typedef struct _smeConfigParams.
1361
1362 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1363
1364 Other status means SME is failed to update the config parameters.
1365 \sa
1366
1367 --------------------------------------------------------------------------*/
1368eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1369{
1370 eHalStatus status = eHAL_STATUS_FAILURE;
1371 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1372
Katya Nigambcb705f2013-12-26 14:26:22 +05301373 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001374 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 if (NULL == pSmeConfigParams ) {
1376 smsLog( pMac, LOGE,
1377 "Empty config param structure for SME, nothing to update");
1378 return status;
1379 }
1380
1381 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1382
1383 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001384 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 status );
1386 }
1387#if defined WLAN_FEATURE_P2P_INTERNAL
1388 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1389
1390 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001391 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 status );
1393 }
1394#endif
1395#if defined WLAN_FEATURE_VOWIFI
1396 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1397
1398 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001399 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 status );
1401 }
1402#endif
1403 //For SOC, CFG is set before start
1404 //We don't want to apply global CFG in connect state because that may cause some side affect
1405 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 csrIsAllSessionDisconnected( pMac) )
1407 {
1408 csrSetGlobalCfgs(pMac);
1409 }
1410
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301411 /* update the directed scan offload setting */
1412 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1413
Sandeep Puligilla60342762014-01-30 21:05:37 +05301414 /* Enable channel bonding mode in 2.4GHz */
1415 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1416 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1417 {
1418 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1419 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1420 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1421 "Setting channelBondingMode24GHz:%d " ,
1422 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1423 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301424 if (pMac->fScanOffload)
1425 {
1426 /* If scan offload is enabled then lim has allow the sending of
1427 scan request to firmware even in powersave mode. The firmware has
1428 to take care of exiting from power save mode */
1429 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1430 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1431
1432 if (eHAL_STATUS_SUCCESS != status)
1433 {
1434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1435 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1436 }
1437 }
krunal sonie9002db2013-11-25 14:24:17 -08001438 pMac->isCoalesingInIBSSAllowed =
1439 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001440 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301441 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
1442
Jeff Johnson295189b2012-06-20 16:38:30 -07001443 return status;
1444}
1445
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301446#ifdef WLAN_FEATURE_GTK_OFFLOAD
1447void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1448 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1449{
1450 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1451
1452 if (NULL == pMac)
1453 {
1454 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1455 "%s: pMac is null", __func__);
1456 return ;
1457 }
1458 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1459 {
1460 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1461 "%s: HDD callback is null", __func__);
1462 return ;
1463 }
1464 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1465 pGtkOffloadGetInfoRsp);
1466}
1467#endif
1468
Jeff Johnson295189b2012-06-20 16:38:30 -07001469/* ---------------------------------------------------------------------------
1470 \fn sme_ChangeConfigParams
1471 \brief The SME API exposed for HDD to provide config params to SME during
1472 SMEs stop -> start sequence.
1473
1474 If HDD changed the domain that will cause a reset. This function will
1475 provide the new set of 11d information for the new domain. Currrently this
1476 API provides info regarding 11d only at reset but we can extend this for
1477 other params (PMC, QoS) which needs to be initialized again at reset.
1478
Srinivas Girigowdade697412013-02-14 16:31:48 -08001479 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001480
1481 \param hHal - The handle returned by macOpen.
1482
1483 \Param
1484 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1485 currently provides 11d related information like Country code,
1486 Regulatory domain, valid channel list, Tx power per channel, a
1487 list with active/passive scan allowed per valid channel.
1488
1489 \return eHalStatus
1490 ---------------------------------------------------------------------------*/
1491eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1492 tCsrUpdateConfigParam *pUpdateConfigParam)
1493{
1494 eHalStatus status = eHAL_STATUS_FAILURE;
1495 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1496
1497 if (NULL == pUpdateConfigParam ) {
1498 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001499 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001500 return status;
1501 }
1502
1503 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1504
1505 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001506 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 status );
1508 }
1509
1510 return status;
1511
1512}
1513
1514/*--------------------------------------------------------------------------
1515
1516 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1517 that the NIC is ready tio run.
1518
1519 The function is called by HDD at the end of initialization stage so PE/HAL can
1520 enable the NIC to running state.
1521
Srinivas Girigowdade697412013-02-14 16:31:48 -08001522 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 \param hHal - The handle returned by macOpen.
1524
1525 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1526 successfully.
1527
1528 Other status means SME failed to send the message to PE.
1529 \sa
1530
1531 --------------------------------------------------------------------------*/
1532eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1533{
1534 tSirSmeReadyReq Msg;
1535 eHalStatus status = eHAL_STATUS_FAILURE;
1536 tPmcPowerState powerState;
1537 tPmcSwitchState hwWlanSwitchState;
1538 tPmcSwitchState swWlanSwitchState;
1539 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1540
Katya Nigambcb705f2013-12-26 14:26:22 +05301541 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001542 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 do
1544 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001545
1546 Msg.messageType = eWNI_SME_SYS_READY_IND;
1547 Msg.length = sizeof( tSirSmeReadyReq );
1548
1549 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1550 {
1551 status = eHAL_STATUS_SUCCESS;
1552 }
1553 else
1554 {
1555 smsLog( pMac, LOGE,
1556 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1557 break;
1558 }
1559
1560 status = pmcQueryPowerState( hHal, &powerState,
1561 &hwWlanSwitchState, &swWlanSwitchState );
1562 if ( ! HAL_STATUS_SUCCESS( status ) )
1563 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001564 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 status );
1566 break;
1567 }
1568
1569 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1570 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1571 {
1572 status = csrReady(pMac);
1573 if ( ! HAL_STATUS_SUCCESS( status ) )
1574 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001575 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001576 break;
1577 }
1578 status = pmcReady(hHal);
1579 if ( ! HAL_STATUS_SUCCESS( status ) )
1580 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001581 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 break;
1583 }
1584#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1585 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1586 {
1587 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001588 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 break;
1590 }
1591#endif
1592
1593#if defined WLAN_FEATURE_VOWIFI
1594 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1595 {
1596 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001597 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 break;
1599 }
1600#endif
1601 }
1602 pMac->sme.state = SME_STATE_READY;
1603 } while( 0 );
1604
1605 return status;
1606}
1607
1608/*--------------------------------------------------------------------------
1609
1610 \brief sme_Start() - Put all SME modules at ready state.
1611
1612 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1613 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001614 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 \param hHal - The handle returned by macOpen.
1616
1617 \return eHAL_STATUS_SUCCESS - SME is ready.
1618
1619 Other status means SME is failed to start
1620 \sa
1621
1622 --------------------------------------------------------------------------*/
1623eHalStatus sme_Start(tHalHandle hHal)
1624{
1625 eHalStatus status = eHAL_STATUS_FAILURE;
1626 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1627
1628 do
1629 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 status = csrStart(pMac);
1631 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001632 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 status );
1634 break;
1635 }
1636
1637 status = pmcStart(hHal);
1638 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001639 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 status );
1641 break;
1642 }
1643
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1645 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001646 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 status );
1648 break;
1649 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 pMac->sme.state = SME_STATE_START;
1651 }while (0);
1652
1653 return status;
1654}
1655
1656
1657#ifdef WLAN_FEATURE_PACKET_FILTERING
1658/******************************************************************************
1659*
1660* Name: sme_PCFilterMatchCountResponseHandler
1661*
1662* Description:
1663* Invoke Packet Coalescing Filter Match Count callback routine
1664*
1665* Parameters:
1666* hHal - HAL handle for device
1667* pMsg - Pointer to tRcvFltPktMatchRsp structure
1668*
1669* Returns: eHalStatus
1670*
1671******************************************************************************/
1672eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1673{
1674 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1675 eHalStatus status = eHAL_STATUS_SUCCESS;
1676 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1677
1678 if (NULL == pMsg)
1679 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001680 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 status = eHAL_STATUS_FAILURE;
1682 }
1683 else
1684 {
1685 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001686 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001687
1688 /* Call Packet Coalescing Filter Match Count callback routine. */
1689 if (pMac->pmc.FilterMatchCountCB != NULL)
1690 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1691 pRcvFltPktMatchRsp);
1692
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001693 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 pRcvFltPktMatchRsp->status);
1695
1696 pMac->pmc.FilterMatchCountCB = NULL;
1697 pMac->pmc.FilterMatchCountCBContext = NULL;
1698 }
1699
1700 return(status);
1701}
1702#endif // WLAN_FEATURE_PACKET_FILTERING
1703
1704
Chet Lanctot186b5732013-03-18 10:26:30 -07001705#ifdef WLAN_FEATURE_11W
1706/*------------------------------------------------------------------
1707 *
1708 * Handle the unprotected management frame indication from LIM and
1709 * forward it to HDD.
1710 *
1711 *------------------------------------------------------------------*/
1712
1713eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1714 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1715{
1716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1717 eHalStatus status = eHAL_STATUS_SUCCESS;
1718 tCsrRoamInfo pRoamInfo = {0};
1719 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1720
1721 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1722 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1723 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1724
1725 /* forward the mgmt frame to HDD */
1726 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1727
1728 return status;
1729}
1730#endif
1731
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001732#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001733/*------------------------------------------------------------------
1734 *
1735 * Handle the tsm ie indication from LIM and forward it to HDD.
1736 *
1737 *------------------------------------------------------------------*/
1738
1739eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1740{
1741 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1742 eHalStatus status = eHAL_STATUS_SUCCESS;
1743 tCsrRoamInfo pRoamInfo = {0};
1744 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1745
1746 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1747 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1748 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1749
1750 /* forward the tsm ie information to HDD */
1751 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1752
1753 return status;
1754}
1755
1756/* ---------------------------------------------------------------------------
1757 \fn sme_SetCCKMIe
1758 \brief function to store the CCKM IE passed from supplicant and use it while packing
1759 reassociation request
1760 \param hHal - HAL handle for device
1761 \param pCckmIe - pointer to CCKM IE data
1762 \param pCckmIeLen - length of the CCKM IE
1763 \- return Success or failure
1764 -------------------------------------------------------------------------*/
1765eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1766 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1767{
1768 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1769 eHalStatus status = eHAL_STATUS_SUCCESS;
1770
1771 status = sme_AcquireGlobalLock( &pMac->sme );
1772 if ( HAL_STATUS_SUCCESS( status ) )
1773 {
1774 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1775 sme_ReleaseGlobalLock( &pMac->sme );
1776 }
1777 return status;
1778}
1779
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001780/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001781 \fn sme_SetEseBeaconRequest
1782 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001783 \param hHal - HAL handle for device
1784 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001785 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001786 \- return Success or failure
1787 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001788eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1789 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001790{
1791 eHalStatus status = eSIR_SUCCESS;
1792 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1793 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001794 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001795 tANI_U8 counter = 0;
1796 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1797 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1798
1799 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001800 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001801
1802 //Prepare the request to send to SME.
1803 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1804 if(NULL == pSmeBcnReportReq)
1805 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001806 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001807 return eSIR_FAILURE;
1808 }
1809
1810 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1811 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1812
1813 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1814 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1815 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1816 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001817 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1818 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001819
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001820 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001821 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001822 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001823 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1824 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1825 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1826 }
1827
1828 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1829 return status;
1830}
1831
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001832#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001833
Chet Lanctot186b5732013-03-18 10:26:30 -07001834
c_hpothu92367912014-05-01 15:18:17 +05301835/* ---------------------------------------------------------------------------
1836 \fn sme_getBcnMissRate
1837 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1838 \param hHal - HAL handle for device.
1839 \param sessionId - session ID.
1840 \- return Success or Failure.
1841 -------------------------------------------------------------------------*/
1842
1843eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1844{
1845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1846 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1847 vos_msg_t vosMessage;
1848 tSirBcnMissRateReq *pMsg;
1849 tCsrRoamSession *pSession;
1850
1851 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1852 {
1853 pSession = CSR_GET_SESSION( pMac, sessionId );
1854
1855 if (!pSession)
1856 {
1857 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1858 sme_ReleaseGlobalLock( &pMac->sme );
1859 return eHAL_STATUS_FAILURE;
1860 }
1861
1862 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
1863 if (NULL == pMsg)
1864 {
1865 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1866 sme_ReleaseGlobalLock( &pMac->sme );
1867 return eHAL_STATUS_FAILURE;
1868 }
1869
1870 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1871 sizeof(tSirMacAddr));
1872
1873 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1874 pMsg->callback = callback;
1875 pMsg->data = data;
1876
1877 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1878 vosMessage.bodyptr = pMsg;
1879 vosMessage.reserved = 0;
1880 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1881 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1882 {
1883 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1884 "%s: Post Set TM Level MSG fail", __func__);
1885 vos_mem_free(pMsg);
1886 sme_ReleaseGlobalLock( &pMac->sme );
1887 return eHAL_STATUS_FAILURE;
1888 }
1889 sme_ReleaseGlobalLock( &pMac->sme);
1890 return eHAL_STATUS_SUCCESS;
1891 }
1892 return eHAL_STATUS_FAILURE;
1893}
1894
Jeff Johnson295189b2012-06-20 16:38:30 -07001895/*--------------------------------------------------------------------------
1896
1897 \brief sme_ProcessMsg() - The main message processor for SME.
1898
1899 The function is called by a message dispatcher when to process a message
1900 targeted for SME.
1901
Srinivas Girigowdade697412013-02-14 16:31:48 -08001902 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 \param hHal - The handle returned by macOpen.
1904 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1905
1906 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1907
1908 Other status means SME failed to process the message to HAL.
1909 \sa
1910
1911 --------------------------------------------------------------------------*/
1912eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1913{
1914 eHalStatus status = eHAL_STATUS_FAILURE;
1915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1916
1917 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001918 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 return status;
1920 }
1921
1922 status = sme_AcquireGlobalLock( &pMac->sme );
1923 if ( HAL_STATUS_SUCCESS( status ) )
1924 {
1925 if( SME_IS_START(pMac) )
1926 {
1927 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1928 case eWNI_PMC_ENTER_BMPS_RSP:
1929 case eWNI_PMC_EXIT_BMPS_RSP:
1930 case eWNI_PMC_EXIT_BMPS_IND:
1931 case eWNI_PMC_ENTER_IMPS_RSP:
1932 case eWNI_PMC_EXIT_IMPS_RSP:
1933 case eWNI_PMC_SMPS_STATE_IND:
1934 case eWNI_PMC_ENTER_UAPSD_RSP:
1935 case eWNI_PMC_EXIT_UAPSD_RSP:
1936 case eWNI_PMC_ENTER_WOWL_RSP:
1937 case eWNI_PMC_EXIT_WOWL_RSP:
1938 //PMC
1939 if (pMsg->bodyptr)
1940 {
1941 pmcMessageProcessor(hHal, pMsg->bodyptr);
1942 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301943 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001945 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 }
1947 break;
1948
1949 case WNI_CFG_SET_CNF:
1950 case WNI_CFG_DNLD_CNF:
1951 case WNI_CFG_GET_RSP:
1952 case WNI_CFG_ADD_GRP_ADDR_CNF:
1953 case WNI_CFG_DEL_GRP_ADDR_CNF:
1954 //CCM
1955 if (pMsg->bodyptr)
1956 {
1957 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1958 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301959 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001960 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001961 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 }
1963 break;
1964
1965 case eWNI_SME_ADDTS_RSP:
1966 case eWNI_SME_DELTS_RSP:
1967 case eWNI_SME_DELTS_IND:
1968#ifdef WLAN_FEATURE_VOWIFI_11R
1969 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001970#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001971 //QoS
1972 if (pMsg->bodyptr)
1973 {
1974#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1975 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301976 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001977#endif
1978 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001979 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 }
1981 break;
1982#if defined WLAN_FEATURE_VOWIFI
1983 case eWNI_SME_NEIGHBOR_REPORT_IND:
1984 case eWNI_SME_BEACON_REPORT_REQ_IND:
1985#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001986 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001987#endif
1988 if ( pMsg->bodyptr )
1989 {
1990 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301991 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 }
1993 else
1994 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001995 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 }
1997 break;
1998#endif
1999
Jeff Johnsone7245742012-09-05 17:12:55 -07002000#ifdef FEATURE_OEM_DATA_SUPPORT
2001 //Handle the eWNI_SME_OEM_DATA_RSP:
2002 case eWNI_SME_OEM_DATA_RSP:
2003 if(pMsg->bodyptr)
2004 {
2005 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2006 vos_mem_free(pMsg->bodyptr);
2007 }
2008 else
2009 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002010 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002011 }
2012 smeProcessPendingQueue( pMac );
2013 break;
2014#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002015
2016 case eWNI_SME_ADD_STA_SELF_RSP:
2017 if(pMsg->bodyptr)
2018 {
2019 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2020 vos_mem_free(pMsg->bodyptr);
2021 }
2022 else
2023 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002024 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 }
2026 break;
2027 case eWNI_SME_DEL_STA_SELF_RSP:
2028 if(pMsg->bodyptr)
2029 {
2030 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2031 vos_mem_free(pMsg->bodyptr);
2032 }
2033 else
2034 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002035 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 }
2037 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002038 case eWNI_SME_REMAIN_ON_CHN_RSP:
2039 if(pMsg->bodyptr)
2040 {
2041 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2042 vos_mem_free(pMsg->bodyptr);
2043 }
2044 else
2045 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002046 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 }
2048 break;
2049 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2050 if(pMsg->bodyptr)
2051 {
2052 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2053 vos_mem_free(pMsg->bodyptr);
2054 }
2055 else
2056 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002057 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 -07002058 }
2059 break;
2060 case eWNI_SME_MGMT_FRM_IND:
2061 if(pMsg->bodyptr)
2062 {
2063 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2064 vos_mem_free(pMsg->bodyptr);
2065 }
2066 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002067 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002068 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 }
2070 break;
2071 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2072 if(pMsg->bodyptr)
2073 {
2074 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2075 vos_mem_free(pMsg->bodyptr);
2076 }
2077 else
2078 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002079 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 }
2081 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 case eWNI_SME_COEX_IND:
2083 if(pMsg->bodyptr)
2084 {
2085 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2086 vos_mem_free(pMsg->bodyptr);
2087 }
2088 else
2089 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002090 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002092 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002093
2094#ifdef FEATURE_WLAN_SCAN_PNO
2095 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2096 if(pMsg->bodyptr)
2097 {
2098 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2099 vos_mem_free(pMsg->bodyptr);
2100 }
2101 else
2102 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002103 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 }
2105 break;
2106#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002107
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 case eWNI_SME_TX_PER_HIT_IND:
2109 if (pMac->sme.pTxPerHitCallback)
2110 {
2111 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2112 }
2113 break;
2114
2115 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002116 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 {
2118 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2119 vos_mem_free(pMsg->bodyptr);
2120 }
2121 else
2122 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002123 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2124 }
2125 break;
2126
2127 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2128 if (pMsg->bodyptr)
2129 {
2130 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2131 vos_mem_free(pMsg->bodyptr);
2132 }
2133 else
2134 {
2135 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002136 }
2137 break;
2138
2139#ifdef WLAN_FEATURE_PACKET_FILTERING
2140 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2141 if(pMsg->bodyptr)
2142 {
2143 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2144 vos_mem_free(pMsg->bodyptr);
2145 }
2146 else
2147 {
2148 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002149 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 }
2151 break;
2152#endif // WLAN_FEATURE_PACKET_FILTERING
2153 case eWNI_SME_PRE_SWITCH_CHL_IND:
2154 {
2155 status = sme_HandlePreChannelSwitchInd(pMac);
2156 break;
2157 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002158
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 case eWNI_SME_POST_SWITCH_CHL_IND:
2160 {
2161 status = sme_HandlePostChannelSwitchInd(pMac);
2162 break;
2163 }
2164
2165#ifdef WLAN_WAKEUP_EVENTS
2166 case eWNI_SME_WAKE_REASON_IND:
2167 if(pMsg->bodyptr)
2168 {
2169 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2170 vos_mem_free(pMsg->bodyptr);
2171 }
2172 else
2173 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002174 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 }
2176 break;
2177#endif // WLAN_WAKEUP_EVENTS
2178
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002179#ifdef FEATURE_WLAN_TDLS
2180 /*
2181 * command rescived from PE, SME tdls msg processor shall be called
2182 * to process commands recieved from PE
2183 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002184 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2185 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002186 case eWNI_SME_TDLS_DEL_STA_RSP:
2187 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002188 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002189 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302190 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002191#ifdef FEATURE_WLAN_TDLS_INTERNAL
2192 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2193 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2194 case eWNI_SME_TDLS_LINK_START_RSP:
2195 case eWNI_SME_TDLS_LINK_START_IND:
2196 case eWNI_SME_TDLS_TEARDOWN_RSP:
2197 case eWNI_SME_TDLS_TEARDOWN_IND:
2198 case eWNI_SME_ADD_TDLS_PEER_IND:
2199 case eWNI_SME_DELETE_TDLS_PEER_IND:
2200#endif
2201 {
2202 if (pMsg->bodyptr)
2203 {
2204 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302205 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002206 }
2207 else
2208 {
2209 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002210 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002211 }
2212 break;
2213 }
2214#endif
2215
Chet Lanctot186b5732013-03-18 10:26:30 -07002216#ifdef WLAN_FEATURE_11W
2217 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2218 if (pMsg->bodyptr)
2219 {
2220 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2221 vos_mem_free(pMsg->bodyptr);
2222 }
2223 else
2224 {
2225 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2226 }
2227 break;
2228#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002229#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002230 case eWNI_SME_TSM_IE_IND:
2231 {
2232 if (pMsg->bodyptr)
2233 {
2234 sme_TsmIeInd(pMac, pMsg->bodyptr);
2235 vos_mem_free(pMsg->bodyptr);
2236 }
2237 else
2238 {
2239 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2240 }
2241 break;
2242 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002243#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002244#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2245 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2246 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2247 break;
2248#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002249
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302250#ifdef WLAN_FEATURE_GTK_OFFLOAD
2251 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2252 if (pMsg->bodyptr)
2253 {
2254 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2255 vos_mem_free(pMsg->bodyptr);
2256 }
2257 else
2258 {
2259 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2260 }
2261 break ;
2262#endif
Leo Chang9056f462013-08-01 19:21:11 -07002263
2264#ifdef FEATURE_WLAN_LPHB
2265 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002266 case eWNI_SME_LPHB_IND:
2267 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002268 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002269 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002270 }
2271 vos_mem_free(pMsg->bodyptr);
2272
2273 break;
2274#endif /* FEATURE_WLAN_LPHB */
2275
Leo Chang0b0e45a2013-12-15 15:18:55 -08002276#ifdef FEATURE_WLAN_CH_AVOID
2277 /* LPHB timeout indication arrived, send IND to client */
2278 case eWNI_SME_CH_AVOID_IND:
2279 if (pMac->sme.pChAvoidNotificationCb)
2280 {
2281 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2282 "%s: CH avoid notification", __func__);
2283 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2284 }
2285 vos_mem_free(pMsg->bodyptr);
2286
2287 break;
2288#endif /* FEATURE_WLAN_CH_AVOID */
2289
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 default:
2291
2292 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2293 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2294 {
2295 //CSR
2296 if (pMsg->bodyptr)
2297 {
2298 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302299 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301 else
2302 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002303 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 }
2305 }
2306 else
2307 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002308 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 pMsg->type);
2310 if (pMsg->bodyptr)
2311 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302312 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 }
2314 }
2315 }//switch
2316 } //SME_IS_START
2317 else
2318 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002319 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 if (pMsg->bodyptr)
2321 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302322 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 }
2324 }
2325 sme_ReleaseGlobalLock( &pMac->sme );
2326 }
2327 else
2328 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002329 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 if (pMsg->bodyptr)
2331 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302332 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 }
2334 }
2335
2336 return status;
2337}
2338
2339
2340//No need to hold the global lock here because this function can only be called
2341//after sme_Stop.
2342v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2343{
2344 if( pMsg )
2345 {
2346 if (pMsg->bodyptr)
2347 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302348 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002349 }
2350 }
2351
2352}
2353
2354
2355/*--------------------------------------------------------------------------
2356
2357 \brief sme_Stop() - Stop all SME modules and put them at idle state
2358
2359 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2360 return, all modules are at idle state ready to start.
2361
Srinivas Girigowdade697412013-02-14 16:31:48 -08002362 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302364 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002365
2366 \return eHAL_STATUS_SUCCESS - SME is stopped.
2367
2368 Other status means SME is failed to stop but caller should still
2369 consider SME is stopped.
2370 \sa
2371
2372 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302373eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002374{
2375 eHalStatus status = eHAL_STATUS_FAILURE;
2376 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2377 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2378
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2380 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002381 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 status );
2383 fail_status = status;
2384 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002385
2386 p2pStop(hHal);
2387
Kiet Lama72a2322013-11-15 11:18:11 +05302388 status = pmcStop(hHal);
2389 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2390 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2391 status );
2392 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 }
2394
Kiet Lama72a2322013-11-15 11:18:11 +05302395 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002397 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002398 status );
2399 fail_status = status;
2400 }
2401
2402 ccmStop(hHal);
2403
2404 purgeSmeCmdList(pMac);
2405
2406 if (!HAL_STATUS_SUCCESS( fail_status )) {
2407 status = fail_status;
2408 }
2409
2410 pMac->sme.state = SME_STATE_STOP;
2411
2412 return status;
2413}
2414
2415/*--------------------------------------------------------------------------
2416
2417 \brief sme_Close() - Release all SME modules and their resources.
2418
2419 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2420 return, all modules are at closed state.
2421
2422 No SME APIs can be involved after smeClose except smeOpen.
2423 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002424 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002425 \param hHal - The handle returned by macOpen
2426
2427 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2428
2429 Other status means SME is failed to be closed but caller still cannot
2430 call any other SME functions except smeOpen.
2431 \sa
2432
2433 --------------------------------------------------------------------------*/
2434eHalStatus sme_Close(tHalHandle hHal)
2435{
2436 eHalStatus status = eHAL_STATUS_FAILURE;
2437 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2438 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2439
2440 status = csrClose(pMac);
2441 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002442 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 status );
2444 fail_status = status;
2445 }
2446
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2448 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002449 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 status );
2451 fail_status = status;
2452 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002453
2454#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2455 status = btcClose(hHal);
2456 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002457 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 status );
2459 fail_status = status;
2460 }
2461
2462 status = sme_QosClose(pMac);
2463 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002464 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002465 status );
2466 fail_status = status;
2467 }
2468#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002469#ifdef FEATURE_OEM_DATA_SUPPORT
2470 status = oemData_OemDataReqClose(hHal);
2471 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002472 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002473 status );
2474 fail_status = status;
2475 }
2476#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002477
2478 status = ccmClose(hHal);
2479 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002480 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 status );
2482 fail_status = status;
2483 }
2484
2485 status = pmcClose(hHal);
2486 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002487 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 status );
2489 fail_status = status;
2490 }
2491#if defined WLAN_FEATURE_VOWIFI
2492 status = rrmClose(hHal);
2493 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002494 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002495 status );
2496 fail_status = status;
2497 }
2498#endif
2499
2500#if defined WLAN_FEATURE_VOWIFI_11R
2501 sme_FTClose(hHal);
2502#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002504
2505 freeSmeCmdList(pMac);
2506
2507 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2508 {
2509 fail_status = eHAL_STATUS_FAILURE;
2510 }
2511
2512 if (!HAL_STATUS_SUCCESS( fail_status )) {
2513 status = fail_status;
2514 }
2515
2516 pMac->sme.state = SME_STATE_STOP;
2517
2518 return status;
2519}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002520#ifdef FEATURE_WLAN_LFR
2521tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2522{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002523#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002524 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2525 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2526 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2527 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2528 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2529 return eANI_BOOLEAN_FALSE;
2530 default:
2531 return eANI_BOOLEAN_TRUE;
2532 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002533#else
2534 /*
2535 * TODO: always return TRUE for now until
2536 * we figure out why we could be stuck in
2537 * one of the roaming states forever.
2538 */
2539 return eANI_BOOLEAN_TRUE;
2540#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002541}
2542#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002543/* ---------------------------------------------------------------------------
2544 \fn sme_ScanRequest
2545 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002546 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002547 \param pScanRequestID - pointer to an object to get back the request ID
2548 \param callback - a callback function that scan calls upon finish, will not
2549 be called if csrScanRequest returns error
2550 \param pContext - a pointer passed in for the callback
2551 \return eHalStatus
2552 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002553eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2554 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 csrScanCompleteCallback callback, void *pContext)
2556{
2557 eHalStatus status = eHAL_STATUS_FAILURE;
2558 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302559 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002560 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 smsLog(pMac, LOG2, FL("enter"));
2562 do
2563 {
2564 if(pMac->scan.fScanEnable)
2565 {
2566 status = sme_AcquireGlobalLock( &pMac->sme );
2567 if ( HAL_STATUS_SUCCESS( status ) )
2568 {
2569 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002570#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002571 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002572 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002573#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002574 status = csrScanRequest( hHal, sessionId, pscanReq,
2575 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302576 if ( !HAL_STATUS_SUCCESS( status ) )
2577 {
2578 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2579 " SId=%d"), sessionId);
2580 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002581#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002582 }
2583 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002584 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302585 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302586 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302587 macTraceGetNeighbourRoamState(
2588 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302589 macTraceGetcsrRoamSubState(
2590 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002591 /*HandOff is in progress. So schedule this scan later*/
2592 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002593 }
2594#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002595 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002596
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 sme_ReleaseGlobalLock( &pMac->sme );
2598 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002599 else
2600 {
2601 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2602 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002604 else
2605 {
2606 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2607 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 } while( 0 );
2609
2610 return (status);
2611
2612
2613}
2614
2615/* ---------------------------------------------------------------------------
2616 \fn sme_ScanGetResult
2617 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002618 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 \param pFilter - If pFilter is NULL, all cached results are returned
2620 \param phResult - an object for the result.
2621 \return eHalStatus
2622 ---------------------------------------------------------------------------*/
2623eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2624 tScanResultHandle *phResult)
2625{
2626 eHalStatus status = eHAL_STATUS_FAILURE;
2627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2628
Katya Nigambcb705f2013-12-26 14:26:22 +05302629 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002630 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 smsLog(pMac, LOG2, FL("enter"));
2632 status = sme_AcquireGlobalLock( &pMac->sme );
2633 if ( HAL_STATUS_SUCCESS( status ) )
2634 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002635 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002636 sme_ReleaseGlobalLock( &pMac->sme );
2637 }
2638 smsLog(pMac, LOG2, FL("exit status %d"), status);
2639
2640 return (status);
2641}
2642
2643
2644/* ---------------------------------------------------------------------------
2645 \fn sme_ScanFlushResult
2646 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002647 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 \return eHalStatus
2649 ---------------------------------------------------------------------------*/
2650eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2651{
2652 eHalStatus status = eHAL_STATUS_FAILURE;
2653 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2654
Katya Nigambcb705f2013-12-26 14:26:22 +05302655 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002656 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 status = sme_AcquireGlobalLock( &pMac->sme );
2658 if ( HAL_STATUS_SUCCESS( status ) )
2659 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002660 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 sme_ReleaseGlobalLock( &pMac->sme );
2662 }
2663
2664 return (status);
2665}
2666
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302667/* ---------------------------------------------------------------------------
2668 \fn sme_FilterScanResults
2669 \brief a wrapper function to request CSR to clear scan results.
2670 This is a synchronous call
2671 \return eHalStatus
2672 ---------------------------------------------------------------------------*/
2673eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2674{
2675 eHalStatus status = eHAL_STATUS_SUCCESS;
2676 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2677
2678 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2679 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2680 status = sme_AcquireGlobalLock( &pMac->sme );
2681 if ( HAL_STATUS_SUCCESS( status ) )
2682 {
2683 csrScanFilterResults(pMac);
2684 sme_ReleaseGlobalLock( &pMac->sme );
2685 }
2686
2687 return (status);
2688}
2689
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002690eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2691{
2692 eHalStatus status = eHAL_STATUS_FAILURE;
2693 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2694
Katya Nigambcb705f2013-12-26 14:26:22 +05302695 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002696 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002697 status = sme_AcquireGlobalLock( &pMac->sme );
2698 if ( HAL_STATUS_SUCCESS( status ) )
2699 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302700 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002701 sme_ReleaseGlobalLock( &pMac->sme );
2702 }
2703
2704 return (status);
2705}
Jeff Johnson295189b2012-06-20 16:38:30 -07002706
2707/* ---------------------------------------------------------------------------
2708 \fn sme_ScanResultGetFirst
2709 \brief a wrapper function to request CSR to returns the first element of
2710 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002711 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 \param hScanResult - returned from csrScanGetResult
2713 \return tCsrScanResultInfo * - NULL if no result
2714 ---------------------------------------------------------------------------*/
2715tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2716 tScanResultHandle hScanResult)
2717{
2718 eHalStatus status = eHAL_STATUS_FAILURE;
2719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2720 tCsrScanResultInfo *pRet = NULL;
2721
Katya Nigambcb705f2013-12-26 14:26:22 +05302722 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002723 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002724 status = sme_AcquireGlobalLock( &pMac->sme );
2725 if ( HAL_STATUS_SUCCESS( status ) )
2726 {
2727 pRet = csrScanResultGetFirst( pMac, hScanResult );
2728 sme_ReleaseGlobalLock( &pMac->sme );
2729 }
2730
2731 return (pRet);
2732}
2733
2734
2735/* ---------------------------------------------------------------------------
2736 \fn sme_ScanResultGetNext
2737 \brief a wrapper function to request CSR to returns the next element of
2738 scan result. It can be called without calling csrScanResultGetFirst
2739 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002740 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002741 \param hScanResult - returned from csrScanGetResult
2742 \return Null if no result or reach the end
2743 ---------------------------------------------------------------------------*/
2744tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2745 tScanResultHandle hScanResult)
2746{
2747 eHalStatus status = eHAL_STATUS_FAILURE;
2748 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2749 tCsrScanResultInfo *pRet = NULL;
2750
Katya Nigambcb705f2013-12-26 14:26:22 +05302751 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002752 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 status = sme_AcquireGlobalLock( &pMac->sme );
2754 if ( HAL_STATUS_SUCCESS( status ) )
2755 {
2756 pRet = csrScanResultGetNext( pMac, hScanResult );
2757 sme_ReleaseGlobalLock( &pMac->sme );
2758 }
2759
2760 return (pRet);
2761}
2762
2763
2764/* ---------------------------------------------------------------------------
2765 \fn sme_ScanSetBGScanparams
2766 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002767 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 \param pScanReq - BG scan request structure
2769 \return eHalStatus
2770 ---------------------------------------------------------------------------*/
2771eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2772{
2773 eHalStatus status = eHAL_STATUS_FAILURE;
2774 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2775
2776 if( NULL != pScanReq )
2777 {
2778 status = sme_AcquireGlobalLock( &pMac->sme );
2779 if ( HAL_STATUS_SUCCESS( status ) )
2780 {
2781 status = csrScanSetBGScanparams( hHal, pScanReq );
2782 sme_ReleaseGlobalLock( &pMac->sme );
2783 }
2784 }
2785
2786 return (status);
2787}
2788
2789
2790/* ---------------------------------------------------------------------------
2791 \fn sme_ScanResultPurge
2792 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2793 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002794 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002795 \param hScanResult - returned from csrScanGetResult. hScanResult is
2796 considered gone by
2797 calling this function and even before this function reutrns.
2798 \return eHalStatus
2799 ---------------------------------------------------------------------------*/
2800eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2801{
2802 eHalStatus status = eHAL_STATUS_FAILURE;
2803 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2804
Katya Nigambcb705f2013-12-26 14:26:22 +05302805 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002806 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 status = sme_AcquireGlobalLock( &pMac->sme );
2808 if ( HAL_STATUS_SUCCESS( status ) )
2809 {
2810 status = csrScanResultPurge( hHal, hScanResult );
2811 sme_ReleaseGlobalLock( &pMac->sme );
2812 }
2813
2814 return (status);
2815}
2816
2817/* ---------------------------------------------------------------------------
2818 \fn sme_ScanGetPMKIDCandidateList
2819 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002820 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 \param pPmkidList - caller allocated buffer point to an array of
2822 tPmkidCandidateInfo
2823 \param pNumItems - pointer to a variable that has the number of
2824 tPmkidCandidateInfo allocated when retruning, this is
2825 either the number needed or number of items put into
2826 pPmkidList
2827 \return eHalStatus - when fail, it usually means the buffer allocated is not
2828 big enough and pNumItems
2829 has the number of tPmkidCandidateInfo.
2830 \Note: pNumItems is a number of tPmkidCandidateInfo,
2831 not sizeof(tPmkidCandidateInfo) * something
2832 ---------------------------------------------------------------------------*/
2833eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002834 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 tANI_U32 *pNumItems )
2836{
2837 eHalStatus status = eHAL_STATUS_FAILURE;
2838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2839
2840 status = sme_AcquireGlobalLock( &pMac->sme );
2841 if ( HAL_STATUS_SUCCESS( status ) )
2842 {
2843 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2844 sme_ReleaseGlobalLock( &pMac->sme );
2845 }
2846
2847 return (status);
2848}
2849
2850/*----------------------------------------------------------------------------
2851 \fn sme_RoamRegisterLinkQualityIndCallback
2852
2853 \brief
2854 a wrapper function to allow HDD to register a callback handler with CSR for
2855 link quality indications.
2856
2857 Only one callback may be registered at any time.
2858 In order to deregister the callback, a NULL cback may be provided.
2859
2860 Registration happens in the task context of the caller.
2861
2862 \param callback - Call back being registered
2863 \param pContext - user data
2864
2865 DEPENDENCIES: After CSR open
2866
2867 \return eHalStatus
2868-----------------------------------------------------------------------------*/
2869eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2870 csrRoamLinkQualityIndCallback callback,
2871 void *pContext)
2872{
2873 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2874}
2875
2876/* ---------------------------------------------------------------------------
2877 \fn sme_RoamRegisterCallback
2878 \brief a wrapper function to allow HDD to register a callback with CSR.
2879 Unlike scan, roam has one callback for all the roam requests
2880 \param callback - a callback function that roam calls upon when state changes
2881 \param pContext - a pointer passed in for the callback
2882 \return eHalStatus
2883 ---------------------------------------------------------------------------*/
2884eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2885 csrRoamCompleteCallback callback,
2886 void *pContext)
2887{
2888 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2889}
2890
2891eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2892{
2893 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2894 return pMac->roam.configParam.phyMode;
2895}
2896
2897/* ---------------------------------------------------------------------------
2898 \fn sme_RoamConnect
2899 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002900 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002901 \param sessionId - the sessionId returned by sme_OpenSession.
2902 \param pProfile - description of the network to which to connect
2903 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2904 from csrScanGetResult
2905 \param pRoamId - to get back the request ID
2906 \return eHalStatus
2907 ---------------------------------------------------------------------------*/
2908eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2909 tANI_U32 *pRoamId)
2910{
2911 eHalStatus status = eHAL_STATUS_FAILURE;
2912 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2913
Yue Mae36e3552014-03-05 17:06:20 -08002914 if (!pMac)
2915 {
2916 return eHAL_STATUS_FAILURE;
2917 }
2918
Katya Nigambcb705f2013-12-26 14:26:22 +05302919 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002920 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002921 smsLog(pMac, LOG2, FL("enter"));
2922 status = sme_AcquireGlobalLock( &pMac->sme );
2923 if ( HAL_STATUS_SUCCESS( status ) )
2924 {
2925 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2926 {
2927 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2928 }
2929 else
2930 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002931 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002932 status = eHAL_STATUS_INVALID_PARAMETER;
2933 }
2934 sme_ReleaseGlobalLock( &pMac->sme );
2935 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002936 else
2937 {
2938 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2939 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002940
2941 return (status);
2942}
2943
2944/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302945
2946 \fn sme_SetPhyMode
2947
2948 \brief Changes the PhyMode.
2949
2950 \param hHal - The handle returned by macOpen.
2951
2952 \param phyMode new phyMode which is to set
2953
2954 \return eHalStatus SUCCESS.
2955
2956 -------------------------------------------------------------------------------*/
2957eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2958{
2959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2960
2961 if (NULL == pMac)
2962 {
2963 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2964 "%s: invalid context", __func__);
2965 return eHAL_STATUS_FAILURE;
2966 }
2967
2968 pMac->roam.configParam.phyMode = phyMode;
2969 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2970 pMac->roam.configParam.phyMode,
2971 pMac->roam.configParam.ProprietaryRatesEnabled);
2972
2973 return eHAL_STATUS_SUCCESS;
2974}
2975
2976/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002977 \fn sme_RoamReassoc
2978 \brief a wrapper function to request CSR to inititiate a re-association
2979 \param pProfile - can be NULL to join the currently connected AP. In that
2980 case modProfileFields should carry the modified field(s) which could trigger
2981 reassoc
2982 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2983 that might need modification dynamically once STA is up & running and this
2984 could trigger a reassoc
2985 \param pRoamId - to get back the request ID
2986 \return eHalStatus
2987 -------------------------------------------------------------------------------*/
2988eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2989 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002990 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002991{
2992 eHalStatus status = eHAL_STATUS_FAILURE;
2993 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2994
Katya Nigambcb705f2013-12-26 14:26:22 +05302995 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002996 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 smsLog(pMac, LOG2, FL("enter"));
2998 status = sme_AcquireGlobalLock( &pMac->sme );
2999 if ( HAL_STATUS_SUCCESS( status ) )
3000 {
3001 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3002 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003003 if((NULL == pProfile) && (fForce == 1))
3004 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003005 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3006 /* to force the AP initiate fresh 802.1x authentication need to clear
3007 * the PMKID cache for that set the following boolean. this is needed
3008 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3009 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003010 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3011 }
3012 else
3013 {
3014 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003015 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003016 }
3017 else
3018 {
3019 status = eHAL_STATUS_INVALID_PARAMETER;
3020 }
3021 sme_ReleaseGlobalLock( &pMac->sme );
3022 }
3023
3024 return (status);
3025}
3026
3027/* ---------------------------------------------------------------------------
3028 \fn sme_RoamConnectToLastProfile
3029 \brief a wrapper function to request CSR to disconnect and reconnect with
3030 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003031 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 \return eHalStatus. It returns fail if currently connected
3033 ---------------------------------------------------------------------------*/
3034eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3035{
3036 eHalStatus status = eHAL_STATUS_FAILURE;
3037 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3038
3039 status = sme_AcquireGlobalLock( &pMac->sme );
3040 if ( HAL_STATUS_SUCCESS( status ) )
3041 {
3042 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3043 {
3044 status = csrRoamConnectToLastProfile( pMac, sessionId );
3045 }
3046 else
3047 {
3048 status = eHAL_STATUS_INVALID_PARAMETER;
3049 }
3050 sme_ReleaseGlobalLock( &pMac->sme );
3051 }
3052
3053 return (status);
3054}
3055
3056/* ---------------------------------------------------------------------------
3057 \fn sme_RoamDisconnect
3058 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003059 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003060 \param reason -- To indicate the reason for disconnecting. Currently, only
3061 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3062 \return eHalStatus
3063 ---------------------------------------------------------------------------*/
3064eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3065{
3066 eHalStatus status = eHAL_STATUS_FAILURE;
3067 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3068
Katya Nigambcb705f2013-12-26 14:26:22 +05303069 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003070 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 smsLog(pMac, LOG2, FL("enter"));
3072 status = sme_AcquireGlobalLock( &pMac->sme );
3073 if ( HAL_STATUS_SUCCESS( status ) )
3074 {
3075 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3076 {
3077 status = csrRoamDisconnect( pMac, sessionId, reason );
3078 }
3079 else
3080 {
3081 status = eHAL_STATUS_INVALID_PARAMETER;
3082 }
3083 sme_ReleaseGlobalLock( &pMac->sme );
3084 }
3085
3086 return (status);
3087}
3088
Jeff Johnson295189b2012-06-20 16:38:30 -07003089/* ---------------------------------------------------------------------------
3090 \fn sme_RoamStopBss
3091 \brief To stop BSS for Soft AP. This is an asynchronous API.
3092 \param hHal - Global structure
3093 \param sessionId - sessionId of SoftAP
3094 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3095 -------------------------------------------------------------------------------*/
3096eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3097{
3098 eHalStatus status = eHAL_STATUS_FAILURE;
3099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3100
3101 smsLog(pMac, LOG2, FL("enter"));
3102 status = sme_AcquireGlobalLock( &pMac->sme );
3103 if ( HAL_STATUS_SUCCESS( status ) )
3104 {
3105 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3106 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303107 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003108 }
3109 else
3110 {
3111 status = eHAL_STATUS_INVALID_PARAMETER;
3112 }
3113 sme_ReleaseGlobalLock( &pMac->sme );
3114 }
3115
3116 return (status);
3117}
3118
3119/* ---------------------------------------------------------------------------
3120 \fn sme_RoamDisconnectSta
3121 \brief To disassociate a station. This is an asynchronous API.
3122 \param hHal - Global structure
3123 \param sessionId - sessionId of SoftAP
3124 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3125 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3126 -------------------------------------------------------------------------------*/
3127eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3128 tANI_U8 *pPeerMacAddr)
3129{
3130 eHalStatus status = eHAL_STATUS_FAILURE;
3131 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3132
3133 if ( NULL == pMac )
3134 {
3135 VOS_ASSERT(0);
3136 return status;
3137 }
3138
3139 status = sme_AcquireGlobalLock( &pMac->sme );
3140 if ( HAL_STATUS_SUCCESS( status ) )
3141 {
3142 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3143 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003144 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303145 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003146 }
3147 else
3148 {
3149 status = eHAL_STATUS_INVALID_PARAMETER;
3150 }
3151 sme_ReleaseGlobalLock( &pMac->sme );
3152 }
3153
3154 return (status);
3155}
3156
3157/* ---------------------------------------------------------------------------
3158 \fn sme_RoamDeauthSta
3159 \brief To disassociate a station. This is an asynchronous API.
3160 \param hHal - Global structure
3161 \param sessionId - sessionId of SoftAP
3162 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3163 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3164 -------------------------------------------------------------------------------*/
3165eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3166 tANI_U8 *pPeerMacAddr)
3167{
3168 eHalStatus status = eHAL_STATUS_FAILURE;
3169 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3170
3171 if ( NULL == pMac )
3172 {
3173 VOS_ASSERT(0);
3174 return status;
3175 }
3176
3177 status = sme_AcquireGlobalLock( &pMac->sme );
3178 if ( HAL_STATUS_SUCCESS( status ) )
3179 {
3180 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3181 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003182 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303183 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003184 }
3185 else
3186 {
3187 status = eHAL_STATUS_INVALID_PARAMETER;
3188 }
3189 sme_ReleaseGlobalLock( &pMac->sme );
3190 }
3191
3192 return (status);
3193}
3194
3195/* ---------------------------------------------------------------------------
3196 \fn sme_RoamTKIPCounterMeasures
3197 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3198 \param sessionId - sessionId of SoftAP
3199 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3200 \return eHalStatus
3201 -------------------------------------------------------------------------------*/
3202eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3203 tANI_BOOLEAN bEnable)
3204{
3205 eHalStatus status = eHAL_STATUS_FAILURE;
3206 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3207
3208 if ( NULL == pMac )
3209 {
3210 VOS_ASSERT(0);
3211 return status;
3212 }
3213
3214 status = sme_AcquireGlobalLock( &pMac->sme );
3215 if ( HAL_STATUS_SUCCESS( status ) )
3216 {
3217 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3218 {
3219 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3220 }
3221 else
3222 {
3223 status = eHAL_STATUS_INVALID_PARAMETER;
3224 }
3225 sme_ReleaseGlobalLock( &pMac->sme );
3226 }
3227
3228 return (status);
3229}
3230
3231/* ---------------------------------------------------------------------------
3232 \fn sme_RoamGetAssociatedStas
3233 \brief To probe the list of associated stations from various modules of CORE stack.
3234 \This is an asynchronous API.
3235 \param sessionId - sessionId of SoftAP
3236 \param modId - Module from whom list of associtated stations is to be probed.
3237 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3238 \param pUsrContext - Opaque HDD context
3239 \param pfnSapEventCallback - Sap event callback in HDD
3240 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3241 \return eHalStatus
3242 -------------------------------------------------------------------------------*/
3243eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3244 VOS_MODULE_ID modId, void *pUsrContext,
3245 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3246{
3247 eHalStatus status = eHAL_STATUS_FAILURE;
3248 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3249
3250 if ( NULL == pMac )
3251 {
3252 VOS_ASSERT(0);
3253 return status;
3254 }
3255
3256 status = sme_AcquireGlobalLock( &pMac->sme );
3257 if ( HAL_STATUS_SUCCESS( status ) )
3258 {
3259 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3260 {
3261 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3262 }
3263 else
3264 {
3265 status = eHAL_STATUS_INVALID_PARAMETER;
3266 }
3267 sme_ReleaseGlobalLock( &pMac->sme );
3268 }
3269
3270 return (status);
3271}
3272
3273/* ---------------------------------------------------------------------------
3274 \fn sme_RoamGetWpsSessionOverlap
3275 \brief To get the WPS PBC session overlap information.
3276 \This is an asynchronous API.
3277 \param sessionId - sessionId of SoftAP
3278 \param pUsrContext - Opaque HDD context
3279 \param pfnSapEventCallback - Sap event callback in HDD
3280 \pRemoveMac - pointer to Mac address which needs to be removed from session
3281 \return eHalStatus
3282 -------------------------------------------------------------------------------*/
3283eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003284 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003285 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3286{
3287 eHalStatus status = eHAL_STATUS_FAILURE;
3288 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3289
3290 if ( NULL == pMac )
3291 {
3292 VOS_ASSERT(0);
3293 return status;
3294 }
3295
3296 status = sme_AcquireGlobalLock( &pMac->sme );
3297 if ( HAL_STATUS_SUCCESS( status ) )
3298 {
3299 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3300 {
3301 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3302 }
3303 else
3304 {
3305 status = eHAL_STATUS_INVALID_PARAMETER;
3306 }
3307 sme_ReleaseGlobalLock( &pMac->sme );
3308 }
3309
3310 return (status);
3311}
3312
Jeff Johnson295189b2012-06-20 16:38:30 -07003313
3314/* ---------------------------------------------------------------------------
3315 \fn sme_RoamGetConnectState
3316 \brief a wrapper function to request CSR to return the current connect state
3317 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003318 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 \return eHalStatus
3320 ---------------------------------------------------------------------------*/
3321eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3322{
3323 eHalStatus status = eHAL_STATUS_FAILURE;
3324 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3325
3326 status = sme_AcquireGlobalLock( &pMac->sme );
3327 if ( HAL_STATUS_SUCCESS( status ) )
3328 {
3329 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3330 {
3331 status = csrRoamGetConnectState( pMac, sessionId, pState );
3332 }
3333 else
3334 {
3335 status = eHAL_STATUS_INVALID_PARAMETER;
3336 }
3337 sme_ReleaseGlobalLock( &pMac->sme );
3338 }
3339
3340 return (status);
3341}
3342
3343/* ---------------------------------------------------------------------------
3344 \fn sme_RoamGetConnectProfile
3345 \brief a wrapper function to request CSR to return the current connect
3346 profile. Caller must call csrRoamFreeConnectProfile after it is done
3347 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003348 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 \param pProfile - pointer to a caller allocated structure
3350 tCsrRoamConnectedProfile
3351 \return eHalStatus. Failure if not connected
3352 ---------------------------------------------------------------------------*/
3353eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3354 tCsrRoamConnectedProfile *pProfile)
3355{
3356 eHalStatus status = eHAL_STATUS_FAILURE;
3357 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3358
Katya Nigambcb705f2013-12-26 14:26:22 +05303359 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003360 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003361 status = sme_AcquireGlobalLock( &pMac->sme );
3362 if ( HAL_STATUS_SUCCESS( status ) )
3363 {
3364 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3365 {
3366 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3367 }
3368 else
3369 {
3370 status = eHAL_STATUS_INVALID_PARAMETER;
3371 }
3372 sme_ReleaseGlobalLock( &pMac->sme );
3373 }
3374
3375 return (status);
3376}
3377
3378/* ---------------------------------------------------------------------------
3379 \fn sme_RoamFreeConnectProfile
3380 \brief a wrapper function to request CSR to free and reinitialize the
3381 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003382 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003383 \param pProfile - pointer to a caller allocated structure
3384 tCsrRoamConnectedProfile
3385 \return eHalStatus.
3386 ---------------------------------------------------------------------------*/
3387eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3388 tCsrRoamConnectedProfile *pProfile)
3389{
3390 eHalStatus status = eHAL_STATUS_FAILURE;
3391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3392
Katya Nigambcb705f2013-12-26 14:26:22 +05303393 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003394 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003395 status = sme_AcquireGlobalLock( &pMac->sme );
3396 if ( HAL_STATUS_SUCCESS( status ) )
3397 {
3398 status = csrRoamFreeConnectProfile( pMac, pProfile );
3399 sme_ReleaseGlobalLock( &pMac->sme );
3400 }
3401
3402 return (status);
3403}
3404
3405/* ---------------------------------------------------------------------------
3406 \fn sme_RoamSetPMKIDCache
3407 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003408 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 \param pPMKIDCache - caller allocated buffer point to an array of
3410 tPmkidCacheInfo
3411 \param numItems - a variable that has the number of tPmkidCacheInfo
3412 allocated when retruning, this is either the number needed
3413 or number of items put into pPMKIDCache
3414 \return eHalStatus - when fail, it usually means the buffer allocated is not
3415 big enough and pNumItems has the number of
3416 tPmkidCacheInfo.
3417 \Note: pNumItems is a number of tPmkidCacheInfo,
3418 not sizeof(tPmkidCacheInfo) * something
3419 ---------------------------------------------------------------------------*/
3420eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3421 tANI_U32 numItems )
3422{
3423 eHalStatus status = eHAL_STATUS_FAILURE;
3424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3425
Katya Nigambcb705f2013-12-26 14:26:22 +05303426 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003427 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003428 status = sme_AcquireGlobalLock( &pMac->sme );
3429 if ( HAL_STATUS_SUCCESS( status ) )
3430 {
3431 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3432 {
3433 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3434 }
3435 else
3436 {
3437 status = eHAL_STATUS_INVALID_PARAMETER;
3438 }
3439 sme_ReleaseGlobalLock( &pMac->sme );
3440 }
3441
3442 return (status);
3443}
3444
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003445eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3446{
3447 eHalStatus status = eHAL_STATUS_FAILURE;
3448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3449 status = sme_AcquireGlobalLock( &pMac->sme );
3450 if ( HAL_STATUS_SUCCESS( status ) )
3451 {
3452 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3453 {
3454 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3455 }
3456 else
3457 {
3458 status = eHAL_STATUS_INVALID_PARAMETER;
3459 }
3460 sme_ReleaseGlobalLock( &pMac->sme );
3461 }
3462 return (status);
3463}
Wilson Yang47b58192013-12-11 11:40:19 -08003464
Jeff Johnson295189b2012-06-20 16:38:30 -07003465/* ---------------------------------------------------------------------------
3466 \fn sme_RoamGetSecurityReqIE
3467 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3468 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003469 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003470 \param pLen - caller allocated memory that has the length of pBuf as input.
3471 Upon returned, *pLen has the needed or IE length in pBuf.
3472 \param pBuf - Caller allocated memory that contain the IE field, if any,
3473 upon return
3474 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3475 \return eHalStatus - when fail, it usually means the buffer allocated is not
3476 big enough
3477 ---------------------------------------------------------------------------*/
3478eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3479 tANI_U8 *pBuf, eCsrSecurityType secType)
3480{
3481 eHalStatus status = eHAL_STATUS_FAILURE;
3482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3483
3484 status = sme_AcquireGlobalLock( &pMac->sme );
3485 if ( HAL_STATUS_SUCCESS( status ) )
3486 {
3487 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3488 {
3489 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3490 }
3491 else
3492 {
3493 status = eHAL_STATUS_INVALID_PARAMETER;
3494 }
3495 sme_ReleaseGlobalLock( &pMac->sme );
3496 }
3497
3498 return (status);
3499}
3500
3501/* ---------------------------------------------------------------------------
3502 \fn sme_RoamGetSecurityRspIE
3503 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3504 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003505 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003506 \param pLen - caller allocated memory that has the length of pBuf as input.
3507 Upon returned, *pLen has the needed or IE length in pBuf.
3508 \param pBuf - Caller allocated memory that contain the IE field, if any,
3509 upon return
3510 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3511 \return eHalStatus - when fail, it usually means the buffer allocated is not
3512 big enough
3513 ---------------------------------------------------------------------------*/
3514eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3515 tANI_U8 *pBuf, eCsrSecurityType secType)
3516{
3517 eHalStatus status = eHAL_STATUS_FAILURE;
3518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3519
3520 status = sme_AcquireGlobalLock( &pMac->sme );
3521 if ( HAL_STATUS_SUCCESS( status ) )
3522 {
3523 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3524 {
3525 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3526 }
3527 else
3528 {
3529 status = eHAL_STATUS_INVALID_PARAMETER;
3530 }
3531 sme_ReleaseGlobalLock( &pMac->sme );
3532 }
3533
3534 return (status);
3535
3536}
3537
3538
3539/* ---------------------------------------------------------------------------
3540 \fn sme_RoamGetNumPMKIDCache
3541 \brief a wrapper function to request CSR to return number of PMKID cache
3542 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003543 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 \return tANI_U32 - the number of PMKID cache entries
3545 ---------------------------------------------------------------------------*/
3546tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3547{
3548 eHalStatus status = eHAL_STATUS_FAILURE;
3549 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3550 tANI_U32 numPmkidCache = 0;
3551
3552 status = sme_AcquireGlobalLock( &pMac->sme );
3553 if ( HAL_STATUS_SUCCESS( status ) )
3554 {
3555 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3556 {
3557 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3558 status = eHAL_STATUS_SUCCESS;
3559 }
3560 else
3561 {
3562 status = eHAL_STATUS_INVALID_PARAMETER;
3563 }
3564 sme_ReleaseGlobalLock( &pMac->sme );
3565 }
3566
3567 return (numPmkidCache);
3568}
3569
3570/* ---------------------------------------------------------------------------
3571 \fn sme_RoamGetPMKIDCache
3572 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003573 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003574 \param pNum - caller allocated memory that has the space of the number of
3575 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3576 needed or actually number in tPmkidCacheInfo.
3577 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3578 any, upon return
3579 \return eHalStatus - when fail, it usually means the buffer allocated is not
3580 big enough
3581 ---------------------------------------------------------------------------*/
3582eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3583 tPmkidCacheInfo *pPmkidCache)
3584{
3585 eHalStatus status = eHAL_STATUS_FAILURE;
3586 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3587
3588 status = sme_AcquireGlobalLock( &pMac->sme );
3589 if ( HAL_STATUS_SUCCESS( status ) )
3590 {
3591 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3592 {
3593 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3594 }
3595 else
3596 {
3597 status = eHAL_STATUS_INVALID_PARAMETER;
3598 }
3599 sme_ReleaseGlobalLock( &pMac->sme );
3600 }
3601
3602 return (status);
3603}
3604
3605
3606/* ---------------------------------------------------------------------------
3607 \fn sme_GetConfigParam
3608 \brief a wrapper function that HDD calls to get the global settings
3609 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003610 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 \param pParam - caller allocated memory
3612 \return eHalStatus
3613 ---------------------------------------------------------------------------*/
3614eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3615{
3616 eHalStatus status = eHAL_STATUS_FAILURE;
3617 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3618
Katya Nigambcb705f2013-12-26 14:26:22 +05303619 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003620 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 status = sme_AcquireGlobalLock( &pMac->sme );
3622 if ( HAL_STATUS_SUCCESS( status ) )
3623 {
3624 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3625 if (status != eHAL_STATUS_SUCCESS)
3626 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003627 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 sme_ReleaseGlobalLock( &pMac->sme );
3629 return status;
3630 }
3631#if defined WLAN_FEATURE_P2P_INTERNAL
3632 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3633 if (status != eHAL_STATUS_SUCCESS)
3634 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003635 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003636 sme_ReleaseGlobalLock( &pMac->sme );
3637 return status;
3638 }
3639#endif
3640 sme_ReleaseGlobalLock( &pMac->sme );
3641 }
3642
3643 return (status);
3644}
3645
3646/* ---------------------------------------------------------------------------
3647 \fn sme_CfgSetInt
3648 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003649 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 \param cfgId - Configuration Parameter ID (type) for STA.
3651 \param ccmValue - The information related to Configuration Parameter ID
3652 which needs to be saved in CFG
3653 \param callback - To be registered by CSR with CCM. Once the CFG done with
3654 saving the information in the database, it notifies CCM &
3655 then the callback will be invoked to notify.
3656 \param toBeSaved - To save the request for future reference
3657 \return eHalStatus
3658 ---------------------------------------------------------------------------*/
3659eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3660 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3661{
3662 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3663}
3664
3665/* ---------------------------------------------------------------------------
3666 \fn sme_CfgSetStr
3667 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003668 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 \param cfgId - Configuration Parameter ID (type) for STA.
3670 \param pStr - Pointer to the byte array which carries the information needs
3671 to be saved in CFG
3672 \param length - Length of the data to be saved
3673 \param callback - To be registered by CSR with CCM. Once the CFG done with
3674 saving the information in the database, it notifies CCM &
3675 then the callback will be invoked to notify.
3676 \param toBeSaved - To save the request for future reference
3677 \return eHalStatus
3678 ---------------------------------------------------------------------------*/
3679eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3680 tANI_U32 length, tCcmCfgSetCallback callback,
3681 eAniBoolean toBeSaved)
3682{
3683 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3684}
3685
3686/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05303687 \fn sme_GetModifyProfileFields
3688 \brief HDD or SME - QOS calls this function to get the current values of
3689 connected profile fields, changing which can cause reassoc.
3690 This function must be called after CFG is downloaded and STA is in connected
3691 state. Also, make sure to call this function to get the current profile
3692 fields before calling the reassoc. So that pModifyProfileFields will have
3693 all the latest values plus the one(s) has been updated as part of reassoc
3694 request.
3695 \param pModifyProfileFields - pointer to the connected profile fields
3696 changing which can cause reassoc
3697
3698 \return eHalStatus
3699 -------------------------------------------------------------------------------*/
3700eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3701 tCsrRoamModifyProfileFields * pModifyProfileFields)
3702{
3703 eHalStatus status = eHAL_STATUS_FAILURE;
3704 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3705
3706 MTRACE(vos_trace(VOS_MODULE_ID_SME,
3707 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
3708 status = sme_AcquireGlobalLock( &pMac->sme );
3709 if ( HAL_STATUS_SUCCESS( status ) )
3710 {
3711 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3712 {
3713 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3714 }
3715 else
3716 {
3717 status = eHAL_STATUS_INVALID_PARAMETER;
3718 }
3719 sme_ReleaseGlobalLock( &pMac->sme );
3720 }
3721
3722 return (status);
3723}
3724
3725/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303726 \fn sme_HT40StopOBSSScan
3727 \brief HDD or SME - Command to stop the OBSS scan
3728 THis is implemented only for debugging purpose.
3729 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3730 \param sessionId - sessionId
3731 changing which can cause reassoc
3732
3733 \return eHalStatus
3734 -------------------------------------------------------------------------------*/
3735eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3736{
3737 eHalStatus status = eHAL_STATUS_FAILURE;
3738 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3739
3740 smsLog(pMac, LOG2, FL("enter"));
3741 status = sme_AcquireGlobalLock( &pMac->sme );
3742 if ( HAL_STATUS_SUCCESS( status ) )
3743 {
3744 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3745 {
3746 csrHT40StopOBSSScan( pMac, sessionId );
3747 }
3748 else
3749 {
3750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3751 "%s: Invalid session sessionId %d", __func__,sessionId);
3752 status = eHAL_STATUS_INVALID_PARAMETER;
3753 }
3754 sme_ReleaseGlobalLock( &pMac->sme );
3755 }
3756 return (status);
3757}
3758
Jeff Johnson295189b2012-06-20 16:38:30 -07003759/*--------------------------------------------------------------------------
3760 \fn sme_SetConfigPowerSave
3761 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3762 For BMPS related configuration, this function also updates the CFG
3763 and sends a message to FW to pick up the new values. Note: Calling
3764 this function only updates the configuration and does not enable
3765 the specified power save mode.
3766 \param hHal - The handle returned by macOpen.
3767 \param psMode - Power Saving mode being modified
3768 \param pConfigParams - a pointer to a caller allocated object of type
3769 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3770 \return eHalStatus
3771 --------------------------------------------------------------------------*/
3772eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3773 void *pConfigParams)
3774{
3775 eHalStatus status = eHAL_STATUS_FAILURE;
3776 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3777
Katya Nigambcb705f2013-12-26 14:26:22 +05303778 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003779 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 if (NULL == pConfigParams ) {
3781 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3782 "nothing to update");
3783 return eHAL_STATUS_FAILURE;
3784 }
3785
3786 status = sme_AcquireGlobalLock( &pMac->sme );
3787 if ( HAL_STATUS_SUCCESS( status ) )
3788 {
3789 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3790 sme_ReleaseGlobalLock( &pMac->sme );
3791 }
3792
3793 return (status);
3794}
3795
3796/*--------------------------------------------------------------------------
3797 \fn sme_GetConfigPowerSave
3798 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3799 \param hHal - The handle returned by macOpen.
3800 \param psMode - Power Saving mode
3801 \param pConfigParams - a pointer to a caller allocated object of type
3802 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3803 \return eHalStatus
3804 --------------------------------------------------------------------------*/
3805eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3806 void *pConfigParams)
3807{
3808 eHalStatus status = eHAL_STATUS_FAILURE;
3809 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3810
Katya Nigambcb705f2013-12-26 14:26:22 +05303811 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003812 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 if (NULL == pConfigParams ) {
3814 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3815 "nothing to update");
3816 return eHAL_STATUS_FAILURE;
3817 }
3818
3819 status = sme_AcquireGlobalLock( &pMac->sme );
3820 if ( HAL_STATUS_SUCCESS( status ) )
3821 {
3822 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3823 sme_ReleaseGlobalLock( &pMac->sme );
3824 }
3825
3826 return (status);
3827}
3828
3829/* ---------------------------------------------------------------------------
3830 \fn sme_SignalPowerEvent
3831 \brief Signals to PMC that a power event has occurred. Used for putting
3832 the chip into deep sleep mode.
3833 \param hHal - The handle returned by macOpen.
3834 \param event - the event that has occurred
3835 \return eHalStatus
3836 ---------------------------------------------------------------------------*/
3837eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3838{
3839 eHalStatus status = eHAL_STATUS_FAILURE;
3840 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3841
3842 status = sme_AcquireGlobalLock( &pMac->sme );
3843 if ( HAL_STATUS_SUCCESS( status ) )
3844 {
3845 status = pmcSignalPowerEvent(hHal, event);
3846 sme_ReleaseGlobalLock( &pMac->sme );
3847 }
3848
3849 return (status);
3850}
3851
3852/* ---------------------------------------------------------------------------
3853 \fn sme_EnablePowerSave
3854 \brief Enables one of the power saving modes.
3855 \param hHal - The handle returned by macOpen.
3856 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3857 while the chip is operating in Full Power, PMC will start
3858 a timer that will try to put the chip in BMPS mode after
3859 expiry.
3860 \return eHalStatus
3861 ---------------------------------------------------------------------------*/
3862eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3863{
3864 eHalStatus status = eHAL_STATUS_FAILURE;
3865 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3866
Katya Nigambcb705f2013-12-26 14:26:22 +05303867 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003868 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003869 status = sme_AcquireGlobalLock( &pMac->sme );
3870 if ( HAL_STATUS_SUCCESS( status ) )
3871 {
3872 status = pmcEnablePowerSave(hHal, psMode);
3873 sme_ReleaseGlobalLock( &pMac->sme );
3874 }
3875
3876 return (status);
3877}
3878
3879/* ---------------------------------------------------------------------------
3880 \fn sme_DisablePowerSave
3881 \brief Disables one of the power saving modes.
3882 \param hHal - The handle returned by macOpen.
3883 \param psMode - The power saving mode to disable. Disabling does not imply
3884 that device will be brought out of the current PS mode. This
3885 is purely a configuration API.
3886 \return eHalStatus
3887 ---------------------------------------------------------------------------*/
3888eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3889{
3890 eHalStatus status = eHAL_STATUS_FAILURE;
3891 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3892
Katya Nigambcb705f2013-12-26 14:26:22 +05303893 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003894 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 status = sme_AcquireGlobalLock( &pMac->sme );
3896 if ( HAL_STATUS_SUCCESS( status ) )
3897 {
3898 status = pmcDisablePowerSave(hHal, psMode);
3899 sme_ReleaseGlobalLock( &pMac->sme );
3900 }
3901
3902 return (status);
3903 }
3904
3905/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303906+ \fn sme_SetHostPowerSave
3907+ \brief Enables BMPS logic to be controlled by User level apps
3908+ \param hHal - The handle returned by macOpen.
3909+ \param psMode - The power saving mode to disable. Disabling does not imply
3910+ that device will be brought out of the current PS mode. This
3911+ is purely a configuration API.
3912+ \return eHalStatus
3913+ ---------------------------------------------------------------------------*/
3914eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3915{
3916 eHalStatus status = eHAL_STATUS_FAILURE;
3917 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3918
3919 pMac->pmc.isHostPsEn = psMode;
3920
3921 return (status);
3922}
3923
3924/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 \fn sme_StartAutoBmpsTimer
3926 \brief Starts a timer that periodically polls all the registered
3927 module for entry into Bmps mode. This timer is started only if BMPS is
3928 enabled and whenever the device is in full power.
3929 \param hHal - The handle returned by macOpen.
3930 \return eHalStatus
3931 ---------------------------------------------------------------------------*/
3932eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3933{
3934 eHalStatus status = eHAL_STATUS_FAILURE;
3935 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3936
Katya Nigambcb705f2013-12-26 14:26:22 +05303937 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003938 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 status = sme_AcquireGlobalLock( &pMac->sme );
3940 if ( HAL_STATUS_SUCCESS( status ) )
3941 {
3942 status = pmcStartAutoBmpsTimer(hHal);
3943 sme_ReleaseGlobalLock( &pMac->sme );
3944 }
3945
3946 return (status);
3947}
3948/* ---------------------------------------------------------------------------
3949 \fn sme_StopAutoBmpsTimer
3950 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3951 Stopping the timer does not cause a device state change. Only the timer
3952 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3953 \param hHal - The handle returned by macOpen.
3954 \return eHalStatus
3955 ---------------------------------------------------------------------------*/
3956eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3957{
3958 eHalStatus status = eHAL_STATUS_FAILURE;
3959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3960
Katya Nigambcb705f2013-12-26 14:26:22 +05303961 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003962 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003963 status = sme_AcquireGlobalLock( &pMac->sme );
3964 if ( HAL_STATUS_SUCCESS( status ) )
3965 {
3966 status = pmcStopAutoBmpsTimer(hHal);
3967 sme_ReleaseGlobalLock( &pMac->sme );
3968 }
3969
3970 return (status);
3971}
3972/* ---------------------------------------------------------------------------
3973 \fn sme_QueryPowerState
3974 \brief Returns the current power state of the device.
3975 \param hHal - The handle returned by macOpen.
3976 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3977 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3978 \return eHalStatus
3979 ---------------------------------------------------------------------------*/
3980eHalStatus sme_QueryPowerState (
3981 tHalHandle hHal,
3982 tPmcPowerState *pPowerState,
3983 tPmcSwitchState *pSwWlanSwitchState)
3984{
3985 eHalStatus status = eHAL_STATUS_FAILURE;
3986 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3987
3988 status = sme_AcquireGlobalLock( &pMac->sme );
3989 if ( HAL_STATUS_SUCCESS( status ) )
3990 {
3991 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3992 sme_ReleaseGlobalLock( &pMac->sme );
3993 }
3994
3995 return (status);
3996}
3997
3998/* ---------------------------------------------------------------------------
3999 \fn sme_IsPowerSaveEnabled
4000 \brief Checks if the device is able to enter a particular power save mode
4001 This does not imply that the device is in a particular PS mode
4002 \param hHal - The handle returned by macOpen.
4003 \param psMode - the power saving mode
4004 \return eHalStatus
4005 ---------------------------------------------------------------------------*/
4006tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4007{
4008 eHalStatus status = eHAL_STATUS_FAILURE;
4009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4010 tANI_BOOLEAN result = false;
4011
Katya Nigambcb705f2013-12-26 14:26:22 +05304012 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004013 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 status = sme_AcquireGlobalLock( &pMac->sme );
4015 if ( HAL_STATUS_SUCCESS( status ) )
4016 {
4017 result = pmcIsPowerSaveEnabled(hHal, psMode);
4018 sme_ReleaseGlobalLock( &pMac->sme );
4019 return result;
4020 }
4021
4022 return false;
4023}
4024
4025/* ---------------------------------------------------------------------------
4026 \fn sme_RequestFullPower
4027 \brief Request that the device be brought to full power state. When the
4028 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4029 is enabled. On timer expiry PMC will attempt to put the device in
4030 BMPS mode if following holds true:
4031 - BMPS mode is enabled
4032 - Polling of all modules through the Power Save Check routine passes
4033 - STA is associated to an access point
4034 \param hHal - The handle returned by macOpen.
4035 \param - callbackRoutine Callback routine invoked in case of success/failure
4036 \return eHalStatus - status
4037 eHAL_STATUS_SUCCESS - device brought to full power state
4038 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4039 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4040 ---------------------------------------------------------------------------*/
4041eHalStatus sme_RequestFullPower (
4042 tHalHandle hHal,
4043 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4044 void *callbackContext,
4045 tRequestFullPowerReason fullPowerReason)
4046{
4047 eHalStatus status = eHAL_STATUS_FAILURE;
4048 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4049
Katya Nigambcb705f2013-12-26 14:26:22 +05304050 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004051 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 status = sme_AcquireGlobalLock( &pMac->sme );
4053 if ( HAL_STATUS_SUCCESS( status ) )
4054 {
4055 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4056 sme_ReleaseGlobalLock( &pMac->sme );
4057 }
4058
4059 return (status);
4060}
4061
4062/* ---------------------------------------------------------------------------
4063 \fn sme_RequestBmps
4064 \brief Request that the device be put in BMPS state. Request will be
4065 accepted only if BMPS mode is enabled and power save check routine
4066 passes.
4067 \param hHal - The handle returned by macOpen.
4068 \param - callbackRoutine Callback routine invoked in case of success/failure
4069 \return eHalStatus
4070 eHAL_STATUS_SUCCESS - device is in BMPS state
4071 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4072 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4073 ---------------------------------------------------------------------------*/
4074eHalStatus sme_RequestBmps (
4075 tHalHandle hHal,
4076 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4077 void *callbackContext)
4078{
4079 eHalStatus status = eHAL_STATUS_FAILURE;
4080 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4081
Katya Nigambcb705f2013-12-26 14:26:22 +05304082 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004083 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004084 status = sme_AcquireGlobalLock( &pMac->sme );
4085 if ( HAL_STATUS_SUCCESS( status ) )
4086 {
4087 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4088 sme_ReleaseGlobalLock( &pMac->sme );
4089 }
4090
4091 return (status);
4092}
4093
4094
4095/* ---------------------------------------------------------------------------
4096 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004097 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4098 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004099 \param hHal - The handle returned by macOpen.
4100 ---------------------------------------------------------------------------*/
4101void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4102{
4103 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4104
Katya Nigambcb705f2013-12-26 14:26:22 +05304105 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004106 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4108 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4109}
4110
4111
4112/* ---------------------------------------------------------------------------
4113 \fn sme_StartUapsd
4114 \brief Request that the device be put in UAPSD state. If the device is in
4115 Full Power it will be put in BMPS mode first and then into UAPSD
4116 mode.
4117 \param hHal - The handle returned by macOpen.
4118 \param - callbackRoutine Callback routine invoked in case of success/failure
4119 eHAL_STATUS_SUCCESS - device is in UAPSD state
4120 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4121 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4122 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4123 \return eHalStatus
4124 ---------------------------------------------------------------------------*/
4125eHalStatus sme_StartUapsd (
4126 tHalHandle hHal,
4127 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4128 void *callbackContext)
4129{
4130 eHalStatus status = eHAL_STATUS_FAILURE;
4131 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4132
4133 status = sme_AcquireGlobalLock( &pMac->sme );
4134 if ( HAL_STATUS_SUCCESS( status ) )
4135 {
4136 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4137 sme_ReleaseGlobalLock( &pMac->sme );
4138 }
4139
4140 return (status);
4141 }
4142
4143/* ---------------------------------------------------------------------------
4144 \fn sme_StopUapsd
4145 \brief Request that the device be put out of UAPSD state. Device will be
4146 put in in BMPS state after stop UAPSD completes.
4147 \param hHal - The handle returned by macOpen.
4148 \return eHalStatus
4149 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4150 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4151 ---------------------------------------------------------------------------*/
4152eHalStatus sme_StopUapsd (tHalHandle hHal)
4153{
4154 eHalStatus status = eHAL_STATUS_FAILURE;
4155 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4156
4157 status = sme_AcquireGlobalLock( &pMac->sme );
4158 if ( HAL_STATUS_SUCCESS( status ) )
4159 {
4160 status = pmcStopUapsd(hHal);
4161 sme_ReleaseGlobalLock( &pMac->sme );
4162 }
4163
4164 return (status);
4165}
4166
4167/* ---------------------------------------------------------------------------
4168 \fn sme_RequestStandby
4169 \brief Request that the device be put in standby. It is HDD's responsibility
4170 to bring the chip to full power and do a disassoc before calling
4171 this API.
4172 \param hHal - The handle returned by macOpen.
4173 \param - callbackRoutine Callback routine invoked in case of success/failure
4174 \return eHalStatus
4175 eHAL_STATUS_SUCCESS - device is in Standby mode
4176 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4177 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4178 ---------------------------------------------------------------------------*/
4179eHalStatus sme_RequestStandby (
4180 tHalHandle hHal,
4181 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4182 void *callbackContext)
4183{
4184 eHalStatus status = eHAL_STATUS_FAILURE;
4185 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4186
Katya Nigambcb705f2013-12-26 14:26:22 +05304187 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004188 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304189 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 status = sme_AcquireGlobalLock( &pMac->sme );
4191 if ( HAL_STATUS_SUCCESS( status ) )
4192 {
4193 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4194 sme_ReleaseGlobalLock( &pMac->sme );
4195 }
4196
4197 return (status);
4198}
4199
4200/* ---------------------------------------------------------------------------
4201 \fn sme_RegisterPowerSaveCheck
4202 \brief Register a power save check routine that is called whenever
4203 the device is about to enter one of the power save modes.
4204 \param hHal - The handle returned by macOpen.
4205 \param checkRoutine - Power save check routine to be registered
4206 \return eHalStatus
4207 eHAL_STATUS_SUCCESS - successfully registered
4208 eHAL_STATUS_FAILURE - not successfully registered
4209 ---------------------------------------------------------------------------*/
4210eHalStatus sme_RegisterPowerSaveCheck (
4211 tHalHandle hHal,
4212 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4213{
4214 eHalStatus status = eHAL_STATUS_FAILURE;
4215 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4216
4217 status = sme_AcquireGlobalLock( &pMac->sme );
4218 if ( HAL_STATUS_SUCCESS( status ) )
4219 {
4220 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4221 sme_ReleaseGlobalLock( &pMac->sme );
4222 }
4223
4224 return (status);
4225}
4226
4227/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304228 \fn sme_Register11dScanDoneCallback
4229 \brief Register a routine of type csrScanCompleteCallback which is
4230 called whenever an 11d scan is done
4231 \param hHal - The handle returned by macOpen.
4232 \param callback - 11d scan complete routine to be registered
4233 \return eHalStatus
4234 ---------------------------------------------------------------------------*/
4235eHalStatus sme_Register11dScanDoneCallback (
4236 tHalHandle hHal,
4237 csrScanCompleteCallback callback)
4238{
4239 eHalStatus status = eHAL_STATUS_SUCCESS;
4240 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4241
4242 pMac->scan.callback11dScanDone = callback;
4243
4244 return (status);
4245}
4246
4247/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004248 \fn sme_DeregisterPowerSaveCheck
4249 \brief Deregister a power save check routine
4250 \param hHal - The handle returned by macOpen.
4251 \param checkRoutine - Power save check routine to be deregistered
4252 \return eHalStatus
4253 eHAL_STATUS_SUCCESS - successfully deregistered
4254 eHAL_STATUS_FAILURE - not successfully deregistered
4255 ---------------------------------------------------------------------------*/
4256eHalStatus sme_DeregisterPowerSaveCheck (
4257 tHalHandle hHal,
4258 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4259{
4260 eHalStatus status = eHAL_STATUS_FAILURE;
4261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4262
4263 status = sme_AcquireGlobalLock( &pMac->sme );
4264 if ( HAL_STATUS_SUCCESS( status ) )
4265 {
4266 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4267 sme_ReleaseGlobalLock( &pMac->sme );
4268 }
4269
4270 return (status);
4271}
4272
4273/* ---------------------------------------------------------------------------
4274 \fn sme_RegisterDeviceStateUpdateInd
4275 \brief Register a callback routine that is called whenever
4276 the device enters a new device state (Full Power, BMPS, UAPSD)
4277 \param hHal - The handle returned by macOpen.
4278 \param callbackRoutine - Callback routine to be registered
4279 \param callbackContext - Cookie to be passed back during callback
4280 \return eHalStatus
4281 eHAL_STATUS_SUCCESS - successfully registered
4282 eHAL_STATUS_FAILURE - not successfully registered
4283 ---------------------------------------------------------------------------*/
4284eHalStatus sme_RegisterDeviceStateUpdateInd (
4285 tHalHandle hHal,
4286 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4287 void *callbackContext)
4288{
4289 eHalStatus status = eHAL_STATUS_FAILURE;
4290 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4291
4292 status = sme_AcquireGlobalLock( &pMac->sme );
4293 if ( HAL_STATUS_SUCCESS( status ) )
4294 {
4295 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4296 sme_ReleaseGlobalLock( &pMac->sme );
4297 }
4298
4299 return (status);
4300}
4301
4302/* ---------------------------------------------------------------------------
4303 \fn sme_DeregisterDeviceStateUpdateInd
4304 \brief Deregister a routine that was registered for device state changes
4305 \param hHal - The handle returned by macOpen.
4306 \param callbackRoutine - Callback routine to be deregistered
4307 \return eHalStatus
4308 eHAL_STATUS_SUCCESS - successfully deregistered
4309 eHAL_STATUS_FAILURE - not successfully deregistered
4310 ---------------------------------------------------------------------------*/
4311eHalStatus sme_DeregisterDeviceStateUpdateInd (
4312 tHalHandle hHal,
4313 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4314{
4315 eHalStatus status = eHAL_STATUS_FAILURE;
4316 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4317
4318 status = sme_AcquireGlobalLock( &pMac->sme );
4319 if ( HAL_STATUS_SUCCESS( status ) )
4320 {
4321 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4322 sme_ReleaseGlobalLock( &pMac->sme );
4323 }
4324
4325 return (status);
4326}
4327
4328/* ---------------------------------------------------------------------------
4329 \fn sme_WowlAddBcastPattern
4330 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4331 do a pattern match on these patterns when Wowl is enabled during BMPS
4332 mode. Note that Firmware performs the pattern matching only on
4333 broadcast frames and while Libra is in BMPS mode.
4334 \param hHal - The handle returned by macOpen.
4335 \param pattern - Pattern to be added
4336 \return eHalStatus
4337 eHAL_STATUS_FAILURE Cannot add pattern
4338 eHAL_STATUS_SUCCESS Request accepted.
4339 ---------------------------------------------------------------------------*/
4340eHalStatus sme_WowlAddBcastPattern (
4341 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004342 tpSirWowlAddBcastPtrn pattern,
4343 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004344{
4345 eHalStatus status = eHAL_STATUS_FAILURE;
4346 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304347 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004348 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004349 status = sme_AcquireGlobalLock( &pMac->sme );
4350 if ( HAL_STATUS_SUCCESS( status ) )
4351 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004352 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004353 sme_ReleaseGlobalLock( &pMac->sme );
4354 }
4355
4356 return (status);
4357}
4358
4359/* ---------------------------------------------------------------------------
4360 \fn sme_WowlDelBcastPattern
4361 \brief Delete a pattern that was added for Pattern Byte Matching.
4362 \param hHal - The handle returned by macOpen.
4363 \param pattern - Pattern to be deleted
4364 \return eHalStatus
4365 eHAL_STATUS_FAILURE Cannot delete pattern
4366 eHAL_STATUS_SUCCESS Request accepted.
4367 ---------------------------------------------------------------------------*/
4368eHalStatus sme_WowlDelBcastPattern (
4369 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004370 tpSirWowlDelBcastPtrn pattern,
4371 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004372{
4373 eHalStatus status = eHAL_STATUS_FAILURE;
4374 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304375 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004376 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 status = sme_AcquireGlobalLock( &pMac->sme );
4378 if ( HAL_STATUS_SUCCESS( status ) )
4379 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004380 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 sme_ReleaseGlobalLock( &pMac->sme );
4382 }
4383
4384 return (status);
4385}
4386
4387/* ---------------------------------------------------------------------------
4388 \fn sme_EnterWowl
4389 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4390 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4391 SME will will cache the information that WOWL has been enabled and
4392 attempt to put the device in BMPS. On entry into BMPS, SME will
4393 enable the WOWL mode.
4394 Note 1: If we exit BMPS mode (someone requests full power), we
4395 will NOT resume WOWL when we go back to BMPS again. Request for full
4396 power (while in WOWL mode) means disable WOWL and go to full power.
4397 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4398 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4399 are required. Currently there is no requirement or use case to support
4400 UAPSD and WOWL at the same time.
4401
4402 \param hHal - The handle returned by macOpen.
4403 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4404 Used for success/failure notification by SME
4405 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4406 at the time of callback.
4407 \param wakeReasonIndCB - Callback routine provided by HDD.
4408 Used for Wake Reason Indication by SME
4409 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4410 at the time of callback.
4411 \return eHalStatus
4412 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4413 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4414 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4415 BMPS mode is entered.
4416 ---------------------------------------------------------------------------*/
4417eHalStatus sme_EnterWowl (
4418 tHalHandle hHal,
4419 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4420 void *enterWowlCallbackContext,
4421#ifdef WLAN_WAKEUP_EVENTS
4422 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4423 void *wakeIndicationCBContext,
4424#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004425 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004426{
4427 eHalStatus status = eHAL_STATUS_FAILURE;
4428 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304429 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004430 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004431 status = sme_AcquireGlobalLock( &pMac->sme );
4432 if ( HAL_STATUS_SUCCESS( status ) )
4433 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004434 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004435#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004436 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004437#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004438 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004439 sme_ReleaseGlobalLock( &pMac->sme );
4440 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004441 return (status);
4442}
4443/* ---------------------------------------------------------------------------
4444 \fn sme_ExitWowl
4445 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4446 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4447 mode.
4448 \param hHal - The handle returned by macOpen.
4449 \return eHalStatus
4450 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4451 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4452 ---------------------------------------------------------------------------*/
4453eHalStatus sme_ExitWowl (tHalHandle hHal)
4454{
4455 eHalStatus status = eHAL_STATUS_FAILURE;
4456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304457 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004458 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004459 status = sme_AcquireGlobalLock( &pMac->sme );
4460 if ( HAL_STATUS_SUCCESS( status ) )
4461 {
4462 status = pmcExitWowl (hHal);
4463 sme_ReleaseGlobalLock( &pMac->sme );
4464 }
4465
4466 return (status);
4467}
4468
4469/* ---------------------------------------------------------------------------
4470
4471 \fn sme_RoamSetKey
4472
4473 \brief To set encryption key. This function should be called only when connected
4474 This is an asynchronous API.
4475
4476 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4477
4478 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4479
4480 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4481
4482 FAILURE or RESOURCES The API finished and failed.
4483
4484 -------------------------------------------------------------------------------*/
4485eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4486{
4487 eHalStatus status = eHAL_STATUS_FAILURE;
4488 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4489 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 tANI_U32 i;
4491 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004492
Katya Nigambcb705f2013-12-26 14:26:22 +05304493 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004494 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004495 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4496 {
4497 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4498 return eHAL_STATUS_FAILURE;
4499 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304500 /*Once Setkey is done, we can go in BMPS*/
4501 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304502 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304503 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304504 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4505 " to allow BMPS"));
4506 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004507
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 status = sme_AcquireGlobalLock( &pMac->sme );
4509 if ( HAL_STATUS_SUCCESS( status ) )
4510 {
4511 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4512 if(pRoamId)
4513 {
4514 *pRoamId = roamId;
4515 }
4516
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004517 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004518
4519 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004520 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004521
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004522 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004523
4524 pSession = CSR_GET_SESSION(pMac, sessionId);
4525
Jeff Johnson32d95a32012-09-10 13:15:23 -07004526 if(!pSession)
4527 {
4528 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004529 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004530 return eHAL_STATUS_FAILURE;
4531 }
4532
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4534 {
4535 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4536 {
4537 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4538 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4539 {
4540 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4541 }
4542 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4543 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4544 {
4545 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4546 }
4547 }
4548 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004549
4550 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4551 sme_ReleaseGlobalLock( &pMac->sme );
4552 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304553#ifdef DEBUG_ROAM_DELAY
4554 //Store sent PTK key time
4555 if(pSetKey->keyDirection == eSIR_TX_RX)
4556 {
4557 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4558 }
4559 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4560 {
4561 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4562 }
4563 else
4564 {
4565 return (status);
4566 }
4567#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004568
4569 return (status);
4570}
4571
4572
4573/* ---------------------------------------------------------------------------
4574
4575 \fn sme_RoamRemoveKey
4576
4577 \brief To set encryption key. This is an asynchronous API.
4578
4579 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4580
4581 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4582
4583 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4584
4585 FAILURE or RESOURCES The API finished and failed.
4586
4587 -------------------------------------------------------------------------------*/
4588eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4589 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4590{
4591 eHalStatus status = eHAL_STATUS_FAILURE;
4592 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4593 tANI_U32 roamId;
4594
Katya Nigambcb705f2013-12-26 14:26:22 +05304595 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004596 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 status = sme_AcquireGlobalLock( &pMac->sme );
4598 if ( HAL_STATUS_SUCCESS( status ) )
4599 {
4600 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4601 if(pRoamId)
4602 {
4603 *pRoamId = roamId;
4604 }
4605 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4606 sme_ReleaseGlobalLock( &pMac->sme );
4607 }
4608
4609 return (status);
4610}
4611
4612/* ---------------------------------------------------------------------------
4613 \fn sme_GetRssi
4614 \brief a wrapper function that client calls to register a callback to get RSSI
4615
4616 \param callback - SME sends back the requested stats using the callback
4617 \param staId - The station ID for which the stats is requested for
4618 \param pContext - user context to be passed back along with the callback
4619 \param pVosContext - vos context
4620 \return eHalStatus
4621 ---------------------------------------------------------------------------*/
4622eHalStatus sme_GetRssi(tHalHandle hHal,
4623 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004624 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 void *pContext, void* pVosContext)
4626{
4627 eHalStatus status = eHAL_STATUS_FAILURE;
4628 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4629
4630 status = sme_AcquireGlobalLock( &pMac->sme );
4631 if ( HAL_STATUS_SUCCESS( status ) )
4632 {
4633 status = csrGetRssi( pMac, callback,
4634 staId, bssId, pContext, pVosContext);
4635 sme_ReleaseGlobalLock( &pMac->sme );
4636 }
4637 return (status);
4638}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304639
4640/* ---------------------------------------------------------------------------
4641 \fn sme_GetSnr
4642 \brief a wrapper function that client calls to register a callback to
4643 get SNR
4644
4645 \param callback - SME sends back the requested stats using the callback
4646 \param staId - The station ID for which the stats is requested for
4647 \param pContext - user context to be passed back along with the callback
4648 \param pVosContext - vos context
4649 \return eHalStatus
4650 ---------------------------------------------------------------------------*/
4651eHalStatus sme_GetSnr(tHalHandle hHal,
4652 tCsrSnrCallback callback,
4653 tANI_U8 staId, tCsrBssid bssId,
4654 void *pContext)
4655{
4656 eHalStatus status = eHAL_STATUS_FAILURE;
4657 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4658
4659 status = sme_AcquireGlobalLock( &pMac->sme );
4660 if ( HAL_STATUS_SUCCESS( status ) )
4661 {
4662 status = csrGetSnr(pMac, callback,
4663 staId, bssId, pContext);
4664 sme_ReleaseGlobalLock( &pMac->sme );
4665 }
4666 return status;
4667}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004668#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004669/* ---------------------------------------------------------------------------
4670 \fn sme_GetRoamRssi
4671 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4672
4673 \param callback - SME sends back the requested stats using the callback
4674 \param staId - The station ID for which the stats is requested for
4675 \param pContext - user context to be passed back along with the callback
4676 \param pVosContext - vos context
4677 \return eHalStatus
4678 ---------------------------------------------------------------------------*/
4679eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4680 tCsrRssiCallback callback,
4681 tANI_U8 staId, tCsrBssid bssId,
4682 void *pContext, void* pVosContext)
4683{
4684 eHalStatus status = eHAL_STATUS_FAILURE;
4685 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4686
4687 status = sme_AcquireGlobalLock( &pMac->sme );
4688 if ( HAL_STATUS_SUCCESS( status ) )
4689 {
4690 status = csrGetRoamRssi( pMac, callback,
4691 staId, bssId, pContext, pVosContext);
4692 sme_ReleaseGlobalLock( &pMac->sme );
4693 }
4694 return (status);
4695}
4696#endif
4697
Jeff Johnson295189b2012-06-20 16:38:30 -07004698
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004699#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004700/* ---------------------------------------------------------------------------
4701 \fn sme_GetTsmStats
4702 \brief a wrapper function that client calls to register a callback to get TSM Stats
4703
4704 \param callback - SME sends back the requested stats using the callback
4705 \param staId - The station ID for which the stats is requested for
4706 \param pContext - user context to be passed back along with the callback
4707 \param pVosContext - vos context
4708 \return eHalStatus
4709 ---------------------------------------------------------------------------*/
4710eHalStatus sme_GetTsmStats(tHalHandle hHal,
4711 tCsrTsmStatsCallback callback,
4712 tANI_U8 staId, tCsrBssid bssId,
4713 void *pContext, void* pVosContext, tANI_U8 tid)
4714{
4715 eHalStatus status = eHAL_STATUS_FAILURE;
4716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4717
4718 status = sme_AcquireGlobalLock( &pMac->sme );
4719 if ( HAL_STATUS_SUCCESS( status ) )
4720 {
4721 status = csrGetTsmStats( pMac, callback,
4722 staId, bssId, pContext, pVosContext, tid);
4723 sme_ReleaseGlobalLock( &pMac->sme );
4724 }
4725 return (status);
4726}
4727#endif
4728
4729
Jeff Johnson295189b2012-06-20 16:38:30 -07004730/* ---------------------------------------------------------------------------
4731 \fn sme_GetStatistics
4732 \brief a wrapper function that client calls to register a callback to get
4733 different PHY level statistics from CSR.
4734
4735 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4736 \param statsMask - The different category/categories of stats requester is looking for
4737 \param callback - SME sends back the requested stats using the callback
4738 \param periodicity - If requester needs periodic update in millisec, 0 means
4739 it's an one time request
4740 \param cache - If requester is happy with cached stats
4741 \param staId - The station ID for which the stats is requested for
4742 \param pContext - user context to be passed back along with the callback
4743 \return eHalStatus
4744 ---------------------------------------------------------------------------*/
4745eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4746 tANI_U32 statsMask,
4747 tCsrStatsCallback callback,
4748 tANI_U32 periodicity, tANI_BOOLEAN cache,
4749 tANI_U8 staId, void *pContext)
4750{
4751 eHalStatus status = eHAL_STATUS_FAILURE;
4752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4753
Katya Nigambcb705f2013-12-26 14:26:22 +05304754 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004755 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004756 status = sme_AcquireGlobalLock( &pMac->sme );
4757 if ( HAL_STATUS_SUCCESS( status ) )
4758 {
4759 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4760 periodicity, cache, staId, pContext);
4761 sme_ReleaseGlobalLock( &pMac->sme );
4762 }
4763
4764 return (status);
4765
4766}
4767
4768/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304769 \fn smeGetTLSTAState
4770 \helper function to get the TL STA State whenever the function is called.
4771
4772 \param staId - The staID to be passed to the TL
4773 to get the relevant TL STA State
4774 \return the state as tANI_U16
4775 ---------------------------------------------------------------------------*/
4776tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4777{
4778 tANI_U16 tlSTAState = TL_INIT_STATE;
4779 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4780 eHalStatus status = eHAL_STATUS_FAILURE;
4781
4782 status = sme_AcquireGlobalLock( &pMac->sme );
4783 if ( HAL_STATUS_SUCCESS( status ) )
4784 {
4785 tlSTAState = csrGetTLSTAState( pMac, staId);
4786 sme_ReleaseGlobalLock( &pMac->sme );
4787 }
4788
4789 return tlSTAState;
4790}
4791
4792/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004793
4794 \fn sme_GetCountryCode
4795
4796 \brief To return the current country code. If no country code is applied, default country code is
4797 used to fill the buffer.
4798 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4799 This is a synchronous API.
4800
4801 \param pBuf - pointer to a caller allocated buffer for returned country code.
4802
4803 \param pbLen For input, this parameter indicates how big is the buffer.
4804 Upon return, this parameter has the number of bytes for country. If pBuf
4805 doesn't have enough space, this function returns
4806 fail status and this parameter contains the number that is needed.
4807
4808 \return eHalStatus SUCCESS.
4809
4810 FAILURE or RESOURCES The API finished and failed.
4811
4812 -------------------------------------------------------------------------------*/
4813eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4814{
4815 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4816
Katya Nigambcb705f2013-12-26 14:26:22 +05304817 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004818 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4819
Jeff Johnson295189b2012-06-20 16:38:30 -07004820 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4821}
4822
4823
4824/* ---------------------------------------------------------------------------
4825
4826 \fn sme_SetCountryCode
4827
4828 \brief To change the current/default country code.
4829 If 11d supported is turned off, an error is return.
4830 This is a synchronous API.
4831
4832 \param pCountry - pointer to a caller allocated buffer for the country code.
4833
4834 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4835 whether a reset is required.
4836
4837 \return eHalStatus SUCCESS.
4838
4839 FAILURE or RESOURCES The API finished and failed.
4840
4841 -------------------------------------------------------------------------------*/
4842eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4843{
4844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4845
Katya Nigambcb705f2013-12-26 14:26:22 +05304846 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004847 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004848 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4849}
4850
4851
4852/* ---------------------------------------------------------------------------
4853 \fn sme_ResetCountryCodeInformation
4854 \brief this function is to reset the country code current being used back to EEPROM default
4855 this includes channel list and power setting. This is a synchronous API.
4856 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4857 a restart is needed to apply the change
4858 \return eHalStatus
4859 -------------------------------------------------------------------------------*/
4860eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4861{
4862 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4863
4864 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4865}
4866
4867
4868/* ---------------------------------------------------------------------------
4869 \fn sme_GetSupportedCountryCode
4870 \brief this function is to get a list of the country code current being supported
4871 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4872 this has the country code list. 3 bytes for each country code. This may be NULL if
4873 caller wants to know the needed byte count.
4874 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4875 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4876 \return eHalStatus
4877 -------------------------------------------------------------------------------*/
4878eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4879{
4880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4881
4882 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4883}
4884
4885
4886/* ---------------------------------------------------------------------------
4887 \fn sme_GetCurrentRegulatoryDomain
4888 \brief this function is to get the current regulatory domain. This is a synchronous API.
4889 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4890 SME. The function fails if 11d support is turned off.
4891 \param pDomain - Caller allocated buffer to return the current domain.
4892 \return eHalStatus SUCCESS.
4893
4894 FAILURE or RESOURCES The API finished and failed.
4895 -------------------------------------------------------------------------------*/
4896eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4897{
4898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4899 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4900
4901 if( pDomain )
4902 {
4903 if( csrIs11dSupported( pMac ) )
4904 {
4905 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4906 status = eHAL_STATUS_SUCCESS;
4907 }
4908 else
4909 {
4910 status = eHAL_STATUS_FAILURE;
4911 }
4912 }
4913
4914 return ( status );
4915}
4916
4917
4918/* ---------------------------------------------------------------------------
4919 \fn sme_SetRegulatoryDomain
4920 \brief this function is to set the current regulatory domain.
4921 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4922 SME. This is a synchronous API.
4923 \param domainId - indicate the domain (defined in the driver) needs to set to.
4924 See v_REGDOMAIN_t for definition
4925 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4926 a restart is needed to apply the change
4927 \return eHalStatus
4928 -------------------------------------------------------------------------------*/
4929eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4930{
4931 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4932
4933 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4934}
4935
4936
4937/* ---------------------------------------------------------------------------
4938
4939 \fn sme_GetRegulatoryDomainForCountry
4940
4941 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4942
4943 \param pCountry - pointer to a caller allocated buffer for input country code.
4944
4945 \param pDomainId Upon successful return, it is the domain that country belongs to.
4946 If it is NULL, returning success means that the country code is known.
4947
4948 \return eHalStatus SUCCESS.
4949
4950 FAILURE or RESOURCES The API finished and failed.
4951
4952 -------------------------------------------------------------------------------*/
4953eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4954{
4955 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4956
Kiet Lam6c583332013-10-14 05:37:09 +05304957 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4958 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004959}
4960
4961
4962
4963
4964/* ---------------------------------------------------------------------------
4965
4966 \fn sme_GetSupportedRegulatoryDomains
4967
4968 \brief To return a list of supported regulatory domains. This is a synchronous API.
4969
4970 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4971
4972 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4973 Upon return, this parameter has the number for supported domains. If pDomains
4974 doesn't have enough space for all the supported domains, this function returns
4975 fail status and this parameter contains the number that is needed.
4976
4977 \return eHalStatus SUCCESS.
4978
4979 FAILURE or RESOURCES The API finished and failed.
4980
4981 -------------------------------------------------------------------------------*/
4982eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4983{
4984 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4985
4986 //We support all domains for now
4987 if( pNumDomains )
4988 {
4989 if( NUM_REG_DOMAINS <= *pNumDomains )
4990 {
4991 status = eHAL_STATUS_SUCCESS;
4992 }
4993 *pNumDomains = NUM_REG_DOMAINS;
4994 }
4995 if( HAL_STATUS_SUCCESS( status ) )
4996 {
4997 if( pDomains )
4998 {
4999 pDomains[0] = REGDOMAIN_FCC;
5000 pDomains[1] = REGDOMAIN_ETSI;
5001 pDomains[2] = REGDOMAIN_JAPAN;
5002 pDomains[3] = REGDOMAIN_WORLD;
5003 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5004 pDomains[5] = REGDOMAIN_APAC;
5005 pDomains[6] = REGDOMAIN_KOREA;
5006 pDomains[7] = REGDOMAIN_HI_5GHZ;
5007 pDomains[8] = REGDOMAIN_NO_5GHZ;
5008 }
5009 else
5010 {
5011 status = eHAL_STATUS_INVALID_PARAMETER;
5012 }
5013 }
5014
5015 return ( status );
5016}
5017
5018
5019//some support functions
5020tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5021{
5022 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5023
5024 return ( csrIs11dSupported( pMac ) );
5025}
5026
5027
5028tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5029{
5030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5031
5032 return ( csrIs11hSupported( pMac ) );
5033}
5034
5035
5036tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5037{
5038 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5039
5040 return ( csrIsWmmSupported( pMac ) );
5041}
5042
5043//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5044eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5045{
5046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5047
5048 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5049}
5050
5051/* ---------------------------------------------------------------------------
5052
5053 \fn sme_ChangeCountryCode
5054
5055 \brief Change Country code from upperlayer during WLAN driver operation.
5056 This is a synchronous API.
5057
5058 \param hHal - The handle returned by macOpen.
5059
5060 \param pCountry New Country Code String
5061
Abhishek Singha306a442013-11-07 18:39:01 +05305062 \param sendRegHint If we want to send reg hint to nl80211
5063
Jeff Johnson295189b2012-06-20 16:38:30 -07005064 \return eHalStatus SUCCESS.
5065
5066 FAILURE or RESOURCES The API finished and failed.
5067
5068 -------------------------------------------------------------------------------*/
5069eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5070 tSmeChangeCountryCallback callback,
5071 tANI_U8 *pCountry,
5072 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305073 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305074 tAniBool countryFromUserSpace,
5075 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005076{
5077 eHalStatus status = eHAL_STATUS_FAILURE;
5078 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5079 vos_msg_t msg;
5080 tAniChangeCountryCodeReq *pMsg;
5081
Katya Nigambcb705f2013-12-26 14:26:22 +05305082 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005083 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005084 status = sme_AcquireGlobalLock( &pMac->sme );
5085 if ( HAL_STATUS_SUCCESS( status ) )
5086 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005087 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005088
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305089 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005090 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5091 {
5092
5093 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5094
5095 sme_ReleaseGlobalLock( &pMac->sme );
5096 status = eHAL_STATUS_FAILURE;
5097 return status;
5098 }
5099
Kiet Lam64c1b492013-07-12 13:56:44 +05305100 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5101 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005102 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005103 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005104 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305105 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005106 }
5107
5108 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5109 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305110 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305111 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305112 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005113 pMsg->changeCCCallback = callback;
5114 pMsg->pDevContext = pContext;
5115 pMsg->pVosContext = pVosContext;
5116
5117 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5118 msg.bodyptr = pMsg;
5119 msg.reserved = 0;
5120
5121 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5122 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005123 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305124 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005125 status = eHAL_STATUS_FAILURE;
5126 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005127 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005128 sme_ReleaseGlobalLock( &pMac->sme );
5129 }
5130
5131 return (status);
5132}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005133
5134/*--------------------------------------------------------------------------
5135
5136 \fn sme_GenericChangeCountryCode
5137
5138 \brief Change Country code from upperlayer during WLAN driver operation.
5139 This is a synchronous API.
5140
5141 \param hHal - The handle returned by macOpen.
5142
5143 \param pCountry New Country Code String
5144
5145 \param reg_domain regulatory domain
5146
5147 \return eHalStatus SUCCESS.
5148
5149 FAILURE or RESOURCES The API finished and failed.
5150
5151-----------------------------------------------------------------------------*/
5152eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5153 tANI_U8 *pCountry,
5154 v_REGDOMAIN_t reg_domain)
5155{
5156 eHalStatus status = eHAL_STATUS_FAILURE;
5157 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5158 vos_msg_t msg;
5159 tAniGenericChangeCountryCodeReq *pMsg;
5160
Kiet Lamcffc5862013-10-30 16:28:45 +05305161 if (NULL == pMac)
5162 {
5163 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5164 "%s: pMac is null", __func__);
5165 return status;
5166 }
5167
Amar Singhal0d15bd52013-10-12 23:13:13 -07005168 status = sme_AcquireGlobalLock( &pMac->sme );
5169 if ( HAL_STATUS_SUCCESS( status ) )
5170 {
5171 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305172 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5173 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005174 {
5175 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5176 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305177 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005178 }
5179
5180 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5181 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005182 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005183 pMsg->domain_index = reg_domain;
5184
5185 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5186 msg.bodyptr = pMsg;
5187 msg.reserved = 0;
5188
5189 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5190 {
5191 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305192 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005193 status = eHAL_STATUS_FAILURE;
5194 }
5195 smsLog(pMac, LOG1, FL(" returned"));
5196 sme_ReleaseGlobalLock( &pMac->sme );
5197 }
5198
5199 return (status);
5200}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305201
5202/* ---------------------------------------------------------------------------
5203
5204 \fn sme_InitChannels
5205
5206 \brief Used to initialize CSR channel lists while driver loading
5207
5208 \param hHal - global pMac structure
5209
5210 \return eHalStatus SUCCESS.
5211
5212 FAILURE or RESOURCES The API finished and failed.
5213
5214 -------------------------------------------------------------------------------*/
5215eHalStatus sme_InitChannels(tHalHandle hHal)
5216{
5217 eHalStatus status = eHAL_STATUS_FAILURE;
5218 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5219
5220 if (NULL == pMac)
5221 {
5222 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5223 "%s: pMac is null", __func__);
5224 return status;
5225 }
5226
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305227 status = csrInitChannels(pMac);
5228
Mihir Shetee1093ba2014-01-21 20:13:32 +05305229 return status;
5230}
5231
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305232/*-------------------------------------------------------------------------
5233 \fn sme_InitChannelsForCC
5234
5235 \brief Used to issue regulatory hint to user
5236
5237 \param hHal - global pMac structure
5238
5239 \return eHalStatus SUCCESS.
5240
5241 FAILURE or RESOURCES The API finished and failed.
5242--------------------------------------------------------------------------*/
5243
5244eHalStatus sme_InitChannelsForCC(tHalHandle hHal)
5245{
5246 eHalStatus status = eHAL_STATUS_FAILURE;
5247 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5248
5249 if (NULL == pMac)
5250 {
5251 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5252 "%s: pMac is null", __func__);
5253 return status;
5254 }
5255 status = csrInitChannelsForCC(pMac);
5256
5257 return status;
5258}
5259
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305260/* ---------------------------------------------------------------------------
5261
5262 \fn sme_DHCPStartInd
5263
5264 \brief API to signal the FW about the DHCP Start event.
5265
5266 \param hHal - HAL handle for device.
5267
5268 \param device_mode - mode(AP,SAP etc) of the device.
5269
5270 \param macAddr - MAC address of the device.
5271
5272 \return eHalStatus SUCCESS.
5273
5274 FAILURE or RESOURCES The API finished and failed.
5275 --------------------------------------------------------------------------*/
5276eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5277 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305278 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305279{
5280 eHalStatus status;
5281 VOS_STATUS vosStatus;
5282 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5283 vos_msg_t vosMessage;
5284 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305285 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305286
5287 status = sme_AcquireGlobalLock(&pMac->sme);
5288 if ( eHAL_STATUS_SUCCESS == status)
5289 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305290 pSession = CSR_GET_SESSION( pMac, sessionId );
5291
5292 if (!pSession)
5293 {
5294 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5295 sme_ReleaseGlobalLock( &pMac->sme );
5296 return eHAL_STATUS_FAILURE;
5297 }
5298
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305299 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5300 if (NULL == pMsg)
5301 {
5302 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5303 "%s: Not able to allocate memory for dhcp start", __func__);
5304 sme_ReleaseGlobalLock( &pMac->sme );
5305 return eHAL_STATUS_FAILURE;
5306 }
5307 pMsg->msgType = WDA_DHCP_START_IND;
5308 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5309 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305310 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5311 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305312 vosMessage.type = WDA_DHCP_START_IND;
5313 vosMessage.bodyptr = pMsg;
5314 vosMessage.reserved = 0;
5315
5316 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5317 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5318 {
5319 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5320 "%s: Post DHCP Start MSG fail", __func__);
5321 vos_mem_free(pMsg);
5322 status = eHAL_STATUS_FAILURE;
5323 }
5324 sme_ReleaseGlobalLock( &pMac->sme );
5325 }
5326 return (status);
5327}
5328/* ---------------------------------------------------------------------------
5329 \fn sme_DHCPStopInd
5330
5331 \brief API to signal the FW about the DHCP complete event.
5332
5333 \param hHal - HAL handle for device.
5334
5335 \param device_mode - mode(AP, SAP etc) of the device.
5336
5337 \param macAddr - MAC address of the device.
5338
5339 \return eHalStatus SUCCESS.
5340 FAILURE or RESOURCES The API finished and failed.
5341 --------------------------------------------------------------------------*/
5342eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5343 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305344 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305345{
5346 eHalStatus status;
5347 VOS_STATUS vosStatus;
5348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5349 vos_msg_t vosMessage;
5350 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305351 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305352
5353 status = sme_AcquireGlobalLock(&pMac->sme);
5354 if ( eHAL_STATUS_SUCCESS == status)
5355 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305356 pSession = CSR_GET_SESSION( pMac, sessionId );
5357
5358 if (!pSession)
5359 {
5360 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5361 sme_ReleaseGlobalLock( &pMac->sme );
5362 return eHAL_STATUS_FAILURE;
5363 }
5364
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305365 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5366 if (NULL == pMsg)
5367 {
5368 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5369 "%s: Not able to allocate memory for dhcp stop", __func__);
5370 sme_ReleaseGlobalLock( &pMac->sme );
5371 return eHAL_STATUS_FAILURE;
5372 }
5373
5374 pMsg->msgType = WDA_DHCP_STOP_IND;
5375 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5376 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305377 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5378 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305379
5380 vosMessage.type = WDA_DHCP_STOP_IND;
5381 vosMessage.bodyptr = pMsg;
5382 vosMessage.reserved = 0;
5383
5384 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5385 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5386 {
5387 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5388 "%s: Post DHCP Stop MSG fail", __func__);
5389 vos_mem_free(pMsg);
5390 status = eHAL_STATUS_FAILURE;
5391 }
5392
5393 sme_ReleaseGlobalLock( &pMac->sme );
5394 }
5395 return (status);
5396}
5397
Jeff Johnson295189b2012-06-20 16:38:30 -07005398
5399/* ---------------------------------------------------------------------------
5400 \fn sme_BtcSignalBtEvent
5401 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5402 BT event type and the current operating mode of Libra (full power,
5403 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5404 would be employed.
5405 \param hHal - The handle returned by macOpen.
5406 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5407 Caller owns the memory and is responsible for freeing it.
5408 \return VOS_STATUS
5409 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5410 if BTC execution mode is set to BTC_WLAN_ONLY
5411 or BTC_PTA_ONLY.
5412 VOS_STATUS_SUCCESS BT Event passed to HAL
5413 ---------------------------------------------------------------------------*/
5414VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5415{
5416 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005417
Jeff Johnson295189b2012-06-20 16:38:30 -07005418#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5419 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5420
Katya Nigambcb705f2013-12-26 14:26:22 +05305421 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005422 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005423 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5424 {
5425 status = btcSignalBTEvent (hHal, pBtEvent);
5426 sme_ReleaseGlobalLock( &pMac->sme );
5427 }
5428#endif
5429 return (status);
5430}
5431
5432/* ---------------------------------------------------------------------------
5433 \fn sme_BtcSetConfig
5434 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5435 This function should be invoked only after CFG download has completed.
5436 Calling it after sme_HDDReadyInd is recommended.
5437 \param hHal - The handle returned by macOpen.
5438 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5439 Caller owns the memory and is responsible for freeing it.
5440 \return VOS_STATUS
5441 VOS_STATUS_E_FAILURE Config not passed to HAL.
5442 VOS_STATUS_SUCCESS Config passed to HAL
5443 ---------------------------------------------------------------------------*/
5444VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5445{
5446 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5447#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305449 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005450 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005451 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5452 {
5453 status = btcSetConfig (hHal, pSmeBtcConfig);
5454 sme_ReleaseGlobalLock( &pMac->sme );
5455 }
5456#endif
5457 return (status);
5458}
5459
5460/* ---------------------------------------------------------------------------
5461 \fn sme_BtcGetConfig
5462 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5463 \param hHal - The handle returned by macOpen.
5464 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5465 tSmeBtcConfig. Caller owns the memory and is responsible
5466 for freeing it.
5467 \return VOS_STATUS
5468 VOS_STATUS_E_FAILURE - failure
5469 VOS_STATUS_SUCCESS success
5470 ---------------------------------------------------------------------------*/
5471VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5472{
5473 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5474#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5475 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5476
Katya Nigambcb705f2013-12-26 14:26:22 +05305477 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005478 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005479 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5480 {
5481 status = btcGetConfig (hHal, pSmeBtcConfig);
5482 sme_ReleaseGlobalLock( &pMac->sme );
5483 }
5484#endif
5485 return (status);
5486}
5487/* ---------------------------------------------------------------------------
5488 \fn sme_SetCfgPrivacy
5489 \brief API to set configure privacy parameters
5490 \param hHal - The handle returned by macOpen.
5491 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005492 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005493
5494 \return void
5495 ---------------------------------------------------------------------------*/
5496void sme_SetCfgPrivacy( tHalHandle hHal,
5497 tCsrRoamProfile *pProfile,
5498 tANI_BOOLEAN fPrivacy
5499 )
5500{
5501 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305502 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005503 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005504 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5505 {
5506 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5507 sme_ReleaseGlobalLock( &pMac->sme );
5508 }
5509}
5510
5511#if defined WLAN_FEATURE_VOWIFI
5512/* ---------------------------------------------------------------------------
5513 \fn sme_NeighborReportRequest
5514 \brief API to request neighbor report.
5515 \param hHal - The handle returned by macOpen.
5516 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5517 tRrmNeighborReq. Caller owns the memory and is responsible
5518 for freeing it.
5519 \return VOS_STATUS
5520 VOS_STATUS_E_FAILURE - failure
5521 VOS_STATUS_SUCCESS success
5522 ---------------------------------------------------------------------------*/
5523VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5524 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5525{
5526 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305528 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005529 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005530
5531 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5532 {
5533 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5534 sme_ReleaseGlobalLock( &pMac->sme );
5535 }
5536
5537 return (status);
5538}
5539#endif
5540
5541//The following are debug APIs to support direct read/write register/memory
5542//They are placed in SME because HW cannot be access when in LOW_POWER state
5543//AND not connected. The knowledge and synchronization is done in SME
5544
5545//sme_DbgReadRegister
5546//Caller needs to validate the input values
5547VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5548{
5549 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5550 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 tPmcPowerState PowerState;
5552 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305553 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005554 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005555
5556 /* 1) To make Quarky work in FTM mode **************************************/
5557
5558 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5559 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005560 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005561 {
5562 return VOS_STATUS_SUCCESS;
5563 }
5564 return VOS_STATUS_E_FAILURE;
5565 }
5566
5567 /* 2) NON FTM mode driver *************************************************/
5568
5569 /* Acquire SME global lock */
5570 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5571 {
5572 return VOS_STATUS_E_FAILURE;
5573 }
5574
5575 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5576 {
5577 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5578 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5579 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005580 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005581 {
5582 status = VOS_STATUS_SUCCESS;
5583 }
5584 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005585 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005586 status = VOS_STATUS_E_FAILURE;
5587 }
5588 }
5589 else
5590 {
5591 status = VOS_STATUS_E_FAILURE;
5592 }
5593 }
5594
5595 /* This is a hack for Qualky/pttWniSocket
5596 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5597 if ( VOS_STATUS_SUCCESS != status )
5598 {
5599 *pRegValue = 0xDEADBEEF;
5600 status = VOS_STATUS_SUCCESS;
5601 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005602
Jeff Johnson295189b2012-06-20 16:38:30 -07005603 /* Release SME global lock */
5604 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005605
Jeff Johnson295189b2012-06-20 16:38:30 -07005606 return (status);
5607}
5608
5609
5610//sme_DbgWriteRegister
5611//Caller needs to validate the input values
5612VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5613{
5614 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5615 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005616 tPmcPowerState PowerState;
5617 tANI_U32 sessionId = 0;
5618
5619 /* 1) To make Quarky work in FTM mode **************************************/
5620
Katya Nigambcb705f2013-12-26 14:26:22 +05305621 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005622 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005623 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5624 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005625 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005626 {
5627 return VOS_STATUS_SUCCESS;
5628 }
5629 return VOS_STATUS_E_FAILURE;
5630 }
5631
5632 /* 2) NON FTM mode driver *************************************************/
5633
5634 /* Acquire SME global lock */
5635 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5636 {
5637 return VOS_STATUS_E_FAILURE;
5638 }
5639
5640 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5641 {
5642 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5643 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5644 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005645 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005646 {
5647 status = VOS_STATUS_SUCCESS;
5648 }
5649 else
5650 {
5651 status = VOS_STATUS_E_FAILURE;
5652 }
5653 }
5654 else
5655 {
5656 status = VOS_STATUS_E_FAILURE;
5657 }
5658 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005659
Jeff Johnson295189b2012-06-20 16:38:30 -07005660 /* Release SME global lock */
5661 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005662
Jeff Johnson295189b2012-06-20 16:38:30 -07005663 return (status);
5664}
5665
5666
5667
5668//sme_DbgReadMemory
5669//Caller needs to validate the input values
5670//pBuf caller allocated buffer has the length of nLen
5671VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5672{
5673 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005675 tPmcPowerState PowerState;
5676 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005677 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5678 tANI_U32 arg1 = memAddr;
5679 tANI_U32 arg2 = nLen/4;
5680 tANI_U32 arg3 = 4;
5681 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005682 /* 1) To make Quarky work in FTM mode **************************************/
5683
Katya Nigambcb705f2013-12-26 14:26:22 +05305684 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005685 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005686 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5687 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005688 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005689 {
5690 return VOS_STATUS_SUCCESS;
5691 }
5692 return VOS_STATUS_E_FAILURE;
5693 }
5694
5695 /* 2) NON FTM mode driver *************************************************/
5696
5697 /* Acquire SME global lock */
5698 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5699 {
5700 return VOS_STATUS_E_FAILURE;
5701 }
5702
5703 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5704 {
5705 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5706 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5707 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005708 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005709 {
5710 status = VOS_STATUS_SUCCESS;
5711 }
5712 else
5713 {
5714 status = VOS_STATUS_E_FAILURE;
5715 }
5716 }
5717 else
5718 {
5719 status = VOS_STATUS_E_FAILURE;
5720 }
5721 }
5722
5723 /* This is a hack for Qualky/pttWniSocket
5724 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5725 if (VOS_STATUS_SUCCESS != status)
5726 {
5727 vos_mem_set(pBuf, nLen, 0xCD);
5728 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005729 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005730 }
5731
5732 /* Release SME lock */
5733 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005734
Jeff Johnson295189b2012-06-20 16:38:30 -07005735 return (status);
5736}
5737
5738
5739//sme_DbgWriteMemory
5740//Caller needs to validate the input values
5741VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5742{
5743 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5744 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005745 tPmcPowerState PowerState;
5746 tANI_U32 sessionId = 0;
5747
5748 /* 1) To make Quarky work in FTM mode **************************************/
5749
Katya Nigambcb705f2013-12-26 14:26:22 +05305750 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005751 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005752 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5753 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005754 {
5755 return VOS_STATUS_SUCCESS;
5756 }
5757 return VOS_STATUS_E_FAILURE;
5758 }
5759
5760 /* 2) NON FTM mode driver *************************************************/
5761
5762 /* Acquire SME global lock */
5763 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5764 {
5765 return VOS_STATUS_E_FAILURE;
5766 }
5767
5768 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5769 {
5770 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5771 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5772 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005773 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005774 {
5775 status = VOS_STATUS_SUCCESS;
5776 }
5777 else
5778 {
5779 status = VOS_STATUS_E_FAILURE;
5780 }
5781 }
5782 else
5783 {
5784 status = VOS_STATUS_E_FAILURE;
5785 }
5786 }
5787
5788 /* Release Global lock */
5789 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005790
Jeff Johnson295189b2012-06-20 16:38:30 -07005791 return (status);
5792}
5793
5794
Katya Nigam70d68332013-09-16 16:49:45 +05305795void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5796{
5797 VOS_TRACE_LEVEL vosDebugLevel;
5798 char logBuffer[LOG_SIZE];
5799 va_list marker;
5800
5801 /* getting proper Debug level */
5802 vosDebugLevel = getVosDebugLevel(loglevel);
5803
5804 /* extracting arguments from pstring */
5805 va_start( marker, pString );
5806 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5807
5808 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5809 va_end( marker );
5810}
5811
5812
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005813void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005814{
5815#ifdef WLAN_DEBUG
5816 // Verify against current log level
5817 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5818 return;
5819 else
5820 {
5821 va_list marker;
5822
5823 va_start( marker, pString ); /* Initialize variable arguments. */
5824
5825 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5826
5827 va_end( marker ); /* Reset variable arguments. */
5828 }
5829#endif
5830}
Jeff Johnson295189b2012-06-20 16:38:30 -07005831
Jeff Johnson295189b2012-06-20 16:38:30 -07005832/* ---------------------------------------------------------------------------
5833 \fn sme_GetWcnssWlanCompiledVersion
5834 \brief This API returns the version of the WCNSS WLAN API with
5835 which the HOST driver was built
5836 \param hHal - The handle returned by macOpen.
5837 \param pVersion - Points to the Version structure to be filled
5838 \return VOS_STATUS
5839 VOS_STATUS_E_INVAL - failure
5840 VOS_STATUS_SUCCESS success
5841 ---------------------------------------------------------------------------*/
5842VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5843 tSirVersionType *pVersion)
5844{
5845 VOS_STATUS status = VOS_STATUS_SUCCESS;
5846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5847 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5848
5849 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5850 {
5851 if( pVersion != NULL )
5852 {
5853 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5854 }
5855 else
5856 {
5857 status = VOS_STATUS_E_INVAL;
5858 }
5859 sme_ReleaseGlobalLock( &pMac->sme );
5860 }
5861
5862 return (status);
5863}
5864
5865
5866/* ---------------------------------------------------------------------------
5867 \fn sme_GetWcnssWlanReportedVersion
5868 \brief This API returns the version of the WCNSS WLAN API with
5869 which the WCNSS driver reports it was built
5870 \param hHal - The handle returned by macOpen.
5871 \param pVersion - Points to the Version structure to be filled
5872 \return VOS_STATUS
5873 VOS_STATUS_E_INVAL - failure
5874 VOS_STATUS_SUCCESS success
5875 ---------------------------------------------------------------------------*/
5876VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5877 tSirVersionType *pVersion)
5878{
5879 VOS_STATUS status = VOS_STATUS_SUCCESS;
5880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5881 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5882
5883 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5884 {
5885 if( pVersion != NULL )
5886 {
5887 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5888 }
5889 else
5890 {
5891 status = VOS_STATUS_E_INVAL;
5892 }
5893 sme_ReleaseGlobalLock( &pMac->sme );
5894 }
5895
5896 return (status);
5897}
5898
5899
5900/* ---------------------------------------------------------------------------
5901 \fn sme_GetWcnssSoftwareVersion
5902 \brief This API returns the version string of the WCNSS driver
5903 \param hHal - The handle returned by macOpen.
5904 \param pVersion - Points to the Version string buffer to be filled
5905 \param versionBufferSize - THe size of the Version string buffer
5906 \return VOS_STATUS
5907 VOS_STATUS_E_INVAL - failure
5908 VOS_STATUS_SUCCESS success
5909 ---------------------------------------------------------------------------*/
5910VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5911 tANI_U8 *pVersion,
5912 tANI_U32 versionBufferSize)
5913{
5914 VOS_STATUS status = VOS_STATUS_SUCCESS;
5915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5916 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5917
5918 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5919 {
5920 if( pVersion != NULL )
5921 {
5922 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5923 versionBufferSize);
5924 }
5925 else
5926 {
5927 status = VOS_STATUS_E_INVAL;
5928 }
5929 sme_ReleaseGlobalLock( &pMac->sme );
5930 }
5931
5932 return (status);
5933}
5934
5935
5936/* ---------------------------------------------------------------------------
5937 \fn sme_GetWcnssHardwareVersion
5938 \brief This API returns the version string of the WCNSS hardware
5939 \param hHal - The handle returned by macOpen.
5940 \param pVersion - Points to the Version string buffer to be filled
5941 \param versionBufferSize - THe size of the Version string buffer
5942 \return VOS_STATUS
5943 VOS_STATUS_E_INVAL - failure
5944 VOS_STATUS_SUCCESS success
5945 ---------------------------------------------------------------------------*/
5946VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5947 tANI_U8 *pVersion,
5948 tANI_U32 versionBufferSize)
5949{
5950 VOS_STATUS status = VOS_STATUS_SUCCESS;
5951 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5952 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5953
5954 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5955 {
5956 if( pVersion != NULL )
5957 {
5958 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5959 versionBufferSize);
5960 }
5961 else
5962 {
5963 status = VOS_STATUS_E_INVAL;
5964 }
5965 sme_ReleaseGlobalLock( &pMac->sme );
5966 }
5967
5968 return (status);
5969}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005970
Jeff Johnson295189b2012-06-20 16:38:30 -07005971
5972#ifdef FEATURE_WLAN_WAPI
5973/* ---------------------------------------------------------------------------
5974 \fn sme_RoamSetBKIDCache
5975 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5976 candidate list.
5977 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5978 it is opened (by calling halOpen).
5979 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5980 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5981 when retruning, this is the number of items put into pBKIDCache
5982 \return eHalStatus - when fail, it usually means the buffer allocated is not
5983 big enough and pNumItems has the number of tBkidCacheInfo.
5984 ---------------------------------------------------------------------------*/
5985eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5986 tANI_U32 numItems )
5987{
5988 eHalStatus status = eHAL_STATUS_FAILURE;
5989 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5990
5991 status = sme_AcquireGlobalLock( &pMac->sme );
5992 if ( HAL_STATUS_SUCCESS( status ) )
5993 {
5994 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5995 sme_ReleaseGlobalLock( &pMac->sme );
5996 }
5997
5998 return (status);
5999}
6000
6001/* ---------------------------------------------------------------------------
6002 \fn sme_RoamGetBKIDCache
6003 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6004 BKID cache.
6005 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6006 it is opened (by calling halOpen).
6007 \param pNum - caller allocated memory that has the space of the number of
6008 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6009 in SME cache.
6010 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6011 upon return
6012 \return eHalStatus - when fail, it usually means the buffer allocated is not
6013 big enough.
6014 ---------------------------------------------------------------------------*/
6015eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6016 tBkidCacheInfo *pBkidCache)
6017{
6018 eHalStatus status = eHAL_STATUS_FAILURE;
6019 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6020
6021 status = sme_AcquireGlobalLock( &pMac->sme );
6022 if ( HAL_STATUS_SUCCESS( status ) )
6023 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006024 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006025 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6026 sme_ReleaseGlobalLock( &pMac->sme );
6027 }
6028
6029 return (status);
6030}
6031
6032/* ---------------------------------------------------------------------------
6033 \fn sme_RoamGetNumBKIDCache
6034 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6035 number of BKID cache entries.
6036 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6037 it is opened (by calling halOpen).
6038 \return tANI_U32 - the number of BKID cache entries.
6039 ---------------------------------------------------------------------------*/
6040tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6041{
6042 eHalStatus status = eHAL_STATUS_FAILURE;
6043 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6044 tANI_U32 numBkidCache = 0;
6045
6046 status = sme_AcquireGlobalLock( &pMac->sme );
6047 if ( HAL_STATUS_SUCCESS( status ) )
6048 {
6049 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6050 sme_ReleaseGlobalLock( &pMac->sme );
6051 }
6052
6053 return (numBkidCache);
6054}
6055
6056/* ---------------------------------------------------------------------------
6057 \fn sme_ScanGetBKIDCandidateList
6058 \brief a wrapper function to return the BKID candidate list
6059 \param pBkidList - caller allocated buffer point to an array of
6060 tBkidCandidateInfo
6061 \param pNumItems - pointer to a variable that has the number of
6062 tBkidCandidateInfo allocated when retruning, this is
6063 either the number needed or number of items put into
6064 pPmkidList
6065 \return eHalStatus - when fail, it usually means the buffer allocated is not
6066 big enough and pNumItems
6067 has the number of tBkidCandidateInfo.
6068 \Note: pNumItems is a number of tBkidCandidateInfo,
6069 not sizeof(tBkidCandidateInfo) * something
6070 ---------------------------------------------------------------------------*/
6071eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6072 tBkidCandidateInfo *pBkidList,
6073 tANI_U32 *pNumItems )
6074{
6075 eHalStatus status = eHAL_STATUS_FAILURE;
6076 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6077
6078 status = sme_AcquireGlobalLock( &pMac->sme );
6079 if ( HAL_STATUS_SUCCESS( status ) )
6080 {
6081 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6082 sme_ReleaseGlobalLock( &pMac->sme );
6083 }
6084
6085 return (status);
6086}
6087#endif /* FEATURE_WLAN_WAPI */
6088
Jeff Johnsone7245742012-09-05 17:12:55 -07006089#ifdef FEATURE_OEM_DATA_SUPPORT
6090
6091/*****************************************************************************
6092 OEM DATA related modifications and function additions
6093 *****************************************************************************/
6094
6095/* ---------------------------------------------------------------------------
6096 \fn sme_getOemDataRsp
6097 \brief a wrapper function to obtain the OEM DATA RSP
6098 \param pOemDataRsp - A pointer to the response object
6099 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006100 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006101 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006102eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006103 tOemDataRsp **pOemDataRsp)
6104{
6105 eHalStatus status = eHAL_STATUS_SUCCESS;
6106 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6107
6108 do
6109 {
6110 //acquire the lock for the sme object
6111 status = sme_AcquireGlobalLock(&pMac->sme);
6112
6113 if(!HAL_STATUS_SUCCESS(status))
6114 {
6115 break;
6116 }
6117
6118 if(pMac->oemData.pOemDataRsp != NULL)
6119 {
6120 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6121 }
6122 else
6123 {
6124 status = eHAL_STATUS_FAILURE;
6125 }
6126
6127 //release the lock for the sme object
6128 sme_ReleaseGlobalLock( &pMac->sme );
6129
6130 } while(0);
6131
6132 return status;
6133}
6134
6135/* ---------------------------------------------------------------------------
6136 \fn sme_OemDataReq
6137 \brief a wrapper function for OEM DATA REQ
6138 \param sessionId - session id to be used.
6139 \param pOemDataReqId - pointer to an object to get back the request ID
6140 \param callback - a callback function that is called upon finish
6141 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006142 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006143 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006144eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006145 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006146 tOemDataReqConfig *pOemDataReqConfig,
6147 tANI_U32 *pOemDataReqID,
6148 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006149 void *pContext)
6150{
6151 eHalStatus status = eHAL_STATUS_SUCCESS;
6152 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6153
6154 do
6155 {
6156 //acquire the lock for the sme object
6157 status = sme_AcquireGlobalLock(&pMac->sme);
6158 if(HAL_STATUS_SUCCESS(status))
6159 {
6160 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6161
6162 if(pOemDataReqID)
6163 {
6164 *pOemDataReqID = lOemDataReqId;
6165 }
6166 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006167 {
6168 sme_ReleaseGlobalLock( &pMac->sme );
6169 return eHAL_STATUS_FAILURE;
6170 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006171
6172 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6173
6174 //release the lock for the sme object
6175 sme_ReleaseGlobalLock( &pMac->sme );
6176 }
6177 } while(0);
6178
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006179 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006180
6181 return(status);
6182}
6183
6184#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006185
6186/*--------------------------------------------------------------------------
6187
6188 \brief sme_OpenSession() - Open a session for scan/roam operation.
6189
6190 This is a synchronous API.
6191
6192
6193 \param hHal - The handle returned by macOpen.
6194 \param callback - A pointer to the function caller specifies for roam/connect status indication
6195 \param pContext - The context passed with callback
6196 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6197 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6198
6199 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6200
6201 Other status means SME is failed to open the session.
6202 eHAL_STATUS_RESOURCES - no more session available.
6203 \sa
6204
6205 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006206eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6207 void *pContext, tANI_U8 *pSelfMacAddr,
6208 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006209{
6210 eHalStatus status;
6211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6212
6213 if( NULL == pbSessionId )
6214 {
6215 status = eHAL_STATUS_INVALID_PARAMETER;
6216 }
6217 else
6218 {
6219 status = sme_AcquireGlobalLock( &pMac->sme );
6220 if ( HAL_STATUS_SUCCESS( status ) )
6221 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006222 status = csrRoamOpenSession(pMac, callback, pContext,
6223 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006224
6225 sme_ReleaseGlobalLock( &pMac->sme );
6226 }
6227 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006228 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306229 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006230 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006231
6232 return ( status );
6233}
6234
6235
6236/*--------------------------------------------------------------------------
6237
6238 \brief sme_CloseSession() - Open a session for scan/roam operation.
6239
6240 This is a synchronous API.
6241
6242
6243 \param hHal - The handle returned by macOpen.
6244
6245 \param sessionId - A previous opened session's ID.
6246
6247 \return eHAL_STATUS_SUCCESS - session is closed.
6248
6249 Other status means SME is failed to open the session.
6250 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6251 \sa
6252
6253 --------------------------------------------------------------------------*/
6254eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6255 csrRoamSessionCloseCallback callback, void *pContext)
6256{
6257 eHalStatus status;
6258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6259
Katya Nigambcb705f2013-12-26 14:26:22 +05306260 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006261 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006262 status = sme_AcquireGlobalLock( &pMac->sme );
6263 if ( HAL_STATUS_SUCCESS( status ) )
6264 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006265 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006266 callback, pContext );
6267
6268 sme_ReleaseGlobalLock( &pMac->sme );
6269 }
6270
6271 return ( status );
6272}
6273
Jeff Johnson295189b2012-06-20 16:38:30 -07006274/* ---------------------------------------------------------------------------
6275
6276 \fn sme_RoamUpdateAPWPSIE
6277
6278 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6279 This is an asynchronous API.
6280
6281 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6282
6283 \return eHalStatus – SUCCESS –
6284
6285 FAILURE or RESOURCES – The API finished and failed.
6286
6287 -------------------------------------------------------------------------------*/
6288eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6289{
6290
6291 eHalStatus status = eHAL_STATUS_FAILURE;
6292 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6293
6294 status = sme_AcquireGlobalLock( &pMac->sme );
6295 if ( HAL_STATUS_SUCCESS( status ) )
6296 {
6297
6298 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6299
6300 sme_ReleaseGlobalLock( &pMac->sme );
6301 }
6302
6303 return (status);
6304}
6305/* ---------------------------------------------------------------------------
6306
6307 \fn sme_RoamUpdateAPWPARSNIEs
6308
6309 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6310 This is an asynchronous API.
6311
6312 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6313
6314 \return eHalStatus – SUCCESS –
6315
6316 FAILURE or RESOURCES – The API finished and failed.
6317
6318 -------------------------------------------------------------------------------*/
6319eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6320{
6321
6322 eHalStatus status = eHAL_STATUS_FAILURE;
6323 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6324
6325 status = sme_AcquireGlobalLock( &pMac->sme );
6326 if ( HAL_STATUS_SUCCESS( status ) )
6327 {
6328
6329 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6330
6331 sme_ReleaseGlobalLock( &pMac->sme );
6332 }
6333
6334 return (status);
6335}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006336/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006337
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006338 \fn sme_ChangeMCCBeaconInterval
6339
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006340 \brief To update P2P-GO beaconInterval. This function should be called after
6341 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006342 This is an asynchronous API.
6343
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006344 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006345
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006346 \return eHalStatus SUCCESS
6347 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006348 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006349
6350 -------------------------------------------------------------------------------*/
6351eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6352{
6353 eHalStatus status = eHAL_STATUS_FAILURE;
6354 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6355
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006356 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006357 status = sme_AcquireGlobalLock( &pMac->sme );
6358 if ( HAL_STATUS_SUCCESS( status ) )
6359 {
6360 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6361 sme_ReleaseGlobalLock( &pMac->sme );
6362 }
6363 return (status);
6364}
Jeff Johnson295189b2012-06-20 16:38:30 -07006365
6366/*-------------------------------------------------------------------------------*
6367
6368 \fn sme_sendBTAmpEvent
6369
6370 \brief to receive the coex priorty request from BT-AMP PAL
6371 and send the BT_AMP link state to HAL
6372
6373 \param btAmpEvent - btAmpEvent
6374
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006375 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006376
6377 FAILURE: API failed
6378
6379-------------------------------------------------------------------------------*/
6380
6381eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6382{
6383 vos_msg_t msg;
6384 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6385 eHalStatus status = eHAL_STATUS_FAILURE;
6386
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006387 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006388 if (NULL == ptrSmeBtAmpEvent)
6389 {
6390 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006391 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006392 return status;
6393 }
6394
6395 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6396 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6397 msg.reserved = 0;
6398 msg.bodyptr = ptrSmeBtAmpEvent;
6399
6400 //status = halFW_SendBTAmpEventMesg(pMac, event);
6401
6402 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6403 {
6404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006405 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006406 vos_mem_free(ptrSmeBtAmpEvent);
6407 return status;
6408 }
6409
6410 return eHAL_STATUS_SUCCESS;
6411
6412}
6413
6414/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306415 \fn smeIssueFastRoamNeighborAPEvent
6416 \brief API to trigger fast BSS roam independent of RSSI triggers
6417 \param hHal - The handle returned by macOpen.
6418 \param bssid - Pointer to the BSSID to roam to.
6419 \param fastRoamTrig - Trigger to Scan or roam
6420 \return eHalStatus
6421 ---------------------------------------------------------------------------*/
6422eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6423 tANI_U8 *bssid,
6424 tSmeFastRoamTrigger fastRoamTrig)
6425{
6426 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6427 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6428 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6429 eHalStatus status = eHAL_STATUS_SUCCESS;
6430
6431 status = sme_AcquireGlobalLock( &pMac->sme );
6432 if ( HAL_STATUS_SUCCESS( status ) )
6433 {
6434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6435 "%s: invoked", __func__);
6436
6437 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6438 {
6439 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6440 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6441 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6442 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006443 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6444 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306445
6446 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6447 if (VOS_STATUS_SUCCESS != vosStatus)
6448 {
6449 smsLog(pMac, LOGE,
6450 FL("CFG Channel list scan state failed with status %d "),
6451 vosStatus);
6452 }
6453 }
6454 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6455 {
6456 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6457 (void *)bssid, sizeof(tSirMacAddr));
6458 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006459 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6460 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306461
6462 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6463 0,
6464 pMac,
6465 0);
6466
6467 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6468 {
6469 smsLog(pMac,
6470 LOGE,
6471 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6472 vosStatus);
6473 }
6474 }
6475 sme_ReleaseGlobalLock( &pMac->sme );
6476 }
6477 return vosStatus;
6478}
6479/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006480 \fn sme_SetHostOffload
6481 \brief API to set the host offload feature.
6482 \param hHal - The handle returned by macOpen.
6483 \param pRequest - Pointer to the offload request.
6484 \return eHalStatus
6485 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006486eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006487 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006488{
6489 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006490 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006491
Katya Nigambcb705f2013-12-26 14:26:22 +05306492 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006493 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006494 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6495 {
6496#ifdef WLAN_NS_OFFLOAD
6497 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6498 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006499 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006500 }
6501 else
6502#endif //WLAN_NS_OFFLOAD
6503 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006504 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006505 }
6506 sme_ReleaseGlobalLock( &pMac->sme );
6507 }
6508
6509 return (status);
6510}
6511
6512#ifdef WLAN_FEATURE_GTK_OFFLOAD
6513/* ---------------------------------------------------------------------------
6514 \fn sme_SetGTKOffload
6515 \brief API to set GTK offload information.
6516 \param hHal - The handle returned by macOpen.
6517 \param pRequest - Pointer to the GTK offload request.
6518 \return eHalStatus
6519 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006520eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006521 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006522{
6523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6524 eHalStatus status;
6525
Katya Nigambcb705f2013-12-26 14:26:22 +05306526 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006527 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006528 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6529 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006530 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006531 sme_ReleaseGlobalLock( &pMac->sme );
6532 }
6533
6534 return (status);
6535}
6536
6537/* ---------------------------------------------------------------------------
6538 \fn sme_GetGTKOffload
6539 \brief API to get GTK offload information.
6540 \param hHal - The handle returned by macOpen.
6541 \param pRequest - Pointer to the GTK offload response.
6542 \return eHalStatus
6543 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006544eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006545 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006546{
6547 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6548 eHalStatus status;
6549
Katya Nigambcb705f2013-12-26 14:26:22 +05306550 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006551 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006552 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6553 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006554 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006555 sme_ReleaseGlobalLock( &pMac->sme );
6556 }
6557
6558 return (status);
6559}
6560#endif // WLAN_FEATURE_GTK_OFFLOAD
6561
6562/* ---------------------------------------------------------------------------
6563 \fn sme_SetKeepAlive
6564 \brief API to set the Keep Alive feature.
6565 \param hHal - The handle returned by macOpen.
6566 \param pRequest - Pointer to the Keep Alive request.
6567 \return eHalStatus
6568 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006569eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006570 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006571{
6572 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6573 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006574 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6575 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006576 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006577 sme_ReleaseGlobalLock( &pMac->sme );
6578 }
6579
6580 return (status);
6581}
6582
6583#ifdef FEATURE_WLAN_SCAN_PNO
6584/* ---------------------------------------------------------------------------
6585 \fn sme_SetPreferredNetworkList
6586 \brief API to set the Preferred Network List Offload feature.
6587 \param hHal - The handle returned by macOpen.
6588 \param pRequest - Pointer to the offload request.
6589 \return eHalStatus
6590 ---------------------------------------------------------------------------*/
6591eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6592{
6593 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6594 eHalStatus status;
6595
6596 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6597 {
6598 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6599 sme_ReleaseGlobalLock( &pMac->sme );
6600 }
6601
6602 return (status);
6603}
6604
6605eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6606{
6607 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6608 eHalStatus status;
6609
6610 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6611 {
6612 pmcSetRssiFilter(hHal, rssiThreshold);
6613 sme_ReleaseGlobalLock( &pMac->sme );
6614 }
6615
6616 return (status);
6617}
6618
6619#endif // FEATURE_WLAN_SCAN_PNO
6620
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006621eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006622{
6623 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6624 eHalStatus status;
6625
Katya Nigambcb705f2013-12-26 14:26:22 +05306626 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006627 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006628 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6629 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006630 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006631 sme_ReleaseGlobalLock( &pMac->sme );
6632 }
6633
6634 return (status);
6635}
6636
6637/* ---------------------------------------------------------------------------
6638 \fn sme_AbortMacScan
6639 \brief API to cancel MAC scan.
6640 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306641 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306642 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006643 \return VOS_STATUS
6644 VOS_STATUS_E_FAILURE - failure
6645 VOS_STATUS_SUCCESS success
6646 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306647eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6648 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006649{
6650 eHalStatus status;
6651 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6652
Katya Nigambcb705f2013-12-26 14:26:22 +05306653 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006654 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 status = sme_AcquireGlobalLock( &pMac->sme );
6656 if ( HAL_STATUS_SUCCESS( status ) )
6657 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306658 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006659
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 sme_ReleaseGlobalLock( &pMac->sme );
6661 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006662
Jeff Johnson295189b2012-06-20 16:38:30 -07006663 return ( status );
6664}
6665
6666/* ----------------------------------------------------------------------------
6667 \fn sme_GetOperationChannel
6668 \brief API to get current channel on which STA is parked
6669 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006670 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006671 \returns eHAL_STATUS_SUCCESS
6672 eHAL_STATUS_FAILURE
6673-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006674eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006675{
Jeff Johnson295189b2012-06-20 16:38:30 -07006676 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6677 tCsrRoamSession *pSession;
6678
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006679 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006680 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006681 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006682
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006683 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006684 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006685 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006686 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6687 {
6688 *pChannel =pSession->connectedProfile.operationChannel;
6689 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006690 }
6691 }
6692 return eHAL_STATUS_FAILURE;
6693}// sme_GetOperationChannel ends here
6694
Jeff Johnson295189b2012-06-20 16:38:30 -07006695/* ---------------------------------------------------------------------------
6696
6697 \fn sme_RegisterMgtFrame
6698
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006699 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006700 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006701 \param matchData - data which needs to be matched before passing frame
6702 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006703 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006704 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006705 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006706eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006707 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6708{
6709 eHalStatus status = eHAL_STATUS_SUCCESS;
6710 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6711
Katya Nigambcb705f2013-12-26 14:26:22 +05306712 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006713 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006714 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6715 {
6716 tSirRegisterMgmtFrame *pMsg;
6717 tANI_U16 len;
6718 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006719
6720 if(!pSession)
6721 {
6722 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006723 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006724 return eHAL_STATUS_FAILURE;
6725 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006726
Jeff Johnson295189b2012-06-20 16:38:30 -07006727 if( !pSession->sessionActive )
6728 {
6729 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006730 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006731 sme_ReleaseGlobalLock( &pMac->sme );
6732 return eHAL_STATUS_FAILURE;
6733 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006734
Jeff Johnson295189b2012-06-20 16:38:30 -07006735 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6736
Kiet Lam64c1b492013-07-12 13:56:44 +05306737 pMsg = vos_mem_malloc(len);
6738 if ( NULL == pMsg )
6739 status = eHAL_STATUS_FAILURE;
6740 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006741 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306742 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6744 pMsg->length = len;
6745 pMsg->sessionId = sessionId;
6746 pMsg->registerFrame = VOS_TRUE;
6747 pMsg->frameType = frameType;
6748 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306749 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006750 status = palSendMBMessage(pMac->hHdd, pMsg);
6751 }
6752 sme_ReleaseGlobalLock( &pMac->sme );
6753 }
6754 return status;
6755}
6756
6757/* ---------------------------------------------------------------------------
6758
6759 \fn sme_DeregisterMgtFrame
6760
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006761 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006762 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006763 \param matchData - data which needs to be matched before passing frame
6764 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006765 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006766 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006767 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006768eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006769 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6770{
6771 eHalStatus status = eHAL_STATUS_SUCCESS;
6772 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6773
Katya Nigambcb705f2013-12-26 14:26:22 +05306774 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006775 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006776 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6777 {
6778 tSirRegisterMgmtFrame *pMsg;
6779 tANI_U16 len;
6780 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006781
6782 if(!pSession)
6783 {
6784 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006785 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006786 return eHAL_STATUS_FAILURE;
6787 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006788
6789 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006790 {
6791 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006792 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006793 sme_ReleaseGlobalLock( &pMac->sme );
6794 return eHAL_STATUS_FAILURE;
6795 }
6796
6797 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6798
Kiet Lam64c1b492013-07-12 13:56:44 +05306799 pMsg = vos_mem_malloc(len);
6800 if ( NULL == pMsg )
6801 status = eHAL_STATUS_FAILURE;
6802 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006803 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306804 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006805 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006806 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006807 pMsg->registerFrame = VOS_FALSE;
6808 pMsg->frameType = frameType;
6809 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306810 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006811 status = palSendMBMessage(pMac->hHdd, pMsg);
6812 }
6813 sme_ReleaseGlobalLock( &pMac->sme );
6814 }
6815 return status;
6816}
6817
6818/* ---------------------------------------------------------------------------
6819 \fn sme_RemainOnChannel
6820 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6821 \param hHal - The handle returned by macOpen.
6822 \param pRequest - channel
6823 \param duration - duration in ms
6824 \param callback - HDD registered callback to process reaminOnChannelRsp
6825 \param context - HDD Callback param
6826 \return eHalStatus
6827 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006828eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6829 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306830 remainOnChanCallback callback,
6831 void *pContext,
6832 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006833{
6834 eHalStatus status = eHAL_STATUS_SUCCESS;
6835 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6836
Katya Nigambcb705f2013-12-26 14:26:22 +05306837 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006838 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006839 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6840 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306841 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6842 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006843#ifdef WLAN_FEATURE_P2P_INTERNAL
6844 , eP2PRemainOnChnReasonUnknown
6845#endif
6846 );
6847 sme_ReleaseGlobalLock( &pMac->sme );
6848 }
6849 return(status);
6850}
6851
6852/* ---------------------------------------------------------------------------
6853 \fn sme_ReportProbeReq
6854 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6855 \param hHal - The handle returned by macOpen.
6856 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6857 \return eHalStatus
6858 ---------------------------------------------------------------------------*/
6859
6860#ifndef WLAN_FEATURE_CONCURRENT_P2P
6861eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6862{
6863 eHalStatus status = eHAL_STATUS_SUCCESS;
6864 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6865
6866 do
6867 {
6868 //acquire the lock for the sme object
6869 status = sme_AcquireGlobalLock(&pMac->sme);
6870 if(HAL_STATUS_SUCCESS(status))
6871 {
6872 /* call set in context */
6873 pMac->p2pContext.probeReqForwarding = flag;
6874 //release the lock for the sme object
6875 sme_ReleaseGlobalLock( &pMac->sme );
6876 }
6877 } while(0);
6878
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006879 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006880
6881 return(status);
6882}
6883
6884/* ---------------------------------------------------------------------------
6885 \fn sme_updateP2pIe
6886 \brief API to set the P2p Ie in p2p context
6887 \param hHal - The handle returned by macOpen.
6888 \param p2pIe - Ptr to p2pIe from HDD.
6889 \param p2pIeLength: length of p2pIe
6890 \return eHalStatus
6891 ---------------------------------------------------------------------------*/
6892
6893eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6894{
6895 eHalStatus status = eHAL_STATUS_SUCCESS;
6896 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6897
6898 //acquire the lock for the sme object
6899 status = sme_AcquireGlobalLock(&pMac->sme);
6900 if(HAL_STATUS_SUCCESS(status))
6901 {
6902 if(NULL != pMac->p2pContext.probeRspIe){
6903 vos_mem_free(pMac->p2pContext.probeRspIe);
6904 pMac->p2pContext.probeRspIeLength = 0;
6905 }
6906
6907 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6908 if (NULL == pMac->p2pContext.probeRspIe)
6909 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006910 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006911 pMac->p2pContext.probeRspIeLength = 0;
6912 status = eHAL_STATUS_FAILURE;
6913 }
6914 else
6915 {
6916 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6917
6918 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6919 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006920 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07006921 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6922 p2pIeLength);
6923 }
6924
6925 //release the lock for the sme object
6926 sme_ReleaseGlobalLock( &pMac->sme );
6927 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006928
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006929 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006930
6931 return(status);
6932}
6933#endif
6934
6935/* ---------------------------------------------------------------------------
6936 \fn sme_sendAction
6937 \brief API to send action frame from supplicant.
6938 \param hHal - The handle returned by macOpen.
6939 \return eHalStatus
6940 ---------------------------------------------------------------------------*/
6941
6942eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006943 const tANI_U8 *pBuf, tANI_U32 len,
6944 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006945{
6946 eHalStatus status = eHAL_STATUS_SUCCESS;
6947 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6948
Katya Nigambcb705f2013-12-26 14:26:22 +05306949 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006950 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006951 //acquire the lock for the sme object
6952 status = sme_AcquireGlobalLock(&pMac->sme);
6953 if(HAL_STATUS_SUCCESS(status))
6954 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006955 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006956 //release the lock for the sme object
6957 sme_ReleaseGlobalLock( &pMac->sme );
6958 }
6959
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006960 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006961
6962 return(status);
6963}
6964
6965eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6966{
6967 eHalStatus status = eHAL_STATUS_SUCCESS;
6968 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6969
Katya Nigambcb705f2013-12-26 14:26:22 +05306970 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006971 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006972 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6973 {
6974 status = p2pCancelRemainOnChannel (hHal, sessionId);
6975 sme_ReleaseGlobalLock( &pMac->sme );
6976 }
6977 return(status);
6978}
6979
6980//Power Save Related
6981eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6982{
6983 eHalStatus status = eHAL_STATUS_SUCCESS;
6984 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6985
6986 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6987 {
6988 status = p2pSetPs (hHal, data);
6989 sme_ReleaseGlobalLock( &pMac->sme );
6990 }
6991 return(status);
6992}
6993
Jeff Johnson295189b2012-06-20 16:38:30 -07006994
6995/* ---------------------------------------------------------------------------
6996
6997 \fn sme_ConfigureRxpFilter
6998
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006999 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007000 SME will pass this request to lower mac to set/reset the filter on RXP for
7001 multicast & broadcast traffic.
7002
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007003 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007004
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007005 hHal - The handle returned by macOpen.
7006
Jeff Johnson295189b2012-06-20 16:38:30 -07007007 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7008 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7009 on this param. In future we can use this as a mask to set various types of
7010 filters as suggested below:
7011 FILTER_ALL_MULTICAST:
7012 FILTER_ALL_BROADCAST:
7013 FILTER_ALL_MULTICAST_BROADCAST:
7014
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007015
7016 \return eHalStatus
7017
7018
Jeff Johnson295189b2012-06-20 16:38:30 -07007019--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007020eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007021 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7022{
7023 eHalStatus status = eHAL_STATUS_SUCCESS;
7024 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7025 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7026 vos_msg_t vosMessage;
7027
Katya Nigambcb705f2013-12-26 14:26:22 +05307028 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007029 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007030 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7031 {
7032 /* serialize the req through MC thread */
7033 vosMessage.bodyptr = wlanRxpFilterParam;
7034 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7035 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7036 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7037 {
7038 status = eHAL_STATUS_FAILURE;
7039 }
7040 sme_ReleaseGlobalLock( &pMac->sme );
7041 }
7042 return(status);
7043}
7044
Jeff Johnson295189b2012-06-20 16:38:30 -07007045/* ---------------------------------------------------------------------------
7046
7047 \fn sme_ConfigureSuspendInd
7048
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007049 \brief
7050 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007051 be suspended
7052
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007053 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007054
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007055 hHal - The handle returned by macOpen.
7056
Jeff Johnson295189b2012-06-20 16:38:30 -07007057 wlanSuspendParam- Depicts the wlan suspend params
7058
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007059
7060 \return eHalStatus
7061
7062
Jeff Johnson295189b2012-06-20 16:38:30 -07007063--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007064eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007065 tpSirWlanSuspendParam wlanSuspendParam)
7066{
7067 eHalStatus status = eHAL_STATUS_SUCCESS;
7068 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7069 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7070 vos_msg_t vosMessage;
7071
Katya Nigambcb705f2013-12-26 14:26:22 +05307072 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007073 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007074 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7075 {
7076 /* serialize the req through MC thread */
7077 vosMessage.bodyptr = wlanSuspendParam;
7078 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7079 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7080 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7081 {
7082 status = eHAL_STATUS_FAILURE;
7083 }
7084 sme_ReleaseGlobalLock( &pMac->sme );
7085 }
7086 return(status);
7087}
7088
7089/* ---------------------------------------------------------------------------
7090
7091 \fn sme_ConfigureResumeReq
7092
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007093 \brief
7094 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007095 be Resumed
7096
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007097 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007098
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007099 hHal - The handle returned by macOpen.
7100
Jeff Johnson295189b2012-06-20 16:38:30 -07007101 wlanResumeParam- Depicts the wlan resume params
7102
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007103
7104 \return eHalStatus
7105
7106
Jeff Johnson295189b2012-06-20 16:38:30 -07007107--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007108eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007109 tpSirWlanResumeParam wlanResumeParam)
7110{
7111 eHalStatus status = eHAL_STATUS_SUCCESS;
7112 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7113 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7114 vos_msg_t vosMessage;
7115
Katya Nigambcb705f2013-12-26 14:26:22 +05307116 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007117 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007118 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7119 {
7120 /* serialize the req through MC thread */
7121 vosMessage.bodyptr = wlanResumeParam;
7122 vosMessage.type = WDA_WLAN_RESUME_REQ;
7123 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7124 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7125 {
7126 status = eHAL_STATUS_FAILURE;
7127 }
7128 sme_ReleaseGlobalLock( &pMac->sme );
7129 }
7130 return(status);
7131}
7132
Jeff Johnson295189b2012-06-20 16:38:30 -07007133/* ---------------------------------------------------------------------------
7134
7135 \fn sme_GetInfraSessionId
7136
7137 \brief To get the session ID for infra session, if connected
7138 This is a synchronous API.
7139
7140 \param hHal - The handle returned by macOpen.
7141
7142 \return sessionid, -1 if infra session is not connected
7143
7144 -------------------------------------------------------------------------------*/
7145tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7146{
7147 eHalStatus status = eHAL_STATUS_FAILURE;
7148 tANI_S8 sessionid = -1;
7149 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007150
Jeff Johnson295189b2012-06-20 16:38:30 -07007151 status = sme_AcquireGlobalLock( &pMac->sme );
7152 if ( HAL_STATUS_SUCCESS( status ) )
7153 {
7154
7155 sessionid = csrGetInfraSessionId( pMac);
7156
7157 sme_ReleaseGlobalLock( &pMac->sme );
7158 }
7159
7160 return (sessionid);
7161}
7162
7163/* ---------------------------------------------------------------------------
7164
7165 \fn sme_GetInfraOperationChannel
7166
7167 \brief To get the operating channel for infra session, if connected
7168 This is a synchronous API.
7169
7170 \param hHal - The handle returned by macOpen.
7171 \param sessionId - the sessionId returned by sme_OpenSession.
7172
7173 \return operating channel, 0 if infra session is not connected
7174
7175 -------------------------------------------------------------------------------*/
7176tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7177{
7178 eHalStatus status = eHAL_STATUS_FAILURE;
7179 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7180 tANI_U8 channel = 0;
7181 status = sme_AcquireGlobalLock( &pMac->sme );
7182 if ( HAL_STATUS_SUCCESS( status ) )
7183 {
7184
7185 channel = csrGetInfraOperationChannel( pMac, sessionId);
7186
7187 sme_ReleaseGlobalLock( &pMac->sme );
7188 }
7189
7190 return (channel);
7191}
7192
7193//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 -07007194//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007195tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7196{
7197 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007198 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007199 tANI_U8 channel = 0;
7200 status = sme_AcquireGlobalLock( &pMac->sme );
7201 if ( HAL_STATUS_SUCCESS( status ) )
7202 {
7203
7204 channel = csrGetConcurrentOperationChannel( pMac );
7205 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007206 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007207 sme_ReleaseGlobalLock( &pMac->sme );
7208 }
7209
7210 return (channel);
7211}
7212
7213#ifdef FEATURE_WLAN_SCAN_PNO
7214/******************************************************************************
7215*
7216* Name: sme_PreferredNetworkFoundInd
7217*
7218* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007219* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007220*
7221* Parameters:
7222* hHal - HAL handle for device
7223* pMsg - found network description
7224*
7225* Returns: eHalStatus
7226*
7227******************************************************************************/
7228eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7229{
7230 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7231 eHalStatus status = eHAL_STATUS_SUCCESS;
7232 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007233 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7234 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007235
7236 if (NULL == pMsg)
7237 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007238 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007239 status = eHAL_STATUS_FAILURE;
7240 }
7241 else
7242 {
7243 if (pPrefNetworkFoundInd->ssId.length > 0)
7244 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007245 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7246 pPrefNetworkFoundInd->ssId.length);
7247 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7248 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307249 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7250 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007251
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307252 /* Flush scan results, So as to avoid indication/updation of
7253 * stale entries, which may not have aged out during APPS collapse
7254 */
7255 sme_ScanFlushResult(hHal,0);
7256
Srikant Kuppa066904f2013-05-07 13:56:02 -07007257 //Save the frame to scan result
7258 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7259 {
7260 //we may have a frame
7261 status = csrScanSavePreferredNetworkFound(pMac,
7262 pPrefNetworkFoundInd);
7263 if (!HAL_STATUS_SUCCESS(status))
7264 {
7265 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7266 }
7267 }
7268 else
7269 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007270 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007271 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007272 }
7273
Srikant Kuppa066904f2013-05-07 13:56:02 -07007274 /* Call Preferred Netowrk Found Indication callback routine. */
7275 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7276 {
7277 pMac->pmc.prefNetwFoundCB(
7278 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7279 pPrefNetworkFoundInd);
7280 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007281 }
7282 else
7283 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007284 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007285 status = eHAL_STATUS_FAILURE;
7286 }
7287 }
7288
7289
7290 return(status);
7291}
7292
7293#endif // FEATURE_WLAN_SCAN_PNO
7294
7295
7296eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7297{
7298 eHalStatus status = eHAL_STATUS_FAILURE;
7299 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007300
Jeff Johnson295189b2012-06-20 16:38:30 -07007301 status = sme_AcquireGlobalLock( &pMac->sme );
7302 if ( HAL_STATUS_SUCCESS( status ) )
7303 {
7304 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7305 sme_ReleaseGlobalLock( &pMac->sme );
7306 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007307
Jeff Johnson295189b2012-06-20 16:38:30 -07007308 return (status);
7309}
7310
7311
7312/* ---------------------------------------------------------------------------
7313
7314 \fn sme_SetTxPerTracking
7315
7316 \brief Set Tx PER tracking configuration parameters
7317
7318 \param hHal - The handle returned by macOpen.
7319 \param pTxPerTrackingConf - Tx PER configuration parameters
7320
7321 \return eHalStatus
7322
7323 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007324eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7325 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007326 void *pCallbackContext,
7327 tpSirTxPerTrackingParam pTxPerTrackingParam)
7328{
7329 vos_msg_t msg;
7330 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7331 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7332
7333 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7334 {
7335 pMac->sme.pTxPerHitCallback = pCallbackfn;
7336 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7337 sme_ReleaseGlobalLock( &pMac->sme );
7338 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007339
Jeff Johnson295189b2012-06-20 16:38:30 -07007340 // free this memory in failure case or WDA request callback function
7341 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7342 if (NULL == pTxPerTrackingParamReq)
7343 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007344 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 -07007345 return eHAL_STATUS_FAILURE;
7346 }
7347
Kiet Lam64c1b492013-07-12 13:56:44 +05307348 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7349 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007350 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7351 msg.reserved = 0;
7352 msg.bodyptr = pTxPerTrackingParamReq;
7353
7354 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7355 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007356 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 -07007357 vos_mem_free(pTxPerTrackingParamReq);
7358 return eHAL_STATUS_FAILURE;
7359 }
7360
7361 return eHAL_STATUS_SUCCESS;
7362}
7363
7364/* ---------------------------------------------------------------------------
7365
7366 \fn sme_HandleChangeCountryCode
7367
7368 \brief Change Country code, Reg Domain and channel list
7369
7370 \details Country Code Priority
7371 0 = 11D > Configured Country > NV
7372 1 = Configured Country > 11D > NV
7373 If Supplicant country code is priority than 11d is disabled.
7374 If 11D is enabled, we update the country code after every scan.
7375 Hence when Supplicant country code is priority, we don't need 11D info.
7376 Country code from Supplicant is set as current courtry code.
7377 User can send reset command XX (instead of country code) to reset the
7378 country code to default values which is read from NV.
7379 In case of reset, 11D is enabled and default NV code is Set as current country code
7380 If 11D is priority,
7381 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7382
7383 \param pMac - The handle returned by macOpen.
7384 \param pMsgBuf - MSG Buffer
7385
7386 \return eHalStatus
7387
7388 -------------------------------------------------------------------------------*/
7389eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7390{
7391 eHalStatus status = eHAL_STATUS_SUCCESS;
7392 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007393 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007394 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7395 static uNvTables nvTables;
7396 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7397
7398
7399 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7400 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7401 {
7402 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7403
7404 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7405
7406 /* read the country code from NV and use it */
7407 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7408 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307409 vos_mem_copy(pMsg->countryCode,
7410 nvTables.defaultCountryTable.countryCode,
7411 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007412 }
7413 else
7414 {
7415 status = eHAL_STATUS_FAILURE;
7416 return status;
7417 }
7418 }
7419 else
7420 {
7421 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307422 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7423 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007424 {
7425 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7426 }
7427 }
7428
7429 /* WEXT set country code means
7430 * 11D should be supported?
7431 * 11D Channel should be enforced?
7432 * 11D Country code should be matched?
7433 * 11D Reg Domian should be matched?
7434 * Country string changed */
7435 if(pMac->roam.configParam.Is11dSupportEnabled &&
7436 pMac->roam.configParam.fEnforce11dChannels &&
7437 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7438 pMac->roam.configParam.fEnforceDefaultDomain &&
7439 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7440 {
7441 /* All 11D related options are already enabled
7442 * Country string is not changed
7443 * Do not need do anything for country code change request */
7444 return eHAL_STATUS_SUCCESS;
7445 }
7446
7447 /* Set Current Country code and Current Regulatory domain */
7448 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7449 if(eHAL_STATUS_SUCCESS != status)
7450 {
7451 /* Supplicant country code failed. So give 11D priority */
7452 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7453 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007454 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007455 }
7456
Jeff Johnson295189b2012-06-20 16:38:30 -07007457 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307458 vos_mem_copy(pMac->scan.countryCodeDefault,
7459 pMac->scan.countryCodeCurrent,
7460 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007461
7462 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307463 status = csrGetRegulatoryDomainForCountry(pMac,
7464 pMac->scan.countryCodeCurrent,
7465 (v_REGDOMAIN_t *) &domainIdIoctl,
7466 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007467 if ( status != eHAL_STATUS_SUCCESS )
7468 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007469 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007470 return status;
7471 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007472 else if (REGDOMAIN_WORLD == domainIdIoctl)
7473 {
7474 /* Supplicant country code is invalid, so we are on world mode now. So
7475 give 11D chance to update */
7476 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7477 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7478 }
7479
Jeff Johnson295189b2012-06-20 16:38:30 -07007480
Abhishek Singha306a442013-11-07 18:39:01 +05307481 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007482
7483 if ( status != eHAL_STATUS_SUCCESS )
7484 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007485 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007486 return status;
7487 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007488 else
7489 {
7490 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7491 //set again if we find AP with 11d info during scan
7492 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7493 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007494 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007495 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7496 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7497 }
7498 }
Kiet Lam6c583332013-10-14 05:37:09 +05307499#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007500 /* set to default domain ID */
7501 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7502
7503 /* get the channels based on new cc */
7504 status = csrInitGetChannels( pMac );
7505
7506 if ( status != eHAL_STATUS_SUCCESS )
7507 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007508 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007509 return status;
7510 }
7511
7512 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007513 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307514 /* Country code Changed, Purge Only scan result
7515 * which does not have channel number belong to 11d
7516 * channel list
7517 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307518 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307519
Kiet Lam6c583332013-10-14 05:37:09 +05307520#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007521 if( pMsg->changeCCCallback )
7522 {
7523 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7524 }
7525
7526 return eHAL_STATUS_SUCCESS;
7527}
7528
Amar Singhal0d15bd52013-10-12 23:13:13 -07007529/* ---------------------------------------------------------------------------
7530
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007531 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007532
7533 \brief Change Country code, Reg Domain and channel list
7534
7535 If Supplicant country code is priority than 11d is disabled.
7536 If 11D is enabled, we update the country code after every scan.
7537 Hence when Supplicant country code is priority, we don't need 11D info.
7538 Country code from Supplicant is set as current country code.
7539
7540 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007541 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007542
7543 \return eHalStatus
7544
7545 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007546eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7547 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007548{
7549 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007550 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307551 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007552
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007553 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007554 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7555
Kiet Lam6c583332013-10-14 05:37:09 +05307556 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7557 VOS_COUNTRY_CODE_LEN) == 0)
7558 {
7559 is11dCountry = VOS_TRUE;
7560 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007561
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307562 /* Set the country code given by userspace when 11dOriginal is FALSE
7563 * when 11doriginal is True,is11dCountry =0 and
7564 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7565 * and return failure
7566 */
7567 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007568 {
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307569 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
7570 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007571
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307572 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007573
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307574 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007575 pMac->scan.countryCode11d,
7576 (v_REGDOMAIN_t *) &reg_domain_id,
7577 COUNTRY_IE);
7578
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307579 return eHAL_STATUS_FAILURE;
7580 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007581 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007582 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307583 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007584 {
7585 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7586 }
7587
Kiet Lamf2f201e2013-11-16 21:24:16 +05307588 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007589 WNI_CFG_COUNTRY_CODE_LEN);
7590
Abhishek Singha306a442013-11-07 18:39:01 +05307591 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007592
Kiet Lam6c583332013-10-14 05:37:09 +05307593 if (VOS_FALSE == is11dCountry )
7594 {
7595 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307596 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307597 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7598 /* set to default domain ID */
7599 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7600 }
7601
Amar Singhal0d15bd52013-10-12 23:13:13 -07007602 if ( status != eHAL_STATUS_SUCCESS )
7603 {
7604 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307605 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007606 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007607 else
7608 {
7609 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7610 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007611 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7612 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007613 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007614 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007615 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7616 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7617 }
7618 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007619
Amar Singhal0d15bd52013-10-12 23:13:13 -07007620 /* get the channels based on new cc */
7621 status = csrInitGetChannels(pMac);
7622
7623 if ( status != eHAL_STATUS_SUCCESS )
7624 {
7625 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7626 return status;
7627 }
7628
7629 /* reset info based on new cc, and we are done */
7630 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307631 if (VOS_TRUE == is11dCountry)
7632 {
Kiet Lam6c583332013-10-14 05:37:09 +05307633 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7634 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7635 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307636 /* Country code Changed, Purge Only scan result
7637 * which does not have channel number belong to 11d
7638 * channel list
7639 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307640 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307641 // Do active scans after the country is set by User hints or Country IE
7642 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05307643 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007644 smsLog(pMac, LOG1, FL(" returned"));
7645 return eHAL_STATUS_SUCCESS;
7646}
7647
7648/* ---------------------------------------------------------------------------
7649
Kiet Lamcffc5862013-10-30 16:28:45 +05307650 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007651
7652 \brief Update Country code in the driver if set by kernel as world
7653
7654 If 11D is enabled, we update the country code after every scan & notify kernel.
7655 This is to make sure kernel & driver are in sync in case of CC found in
7656 driver but not in kernel database
7657
7658 \param pMac - The handle returned by macOpen.
7659 \param pMsg - Carrying new CC set in kernel
7660
7661 \return eHalStatus
7662
7663 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307664eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007665{
Kiet Lamcffc5862013-10-30 16:28:45 +05307666 eHalStatus status;
7667
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007668 smsLog(pMac, LOG1, FL(" called"));
7669
7670 //this is to make sure kernel & driver are in sync in case of CC found in
7671 //driver but not in kernel database
7672 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7673 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007674 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307675 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007676 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307677 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007678 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007679 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307680
Abhishek Singha306a442013-11-07 18:39:01 +05307681 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307682
7683 if ( status != eHAL_STATUS_SUCCESS )
7684 {
7685 smsLog( pMac, LOGE, FL(" fail to set regId") );
7686 return status;
7687 }
7688 else
7689 {
7690 status = csrInitGetChannels(pMac);
7691 if ( status != eHAL_STATUS_SUCCESS )
7692 {
7693 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7694 }
7695 else
7696 {
7697 csrInitChannelList(pMac);
7698 }
7699 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307700 /* Country code Changed, Purge Only scan result
7701 * which does not have channel number belong to 11d
7702 * channel list
7703 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307704 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007705 smsLog(pMac, LOG1, FL(" returned"));
7706 return eHAL_STATUS_SUCCESS;
7707}
7708
7709/* ---------------------------------------------------------------------------
7710
Sushant Kaushik1d732562014-05-21 14:15:37 +05307711 \fn sme_DisconnectConnectedSessions
7712
7713 \brief Disconnect STA and P2P client session if channel is not supported
7714
7715 If new country code does not support the channel on which STA/P2P client
7716 is connetced, it sends the disconnect to the AP/P2P GO
7717
7718 \param pMac - The handle returned by macOpen
7719
7720 \return eHalStatus
7721
7722 -------------------------------------------------------------------------------*/
7723
7724void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
7725{
7726 v_U8_t i, sessionId, isChanFound = false;
7727 tANI_U8 currChannel;
7728
7729 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
7730 {
7731 if (csrIsSessionClientAndConnected(pMac, sessionId))
7732 {
7733 isChanFound = false;
7734 //Session is connected.Check the channel
7735 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
7736 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
7737 currChannel, sessionId);
7738 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
7739 {
7740 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
7741 {
7742 isChanFound = true;
7743 break;
7744 }
7745 }
7746
7747 if (!isChanFound)
7748 {
7749 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
7750 {
7751 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
7752 {
7753 isChanFound = true;
7754 break;
7755 }
7756 }
7757 }
7758 if (!isChanFound)
7759 {
7760 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
7761 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
7762 }
7763 }
7764 }
7765}
7766/* ---------------------------------------------------------------------------
7767
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007768 \fn sme_HandleGenericChangeCountryCode
7769
7770 \brief Change Country code, Reg Domain and channel list
7771
7772 If Supplicant country code is priority than 11d is disabled.
7773 If 11D is enabled, we update the country code after every scan.
7774 Hence when Supplicant country code is priority, we don't need 11D info.
7775 Country code from kernel is set as current country code.
7776
7777 \param pMac - The handle returned by macOpen.
7778 \param pMsgBuf - message buffer
7779
7780 \return eHalStatus
7781
7782 -------------------------------------------------------------------------------*/
7783eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7784{
7785 tAniGenericChangeCountryCodeReq *pMsg;
7786 v_REGDOMAIN_t reg_domain_id;
7787
7788 smsLog(pMac, LOG1, FL(" called"));
7789 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7790 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7791
7792 if (REGDOMAIN_COUNT == reg_domain_id)
7793 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307794 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007795 }
7796 else
7797 {
7798 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7799 }
7800 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007801 return eHAL_STATUS_SUCCESS;
7802}
7803
Jeff Johnson295189b2012-06-20 16:38:30 -07007804#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007805eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007806{
7807 tpSirRcvFltMcAddrList pRequestBuf;
7808 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007809 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007810 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007811
7812 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307813 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007814 pMulticastAddrs->ulMulticastAddrCnt,
7815 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007816
7817 /*
7818 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007819 */
7820 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7821 csrIsConnStateInfra(pMac, sessionId))
7822 {
7823 pSession = CSR_GET_SESSION( pMac, sessionId );
7824 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007825
7826 if(pSession == NULL )
7827 {
7828 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007829 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007830 return eHAL_STATUS_FAILURE;
7831 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007832
Jeff Johnson295189b2012-06-20 16:38:30 -07007833 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7834 if (NULL == pRequestBuf)
7835 {
7836 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007837 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007838 return eHAL_STATUS_FAILED_ALLOC;
7839 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007840
7841 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7842 {
7843 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7844 "indication as we are not connected", __func__);
7845 vos_mem_free(pRequestBuf);
7846 return eHAL_STATUS_FAILURE;
7847 }
7848
Jeff Johnson295189b2012-06-20 16:38:30 -07007849 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7850
Kiet Lam64c1b492013-07-12 13:56:44 +05307851 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7852 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007853 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7854 sizeof(tSirMacAddr));
7855
Jeff Johnson295189b2012-06-20 16:38:30 -07007856 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7857 msg.reserved = 0;
7858 msg.bodyptr = pRequestBuf;
7859 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7860 {
7861 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007862 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007863 vos_mem_free(pRequestBuf);
7864 return eHAL_STATUS_FAILURE;
7865 }
7866
7867 return eHAL_STATUS_SUCCESS;
7868}
7869
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007870eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007871 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007872{
7873 tpSirRcvPktFilterCfgType pRequestBuf;
7874 v_SINT_t allocSize;
7875 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007876 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7877 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007878 v_U8_t idx=0;
7879
7880 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007881 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007882 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007883
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007884 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007885
Jeff Johnson295189b2012-06-20 16:38:30 -07007886 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007887
7888 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007889 {
7890 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007891 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007892 return eHAL_STATUS_FAILED_ALLOC;
7893 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007894
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007895 if( NULL == pSession )
7896 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007897 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007898 vos_mem_free(pRequestBuf);
7899 return eHAL_STATUS_FAILURE;
7900 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007901
Kiet Lam64c1b492013-07-12 13:56:44 +05307902 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7903 sizeof(tSirMacAddr));
7904 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7905 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007906 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7907
Jeff Johnson295189b2012-06-20 16:38:30 -07007908 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7909 msg.reserved = 0;
7910 msg.bodyptr = pRequestBuf;
7911
7912 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007913 "FT %d FID %d ",
7914 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007915
7916 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007917 "params %d CT %d",
7918 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07007919
7920 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7921 {
7922
7923 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007924 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007925 pRequestBuf->paramsData[idx].protocolLayer,
7926 pRequestBuf->paramsData[idx].cmpFlag);
7927
7928 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007929 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007930 pRequestBuf->paramsData[idx].dataOffset,
7931 pRequestBuf->paramsData[idx].dataLength);
7932
7933 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007934 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007935 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007936 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007937 pRequestBuf->paramsData[idx].compareData[2],
7938 pRequestBuf->paramsData[idx].compareData[3],
7939 pRequestBuf->paramsData[idx].compareData[4],
7940 pRequestBuf->paramsData[idx].compareData[5]);
7941
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007942 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007943 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007944 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007945 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007946 pRequestBuf->paramsData[idx].dataMask[2],
7947 pRequestBuf->paramsData[idx].dataMask[3],
7948 pRequestBuf->paramsData[idx].dataMask[4],
7949 pRequestBuf->paramsData[idx].dataMask[5]);
7950
7951 }
7952
7953 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7954 {
7955 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007956 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007957 vos_mem_free(pRequestBuf);
7958 return eHAL_STATUS_FAILURE;
7959 }
7960
7961 return eHAL_STATUS_SUCCESS;
7962}
7963
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007964eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007965 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007966 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007967 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007968{
7969 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7970 eHalStatus status;
7971
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007972 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007973
7974 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7975 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007976 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007977 sme_ReleaseGlobalLock( &pMac->sme );
7978 }
7979
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007980 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007981
7982 return (status);
7983}
7984
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007985eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07007986 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007987{
7988 tpSirRcvFltPktClearParam pRequestBuf;
7989 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007990 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7991 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007992
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007993 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007994 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007995
Jeff Johnson295189b2012-06-20 16:38:30 -07007996 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007997 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007998 {
7999 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8000 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008001 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008002 return eHAL_STATUS_FAILED_ALLOC;
8003 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008004 if( NULL == pSession )
8005 {
8006 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008007 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008008 vos_mem_free(pRequestBuf);
8009 return eHAL_STATUS_FAILURE;
8010 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008011
Kiet Lam64c1b492013-07-12 13:56:44 +05308012 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8013 sizeof(tSirMacAddr));
8014 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8015 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008016
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008017 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8018
Jeff Johnson295189b2012-06-20 16:38:30 -07008019 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8020 msg.reserved = 0;
8021 msg.bodyptr = pRequestBuf;
8022 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8023 {
8024 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008025 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008026 vos_mem_free(pRequestBuf);
8027 return eHAL_STATUS_FAILURE;
8028 }
8029
8030 return eHAL_STATUS_SUCCESS;
8031}
8032#endif // WLAN_FEATURE_PACKET_FILTERING
8033
8034/* ---------------------------------------------------------------------------
8035 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008036 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008037 channel switch.
8038 \param callbackContext
8039 \param status
8040 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008041void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008042 eHalStatus status)
8043{
8044 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8045 tSirMbMsg *pMsg;
8046 tANI_U16 msgLen;
8047
8048 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308049 pMsg = vos_mem_malloc(msgLen);
8050 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008051 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308052 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008053 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8054 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8055 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008056 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008057
8058 return;
8059}
8060
8061/* ---------------------------------------------------------------------------
8062 \fn sme_HandlePreChannelSwitchInd
8063 \brief Processes the indcation from PE for pre-channel switch.
8064 \param hHal
8065 \- The handle returned by macOpen. return eHalStatus
8066 ---------------------------------------------------------------------------*/
8067eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8068{
8069 eHalStatus status = eHAL_STATUS_FAILURE;
8070 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8071 status = sme_AcquireGlobalLock( &pMac->sme );
8072 if ( HAL_STATUS_SUCCESS( status ) )
8073 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008074 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8075 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008076 sme_ReleaseGlobalLock( &pMac->sme );
8077 }
8078
8079 return (status);
8080}
8081
8082/* ---------------------------------------------------------------------------
8083 \fn sme_HandlePostChannelSwitchInd
8084 \brief Processes the indcation from PE for post-channel switch.
8085 \param hHal
8086 \- The handle returned by macOpen. return eHalStatus
8087 ---------------------------------------------------------------------------*/
8088eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8089{
8090 eHalStatus status = eHAL_STATUS_FAILURE;
8091 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8092
8093 status = sme_AcquireGlobalLock( &pMac->sme );
8094 if ( HAL_STATUS_SUCCESS( status ) )
8095 {
8096 status = pmcRequestBmps(hHal, NULL, NULL);
8097 sme_ReleaseGlobalLock( &pMac->sme );
8098 }
8099
8100 return (status);
8101}
8102
8103/* ---------------------------------------------------------------------------
8104
8105 \fn sme_IsChannelValid
8106
8107 \brief To check if the channel is valid for currently established domain
8108 This is a synchronous API.
8109
8110 \param hHal - The handle returned by macOpen.
8111 \param channel - channel to verify
8112
8113 \return TRUE/FALSE, TRUE if channel is valid
8114
8115 -------------------------------------------------------------------------------*/
8116tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8117{
8118 eHalStatus status = eHAL_STATUS_FAILURE;
8119 tANI_BOOLEAN valid = FALSE;
8120 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008121
Jeff Johnson295189b2012-06-20 16:38:30 -07008122 status = sme_AcquireGlobalLock( &pMac->sme );
8123 if ( HAL_STATUS_SUCCESS( status ) )
8124 {
8125
8126 valid = csrRoamIsChannelValid( pMac, channel);
8127
8128 sme_ReleaseGlobalLock( &pMac->sme );
8129 }
8130
8131 return (valid);
8132}
8133
8134/* ---------------------------------------------------------------------------
8135 \fn sme_SetFreqBand
8136 \brief Used to set frequency band.
8137 \param hHal
8138 \eBand band value to be configured
8139 \- return eHalStatus
8140 -------------------------------------------------------------------------*/
8141eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8142{
8143 eHalStatus status = eHAL_STATUS_FAILURE;
8144 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8145
8146 status = sme_AcquireGlobalLock( &pMac->sme );
8147 if ( HAL_STATUS_SUCCESS( status ) )
8148 {
8149 status = csrSetBand(hHal, eBand);
8150 sme_ReleaseGlobalLock( &pMac->sme );
8151 }
8152 return status;
8153}
8154
8155/* ---------------------------------------------------------------------------
8156 \fn sme_GetFreqBand
8157 \brief Used to get the current band settings.
8158 \param hHal
8159 \pBand pointer to hold band value
8160 \- return eHalStatus
8161 -------------------------------------------------------------------------*/
8162eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8163{
8164 eHalStatus status = eHAL_STATUS_FAILURE;
8165 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8166
8167 status = sme_AcquireGlobalLock( &pMac->sme );
8168 if ( HAL_STATUS_SUCCESS( status ) )
8169 {
8170 *pBand = csrGetCurrentBand( hHal );
8171 sme_ReleaseGlobalLock( &pMac->sme );
8172 }
8173 return status;
8174}
8175
8176#ifdef WLAN_WAKEUP_EVENTS
8177/******************************************************************************
8178 \fn sme_WakeReasonIndCallback
8179
8180 \brief
8181 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8182
8183 \param hHal - HAL handle for device
8184 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8185
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008186 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008187******************************************************************************/
8188eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8189{
8190 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8191 eHalStatus status = eHAL_STATUS_SUCCESS;
8192 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8193
8194 if (NULL == pMsg)
8195 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008196 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008197 status = eHAL_STATUS_FAILURE;
8198 }
8199 else
8200 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008201 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008202
8203 /* Call Wake Reason Indication callback routine. */
8204 if (pMac->pmc.wakeReasonIndCB != NULL)
8205 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008206
Jeff Johnson295189b2012-06-20 16:38:30 -07008207 pMac->pmc.wakeReasonIndCB = NULL;
8208 pMac->pmc.wakeReasonIndCBContext = NULL;
8209
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008210 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008211 }
8212
8213 return(status);
8214}
8215#endif // WLAN_WAKEUP_EVENTS
8216
8217
8218/* ---------------------------------------------------------------------------
8219
8220 \fn sme_SetMaxTxPower
8221
8222 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8223 not persist over reboots.
8224
8225 \param hHal
8226 \param pBssid BSSID to set the power cap for
8227 \param pBssid pSelfMacAddress self MAC Address
8228 \param pBssid power to set in dB
8229 \- return eHalStatus
8230
8231 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008232eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008233 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8234{
8235 vos_msg_t msg;
8236 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308237 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008238 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008239 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8240 if (NULL == pMaxTxParams)
8241 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008242 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 -07008243 return eHAL_STATUS_FAILURE;
8244 }
8245
8246 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308247 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008248 SIR_MAC_ADDR_LENGTH);
8249 pMaxTxParams->power = dB;
8250
8251 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8252 msg.reserved = 0;
8253 msg.bodyptr = pMaxTxParams;
8254
8255 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8256 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008257 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 -07008258 vos_mem_free(pMaxTxParams);
8259 return eHAL_STATUS_FAILURE;
8260 }
8261
8262 return eHAL_STATUS_SUCCESS;
8263}
8264
Jeff Johnson295189b2012-06-20 16:38:30 -07008265/* ---------------------------------------------------------------------------
8266
Arif Hussaina5ebce02013-08-09 15:09:58 -07008267 \fn sme_SetMaxTxPowerPerBand
8268
8269 \brief Set the Maximum Transmit Power specific to band dynamically.
8270 Note: this setting will not persist over reboots.
8271
8272 \param band
8273 \param power to set in dB
8274 \- return eHalStatus
8275
8276 ----------------------------------------------------------------------------*/
8277eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8278{
8279 vos_msg_t msg;
8280 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8281
8282 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8283 if (NULL == pMaxTxPowerPerBandParams)
8284 {
8285 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8286 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8287 __func__);
8288 return eHAL_STATUS_FAILURE;
8289 }
8290
8291 pMaxTxPowerPerBandParams->power = dB;
8292 pMaxTxPowerPerBandParams->bandInfo = band;
8293
8294 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8295 msg.reserved = 0;
8296 msg.bodyptr = pMaxTxPowerPerBandParams;
8297
8298 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8299 {
8300 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8301 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8302 __func__);
8303 vos_mem_free(pMaxTxPowerPerBandParams);
8304 return eHAL_STATUS_FAILURE;
8305 }
8306
8307 return eHAL_STATUS_SUCCESS;
8308}
8309
8310/* ---------------------------------------------------------------------------
8311
schang86c22c42013-03-13 18:41:24 -07008312 \fn sme_SetTxPower
8313
8314 \brief Set Transmit Power dynamically. Note: this setting will
8315 not persist over reboots.
8316
8317 \param hHal
8318 \param sessionId Target Session ID
8319 \param mW power to set in mW
8320 \- return eHalStatus
8321
8322 -------------------------------------------------------------------------------*/
8323eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8324{
8325
8326 eHalStatus status = eHAL_STATUS_FAILURE;
8327 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8328
Katya Nigambcb705f2013-12-26 14:26:22 +05308329 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008330 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008331 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8332 status = sme_AcquireGlobalLock(&pMac->sme);
8333 if (HAL_STATUS_SUCCESS(status))
8334 {
8335 status = csrSetTxPower(pMac, sessionId, mW);
8336 sme_ReleaseGlobalLock(&pMac->sme);
8337 }
8338 return status;
8339}
8340
8341/* ---------------------------------------------------------------------------
8342
Jeff Johnson295189b2012-06-20 16:38:30 -07008343 \fn sme_HideSSID
8344
8345 \brief hide/show SSID dynamically. Note: this setting will
8346 not persist over reboots.
8347
8348 \param hHal
8349 \param sessionId
8350 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8351 \- return eHalStatus
8352
8353 -------------------------------------------------------------------------------*/
8354eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8355{
8356 eHalStatus status = eHAL_STATUS_SUCCESS;
8357 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8358 tANI_U16 len;
8359
8360 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8361 {
8362 tpSirUpdateParams pMsg;
8363 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008364
8365 if(!pSession)
8366 {
8367 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008368 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008369 return eHAL_STATUS_FAILURE;
8370 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008371
8372 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008373 VOS_ASSERT(0);
8374
8375 /* Create the message and send to lim */
8376 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308377 pMsg = vos_mem_malloc(len);
8378 if ( NULL == pMsg )
8379 status = eHAL_STATUS_FAILURE;
8380 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008381 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308382 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008383 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8384 pMsg->length = len;
8385 /* Data starts from here */
8386 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008387 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008388 status = palSendMBMessage(pMac->hHdd, pMsg);
8389 }
8390 sme_ReleaseGlobalLock( &pMac->sme );
8391 }
8392 return status;
8393}
Jeff Johnson295189b2012-06-20 16:38:30 -07008394
8395/* ---------------------------------------------------------------------------
8396
8397 \fn sme_SetTmLevel
8398 \brief Set Thermal Mitigation Level to RIVA
8399 \param hHal - The handle returned by macOpen.
8400 \param newTMLevel - new Thermal Mitigation Level
8401 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008402 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008403 ---------------------------------------------------------------------------*/
8404eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8405{
8406 eHalStatus status = eHAL_STATUS_SUCCESS;
8407 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8408 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8409 vos_msg_t vosMessage;
8410 tAniSetTmLevelReq *setTmLevelReq = NULL;
8411
Katya Nigambcb705f2013-12-26 14:26:22 +05308412 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008413 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008414 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8415 {
8416 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308417 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008418 {
8419 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008420 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008421 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008422 return eHAL_STATUS_FAILURE;
8423 }
8424
8425 setTmLevelReq->tmMode = tmMode;
8426 setTmLevelReq->newTmLevel = newTMLevel;
8427
8428 /* serialize the req through MC thread */
8429 vosMessage.bodyptr = setTmLevelReq;
8430 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8431 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8432 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8433 {
8434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008435 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008436 vos_mem_free(setTmLevelReq);
8437 status = eHAL_STATUS_FAILURE;
8438 }
8439 sme_ReleaseGlobalLock( &pMac->sme );
8440 }
8441 return(status);
8442}
8443
8444/*---------------------------------------------------------------------------
8445
8446 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8447 Host and FW.
8448
8449 \param hHal - HAL handle for device
8450
8451 \return NONE
8452
8453---------------------------------------------------------------------------*/
8454void sme_featureCapsExchange( tHalHandle hHal)
8455{
8456 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308457 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008458 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008459 WDA_featureCapsExchange(vosContext);
8460}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008461
Yathish9f22e662012-12-10 14:21:35 -08008462/*---------------------------------------------------------------------------
8463
8464 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8465 in Host.
8466
8467 \param hHal - HAL handle for device
8468
8469 \return NONE
8470
8471---------------------------------------------------------------------------*/
8472void sme_disableFeatureCapablity(tANI_U8 feature_index)
8473{
8474 WDA_disableCapablityFeature(feature_index);
8475}
8476
Jeff Johnsond13512a2012-07-17 11:42:19 -07008477/* ---------------------------------------------------------------------------
8478
8479 \fn sme_GetDefaultCountryCode
8480
8481 \brief Get the default country code from NV
8482
8483 \param hHal
8484 \param pCountry
8485 \- return eHalStatus
8486
8487 -------------------------------------------------------------------------------*/
8488eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8489{
8490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308491 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008492 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008493 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8494}
8495
8496/* ---------------------------------------------------------------------------
8497
8498 \fn sme_GetCurrentCountryCode
8499
8500 \brief Get the current country code
8501
8502 \param hHal
8503 \param pCountry
8504 \- return eHalStatus
8505
8506 -------------------------------------------------------------------------------*/
8507eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8508{
8509 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308510 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008511 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008512 return csrGetCurrentCountryCode(pMac, pCountry);
8513}
8514
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008515/* ---------------------------------------------------------------------------
8516 \fn sme_transportDebug
8517 \brief Dynamically monitoring Transport channels
8518 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008519 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008520 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008521 \param toggleStallDetect Enable stall detect feature
8522 This feature will take effect to data performance
8523 Not integrate till fully verification
8524 \- return NONE
8525 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008526void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008527{
schang6295e542013-03-12 15:31:23 -07008528 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8529
8530 if (NULL == pMac)
8531 {
8532 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8533 "%s: invalid context", __func__);
8534 return;
8535 }
8536 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008537}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008538
Kiran4a17ebe2013-01-31 10:43:43 -08008539/* ---------------------------------------------------------------------------
8540 \fn sme_ResetPowerValuesFor5G
8541 \brief Reset the power values for 5G band with NV power values.
8542 \param hHal - HAL handle for device
8543 \- return NONE
8544 -------------------------------------------------------------------------*/
8545void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8546{
8547 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308548 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008549 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008550 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8551 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8552}
8553
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008554#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008555/* ---------------------------------------------------------------------------
8556 \fn sme_UpdateRoamPrefer5GHz
8557 \brief enable/disable Roam prefer 5G runtime option
8558 This function is called through dynamic setConfig callback function
8559 to configure the Roam prefer 5G runtime option
8560 \param hHal - HAL handle for device
8561 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8562 \- return Success or failure
8563 -------------------------------------------------------------------------*/
8564
8565eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8566{
8567 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008568 eHalStatus status = eHAL_STATUS_SUCCESS;
8569
Katya Nigambcb705f2013-12-26 14:26:22 +05308570 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008571 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008572 status = sme_AcquireGlobalLock( &pMac->sme );
8573 if ( HAL_STATUS_SUCCESS( status ) )
8574 {
8575 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8576 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8577 pMac->roam.configParam.nRoamPrefer5GHz,
8578 nRoamPrefer5GHz);
8579 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8580 sme_ReleaseGlobalLock( &pMac->sme );
8581 }
8582
8583 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008584}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008585
8586/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008587 \fn sme_setRoamIntraBand
8588 \brief enable/disable Intra band roaming
8589 This function is called through dynamic setConfig callback function
8590 to configure the intra band roaming
8591 \param hHal - HAL handle for device
8592 \param nRoamIntraBand Enable/Disable Intra band roaming
8593 \- return Success or failure
8594 -------------------------------------------------------------------------*/
8595eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8596{
8597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8598 eHalStatus status = eHAL_STATUS_SUCCESS;
8599
Katya Nigambcb705f2013-12-26 14:26:22 +05308600 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008601 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008602 status = sme_AcquireGlobalLock( &pMac->sme );
8603 if ( HAL_STATUS_SUCCESS( status ) )
8604 {
8605 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8606 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8607 pMac->roam.configParam.nRoamIntraBand,
8608 nRoamIntraBand);
8609 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8610 sme_ReleaseGlobalLock( &pMac->sme );
8611 }
8612
8613 return status ;
8614}
8615
8616/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008617 \fn sme_UpdateRoamScanNProbes
8618 \brief function to update roam scan N probes
8619 This function is called through dynamic setConfig callback function
8620 to update roam scan N probes
8621 \param hHal - HAL handle for device
8622 \param nProbes number of probe requests to be sent out
8623 \- return Success or failure
8624 -------------------------------------------------------------------------*/
8625eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8626{
8627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8628 eHalStatus status = eHAL_STATUS_SUCCESS;
8629
8630 status = sme_AcquireGlobalLock( &pMac->sme );
8631 if ( HAL_STATUS_SUCCESS( status ) )
8632 {
8633 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8634 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8635 pMac->roam.configParam.nProbes,
8636 nProbes);
8637 pMac->roam.configParam.nProbes = nProbes;
8638 sme_ReleaseGlobalLock( &pMac->sme );
8639 }
8640#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8641 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8642 {
8643 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8644 REASON_NPROBES_CHANGED);
8645 }
8646#endif
8647 return status ;
8648}
8649
8650/* ---------------------------------------------------------------------------
8651 \fn sme_UpdateRoamScanHomeAwayTime
8652 \brief function to update roam scan Home away time
8653 This function is called through dynamic setConfig callback function
8654 to update roam scan home away time
8655 \param hHal - HAL handle for device
8656 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008657 \param bSendOffloadCmd If TRUE then send offload command to firmware
8658 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008659 \- return Success or failure
8660 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008661eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8662 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008663{
8664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8665 eHalStatus status = eHAL_STATUS_SUCCESS;
8666
8667 status = sme_AcquireGlobalLock( &pMac->sme );
8668 if ( HAL_STATUS_SUCCESS( status ) )
8669 {
8670 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8671 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8672 pMac->roam.configParam.nRoamScanHomeAwayTime,
8673 nRoamScanHomeAwayTime);
8674 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8675 sme_ReleaseGlobalLock( &pMac->sme );
8676 }
8677
8678#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008679 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008680 {
8681 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8682 REASON_HOME_AWAY_TIME_CHANGED);
8683 }
8684#endif
8685 return status;
8686}
8687
8688
8689/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008690 \fn sme_getRoamIntraBand
8691 \brief get Intra band roaming
8692 \param hHal - HAL handle for device
8693 \- return Success or failure
8694 -------------------------------------------------------------------------*/
8695v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8696{
8697 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308698 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008699 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008700 return pMac->roam.configParam.nRoamIntraBand;
8701}
8702
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008703/* ---------------------------------------------------------------------------
8704 \fn sme_getRoamScanNProbes
8705 \brief get N Probes
8706 \param hHal - HAL handle for device
8707 \- return Success or failure
8708 -------------------------------------------------------------------------*/
8709v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8710{
8711 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8712 return pMac->roam.configParam.nProbes;
8713}
8714
8715/* ---------------------------------------------------------------------------
8716 \fn sme_getRoamScanHomeAwayTime
8717 \brief get Roam scan home away time
8718 \param hHal - HAL handle for device
8719 \- return Success or failure
8720 -------------------------------------------------------------------------*/
8721v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8722{
8723 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8724 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8725}
8726
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008727
8728/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008729 \fn sme_UpdateImmediateRoamRssiDiff
8730 \brief Update nImmediateRoamRssiDiff
8731 This function is called through dynamic setConfig callback function
8732 to configure nImmediateRoamRssiDiff
8733 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8734 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008735 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008736 candidate and current AP.
8737 \- return Success or failure
8738 -------------------------------------------------------------------------*/
8739
8740eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8741{
8742 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008743 eHalStatus status = eHAL_STATUS_SUCCESS;
8744
Katya Nigambcb705f2013-12-26 14:26:22 +05308745 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008746 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008747 status = sme_AcquireGlobalLock( &pMac->sme );
8748 if ( HAL_STATUS_SUCCESS( status ) )
8749 {
8750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308751 "LFR runtime successfully set immediate roam rssi diff to"
8752 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008753 nImmediateRoamRssiDiff,
8754 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308755 macTraceGetNeighbourRoamState(
8756 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008757 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8758 sme_ReleaseGlobalLock( &pMac->sme );
8759 }
8760
8761 return status ;
8762}
8763
8764/* ---------------------------------------------------------------------------
8765 \fn sme_UpdateRoamRssiDiff
8766 \brief Update RoamRssiDiff
8767 This function is called through dynamic setConfig callback function
8768 to configure RoamRssiDiff
8769 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8770 \param hHal - HAL handle for device
8771 \param RoamRssiDiff - minimum rssi difference between potential
8772 candidate and current AP.
8773 \- return Success or failure
8774 -------------------------------------------------------------------------*/
8775
8776eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8777{
8778 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8779 eHalStatus status = eHAL_STATUS_SUCCESS;
8780
8781 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308782 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008783 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008784 if ( HAL_STATUS_SUCCESS( status ) )
8785 {
8786 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308787 "LFR runtime successfully set roam rssi diff to %d"
8788 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008789 RoamRssiDiff,
8790 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308791 macTraceGetNeighbourRoamState(
8792 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008793 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8794 sme_ReleaseGlobalLock( &pMac->sme );
8795 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008796#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8797 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8798 {
8799 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8800 }
8801#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008802 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008803}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008804
8805/*--------------------------------------------------------------------------
8806 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008807 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008808 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008809 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008810 \param hHal - The handle returned by macOpen.
8811 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8812 Other status means SME is failed to update isFastTransitionEnabled.
8813 \sa
8814 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008815eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008816 v_BOOL_t isFastTransitionEnabled)
8817{
8818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008819 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008820
Katya Nigambcb705f2013-12-26 14:26:22 +05308821 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008822 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008823 status = sme_AcquireGlobalLock( &pMac->sme );
8824 if ( HAL_STATUS_SUCCESS( status ) )
8825 {
8826 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8827 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8828 pMac->roam.configParam.isFastTransitionEnabled,
8829 isFastTransitionEnabled);
8830 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8831 sme_ReleaseGlobalLock( &pMac->sme );
8832 }
8833
8834 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008835}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008836
8837/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008838 \fn sme_UpdateWESMode
8839 \brief Update WES Mode
8840 This function is called through dynamic setConfig callback function
8841 to configure isWESModeEnabled
8842 \param hHal - HAL handle for device
8843 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8844 Other status means SME is failed to update isWESModeEnabled.
8845 -------------------------------------------------------------------------*/
8846
8847eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8848{
8849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8850 eHalStatus status = eHAL_STATUS_SUCCESS;
8851
8852 status = sme_AcquireGlobalLock( &pMac->sme );
8853 if ( HAL_STATUS_SUCCESS( status ) )
8854 {
8855 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308856 "LFR runtime successfully set WES Mode to %d"
8857 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008858 isWESModeEnabled,
8859 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308860 macTraceGetNeighbourRoamState(
8861 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008862 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8863 sme_ReleaseGlobalLock( &pMac->sme );
8864 }
8865
8866 return status ;
8867}
8868
8869/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008870 \fn sme_SetRoamScanControl
8871 \brief Set roam scan control
8872 This function is called to set roam scan control
8873 if roam scan control is set to 0, roaming scan cache is cleared
8874 any value other than 0 is treated as invalid value
8875 \param hHal - HAL handle for device
8876 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8877 Other status means SME failure to update
8878 -------------------------------------------------------------------------*/
8879eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8880{
8881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8882 eHalStatus status = eHAL_STATUS_SUCCESS;
8883
Katya Nigambcb705f2013-12-26 14:26:22 +05308884 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008885 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008886 status = sme_AcquireGlobalLock( &pMac->sme );
8887 if ( HAL_STATUS_SUCCESS( status ) )
8888 {
8889 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308890 "LFR runtime successfully set roam scan control to %d"
8891 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008892 roamScanControl,
8893 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308894 macTraceGetNeighbourRoamState(
8895 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008896 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8897 if ( 0 == roamScanControl)
8898 {
8899 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8900 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008901 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008902#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8903 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8904 {
8905 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8906 }
8907#endif
8908 }
8909 sme_ReleaseGlobalLock( &pMac->sme );
8910 }
8911 return status ;
8912}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008913#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008914
8915#ifdef FEATURE_WLAN_LFR
8916/*--------------------------------------------------------------------------
8917 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008918 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008919 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008920 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008921 \param hHal - The handle returned by macOpen.
8922 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8923 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8924 \sa
8925 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008926eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008927 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008928{
8929 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8930
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008931 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8932 {
8933 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8934 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8935 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8936 isFastRoamIniFeatureEnabled);
8937 return eHAL_STATUS_SUCCESS;
8938 }
8939
Srinivas Girigowdade697412013-02-14 16:31:48 -08008940 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8941 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8942 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8943 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008944 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008945 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008946
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008947 return eHAL_STATUS_SUCCESS;
8948}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008949
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008950/*--------------------------------------------------------------------------
8951 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8952 Enable/disable LFR MAWC support at runtime
8953 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8954 isMAWCIniFeatureEnabled.
8955 This is a synchronous call
8956 \param hHal - The handle returned by macOpen.
8957 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8958 Other status means SME is failed to update MAWCEnabled.
8959 \sa
8960 --------------------------------------------------------------------------*/
8961eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8962 const v_BOOL_t MAWCEnabled)
8963{
8964 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8965 eHalStatus status = eHAL_STATUS_SUCCESS;
8966
8967 status = sme_AcquireGlobalLock( &pMac->sme );
8968 if ( HAL_STATUS_SUCCESS( status ) )
8969 {
8970 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8971 "%s: MAWCEnabled is changed from %d to %d", __func__,
8972 pMac->roam.configParam.MAWCEnabled,
8973 MAWCEnabled);
8974 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8975 sme_ReleaseGlobalLock( &pMac->sme );
8976 }
8977
8978 return status ;
8979
8980}
8981
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008982#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8983/*--------------------------------------------------------------------------
8984 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8985 This is a synchronuous call
8986 \param hHal - The handle returned by macOpen.
8987 \return eHAL_STATUS_SUCCESS
8988 Other status means SME is failed
8989 \sa
8990 --------------------------------------------------------------------------*/
8991
8992eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8993 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8994{
8995
8996 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8997 eHalStatus status = eHAL_STATUS_SUCCESS;
8998
8999 status = sme_AcquireGlobalLock( &pMac->sme );
9000 if ( HAL_STATUS_SUCCESS( status ) )
9001 {
9002 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9003 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9004 {
9005 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9006 }
9007 sme_ReleaseGlobalLock( &pMac->sme );
9008 }
9009
9010 return status;
9011}
9012#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009013#endif /* FEATURE_WLAN_LFR */
9014
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009015#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009016/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009017 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009018 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009019 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009020 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009021 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009022 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9023 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009024 \sa
9025 --------------------------------------------------------------------------*/
9026
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009027eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9028 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009029{
9030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9031
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009032 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009033 {
9034 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009035 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9036 pMac->roam.configParam.isEseIniFeatureEnabled,
9037 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009038 return eHAL_STATUS_SUCCESS;
9039 }
9040
Srinivas Girigowdade697412013-02-14 16:31:48 -08009041 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009042 "%s: EseEnabled is changed from %d to %d", __func__,
9043 pMac->roam.configParam.isEseIniFeatureEnabled,
9044 isEseIniFeatureEnabled);
9045 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9046 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009047
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009048 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009049 {
9050 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009051 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009052
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009053#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9054 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9055 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009056 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009057 }
9058#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009059 return eHAL_STATUS_SUCCESS;
9060}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009061#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009062
9063/*--------------------------------------------------------------------------
9064 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9065 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9066 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009067 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009068 \param hHal - The handle returned by macOpen.
9069 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9070 Other status means SME is failed to update fEnableFwRssiMonitoring.
9071 \sa
9072 --------------------------------------------------------------------------*/
9073
9074eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9075 v_BOOL_t fEnableFwRssiMonitoring)
9076{
9077 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9078
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009079 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9080 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9081 {
9082 halStatus = eHAL_STATUS_FAILURE;
9083 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009084 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009085 }
9086
9087 return (halStatus);
9088}
9089
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009090#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009091/*--------------------------------------------------------------------------
9092 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9093 This is a synchronous call
9094 \param hHal - The handle returned by macOpen.
9095 \return eHAL_STATUS_SUCCESS - SME update config successful.
9096 Other status means SME is failed to update
9097 \sa
9098 --------------------------------------------------------------------------*/
9099eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9100 v_U8_t neighborLookupRssiThreshold)
9101{
9102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9103 eHalStatus status = eHAL_STATUS_SUCCESS;
9104
9105 status = sme_AcquireGlobalLock( &pMac->sme );
9106 if ( HAL_STATUS_SUCCESS( status ) )
9107 {
9108 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9109 if (HAL_STATUS_SUCCESS(status))
9110 {
9111 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309112 "LFR runtime successfully set Lookup threshold to %d"
9113 " - old value is %d - roam state is %s",
9114 neighborLookupRssiThreshold,
9115 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9116 macTraceGetNeighbourRoamState(
9117 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009118 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9119 neighborLookupRssiThreshold;
9120 }
9121 sme_ReleaseGlobalLock( &pMac->sme );
9122 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009123 return status;
9124}
9125
9126/*--------------------------------------------------------------------------
9127 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9128 This is a synchronous call
9129 \param hHal - The handle returned by macOpen.
9130 \return eHAL_STATUS_SUCCESS - SME update config successful.
9131 Other status means SME is failed to update
9132 \sa
9133 --------------------------------------------------------------------------*/
9134eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9135 v_U8_t neighborReassocRssiThreshold)
9136{
9137 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9138 eHalStatus status = eHAL_STATUS_SUCCESS;
9139
9140 status = sme_AcquireGlobalLock( &pMac->sme );
9141 if ( HAL_STATUS_SUCCESS( status ) )
9142 {
9143 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309144 "LFR runtime successfully set Reassoc threshold to %d"
9145 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009146 neighborReassocRssiThreshold,
9147 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309148 macTraceGetNeighbourRoamState(
9149 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009150 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9151 neighborReassocRssiThreshold;
9152 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9153 neighborReassocRssiThreshold;
9154 sme_ReleaseGlobalLock( &pMac->sme );
9155 }
9156
9157 return status ;
9158}
9159
9160
9161/*--------------------------------------------------------------------------
9162 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9163 This is a synchronous call
9164 \param hHal - The handle returned by macOpen.
9165 \return eHAL_STATUS_SUCCESS - SME update config successful.
9166 Other status means SME is failed to update
9167 \sa
9168 --------------------------------------------------------------------------*/
9169v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9170{
9171 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9172 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9173}
9174
9175/*--------------------------------------------------------------------------
9176 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9177 This is a synchronous call
9178 \param hHal - The handle returned by macOpen.
9179 \return eHAL_STATUS_SUCCESS - SME update config successful.
9180 Other status means SME is failed to update
9181 \sa
9182 --------------------------------------------------------------------------*/
9183eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9184 v_U16_t neighborScanResultsRefreshPeriod)
9185{
9186 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9187 eHalStatus status = eHAL_STATUS_SUCCESS;
9188
9189 status = sme_AcquireGlobalLock( &pMac->sme );
9190 if ( HAL_STATUS_SUCCESS( status ) )
9191 {
9192 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309193 "LFR runtime successfully set roam scan refresh period to %d"
9194 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009195 neighborScanResultsRefreshPeriod,
9196 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309197 macTraceGetNeighbourRoamState(
9198 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009199 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9200 neighborScanResultsRefreshPeriod;
9201 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9202 neighborScanResultsRefreshPeriod;
9203
9204 sme_ReleaseGlobalLock( &pMac->sme );
9205 }
9206
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009207#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9208 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9209 {
9210 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9211 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9212 }
9213#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009214 return status ;
9215}
9216
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009217#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9218/*--------------------------------------------------------------------------
9219 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9220 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9221 gRoamScanOffloadEnabled.
9222 This is a synchronous call
9223 \param hHal - The handle returned by macOpen.
9224 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9225 Other status means SME is failed to update.
9226 \sa
9227 --------------------------------------------------------------------------*/
9228
9229eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9230 v_BOOL_t nRoamScanOffloadEnabled)
9231{
9232 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9233 eHalStatus status = eHAL_STATUS_SUCCESS;
9234
9235 status = sme_AcquireGlobalLock( &pMac->sme );
9236 if ( HAL_STATUS_SUCCESS( status ) )
9237 {
9238 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9239 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9240 pMac->roam.configParam.isRoamOffloadScanEnabled,
9241 nRoamScanOffloadEnabled);
9242 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9243 sme_ReleaseGlobalLock( &pMac->sme );
9244 }
9245
9246 return status ;
9247}
9248#endif
9249
Srinivas Girigowdade697412013-02-14 16:31:48 -08009250/*--------------------------------------------------------------------------
9251 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9252 This is a synchronous call
9253 \param hHal - The handle returned by macOpen.
9254 \return v_U16_t - Neighbor scan results refresh period value
9255 \sa
9256 --------------------------------------------------------------------------*/
9257v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9258{
9259 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9260 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9261}
9262
9263/*--------------------------------------------------------------------------
9264 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9265 This is a synchronuous call
9266 \param hHal - The handle returned by macOpen.
9267 \return eHAL_STATUS_SUCCESS - SME update config successful.
9268 Other status means SME is failed to update
9269 \sa
9270 --------------------------------------------------------------------------*/
9271v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9272{
9273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9274 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9275}
9276
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009277/* ---------------------------------------------------------------------------
9278 \fn sme_UpdateEmptyScanRefreshPeriod
9279 \brief Update nEmptyScanRefreshPeriod
9280 This function is called through dynamic setConfig callback function
9281 to configure nEmptyScanRefreshPeriod
9282 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9283 \param hHal - HAL handle for device
9284 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9285 \- return Success or failure
9286 -------------------------------------------------------------------------*/
9287
9288eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9289{
9290 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9291 eHalStatus status = eHAL_STATUS_SUCCESS;
9292
9293 status = sme_AcquireGlobalLock( &pMac->sme );
9294 if ( HAL_STATUS_SUCCESS( status ) )
9295 {
9296 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309297 "LFR runtime successfully set roam scan period to %d -"
9298 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009299 nEmptyScanRefreshPeriod,
9300 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309301 macTraceGetNeighbourRoamState(
9302 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009303 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9304 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9305 sme_ReleaseGlobalLock( &pMac->sme );
9306 }
9307
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009308#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9309 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9310 {
9311 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9312 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9313 }
9314#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009315 return status ;
9316}
9317
9318/* ---------------------------------------------------------------------------
9319 \fn sme_setNeighborScanMinChanTime
9320 \brief Update nNeighborScanMinChanTime
9321 This function is called through dynamic setConfig callback function
9322 to configure gNeighborScanChannelMinTime
9323 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9324 \param hHal - HAL handle for device
9325 \param nNeighborScanMinChanTime - Channel minimum dwell time
9326 \- return Success or failure
9327 -------------------------------------------------------------------------*/
9328eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9329{
9330 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9331 eHalStatus status = eHAL_STATUS_SUCCESS;
9332
9333 status = sme_AcquireGlobalLock( &pMac->sme );
9334 if ( HAL_STATUS_SUCCESS( status ) )
9335 {
9336 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309337 "LFR runtime successfully set channel min dwell time to %d"
9338 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009339 nNeighborScanMinChanTime,
9340 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309341 macTraceGetNeighbourRoamState(
9342 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009343 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9344 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9345 sme_ReleaseGlobalLock( &pMac->sme );
9346 }
9347
9348 return status ;
9349}
9350
9351/* ---------------------------------------------------------------------------
9352 \fn sme_setNeighborScanMaxChanTime
9353 \brief Update nNeighborScanMaxChanTime
9354 This function is called through dynamic setConfig callback function
9355 to configure gNeighborScanChannelMaxTime
9356 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9357 \param hHal - HAL handle for device
9358 \param nNeighborScanMinChanTime - Channel maximum dwell time
9359 \- return Success or failure
9360 -------------------------------------------------------------------------*/
9361eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9362{
9363 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9364 eHalStatus status = eHAL_STATUS_SUCCESS;
9365
9366 status = sme_AcquireGlobalLock( &pMac->sme );
9367 if ( HAL_STATUS_SUCCESS( status ) )
9368 {
9369 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309370 "LFR runtime successfully set channel max dwell time to %d"
9371 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009372 nNeighborScanMaxChanTime,
9373 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309374 macTraceGetNeighbourRoamState(
9375 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009376 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9377 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9378 sme_ReleaseGlobalLock( &pMac->sme );
9379 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009380#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9381 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9382 {
9383 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9384 REASON_SCAN_CH_TIME_CHANGED);
9385 }
9386#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009387
9388 return status ;
9389}
9390
9391/* ---------------------------------------------------------------------------
9392 \fn sme_getNeighborScanMinChanTime
9393 \brief get neighbor scan min channel time
9394 \param hHal - The handle returned by macOpen.
9395 \return v_U16_t - channel min time value
9396 -------------------------------------------------------------------------*/
9397v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9398{
9399 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9400 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9401}
9402
9403/* ---------------------------------------------------------------------------
9404 \fn sme_getNeighborScanMaxChanTime
9405 \brief get neighbor scan max channel time
9406 \param hHal - The handle returned by macOpen.
9407 \return v_U16_t - channel max time value
9408 -------------------------------------------------------------------------*/
9409v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9410{
9411 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9412 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9413}
9414
9415/* ---------------------------------------------------------------------------
9416 \fn sme_setNeighborScanPeriod
9417 \brief Update nNeighborScanPeriod
9418 This function is called through dynamic setConfig callback function
9419 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009420 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009421 \param hHal - HAL handle for device
9422 \param nNeighborScanPeriod - neighbor scan period
9423 \- return Success or failure
9424 -------------------------------------------------------------------------*/
9425eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9426{
9427 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9428 eHalStatus status = eHAL_STATUS_SUCCESS;
9429
9430 status = sme_AcquireGlobalLock( &pMac->sme );
9431 if ( HAL_STATUS_SUCCESS( status ) )
9432 {
9433 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309434 "LFR runtime successfully set neighbor scan period to %d"
9435 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009436 nNeighborScanPeriod,
9437 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309438 macTraceGetNeighbourRoamState(
9439 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009440 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9441 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9442 sme_ReleaseGlobalLock( &pMac->sme );
9443 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009444#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9445 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9446 {
9447 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9448 REASON_SCAN_HOME_TIME_CHANGED);
9449 }
9450#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009451
9452 return status ;
9453}
9454
9455/* ---------------------------------------------------------------------------
9456 \fn sme_getNeighborScanPeriod
9457 \brief get neighbor scan period
9458 \param hHal - The handle returned by macOpen.
9459 \return v_U16_t - neighbor scan period
9460 -------------------------------------------------------------------------*/
9461v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9462{
9463 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9464 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9465}
9466
9467#endif
9468
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009469#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009470
Srinivas Girigowdade697412013-02-14 16:31:48 -08009471/*--------------------------------------------------------------------------
9472 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9473 This is a synchronous call
9474 \param hHal - The handle returned by macOpen.
9475 \return v_U16_t - Rssi diff value
9476 \sa
9477 --------------------------------------------------------------------------*/
9478v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9479{
9480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9481 return pMac->roam.configParam.RoamRssiDiff;
9482}
9483
9484/*--------------------------------------------------------------------------
9485 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9486 This is a synchronous call
9487 \param hHal - The handle returned by macOpen.
9488 \return eHAL_STATUS_SUCCESS - SME update config successful.
9489 Other status means SME is failed to update
9490 \sa
9491 --------------------------------------------------------------------------*/
9492eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9493 tANI_U8 numChannels)
9494{
9495 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9496 eHalStatus status = eHAL_STATUS_SUCCESS;
9497 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009498 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309499 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009500 tANI_U8 i = 0, j = 0;
9501
9502 status = sme_AcquireGlobalLock( &pMac->sme );
9503 if ( HAL_STATUS_SUCCESS( status ) )
9504 {
9505 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9506 {
9507 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9508 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309509 if (j < sizeof(oldChannelList))
9510 {
9511 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9512 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9513 }
9514 else
9515 {
9516 break;
9517 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009518 }
9519 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009520 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009521 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009522 sme_SetRoamScanControl(hHal, 1);
9523 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009524 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009525 j = 0;
9526 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009527 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309528 if (j < sizeof(oldChannelList))
9529 {
9530 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9531 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9532 }
9533 else
9534 {
9535 break;
9536 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009537 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009538 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009539
9540 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309541 "LFR runtime successfully set roam scan channels to %s"
9542 "- old value is %s - roam state is %s",
9543 newChannelList, oldChannelList,
9544 macTraceGetNeighbourRoamState(
9545 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009546 sme_ReleaseGlobalLock( &pMac->sme );
9547 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009548#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9549 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9550 {
9551 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9552 }
9553#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009554
9555 return status ;
9556}
9557
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009558
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009559#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009560/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009561 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009562 This is a synchronuous call
9563 \param hHal - The handle returned by macOpen.
9564 \return eHAL_STATUS_SUCCESS - SME update config successful.
9565 Other status means SME is failed to update
9566 \sa
9567 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009568eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009569 tANI_U8 *pChannelList,
9570 tANI_U8 numChannels)
9571{
9572 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9573 eHalStatus status = eHAL_STATUS_SUCCESS;
9574 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9575 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9576 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9577 tANI_U8 newChannelList[128] = {0};
9578 tANI_U8 i = 0, j = 0;
9579
9580 status = sme_AcquireGlobalLock( &pMac->sme );
9581 if ( HAL_STATUS_SUCCESS( status ) )
9582 {
9583 if (NULL != currChannelListInfo->ChannelList)
9584 {
9585 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9586 {
9587 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9588 currChannelListInfo->ChannelList[i]);
9589 }
9590 }
9591 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9592
9593 if ( HAL_STATUS_SUCCESS( status ))
9594 {
9595 if (NULL != currChannelListInfo->ChannelList)
9596 {
9597 j = 0;
9598 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9599 {
9600 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9601 currChannelListInfo->ChannelList[i]);
9602 }
9603 }
9604
9605 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009606 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
9607 newChannelList, oldChannelList,
9608 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009609 }
9610 sme_ReleaseGlobalLock( &pMac->sme );
9611 }
9612#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9613 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9614 {
9615 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9616 }
9617#endif
9618
9619 return status ;
9620}
9621#endif
9622
Srinivas Girigowdade697412013-02-14 16:31:48 -08009623/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009624 \brief sme_getRoamScanChannelList() - get roam scan channel list
9625 This is a synchronous call
9626 \param hHal - The handle returned by macOpen.
9627 \return eHAL_STATUS_SUCCESS - SME update config successful.
9628 Other status means SME is failed to update
9629 \sa
9630 --------------------------------------------------------------------------*/
9631eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9632 tANI_U8 *pNumChannels)
9633{
9634 int i = 0;
9635 tANI_U8 *pOutPtr = pChannelList;
9636 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9637 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9638 eHalStatus status = eHAL_STATUS_SUCCESS;
9639
9640 status = sme_AcquireGlobalLock( &pMac->sme );
9641 if ( HAL_STATUS_SUCCESS( status ) )
9642 {
9643 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9644 {
9645 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9646 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009647 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009648 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009649 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009650 }
9651
9652 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9653 for (i = 0; i < (*pNumChannels); i++)
9654 {
9655 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9656 }
9657 pOutPtr[i] = '\0';
9658 sme_ReleaseGlobalLock( &pMac->sme );
9659 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009660 return status ;
9661}
9662
9663/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009664 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009665 This is a synchronuous call
9666 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009667 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009668 FALSE (0) - if feature is disabled (compile or runtime)
9669 \sa
9670 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009671tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009672{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009673#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -08009674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009675 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009676#else
9677 return eANI_BOOLEAN_FALSE;
9678#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009679}
9680
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009681/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009682 \brief sme_GetWESMode() - get WES Mode
9683 This is a synchronous call
9684 \param hHal - The handle returned by macOpen
9685 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9686 \sa
9687 --------------------------------------------------------------------------*/
9688v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9689{
9690 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9691 return pMac->roam.configParam.isWESModeEnabled;
9692}
9693
9694/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009695 \brief sme_GetRoamScanControl() - get scan control
9696 This is a synchronous call
9697 \param hHal - The handle returned by macOpen.
9698 \return v_BOOL_t - Enabled(1)/Disabled(0)
9699 \sa
9700 --------------------------------------------------------------------------*/
9701v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9702{
9703 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9704 return pMac->roam.configParam.nRoamScanControl;
9705}
9706#endif
9707
9708/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009709 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9710 This is a synchronuous call
9711 \param hHal - The handle returned by macOpen.
9712 \return TRUE (1) - if the feature is enabled
9713 FALSE (0) - if feature is disabled (compile or runtime)
9714 \sa
9715 --------------------------------------------------------------------------*/
9716tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9717{
9718#ifdef FEATURE_WLAN_LFR
9719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9720 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9721#else
9722 return eANI_BOOLEAN_FALSE;
9723#endif
9724}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009725
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009726/*--------------------------------------------------------------------------
9727 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9728 This is a synchronuous call
9729 \param hHal - The handle returned by macOpen.
9730 \return TRUE (1) - if the feature is enabled
9731 FALSE (0) - if feature is disabled (compile or runtime)
9732 \sa
9733 --------------------------------------------------------------------------*/
9734tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9735{
9736#ifdef WLAN_FEATURE_VOWIFI_11R
9737 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9738 return pMac->roam.configParam.isFastTransitionEnabled;
9739#else
9740 return eANI_BOOLEAN_FALSE;
9741#endif
9742}
9743
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009744/* ---------------------------------------------------------------------------
9745 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009746
Kiet Lam0f320422013-11-21 19:29:17 +05309747 \brief Check if a feature is enabled by FW
9748
9749 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009750
Kiet Lam0f320422013-11-21 19:29:17 +05309751 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009752 -------------------------------------------------------------------------*/
9753tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9754{
9755 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9756}
Kiet Lam0f320422013-11-21 19:29:17 +05309757
9758/* ---------------------------------------------------------------------------
9759 \fn sme_IsFeatureSupportedByDriver
9760 \brief Check if a feature is enabled by Driver
9761
9762 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9763 \- return 1/0 (TRUE/FALSE)
9764 -------------------------------------------------------------------------*/
9765
9766tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9767{
9768 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9769}
9770
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009771#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309772
9773/* ---------------------------------------------------------------------------
9774 \fn sme_SendTdlsMgmtFrame
9775 \brief API to send TDLS management frames.
9776
9777 \param peerMac - peer's Mac Adress.
9778 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9779 \- return VOS_STATUS_SUCCES
9780 -------------------------------------------------------------------------*/
9781VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9782 tANI_U8 sessionId,
9783 tSirMacAddr peerMac,
9784 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9785{
9786 eHalStatus status = eHAL_STATUS_SUCCESS;
9787 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9788
9789 status = sme_AcquireGlobalLock( &pMac->sme );
9790
9791 if ( HAL_STATUS_SUCCESS( status ) )
9792 {
9793 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9794 sme_ReleaseGlobalLock( &pMac->sme );
9795 }
9796 return status ;
9797}
9798
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009799/* ---------------------------------------------------------------------------
9800 \fn sme_SendTdlsMgmtFrame
9801 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009802
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009803 \param peerMac - peer's Mac Adress.
9804 \param frame_type - Type of TDLS mgmt frame to be sent.
9805 \param dialog - dialog token used in the frame.
9806 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309807 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009808 \param buf - additional IEs to be included
9809 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009810 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009811 \- return VOS_STATUS_SUCCES
9812 -------------------------------------------------------------------------*/
9813VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309814 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 -08009815{
9816 eHalStatus status = eHAL_STATUS_SUCCESS;
9817 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9818 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9819
9820 status = sme_AcquireGlobalLock( &pMac->sme );
9821 if ( HAL_STATUS_SUCCESS( status ) )
9822 {
9823 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9824 sendTdlsReq.frameType = frame_type;
9825 sendTdlsReq.buf = buf;
9826 sendTdlsReq.len = len;
9827 sendTdlsReq.dialog = dialog;
9828 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009829 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309830 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009831
9832 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9833
9834 sme_ReleaseGlobalLock( &pMac->sme );
9835 }
9836
9837 return status ;
9838
9839}
9840/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009841 \fn sme_ChangeTdlsPeerSta
9842 \brief API to Update TDLS peer sta parameters.
9843
9844 \param peerMac - peer's Mac Adress.
9845 \param staParams - Peer Station Parameters
9846 \- return VOS_STATUS_SUCCES
9847 -------------------------------------------------------------------------*/
9848VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9849 tCsrStaParams *pstaParams)
9850{
9851 eHalStatus status = eHAL_STATUS_SUCCESS;
9852 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9853
Sushant Kaushikd62d9782014-02-19 15:39:40 +05309854 if (NULL == pstaParams)
9855 {
9856 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9857 "%s :pstaParams is NULL",__func__);
9858 return eHAL_STATUS_FAILURE;
9859 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009860 status = sme_AcquireGlobalLock( &pMac->sme );
9861 if ( HAL_STATUS_SUCCESS( status ) )
9862 {
9863 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9864
9865 sme_ReleaseGlobalLock( &pMac->sme );
9866 }
9867
9868 return status ;
9869
9870}
9871
9872/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009873 \fn sme_AddTdlsPeerSta
9874 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009875
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009876 \param peerMac - peer's Mac Adress.
9877 \- return VOS_STATUS_SUCCES
9878 -------------------------------------------------------------------------*/
9879VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9880{
9881 eHalStatus status = eHAL_STATUS_SUCCESS;
9882 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9883
9884 status = sme_AcquireGlobalLock( &pMac->sme );
9885 if ( HAL_STATUS_SUCCESS( status ) )
9886 {
9887 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9888
9889 sme_ReleaseGlobalLock( &pMac->sme );
9890 }
9891
9892 return status ;
9893
9894}
9895/* ---------------------------------------------------------------------------
9896 \fn sme_DeleteTdlsPeerSta
9897 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009898
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009899 \param peerMac - peer's Mac Adress.
9900 \- return VOS_STATUS_SUCCES
9901 -------------------------------------------------------------------------*/
9902VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9903{
9904 eHalStatus status = eHAL_STATUS_SUCCESS;
9905 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9906
9907 status = sme_AcquireGlobalLock( &pMac->sme );
9908 if ( HAL_STATUS_SUCCESS( status ) )
9909 {
9910 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9911
9912 sme_ReleaseGlobalLock( &pMac->sme );
9913 }
9914
9915 return status ;
9916
9917}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009918/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009919 \fn sme_SetTdlsPowerSaveProhibited
9920 \API to set/reset the isTdlsPowerSaveProhibited.
9921
9922 \- return void
9923 -------------------------------------------------------------------------*/
9924void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9925{
9926 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9927
9928 pMac->isTdlsPowerSaveProhibited = val;
9929 return;
9930}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009931#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309932/* ---------------------------------------------------------------------------
9933 \fn sme_IsPmcBmps
9934 \API to Check if PMC state is BMPS.
9935
9936 \- return v_BOOL_t
9937 -------------------------------------------------------------------------*/
9938v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9939{
9940 return (BMPS == pmcGetPmcState(hHal));
9941}
9942
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009943#ifdef FEATURE_WLAN_TDLS_INTERNAL
9944/*
9945 * SME API to start TDLS discovery Procedure
9946 */
9947VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9948{
9949 VOS_STATUS status = VOS_STATUS_SUCCESS;
9950 tCsrTdlsDisRequest disReq = {{0}} ;
9951 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9952 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9953
9954 return status ;
9955
9956}
9957
9958/*
9959 * Process TDLS discovery results
9960 */
9961v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9962 tSmeTdlsDisResult *disResult, v_U8_t listType)
9963{
9964 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9965 tSirTdlsPeerInfo *peerInfo = NULL ;
9966 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9967 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9968 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9969 tListElem *pEntry = NULL ;
9970 v_U8_t peerCnt = 0 ;
9971
9972 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009973 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009974 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9975 while(pEntry)
9976 {
9977 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9978 tdlsPeerStaLink) ;
9979 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9980
9981 switch(listType)
9982 {
9983 case TDLS_SETUP_LIST:
9984 {
9985 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9986 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309987 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9988 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009989 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9990 peerCnt++ ;
9991 }
9992 break ;
9993 }
9994 case TDLS_DIS_LIST:
9995 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309996 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9997 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009998 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9999 peerCnt++ ;
10000 break ;
10001 }
10002 default:
10003 {
10004 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010005 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010006 break ;
10007 }
10008 }
10009
10010 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10011 }
10012
10013 return peerCnt ;
10014
10015}
10016
10017/*
10018 * SME API to start TDLS link setup Procedure.
10019 */
10020VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10021{
10022 VOS_STATUS status = VOS_STATUS_SUCCESS;
10023 tCsrTdlsSetupRequest setupReq = {{0}} ;
10024 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10025 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10026 return status ;
10027
10028}
10029
10030/*
10031 * SME API to start TDLS link Teardown Procedure.
10032 */
10033VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10034{
10035 VOS_STATUS status = VOS_STATUS_SUCCESS;
10036 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10037 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10038 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10039 return status ;
10040
10041}
10042
10043#endif /* FEATURE_WLAN_TDLS */
10044
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010045eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10046{
10047 eHalStatus status = eHAL_STATUS_FAILURE;
10048 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10049
10050 smsLog(pMac, LOG2, FL("enter"));
10051 status = sme_AcquireGlobalLock( &pMac->sme );
10052 if ( HAL_STATUS_SUCCESS( status ) )
10053 {
10054 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10055 sme_ReleaseGlobalLock( &pMac->sme );
10056 }
10057 smsLog(pMac, LOG2, FL("exit status %d"), status);
10058
10059 return (status);
10060}
10061
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010062/*
10063 * SME API to enable/disable WLAN driver initiated SSR
10064 */
10065void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10066{
10067 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10068 eHalStatus status = eHAL_STATUS_SUCCESS;
10069
10070 status = sme_AcquireGlobalLock(&pMac->sme);
10071 if (HAL_STATUS_SUCCESS(status))
10072 {
10073 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10074 "SSR level is changed %d", enableSSR);
10075 /* not serializing this messsage, as this is only going
10076 * to set a variable in WDA/WDI
10077 */
10078 WDA_SetEnableSSR(enableSSR);
10079 sme_ReleaseGlobalLock(&pMac->sme);
10080 }
10081 return;
10082}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010083
10084/*
10085 * SME API to determine the channel bonding mode
10086 */
10087VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10088{
10089 tSmeConfigParams smeConfig;
10090 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10091
10092 if (
10093#ifdef WLAN_FEATURE_11AC
10094 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10095 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10096#endif
10097 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010098 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10099
10100 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10101 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10102
10103 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010104 )
10105 {
10106 return VOS_STATUS_SUCCESS;
10107 }
10108
10109 /* If channel bonding mode is not required */
10110 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
10111 return VOS_STATUS_SUCCESS;
10112 }
10113
10114 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
10115 sme_GetConfigParam(pMac, &smeConfig);
10116
10117#ifdef WLAN_FEATURE_11AC
10118 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10119 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10120 {
10121 if ( channel== 36 || channel == 52 || channel == 100 ||
10122 channel == 116 || channel == 149 )
10123 {
10124 smeConfig.csrConfig.channelBondingMode5GHz =
10125 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
10126 }
10127 else if ( channel == 40 || channel == 56 || channel == 104 ||
10128 channel == 120 || channel == 153 )
10129 {
10130 smeConfig.csrConfig.channelBondingMode5GHz =
10131 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
10132 }
10133 else if ( channel == 44 || channel == 60 || channel == 108 ||
10134 channel == 124 || channel == 157 )
10135 {
10136 smeConfig.csrConfig.channelBondingMode5GHz =
10137 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
10138 }
10139 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010140 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010141 {
10142 smeConfig.csrConfig.channelBondingMode5GHz =
10143 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
10144 }
10145 else if ( channel == 165 )
10146 {
10147 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10148 }
10149 }
10150#endif
10151
10152 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10153 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10154 {
10155 if ( channel== 40 || channel == 48 || channel == 56 ||
10156 channel == 64 || channel == 104 || channel == 112 ||
10157 channel == 120 || channel == 128 || channel == 136 ||
10158 channel == 144 || channel == 153 || channel == 161 )
10159 {
10160 smeConfig.csrConfig.channelBondingMode5GHz = 1;
10161 }
10162 else if ( channel== 36 || channel == 44 || channel == 52 ||
10163 channel == 60 || channel == 100 || channel == 108 ||
10164 channel == 116 || channel == 124 || channel == 132 ||
10165 channel == 140 || channel == 149 || channel == 157 )
10166 {
10167 smeConfig.csrConfig.channelBondingMode5GHz = 2;
10168 }
10169 else if ( channel == 165 )
10170 {
10171 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10172 }
10173 }
krunal soni634aba32014-03-06 17:46:50 -080010174
10175 /*
10176 for 802.11a phy mode, channel bonding should be zero.
10177 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10178 through csrChangeDefaultConfigParam function. We will override this
10179 value here.
10180 */
10181 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10182 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10183 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10184 {
10185 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10186 }
10187
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010188 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Jeff Johnsonce8ad512013-10-30 12:34:42 -070010189 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010190
10191 sme_UpdateConfig (pMac, &smeConfig);
10192 return VOS_STATUS_SUCCESS;
10193}
10194
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010195/*--------------------------------------------------------------------------
10196
10197 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10198 \param hHal - The handle returned by macOpen.
10199 \param currDeviceMode - Current operating device mode.
10200 --------------------------------------------------------------------------*/
10201
10202void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10203{
10204 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10205 pMac->sme.currDeviceMode = currDeviceMode;
10206 return;
10207}
10208
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010209#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10210/*--------------------------------------------------------------------------
10211 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10212 from CSR.
10213 This is a synchronous call
10214 \param hHal - The handle returned by macOpen
10215 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10216 BSSID, channel etc.)
10217 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10218 Other status means SME is failed to send the request.
10219 \sa
10220 --------------------------------------------------------------------------*/
10221
10222eHalStatus sme_HandoffRequest(tHalHandle hHal,
10223 tCsrHandoffRequest *pHandoffInfo)
10224{
10225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10226 eHalStatus status = eHAL_STATUS_SUCCESS;
10227
10228 status = sme_AcquireGlobalLock( &pMac->sme );
10229 if ( HAL_STATUS_SUCCESS( status ) )
10230 {
10231 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10232 "%s: invoked", __func__);
10233 status = csrHandoffRequest(pMac, pHandoffInfo);
10234 sme_ReleaseGlobalLock( &pMac->sme );
10235 }
10236
10237 return status ;
10238}
10239#endif
10240
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010241/*
10242 * SME API to check if there is any infra station or
10243 * P2P client is connected
10244 */
10245VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10246{
10247 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10248 if(csrIsInfraConnected(pMac))
10249 {
10250 return VOS_STATUS_SUCCESS;
10251 }
10252 return VOS_STATUS_E_FAILURE;
10253}
10254
Leo Chang9056f462013-08-01 19:21:11 -070010255
10256#ifdef FEATURE_WLAN_LPHB
10257/* ---------------------------------------------------------------------------
10258 \fn sme_LPHBConfigReq
10259 \API to make configuration LPHB within FW.
10260 \param hHal - The handle returned by macOpen
10261 \param lphdReq - LPHB request argument by client
10262 \param pCallbackfn - LPHB timeout notification callback function pointer
10263 \- return Configuration message posting status, SUCCESS or Fail
10264 -------------------------------------------------------------------------*/
10265eHalStatus sme_LPHBConfigReq
10266(
10267 tHalHandle hHal,
10268 tSirLPHBReq *lphdReq,
10269 void (*pCallbackfn)(void *pAdapter, void *indParam)
10270)
10271{
10272 eHalStatus status = eHAL_STATUS_SUCCESS;
10273 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10274 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10275 vos_msg_t vosMessage;
10276
10277 status = sme_AcquireGlobalLock(&pMac->sme);
10278 if (eHAL_STATUS_SUCCESS == status)
10279 {
10280 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10281 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010282 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010283 {
10284 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10285 "%s: Indication Call back did not registered", __func__);
10286 sme_ReleaseGlobalLock(&pMac->sme);
10287 return eHAL_STATUS_FAILURE;
10288 }
10289 else if (NULL != pCallbackfn)
10290 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010291 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010292 }
10293
10294 /* serialize the req through MC thread */
10295 vosMessage.bodyptr = lphdReq;
10296 vosMessage.type = WDA_LPHB_CONF_REQ;
10297 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10298 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10299 {
10300 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10301 "%s: Post Config LPHB MSG fail", __func__);
10302 status = eHAL_STATUS_FAILURE;
10303 }
10304 sme_ReleaseGlobalLock(&pMac->sme);
10305 }
10306
10307 return(status);
10308}
10309#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010310/*--------------------------------------------------------------------------
10311 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10312 scan parameter.
10313 This is a synchronous call
10314 \param hHal - The handle returned by macOpen
10315 \return NONE.
10316 \sa
10317 --------------------------------------------------------------------------*/
10318void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10319 tANI_U8 nNumP2PChan)
10320{
10321 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10322
10323 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10324 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10325
10326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10327 "%s: SCAN nNumStaChanCombinedConc : %d,"
10328 "nNumP2PChanCombinedConc : %d ",
10329 __func__, nNumStaChan, nNumP2PChan);
10330
10331 return;
10332
10333}
Leo Chang9056f462013-08-01 19:21:11 -070010334
Yue Mab9c86f42013-08-14 15:59:08 -070010335/* ---------------------------------------------------------------------------
10336 \fn sme_AddPeriodicTxPtrn
10337 \brief API to Periodic TX Pattern Offload feature
10338 \param hHal - The handle returned by macOpen
10339 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10340 \return eHalStatus
10341 ---------------------------------------------------------------------------*/
10342eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10343 *addPeriodicTxPtrnParams)
10344{
10345 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10346 eHalStatus status;
10347 vos_msg_t msg;
10348
10349 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10350 {
10351 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10352 msg.bodyptr = addPeriodicTxPtrnParams;
10353
10354 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10355 {
10356 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10357 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10358 __func__);
10359
10360 sme_ReleaseGlobalLock(&pMac->sme);
10361 return eHAL_STATUS_FAILURE;
10362 }
10363
10364 sme_ReleaseGlobalLock(&pMac->sme);
10365 return eHAL_STATUS_SUCCESS;
10366 }
10367
10368 return status;
10369}
10370
10371/* ---------------------------------------------------------------------------
10372 \fn sme_DelPeriodicTxPtrn
10373 \brief API to Periodic TX Pattern Offload feature
10374 \param hHal - The handle returned by macOpen
10375 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10376 \return eHalStatus
10377 ---------------------------------------------------------------------------*/
10378eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10379 *delPeriodicTxPtrnParams)
10380{
10381 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10382 eHalStatus status;
10383 vos_msg_t msg;
10384
10385 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10386 {
10387 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10388 msg.bodyptr = delPeriodicTxPtrnParams;
10389
10390 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10391 {
10392 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10393 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10394 __func__);
10395
10396 sme_ReleaseGlobalLock(&pMac->sme);
10397 return eHAL_STATUS_FAILURE;
10398 }
10399
10400 sme_ReleaseGlobalLock(&pMac->sme);
10401 return eHAL_STATUS_SUCCESS;
10402 }
10403
10404 return status;
10405}
10406
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010407void smeGetCommandQStatus( tHalHandle hHal )
10408{
10409 tSmeCmd *pTempCmd = NULL;
10410 tListElem *pEntry;
10411 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10412
10413 if (NULL == pMac)
10414 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010415 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10416 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010417 return;
10418 }
10419
10420 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10421 if( pEntry )
10422 {
10423 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10424 }
10425 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10426 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10427 if(pTempCmd)
10428 {
10429 if( eSmeCsrCommandMask & pTempCmd->command )
10430 {
10431 //CSR command is stuck. See what the reason code is for that command
10432 dumpCsrCommandInfo(pMac, pTempCmd);
10433 }
10434 } //if(pTempCmd)
10435
10436 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10437 csrLLCount(&pMac->sme.smeCmdPendingList));
10438
10439 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10440 csrLLCount(&pMac->roam.roamCmdPendingList));
10441
10442 return;
10443}
Rajeev79dbe4c2013-10-05 11:03:42 +053010444
10445#ifdef FEATURE_WLAN_BATCH_SCAN
10446/* ---------------------------------------------------------------------------
10447 \fn sme_SetBatchScanReq
10448 \brief API to set batch scan request in FW
10449 \param hHal - The handle returned by macOpen.
10450 \param pRequest - Pointer to the batch request.
10451 \param sessionId - session ID
10452 \param callbackRoutine - HDD callback which needs to be invoked after
10453 getting set batch scan response from FW
10454 \param callbackContext - pAdapter context
10455 \return eHalStatus
10456 ---------------------------------------------------------------------------*/
10457eHalStatus sme_SetBatchScanReq
10458(
10459 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10460 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10461 void *callbackContext
10462)
10463{
10464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10465 eHalStatus status;
10466
Yue Mae36e3552014-03-05 17:06:20 -080010467 if (!pMac)
10468 {
10469 return eHAL_STATUS_FAILURE;
10470 }
10471
Rajeev79dbe4c2013-10-05 11:03:42 +053010472 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10473 {
10474 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10475 callbackContext);
10476 sme_ReleaseGlobalLock( &pMac->sme );
10477 }
10478
10479 return status;
10480}
10481
10482/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010483 \fn sme_SendRateUpdateInd
10484 \brief API to Update rate
10485 \param hHal - The handle returned by macOpen
10486 \param rateUpdateParams - Pointer to rate update params
10487 \return eHalStatus
10488 ---------------------------------------------------------------------------*/
10489eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10490{
10491 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10492 eHalStatus status;
10493 vos_msg_t msg;
10494
10495 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10496 {
10497 msg.type = WDA_RATE_UPDATE_IND;
10498 msg.bodyptr = rateUpdateParams;
10499
10500 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10501 {
10502 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10503 "to post WDA_SET_RMC_RATE_IND to WDA!",
10504 __func__);
10505
10506 sme_ReleaseGlobalLock(&pMac->sme);
10507 return eHAL_STATUS_FAILURE;
10508 }
10509
10510 sme_ReleaseGlobalLock(&pMac->sme);
10511 return eHAL_STATUS_SUCCESS;
10512 }
10513
10514 return status;
10515}
10516
10517/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010518 \fn sme_TriggerBatchScanResultInd
10519 \brief API to trigger batch scan result indications from FW
10520 \param hHal - The handle returned by macOpen.
10521 \param pRequest - Pointer to get batch request.
10522 \param sessionId - session ID
10523 \param callbackRoutine - HDD callback which needs to be invoked after
10524 getting batch scan result indication from FW
10525 \param callbackContext - pAdapter context
10526 \return eHalStatus
10527 ---------------------------------------------------------------------------*/
10528eHalStatus sme_TriggerBatchScanResultInd
10529(
10530 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10531 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10532 void *callbackContext
10533)
10534{
10535 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10536 eHalStatus status;
10537
10538 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10539 {
10540 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10541 callbackRoutine, callbackContext);
10542 sme_ReleaseGlobalLock( &pMac->sme );
10543 }
10544
10545 return status;
10546}
10547
10548
10549/* ---------------------------------------------------------------------------
10550 \fn sme_StopBatchScanInd
10551 \brief API to stop batch scan request in FW
10552 \param hHal - The handle returned by macOpen.
10553 \param pRequest - Pointer to the batch request.
10554 \param sessionId - session ID
10555 \return eHalStatus
10556 ---------------------------------------------------------------------------*/
10557eHalStatus sme_StopBatchScanInd
10558(
10559 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10560)
10561{
10562 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10563 eHalStatus status;
10564
10565 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10566 {
10567 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10568 sme_ReleaseGlobalLock( &pMac->sme );
10569 }
10570
10571 return status;
10572}
10573
10574#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010575
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010576
Leo Chang0b0e45a2013-12-15 15:18:55 -080010577#ifdef FEATURE_WLAN_CH_AVOID
10578/* ---------------------------------------------------------------------------
10579 \fn sme_AddChAvoidCallback
10580 \brief Used to plug in callback function
10581 Which notify channel may not be used with SAP or P2PGO mode.
10582 Notification come from FW.
10583 \param hHal
10584 \param pCallbackfn : callback function pointer should be plugged in
10585 \- return eHalStatus
10586 -------------------------------------------------------------------------*/
10587eHalStatus sme_AddChAvoidCallback
10588(
10589 tHalHandle hHal,
10590 void (*pCallbackfn)(void *pAdapter, void *indParam)
10591)
10592{
10593 eHalStatus status = eHAL_STATUS_SUCCESS;
10594 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10595
10596 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10597 "%s: Plug in CH AVOID CB", __func__);
10598
10599 status = sme_AcquireGlobalLock(&pMac->sme);
10600 if (eHAL_STATUS_SUCCESS == status)
10601 {
10602 if (NULL != pCallbackfn)
10603 {
10604 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10605 }
10606 sme_ReleaseGlobalLock(&pMac->sme);
10607 }
10608
10609 return(status);
10610}
10611#endif /* FEATURE_WLAN_CH_AVOID */
10612
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010613void activeListCmdTimeoutHandle(void *userData)
10614{
10615 if (NULL == userData)
10616 return;
10617 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10618 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010619 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010620 smeGetCommandQStatus((tHalHandle) userData);
10621}
10622
Sunil Duttc69bccb2014-05-26 21:30:20 +053010623#ifdef WLAN_FEATURE_LINK_LAYER_STATS
10624
10625/* ---------------------------------------------------------------------------
10626 \fn sme_LLStatsSetReq
10627 \brief API to set link layer stats request to FW
10628 \param hHal - The handle returned by macOpen.
10629
10630 \Param pStatsReq - a pointer to a caller allocated object of
10631 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
10632 stats set.
10633
10634 \return eHalStatus
10635 ---------------------------------------------------------------------------*/
10636eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
10637 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
10638{
10639 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10640 vos_msg_t msg;
10641 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010642 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010643
Dino Mycledf0a5d92014-07-04 09:41:55 +053010644 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
10645 if ( !plinkLayerSetReq)
10646 {
10647 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10648 "%s: Not able to allocate memory for "
10649 "WDA_LINK_LAYER_STATS_SET_REQ",
10650 __func__);
10651 return eHAL_STATUS_FAILURE;
10652 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053010653
Dino Mycledf0a5d92014-07-04 09:41:55 +053010654 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
10655
Sunil Duttc69bccb2014-05-26 21:30:20 +053010656
10657 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10658 {
10659 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
10660 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010661 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010662
10663 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10664 {
10665 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10666 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
10667 status = eHAL_STATUS_FAILURE;
10668 }
10669 sme_ReleaseGlobalLock( &pMac->sme );
10670 }
10671 else
10672 {
10673 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10674 "sme_AcquireGlobalLock error", __func__);
10675 }
10676 return status;
10677}
10678
10679/* ---------------------------------------------------------------------------
10680 \fn sme_LLStatsGetReq
10681 \brief API to get link layer stats request to FW
10682 \param hHal - The handle returned by macOpen.
10683
10684 \Param pStatsReq - a pointer to a caller allocated object of
10685 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
10686 stats get.
10687
10688 \return eHalStatus
10689 ---------------------------------------------------------------------------*/
10690eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
10691 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
10692{
10693 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10694 vos_msg_t msg;
10695 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010696 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010697
Dino Mycledf0a5d92014-07-04 09:41:55 +053010698 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
10699 if ( !pGetStatsReq)
10700 {
10701 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10702 "%s: Not able to allocate memory for "
10703 "WDA_LINK_LAYER_STATS_GET_REQ",
10704 __func__);
10705 return eHAL_STATUS_FAILURE;
10706 }
10707 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010708
10709 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10710 {
10711 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
10712 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010713 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010714 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10715 {
10716 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10717 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
10718 status = eHAL_STATUS_FAILURE;
10719 }
10720 sme_ReleaseGlobalLock( &pMac->sme );
10721 }
10722 else
10723 {
10724 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10725 "sme_AcquireGlobalLock error", __func__);
10726 }
10727 return status;
10728}
10729
10730/* ---------------------------------------------------------------------------
10731 \fn sme_LLStatsClearReq
10732 \brief API to clear link layer stats request to FW
10733 \param hHal - The handle returned by macOpen.
10734
10735 \Param pStatsReq - a pointer to a caller allocated object of
10736 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
10737 stats clear.
10738
10739 \return eHalStatus
10740 ---------------------------------------------------------------------------*/
10741eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
10742 tSirLLStatsClearReq *pLinkLayerStatsClear)
10743{
10744 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10745 vos_msg_t msg;
10746 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010747 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010748
10749
10750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10751 "reqId = %u", pLinkLayerStatsClear->reqId);
10752 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10753 "staId = %u", pLinkLayerStatsClear->staId);
10754 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10755 "statsClearReqMask = 0x%X",
10756 pLinkLayerStatsClear->statsClearReqMask);
10757 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10758 "stopReq = %u", pLinkLayerStatsClear->stopReq);
10759
Dino Mycledf0a5d92014-07-04 09:41:55 +053010760 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
10761 if ( !pClearStatsReq)
10762 {
10763 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10764 "%s: Not able to allocate memory for "
10765 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
10766 __func__);
10767 return eHAL_STATUS_FAILURE;
10768 }
10769
10770 *pClearStatsReq = *pLinkLayerStatsClear;
10771
Sunil Duttc69bccb2014-05-26 21:30:20 +053010772 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10773 {
10774 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
10775 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010776 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010777
10778 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10779 {
10780 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10781 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
10782 status = eHAL_STATUS_FAILURE;
10783 }
10784 sme_ReleaseGlobalLock( &pMac->sme );
10785 }
10786 else
10787 {
10788 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10789 "sme_AcquireGlobalLock error", __func__);
10790 }
10791
10792 return status;
10793}
10794
10795/* ---------------------------------------------------------------------------
10796 \fn sme_SetLinkLayerStatsIndCB
10797 \brief API to trigger Link Layer Statistic indications from FW
10798 \param hHal - The handle returned by macOpen.
10799 \param sessionId - session ID
10800 \param callbackRoutine - HDD callback which needs to be invoked after
10801 getting Link Layer Statistics from FW
10802 \param callbackContext - pAdapter context
10803 \return eHalStatus
10804 ---------------------------------------------------------------------------*/
10805eHalStatus sme_SetLinkLayerStatsIndCB
10806(
10807 tHalHandle hHal, tANI_U8 sessionId,
10808 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp),
10809 void *callbackContext
10810)
10811{
10812 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10813 eHalStatus status;
10814
10815 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10816 {
10817 if (NULL != callbackRoutine)
10818 {
10819 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
10820 pMac->sme.pLinkLayerStatsCallbackContext = callbackContext;
10821 }
10822 sme_ReleaseGlobalLock( &pMac->sme );
10823 }
10824
10825 return status;
10826}
10827#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
10828
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010829eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10830{
10831 eHalStatus status = eHAL_STATUS_SUCCESS;
10832 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10833 pMac->fEnableDebugLog = set_value;
10834 return (status);
10835}
10836
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010837VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070010838 sme_QosWmmUpType *dscpmapping,
10839 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010840{
10841 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070010842 eHalStatus status = eHAL_STATUS_SUCCESS;
10843 v_U8_t i, j, peSessionId;
10844 tCsrRoamSession *pCsrSession = NULL;
10845 tpPESession pSession = NULL;
10846
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010847 status = sme_AcquireGlobalLock( &pMac->sme );
10848 if ( HAL_STATUS_SUCCESS( status ) )
10849 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010850 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
10851 {
10852 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10853 "%s: Invalid session Id %u", __func__, sessionId);
10854 sme_ReleaseGlobalLock( &pMac->sme);
10855 return eHAL_STATUS_FAILURE;
10856 }
10857 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
10858
10859 if (pCsrSession == NULL)
10860 {
10861 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10862 "%s: CSR Session lookup fails %u", __func__, sessionId);
10863 sme_ReleaseGlobalLock( &pMac->sme);
10864 return eHAL_STATUS_FAILURE;
10865 }
10866
10867 pSession = peFindSessionByBssid( pMac,
10868 pCsrSession->connectedProfile.bssid, &peSessionId );
10869
10870 if (pSession == NULL)
10871 {
10872 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10873 "%s: Session lookup fails for BSSID", __func__);
10874 sme_ReleaseGlobalLock( &pMac->sme);
10875 return eHAL_STATUS_FAILURE;
10876 }
10877
10878 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010879 {
10880 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10881 "%s: QOS Mapping IE not present", __func__);
10882 sme_ReleaseGlobalLock( &pMac->sme);
10883 return eHAL_STATUS_FAILURE;
10884 }
10885 else
10886 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010887 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010888 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010889 for (j = pSession->QosMapSet.dscp_range[i][0];
10890 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010891 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010892 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
10893 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010894 {
10895 dscpmapping[j]= 0;
10896 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10897 "%s: User Priority %d is not used in mapping",
10898 __func__, i);
10899 break;
10900 }
10901 else
10902 {
10903 dscpmapping[j]= i;
10904 }
10905 }
10906 }
Kumar Anand82c009f2014-05-29 00:29:42 -070010907 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010908 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010909 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010910 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010911 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
10912 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010913 }
10914 }
10915 }
10916 }
10917 sme_ReleaseGlobalLock( &pMac->sme);
10918 return status;
10919}
Agarwal Ashish5e414792014-06-08 15:25:23 +053010920
Agarwal Ashish5e414792014-06-08 15:25:23 +053010921tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
10922{
10923 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10924
10925 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
10926 pMac->scan.countryCode11d, 2))
10927 {
10928 return eANI_BOOLEAN_TRUE;
10929 }
10930 else
10931 {
10932 return eANI_BOOLEAN_FALSE;
10933 }
10934}
Dino Mycle2c198072014-06-10 10:15:52 +053010935
10936#ifdef WLAN_FEATURE_EXTSCAN
10937/* ---------------------------------------------------------------------------
10938 \fn sme_GetValidChannelsByBand
10939 \brief SME API to fetch all valid channel filtered by band
10940 \param hHal
10941 \param wifiBand: RF band information
10942 \param aValidChannels: Array to store channel info
10943 \param len: number of channels
10944 \- return eHalStatus
10945 -------------------------------------------------------------------------*/
10946eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
10947 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
10948{
10949 eHalStatus status = eHAL_STATUS_SUCCESS;
10950 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
10951 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10952 tANI_U8 numChannels = 0;
10953 tANI_U8 i = 0;
10954 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
10955
10956 if (!aValidChannels || !pNumChannels) {
10957 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
10958 FL("Output channel list/NumChannels is NULL"));
10959 return eHAL_STATUS_INVALID_PARAMETER;
10960 }
10961
10962 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
10963 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
10964 FL("Invalid wifiBand (%d)"), wifiBand);
10965 return eHAL_STATUS_INVALID_PARAMETER;
10966 }
10967
10968 status = sme_GetCfgValidChannels(hHal, &chanList[0],
10969 &totValidChannels);
10970 if (!HAL_STATUS_SUCCESS(status)) {
10971 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
10972 FL("Failed to get valid channel list (err=%d)"), status);
10973 return status;
10974 }
10975
10976 switch (wifiBand) {
10977 case WIFI_BAND_UNSPECIFIED:
10978 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
10979 "return all (%d) valid channels"), totValidChannels);
10980 numChannels = totValidChannels;
10981 for (i = 0; i < numChannels; i++)
10982 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
10983 break;
10984
10985 case WIFI_BAND_BG:
10986 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
10987 for (i = 0; i < totValidChannels; i++)
10988 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
10989 aValidChannels[numChannels++] =
10990 vos_chan_to_freq(chanList[i]);
10991 break;
10992
10993 case WIFI_BAND_A:
10994 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
10995 FL("WIFI_BAND_A (5 GHz without DFS)"));
10996 for (i = 0; i < totValidChannels; i++)
10997 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
10998 !CSR_IS_CHANNEL_DFS(chanList[i]))
10999 aValidChannels[numChannels++] =
11000 vos_chan_to_freq(chanList[i]);
11001 break;
11002
11003 case WIFI_BAND_ABG:
11004 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11005 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11006 for (i = 0; i < totValidChannels; i++)
11007 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11008 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11009 !CSR_IS_CHANNEL_DFS(chanList[i]))
11010 aValidChannels[numChannels++] =
11011 vos_chan_to_freq(chanList[i]);
11012 break;
11013
11014 case WIFI_BAND_A_DFS_ONLY:
11015 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11016 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11017 for (i = 0; i < totValidChannels; i++)
11018 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11019 CSR_IS_CHANNEL_DFS(chanList[i]))
11020 aValidChannels[numChannels++] =
11021 vos_chan_to_freq(chanList[i]);
11022 break;
11023
11024 case WIFI_BAND_A_WITH_DFS:
11025 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11026 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11027 for (i = 0; i < totValidChannels; i++)
11028 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11029 aValidChannels[numChannels++] =
11030 vos_chan_to_freq(chanList[i]);
11031 break;
11032
11033 case WIFI_BAND_ABG_WITH_DFS:
11034 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11035 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11036 for (i = 0; i < totValidChannels; i++)
11037 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11038 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11039 aValidChannels[numChannels++] =
11040 vos_chan_to_freq(chanList[i]);
11041 break;
11042
11043 default:
11044 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11045 FL("Unknown wifiBand (%d))"), wifiBand);
11046 return eHAL_STATUS_INVALID_PARAMETER;
11047 break;
11048 }
11049 *pNumChannels = numChannels;
11050
11051 return status;
11052}
11053/* ---------------------------------------------------------------------------
11054 \fn sme_EXTScanGetCapabilities
11055 \brief SME API to fetch Extended Scan capabilities
11056 \param hHal
11057 \param pReq: Extended Scan capabilities structure
11058 \- return eHalStatus
11059 -------------------------------------------------------------------------*/
11060eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11061 tSirGetEXTScanCapabilitiesReqParams *pReq)
11062{
11063 eHalStatus status = eHAL_STATUS_SUCCESS;
11064 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11065 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11066 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011067 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11068
11069 pGetEXTScanCapabilitiesReq =
11070 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11071 if ( !pGetEXTScanCapabilitiesReq)
11072 {
11073 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11074 "%s: Not able to allocate memory for "
11075 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11076 __func__);
11077 return eHAL_STATUS_FAILURE;
11078 }
11079
11080 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011081
11082 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11083 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11084 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11085 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011086 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011087 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11088 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11089 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11090 status = eHAL_STATUS_FAILURE;
11091
11092 sme_ReleaseGlobalLock(&pMac->sme);
11093 }
11094 return(status);
11095}
11096
11097/* ---------------------------------------------------------------------------
11098 \fn sme_EXTScanStart
11099 \brief SME API to issue Extended Scan start
11100 \param hHal
11101 \param pStartCmd: Extended Scan start structure
11102 \- return eHalStatus
11103 -------------------------------------------------------------------------*/
11104eHalStatus sme_EXTScanStart (tHalHandle hHal,
11105 tSirEXTScanStartReqParams *pStartCmd)
11106{
11107 eHalStatus status = eHAL_STATUS_SUCCESS;
11108 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11109 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11110 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011111 tSirEXTScanStartReqParams *pextScanStartReq;
11112
11113 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11114 if ( !pextScanStartReq)
11115 {
11116 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11117 "%s: Not able to allocate memory for "
11118 "WDA_EXTSCAN_START_REQ",
11119 __func__);
11120 return eHAL_STATUS_FAILURE;
11121 }
11122
11123 *pextScanStartReq = *pStartCmd;
11124
Dino Mycle2c198072014-06-10 10:15:52 +053011125
11126 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11127 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11128 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11129 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011130 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011131 vosMessage.type = WDA_EXTSCAN_START_REQ;
11132 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11133 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11134 status = eHAL_STATUS_FAILURE;
11135
11136 sme_ReleaseGlobalLock(&pMac->sme);
11137 }
11138 return(status);
11139}
11140
11141/* ---------------------------------------------------------------------------
11142 \fn sme_EXTScanStop
11143 \brief SME API to issue Extended Scan stop
11144 \param hHal
11145 \param pStopReq: Extended Scan stop structure
11146 \- return eHalStatus
11147 -------------------------------------------------------------------------*/
11148eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11149{
11150 eHalStatus status = eHAL_STATUS_SUCCESS;
11151 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11152 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11153 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011154 tSirEXTScanStopReqParams *pEXTScanStopReq;
11155
11156 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11157 if ( !pEXTScanStopReq)
11158 {
11159 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11160 "%s: Not able to allocate memory for "
11161 "WDA_EXTSCAN_STOP_REQ",
11162 __func__);
11163 return eHAL_STATUS_FAILURE;
11164 }
11165
11166 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011167
11168 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11169 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11170 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11171 {
11172 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011173 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011174 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11175 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11176 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11177 {
11178 status = eHAL_STATUS_FAILURE;
11179 }
11180 sme_ReleaseGlobalLock(&pMac->sme);
11181 }
11182 return(status);
11183}
11184
11185/* ---------------------------------------------------------------------------
11186 \fn sme_SetBssHotlist
11187 \brief SME API to set BSSID hotlist
11188 \param hHal
11189 \param pSetHotListReq: Extended Scan set hotlist structure
11190 \- return eHalStatus
11191 -------------------------------------------------------------------------*/
11192eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11193 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11194{
11195 eHalStatus status = eHAL_STATUS_SUCCESS;
11196 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11197 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11198 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011199 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11200
11201 pEXTScanSetBssidHotlistReq =
11202 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11203 if ( !pEXTScanSetBssidHotlistReq)
11204 {
11205 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11206 "%s: Not able to allocate memory for "
11207 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11208 __func__);
11209 return eHAL_STATUS_FAILURE;
11210 }
11211
11212 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011213
11214 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11215 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11216 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11217 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011218 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011219 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11220 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11221 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11222 status = eHAL_STATUS_FAILURE;
11223
11224 sme_ReleaseGlobalLock(&pMac->sme);
11225 }
11226
11227 return(status);
11228}
11229
11230/* ---------------------------------------------------------------------------
11231 \fn sme_ResetBssHotlist
11232 \brief SME API to reset BSSID hotlist
11233 \param hHal
11234 \param pSetHotListReq: Extended Scan set hotlist structure
11235 \- return eHalStatus
11236 -------------------------------------------------------------------------*/
11237eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11238 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11239{
11240 eHalStatus status = eHAL_STATUS_SUCCESS;
11241 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11242 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11243 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011244 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11245
11246 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11247 if ( !pEXTScanHotlistResetReq)
11248 {
11249 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11250 "%s: Not able to allocate memory for "
11251 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11252 __func__);
11253 return eHAL_STATUS_FAILURE;
11254 }
11255
11256 *pEXTScanHotlistResetReq = *pResetReq;
11257
Dino Mycle2c198072014-06-10 10:15:52 +053011258
11259 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11260 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11261 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11262 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011263 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011264 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11265 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11266 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11267 status = eHAL_STATUS_FAILURE;
11268
11269 sme_ReleaseGlobalLock(&pMac->sme);
11270 }
11271 return(status);
11272}
11273
11274/* ---------------------------------------------------------------------------
11275 \fn sme_SetSignificantChange
11276 \brief SME API to set significant change
11277 \param hHal
11278 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11279 \- return eHalStatus
11280 -------------------------------------------------------------------------*/
11281eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11282 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11283{
11284 eHalStatus status = eHAL_STATUS_SUCCESS;
11285 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11286 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11287 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011288 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11289
11290 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11291 if ( !pEXTScanSetSignificantReq)
11292 {
11293 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11294 "%s: Not able to allocate memory for "
11295 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11296 __func__);
11297 return eHAL_STATUS_FAILURE;
11298 }
11299
11300 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11301
11302
Dino Mycle2c198072014-06-10 10:15:52 +053011303
11304 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11305 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11306 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11307 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011308 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011309 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11310 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11311 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11312 status = eHAL_STATUS_FAILURE;
11313
11314 sme_ReleaseGlobalLock(&pMac->sme);
11315 }
11316 return(status);
11317}
11318
11319/* ---------------------------------------------------------------------------
11320 \fn sme_ResetSignificantChange
11321 \brief SME API to reset significant change
11322 \param hHal
11323 \param pResetReq: Extended Scan reset significant change structure
11324 \- return eHalStatus
11325 -------------------------------------------------------------------------*/
11326eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11327 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11328{
11329 eHalStatus status = eHAL_STATUS_SUCCESS;
11330 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11331 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11332 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011333 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11334
11335 pEXTScanResetSignificantReq =
11336 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11337 if ( !pEXTScanResetSignificantReq)
11338 {
11339 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11340 "%s: Not able to allocate memory for "
11341 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11342 __func__);
11343 return eHAL_STATUS_FAILURE;
11344 }
11345
11346 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011347
11348 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11349 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11350 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11351 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011352 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011353 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11354 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11355 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11356 status = eHAL_STATUS_FAILURE;
11357
11358 sme_ReleaseGlobalLock(&pMac->sme);
11359 }
11360 return(status);
11361}
11362
11363/* ---------------------------------------------------------------------------
11364 \fn sme_getCachedResults
11365 \brief SME API to get cached results
11366 \param hHal
11367 \param pCachedResultsReq: Extended Scan get cached results structure
11368 \- return eHalStatus
11369 -------------------------------------------------------------------------*/
11370eHalStatus sme_getCachedResults (tHalHandle hHal,
11371 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11372{
11373 eHalStatus status = eHAL_STATUS_SUCCESS;
11374 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11375 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11376 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011377 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11378
11379 pEXTScanCachedResultsReq =
11380 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11381 if ( !pEXTScanCachedResultsReq)
11382 {
11383 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11384 "%s: Not able to allocate memory for "
11385 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11386 __func__);
11387 return eHAL_STATUS_FAILURE;
11388 }
11389
11390 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11391
Dino Mycle2c198072014-06-10 10:15:52 +053011392
11393 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11394 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11395 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11396 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011397 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011398 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11399 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11400 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11401 status = eHAL_STATUS_FAILURE;
11402
11403 sme_ReleaseGlobalLock(&pMac->sme);
11404 }
11405 return(status);
11406}
11407
11408eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
11409 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
11410 void *callbackContext)
11411{
11412 eHalStatus status = eHAL_STATUS_SUCCESS;
11413 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11414
11415 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11416 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
11417 pMac->sme.pEXTScanCallbackContext = callbackContext;
11418 sme_ReleaseGlobalLock(&pMac->sme);
11419 }
11420 return(status);
11421}
11422
11423#endif /* WLAN_FEATURE_EXTSCAN */