blob: b80d6a34dc1f8768dbe8c49910a7dbb642a29de1 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/**=========================================================================
32
33 \file smeApi.c
34
35 \brief Definitions for SME APIs
36
Kiet Lamaa8e15a2014-02-11 23:30:06 -080037 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
38
39 Qualcomm Confidential and Proprietary.
40
Jeff Johnson295189b2012-06-20 16:38:30 -070041 ========================================================================*/
42
43/*===========================================================================
44
45 EDIT HISTORY FOR FILE
46
47
48 This section contains comments describing changes made to the module.
49 Notice that changes are listed in reverse chronological order.
50
51
52
53 when who what, where, why
54---------- --- --------------------------------------------------------
5506/03/10 js Added support to hostapd driven
56 * deauth/disassoc/mic failure
57
58===========================================================================*/
59
60/*--------------------------------------------------------------------------
61 Include Files
62 ------------------------------------------------------------------------*/
63
Jeff Johnson295189b2012-06-20 16:38:30 -070064
65#include "smsDebug.h"
66#include "sme_Api.h"
67#include "csrInsideApi.h"
68#include "smeInside.h"
69#include "csrInternal.h"
70#include "wlan_qct_wda.h"
71#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053072#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070073#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053074#include "vos_types.h"
75#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070076#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053077#include "macTrace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070078
79
Mukul Sharmabe91e2f2014-06-29 22:09:20 +053080#ifdef DEBUG_ROAM_DELAY
81#include "vos_utils.h"
82#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070083
Jeff Johnson295189b2012-06-20 16:38:30 -070084extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
85
86#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053087#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080088#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053089#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080090
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070091
92#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
93
Jeff Johnson295189b2012-06-20 16:38:30 -070094// TxMB Functions
95extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
96 tANI_U32 size, tSmeCmd **ppCmd );
97extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
98extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070099extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
100extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
101extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
102extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
103extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700105
106static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
107static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
108
109eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
110
111eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
112
Sushant Kaushik1d732562014-05-21 14:15:37 +0530113void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
114
Amar Singhal0d15bd52013-10-12 23:13:13 -0700115eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
116
Jeff Johnson295189b2012-06-20 16:38:30 -0700117eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
118
119eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
120
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700121#ifdef FEATURE_WLAN_LFR
122tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
123#endif
124
Chet Lanctot186b5732013-03-18 10:26:30 -0700125#ifdef WLAN_FEATURE_11W
126eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
127 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
128#endif
129
Jeff Johnson295189b2012-06-20 16:38:30 -0700130//Internal SME APIs
131eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
132{
133 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
134
135 if(psSme)
136 {
137 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
138 {
139 status = eHAL_STATUS_SUCCESS;
140 }
141 }
142
143 return (status);
144}
145
146
147eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
148{
149 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
150
151 if(psSme)
152 {
153 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
154 {
155 status = eHAL_STATUS_SUCCESS;
156 }
157 }
158
159 return (status);
160}
161
162
163
164static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
165{
166 eHalStatus status;
167 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530168 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700169 VOS_STATUS vosStatus;
170 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700171
172 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530173 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
174 &pMac->sme.smeCmdActiveList)))
175 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700176
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530177 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
178 &pMac->sme.smeCmdPendingList)))
179 goto end;
180
181 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
182 &pMac->sme.smeScanCmdActiveList)))
183 goto end;
184
185 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
186 &pMac->sme.smeScanCmdPendingList)))
187 goto end;
188
189 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
190 &pMac->sme.smeCmdFreeList)))
191 goto end;
192
Kiet Lam64c1b492013-07-12 13:56:44 +0530193 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
194 if ( NULL == pCmd )
195 status = eHAL_STATUS_FAILURE;
196 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530197 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530198 status = eHAL_STATUS_SUCCESS;
199
200 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
201 pMac->sme.pSmeCmdBufAddr = pCmd;
202
203 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
204 {
205 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530206 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530207 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 }
209
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700210 /* This timer is only to debug the active list command timeout */
211
212 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
213 if (cmdTimeoutTimer)
214 {
215 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
216 vosStatus =
217 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
218 VOS_TIMER_TYPE_SW,
219 activeListCmdTimeoutHandle,
220 (void*) pMac);
221
222 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
223 {
224 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
225 "Init Timer fail for active list command process time out");
226 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
227 }
228 else
229 {
230 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
231 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
232 }
233 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530234end:
235 if (!HAL_STATUS_SUCCESS(status))
236 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
237 status);
238
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 return (status);
240}
241
242
243void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
244{
245 pCmd->command = eSmeNoCommand;
246 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
247}
248
249
250
251static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
252{
253 tListElem *pEntry;
254 tSmeCmd *pCommand;
255
256 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
257 {
258 //TODO: base on command type to call release functions
259 //reinitialize different command types so they can be reused
260 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
261 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
262 }
263}
264
265static void purgeSmeCmdList(tpAniSirGlobal pMac)
266{
267 //release any out standing commands back to free command list
268 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
269 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530270 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
271 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700272}
273
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530274void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
275 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700276{
277 //release any out standing commands back to free command list
278 tListElem *pEntry, *pNext;
279 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 tDblLinkList localList;
281
282 vos_mem_zero(&localList, sizeof(tDblLinkList));
283 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
284 {
285 smsLog(pMac, LOGE, FL(" failed to open list"));
286 return;
287 }
288
289 csrLLLock(pList);
290 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
291 while(pEntry != NULL)
292 {
293 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
294 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
295 if(pCommand->sessionId == sessionId)
296 {
297 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
298 {
299 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
300 }
301 }
302 pEntry = pNext;
303 }
304 csrLLUnlock(pList);
305
306 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
307 {
308 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
309 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
310 }
311 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700312}
313
314
315static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
316{
317 eHalStatus status = eHAL_STATUS_SUCCESS;
318
319 purgeSmeCmdList(pMac);
320 csrLLClose(&pMac->sme.smeCmdPendingList);
321 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530322 csrLLClose(&pMac->sme.smeScanCmdPendingList);
323 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 csrLLClose(&pMac->sme.smeCmdFreeList);
325
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700326 /*destroy active list command time out timer */
327 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
328 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
329 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
330
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800331 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
332 if(status != eHAL_STATUS_SUCCESS)
333 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800334 smsLog(pMac, LOGE,
335 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800336 goto done;
337 }
338
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 if(NULL != pMac->sme.pSmeCmdBufAddr)
340 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530341 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 pMac->sme.pSmeCmdBufAddr = NULL;
343 }
344
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800345 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
346 if(status != eHAL_STATUS_SUCCESS)
347 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800348 smsLog(pMac, LOGE,
349 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800350 }
351done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 return (status);
353}
354
355
356void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
357{
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 switch( pCmd->command )
359 {
360 case eSmeCommandScan:
361 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
362 break;
363
364 case eSmeCommandRoam:
365 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
366 break;
367
368 case eSmeCommandWmStatusChange:
369 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
370 break;
371
372 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800373 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
375 break;
376
377 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800378 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
380 break;
381
382 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700383 smsLog( pMac, LOGE, " default: Unhandled command %d",
384 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 break;
386 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700387}
388
389tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
390{
391 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
392 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530393 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700394 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
395
396 // If we can get another MS Msg buffer, then we are ok. Just link
397 // the entry onto the linked list. (We are using the linked list
398 // to keep track of tfhe message buffers).
399 if ( pEntry )
400 {
401 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530402 /* reset when free list is available */
403 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
405 else {
406 int idx = 1;
407
408 //Cannot change pRetCmd here since it needs to return later.
409 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
410 if( pEntry )
411 {
412 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
413 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800414 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
416 if(pTempCmd)
417 {
418 if( eSmeCsrCommandMask & pTempCmd->command )
419 {
420 //CSR command is stuck. See what the reason code is for that command
421 dumpCsrCommandInfo(pMac, pTempCmd);
422 }
423 } //if(pTempCmd)
424
425 //dump what is in the pending queue
426 csrLLLock(&pMac->sme.smeCmdPendingList);
427 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530428 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 {
430 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530431 /* Print only 1st five commands from pending queue. */
432 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800433 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530434 idx, pTempCmd->command );
435 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 if( eSmeCsrCommandMask & pTempCmd->command )
437 {
438 //CSR command is stuck. See what the reason code is for that command
439 dumpCsrCommandInfo(pMac, pTempCmd);
440 }
441 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
442 }
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530443 /* Increament static variable so that it prints pending command only once*/
444 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 csrLLUnlock(&pMac->sme.smeCmdPendingList);
446
447 //There may be some more command in CSR's own pending queue
448 csrLLLock(&pMac->roam.roamCmdPendingList);
449 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
450 while(pEntry)
451 {
452 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800453 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 idx++, pTempCmd->command );
455 dumpCsrCommandInfo(pMac, pTempCmd);
456 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
457 }
458 csrLLUnlock(&pMac->roam.roamCmdPendingList);
459 }
460
461 return( pRetCmd );
462}
463
464
465void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
466{
467 if ( fHighPriority )
468 {
469 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
470 }
471 else
472 {
473 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
474 }
475
476 // process the command queue...
477 smeProcessPendingQueue( pMac );
478
479 return;
480}
481
482
483static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
484{
485 eSmeCommandType pmcCommand = eSmeNoCommand;
486 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
487 tPmcState pmcState;
488 eHalStatus status;
489
490 do
491 {
492 pmcState = pmcGetPmcState(pMac);
493
494 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
495 if( !HAL_STATUS_SUCCESS(status) )
496 {
497 //PMC state is not right for the command, drop it
498 return ( eSmeDropCommand );
499 }
500 if( fFullPowerNeeded ) break;
501 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
502 ( eSmeCommandDelTs == pCommand->command ) );
503 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700504#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700505 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700506 eSmeCommandOemDataReq == pCommand->command);
507 if(fFullPowerNeeded) break;
508#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700509 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 eSmeCommandRemainOnChannel == pCommand->command);
511 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 } while(0);
513
514 if( fFullPowerNeeded )
515 {
516 switch( pmcState )
517 {
518 case IMPS:
519 case STANDBY:
520 pmcCommand = eSmeCommandExitImps;
521 break;
522
523 case BMPS:
524 pmcCommand = eSmeCommandExitBmps;
525 break;
526
527 case UAPSD:
528 pmcCommand = eSmeCommandExitUapsd;
529 break;
530
531 case WOWL:
532 pmcCommand = eSmeCommandExitWowl;
533 break;
534
535 default:
536 break;
537 }
538 }
539
540 return ( pmcCommand );
541}
542
543
544//For commands that need to do extra cleanup.
545static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
546{
547 if( eSmePmcCommandMask & pCommand->command )
548 {
549 pmcAbortCommand( pMac, pCommand, fStopping );
550 }
551 else if ( eSmeCsrCommandMask & pCommand->command )
552 {
553 csrAbortCommand( pMac, pCommand, fStopping );
554 }
555 else
556 {
557 switch( pCommand->command )
558 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eSmeCommandRemainOnChannel:
560 if (NULL != pCommand->u.remainChlCmd.callback)
561 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700562 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 pCommand->u.remainChlCmd.callback;
564 /* process the msg */
565 if( callback )
566 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700567 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 eCSR_SCAN_ABORT );
569 }
570 }
571 smeReleaseCommand( pMac, pCommand );
572 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 default:
574 smeReleaseCommand( pMac, pCommand );
575 break;
576 }
577 }
578}
579
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530580tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
581 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
582{
583 tListElem *pCurEntry = NULL;
584 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700585
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530586 /* Go through the list and return the command whose session id is not
587 * matching with the current ongoing scan cmd sessionId */
588 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
589 while (pCurEntry)
590 {
591 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
592 if (pCommand->sessionId != sessionId)
593 {
594 smsLog(pMac, LOG1, "selected the command with different sessionId");
595 return pCurEntry;
596 }
597
598 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
599 }
600
601 smsLog(pMac, LOG1, "No command pending with different sessionId");
602 return NULL;
603}
604
605tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
606{
607 tListElem *pEntry;
608 tSmeCmd *pCommand;
609 tListElem *pSmeEntry;
610 tSmeCmd *pSmeCommand;
611 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
612
613 csrLLLock( &pMac->sme.smeScanCmdActiveList );
614 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
615 LL_ACCESS_NOLOCK ))
616 {
617 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
618 LL_ACCESS_LOCK))
619 {
620 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
621 LL_ACCESS_LOCK );
622 if (pEntry)
623 {
624 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
625 //We cannot execute any command in wait-for-key state until setKey is through.
626 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
627 {
628 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
629 {
630 smsLog(pMac, LOGE,
631 " Cannot process command(%d) while waiting for key",
632 pCommand->command);
633 status = eANI_BOOLEAN_FALSE;
634 goto end;
635 }
636 }
637
638 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
639 LL_ACCESS_LOCK )))
640 {
641 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
642 LL_ACCESS_LOCK);
643 if (pEntry)
644 {
645 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
646 Link) ;
647
648 /* if scan is running on one interface and SME recei
649 ves the next command on the same interface then
650 dont the allow the command to be queued to
651 smeCmdPendingList. If next scan is allowed on
652 the same interface the CSR state machine will
653 get screwed up. */
654 if (pSmeCommand->sessionId == pCommand->sessionId)
655 {
656 status = eANI_BOOLEAN_FALSE;
657 goto end;
658 }
659 }
660 }
661 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
662 pEntry, LL_ACCESS_LOCK ) )
663 {
664 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
665 &pCommand->Link, LL_ACCESS_NOLOCK );
666
667 switch (pCommand->command)
668 {
669 case eSmeCommandScan:
670 smsLog(pMac, LOG1,
671 " Processing scan offload command ");
672 csrProcessScanCommand( pMac, pCommand );
673 break;
674 default:
675 smsLog(pMac, LOGE,
676 " Something wrong, wrong command enqueued"
677 " to smeScanCmdPendingList");
678 pEntry = csrLLRemoveHead(
679 &pMac->sme.smeScanCmdActiveList,
680 LL_ACCESS_NOLOCK );
681 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
682 smeReleaseCommand( pMac, pCommand );
683 break;
684 }
685 }
686 }
687 }
688 }
689end:
690 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
691 return status;
692}
Jeff Johnson295189b2012-06-20 16:38:30 -0700693
694tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
695{
696 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
697 eHalStatus status = eHAL_STATUS_SUCCESS;
698 tListElem *pEntry;
699 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530700 tListElem *pSmeEntry;
701 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 eSmeCommandType pmcCommand = eSmeNoCommand;
703
704 // if the ActiveList is empty, then nothing is active so we can process a
705 // pending command...
706 //alwasy lock active list before locking pending list
707 csrLLLock( &pMac->sme.smeCmdActiveList );
708 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
709 {
710 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
711 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530712 /* If scan command is pending in the smeScanCmdActive list
713 * then pick the command from smeCmdPendingList which is
714 * not matching with the scan command session id.
715 * At any point of time only one command will be allowed
716 * on a single session. */
717 if ((pMac->fScanOffload) &&
718 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
719 LL_ACCESS_LOCK)))
720 {
721 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
722 LL_ACCESS_LOCK);
723 if (pSmeEntry)
724 {
725 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
726
727 pEntry = csrGetCmdToProcess(pMac,
728 &pMac->sme.smeCmdPendingList,
729 pSmeCommand->sessionId,
730 LL_ACCESS_LOCK);
731 goto sme_process_cmd;
732 }
733 }
734
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 //Peek the command
736 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530737sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 if( pEntry )
739 {
740 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530741
Abhishek Singhf4669da2014-05-26 15:07:49 +0530742 /* Allow only disconnect command
743 * in wait-for-key state until setKey is through.
744 */
745 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
746 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 {
748 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
749 {
750 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530751 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
752 "command(%d) while waiting for key"),
753 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530754 fContinue = eANI_BOOLEAN_FALSE;
755 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 }
757 }
758 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
759 if( eSmeDropCommand == pmcCommand )
760 {
761 //This command is not ok for current PMC state
762 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
763 {
764 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
765 }
766 csrLLUnlock( &pMac->sme.smeCmdActiveList );
767 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530768 fContinue = eANI_BOOLEAN_TRUE;
769 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 }
771 else if( eSmeNoCommand != pmcCommand )
772 {
773 tExitBmpsInfo exitBmpsInfo;
774 void *pv = NULL;
775 tANI_U32 size = 0;
776 tSmeCmd *pPmcCmd = NULL;
777
778 if( eSmeCommandExitBmps == pmcCommand )
779 {
780 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
781 pv = (void *)&exitBmpsInfo;
782 size = sizeof(tExitBmpsInfo);
783 }
784 //pmcCommand has to be one of the exit power save command
785 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
786 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
787 {
788 //Force this command to wake up the chip
789 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
790 csrLLUnlock( &pMac->sme.smeCmdActiveList );
791 fContinue = pmcProcessCommand( pMac, pPmcCmd );
792 if( fContinue )
793 {
794 //The command failed, remove it
795 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
796 {
797 pmcReleaseCommand( pMac, pPmcCmd );
798 }
799 }
800 }
801 else
802 {
803 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800804 smsLog( pMac, LOGE, FL( "Cannot issue command(0x%X) to wake up the chip. Status = %d"), pmcCommand, status );
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 //Let it retry
806 fContinue = eANI_BOOLEAN_TRUE;
807 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530808 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 }
810 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
811 {
812 // we can reuse the pCommand
813
814 // Insert the command onto the ActiveList...
815 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
816
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530817 if( pMac->deferImps )
818 {
819 /* IMPS timer is already running so stop it and
820 * it will get restarted when no command is pending
821 */
822 csrScanStopIdleScanTimer( pMac );
823 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
824 pMac->deferImps = eANI_BOOLEAN_FALSE;
825 }
826
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 // .... and process the command.
828
Katya Nigambcb705f2013-12-26 14:26:22 +0530829 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700830 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 switch ( pCommand->command )
832 {
833
834 case eSmeCommandScan:
835 csrLLUnlock( &pMac->sme.smeCmdActiveList );
836 status = csrProcessScanCommand( pMac, pCommand );
837 break;
838
839 case eSmeCommandRoam:
840 csrLLUnlock( &pMac->sme.smeCmdActiveList );
841 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800842 if(!HAL_STATUS_SUCCESS(status))
843 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700844 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800845 &pCommand->Link, LL_ACCESS_LOCK ) )
846 {
847 csrReleaseCommandRoam( pMac, pCommand );
848 }
849 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 break;
851
852 case eSmeCommandWmStatusChange:
853 csrLLUnlock( &pMac->sme.smeCmdActiveList );
854 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
855 break;
856
857 case eSmeCommandSetKey:
858 csrLLUnlock( &pMac->sme.smeCmdActiveList );
859 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
860 if(!HAL_STATUS_SUCCESS(status))
861 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700862 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 &pCommand->Link, LL_ACCESS_LOCK ) )
864 {
865 csrReleaseCommandSetKey( pMac, pCommand );
866 }
867 }
868 break;
869
870 case eSmeCommandRemoveKey:
871 csrLLUnlock( &pMac->sme.smeCmdActiveList );
872 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
873 if(!HAL_STATUS_SUCCESS(status))
874 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700875 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 &pCommand->Link, LL_ACCESS_LOCK ) )
877 {
878 csrReleaseCommandRemoveKey( pMac, pCommand );
879 }
880 }
881 break;
882
883 case eSmeCommandAddStaSession:
884 csrLLUnlock( &pMac->sme.smeCmdActiveList );
885 csrProcessAddStaSessionCommand( pMac, pCommand );
886 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700887 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 csrLLUnlock( &pMac->sme.smeCmdActiveList );
889 csrProcessDelStaSessionCommand( pMac, pCommand );
890 break;
891
Jeff Johnsone7245742012-09-05 17:12:55 -0700892#ifdef FEATURE_OEM_DATA_SUPPORT
893 case eSmeCommandOemDataReq:
894 csrLLUnlock(&pMac->sme.smeCmdActiveList);
895 oemData_ProcessOemDataReqCommand(pMac, pCommand);
896 break;
897#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 case eSmeCommandRemainOnChannel:
899 csrLLUnlock(&pMac->sme.smeCmdActiveList);
900 p2pProcessRemainOnChannelCmd(pMac, pCommand);
901 break;
902 case eSmeCommandNoAUpdate:
903 csrLLUnlock( &pMac->sme.smeCmdActiveList );
904 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 case eSmeCommandEnterImps:
906 case eSmeCommandExitImps:
907 case eSmeCommandEnterBmps:
908 case eSmeCommandExitBmps:
909 case eSmeCommandEnterUapsd:
910 case eSmeCommandExitUapsd:
911 case eSmeCommandEnterWowl:
912 case eSmeCommandExitWowl:
913 csrLLUnlock( &pMac->sme.smeCmdActiveList );
914 fContinue = pmcProcessCommand( pMac, pCommand );
915 if( fContinue )
916 {
917 //The command failed, remove it
918 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
919 &pCommand->Link, LL_ACCESS_LOCK ) )
920 {
921 pmcReleaseCommand( pMac, pCommand );
922 }
923 }
924 break;
925
926 //Treat standby differently here because caller may not be able to handle
927 //the failure so we do our best here
928 case eSmeCommandEnterStandby:
929 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
930 {
931 //It can continue
932 csrLLUnlock( &pMac->sme.smeCmdActiveList );
933 fContinue = pmcProcessCommand( pMac, pCommand );
934 if( fContinue )
935 {
936 //The command failed, remove it
937 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
938 &pCommand->Link, LL_ACCESS_LOCK ) )
939 {
940 pmcReleaseCommand( pMac, pCommand );
941 }
942 }
943 }
944 else
945 {
946 //Need to issue a disconnect first before processing this command
947 tSmeCmd *pNewCmd;
948
949 //We need to re-run the command
950 fContinue = eANI_BOOLEAN_TRUE;
951 //Pull off the standby command first
952 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
953 &pCommand->Link, LL_ACCESS_NOLOCK ) )
954 {
955 csrLLUnlock( &pMac->sme.smeCmdActiveList );
956 //Need to call CSR function here because the disconnect command
957 //is handled by CSR
958 pNewCmd = csrGetCommandBuffer( pMac );
959 if( NULL != pNewCmd )
960 {
961 //Put the standby command to the head of the pending list first
962 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
963 LL_ACCESS_LOCK );
964 pNewCmd->command = eSmeCommandRoam;
965 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
966 //Put the disassoc command before the standby command
967 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
968 LL_ACCESS_LOCK );
969 }
970 else
971 {
972 //Continue the command here
973 fContinue = pmcProcessCommand( pMac, pCommand );
974 if( fContinue )
975 {
976 //The command failed, remove it
977 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
978 &pCommand->Link, LL_ACCESS_LOCK ) )
979 {
980 pmcReleaseCommand( pMac, pCommand );
981 }
982 }
983 }
984 }
985 else
986 {
987 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800988 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 VOS_ASSERT(0);
990 }
991 }
992 break;
993
994 case eSmeCommandAddTs:
995 case eSmeCommandDelTs:
996 csrLLUnlock( &pMac->sme.smeCmdActiveList );
997#ifndef WLAN_MDM_CODE_REDUCTION_OPT
998 fContinue = qosProcessCommand( pMac, pCommand );
999 if( fContinue )
1000 {
1001 //The command failed, remove it
1002 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1003 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1004 {
1005//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1006 qosReleaseCommand( pMac, pCommand );
1007//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1008 }
1009 }
1010#endif
1011 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001012#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001013 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001014 case eSmeCommandTdlsAddPeer:
1015 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301016 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301017 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001018#ifdef FEATURE_WLAN_TDLS_INTERNAL
1019 case eSmeCommandTdlsDiscovery:
1020 case eSmeCommandTdlsLinkSetup:
1021 case eSmeCommandTdlsLinkTear:
1022 case eSmeCommandTdlsEnterUapsd:
1023 case eSmeCommandTdlsExitUapsd:
1024#endif
1025 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001026 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001027 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001028
1029 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1030 status = csrTdlsProcessCmd( pMac, pCommand );
1031 }
1032 break ;
1033#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001034
1035 default:
1036 //something is wrong
1037 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001038 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001039 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1040 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1041 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1042 smeReleaseCommand( pMac, pCommand );
1043 status = eHAL_STATUS_FAILURE;
1044 break;
1045 }
1046 if(!HAL_STATUS_SUCCESS(status))
1047 {
1048 fContinue = eANI_BOOLEAN_TRUE;
1049 }
1050 }//if(pEntry)
1051 else
1052 {
1053 //This is odd. Some one else pull off the command.
1054 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1055 }
1056 }
1057 else
1058 {
1059 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1060 }
1061 }
1062 else
1063 {
1064 //No command waiting
1065 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1066 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1067 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1068 {
1069 tANI_U32 nTime = 0;
1070
1071 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1072 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1073 {
1074 csrScanStartIdleScanTimer(pMac, nTime);
1075 }
1076 }
1077 }
1078 }
1079 else {
1080 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1081 }
1082
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301083sme_process_scan_queue:
1084 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1085 fContinue = eANI_BOOLEAN_FALSE;
1086
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 return ( fContinue );
1088}
1089
1090void smeProcessPendingQueue( tpAniSirGlobal pMac )
1091{
1092 while( smeProcessCommand( pMac ) );
1093}
1094
1095
1096tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1097{
1098 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1099 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1100}
1101
1102
1103
1104//Global APIs
1105
1106/*--------------------------------------------------------------------------
1107
1108 \brief sme_Open() - Initialze all SME modules and put them at idle state
1109
1110 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1111 successfully return, all modules are at idle state ready to start.
1112
1113 smeOpen must be called before any other SME APIs can be involved.
1114 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001115 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 \param hHal - The handle returned by macOpen.
1117
1118 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1119
1120 Other status means SME is failed to be initialized
1121 \sa
1122
1123 --------------------------------------------------------------------------*/
1124eHalStatus sme_Open(tHalHandle hHal)
1125{
1126 eHalStatus status = eHAL_STATUS_FAILURE;
1127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1128
1129 do {
1130 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001131 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1133 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001134 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 status = eHAL_STATUS_FAILURE;
1136 break;
1137 }
1138
1139 status = ccmOpen(hHal);
1140 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1141 smsLog( pMac, LOGE,
1142 "ccmOpen failed during initialization with status=%d", status );
1143 break;
1144 }
1145
1146 status = csrOpen(pMac);
1147 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1148 smsLog( pMac, LOGE,
1149 "csrOpen failed during initialization with status=%d", status );
1150 break;
1151 }
1152
1153 status = pmcOpen(hHal);
1154 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1155 smsLog( pMac, LOGE,
1156 "pmcOpen failed during initialization with status=%d", status );
1157 break;
1158 }
1159
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001160#ifdef FEATURE_WLAN_TDLS
1161 pMac->isTdlsPowerSaveProhibited = 0;
1162#endif
1163
Jeff Johnson295189b2012-06-20 16:38:30 -07001164#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1165 status = sme_QosOpen(pMac);
1166 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1167 smsLog( pMac, LOGE,
1168 "Qos open failed during initialization with status=%d", status );
1169 break;
1170 }
1171
1172 status = btcOpen(pMac);
1173 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1174 smsLog( pMac, LOGE,
1175 "btcOpen open failed during initialization with status=%d", status );
1176 break;
1177 }
1178#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001179#ifdef FEATURE_OEM_DATA_SUPPORT
1180 status = oemData_OemDataReqOpen(pMac);
1181 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1182 smsLog(pMac, LOGE,
1183 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1184 break;
1185 }
1186#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001187
1188 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1189 break;
1190
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 {
1192 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1193 if ( NULL == pvosGCtx ){
1194 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1195 status = eHAL_STATUS_FAILURE;
1196 break;
1197 }
1198
1199 status = WLANSAP_Open( pvosGCtx );
1200 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1201 smsLog( pMac, LOGE,
1202 "WLANSAP_Open open failed during initialization with status=%d", status );
1203 break;
1204 }
1205 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001206#if defined WLAN_FEATURE_VOWIFI
1207 status = rrmOpen(pMac);
1208 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1209 smsLog( pMac, LOGE,
1210 "rrmOpen open failed during initialization with status=%d", status );
1211 break;
1212 }
1213#endif
1214
1215#if defined WLAN_FEATURE_VOWIFI_11R
1216 sme_FTOpen(pMac);
1217#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001218 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001219 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001220
1221 }while (0);
1222
1223 return status;
1224}
1225
Jeff Johnson295189b2012-06-20 16:38:30 -07001226/*--------------------------------------------------------------------------
1227
1228 \brief sme_set11dinfo() - Set the 11d information about valid channels
1229 and there power using information from nvRAM
1230 This function is called only for AP.
1231
Srinivas Girigowdade697412013-02-14 16:31:48 -08001232 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001233
1234 \param hHal - The handle returned by macOpen.
1235 \Param pSmeConfigParams - a pointer to a caller allocated object of
1236 typedef struct _smeConfigParams.
1237
1238 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1239
1240 Other status means SME is failed to update the config parameters.
1241 \sa
1242--------------------------------------------------------------------------*/
1243
1244eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1245{
1246 eHalStatus status = eHAL_STATUS_FAILURE;
1247 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1248
Katya Nigambcb705f2013-12-26 14:26:22 +05301249 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001250 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 if (NULL == pSmeConfigParams ) {
1252 smsLog( pMac, LOGE,
1253 "Empty config param structure for SME, nothing to update");
1254 return status;
1255 }
1256
1257 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1258 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001259 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 status );
1261 }
1262 return status;
1263}
1264
1265/*--------------------------------------------------------------------------
1266
1267 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1268
Srinivas Girigowdade697412013-02-14 16:31:48 -08001269 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001270
1271 \param hHal - The handle returned by HostapdAdapter.
1272 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1273
1274 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1275
1276 Other status means, failed to get the current regulatory domain.
1277 \sa
1278--------------------------------------------------------------------------*/
1279
1280eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1281{
1282 eHalStatus status = eHAL_STATUS_FAILURE;
1283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1284
Katya Nigambcb705f2013-12-26 14:26:22 +05301285 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001286 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 if (NULL == domainIdSoftAp ) {
1288 smsLog( pMac, LOGE, "Uninitialized domain Id");
1289 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001290 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001291
1292 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1293 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001294
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 return status;
1296}
1297
1298
1299eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1300{
1301 eHalStatus status = eHAL_STATUS_FAILURE;
1302 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1303
Katya Nigambcb705f2013-12-26 14:26:22 +05301304 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001305 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001306 if (NULL == apCntryCode ) {
1307 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1308 return status;
1309 }
1310
1311 status = csrSetRegInfo(hHal, apCntryCode );
1312 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001313 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 status );
1315 }
1316 return status;
1317}
1318
Jeff Johnson295189b2012-06-20 16:38:30 -07001319#ifdef FEATURE_WLAN_SCAN_PNO
1320/*--------------------------------------------------------------------------
1321
1322 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001323
1324 It is used at driver start up to inform RIVA of the default channel
1325 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001326
Srinivas Girigowdade697412013-02-14 16:31:48 -08001327 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001328
1329 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001330
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1332
1333 Other status means SME is failed to update the channel config.
1334 \sa
1335
1336 --------------------------------------------------------------------------*/
1337eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1338{
1339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1340
Katya Nigambcb705f2013-12-26 14:26:22 +05301341 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001342 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1343 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 &pMac->scan.base20MHzChannels, FALSE);
1345 return eHAL_STATUS_SUCCESS;
1346}
1347#endif // FEATURE_WLAN_SCAN_PNLO
1348
Abhishek Singhf644b272014-08-21 02:59:39 +05301349eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1350{
1351 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1352 eHalStatus status = eHAL_STATUS_SUCCESS;
1353
1354 status = csrUpdateChannelList(pMac);
1355
1356 if (eHAL_STATUS_SUCCESS != status)
1357 {
1358 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1359 "failed to update the supported channel list");
1360 }
1361 return status;
1362}
1363
Jeff Johnson295189b2012-06-20 16:38:30 -07001364/*--------------------------------------------------------------------------
1365
1366 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1367
1368 The function updates some configuration for modules in SME, CCM, CSR, etc
1369 during SMEs close open sequence.
1370
1371 Modules inside SME apply the new configuration at the next transaction.
1372
Srinivas Girigowdade697412013-02-14 16:31:48 -08001373 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001374
1375 \param hHal - The handle returned by macOpen.
1376 \Param pSmeConfigParams - a pointer to a caller allocated object of
1377 typedef struct _smeConfigParams.
1378
1379 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1380
1381 Other status means SME is failed to update the config parameters.
1382 \sa
1383
1384 --------------------------------------------------------------------------*/
1385eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1386{
1387 eHalStatus status = eHAL_STATUS_FAILURE;
1388 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1389
Katya Nigambcb705f2013-12-26 14:26:22 +05301390 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001391 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 if (NULL == pSmeConfigParams ) {
1393 smsLog( pMac, LOGE,
1394 "Empty config param structure for SME, nothing to update");
1395 return status;
1396 }
1397
1398 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1399
1400 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001401 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 status );
1403 }
1404#if defined WLAN_FEATURE_P2P_INTERNAL
1405 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1406
1407 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001408 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 status );
1410 }
1411#endif
1412#if defined WLAN_FEATURE_VOWIFI
1413 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1414
1415 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001416 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 status );
1418 }
1419#endif
1420 //For SOC, CFG is set before start
1421 //We don't want to apply global CFG in connect state because that may cause some side affect
1422 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 csrIsAllSessionDisconnected( pMac) )
1424 {
1425 csrSetGlobalCfgs(pMac);
1426 }
1427
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301428 /* update the directed scan offload setting */
1429 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1430
Sandeep Puligilla60342762014-01-30 21:05:37 +05301431 /* Enable channel bonding mode in 2.4GHz */
1432 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1433 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1434 {
1435 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1436 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1437 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1438 "Setting channelBondingMode24GHz:%d " ,
1439 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1440 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301441 if (pMac->fScanOffload)
1442 {
1443 /* If scan offload is enabled then lim has allow the sending of
1444 scan request to firmware even in powersave mode. The firmware has
1445 to take care of exiting from power save mode */
1446 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1447 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1448
1449 if (eHAL_STATUS_SUCCESS != status)
1450 {
1451 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1452 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1453 }
1454 }
krunal sonie9002db2013-11-25 14:24:17 -08001455 pMac->isCoalesingInIBSSAllowed =
1456 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001457 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301458 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
1459
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 return status;
1461}
1462
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301463#ifdef WLAN_FEATURE_GTK_OFFLOAD
1464void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1465 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1466{
1467 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1468
1469 if (NULL == pMac)
1470 {
1471 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1472 "%s: pMac is null", __func__);
1473 return ;
1474 }
1475 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1476 {
1477 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1478 "%s: HDD callback is null", __func__);
1479 return ;
1480 }
1481 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1482 pGtkOffloadGetInfoRsp);
1483}
1484#endif
1485
Jeff Johnson295189b2012-06-20 16:38:30 -07001486/* ---------------------------------------------------------------------------
1487 \fn sme_ChangeConfigParams
1488 \brief The SME API exposed for HDD to provide config params to SME during
1489 SMEs stop -> start sequence.
1490
1491 If HDD changed the domain that will cause a reset. This function will
1492 provide the new set of 11d information for the new domain. Currrently this
1493 API provides info regarding 11d only at reset but we can extend this for
1494 other params (PMC, QoS) which needs to be initialized again at reset.
1495
Srinivas Girigowdade697412013-02-14 16:31:48 -08001496 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001497
1498 \param hHal - The handle returned by macOpen.
1499
1500 \Param
1501 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1502 currently provides 11d related information like Country code,
1503 Regulatory domain, valid channel list, Tx power per channel, a
1504 list with active/passive scan allowed per valid channel.
1505
1506 \return eHalStatus
1507 ---------------------------------------------------------------------------*/
1508eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1509 tCsrUpdateConfigParam *pUpdateConfigParam)
1510{
1511 eHalStatus status = eHAL_STATUS_FAILURE;
1512 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1513
1514 if (NULL == pUpdateConfigParam ) {
1515 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001516 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001517 return status;
1518 }
1519
1520 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1521
1522 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001523 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001524 status );
1525 }
1526
1527 return status;
1528
1529}
1530
1531/*--------------------------------------------------------------------------
1532
1533 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1534 that the NIC is ready tio run.
1535
1536 The function is called by HDD at the end of initialization stage so PE/HAL can
1537 enable the NIC to running state.
1538
Srinivas Girigowdade697412013-02-14 16:31:48 -08001539 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 \param hHal - The handle returned by macOpen.
1541
1542 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1543 successfully.
1544
1545 Other status means SME failed to send the message to PE.
1546 \sa
1547
1548 --------------------------------------------------------------------------*/
1549eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1550{
1551 tSirSmeReadyReq Msg;
1552 eHalStatus status = eHAL_STATUS_FAILURE;
1553 tPmcPowerState powerState;
1554 tPmcSwitchState hwWlanSwitchState;
1555 tPmcSwitchState swWlanSwitchState;
1556 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1557
Katya Nigambcb705f2013-12-26 14:26:22 +05301558 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001559 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 do
1561 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001562
1563 Msg.messageType = eWNI_SME_SYS_READY_IND;
1564 Msg.length = sizeof( tSirSmeReadyReq );
1565
1566 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1567 {
1568 status = eHAL_STATUS_SUCCESS;
1569 }
1570 else
1571 {
1572 smsLog( pMac, LOGE,
1573 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1574 break;
1575 }
1576
1577 status = pmcQueryPowerState( hHal, &powerState,
1578 &hwWlanSwitchState, &swWlanSwitchState );
1579 if ( ! HAL_STATUS_SUCCESS( status ) )
1580 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001581 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 status );
1583 break;
1584 }
1585
1586 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1587 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1588 {
1589 status = csrReady(pMac);
1590 if ( ! HAL_STATUS_SUCCESS( status ) )
1591 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001592 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001593 break;
1594 }
1595 status = pmcReady(hHal);
1596 if ( ! HAL_STATUS_SUCCESS( status ) )
1597 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001598 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 break;
1600 }
1601#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1602 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1603 {
1604 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001605 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 break;
1607 }
1608#endif
1609
1610#if defined WLAN_FEATURE_VOWIFI
1611 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1612 {
1613 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001614 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 break;
1616 }
1617#endif
1618 }
1619 pMac->sme.state = SME_STATE_READY;
1620 } while( 0 );
1621
1622 return status;
1623}
1624
1625/*--------------------------------------------------------------------------
1626
1627 \brief sme_Start() - Put all SME modules at ready state.
1628
1629 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1630 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001631 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 \param hHal - The handle returned by macOpen.
1633
1634 \return eHAL_STATUS_SUCCESS - SME is ready.
1635
1636 Other status means SME is failed to start
1637 \sa
1638
1639 --------------------------------------------------------------------------*/
1640eHalStatus sme_Start(tHalHandle hHal)
1641{
1642 eHalStatus status = eHAL_STATUS_FAILURE;
1643 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1644
1645 do
1646 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 status = csrStart(pMac);
1648 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001649 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 status );
1651 break;
1652 }
1653
1654 status = pmcStart(hHal);
1655 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001656 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001657 status );
1658 break;
1659 }
1660
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1662 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001663 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 status );
1665 break;
1666 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 pMac->sme.state = SME_STATE_START;
1668 }while (0);
1669
1670 return status;
1671}
1672
1673
1674#ifdef WLAN_FEATURE_PACKET_FILTERING
1675/******************************************************************************
1676*
1677* Name: sme_PCFilterMatchCountResponseHandler
1678*
1679* Description:
1680* Invoke Packet Coalescing Filter Match Count callback routine
1681*
1682* Parameters:
1683* hHal - HAL handle for device
1684* pMsg - Pointer to tRcvFltPktMatchRsp structure
1685*
1686* Returns: eHalStatus
1687*
1688******************************************************************************/
1689eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1690{
1691 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1692 eHalStatus status = eHAL_STATUS_SUCCESS;
1693 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1694
1695 if (NULL == pMsg)
1696 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001697 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 status = eHAL_STATUS_FAILURE;
1699 }
1700 else
1701 {
1702 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001703 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001704
1705 /* Call Packet Coalescing Filter Match Count callback routine. */
1706 if (pMac->pmc.FilterMatchCountCB != NULL)
1707 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1708 pRcvFltPktMatchRsp);
1709
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001710 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 pRcvFltPktMatchRsp->status);
1712
1713 pMac->pmc.FilterMatchCountCB = NULL;
1714 pMac->pmc.FilterMatchCountCBContext = NULL;
1715 }
1716
1717 return(status);
1718}
1719#endif // WLAN_FEATURE_PACKET_FILTERING
1720
1721
Chet Lanctot186b5732013-03-18 10:26:30 -07001722#ifdef WLAN_FEATURE_11W
1723/*------------------------------------------------------------------
1724 *
1725 * Handle the unprotected management frame indication from LIM and
1726 * forward it to HDD.
1727 *
1728 *------------------------------------------------------------------*/
1729
1730eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1731 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1732{
1733 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1734 eHalStatus status = eHAL_STATUS_SUCCESS;
1735 tCsrRoamInfo pRoamInfo = {0};
1736 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1737
1738 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1739 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1740 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1741
1742 /* forward the mgmt frame to HDD */
1743 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1744
1745 return status;
1746}
1747#endif
1748
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001749#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001750/*------------------------------------------------------------------
1751 *
1752 * Handle the tsm ie indication from LIM and forward it to HDD.
1753 *
1754 *------------------------------------------------------------------*/
1755
1756eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1757{
1758 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1759 eHalStatus status = eHAL_STATUS_SUCCESS;
1760 tCsrRoamInfo pRoamInfo = {0};
1761 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1762
1763 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1764 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1765 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1766
1767 /* forward the tsm ie information to HDD */
1768 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1769
1770 return status;
1771}
1772
1773/* ---------------------------------------------------------------------------
1774 \fn sme_SetCCKMIe
1775 \brief function to store the CCKM IE passed from supplicant and use it while packing
1776 reassociation request
1777 \param hHal - HAL handle for device
1778 \param pCckmIe - pointer to CCKM IE data
1779 \param pCckmIeLen - length of the CCKM IE
1780 \- return Success or failure
1781 -------------------------------------------------------------------------*/
1782eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1783 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1784{
1785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1786 eHalStatus status = eHAL_STATUS_SUCCESS;
1787
1788 status = sme_AcquireGlobalLock( &pMac->sme );
1789 if ( HAL_STATUS_SUCCESS( status ) )
1790 {
1791 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1792 sme_ReleaseGlobalLock( &pMac->sme );
1793 }
1794 return status;
1795}
1796
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001797/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001798 \fn sme_SetEseBeaconRequest
1799 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001800 \param hHal - HAL handle for device
1801 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001802 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001803 \- return Success or failure
1804 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001805eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1806 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001807{
1808 eHalStatus status = eSIR_SUCCESS;
1809 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1810 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001811 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001812 tANI_U8 counter = 0;
1813 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1814 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1815
1816 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001817 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001818
1819 //Prepare the request to send to SME.
1820 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1821 if(NULL == pSmeBcnReportReq)
1822 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001823 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001824 return eSIR_FAILURE;
1825 }
1826
1827 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1828 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1829
1830 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1831 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1832 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1833 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001834 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1835 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001836
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001837 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001838 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001839 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001840 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1841 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1842 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1843 }
1844
1845 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1846 return status;
1847}
1848
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001849#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001850
Chet Lanctot186b5732013-03-18 10:26:30 -07001851
c_hpothu92367912014-05-01 15:18:17 +05301852/* ---------------------------------------------------------------------------
1853 \fn sme_getBcnMissRate
1854 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1855 \param hHal - HAL handle for device.
1856 \param sessionId - session ID.
1857 \- return Success or Failure.
1858 -------------------------------------------------------------------------*/
1859
1860eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1861{
1862 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1863 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1864 vos_msg_t vosMessage;
1865 tSirBcnMissRateReq *pMsg;
1866 tCsrRoamSession *pSession;
1867
1868 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1869 {
1870 pSession = CSR_GET_SESSION( pMac, sessionId );
1871
1872 if (!pSession)
1873 {
1874 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1875 sme_ReleaseGlobalLock( &pMac->sme );
1876 return eHAL_STATUS_FAILURE;
1877 }
1878
c_hpothu402de812014-07-10 15:55:45 +05301879 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05301880 if (NULL == pMsg)
1881 {
1882 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1883 sme_ReleaseGlobalLock( &pMac->sme );
1884 return eHAL_STATUS_FAILURE;
1885 }
1886
1887 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1888 sizeof(tSirMacAddr));
1889
1890 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1891 pMsg->callback = callback;
1892 pMsg->data = data;
1893
1894 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1895 vosMessage.bodyptr = pMsg;
1896 vosMessage.reserved = 0;
1897 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1898 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1899 {
1900 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1901 "%s: Post Set TM Level MSG fail", __func__);
1902 vos_mem_free(pMsg);
1903 sme_ReleaseGlobalLock( &pMac->sme );
1904 return eHAL_STATUS_FAILURE;
1905 }
1906 sme_ReleaseGlobalLock( &pMac->sme);
1907 return eHAL_STATUS_SUCCESS;
1908 }
1909 return eHAL_STATUS_FAILURE;
1910}
1911
Jeff Johnson295189b2012-06-20 16:38:30 -07001912/*--------------------------------------------------------------------------
1913
1914 \brief sme_ProcessMsg() - The main message processor for SME.
1915
1916 The function is called by a message dispatcher when to process a message
1917 targeted for SME.
1918
Srinivas Girigowdade697412013-02-14 16:31:48 -08001919 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 \param hHal - The handle returned by macOpen.
1921 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1922
1923 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1924
1925 Other status means SME failed to process the message to HAL.
1926 \sa
1927
1928 --------------------------------------------------------------------------*/
1929eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1930{
1931 eHalStatus status = eHAL_STATUS_FAILURE;
1932 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1933
1934 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001935 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 return status;
1937 }
1938
1939 status = sme_AcquireGlobalLock( &pMac->sme );
1940 if ( HAL_STATUS_SUCCESS( status ) )
1941 {
1942 if( SME_IS_START(pMac) )
1943 {
1944 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1945 case eWNI_PMC_ENTER_BMPS_RSP:
1946 case eWNI_PMC_EXIT_BMPS_RSP:
1947 case eWNI_PMC_EXIT_BMPS_IND:
1948 case eWNI_PMC_ENTER_IMPS_RSP:
1949 case eWNI_PMC_EXIT_IMPS_RSP:
1950 case eWNI_PMC_SMPS_STATE_IND:
1951 case eWNI_PMC_ENTER_UAPSD_RSP:
1952 case eWNI_PMC_EXIT_UAPSD_RSP:
1953 case eWNI_PMC_ENTER_WOWL_RSP:
1954 case eWNI_PMC_EXIT_WOWL_RSP:
1955 //PMC
1956 if (pMsg->bodyptr)
1957 {
1958 pmcMessageProcessor(hHal, pMsg->bodyptr);
1959 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301960 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001962 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 }
1964 break;
1965
1966 case WNI_CFG_SET_CNF:
1967 case WNI_CFG_DNLD_CNF:
1968 case WNI_CFG_GET_RSP:
1969 case WNI_CFG_ADD_GRP_ADDR_CNF:
1970 case WNI_CFG_DEL_GRP_ADDR_CNF:
1971 //CCM
1972 if (pMsg->bodyptr)
1973 {
1974 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1975 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301976 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001978 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 }
1980 break;
1981
1982 case eWNI_SME_ADDTS_RSP:
1983 case eWNI_SME_DELTS_RSP:
1984 case eWNI_SME_DELTS_IND:
1985#ifdef WLAN_FEATURE_VOWIFI_11R
1986 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001987#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001988 //QoS
1989 if (pMsg->bodyptr)
1990 {
1991#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1992 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301993 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001994#endif
1995 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001996 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 }
1998 break;
1999#if defined WLAN_FEATURE_VOWIFI
2000 case eWNI_SME_NEIGHBOR_REPORT_IND:
2001 case eWNI_SME_BEACON_REPORT_REQ_IND:
2002#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002003 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002004#endif
2005 if ( pMsg->bodyptr )
2006 {
2007 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302008 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 }
2010 else
2011 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002012 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 }
2014 break;
2015#endif
2016
Jeff Johnsone7245742012-09-05 17:12:55 -07002017#ifdef FEATURE_OEM_DATA_SUPPORT
2018 //Handle the eWNI_SME_OEM_DATA_RSP:
2019 case eWNI_SME_OEM_DATA_RSP:
2020 if(pMsg->bodyptr)
2021 {
2022 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2023 vos_mem_free(pMsg->bodyptr);
2024 }
2025 else
2026 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002027 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002028 }
2029 smeProcessPendingQueue( pMac );
2030 break;
2031#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002032
2033 case eWNI_SME_ADD_STA_SELF_RSP:
2034 if(pMsg->bodyptr)
2035 {
2036 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2037 vos_mem_free(pMsg->bodyptr);
2038 }
2039 else
2040 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002041 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 }
2043 break;
2044 case eWNI_SME_DEL_STA_SELF_RSP:
2045 if(pMsg->bodyptr)
2046 {
2047 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2048 vos_mem_free(pMsg->bodyptr);
2049 }
2050 else
2051 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002052 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 }
2054 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 case eWNI_SME_REMAIN_ON_CHN_RSP:
2056 if(pMsg->bodyptr)
2057 {
2058 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2059 vos_mem_free(pMsg->bodyptr);
2060 }
2061 else
2062 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002063 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 }
2065 break;
2066 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2067 if(pMsg->bodyptr)
2068 {
2069 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2070 vos_mem_free(pMsg->bodyptr);
2071 }
2072 else
2073 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002074 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 -07002075 }
2076 break;
2077 case eWNI_SME_MGMT_FRM_IND:
2078 if(pMsg->bodyptr)
2079 {
2080 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2081 vos_mem_free(pMsg->bodyptr);
2082 }
2083 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002084 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002085 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 }
2087 break;
2088 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2089 if(pMsg->bodyptr)
2090 {
2091 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2092 vos_mem_free(pMsg->bodyptr);
2093 }
2094 else
2095 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002096 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 }
2098 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 case eWNI_SME_COEX_IND:
2100 if(pMsg->bodyptr)
2101 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302102 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2103
2104 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2105 {
2106 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2107 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2108 pMac->isCoexScoIndSet = 1;
2109 }
2110 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2111 {
2112 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2113 pMac->isCoexScoIndSet = 0;
2114 sme_RequestBmps(hHal, NULL, NULL);
2115 }
2116
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2118 vos_mem_free(pMsg->bodyptr);
2119 }
2120 else
2121 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002122 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002124 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002125
2126#ifdef FEATURE_WLAN_SCAN_PNO
2127 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2128 if(pMsg->bodyptr)
2129 {
2130 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2131 vos_mem_free(pMsg->bodyptr);
2132 }
2133 else
2134 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002135 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002136 }
2137 break;
2138#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002139
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 case eWNI_SME_TX_PER_HIT_IND:
2141 if (pMac->sme.pTxPerHitCallback)
2142 {
2143 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2144 }
2145 break;
2146
2147 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002148 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 {
2150 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2151 vos_mem_free(pMsg->bodyptr);
2152 }
2153 else
2154 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002155 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2156 }
2157 break;
2158
2159 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2160 if (pMsg->bodyptr)
2161 {
2162 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2163 vos_mem_free(pMsg->bodyptr);
2164 }
2165 else
2166 {
2167 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 }
2169 break;
2170
2171#ifdef WLAN_FEATURE_PACKET_FILTERING
2172 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2173 if(pMsg->bodyptr)
2174 {
2175 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2176 vos_mem_free(pMsg->bodyptr);
2177 }
2178 else
2179 {
2180 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002181 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 }
2183 break;
2184#endif // WLAN_FEATURE_PACKET_FILTERING
2185 case eWNI_SME_PRE_SWITCH_CHL_IND:
2186 {
2187 status = sme_HandlePreChannelSwitchInd(pMac);
2188 break;
2189 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002190
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 case eWNI_SME_POST_SWITCH_CHL_IND:
2192 {
2193 status = sme_HandlePostChannelSwitchInd(pMac);
2194 break;
2195 }
2196
2197#ifdef WLAN_WAKEUP_EVENTS
2198 case eWNI_SME_WAKE_REASON_IND:
2199 if(pMsg->bodyptr)
2200 {
2201 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2202 vos_mem_free(pMsg->bodyptr);
2203 }
2204 else
2205 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002206 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 }
2208 break;
2209#endif // WLAN_WAKEUP_EVENTS
2210
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002211#ifdef FEATURE_WLAN_TDLS
2212 /*
2213 * command rescived from PE, SME tdls msg processor shall be called
2214 * to process commands recieved from PE
2215 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002216 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2217 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002218 case eWNI_SME_TDLS_DEL_STA_RSP:
2219 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002220 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002221 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302222 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302223 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002224#ifdef FEATURE_WLAN_TDLS_INTERNAL
2225 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2226 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2227 case eWNI_SME_TDLS_LINK_START_RSP:
2228 case eWNI_SME_TDLS_LINK_START_IND:
2229 case eWNI_SME_TDLS_TEARDOWN_RSP:
2230 case eWNI_SME_TDLS_TEARDOWN_IND:
2231 case eWNI_SME_ADD_TDLS_PEER_IND:
2232 case eWNI_SME_DELETE_TDLS_PEER_IND:
2233#endif
2234 {
2235 if (pMsg->bodyptr)
2236 {
2237 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302238 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002239 }
2240 else
2241 {
2242 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002243 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002244 }
2245 break;
2246 }
2247#endif
2248
Chet Lanctot186b5732013-03-18 10:26:30 -07002249#ifdef WLAN_FEATURE_11W
2250 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2251 if (pMsg->bodyptr)
2252 {
2253 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2254 vos_mem_free(pMsg->bodyptr);
2255 }
2256 else
2257 {
2258 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2259 }
2260 break;
2261#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002262#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002263 case eWNI_SME_TSM_IE_IND:
2264 {
2265 if (pMsg->bodyptr)
2266 {
2267 sme_TsmIeInd(pMac, pMsg->bodyptr);
2268 vos_mem_free(pMsg->bodyptr);
2269 }
2270 else
2271 {
2272 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2273 }
2274 break;
2275 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002276#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002277#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2278 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2279 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2280 break;
2281#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002282
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302283#ifdef WLAN_FEATURE_GTK_OFFLOAD
2284 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2285 if (pMsg->bodyptr)
2286 {
2287 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2288 vos_mem_free(pMsg->bodyptr);
2289 }
2290 else
2291 {
2292 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2293 }
2294 break ;
2295#endif
Leo Chang9056f462013-08-01 19:21:11 -07002296
2297#ifdef FEATURE_WLAN_LPHB
2298 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002299 case eWNI_SME_LPHB_IND:
2300 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002301 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002302 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002303 }
2304 vos_mem_free(pMsg->bodyptr);
2305
2306 break;
2307#endif /* FEATURE_WLAN_LPHB */
2308
Leo Chang0b0e45a2013-12-15 15:18:55 -08002309#ifdef FEATURE_WLAN_CH_AVOID
2310 /* LPHB timeout indication arrived, send IND to client */
2311 case eWNI_SME_CH_AVOID_IND:
2312 if (pMac->sme.pChAvoidNotificationCb)
2313 {
2314 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2315 "%s: CH avoid notification", __func__);
2316 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2317 }
2318 vos_mem_free(pMsg->bodyptr);
2319
2320 break;
2321#endif /* FEATURE_WLAN_CH_AVOID */
2322
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 default:
2324
2325 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2326 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2327 {
2328 //CSR
2329 if (pMsg->bodyptr)
2330 {
2331 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302332 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 }
2334 else
2335 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002336 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 }
2338 }
2339 else
2340 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002341 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 pMsg->type);
2343 if (pMsg->bodyptr)
2344 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302345 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002346 }
2347 }
2348 }//switch
2349 } //SME_IS_START
2350 else
2351 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002352 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 if (pMsg->bodyptr)
2354 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302355 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002356 }
2357 }
2358 sme_ReleaseGlobalLock( &pMac->sme );
2359 }
2360 else
2361 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002362 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 if (pMsg->bodyptr)
2364 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302365 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002366 }
2367 }
2368
2369 return status;
2370}
2371
2372
2373//No need to hold the global lock here because this function can only be called
2374//after sme_Stop.
2375v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2376{
2377 if( pMsg )
2378 {
2379 if (pMsg->bodyptr)
2380 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302381 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 }
2383 }
2384
2385}
2386
2387
2388/*--------------------------------------------------------------------------
2389
2390 \brief sme_Stop() - Stop all SME modules and put them at idle state
2391
2392 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2393 return, all modules are at idle state ready to start.
2394
Srinivas Girigowdade697412013-02-14 16:31:48 -08002395 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302397 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002398
2399 \return eHAL_STATUS_SUCCESS - SME is stopped.
2400
2401 Other status means SME is failed to stop but caller should still
2402 consider SME is stopped.
2403 \sa
2404
2405 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302406eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002407{
2408 eHalStatus status = eHAL_STATUS_FAILURE;
2409 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2410 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2411
Jeff Johnson295189b2012-06-20 16:38:30 -07002412 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2413 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002414 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 status );
2416 fail_status = status;
2417 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002418
2419 p2pStop(hHal);
2420
Kiet Lama72a2322013-11-15 11:18:11 +05302421 status = pmcStop(hHal);
2422 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2423 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2424 status );
2425 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 }
2427
Kiet Lama72a2322013-11-15 11:18:11 +05302428 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002429 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002430 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 status );
2432 fail_status = status;
2433 }
2434
2435 ccmStop(hHal);
2436
2437 purgeSmeCmdList(pMac);
2438
2439 if (!HAL_STATUS_SUCCESS( fail_status )) {
2440 status = fail_status;
2441 }
2442
2443 pMac->sme.state = SME_STATE_STOP;
2444
2445 return status;
2446}
2447
2448/*--------------------------------------------------------------------------
2449
2450 \brief sme_Close() - Release all SME modules and their resources.
2451
2452 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2453 return, all modules are at closed state.
2454
2455 No SME APIs can be involved after smeClose except smeOpen.
2456 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002457 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 \param hHal - The handle returned by macOpen
2459
2460 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2461
2462 Other status means SME is failed to be closed but caller still cannot
2463 call any other SME functions except smeOpen.
2464 \sa
2465
2466 --------------------------------------------------------------------------*/
2467eHalStatus sme_Close(tHalHandle hHal)
2468{
2469 eHalStatus status = eHAL_STATUS_FAILURE;
2470 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2471 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2472
2473 status = csrClose(pMac);
2474 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002475 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002476 status );
2477 fail_status = status;
2478 }
2479
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2481 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002482 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 status );
2484 fail_status = status;
2485 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002486
2487#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2488 status = btcClose(hHal);
2489 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002490 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002491 status );
2492 fail_status = status;
2493 }
2494
2495 status = sme_QosClose(pMac);
2496 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002497 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 status );
2499 fail_status = status;
2500 }
2501#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002502#ifdef FEATURE_OEM_DATA_SUPPORT
2503 status = oemData_OemDataReqClose(hHal);
2504 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002505 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002506 status );
2507 fail_status = status;
2508 }
2509#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002510
2511 status = ccmClose(hHal);
2512 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002513 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 status );
2515 fail_status = status;
2516 }
2517
2518 status = pmcClose(hHal);
2519 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002520 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002521 status );
2522 fail_status = status;
2523 }
2524#if defined WLAN_FEATURE_VOWIFI
2525 status = rrmClose(hHal);
2526 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002527 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002528 status );
2529 fail_status = status;
2530 }
2531#endif
2532
2533#if defined WLAN_FEATURE_VOWIFI_11R
2534 sme_FTClose(hHal);
2535#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002537
2538 freeSmeCmdList(pMac);
2539
2540 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2541 {
2542 fail_status = eHAL_STATUS_FAILURE;
2543 }
2544
2545 if (!HAL_STATUS_SUCCESS( fail_status )) {
2546 status = fail_status;
2547 }
2548
2549 pMac->sme.state = SME_STATE_STOP;
2550
2551 return status;
2552}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002553#ifdef FEATURE_WLAN_LFR
2554tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2555{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002556#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002557 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2558 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2559 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2560 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2561 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2562 return eANI_BOOLEAN_FALSE;
2563 default:
2564 return eANI_BOOLEAN_TRUE;
2565 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002566#else
2567 /*
2568 * TODO: always return TRUE for now until
2569 * we figure out why we could be stuck in
2570 * one of the roaming states forever.
2571 */
2572 return eANI_BOOLEAN_TRUE;
2573#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002574}
2575#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002576/* ---------------------------------------------------------------------------
2577 \fn sme_ScanRequest
2578 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002579 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 \param pScanRequestID - pointer to an object to get back the request ID
2581 \param callback - a callback function that scan calls upon finish, will not
2582 be called if csrScanRequest returns error
2583 \param pContext - a pointer passed in for the callback
2584 \return eHalStatus
2585 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002586eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2587 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 csrScanCompleteCallback callback, void *pContext)
2589{
2590 eHalStatus status = eHAL_STATUS_FAILURE;
2591 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302592 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002593 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 smsLog(pMac, LOG2, FL("enter"));
2595 do
2596 {
c_hpothu304c0522014-09-30 10:22:57 +05302597 if(pMac->scan.fScanEnable &&
2598 ((FALSE == pMac->isCoexScoIndSet) || (TRUE == pscanReq->p2pSearch)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 {
2600 status = sme_AcquireGlobalLock( &pMac->sme );
2601 if ( HAL_STATUS_SUCCESS( status ) )
2602 {
2603 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002604#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002605 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002606 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002607#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002608 status = csrScanRequest( hHal, sessionId, pscanReq,
2609 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302610 if ( !HAL_STATUS_SUCCESS( status ) )
2611 {
2612 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2613 " SId=%d"), sessionId);
2614 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002615#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002616 }
2617 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002618 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302619 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302620 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302621 macTraceGetNeighbourRoamState(
2622 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302623 macTraceGetcsrRoamSubState(
2624 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002625 /*HandOff is in progress. So schedule this scan later*/
2626 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002627 }
2628#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002630
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 sme_ReleaseGlobalLock( &pMac->sme );
2632 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002633 else
2634 {
2635 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2636 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002638 else
2639 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302640 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
2641 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002642 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002643 } while( 0 );
2644
2645 return (status);
2646
2647
2648}
2649
2650/* ---------------------------------------------------------------------------
2651 \fn sme_ScanGetResult
2652 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002653 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002654 \param pFilter - If pFilter is NULL, all cached results are returned
2655 \param phResult - an object for the result.
2656 \return eHalStatus
2657 ---------------------------------------------------------------------------*/
2658eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2659 tScanResultHandle *phResult)
2660{
2661 eHalStatus status = eHAL_STATUS_FAILURE;
2662 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2663
Katya Nigambcb705f2013-12-26 14:26:22 +05302664 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002665 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 smsLog(pMac, LOG2, FL("enter"));
2667 status = sme_AcquireGlobalLock( &pMac->sme );
2668 if ( HAL_STATUS_SUCCESS( status ) )
2669 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002670 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 sme_ReleaseGlobalLock( &pMac->sme );
2672 }
2673 smsLog(pMac, LOG2, FL("exit status %d"), status);
2674
2675 return (status);
2676}
2677
2678
2679/* ---------------------------------------------------------------------------
2680 \fn sme_ScanFlushResult
2681 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002682 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 \return eHalStatus
2684 ---------------------------------------------------------------------------*/
2685eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2686{
2687 eHalStatus status = eHAL_STATUS_FAILURE;
2688 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2689
Katya Nigambcb705f2013-12-26 14:26:22 +05302690 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002691 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 status = sme_AcquireGlobalLock( &pMac->sme );
2693 if ( HAL_STATUS_SUCCESS( status ) )
2694 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002695 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002696 sme_ReleaseGlobalLock( &pMac->sme );
2697 }
2698
2699 return (status);
2700}
2701
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302702/* ---------------------------------------------------------------------------
2703 \fn sme_FilterScanResults
2704 \brief a wrapper function to request CSR to clear scan results.
2705 This is a synchronous call
2706 \return eHalStatus
2707 ---------------------------------------------------------------------------*/
2708eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2709{
2710 eHalStatus status = eHAL_STATUS_SUCCESS;
2711 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2712
2713 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2714 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2715 status = sme_AcquireGlobalLock( &pMac->sme );
2716 if ( HAL_STATUS_SUCCESS( status ) )
2717 {
2718 csrScanFilterResults(pMac);
2719 sme_ReleaseGlobalLock( &pMac->sme );
2720 }
2721
2722 return (status);
2723}
2724
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002725eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2726{
2727 eHalStatus status = eHAL_STATUS_FAILURE;
2728 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2729
Katya Nigambcb705f2013-12-26 14:26:22 +05302730 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002731 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002732 status = sme_AcquireGlobalLock( &pMac->sme );
2733 if ( HAL_STATUS_SUCCESS( status ) )
2734 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302735 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002736 sme_ReleaseGlobalLock( &pMac->sme );
2737 }
2738
2739 return (status);
2740}
Jeff Johnson295189b2012-06-20 16:38:30 -07002741
2742/* ---------------------------------------------------------------------------
2743 \fn sme_ScanResultGetFirst
2744 \brief a wrapper function to request CSR to returns the first element of
2745 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002746 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002747 \param hScanResult - returned from csrScanGetResult
2748 \return tCsrScanResultInfo * - NULL if no result
2749 ---------------------------------------------------------------------------*/
2750tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2751 tScanResultHandle hScanResult)
2752{
2753 eHalStatus status = eHAL_STATUS_FAILURE;
2754 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2755 tCsrScanResultInfo *pRet = NULL;
2756
Katya Nigambcb705f2013-12-26 14:26:22 +05302757 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002758 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002759 status = sme_AcquireGlobalLock( &pMac->sme );
2760 if ( HAL_STATUS_SUCCESS( status ) )
2761 {
2762 pRet = csrScanResultGetFirst( pMac, hScanResult );
2763 sme_ReleaseGlobalLock( &pMac->sme );
2764 }
2765
2766 return (pRet);
2767}
2768
2769
2770/* ---------------------------------------------------------------------------
2771 \fn sme_ScanResultGetNext
2772 \brief a wrapper function to request CSR to returns the next element of
2773 scan result. It can be called without calling csrScanResultGetFirst
2774 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002775 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002776 \param hScanResult - returned from csrScanGetResult
2777 \return Null if no result or reach the end
2778 ---------------------------------------------------------------------------*/
2779tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2780 tScanResultHandle hScanResult)
2781{
2782 eHalStatus status = eHAL_STATUS_FAILURE;
2783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2784 tCsrScanResultInfo *pRet = NULL;
2785
Katya Nigambcb705f2013-12-26 14:26:22 +05302786 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002787 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002788 status = sme_AcquireGlobalLock( &pMac->sme );
2789 if ( HAL_STATUS_SUCCESS( status ) )
2790 {
2791 pRet = csrScanResultGetNext( pMac, hScanResult );
2792 sme_ReleaseGlobalLock( &pMac->sme );
2793 }
2794
2795 return (pRet);
2796}
2797
2798
2799/* ---------------------------------------------------------------------------
2800 \fn sme_ScanSetBGScanparams
2801 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002802 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002803 \param pScanReq - BG scan request structure
2804 \return eHalStatus
2805 ---------------------------------------------------------------------------*/
2806eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2807{
2808 eHalStatus status = eHAL_STATUS_FAILURE;
2809 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2810
2811 if( NULL != pScanReq )
2812 {
2813 status = sme_AcquireGlobalLock( &pMac->sme );
2814 if ( HAL_STATUS_SUCCESS( status ) )
2815 {
2816 status = csrScanSetBGScanparams( hHal, pScanReq );
2817 sme_ReleaseGlobalLock( &pMac->sme );
2818 }
2819 }
2820
2821 return (status);
2822}
2823
2824
2825/* ---------------------------------------------------------------------------
2826 \fn sme_ScanResultPurge
2827 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2828 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002829 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 \param hScanResult - returned from csrScanGetResult. hScanResult is
2831 considered gone by
2832 calling this function and even before this function reutrns.
2833 \return eHalStatus
2834 ---------------------------------------------------------------------------*/
2835eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2836{
2837 eHalStatus status = eHAL_STATUS_FAILURE;
2838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2839
Katya Nigambcb705f2013-12-26 14:26:22 +05302840 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002841 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 status = sme_AcquireGlobalLock( &pMac->sme );
2843 if ( HAL_STATUS_SUCCESS( status ) )
2844 {
2845 status = csrScanResultPurge( hHal, hScanResult );
2846 sme_ReleaseGlobalLock( &pMac->sme );
2847 }
2848
2849 return (status);
2850}
2851
2852/* ---------------------------------------------------------------------------
2853 \fn sme_ScanGetPMKIDCandidateList
2854 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002855 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 \param pPmkidList - caller allocated buffer point to an array of
2857 tPmkidCandidateInfo
2858 \param pNumItems - pointer to a variable that has the number of
2859 tPmkidCandidateInfo allocated when retruning, this is
2860 either the number needed or number of items put into
2861 pPmkidList
2862 \return eHalStatus - when fail, it usually means the buffer allocated is not
2863 big enough and pNumItems
2864 has the number of tPmkidCandidateInfo.
2865 \Note: pNumItems is a number of tPmkidCandidateInfo,
2866 not sizeof(tPmkidCandidateInfo) * something
2867 ---------------------------------------------------------------------------*/
2868eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002869 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002870 tANI_U32 *pNumItems )
2871{
2872 eHalStatus status = eHAL_STATUS_FAILURE;
2873 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2874
2875 status = sme_AcquireGlobalLock( &pMac->sme );
2876 if ( HAL_STATUS_SUCCESS( status ) )
2877 {
2878 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2879 sme_ReleaseGlobalLock( &pMac->sme );
2880 }
2881
2882 return (status);
2883}
2884
2885/*----------------------------------------------------------------------------
2886 \fn sme_RoamRegisterLinkQualityIndCallback
2887
2888 \brief
2889 a wrapper function to allow HDD to register a callback handler with CSR for
2890 link quality indications.
2891
2892 Only one callback may be registered at any time.
2893 In order to deregister the callback, a NULL cback may be provided.
2894
2895 Registration happens in the task context of the caller.
2896
2897 \param callback - Call back being registered
2898 \param pContext - user data
2899
2900 DEPENDENCIES: After CSR open
2901
2902 \return eHalStatus
2903-----------------------------------------------------------------------------*/
2904eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2905 csrRoamLinkQualityIndCallback callback,
2906 void *pContext)
2907{
2908 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2909}
2910
2911/* ---------------------------------------------------------------------------
2912 \fn sme_RoamRegisterCallback
2913 \brief a wrapper function to allow HDD to register a callback with CSR.
2914 Unlike scan, roam has one callback for all the roam requests
2915 \param callback - a callback function that roam calls upon when state changes
2916 \param pContext - a pointer passed in for the callback
2917 \return eHalStatus
2918 ---------------------------------------------------------------------------*/
2919eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2920 csrRoamCompleteCallback callback,
2921 void *pContext)
2922{
2923 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2924}
2925
2926eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2927{
2928 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2929 return pMac->roam.configParam.phyMode;
2930}
2931
2932/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05302933 \fn sme_GetChannelBondingMode5G
2934 \brief get the channel bonding mode for 5G band
2935 \param hHal - HAL handle
2936 \return channel bonding mode for 5G
2937 ---------------------------------------------------------------------------*/
2938tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
2939{
2940 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2941 tSmeConfigParams smeConfig;
2942
2943 sme_GetConfigParam(pMac, &smeConfig);
2944
2945 return smeConfig.csrConfig.channelBondingMode5GHz;
2946}
2947
2948/* ---------------------------------------------------------------------------
2949 \fn sme_GetChannelBondingMode24G
2950 \brief get the channel bonding mode for 2.4G band
2951 \param hHal - HAL handle
2952 \return channel bonding mode for 2.4G
2953 ---------------------------------------------------------------------------*/
2954tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
2955{
2956 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2957 tSmeConfigParams smeConfig;
2958
2959 sme_GetConfigParam(pMac, &smeConfig);
2960
2961 return smeConfig.csrConfig.channelBondingMode24GHz;
2962}
2963
2964
2965/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002966 \fn sme_RoamConnect
2967 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002968 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 \param sessionId - the sessionId returned by sme_OpenSession.
2970 \param pProfile - description of the network to which to connect
2971 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2972 from csrScanGetResult
2973 \param pRoamId - to get back the request ID
2974 \return eHalStatus
2975 ---------------------------------------------------------------------------*/
2976eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2977 tANI_U32 *pRoamId)
2978{
2979 eHalStatus status = eHAL_STATUS_FAILURE;
2980 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2981
Yue Mae36e3552014-03-05 17:06:20 -08002982 if (!pMac)
2983 {
2984 return eHAL_STATUS_FAILURE;
2985 }
2986
Katya Nigambcb705f2013-12-26 14:26:22 +05302987 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002988 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 smsLog(pMac, LOG2, FL("enter"));
2990 status = sme_AcquireGlobalLock( &pMac->sme );
2991 if ( HAL_STATUS_SUCCESS( status ) )
2992 {
2993 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2994 {
2995 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2996 }
2997 else
2998 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002999 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 status = eHAL_STATUS_INVALID_PARAMETER;
3001 }
3002 sme_ReleaseGlobalLock( &pMac->sme );
3003 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003004 else
3005 {
3006 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3007 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003008
3009 return (status);
3010}
3011
3012/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303013
3014 \fn sme_SetPhyMode
3015
3016 \brief Changes the PhyMode.
3017
3018 \param hHal - The handle returned by macOpen.
3019
3020 \param phyMode new phyMode which is to set
3021
3022 \return eHalStatus SUCCESS.
3023
3024 -------------------------------------------------------------------------------*/
3025eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3026{
3027 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3028
3029 if (NULL == pMac)
3030 {
3031 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3032 "%s: invalid context", __func__);
3033 return eHAL_STATUS_FAILURE;
3034 }
3035
3036 pMac->roam.configParam.phyMode = phyMode;
3037 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3038 pMac->roam.configParam.phyMode,
3039 pMac->roam.configParam.ProprietaryRatesEnabled);
3040
3041 return eHAL_STATUS_SUCCESS;
3042}
3043
3044/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 \fn sme_RoamReassoc
3046 \brief a wrapper function to request CSR to inititiate a re-association
3047 \param pProfile - can be NULL to join the currently connected AP. In that
3048 case modProfileFields should carry the modified field(s) which could trigger
3049 reassoc
3050 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3051 that might need modification dynamically once STA is up & running and this
3052 could trigger a reassoc
3053 \param pRoamId - to get back the request ID
3054 \return eHalStatus
3055 -------------------------------------------------------------------------------*/
3056eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3057 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003058 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003059{
3060 eHalStatus status = eHAL_STATUS_FAILURE;
3061 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3062
Katya Nigambcb705f2013-12-26 14:26:22 +05303063 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003064 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 smsLog(pMac, LOG2, FL("enter"));
3066 status = sme_AcquireGlobalLock( &pMac->sme );
3067 if ( HAL_STATUS_SUCCESS( status ) )
3068 {
3069 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3070 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003071 if((NULL == pProfile) && (fForce == 1))
3072 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003073 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3074 /* to force the AP initiate fresh 802.1x authentication need to clear
3075 * the PMKID cache for that set the following boolean. this is needed
3076 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3077 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003078 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3079 }
3080 else
3081 {
3082 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003083 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003084 }
3085 else
3086 {
3087 status = eHAL_STATUS_INVALID_PARAMETER;
3088 }
3089 sme_ReleaseGlobalLock( &pMac->sme );
3090 }
3091
3092 return (status);
3093}
3094
3095/* ---------------------------------------------------------------------------
3096 \fn sme_RoamConnectToLastProfile
3097 \brief a wrapper function to request CSR to disconnect and reconnect with
3098 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003099 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003100 \return eHalStatus. It returns fail if currently connected
3101 ---------------------------------------------------------------------------*/
3102eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3103{
3104 eHalStatus status = eHAL_STATUS_FAILURE;
3105 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3106
3107 status = sme_AcquireGlobalLock( &pMac->sme );
3108 if ( HAL_STATUS_SUCCESS( status ) )
3109 {
3110 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3111 {
3112 status = csrRoamConnectToLastProfile( pMac, sessionId );
3113 }
3114 else
3115 {
3116 status = eHAL_STATUS_INVALID_PARAMETER;
3117 }
3118 sme_ReleaseGlobalLock( &pMac->sme );
3119 }
3120
3121 return (status);
3122}
3123
3124/* ---------------------------------------------------------------------------
3125 \fn sme_RoamDisconnect
3126 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003127 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003128 \param reason -- To indicate the reason for disconnecting. Currently, only
3129 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3130 \return eHalStatus
3131 ---------------------------------------------------------------------------*/
3132eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3133{
3134 eHalStatus status = eHAL_STATUS_FAILURE;
3135 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3136
Katya Nigambcb705f2013-12-26 14:26:22 +05303137 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003138 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 smsLog(pMac, LOG2, FL("enter"));
3140 status = sme_AcquireGlobalLock( &pMac->sme );
3141 if ( HAL_STATUS_SUCCESS( status ) )
3142 {
3143 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3144 {
3145 status = csrRoamDisconnect( pMac, sessionId, reason );
3146 }
3147 else
3148 {
3149 status = eHAL_STATUS_INVALID_PARAMETER;
3150 }
3151 sme_ReleaseGlobalLock( &pMac->sme );
3152 }
3153
3154 return (status);
3155}
3156
Jeff Johnson295189b2012-06-20 16:38:30 -07003157/* ---------------------------------------------------------------------------
3158 \fn sme_RoamStopBss
3159 \brief To stop BSS for Soft AP. This is an asynchronous API.
3160 \param hHal - Global structure
3161 \param sessionId - sessionId of SoftAP
3162 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3163 -------------------------------------------------------------------------------*/
3164eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3165{
3166 eHalStatus status = eHAL_STATUS_FAILURE;
3167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3168
3169 smsLog(pMac, LOG2, FL("enter"));
3170 status = sme_AcquireGlobalLock( &pMac->sme );
3171 if ( HAL_STATUS_SUCCESS( status ) )
3172 {
3173 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3174 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303175 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 }
3177 else
3178 {
3179 status = eHAL_STATUS_INVALID_PARAMETER;
3180 }
3181 sme_ReleaseGlobalLock( &pMac->sme );
3182 }
3183
3184 return (status);
3185}
3186
3187/* ---------------------------------------------------------------------------
3188 \fn sme_RoamDisconnectSta
3189 \brief To disassociate a station. This is an asynchronous API.
3190 \param hHal - Global structure
3191 \param sessionId - sessionId of SoftAP
3192 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3193 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3194 -------------------------------------------------------------------------------*/
3195eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3196 tANI_U8 *pPeerMacAddr)
3197{
3198 eHalStatus status = eHAL_STATUS_FAILURE;
3199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3200
3201 if ( NULL == pMac )
3202 {
3203 VOS_ASSERT(0);
3204 return status;
3205 }
3206
3207 status = sme_AcquireGlobalLock( &pMac->sme );
3208 if ( HAL_STATUS_SUCCESS( status ) )
3209 {
3210 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3211 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003212 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303213 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003214 }
3215 else
3216 {
3217 status = eHAL_STATUS_INVALID_PARAMETER;
3218 }
3219 sme_ReleaseGlobalLock( &pMac->sme );
3220 }
3221
3222 return (status);
3223}
3224
3225/* ---------------------------------------------------------------------------
3226 \fn sme_RoamDeauthSta
3227 \brief To disassociate a station. This is an asynchronous API.
3228 \param hHal - Global structure
3229 \param sessionId - sessionId of SoftAP
3230 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3231 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3232 -------------------------------------------------------------------------------*/
3233eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3234 tANI_U8 *pPeerMacAddr)
3235{
3236 eHalStatus status = eHAL_STATUS_FAILURE;
3237 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3238
3239 if ( NULL == pMac )
3240 {
3241 VOS_ASSERT(0);
3242 return status;
3243 }
3244
3245 status = sme_AcquireGlobalLock( &pMac->sme );
3246 if ( HAL_STATUS_SUCCESS( status ) )
3247 {
3248 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3249 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003250 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303251 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 }
3253 else
3254 {
3255 status = eHAL_STATUS_INVALID_PARAMETER;
3256 }
3257 sme_ReleaseGlobalLock( &pMac->sme );
3258 }
3259
3260 return (status);
3261}
3262
3263/* ---------------------------------------------------------------------------
3264 \fn sme_RoamTKIPCounterMeasures
3265 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3266 \param sessionId - sessionId of SoftAP
3267 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3268 \return eHalStatus
3269 -------------------------------------------------------------------------------*/
3270eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3271 tANI_BOOLEAN bEnable)
3272{
3273 eHalStatus status = eHAL_STATUS_FAILURE;
3274 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3275
3276 if ( NULL == pMac )
3277 {
3278 VOS_ASSERT(0);
3279 return status;
3280 }
3281
3282 status = sme_AcquireGlobalLock( &pMac->sme );
3283 if ( HAL_STATUS_SUCCESS( status ) )
3284 {
3285 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3286 {
3287 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3288 }
3289 else
3290 {
3291 status = eHAL_STATUS_INVALID_PARAMETER;
3292 }
3293 sme_ReleaseGlobalLock( &pMac->sme );
3294 }
3295
3296 return (status);
3297}
3298
3299/* ---------------------------------------------------------------------------
3300 \fn sme_RoamGetAssociatedStas
3301 \brief To probe the list of associated stations from various modules of CORE stack.
3302 \This is an asynchronous API.
3303 \param sessionId - sessionId of SoftAP
3304 \param modId - Module from whom list of associtated stations is to be probed.
3305 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3306 \param pUsrContext - Opaque HDD context
3307 \param pfnSapEventCallback - Sap event callback in HDD
3308 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3309 \return eHalStatus
3310 -------------------------------------------------------------------------------*/
3311eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3312 VOS_MODULE_ID modId, void *pUsrContext,
3313 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3314{
3315 eHalStatus status = eHAL_STATUS_FAILURE;
3316 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3317
3318 if ( NULL == pMac )
3319 {
3320 VOS_ASSERT(0);
3321 return status;
3322 }
3323
3324 status = sme_AcquireGlobalLock( &pMac->sme );
3325 if ( HAL_STATUS_SUCCESS( status ) )
3326 {
3327 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3328 {
3329 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3330 }
3331 else
3332 {
3333 status = eHAL_STATUS_INVALID_PARAMETER;
3334 }
3335 sme_ReleaseGlobalLock( &pMac->sme );
3336 }
3337
3338 return (status);
3339}
3340
3341/* ---------------------------------------------------------------------------
3342 \fn sme_RoamGetWpsSessionOverlap
3343 \brief To get the WPS PBC session overlap information.
3344 \This is an asynchronous API.
3345 \param sessionId - sessionId of SoftAP
3346 \param pUsrContext - Opaque HDD context
3347 \param pfnSapEventCallback - Sap event callback in HDD
3348 \pRemoveMac - pointer to Mac address which needs to be removed from session
3349 \return eHalStatus
3350 -------------------------------------------------------------------------------*/
3351eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003352 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003353 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3354{
3355 eHalStatus status = eHAL_STATUS_FAILURE;
3356 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3357
3358 if ( NULL == pMac )
3359 {
3360 VOS_ASSERT(0);
3361 return status;
3362 }
3363
3364 status = sme_AcquireGlobalLock( &pMac->sme );
3365 if ( HAL_STATUS_SUCCESS( status ) )
3366 {
3367 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3368 {
3369 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3370 }
3371 else
3372 {
3373 status = eHAL_STATUS_INVALID_PARAMETER;
3374 }
3375 sme_ReleaseGlobalLock( &pMac->sme );
3376 }
3377
3378 return (status);
3379}
3380
Jeff Johnson295189b2012-06-20 16:38:30 -07003381
3382/* ---------------------------------------------------------------------------
3383 \fn sme_RoamGetConnectState
3384 \brief a wrapper function to request CSR to return the current connect state
3385 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003386 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003387 \return eHalStatus
3388 ---------------------------------------------------------------------------*/
3389eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3390{
3391 eHalStatus status = eHAL_STATUS_FAILURE;
3392 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3393
3394 status = sme_AcquireGlobalLock( &pMac->sme );
3395 if ( HAL_STATUS_SUCCESS( status ) )
3396 {
3397 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3398 {
3399 status = csrRoamGetConnectState( pMac, sessionId, pState );
3400 }
3401 else
3402 {
3403 status = eHAL_STATUS_INVALID_PARAMETER;
3404 }
3405 sme_ReleaseGlobalLock( &pMac->sme );
3406 }
3407
3408 return (status);
3409}
3410
3411/* ---------------------------------------------------------------------------
3412 \fn sme_RoamGetConnectProfile
3413 \brief a wrapper function to request CSR to return the current connect
3414 profile. Caller must call csrRoamFreeConnectProfile after it is done
3415 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003416 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 \param pProfile - pointer to a caller allocated structure
3418 tCsrRoamConnectedProfile
3419 \return eHalStatus. Failure if not connected
3420 ---------------------------------------------------------------------------*/
3421eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3422 tCsrRoamConnectedProfile *pProfile)
3423{
3424 eHalStatus status = eHAL_STATUS_FAILURE;
3425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3426
Katya Nigambcb705f2013-12-26 14:26:22 +05303427 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003428 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 status = sme_AcquireGlobalLock( &pMac->sme );
3430 if ( HAL_STATUS_SUCCESS( status ) )
3431 {
3432 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3433 {
3434 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3435 }
3436 else
3437 {
3438 status = eHAL_STATUS_INVALID_PARAMETER;
3439 }
3440 sme_ReleaseGlobalLock( &pMac->sme );
3441 }
3442
3443 return (status);
3444}
3445
3446/* ---------------------------------------------------------------------------
3447 \fn sme_RoamFreeConnectProfile
3448 \brief a wrapper function to request CSR to free and reinitialize the
3449 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003450 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 \param pProfile - pointer to a caller allocated structure
3452 tCsrRoamConnectedProfile
3453 \return eHalStatus.
3454 ---------------------------------------------------------------------------*/
3455eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3456 tCsrRoamConnectedProfile *pProfile)
3457{
3458 eHalStatus status = eHAL_STATUS_FAILURE;
3459 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3460
Katya Nigambcb705f2013-12-26 14:26:22 +05303461 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003462 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 status = sme_AcquireGlobalLock( &pMac->sme );
3464 if ( HAL_STATUS_SUCCESS( status ) )
3465 {
3466 status = csrRoamFreeConnectProfile( pMac, pProfile );
3467 sme_ReleaseGlobalLock( &pMac->sme );
3468 }
3469
3470 return (status);
3471}
3472
3473/* ---------------------------------------------------------------------------
3474 \fn sme_RoamSetPMKIDCache
3475 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003476 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 \param pPMKIDCache - caller allocated buffer point to an array of
3478 tPmkidCacheInfo
3479 \param numItems - a variable that has the number of tPmkidCacheInfo
3480 allocated when retruning, this is either the number needed
3481 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303482 \param update_entire_cache - this bool value specifies if the entire pmkid
3483 cache should be overwritten or should it be
3484 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003485 \return eHalStatus - when fail, it usually means the buffer allocated is not
3486 big enough and pNumItems has the number of
3487 tPmkidCacheInfo.
3488 \Note: pNumItems is a number of tPmkidCacheInfo,
3489 not sizeof(tPmkidCacheInfo) * something
3490 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303491eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3492 tPmkidCacheInfo *pPMKIDCache,
3493 tANI_U32 numItems,
3494 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003495{
3496 eHalStatus status = eHAL_STATUS_FAILURE;
3497 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3498
Katya Nigambcb705f2013-12-26 14:26:22 +05303499 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003500 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 status = sme_AcquireGlobalLock( &pMac->sme );
3502 if ( HAL_STATUS_SUCCESS( status ) )
3503 {
3504 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3505 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303506 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3507 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 }
3509 else
3510 {
3511 status = eHAL_STATUS_INVALID_PARAMETER;
3512 }
3513 sme_ReleaseGlobalLock( &pMac->sme );
3514 }
3515
3516 return (status);
3517}
3518
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303519eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
3520 tANI_U8 *pBSSId,
3521 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003522{
3523 eHalStatus status = eHAL_STATUS_FAILURE;
3524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3525 status = sme_AcquireGlobalLock( &pMac->sme );
3526 if ( HAL_STATUS_SUCCESS( status ) )
3527 {
3528 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3529 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303530 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
3531 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003532 }
3533 else
3534 {
3535 status = eHAL_STATUS_INVALID_PARAMETER;
3536 }
3537 sme_ReleaseGlobalLock( &pMac->sme );
3538 }
3539 return (status);
3540}
Wilson Yang47b58192013-12-11 11:40:19 -08003541
Jeff Johnson295189b2012-06-20 16:38:30 -07003542/* ---------------------------------------------------------------------------
3543 \fn sme_RoamGetSecurityReqIE
3544 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3545 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003546 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 \param pLen - caller allocated memory that has the length of pBuf as input.
3548 Upon returned, *pLen has the needed or IE length in pBuf.
3549 \param pBuf - Caller allocated memory that contain the IE field, if any,
3550 upon return
3551 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3552 \return eHalStatus - when fail, it usually means the buffer allocated is not
3553 big enough
3554 ---------------------------------------------------------------------------*/
3555eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3556 tANI_U8 *pBuf, eCsrSecurityType secType)
3557{
3558 eHalStatus status = eHAL_STATUS_FAILURE;
3559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3560
3561 status = sme_AcquireGlobalLock( &pMac->sme );
3562 if ( HAL_STATUS_SUCCESS( status ) )
3563 {
3564 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3565 {
3566 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3567 }
3568 else
3569 {
3570 status = eHAL_STATUS_INVALID_PARAMETER;
3571 }
3572 sme_ReleaseGlobalLock( &pMac->sme );
3573 }
3574
3575 return (status);
3576}
3577
3578/* ---------------------------------------------------------------------------
3579 \fn sme_RoamGetSecurityRspIE
3580 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3581 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003582 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003583 \param pLen - caller allocated memory that has the length of pBuf as input.
3584 Upon returned, *pLen has the needed or IE length in pBuf.
3585 \param pBuf - Caller allocated memory that contain the IE field, if any,
3586 upon return
3587 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3588 \return eHalStatus - when fail, it usually means the buffer allocated is not
3589 big enough
3590 ---------------------------------------------------------------------------*/
3591eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3592 tANI_U8 *pBuf, eCsrSecurityType secType)
3593{
3594 eHalStatus status = eHAL_STATUS_FAILURE;
3595 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3596
3597 status = sme_AcquireGlobalLock( &pMac->sme );
3598 if ( HAL_STATUS_SUCCESS( status ) )
3599 {
3600 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3601 {
3602 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3603 }
3604 else
3605 {
3606 status = eHAL_STATUS_INVALID_PARAMETER;
3607 }
3608 sme_ReleaseGlobalLock( &pMac->sme );
3609 }
3610
3611 return (status);
3612
3613}
3614
3615
3616/* ---------------------------------------------------------------------------
3617 \fn sme_RoamGetNumPMKIDCache
3618 \brief a wrapper function to request CSR to return number of PMKID cache
3619 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003620 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 \return tANI_U32 - the number of PMKID cache entries
3622 ---------------------------------------------------------------------------*/
3623tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3624{
3625 eHalStatus status = eHAL_STATUS_FAILURE;
3626 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3627 tANI_U32 numPmkidCache = 0;
3628
3629 status = sme_AcquireGlobalLock( &pMac->sme );
3630 if ( HAL_STATUS_SUCCESS( status ) )
3631 {
3632 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3633 {
3634 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3635 status = eHAL_STATUS_SUCCESS;
3636 }
3637 else
3638 {
3639 status = eHAL_STATUS_INVALID_PARAMETER;
3640 }
3641 sme_ReleaseGlobalLock( &pMac->sme );
3642 }
3643
3644 return (numPmkidCache);
3645}
3646
3647/* ---------------------------------------------------------------------------
3648 \fn sme_RoamGetPMKIDCache
3649 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003650 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 \param pNum - caller allocated memory that has the space of the number of
3652 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3653 needed or actually number in tPmkidCacheInfo.
3654 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3655 any, upon return
3656 \return eHalStatus - when fail, it usually means the buffer allocated is not
3657 big enough
3658 ---------------------------------------------------------------------------*/
3659eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3660 tPmkidCacheInfo *pPmkidCache)
3661{
3662 eHalStatus status = eHAL_STATUS_FAILURE;
3663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3664
3665 status = sme_AcquireGlobalLock( &pMac->sme );
3666 if ( HAL_STATUS_SUCCESS( status ) )
3667 {
3668 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3669 {
3670 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3671 }
3672 else
3673 {
3674 status = eHAL_STATUS_INVALID_PARAMETER;
3675 }
3676 sme_ReleaseGlobalLock( &pMac->sme );
3677 }
3678
3679 return (status);
3680}
3681
3682
3683/* ---------------------------------------------------------------------------
3684 \fn sme_GetConfigParam
3685 \brief a wrapper function that HDD calls to get the global settings
3686 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003687 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 \param pParam - caller allocated memory
3689 \return eHalStatus
3690 ---------------------------------------------------------------------------*/
3691eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3692{
3693 eHalStatus status = eHAL_STATUS_FAILURE;
3694 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3695
Katya Nigambcb705f2013-12-26 14:26:22 +05303696 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003697 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003698 status = sme_AcquireGlobalLock( &pMac->sme );
3699 if ( HAL_STATUS_SUCCESS( status ) )
3700 {
3701 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3702 if (status != eHAL_STATUS_SUCCESS)
3703 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003704 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 sme_ReleaseGlobalLock( &pMac->sme );
3706 return status;
3707 }
3708#if defined WLAN_FEATURE_P2P_INTERNAL
3709 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3710 if (status != eHAL_STATUS_SUCCESS)
3711 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003712 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003713 sme_ReleaseGlobalLock( &pMac->sme );
3714 return status;
3715 }
3716#endif
3717 sme_ReleaseGlobalLock( &pMac->sme );
3718 }
3719
3720 return (status);
3721}
3722
3723/* ---------------------------------------------------------------------------
3724 \fn sme_CfgSetInt
3725 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003726 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003727 \param cfgId - Configuration Parameter ID (type) for STA.
3728 \param ccmValue - The information related to Configuration Parameter ID
3729 which needs to be saved in CFG
3730 \param callback - To be registered by CSR with CCM. Once the CFG done with
3731 saving the information in the database, it notifies CCM &
3732 then the callback will be invoked to notify.
3733 \param toBeSaved - To save the request for future reference
3734 \return eHalStatus
3735 ---------------------------------------------------------------------------*/
3736eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3737 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3738{
3739 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3740}
3741
3742/* ---------------------------------------------------------------------------
3743 \fn sme_CfgSetStr
3744 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003745 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003746 \param cfgId - Configuration Parameter ID (type) for STA.
3747 \param pStr - Pointer to the byte array which carries the information needs
3748 to be saved in CFG
3749 \param length - Length of the data to be saved
3750 \param callback - To be registered by CSR with CCM. Once the CFG done with
3751 saving the information in the database, it notifies CCM &
3752 then the callback will be invoked to notify.
3753 \param toBeSaved - To save the request for future reference
3754 \return eHalStatus
3755 ---------------------------------------------------------------------------*/
3756eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3757 tANI_U32 length, tCcmCfgSetCallback callback,
3758 eAniBoolean toBeSaved)
3759{
3760 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3761}
3762
3763/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05303764 \fn sme_GetModifyProfileFields
3765 \brief HDD or SME - QOS calls this function to get the current values of
3766 connected profile fields, changing which can cause reassoc.
3767 This function must be called after CFG is downloaded and STA is in connected
3768 state. Also, make sure to call this function to get the current profile
3769 fields before calling the reassoc. So that pModifyProfileFields will have
3770 all the latest values plus the one(s) has been updated as part of reassoc
3771 request.
3772 \param pModifyProfileFields - pointer to the connected profile fields
3773 changing which can cause reassoc
3774
3775 \return eHalStatus
3776 -------------------------------------------------------------------------------*/
3777eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3778 tCsrRoamModifyProfileFields * pModifyProfileFields)
3779{
3780 eHalStatus status = eHAL_STATUS_FAILURE;
3781 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3782
3783 MTRACE(vos_trace(VOS_MODULE_ID_SME,
3784 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
3785 status = sme_AcquireGlobalLock( &pMac->sme );
3786 if ( HAL_STATUS_SUCCESS( status ) )
3787 {
3788 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3789 {
3790 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3791 }
3792 else
3793 {
3794 status = eHAL_STATUS_INVALID_PARAMETER;
3795 }
3796 sme_ReleaseGlobalLock( &pMac->sme );
3797 }
3798
3799 return (status);
3800}
3801
3802/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303803 \fn sme_HT40StopOBSSScan
3804 \brief HDD or SME - Command to stop the OBSS scan
3805 THis is implemented only for debugging purpose.
3806 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3807 \param sessionId - sessionId
3808 changing which can cause reassoc
3809
3810 \return eHalStatus
3811 -------------------------------------------------------------------------------*/
3812eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3813{
3814 eHalStatus status = eHAL_STATUS_FAILURE;
3815 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3816
3817 smsLog(pMac, LOG2, FL("enter"));
3818 status = sme_AcquireGlobalLock( &pMac->sme );
3819 if ( HAL_STATUS_SUCCESS( status ) )
3820 {
3821 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3822 {
3823 csrHT40StopOBSSScan( pMac, sessionId );
3824 }
3825 else
3826 {
3827 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3828 "%s: Invalid session sessionId %d", __func__,sessionId);
3829 status = eHAL_STATUS_INVALID_PARAMETER;
3830 }
3831 sme_ReleaseGlobalLock( &pMac->sme );
3832 }
3833 return (status);
3834}
3835
Jeff Johnson295189b2012-06-20 16:38:30 -07003836/*--------------------------------------------------------------------------
3837 \fn sme_SetConfigPowerSave
3838 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3839 For BMPS related configuration, this function also updates the CFG
3840 and sends a message to FW to pick up the new values. Note: Calling
3841 this function only updates the configuration and does not enable
3842 the specified power save mode.
3843 \param hHal - The handle returned by macOpen.
3844 \param psMode - Power Saving mode being modified
3845 \param pConfigParams - a pointer to a caller allocated object of type
3846 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3847 \return eHalStatus
3848 --------------------------------------------------------------------------*/
3849eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3850 void *pConfigParams)
3851{
3852 eHalStatus status = eHAL_STATUS_FAILURE;
3853 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3854
Katya Nigambcb705f2013-12-26 14:26:22 +05303855 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003856 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003857 if (NULL == pConfigParams ) {
3858 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3859 "nothing to update");
3860 return eHAL_STATUS_FAILURE;
3861 }
3862
3863 status = sme_AcquireGlobalLock( &pMac->sme );
3864 if ( HAL_STATUS_SUCCESS( status ) )
3865 {
3866 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3867 sme_ReleaseGlobalLock( &pMac->sme );
3868 }
3869
3870 return (status);
3871}
3872
3873/*--------------------------------------------------------------------------
3874 \fn sme_GetConfigPowerSave
3875 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3876 \param hHal - The handle returned by macOpen.
3877 \param psMode - Power Saving mode
3878 \param pConfigParams - a pointer to a caller allocated object of type
3879 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3880 \return eHalStatus
3881 --------------------------------------------------------------------------*/
3882eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3883 void *pConfigParams)
3884{
3885 eHalStatus status = eHAL_STATUS_FAILURE;
3886 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3887
Katya Nigambcb705f2013-12-26 14:26:22 +05303888 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003889 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 if (NULL == pConfigParams ) {
3891 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3892 "nothing to update");
3893 return eHAL_STATUS_FAILURE;
3894 }
3895
3896 status = sme_AcquireGlobalLock( &pMac->sme );
3897 if ( HAL_STATUS_SUCCESS( status ) )
3898 {
3899 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3900 sme_ReleaseGlobalLock( &pMac->sme );
3901 }
3902
3903 return (status);
3904}
3905
3906/* ---------------------------------------------------------------------------
3907 \fn sme_SignalPowerEvent
3908 \brief Signals to PMC that a power event has occurred. Used for putting
3909 the chip into deep sleep mode.
3910 \param hHal - The handle returned by macOpen.
3911 \param event - the event that has occurred
3912 \return eHalStatus
3913 ---------------------------------------------------------------------------*/
3914eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3915{
3916 eHalStatus status = eHAL_STATUS_FAILURE;
3917 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3918
3919 status = sme_AcquireGlobalLock( &pMac->sme );
3920 if ( HAL_STATUS_SUCCESS( status ) )
3921 {
3922 status = pmcSignalPowerEvent(hHal, event);
3923 sme_ReleaseGlobalLock( &pMac->sme );
3924 }
3925
3926 return (status);
3927}
3928
3929/* ---------------------------------------------------------------------------
3930 \fn sme_EnablePowerSave
3931 \brief Enables one of the power saving modes.
3932 \param hHal - The handle returned by macOpen.
3933 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3934 while the chip is operating in Full Power, PMC will start
3935 a timer that will try to put the chip in BMPS mode after
3936 expiry.
3937 \return eHalStatus
3938 ---------------------------------------------------------------------------*/
3939eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3940{
3941 eHalStatus status = eHAL_STATUS_FAILURE;
3942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3943
Katya Nigambcb705f2013-12-26 14:26:22 +05303944 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003945 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003946 status = sme_AcquireGlobalLock( &pMac->sme );
3947 if ( HAL_STATUS_SUCCESS( status ) )
3948 {
3949 status = pmcEnablePowerSave(hHal, psMode);
3950 sme_ReleaseGlobalLock( &pMac->sme );
3951 }
3952
3953 return (status);
3954}
3955
3956/* ---------------------------------------------------------------------------
3957 \fn sme_DisablePowerSave
3958 \brief Disables one of the power saving modes.
3959 \param hHal - The handle returned by macOpen.
3960 \param psMode - The power saving mode to disable. Disabling does not imply
3961 that device will be brought out of the current PS mode. This
3962 is purely a configuration API.
3963 \return eHalStatus
3964 ---------------------------------------------------------------------------*/
3965eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3966{
3967 eHalStatus status = eHAL_STATUS_FAILURE;
3968 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3969
Katya Nigambcb705f2013-12-26 14:26:22 +05303970 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003971 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003972 status = sme_AcquireGlobalLock( &pMac->sme );
3973 if ( HAL_STATUS_SUCCESS( status ) )
3974 {
3975 status = pmcDisablePowerSave(hHal, psMode);
3976 sme_ReleaseGlobalLock( &pMac->sme );
3977 }
3978
3979 return (status);
3980 }
3981
3982/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303983+ \fn sme_SetHostPowerSave
3984+ \brief Enables BMPS logic to be controlled by User level apps
3985+ \param hHal - The handle returned by macOpen.
3986+ \param psMode - The power saving mode to disable. Disabling does not imply
3987+ that device will be brought out of the current PS mode. This
3988+ is purely a configuration API.
3989+ \return eHalStatus
3990+ ---------------------------------------------------------------------------*/
3991eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3992{
3993 eHalStatus status = eHAL_STATUS_FAILURE;
3994 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3995
3996 pMac->pmc.isHostPsEn = psMode;
3997
3998 return (status);
3999}
4000
4001/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004002 \fn sme_StartAutoBmpsTimer
4003 \brief Starts a timer that periodically polls all the registered
4004 module for entry into Bmps mode. This timer is started only if BMPS is
4005 enabled and whenever the device is in full power.
4006 \param hHal - The handle returned by macOpen.
4007 \return eHalStatus
4008 ---------------------------------------------------------------------------*/
4009eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4010{
4011 eHalStatus status = eHAL_STATUS_FAILURE;
4012 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4013
Katya Nigambcb705f2013-12-26 14:26:22 +05304014 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004015 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004016 status = sme_AcquireGlobalLock( &pMac->sme );
4017 if ( HAL_STATUS_SUCCESS( status ) )
4018 {
4019 status = pmcStartAutoBmpsTimer(hHal);
4020 sme_ReleaseGlobalLock( &pMac->sme );
4021 }
4022
4023 return (status);
4024}
4025/* ---------------------------------------------------------------------------
4026 \fn sme_StopAutoBmpsTimer
4027 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4028 Stopping the timer does not cause a device state change. Only the timer
4029 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4030 \param hHal - The handle returned by macOpen.
4031 \return eHalStatus
4032 ---------------------------------------------------------------------------*/
4033eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4034{
4035 eHalStatus status = eHAL_STATUS_FAILURE;
4036 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4037
Katya Nigambcb705f2013-12-26 14:26:22 +05304038 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004039 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 status = sme_AcquireGlobalLock( &pMac->sme );
4041 if ( HAL_STATUS_SUCCESS( status ) )
4042 {
4043 status = pmcStopAutoBmpsTimer(hHal);
4044 sme_ReleaseGlobalLock( &pMac->sme );
4045 }
4046
4047 return (status);
4048}
4049/* ---------------------------------------------------------------------------
4050 \fn sme_QueryPowerState
4051 \brief Returns the current power state of the device.
4052 \param hHal - The handle returned by macOpen.
4053 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4054 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4055 \return eHalStatus
4056 ---------------------------------------------------------------------------*/
4057eHalStatus sme_QueryPowerState (
4058 tHalHandle hHal,
4059 tPmcPowerState *pPowerState,
4060 tPmcSwitchState *pSwWlanSwitchState)
4061{
4062 eHalStatus status = eHAL_STATUS_FAILURE;
4063 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4064
4065 status = sme_AcquireGlobalLock( &pMac->sme );
4066 if ( HAL_STATUS_SUCCESS( status ) )
4067 {
4068 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4069 sme_ReleaseGlobalLock( &pMac->sme );
4070 }
4071
4072 return (status);
4073}
4074
4075/* ---------------------------------------------------------------------------
4076 \fn sme_IsPowerSaveEnabled
4077 \brief Checks if the device is able to enter a particular power save mode
4078 This does not imply that the device is in a particular PS mode
4079 \param hHal - The handle returned by macOpen.
4080 \param psMode - the power saving mode
4081 \return eHalStatus
4082 ---------------------------------------------------------------------------*/
4083tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4084{
4085 eHalStatus status = eHAL_STATUS_FAILURE;
4086 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4087 tANI_BOOLEAN result = false;
4088
Katya Nigambcb705f2013-12-26 14:26:22 +05304089 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004090 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004091 status = sme_AcquireGlobalLock( &pMac->sme );
4092 if ( HAL_STATUS_SUCCESS( status ) )
4093 {
4094 result = pmcIsPowerSaveEnabled(hHal, psMode);
4095 sme_ReleaseGlobalLock( &pMac->sme );
4096 return result;
4097 }
4098
4099 return false;
4100}
4101
4102/* ---------------------------------------------------------------------------
4103 \fn sme_RequestFullPower
4104 \brief Request that the device be brought to full power state. When the
4105 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4106 is enabled. On timer expiry PMC will attempt to put the device in
4107 BMPS mode if following holds true:
4108 - BMPS mode is enabled
4109 - Polling of all modules through the Power Save Check routine passes
4110 - STA is associated to an access point
4111 \param hHal - The handle returned by macOpen.
4112 \param - callbackRoutine Callback routine invoked in case of success/failure
4113 \return eHalStatus - status
4114 eHAL_STATUS_SUCCESS - device brought to full power state
4115 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4116 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4117 ---------------------------------------------------------------------------*/
4118eHalStatus sme_RequestFullPower (
4119 tHalHandle hHal,
4120 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4121 void *callbackContext,
4122 tRequestFullPowerReason fullPowerReason)
4123{
4124 eHalStatus status = eHAL_STATUS_FAILURE;
4125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4126
Katya Nigambcb705f2013-12-26 14:26:22 +05304127 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004128 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004129 status = sme_AcquireGlobalLock( &pMac->sme );
4130 if ( HAL_STATUS_SUCCESS( status ) )
4131 {
4132 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4133 sme_ReleaseGlobalLock( &pMac->sme );
4134 }
4135
4136 return (status);
4137}
4138
4139/* ---------------------------------------------------------------------------
4140 \fn sme_RequestBmps
4141 \brief Request that the device be put in BMPS state. Request will be
4142 accepted only if BMPS mode is enabled and power save check routine
4143 passes.
4144 \param hHal - The handle returned by macOpen.
4145 \param - callbackRoutine Callback routine invoked in case of success/failure
4146 \return eHalStatus
4147 eHAL_STATUS_SUCCESS - device is in BMPS state
4148 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4149 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4150 ---------------------------------------------------------------------------*/
4151eHalStatus sme_RequestBmps (
4152 tHalHandle hHal,
4153 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4154 void *callbackContext)
4155{
4156 eHalStatus status = eHAL_STATUS_FAILURE;
4157 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4158
Katya Nigambcb705f2013-12-26 14:26:22 +05304159 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004160 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004161 status = sme_AcquireGlobalLock( &pMac->sme );
4162 if ( HAL_STATUS_SUCCESS( status ) )
4163 {
4164 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4165 sme_ReleaseGlobalLock( &pMac->sme );
4166 }
4167
4168 return (status);
4169}
4170
4171
4172/* ---------------------------------------------------------------------------
4173 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004174 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4175 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004176 \param hHal - The handle returned by macOpen.
4177 ---------------------------------------------------------------------------*/
4178void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4179{
4180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4181
Katya Nigambcb705f2013-12-26 14:26:22 +05304182 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004183 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4185 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4186}
4187
4188
4189/* ---------------------------------------------------------------------------
4190 \fn sme_StartUapsd
4191 \brief Request that the device be put in UAPSD state. If the device is in
4192 Full Power it will be put in BMPS mode first and then into UAPSD
4193 mode.
4194 \param hHal - The handle returned by macOpen.
4195 \param - callbackRoutine Callback routine invoked in case of success/failure
4196 eHAL_STATUS_SUCCESS - device is in UAPSD state
4197 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4198 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4199 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4200 \return eHalStatus
4201 ---------------------------------------------------------------------------*/
4202eHalStatus sme_StartUapsd (
4203 tHalHandle hHal,
4204 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4205 void *callbackContext)
4206{
4207 eHalStatus status = eHAL_STATUS_FAILURE;
4208 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4209
4210 status = sme_AcquireGlobalLock( &pMac->sme );
4211 if ( HAL_STATUS_SUCCESS( status ) )
4212 {
4213 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4214 sme_ReleaseGlobalLock( &pMac->sme );
4215 }
4216
4217 return (status);
4218 }
4219
4220/* ---------------------------------------------------------------------------
4221 \fn sme_StopUapsd
4222 \brief Request that the device be put out of UAPSD state. Device will be
4223 put in in BMPS state after stop UAPSD completes.
4224 \param hHal - The handle returned by macOpen.
4225 \return eHalStatus
4226 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4227 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4228 ---------------------------------------------------------------------------*/
4229eHalStatus sme_StopUapsd (tHalHandle hHal)
4230{
4231 eHalStatus status = eHAL_STATUS_FAILURE;
4232 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4233
4234 status = sme_AcquireGlobalLock( &pMac->sme );
4235 if ( HAL_STATUS_SUCCESS( status ) )
4236 {
4237 status = pmcStopUapsd(hHal);
4238 sme_ReleaseGlobalLock( &pMac->sme );
4239 }
4240
4241 return (status);
4242}
4243
4244/* ---------------------------------------------------------------------------
4245 \fn sme_RequestStandby
4246 \brief Request that the device be put in standby. It is HDD's responsibility
4247 to bring the chip to full power and do a disassoc before calling
4248 this API.
4249 \param hHal - The handle returned by macOpen.
4250 \param - callbackRoutine Callback routine invoked in case of success/failure
4251 \return eHalStatus
4252 eHAL_STATUS_SUCCESS - device is in Standby mode
4253 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4254 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4255 ---------------------------------------------------------------------------*/
4256eHalStatus sme_RequestStandby (
4257 tHalHandle hHal,
4258 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4259 void *callbackContext)
4260{
4261 eHalStatus status = eHAL_STATUS_FAILURE;
4262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4263
Katya Nigambcb705f2013-12-26 14:26:22 +05304264 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004265 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304266 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 status = sme_AcquireGlobalLock( &pMac->sme );
4268 if ( HAL_STATUS_SUCCESS( status ) )
4269 {
4270 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4271 sme_ReleaseGlobalLock( &pMac->sme );
4272 }
4273
4274 return (status);
4275}
4276
4277/* ---------------------------------------------------------------------------
4278 \fn sme_RegisterPowerSaveCheck
4279 \brief Register a power save check routine that is called whenever
4280 the device is about to enter one of the power save modes.
4281 \param hHal - The handle returned by macOpen.
4282 \param checkRoutine - Power save check routine to be registered
4283 \return eHalStatus
4284 eHAL_STATUS_SUCCESS - successfully registered
4285 eHAL_STATUS_FAILURE - not successfully registered
4286 ---------------------------------------------------------------------------*/
4287eHalStatus sme_RegisterPowerSaveCheck (
4288 tHalHandle hHal,
4289 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4290{
4291 eHalStatus status = eHAL_STATUS_FAILURE;
4292 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4293
4294 status = sme_AcquireGlobalLock( &pMac->sme );
4295 if ( HAL_STATUS_SUCCESS( status ) )
4296 {
4297 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4298 sme_ReleaseGlobalLock( &pMac->sme );
4299 }
4300
4301 return (status);
4302}
4303
4304/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304305 \fn sme_Register11dScanDoneCallback
4306 \brief Register a routine of type csrScanCompleteCallback which is
4307 called whenever an 11d scan is done
4308 \param hHal - The handle returned by macOpen.
4309 \param callback - 11d scan complete routine to be registered
4310 \return eHalStatus
4311 ---------------------------------------------------------------------------*/
4312eHalStatus sme_Register11dScanDoneCallback (
4313 tHalHandle hHal,
4314 csrScanCompleteCallback callback)
4315{
4316 eHalStatus status = eHAL_STATUS_SUCCESS;
4317 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4318
4319 pMac->scan.callback11dScanDone = callback;
4320
4321 return (status);
4322}
4323
4324/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 \fn sme_DeregisterPowerSaveCheck
4326 \brief Deregister a power save check routine
4327 \param hHal - The handle returned by macOpen.
4328 \param checkRoutine - Power save check routine to be deregistered
4329 \return eHalStatus
4330 eHAL_STATUS_SUCCESS - successfully deregistered
4331 eHAL_STATUS_FAILURE - not successfully deregistered
4332 ---------------------------------------------------------------------------*/
4333eHalStatus sme_DeregisterPowerSaveCheck (
4334 tHalHandle hHal,
4335 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4336{
4337 eHalStatus status = eHAL_STATUS_FAILURE;
4338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4339
4340 status = sme_AcquireGlobalLock( &pMac->sme );
4341 if ( HAL_STATUS_SUCCESS( status ) )
4342 {
4343 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4344 sme_ReleaseGlobalLock( &pMac->sme );
4345 }
4346
4347 return (status);
4348}
4349
4350/* ---------------------------------------------------------------------------
4351 \fn sme_RegisterDeviceStateUpdateInd
4352 \brief Register a callback routine that is called whenever
4353 the device enters a new device state (Full Power, BMPS, UAPSD)
4354 \param hHal - The handle returned by macOpen.
4355 \param callbackRoutine - Callback routine to be registered
4356 \param callbackContext - Cookie to be passed back during callback
4357 \return eHalStatus
4358 eHAL_STATUS_SUCCESS - successfully registered
4359 eHAL_STATUS_FAILURE - not successfully registered
4360 ---------------------------------------------------------------------------*/
4361eHalStatus sme_RegisterDeviceStateUpdateInd (
4362 tHalHandle hHal,
4363 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4364 void *callbackContext)
4365{
4366 eHalStatus status = eHAL_STATUS_FAILURE;
4367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4368
4369 status = sme_AcquireGlobalLock( &pMac->sme );
4370 if ( HAL_STATUS_SUCCESS( status ) )
4371 {
4372 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4373 sme_ReleaseGlobalLock( &pMac->sme );
4374 }
4375
4376 return (status);
4377}
4378
4379/* ---------------------------------------------------------------------------
4380 \fn sme_DeregisterDeviceStateUpdateInd
4381 \brief Deregister a routine that was registered for device state changes
4382 \param hHal - The handle returned by macOpen.
4383 \param callbackRoutine - Callback routine to be deregistered
4384 \return eHalStatus
4385 eHAL_STATUS_SUCCESS - successfully deregistered
4386 eHAL_STATUS_FAILURE - not successfully deregistered
4387 ---------------------------------------------------------------------------*/
4388eHalStatus sme_DeregisterDeviceStateUpdateInd (
4389 tHalHandle hHal,
4390 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4391{
4392 eHalStatus status = eHAL_STATUS_FAILURE;
4393 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4394
4395 status = sme_AcquireGlobalLock( &pMac->sme );
4396 if ( HAL_STATUS_SUCCESS( status ) )
4397 {
4398 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4399 sme_ReleaseGlobalLock( &pMac->sme );
4400 }
4401
4402 return (status);
4403}
4404
4405/* ---------------------------------------------------------------------------
4406 \fn sme_WowlAddBcastPattern
4407 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4408 do a pattern match on these patterns when Wowl is enabled during BMPS
4409 mode. Note that Firmware performs the pattern matching only on
4410 broadcast frames and while Libra is in BMPS mode.
4411 \param hHal - The handle returned by macOpen.
4412 \param pattern - Pattern to be added
4413 \return eHalStatus
4414 eHAL_STATUS_FAILURE Cannot add pattern
4415 eHAL_STATUS_SUCCESS Request accepted.
4416 ---------------------------------------------------------------------------*/
4417eHalStatus sme_WowlAddBcastPattern (
4418 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004419 tpSirWowlAddBcastPtrn pattern,
4420 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004421{
4422 eHalStatus status = eHAL_STATUS_FAILURE;
4423 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304424 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004425 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 status = sme_AcquireGlobalLock( &pMac->sme );
4427 if ( HAL_STATUS_SUCCESS( status ) )
4428 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004429 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004430 sme_ReleaseGlobalLock( &pMac->sme );
4431 }
4432
4433 return (status);
4434}
4435
4436/* ---------------------------------------------------------------------------
4437 \fn sme_WowlDelBcastPattern
4438 \brief Delete a pattern that was added for Pattern Byte Matching.
4439 \param hHal - The handle returned by macOpen.
4440 \param pattern - Pattern to be deleted
4441 \return eHalStatus
4442 eHAL_STATUS_FAILURE Cannot delete pattern
4443 eHAL_STATUS_SUCCESS Request accepted.
4444 ---------------------------------------------------------------------------*/
4445eHalStatus sme_WowlDelBcastPattern (
4446 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004447 tpSirWowlDelBcastPtrn pattern,
4448 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004449{
4450 eHalStatus status = eHAL_STATUS_FAILURE;
4451 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304452 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004453 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004454 status = sme_AcquireGlobalLock( &pMac->sme );
4455 if ( HAL_STATUS_SUCCESS( status ) )
4456 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004457 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 sme_ReleaseGlobalLock( &pMac->sme );
4459 }
4460
4461 return (status);
4462}
4463
4464/* ---------------------------------------------------------------------------
4465 \fn sme_EnterWowl
4466 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4467 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4468 SME will will cache the information that WOWL has been enabled and
4469 attempt to put the device in BMPS. On entry into BMPS, SME will
4470 enable the WOWL mode.
4471 Note 1: If we exit BMPS mode (someone requests full power), we
4472 will NOT resume WOWL when we go back to BMPS again. Request for full
4473 power (while in WOWL mode) means disable WOWL and go to full power.
4474 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4475 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4476 are required. Currently there is no requirement or use case to support
4477 UAPSD and WOWL at the same time.
4478
4479 \param hHal - The handle returned by macOpen.
4480 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4481 Used for success/failure notification by SME
4482 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4483 at the time of callback.
4484 \param wakeReasonIndCB - Callback routine provided by HDD.
4485 Used for Wake Reason Indication by SME
4486 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4487 at the time of callback.
4488 \return eHalStatus
4489 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4490 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4491 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4492 BMPS mode is entered.
4493 ---------------------------------------------------------------------------*/
4494eHalStatus sme_EnterWowl (
4495 tHalHandle hHal,
4496 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4497 void *enterWowlCallbackContext,
4498#ifdef WLAN_WAKEUP_EVENTS
4499 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4500 void *wakeIndicationCBContext,
4501#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004502 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004503{
4504 eHalStatus status = eHAL_STATUS_FAILURE;
4505 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304506 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004507 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 status = sme_AcquireGlobalLock( &pMac->sme );
4509 if ( HAL_STATUS_SUCCESS( status ) )
4510 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004511 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004512#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004513 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004514#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004515 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004516 sme_ReleaseGlobalLock( &pMac->sme );
4517 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004518 return (status);
4519}
4520/* ---------------------------------------------------------------------------
4521 \fn sme_ExitWowl
4522 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4523 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4524 mode.
4525 \param hHal - The handle returned by macOpen.
4526 \return eHalStatus
4527 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4528 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4529 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05304530eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004531{
4532 eHalStatus status = eHAL_STATUS_FAILURE;
4533 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304534 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004535 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 status = sme_AcquireGlobalLock( &pMac->sme );
4537 if ( HAL_STATUS_SUCCESS( status ) )
4538 {
c_hpothu01484c02014-05-16 14:05:15 +05304539 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004540 sme_ReleaseGlobalLock( &pMac->sme );
4541 }
4542
4543 return (status);
4544}
4545
4546/* ---------------------------------------------------------------------------
4547
4548 \fn sme_RoamSetKey
4549
4550 \brief To set encryption key. This function should be called only when connected
4551 This is an asynchronous API.
4552
4553 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4554
4555 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4556
4557 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4558
4559 FAILURE or RESOURCES The API finished and failed.
4560
4561 -------------------------------------------------------------------------------*/
4562eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4563{
4564 eHalStatus status = eHAL_STATUS_FAILURE;
4565 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4566 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 tANI_U32 i;
4568 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004569
Katya Nigambcb705f2013-12-26 14:26:22 +05304570 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004571 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004572 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4573 {
4574 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4575 return eHAL_STATUS_FAILURE;
4576 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304577 /*Once Setkey is done, we can go in BMPS*/
4578 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304579 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304580 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304581 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4582 " to allow BMPS"));
4583 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004584
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 status = sme_AcquireGlobalLock( &pMac->sme );
4586 if ( HAL_STATUS_SUCCESS( status ) )
4587 {
4588 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4589 if(pRoamId)
4590 {
4591 *pRoamId = roamId;
4592 }
4593
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004594 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004595
4596 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004597 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004598
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004599 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004600
4601 pSession = CSR_GET_SESSION(pMac, sessionId);
4602
Jeff Johnson32d95a32012-09-10 13:15:23 -07004603 if(!pSession)
4604 {
4605 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004606 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004607 return eHAL_STATUS_FAILURE;
4608 }
4609
Jeff Johnson295189b2012-06-20 16:38:30 -07004610 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4611 {
4612 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4613 {
4614 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4615 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4616 {
4617 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4618 }
4619 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4620 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4621 {
4622 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4623 }
4624 }
4625 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004626
4627 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4628 sme_ReleaseGlobalLock( &pMac->sme );
4629 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304630#ifdef DEBUG_ROAM_DELAY
4631 //Store sent PTK key time
4632 if(pSetKey->keyDirection == eSIR_TX_RX)
4633 {
4634 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4635 }
4636 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4637 {
4638 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4639 }
4640 else
4641 {
4642 return (status);
4643 }
4644#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004645
4646 return (status);
4647}
4648
4649
4650/* ---------------------------------------------------------------------------
4651
4652 \fn sme_RoamRemoveKey
4653
4654 \brief To set encryption key. This is an asynchronous API.
4655
4656 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4657
4658 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4659
4660 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4661
4662 FAILURE or RESOURCES The API finished and failed.
4663
4664 -------------------------------------------------------------------------------*/
4665eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4666 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4667{
4668 eHalStatus status = eHAL_STATUS_FAILURE;
4669 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4670 tANI_U32 roamId;
4671
Katya Nigambcb705f2013-12-26 14:26:22 +05304672 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004673 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004674 status = sme_AcquireGlobalLock( &pMac->sme );
4675 if ( HAL_STATUS_SUCCESS( status ) )
4676 {
4677 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4678 if(pRoamId)
4679 {
4680 *pRoamId = roamId;
4681 }
4682 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4683 sme_ReleaseGlobalLock( &pMac->sme );
4684 }
4685
4686 return (status);
4687}
4688
4689/* ---------------------------------------------------------------------------
4690 \fn sme_GetRssi
4691 \brief a wrapper function that client calls to register a callback to get RSSI
4692
4693 \param callback - SME sends back the requested stats using the callback
4694 \param staId - The station ID for which the stats is requested for
4695 \param pContext - user context to be passed back along with the callback
4696 \param pVosContext - vos context
4697 \return eHalStatus
4698 ---------------------------------------------------------------------------*/
4699eHalStatus sme_GetRssi(tHalHandle hHal,
4700 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004701 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004702 void *pContext, void* pVosContext)
4703{
4704 eHalStatus status = eHAL_STATUS_FAILURE;
4705 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4706
4707 status = sme_AcquireGlobalLock( &pMac->sme );
4708 if ( HAL_STATUS_SUCCESS( status ) )
4709 {
4710 status = csrGetRssi( pMac, callback,
4711 staId, bssId, pContext, pVosContext);
4712 sme_ReleaseGlobalLock( &pMac->sme );
4713 }
4714 return (status);
4715}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304716
4717/* ---------------------------------------------------------------------------
4718 \fn sme_GetSnr
4719 \brief a wrapper function that client calls to register a callback to
4720 get SNR
4721
4722 \param callback - SME sends back the requested stats using the callback
4723 \param staId - The station ID for which the stats is requested for
4724 \param pContext - user context to be passed back along with the callback
4725 \param pVosContext - vos context
4726 \return eHalStatus
4727 ---------------------------------------------------------------------------*/
4728eHalStatus sme_GetSnr(tHalHandle hHal,
4729 tCsrSnrCallback callback,
4730 tANI_U8 staId, tCsrBssid bssId,
4731 void *pContext)
4732{
4733 eHalStatus status = eHAL_STATUS_FAILURE;
4734 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4735
4736 status = sme_AcquireGlobalLock( &pMac->sme );
4737 if ( HAL_STATUS_SUCCESS( status ) )
4738 {
4739 status = csrGetSnr(pMac, callback,
4740 staId, bssId, pContext);
4741 sme_ReleaseGlobalLock( &pMac->sme );
4742 }
4743 return status;
4744}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004745#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004746/* ---------------------------------------------------------------------------
4747 \fn sme_GetRoamRssi
4748 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4749
4750 \param callback - SME sends back the requested stats using the callback
4751 \param staId - The station ID for which the stats is requested for
4752 \param pContext - user context to be passed back along with the callback
4753 \param pVosContext - vos context
4754 \return eHalStatus
4755 ---------------------------------------------------------------------------*/
4756eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4757 tCsrRssiCallback callback,
4758 tANI_U8 staId, tCsrBssid bssId,
4759 void *pContext, void* pVosContext)
4760{
4761 eHalStatus status = eHAL_STATUS_FAILURE;
4762 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4763
4764 status = sme_AcquireGlobalLock( &pMac->sme );
4765 if ( HAL_STATUS_SUCCESS( status ) )
4766 {
4767 status = csrGetRoamRssi( pMac, callback,
4768 staId, bssId, pContext, pVosContext);
4769 sme_ReleaseGlobalLock( &pMac->sme );
4770 }
4771 return (status);
4772}
4773#endif
4774
Jeff Johnson295189b2012-06-20 16:38:30 -07004775
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004776#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004777/* ---------------------------------------------------------------------------
4778 \fn sme_GetTsmStats
4779 \brief a wrapper function that client calls to register a callback to get TSM Stats
4780
4781 \param callback - SME sends back the requested stats using the callback
4782 \param staId - The station ID for which the stats is requested for
4783 \param pContext - user context to be passed back along with the callback
4784 \param pVosContext - vos context
4785 \return eHalStatus
4786 ---------------------------------------------------------------------------*/
4787eHalStatus sme_GetTsmStats(tHalHandle hHal,
4788 tCsrTsmStatsCallback callback,
4789 tANI_U8 staId, tCsrBssid bssId,
4790 void *pContext, void* pVosContext, tANI_U8 tid)
4791{
4792 eHalStatus status = eHAL_STATUS_FAILURE;
4793 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4794
4795 status = sme_AcquireGlobalLock( &pMac->sme );
4796 if ( HAL_STATUS_SUCCESS( status ) )
4797 {
4798 status = csrGetTsmStats( pMac, callback,
4799 staId, bssId, pContext, pVosContext, tid);
4800 sme_ReleaseGlobalLock( &pMac->sme );
4801 }
4802 return (status);
4803}
4804#endif
4805
4806
Jeff Johnson295189b2012-06-20 16:38:30 -07004807/* ---------------------------------------------------------------------------
4808 \fn sme_GetStatistics
4809 \brief a wrapper function that client calls to register a callback to get
4810 different PHY level statistics from CSR.
4811
4812 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4813 \param statsMask - The different category/categories of stats requester is looking for
4814 \param callback - SME sends back the requested stats using the callback
4815 \param periodicity - If requester needs periodic update in millisec, 0 means
4816 it's an one time request
4817 \param cache - If requester is happy with cached stats
4818 \param staId - The station ID for which the stats is requested for
4819 \param pContext - user context to be passed back along with the callback
4820 \return eHalStatus
4821 ---------------------------------------------------------------------------*/
4822eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4823 tANI_U32 statsMask,
4824 tCsrStatsCallback callback,
4825 tANI_U32 periodicity, tANI_BOOLEAN cache,
4826 tANI_U8 staId, void *pContext)
4827{
4828 eHalStatus status = eHAL_STATUS_FAILURE;
4829 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4830
Katya Nigambcb705f2013-12-26 14:26:22 +05304831 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004832 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 status = sme_AcquireGlobalLock( &pMac->sme );
4834 if ( HAL_STATUS_SUCCESS( status ) )
4835 {
4836 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4837 periodicity, cache, staId, pContext);
4838 sme_ReleaseGlobalLock( &pMac->sme );
4839 }
4840
4841 return (status);
4842
4843}
4844
4845/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304846 \fn smeGetTLSTAState
4847 \helper function to get the TL STA State whenever the function is called.
4848
4849 \param staId - The staID to be passed to the TL
4850 to get the relevant TL STA State
4851 \return the state as tANI_U16
4852 ---------------------------------------------------------------------------*/
4853tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4854{
4855 tANI_U16 tlSTAState = TL_INIT_STATE;
4856 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4857 eHalStatus status = eHAL_STATUS_FAILURE;
4858
4859 status = sme_AcquireGlobalLock( &pMac->sme );
4860 if ( HAL_STATUS_SUCCESS( status ) )
4861 {
4862 tlSTAState = csrGetTLSTAState( pMac, staId);
4863 sme_ReleaseGlobalLock( &pMac->sme );
4864 }
4865
4866 return tlSTAState;
4867}
4868
4869/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004870
4871 \fn sme_GetCountryCode
4872
4873 \brief To return the current country code. If no country code is applied, default country code is
4874 used to fill the buffer.
4875 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4876 This is a synchronous API.
4877
4878 \param pBuf - pointer to a caller allocated buffer for returned country code.
4879
4880 \param pbLen For input, this parameter indicates how big is the buffer.
4881 Upon return, this parameter has the number of bytes for country. If pBuf
4882 doesn't have enough space, this function returns
4883 fail status and this parameter contains the number that is needed.
4884
4885 \return eHalStatus SUCCESS.
4886
4887 FAILURE or RESOURCES The API finished and failed.
4888
4889 -------------------------------------------------------------------------------*/
4890eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4891{
4892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4893
Katya Nigambcb705f2013-12-26 14:26:22 +05304894 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004895 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4896
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4898}
4899
4900
4901/* ---------------------------------------------------------------------------
4902
4903 \fn sme_SetCountryCode
4904
4905 \brief To change the current/default country code.
4906 If 11d supported is turned off, an error is return.
4907 This is a synchronous API.
4908
4909 \param pCountry - pointer to a caller allocated buffer for the country code.
4910
4911 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4912 whether a reset is required.
4913
4914 \return eHalStatus SUCCESS.
4915
4916 FAILURE or RESOURCES The API finished and failed.
4917
4918 -------------------------------------------------------------------------------*/
4919eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4920{
4921 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4922
Katya Nigambcb705f2013-12-26 14:26:22 +05304923 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004924 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004925 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4926}
4927
4928
4929/* ---------------------------------------------------------------------------
4930 \fn sme_ResetCountryCodeInformation
4931 \brief this function is to reset the country code current being used back to EEPROM default
4932 this includes channel list and power setting. This is a synchronous API.
4933 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4934 a restart is needed to apply the change
4935 \return eHalStatus
4936 -------------------------------------------------------------------------------*/
4937eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4938{
4939 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4940
4941 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4942}
4943
4944
4945/* ---------------------------------------------------------------------------
4946 \fn sme_GetSupportedCountryCode
4947 \brief this function is to get a list of the country code current being supported
4948 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4949 this has the country code list. 3 bytes for each country code. This may be NULL if
4950 caller wants to know the needed byte count.
4951 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4952 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4953 \return eHalStatus
4954 -------------------------------------------------------------------------------*/
4955eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4956{
4957 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4958
4959 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4960}
4961
4962
4963/* ---------------------------------------------------------------------------
4964 \fn sme_GetCurrentRegulatoryDomain
4965 \brief this function is to get the current regulatory domain. This is a synchronous API.
4966 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4967 SME. The function fails if 11d support is turned off.
4968 \param pDomain - Caller allocated buffer to return the current domain.
4969 \return eHalStatus SUCCESS.
4970
4971 FAILURE or RESOURCES The API finished and failed.
4972 -------------------------------------------------------------------------------*/
4973eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4974{
4975 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4976 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4977
4978 if( pDomain )
4979 {
4980 if( csrIs11dSupported( pMac ) )
4981 {
4982 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4983 status = eHAL_STATUS_SUCCESS;
4984 }
4985 else
4986 {
4987 status = eHAL_STATUS_FAILURE;
4988 }
4989 }
4990
4991 return ( status );
4992}
4993
4994
4995/* ---------------------------------------------------------------------------
4996 \fn sme_SetRegulatoryDomain
4997 \brief this function is to set the current regulatory domain.
4998 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4999 SME. This is a synchronous API.
5000 \param domainId - indicate the domain (defined in the driver) needs to set to.
5001 See v_REGDOMAIN_t for definition
5002 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5003 a restart is needed to apply the change
5004 \return eHalStatus
5005 -------------------------------------------------------------------------------*/
5006eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5007{
5008 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5009
5010 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5011}
5012
5013
5014/* ---------------------------------------------------------------------------
5015
5016 \fn sme_GetRegulatoryDomainForCountry
5017
5018 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5019
5020 \param pCountry - pointer to a caller allocated buffer for input country code.
5021
5022 \param pDomainId Upon successful return, it is the domain that country belongs to.
5023 If it is NULL, returning success means that the country code is known.
5024
5025 \return eHalStatus SUCCESS.
5026
5027 FAILURE or RESOURCES The API finished and failed.
5028
5029 -------------------------------------------------------------------------------*/
5030eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5031{
5032 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5033
Kiet Lam6c583332013-10-14 05:37:09 +05305034 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5035 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005036}
5037
5038
5039
5040
5041/* ---------------------------------------------------------------------------
5042
5043 \fn sme_GetSupportedRegulatoryDomains
5044
5045 \brief To return a list of supported regulatory domains. This is a synchronous API.
5046
5047 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5048
5049 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5050 Upon return, this parameter has the number for supported domains. If pDomains
5051 doesn't have enough space for all the supported domains, this function returns
5052 fail status and this parameter contains the number that is needed.
5053
5054 \return eHalStatus SUCCESS.
5055
5056 FAILURE or RESOURCES The API finished and failed.
5057
5058 -------------------------------------------------------------------------------*/
5059eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5060{
5061 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5062
5063 //We support all domains for now
5064 if( pNumDomains )
5065 {
5066 if( NUM_REG_DOMAINS <= *pNumDomains )
5067 {
5068 status = eHAL_STATUS_SUCCESS;
5069 }
5070 *pNumDomains = NUM_REG_DOMAINS;
5071 }
5072 if( HAL_STATUS_SUCCESS( status ) )
5073 {
5074 if( pDomains )
5075 {
5076 pDomains[0] = REGDOMAIN_FCC;
5077 pDomains[1] = REGDOMAIN_ETSI;
5078 pDomains[2] = REGDOMAIN_JAPAN;
5079 pDomains[3] = REGDOMAIN_WORLD;
5080 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5081 pDomains[5] = REGDOMAIN_APAC;
5082 pDomains[6] = REGDOMAIN_KOREA;
5083 pDomains[7] = REGDOMAIN_HI_5GHZ;
5084 pDomains[8] = REGDOMAIN_NO_5GHZ;
5085 }
5086 else
5087 {
5088 status = eHAL_STATUS_INVALID_PARAMETER;
5089 }
5090 }
5091
5092 return ( status );
5093}
5094
5095
5096//some support functions
5097tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5098{
5099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5100
5101 return ( csrIs11dSupported( pMac ) );
5102}
5103
5104
5105tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5106{
5107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5108
5109 return ( csrIs11hSupported( pMac ) );
5110}
5111
5112
5113tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5114{
5115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5116
5117 return ( csrIsWmmSupported( pMac ) );
5118}
5119
5120//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5121eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5122{
5123 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5124
5125 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5126}
5127
5128/* ---------------------------------------------------------------------------
5129
5130 \fn sme_ChangeCountryCode
5131
5132 \brief Change Country code from upperlayer during WLAN driver operation.
5133 This is a synchronous API.
5134
5135 \param hHal - The handle returned by macOpen.
5136
5137 \param pCountry New Country Code String
5138
Abhishek Singha306a442013-11-07 18:39:01 +05305139 \param sendRegHint If we want to send reg hint to nl80211
5140
Jeff Johnson295189b2012-06-20 16:38:30 -07005141 \return eHalStatus SUCCESS.
5142
5143 FAILURE or RESOURCES The API finished and failed.
5144
5145 -------------------------------------------------------------------------------*/
5146eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5147 tSmeChangeCountryCallback callback,
5148 tANI_U8 *pCountry,
5149 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305150 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305151 tAniBool countryFromUserSpace,
5152 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005153{
5154 eHalStatus status = eHAL_STATUS_FAILURE;
5155 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5156 vos_msg_t msg;
5157 tAniChangeCountryCodeReq *pMsg;
5158
Katya Nigambcb705f2013-12-26 14:26:22 +05305159 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005160 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 status = sme_AcquireGlobalLock( &pMac->sme );
5162 if ( HAL_STATUS_SUCCESS( status ) )
5163 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005164 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005165
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305166 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005167 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5168 {
5169
5170 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5171
5172 sme_ReleaseGlobalLock( &pMac->sme );
5173 status = eHAL_STATUS_FAILURE;
5174 return status;
5175 }
5176
Kiet Lam64c1b492013-07-12 13:56:44 +05305177 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5178 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005179 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005180 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005181 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305182 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005183 }
5184
5185 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5186 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305187 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305188 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305189 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005190 pMsg->changeCCCallback = callback;
5191 pMsg->pDevContext = pContext;
5192 pMsg->pVosContext = pVosContext;
5193
5194 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5195 msg.bodyptr = pMsg;
5196 msg.reserved = 0;
5197
5198 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5199 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005200 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305201 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005202 status = eHAL_STATUS_FAILURE;
5203 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005204 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005205 sme_ReleaseGlobalLock( &pMac->sme );
5206 }
5207
5208 return (status);
5209}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005210
5211/*--------------------------------------------------------------------------
5212
5213 \fn sme_GenericChangeCountryCode
5214
5215 \brief Change Country code from upperlayer during WLAN driver operation.
5216 This is a synchronous API.
5217
5218 \param hHal - The handle returned by macOpen.
5219
5220 \param pCountry New Country Code String
5221
5222 \param reg_domain regulatory domain
5223
5224 \return eHalStatus SUCCESS.
5225
5226 FAILURE or RESOURCES The API finished and failed.
5227
5228-----------------------------------------------------------------------------*/
5229eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5230 tANI_U8 *pCountry,
5231 v_REGDOMAIN_t reg_domain)
5232{
5233 eHalStatus status = eHAL_STATUS_FAILURE;
5234 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5235 vos_msg_t msg;
5236 tAniGenericChangeCountryCodeReq *pMsg;
5237
Kiet Lamcffc5862013-10-30 16:28:45 +05305238 if (NULL == pMac)
5239 {
5240 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5241 "%s: pMac is null", __func__);
5242 return status;
5243 }
5244
Amar Singhal0d15bd52013-10-12 23:13:13 -07005245 status = sme_AcquireGlobalLock( &pMac->sme );
5246 if ( HAL_STATUS_SUCCESS( status ) )
5247 {
5248 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305249 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5250 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005251 {
5252 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5253 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305254 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005255 }
5256
5257 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5258 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005259 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305260
5261 pMsg->countryCode[2] = ' '; /* For ASCII space */
5262
Amar Singhal0d15bd52013-10-12 23:13:13 -07005263 pMsg->domain_index = reg_domain;
5264
5265 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5266 msg.bodyptr = pMsg;
5267 msg.reserved = 0;
5268
5269 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5270 {
5271 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305272 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005273 status = eHAL_STATUS_FAILURE;
5274 }
5275 smsLog(pMac, LOG1, FL(" returned"));
5276 sme_ReleaseGlobalLock( &pMac->sme );
5277 }
5278
5279 return (status);
5280}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305281
5282/* ---------------------------------------------------------------------------
5283
5284 \fn sme_InitChannels
5285
5286 \brief Used to initialize CSR channel lists while driver loading
5287
5288 \param hHal - global pMac structure
5289
5290 \return eHalStatus SUCCESS.
5291
5292 FAILURE or RESOURCES The API finished and failed.
5293
5294 -------------------------------------------------------------------------------*/
5295eHalStatus sme_InitChannels(tHalHandle hHal)
5296{
5297 eHalStatus status = eHAL_STATUS_FAILURE;
5298 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5299
5300 if (NULL == pMac)
5301 {
5302 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5303 "%s: pMac is null", __func__);
5304 return status;
5305 }
5306
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305307 status = csrInitChannels(pMac);
5308
Mihir Shetee1093ba2014-01-21 20:13:32 +05305309 return status;
5310}
5311
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305312/*-------------------------------------------------------------------------
5313 \fn sme_InitChannelsForCC
5314
5315 \brief Used to issue regulatory hint to user
5316
5317 \param hHal - global pMac structure
5318
5319 \return eHalStatus SUCCESS.
5320
5321 FAILURE or RESOURCES The API finished and failed.
5322--------------------------------------------------------------------------*/
5323
5324eHalStatus sme_InitChannelsForCC(tHalHandle hHal)
5325{
5326 eHalStatus status = eHAL_STATUS_FAILURE;
5327 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5328
5329 if (NULL == pMac)
5330 {
5331 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5332 "%s: pMac is null", __func__);
5333 return status;
5334 }
5335 status = csrInitChannelsForCC(pMac);
5336
5337 return status;
5338}
5339
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305340/* ---------------------------------------------------------------------------
5341
5342 \fn sme_DHCPStartInd
5343
5344 \brief API to signal the FW about the DHCP Start event.
5345
5346 \param hHal - HAL handle for device.
5347
5348 \param device_mode - mode(AP,SAP etc) of the device.
5349
5350 \param macAddr - MAC address of the device.
5351
5352 \return eHalStatus SUCCESS.
5353
5354 FAILURE or RESOURCES The API finished and failed.
5355 --------------------------------------------------------------------------*/
5356eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5357 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305358 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305359{
5360 eHalStatus status;
5361 VOS_STATUS vosStatus;
5362 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5363 vos_msg_t vosMessage;
5364 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305365 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305366
5367 status = sme_AcquireGlobalLock(&pMac->sme);
5368 if ( eHAL_STATUS_SUCCESS == status)
5369 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305370 pSession = CSR_GET_SESSION( pMac, sessionId );
5371
5372 if (!pSession)
5373 {
5374 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5375 sme_ReleaseGlobalLock( &pMac->sme );
5376 return eHAL_STATUS_FAILURE;
5377 }
5378
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305379 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5380 if (NULL == pMsg)
5381 {
5382 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5383 "%s: Not able to allocate memory for dhcp start", __func__);
5384 sme_ReleaseGlobalLock( &pMac->sme );
5385 return eHAL_STATUS_FAILURE;
5386 }
5387 pMsg->msgType = WDA_DHCP_START_IND;
5388 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5389 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305390 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5391 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305392 vosMessage.type = WDA_DHCP_START_IND;
5393 vosMessage.bodyptr = pMsg;
5394 vosMessage.reserved = 0;
5395
5396 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5397 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5398 {
5399 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5400 "%s: Post DHCP Start MSG fail", __func__);
5401 vos_mem_free(pMsg);
5402 status = eHAL_STATUS_FAILURE;
5403 }
5404 sme_ReleaseGlobalLock( &pMac->sme );
5405 }
5406 return (status);
5407}
5408/* ---------------------------------------------------------------------------
5409 \fn sme_DHCPStopInd
5410
5411 \brief API to signal the FW about the DHCP complete event.
5412
5413 \param hHal - HAL handle for device.
5414
5415 \param device_mode - mode(AP, SAP etc) of the device.
5416
5417 \param macAddr - MAC address of the device.
5418
5419 \return eHalStatus SUCCESS.
5420 FAILURE or RESOURCES The API finished and failed.
5421 --------------------------------------------------------------------------*/
5422eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5423 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305424 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305425{
5426 eHalStatus status;
5427 VOS_STATUS vosStatus;
5428 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5429 vos_msg_t vosMessage;
5430 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305431 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305432
5433 status = sme_AcquireGlobalLock(&pMac->sme);
5434 if ( eHAL_STATUS_SUCCESS == status)
5435 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305436 pSession = CSR_GET_SESSION( pMac, sessionId );
5437
5438 if (!pSession)
5439 {
5440 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5441 sme_ReleaseGlobalLock( &pMac->sme );
5442 return eHAL_STATUS_FAILURE;
5443 }
5444
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305445 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5446 if (NULL == pMsg)
5447 {
5448 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5449 "%s: Not able to allocate memory for dhcp stop", __func__);
5450 sme_ReleaseGlobalLock( &pMac->sme );
5451 return eHAL_STATUS_FAILURE;
5452 }
5453
5454 pMsg->msgType = WDA_DHCP_STOP_IND;
5455 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5456 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305457 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5458 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305459
5460 vosMessage.type = WDA_DHCP_STOP_IND;
5461 vosMessage.bodyptr = pMsg;
5462 vosMessage.reserved = 0;
5463
5464 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5465 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5466 {
5467 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5468 "%s: Post DHCP Stop MSG fail", __func__);
5469 vos_mem_free(pMsg);
5470 status = eHAL_STATUS_FAILURE;
5471 }
5472
5473 sme_ReleaseGlobalLock( &pMac->sme );
5474 }
5475 return (status);
5476}
5477
Jeff Johnson295189b2012-06-20 16:38:30 -07005478
5479/* ---------------------------------------------------------------------------
5480 \fn sme_BtcSignalBtEvent
5481 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5482 BT event type and the current operating mode of Libra (full power,
5483 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5484 would be employed.
5485 \param hHal - The handle returned by macOpen.
5486 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5487 Caller owns the memory and is responsible for freeing it.
5488 \return VOS_STATUS
5489 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5490 if BTC execution mode is set to BTC_WLAN_ONLY
5491 or BTC_PTA_ONLY.
5492 VOS_STATUS_SUCCESS BT Event passed to HAL
5493 ---------------------------------------------------------------------------*/
5494VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5495{
5496 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005497
Jeff Johnson295189b2012-06-20 16:38:30 -07005498#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5500
Katya Nigambcb705f2013-12-26 14:26:22 +05305501 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005502 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005503 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5504 {
5505 status = btcSignalBTEvent (hHal, pBtEvent);
5506 sme_ReleaseGlobalLock( &pMac->sme );
5507 }
5508#endif
5509 return (status);
5510}
5511
5512/* ---------------------------------------------------------------------------
5513 \fn sme_BtcSetConfig
5514 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5515 This function should be invoked only after CFG download has completed.
5516 Calling it after sme_HDDReadyInd is recommended.
5517 \param hHal - The handle returned by macOpen.
5518 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5519 Caller owns the memory and is responsible for freeing it.
5520 \return VOS_STATUS
5521 VOS_STATUS_E_FAILURE Config not passed to HAL.
5522 VOS_STATUS_SUCCESS Config passed to HAL
5523 ---------------------------------------------------------------------------*/
5524VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5525{
5526 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5527#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5528 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305529 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005530 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005531 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5532 {
5533 status = btcSetConfig (hHal, pSmeBtcConfig);
5534 sme_ReleaseGlobalLock( &pMac->sme );
5535 }
5536#endif
5537 return (status);
5538}
5539
5540/* ---------------------------------------------------------------------------
5541 \fn sme_BtcGetConfig
5542 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5543 \param hHal - The handle returned by macOpen.
5544 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5545 tSmeBtcConfig. Caller owns the memory and is responsible
5546 for freeing it.
5547 \return VOS_STATUS
5548 VOS_STATUS_E_FAILURE - failure
5549 VOS_STATUS_SUCCESS success
5550 ---------------------------------------------------------------------------*/
5551VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5552{
5553 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5554#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5555 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5556
Katya Nigambcb705f2013-12-26 14:26:22 +05305557 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005558 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005559 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5560 {
5561 status = btcGetConfig (hHal, pSmeBtcConfig);
5562 sme_ReleaseGlobalLock( &pMac->sme );
5563 }
5564#endif
5565 return (status);
5566}
5567/* ---------------------------------------------------------------------------
5568 \fn sme_SetCfgPrivacy
5569 \brief API to set configure privacy parameters
5570 \param hHal - The handle returned by macOpen.
5571 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005572 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005573
5574 \return void
5575 ---------------------------------------------------------------------------*/
5576void sme_SetCfgPrivacy( tHalHandle hHal,
5577 tCsrRoamProfile *pProfile,
5578 tANI_BOOLEAN fPrivacy
5579 )
5580{
5581 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305582 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005583 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005584 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5585 {
5586 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5587 sme_ReleaseGlobalLock( &pMac->sme );
5588 }
5589}
5590
5591#if defined WLAN_FEATURE_VOWIFI
5592/* ---------------------------------------------------------------------------
5593 \fn sme_NeighborReportRequest
5594 \brief API to request neighbor report.
5595 \param hHal - The handle returned by macOpen.
5596 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5597 tRrmNeighborReq. Caller owns the memory and is responsible
5598 for freeing it.
5599 \return VOS_STATUS
5600 VOS_STATUS_E_FAILURE - failure
5601 VOS_STATUS_SUCCESS success
5602 ---------------------------------------------------------------------------*/
5603VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5604 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5605{
5606 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5607 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305608 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005609 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005610
5611 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5612 {
5613 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5614 sme_ReleaseGlobalLock( &pMac->sme );
5615 }
5616
5617 return (status);
5618}
5619#endif
5620
5621//The following are debug APIs to support direct read/write register/memory
5622//They are placed in SME because HW cannot be access when in LOW_POWER state
5623//AND not connected. The knowledge and synchronization is done in SME
5624
5625//sme_DbgReadRegister
5626//Caller needs to validate the input values
5627VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5628{
5629 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5630 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005631 tPmcPowerState PowerState;
5632 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305633 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005634 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005635
5636 /* 1) To make Quarky work in FTM mode **************************************/
5637
5638 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5639 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005640 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005641 {
5642 return VOS_STATUS_SUCCESS;
5643 }
5644 return VOS_STATUS_E_FAILURE;
5645 }
5646
5647 /* 2) NON FTM mode driver *************************************************/
5648
5649 /* Acquire SME global lock */
5650 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5651 {
5652 return VOS_STATUS_E_FAILURE;
5653 }
5654
5655 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5656 {
5657 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5658 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5659 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005660 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 {
5662 status = VOS_STATUS_SUCCESS;
5663 }
5664 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005665 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005666 status = VOS_STATUS_E_FAILURE;
5667 }
5668 }
5669 else
5670 {
5671 status = VOS_STATUS_E_FAILURE;
5672 }
5673 }
5674
5675 /* This is a hack for Qualky/pttWniSocket
5676 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5677 if ( VOS_STATUS_SUCCESS != status )
5678 {
5679 *pRegValue = 0xDEADBEEF;
5680 status = VOS_STATUS_SUCCESS;
5681 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005682
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 /* Release SME global lock */
5684 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005685
Jeff Johnson295189b2012-06-20 16:38:30 -07005686 return (status);
5687}
5688
5689
5690//sme_DbgWriteRegister
5691//Caller needs to validate the input values
5692VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5693{
5694 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5695 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005696 tPmcPowerState PowerState;
5697 tANI_U32 sessionId = 0;
5698
5699 /* 1) To make Quarky work in FTM mode **************************************/
5700
Katya Nigambcb705f2013-12-26 14:26:22 +05305701 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005702 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005703 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5704 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005705 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005706 {
5707 return VOS_STATUS_SUCCESS;
5708 }
5709 return VOS_STATUS_E_FAILURE;
5710 }
5711
5712 /* 2) NON FTM mode driver *************************************************/
5713
5714 /* Acquire SME global lock */
5715 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5716 {
5717 return VOS_STATUS_E_FAILURE;
5718 }
5719
5720 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5721 {
5722 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5723 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5724 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005725 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005726 {
5727 status = VOS_STATUS_SUCCESS;
5728 }
5729 else
5730 {
5731 status = VOS_STATUS_E_FAILURE;
5732 }
5733 }
5734 else
5735 {
5736 status = VOS_STATUS_E_FAILURE;
5737 }
5738 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005739
Jeff Johnson295189b2012-06-20 16:38:30 -07005740 /* Release SME global lock */
5741 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005742
Jeff Johnson295189b2012-06-20 16:38:30 -07005743 return (status);
5744}
5745
5746
5747
5748//sme_DbgReadMemory
5749//Caller needs to validate the input values
5750//pBuf caller allocated buffer has the length of nLen
5751VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5752{
5753 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5754 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005755 tPmcPowerState PowerState;
5756 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005757 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5758 tANI_U32 arg1 = memAddr;
5759 tANI_U32 arg2 = nLen/4;
5760 tANI_U32 arg3 = 4;
5761 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005762 /* 1) To make Quarky work in FTM mode **************************************/
5763
Katya Nigambcb705f2013-12-26 14:26:22 +05305764 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005765 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005766 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5767 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005768 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005769 {
5770 return VOS_STATUS_SUCCESS;
5771 }
5772 return VOS_STATUS_E_FAILURE;
5773 }
5774
5775 /* 2) NON FTM mode driver *************************************************/
5776
5777 /* Acquire SME global lock */
5778 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5779 {
5780 return VOS_STATUS_E_FAILURE;
5781 }
5782
5783 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5784 {
5785 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5786 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5787 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005788 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005789 {
5790 status = VOS_STATUS_SUCCESS;
5791 }
5792 else
5793 {
5794 status = VOS_STATUS_E_FAILURE;
5795 }
5796 }
5797 else
5798 {
5799 status = VOS_STATUS_E_FAILURE;
5800 }
5801 }
5802
5803 /* This is a hack for Qualky/pttWniSocket
5804 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5805 if (VOS_STATUS_SUCCESS != status)
5806 {
5807 vos_mem_set(pBuf, nLen, 0xCD);
5808 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005809 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005810 }
5811
5812 /* Release SME lock */
5813 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005814
Jeff Johnson295189b2012-06-20 16:38:30 -07005815 return (status);
5816}
5817
5818
5819//sme_DbgWriteMemory
5820//Caller needs to validate the input values
5821VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5822{
5823 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5824 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005825 tPmcPowerState PowerState;
5826 tANI_U32 sessionId = 0;
5827
5828 /* 1) To make Quarky work in FTM mode **************************************/
5829
Katya Nigambcb705f2013-12-26 14:26:22 +05305830 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005831 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005832 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5833 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005834 {
5835 return VOS_STATUS_SUCCESS;
5836 }
5837 return VOS_STATUS_E_FAILURE;
5838 }
5839
5840 /* 2) NON FTM mode driver *************************************************/
5841
5842 /* Acquire SME global lock */
5843 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5844 {
5845 return VOS_STATUS_E_FAILURE;
5846 }
5847
5848 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5849 {
5850 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5851 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5852 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005853 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005854 {
5855 status = VOS_STATUS_SUCCESS;
5856 }
5857 else
5858 {
5859 status = VOS_STATUS_E_FAILURE;
5860 }
5861 }
5862 else
5863 {
5864 status = VOS_STATUS_E_FAILURE;
5865 }
5866 }
5867
5868 /* Release Global lock */
5869 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005870
Jeff Johnson295189b2012-06-20 16:38:30 -07005871 return (status);
5872}
5873
5874
Katya Nigam70d68332013-09-16 16:49:45 +05305875void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5876{
5877 VOS_TRACE_LEVEL vosDebugLevel;
5878 char logBuffer[LOG_SIZE];
5879 va_list marker;
5880
5881 /* getting proper Debug level */
5882 vosDebugLevel = getVosDebugLevel(loglevel);
5883
5884 /* extracting arguments from pstring */
5885 va_start( marker, pString );
5886 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5887
5888 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5889 va_end( marker );
5890}
5891
5892
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005893void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005894{
5895#ifdef WLAN_DEBUG
5896 // Verify against current log level
5897 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5898 return;
5899 else
5900 {
5901 va_list marker;
5902
5903 va_start( marker, pString ); /* Initialize variable arguments. */
5904
5905 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5906
5907 va_end( marker ); /* Reset variable arguments. */
5908 }
5909#endif
5910}
Jeff Johnson295189b2012-06-20 16:38:30 -07005911
Jeff Johnson295189b2012-06-20 16:38:30 -07005912/* ---------------------------------------------------------------------------
5913 \fn sme_GetWcnssWlanCompiledVersion
5914 \brief This API returns the version of the WCNSS WLAN API with
5915 which the HOST driver was built
5916 \param hHal - The handle returned by macOpen.
5917 \param pVersion - Points to the Version structure to be filled
5918 \return VOS_STATUS
5919 VOS_STATUS_E_INVAL - failure
5920 VOS_STATUS_SUCCESS success
5921 ---------------------------------------------------------------------------*/
5922VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5923 tSirVersionType *pVersion)
5924{
5925 VOS_STATUS status = VOS_STATUS_SUCCESS;
5926 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5927 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5928
5929 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5930 {
5931 if( pVersion != NULL )
5932 {
5933 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5934 }
5935 else
5936 {
5937 status = VOS_STATUS_E_INVAL;
5938 }
5939 sme_ReleaseGlobalLock( &pMac->sme );
5940 }
5941
5942 return (status);
5943}
5944
5945
5946/* ---------------------------------------------------------------------------
5947 \fn sme_GetWcnssWlanReportedVersion
5948 \brief This API returns the version of the WCNSS WLAN API with
5949 which the WCNSS driver reports it was built
5950 \param hHal - The handle returned by macOpen.
5951 \param pVersion - Points to the Version structure to be filled
5952 \return VOS_STATUS
5953 VOS_STATUS_E_INVAL - failure
5954 VOS_STATUS_SUCCESS success
5955 ---------------------------------------------------------------------------*/
5956VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5957 tSirVersionType *pVersion)
5958{
5959 VOS_STATUS status = VOS_STATUS_SUCCESS;
5960 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5961 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5962
5963 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5964 {
5965 if( pVersion != NULL )
5966 {
5967 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5968 }
5969 else
5970 {
5971 status = VOS_STATUS_E_INVAL;
5972 }
5973 sme_ReleaseGlobalLock( &pMac->sme );
5974 }
5975
5976 return (status);
5977}
5978
5979
5980/* ---------------------------------------------------------------------------
5981 \fn sme_GetWcnssSoftwareVersion
5982 \brief This API returns the version string of the WCNSS driver
5983 \param hHal - The handle returned by macOpen.
5984 \param pVersion - Points to the Version string buffer to be filled
5985 \param versionBufferSize - THe size of the Version string buffer
5986 \return VOS_STATUS
5987 VOS_STATUS_E_INVAL - failure
5988 VOS_STATUS_SUCCESS success
5989 ---------------------------------------------------------------------------*/
5990VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5991 tANI_U8 *pVersion,
5992 tANI_U32 versionBufferSize)
5993{
5994 VOS_STATUS status = VOS_STATUS_SUCCESS;
5995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5996 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5997
5998 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5999 {
6000 if( pVersion != NULL )
6001 {
6002 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6003 versionBufferSize);
6004 }
6005 else
6006 {
6007 status = VOS_STATUS_E_INVAL;
6008 }
6009 sme_ReleaseGlobalLock( &pMac->sme );
6010 }
6011
6012 return (status);
6013}
6014
6015
6016/* ---------------------------------------------------------------------------
6017 \fn sme_GetWcnssHardwareVersion
6018 \brief This API returns the version string of the WCNSS hardware
6019 \param hHal - The handle returned by macOpen.
6020 \param pVersion - Points to the Version string buffer to be filled
6021 \param versionBufferSize - THe size of the Version string buffer
6022 \return VOS_STATUS
6023 VOS_STATUS_E_INVAL - failure
6024 VOS_STATUS_SUCCESS success
6025 ---------------------------------------------------------------------------*/
6026VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6027 tANI_U8 *pVersion,
6028 tANI_U32 versionBufferSize)
6029{
6030 VOS_STATUS status = VOS_STATUS_SUCCESS;
6031 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6032 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6033
6034 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6035 {
6036 if( pVersion != NULL )
6037 {
6038 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6039 versionBufferSize);
6040 }
6041 else
6042 {
6043 status = VOS_STATUS_E_INVAL;
6044 }
6045 sme_ReleaseGlobalLock( &pMac->sme );
6046 }
6047
6048 return (status);
6049}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006050
Jeff Johnson295189b2012-06-20 16:38:30 -07006051
6052#ifdef FEATURE_WLAN_WAPI
6053/* ---------------------------------------------------------------------------
6054 \fn sme_RoamSetBKIDCache
6055 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6056 candidate list.
6057 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6058 it is opened (by calling halOpen).
6059 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6060 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6061 when retruning, this is the number of items put into pBKIDCache
6062 \return eHalStatus - when fail, it usually means the buffer allocated is not
6063 big enough and pNumItems has the number of tBkidCacheInfo.
6064 ---------------------------------------------------------------------------*/
6065eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6066 tANI_U32 numItems )
6067{
6068 eHalStatus status = eHAL_STATUS_FAILURE;
6069 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6070
6071 status = sme_AcquireGlobalLock( &pMac->sme );
6072 if ( HAL_STATUS_SUCCESS( status ) )
6073 {
6074 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6075 sme_ReleaseGlobalLock( &pMac->sme );
6076 }
6077
6078 return (status);
6079}
6080
6081/* ---------------------------------------------------------------------------
6082 \fn sme_RoamGetBKIDCache
6083 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6084 BKID cache.
6085 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6086 it is opened (by calling halOpen).
6087 \param pNum - caller allocated memory that has the space of the number of
6088 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6089 in SME cache.
6090 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6091 upon return
6092 \return eHalStatus - when fail, it usually means the buffer allocated is not
6093 big enough.
6094 ---------------------------------------------------------------------------*/
6095eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6096 tBkidCacheInfo *pBkidCache)
6097{
6098 eHalStatus status = eHAL_STATUS_FAILURE;
6099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6100
6101 status = sme_AcquireGlobalLock( &pMac->sme );
6102 if ( HAL_STATUS_SUCCESS( status ) )
6103 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006104 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006105 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6106 sme_ReleaseGlobalLock( &pMac->sme );
6107 }
6108
6109 return (status);
6110}
6111
6112/* ---------------------------------------------------------------------------
6113 \fn sme_RoamGetNumBKIDCache
6114 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6115 number of BKID cache entries.
6116 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6117 it is opened (by calling halOpen).
6118 \return tANI_U32 - the number of BKID cache entries.
6119 ---------------------------------------------------------------------------*/
6120tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6121{
6122 eHalStatus status = eHAL_STATUS_FAILURE;
6123 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6124 tANI_U32 numBkidCache = 0;
6125
6126 status = sme_AcquireGlobalLock( &pMac->sme );
6127 if ( HAL_STATUS_SUCCESS( status ) )
6128 {
6129 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6130 sme_ReleaseGlobalLock( &pMac->sme );
6131 }
6132
6133 return (numBkidCache);
6134}
6135
6136/* ---------------------------------------------------------------------------
6137 \fn sme_ScanGetBKIDCandidateList
6138 \brief a wrapper function to return the BKID candidate list
6139 \param pBkidList - caller allocated buffer point to an array of
6140 tBkidCandidateInfo
6141 \param pNumItems - pointer to a variable that has the number of
6142 tBkidCandidateInfo allocated when retruning, this is
6143 either the number needed or number of items put into
6144 pPmkidList
6145 \return eHalStatus - when fail, it usually means the buffer allocated is not
6146 big enough and pNumItems
6147 has the number of tBkidCandidateInfo.
6148 \Note: pNumItems is a number of tBkidCandidateInfo,
6149 not sizeof(tBkidCandidateInfo) * something
6150 ---------------------------------------------------------------------------*/
6151eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6152 tBkidCandidateInfo *pBkidList,
6153 tANI_U32 *pNumItems )
6154{
6155 eHalStatus status = eHAL_STATUS_FAILURE;
6156 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6157
6158 status = sme_AcquireGlobalLock( &pMac->sme );
6159 if ( HAL_STATUS_SUCCESS( status ) )
6160 {
6161 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6162 sme_ReleaseGlobalLock( &pMac->sme );
6163 }
6164
6165 return (status);
6166}
6167#endif /* FEATURE_WLAN_WAPI */
6168
Jeff Johnsone7245742012-09-05 17:12:55 -07006169#ifdef FEATURE_OEM_DATA_SUPPORT
6170
6171/*****************************************************************************
6172 OEM DATA related modifications and function additions
6173 *****************************************************************************/
6174
6175/* ---------------------------------------------------------------------------
6176 \fn sme_getOemDataRsp
6177 \brief a wrapper function to obtain the OEM DATA RSP
6178 \param pOemDataRsp - A pointer to the response object
6179 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006180 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006181 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006182eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006183 tOemDataRsp **pOemDataRsp)
6184{
6185 eHalStatus status = eHAL_STATUS_SUCCESS;
6186 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6187
6188 do
6189 {
6190 //acquire the lock for the sme object
6191 status = sme_AcquireGlobalLock(&pMac->sme);
6192
6193 if(!HAL_STATUS_SUCCESS(status))
6194 {
6195 break;
6196 }
6197
6198 if(pMac->oemData.pOemDataRsp != NULL)
6199 {
6200 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6201 }
6202 else
6203 {
6204 status = eHAL_STATUS_FAILURE;
6205 }
6206
6207 //release the lock for the sme object
6208 sme_ReleaseGlobalLock( &pMac->sme );
6209
6210 } while(0);
6211
6212 return status;
6213}
6214
6215/* ---------------------------------------------------------------------------
6216 \fn sme_OemDataReq
6217 \brief a wrapper function for OEM DATA REQ
6218 \param sessionId - session id to be used.
6219 \param pOemDataReqId - pointer to an object to get back the request ID
6220 \param callback - a callback function that is called upon finish
6221 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006222 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006223 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006224eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006225 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006226 tOemDataReqConfig *pOemDataReqConfig,
6227 tANI_U32 *pOemDataReqID,
6228 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006229 void *pContext)
6230{
6231 eHalStatus status = eHAL_STATUS_SUCCESS;
6232 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6233
6234 do
6235 {
6236 //acquire the lock for the sme object
6237 status = sme_AcquireGlobalLock(&pMac->sme);
6238 if(HAL_STATUS_SUCCESS(status))
6239 {
6240 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6241
6242 if(pOemDataReqID)
6243 {
6244 *pOemDataReqID = lOemDataReqId;
6245 }
6246 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006247 {
6248 sme_ReleaseGlobalLock( &pMac->sme );
6249 return eHAL_STATUS_FAILURE;
6250 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006251
6252 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6253
6254 //release the lock for the sme object
6255 sme_ReleaseGlobalLock( &pMac->sme );
6256 }
6257 } while(0);
6258
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006259 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006260
6261 return(status);
6262}
6263
6264#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006265
6266/*--------------------------------------------------------------------------
6267
6268 \brief sme_OpenSession() - Open a session for scan/roam operation.
6269
6270 This is a synchronous API.
6271
6272
6273 \param hHal - The handle returned by macOpen.
6274 \param callback - A pointer to the function caller specifies for roam/connect status indication
6275 \param pContext - The context passed with callback
6276 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6277 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6278
6279 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6280
6281 Other status means SME is failed to open the session.
6282 eHAL_STATUS_RESOURCES - no more session available.
6283 \sa
6284
6285 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006286eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6287 void *pContext, tANI_U8 *pSelfMacAddr,
6288 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006289{
6290 eHalStatus status;
6291 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6292
6293 if( NULL == pbSessionId )
6294 {
6295 status = eHAL_STATUS_INVALID_PARAMETER;
6296 }
6297 else
6298 {
6299 status = sme_AcquireGlobalLock( &pMac->sme );
6300 if ( HAL_STATUS_SUCCESS( status ) )
6301 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006302 status = csrRoamOpenSession(pMac, callback, pContext,
6303 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006304
6305 sme_ReleaseGlobalLock( &pMac->sme );
6306 }
6307 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006308 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306309 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006310 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006311
6312 return ( status );
6313}
6314
6315
6316/*--------------------------------------------------------------------------
6317
6318 \brief sme_CloseSession() - Open a session for scan/roam operation.
6319
6320 This is a synchronous API.
6321
6322
6323 \param hHal - The handle returned by macOpen.
6324
6325 \param sessionId - A previous opened session's ID.
6326
6327 \return eHAL_STATUS_SUCCESS - session is closed.
6328
6329 Other status means SME is failed to open the session.
6330 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6331 \sa
6332
6333 --------------------------------------------------------------------------*/
6334eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6335 csrRoamSessionCloseCallback callback, void *pContext)
6336{
6337 eHalStatus status;
6338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6339
Katya Nigambcb705f2013-12-26 14:26:22 +05306340 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006341 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006342 status = sme_AcquireGlobalLock( &pMac->sme );
6343 if ( HAL_STATUS_SUCCESS( status ) )
6344 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006345 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006346 callback, pContext );
6347
6348 sme_ReleaseGlobalLock( &pMac->sme );
6349 }
6350
6351 return ( status );
6352}
6353
Jeff Johnson295189b2012-06-20 16:38:30 -07006354/* ---------------------------------------------------------------------------
6355
6356 \fn sme_RoamUpdateAPWPSIE
6357
6358 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6359 This is an asynchronous API.
6360
6361 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6362
6363 \return eHalStatus – SUCCESS –
6364
6365 FAILURE or RESOURCES – The API finished and failed.
6366
6367 -------------------------------------------------------------------------------*/
6368eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6369{
6370
6371 eHalStatus status = eHAL_STATUS_FAILURE;
6372 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6373
6374 status = sme_AcquireGlobalLock( &pMac->sme );
6375 if ( HAL_STATUS_SUCCESS( status ) )
6376 {
6377
6378 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6379
6380 sme_ReleaseGlobalLock( &pMac->sme );
6381 }
6382
6383 return (status);
6384}
6385/* ---------------------------------------------------------------------------
6386
6387 \fn sme_RoamUpdateAPWPARSNIEs
6388
6389 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6390 This is an asynchronous API.
6391
6392 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6393
6394 \return eHalStatus – SUCCESS –
6395
6396 FAILURE or RESOURCES – The API finished and failed.
6397
6398 -------------------------------------------------------------------------------*/
6399eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6400{
6401
6402 eHalStatus status = eHAL_STATUS_FAILURE;
6403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6404
6405 status = sme_AcquireGlobalLock( &pMac->sme );
6406 if ( HAL_STATUS_SUCCESS( status ) )
6407 {
6408
6409 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6410
6411 sme_ReleaseGlobalLock( &pMac->sme );
6412 }
6413
6414 return (status);
6415}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006416/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006417
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006418 \fn sme_ChangeMCCBeaconInterval
6419
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006420 \brief To update P2P-GO beaconInterval. This function should be called after
6421 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006422 This is an asynchronous API.
6423
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006424 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006425
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006426 \return eHalStatus SUCCESS
6427 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006428 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006429
6430 -------------------------------------------------------------------------------*/
6431eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6432{
6433 eHalStatus status = eHAL_STATUS_FAILURE;
6434 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6435
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006436 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006437 status = sme_AcquireGlobalLock( &pMac->sme );
6438 if ( HAL_STATUS_SUCCESS( status ) )
6439 {
6440 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6441 sme_ReleaseGlobalLock( &pMac->sme );
6442 }
6443 return (status);
6444}
Jeff Johnson295189b2012-06-20 16:38:30 -07006445
6446/*-------------------------------------------------------------------------------*
6447
6448 \fn sme_sendBTAmpEvent
6449
6450 \brief to receive the coex priorty request from BT-AMP PAL
6451 and send the BT_AMP link state to HAL
6452
6453 \param btAmpEvent - btAmpEvent
6454
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006455 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006456
6457 FAILURE: API failed
6458
6459-------------------------------------------------------------------------------*/
6460
6461eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6462{
6463 vos_msg_t msg;
6464 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6465 eHalStatus status = eHAL_STATUS_FAILURE;
6466
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006467 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006468 if (NULL == ptrSmeBtAmpEvent)
6469 {
6470 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006471 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006472 return status;
6473 }
6474
6475 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6476 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6477 msg.reserved = 0;
6478 msg.bodyptr = ptrSmeBtAmpEvent;
6479
6480 //status = halFW_SendBTAmpEventMesg(pMac, event);
6481
6482 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6483 {
6484 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006485 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006486 vos_mem_free(ptrSmeBtAmpEvent);
6487 return status;
6488 }
6489
6490 return eHAL_STATUS_SUCCESS;
6491
6492}
6493
6494/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306495 \fn smeIssueFastRoamNeighborAPEvent
6496 \brief API to trigger fast BSS roam independent of RSSI triggers
6497 \param hHal - The handle returned by macOpen.
6498 \param bssid - Pointer to the BSSID to roam to.
6499 \param fastRoamTrig - Trigger to Scan or roam
6500 \return eHalStatus
6501 ---------------------------------------------------------------------------*/
6502eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6503 tANI_U8 *bssid,
6504 tSmeFastRoamTrigger fastRoamTrig)
6505{
6506 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6507 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6508 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6509 eHalStatus status = eHAL_STATUS_SUCCESS;
6510
6511 status = sme_AcquireGlobalLock( &pMac->sme );
6512 if ( HAL_STATUS_SUCCESS( status ) )
6513 {
6514 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6515 "%s: invoked", __func__);
6516
6517 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6518 {
6519 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6520 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6521 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6522 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006523 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6524 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306525
6526 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6527 if (VOS_STATUS_SUCCESS != vosStatus)
6528 {
6529 smsLog(pMac, LOGE,
6530 FL("CFG Channel list scan state failed with status %d "),
6531 vosStatus);
6532 }
6533 }
6534 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6535 {
6536 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6537 (void *)bssid, sizeof(tSirMacAddr));
6538 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006539 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6540 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306541
6542 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6543 0,
6544 pMac,
6545 0);
6546
6547 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6548 {
6549 smsLog(pMac,
6550 LOGE,
6551 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6552 vosStatus);
6553 }
6554 }
6555 sme_ReleaseGlobalLock( &pMac->sme );
6556 }
6557 return vosStatus;
6558}
6559/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006560 \fn sme_SetHostOffload
6561 \brief API to set the host offload feature.
6562 \param hHal - The handle returned by macOpen.
6563 \param pRequest - Pointer to the offload request.
6564 \return eHalStatus
6565 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006566eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006567 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006568{
6569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006570 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006571
Katya Nigambcb705f2013-12-26 14:26:22 +05306572 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006573 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006574 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6575 {
6576#ifdef WLAN_NS_OFFLOAD
6577 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6578 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006579 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006580 }
6581 else
6582#endif //WLAN_NS_OFFLOAD
6583 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006584 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006585 }
6586 sme_ReleaseGlobalLock( &pMac->sme );
6587 }
6588
6589 return (status);
6590}
6591
6592#ifdef WLAN_FEATURE_GTK_OFFLOAD
6593/* ---------------------------------------------------------------------------
6594 \fn sme_SetGTKOffload
6595 \brief API to set GTK offload information.
6596 \param hHal - The handle returned by macOpen.
6597 \param pRequest - Pointer to the GTK offload request.
6598 \return eHalStatus
6599 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006600eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006601 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006602{
6603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6604 eHalStatus status;
6605
Katya Nigambcb705f2013-12-26 14:26:22 +05306606 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006607 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006608 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6609 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006610 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006611 sme_ReleaseGlobalLock( &pMac->sme );
6612 }
6613
6614 return (status);
6615}
6616
6617/* ---------------------------------------------------------------------------
6618 \fn sme_GetGTKOffload
6619 \brief API to get GTK offload information.
6620 \param hHal - The handle returned by macOpen.
6621 \param pRequest - Pointer to the GTK offload response.
6622 \return eHalStatus
6623 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006624eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006625 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006626{
6627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6628 eHalStatus status;
6629
Katya Nigambcb705f2013-12-26 14:26:22 +05306630 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006631 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006632 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6633 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006634 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006635 sme_ReleaseGlobalLock( &pMac->sme );
6636 }
6637
6638 return (status);
6639}
6640#endif // WLAN_FEATURE_GTK_OFFLOAD
6641
6642/* ---------------------------------------------------------------------------
6643 \fn sme_SetKeepAlive
6644 \brief API to set the Keep Alive feature.
6645 \param hHal - The handle returned by macOpen.
6646 \param pRequest - Pointer to the Keep Alive request.
6647 \return eHalStatus
6648 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006649eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006650 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006651{
6652 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6653 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006654 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6655 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006656 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006657 sme_ReleaseGlobalLock( &pMac->sme );
6658 }
6659
6660 return (status);
6661}
6662
6663#ifdef FEATURE_WLAN_SCAN_PNO
6664/* ---------------------------------------------------------------------------
6665 \fn sme_SetPreferredNetworkList
6666 \brief API to set the Preferred Network List Offload feature.
6667 \param hHal - The handle returned by macOpen.
6668 \param pRequest - Pointer to the offload request.
6669 \return eHalStatus
6670 ---------------------------------------------------------------------------*/
6671eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6672{
6673 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6674 eHalStatus status;
6675
6676 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6677 {
6678 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6679 sme_ReleaseGlobalLock( &pMac->sme );
6680 }
6681
6682 return (status);
6683}
6684
6685eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6686{
6687 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6688 eHalStatus status;
6689
6690 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6691 {
6692 pmcSetRssiFilter(hHal, rssiThreshold);
6693 sme_ReleaseGlobalLock( &pMac->sme );
6694 }
6695
6696 return (status);
6697}
6698
6699#endif // FEATURE_WLAN_SCAN_PNO
6700
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006701eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006702{
6703 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6704 eHalStatus status;
6705
Katya Nigambcb705f2013-12-26 14:26:22 +05306706 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006707 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006708 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6709 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006710 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006711 sme_ReleaseGlobalLock( &pMac->sme );
6712 }
6713
6714 return (status);
6715}
6716
6717/* ---------------------------------------------------------------------------
6718 \fn sme_AbortMacScan
6719 \brief API to cancel MAC scan.
6720 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306721 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306722 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006723 \return VOS_STATUS
6724 VOS_STATUS_E_FAILURE - failure
6725 VOS_STATUS_SUCCESS success
6726 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306727eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6728 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006729{
6730 eHalStatus status;
6731 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6732
Katya Nigambcb705f2013-12-26 14:26:22 +05306733 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006734 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006735 status = sme_AcquireGlobalLock( &pMac->sme );
6736 if ( HAL_STATUS_SUCCESS( status ) )
6737 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306738 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006739
Jeff Johnson295189b2012-06-20 16:38:30 -07006740 sme_ReleaseGlobalLock( &pMac->sme );
6741 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006742
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 return ( status );
6744}
6745
6746/* ----------------------------------------------------------------------------
6747 \fn sme_GetOperationChannel
6748 \brief API to get current channel on which STA is parked
6749 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006750 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006751 \returns eHAL_STATUS_SUCCESS
6752 eHAL_STATUS_FAILURE
6753-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006754eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006755{
Jeff Johnson295189b2012-06-20 16:38:30 -07006756 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6757 tCsrRoamSession *pSession;
6758
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006759 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006760 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006761 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006762
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006763 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006764 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006765 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006766 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6767 {
6768 *pChannel =pSession->connectedProfile.operationChannel;
6769 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006770 }
6771 }
6772 return eHAL_STATUS_FAILURE;
6773}// sme_GetOperationChannel ends here
6774
Jeff Johnson295189b2012-06-20 16:38:30 -07006775/* ---------------------------------------------------------------------------
6776
6777 \fn sme_RegisterMgtFrame
6778
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006779 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006780 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006781 \param matchData - data which needs to be matched before passing frame
6782 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006783 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006784 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006785 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006786eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006787 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6788{
6789 eHalStatus status = eHAL_STATUS_SUCCESS;
6790 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6791
Katya Nigambcb705f2013-12-26 14:26:22 +05306792 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006793 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006794 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6795 {
6796 tSirRegisterMgmtFrame *pMsg;
6797 tANI_U16 len;
6798 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006799
6800 if(!pSession)
6801 {
6802 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006803 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006804 return eHAL_STATUS_FAILURE;
6805 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006806
Jeff Johnson295189b2012-06-20 16:38:30 -07006807 if( !pSession->sessionActive )
6808 {
6809 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006810 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006811 sme_ReleaseGlobalLock( &pMac->sme );
6812 return eHAL_STATUS_FAILURE;
6813 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006814
Jeff Johnson295189b2012-06-20 16:38:30 -07006815 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6816
Kiet Lam64c1b492013-07-12 13:56:44 +05306817 pMsg = vos_mem_malloc(len);
6818 if ( NULL == pMsg )
6819 status = eHAL_STATUS_FAILURE;
6820 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006821 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306822 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006823 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6824 pMsg->length = len;
6825 pMsg->sessionId = sessionId;
6826 pMsg->registerFrame = VOS_TRUE;
6827 pMsg->frameType = frameType;
6828 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306829 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006830 status = palSendMBMessage(pMac->hHdd, pMsg);
6831 }
6832 sme_ReleaseGlobalLock( &pMac->sme );
6833 }
6834 return status;
6835}
6836
6837/* ---------------------------------------------------------------------------
6838
6839 \fn sme_DeregisterMgtFrame
6840
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006841 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006842 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006843 \param matchData - data which needs to be matched before passing frame
6844 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006845 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006846 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006847 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006848eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006849 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6850{
6851 eHalStatus status = eHAL_STATUS_SUCCESS;
6852 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6853
Katya Nigambcb705f2013-12-26 14:26:22 +05306854 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006855 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006856 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6857 {
6858 tSirRegisterMgmtFrame *pMsg;
6859 tANI_U16 len;
6860 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006861
6862 if(!pSession)
6863 {
6864 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006865 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006866 return eHAL_STATUS_FAILURE;
6867 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006868
6869 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006870 {
6871 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006872 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006873 sme_ReleaseGlobalLock( &pMac->sme );
6874 return eHAL_STATUS_FAILURE;
6875 }
6876
6877 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6878
Kiet Lam64c1b492013-07-12 13:56:44 +05306879 pMsg = vos_mem_malloc(len);
6880 if ( NULL == pMsg )
6881 status = eHAL_STATUS_FAILURE;
6882 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006883 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306884 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006885 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006886 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006887 pMsg->registerFrame = VOS_FALSE;
6888 pMsg->frameType = frameType;
6889 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306890 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006891 status = palSendMBMessage(pMac->hHdd, pMsg);
6892 }
6893 sme_ReleaseGlobalLock( &pMac->sme );
6894 }
6895 return status;
6896}
6897
6898/* ---------------------------------------------------------------------------
6899 \fn sme_RemainOnChannel
6900 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6901 \param hHal - The handle returned by macOpen.
6902 \param pRequest - channel
6903 \param duration - duration in ms
6904 \param callback - HDD registered callback to process reaminOnChannelRsp
6905 \param context - HDD Callback param
6906 \return eHalStatus
6907 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006908eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6909 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306910 remainOnChanCallback callback,
6911 void *pContext,
6912 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006913{
6914 eHalStatus status = eHAL_STATUS_SUCCESS;
6915 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6916
Katya Nigambcb705f2013-12-26 14:26:22 +05306917 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006918 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006919 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6920 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306921 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6922 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006923#ifdef WLAN_FEATURE_P2P_INTERNAL
6924 , eP2PRemainOnChnReasonUnknown
6925#endif
6926 );
6927 sme_ReleaseGlobalLock( &pMac->sme );
6928 }
6929 return(status);
6930}
6931
6932/* ---------------------------------------------------------------------------
6933 \fn sme_ReportProbeReq
6934 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6935 \param hHal - The handle returned by macOpen.
6936 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6937 \return eHalStatus
6938 ---------------------------------------------------------------------------*/
6939
6940#ifndef WLAN_FEATURE_CONCURRENT_P2P
6941eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6942{
6943 eHalStatus status = eHAL_STATUS_SUCCESS;
6944 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6945
6946 do
6947 {
6948 //acquire the lock for the sme object
6949 status = sme_AcquireGlobalLock(&pMac->sme);
6950 if(HAL_STATUS_SUCCESS(status))
6951 {
6952 /* call set in context */
6953 pMac->p2pContext.probeReqForwarding = flag;
6954 //release the lock for the sme object
6955 sme_ReleaseGlobalLock( &pMac->sme );
6956 }
6957 } while(0);
6958
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006959 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006960
6961 return(status);
6962}
6963
6964/* ---------------------------------------------------------------------------
6965 \fn sme_updateP2pIe
6966 \brief API to set the P2p Ie in p2p context
6967 \param hHal - The handle returned by macOpen.
6968 \param p2pIe - Ptr to p2pIe from HDD.
6969 \param p2pIeLength: length of p2pIe
6970 \return eHalStatus
6971 ---------------------------------------------------------------------------*/
6972
6973eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6974{
6975 eHalStatus status = eHAL_STATUS_SUCCESS;
6976 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6977
6978 //acquire the lock for the sme object
6979 status = sme_AcquireGlobalLock(&pMac->sme);
6980 if(HAL_STATUS_SUCCESS(status))
6981 {
6982 if(NULL != pMac->p2pContext.probeRspIe){
6983 vos_mem_free(pMac->p2pContext.probeRspIe);
6984 pMac->p2pContext.probeRspIeLength = 0;
6985 }
6986
6987 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6988 if (NULL == pMac->p2pContext.probeRspIe)
6989 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006990 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006991 pMac->p2pContext.probeRspIeLength = 0;
6992 status = eHAL_STATUS_FAILURE;
6993 }
6994 else
6995 {
6996 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6997
6998 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6999 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007000 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007001 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7002 p2pIeLength);
7003 }
7004
7005 //release the lock for the sme object
7006 sme_ReleaseGlobalLock( &pMac->sme );
7007 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007008
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007009 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007010
7011 return(status);
7012}
7013#endif
7014
7015/* ---------------------------------------------------------------------------
7016 \fn sme_sendAction
7017 \brief API to send action frame from supplicant.
7018 \param hHal - The handle returned by macOpen.
7019 \return eHalStatus
7020 ---------------------------------------------------------------------------*/
7021
7022eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007023 const tANI_U8 *pBuf, tANI_U32 len,
7024 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007025{
7026 eHalStatus status = eHAL_STATUS_SUCCESS;
7027 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7028
Katya Nigambcb705f2013-12-26 14:26:22 +05307029 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007030 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007031 //acquire the lock for the sme object
7032 status = sme_AcquireGlobalLock(&pMac->sme);
7033 if(HAL_STATUS_SUCCESS(status))
7034 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007035 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007036 //release the lock for the sme object
7037 sme_ReleaseGlobalLock( &pMac->sme );
7038 }
7039
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007040 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007041
7042 return(status);
7043}
7044
7045eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7046{
7047 eHalStatus status = eHAL_STATUS_SUCCESS;
7048 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7049
Katya Nigambcb705f2013-12-26 14:26:22 +05307050 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007051 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007052 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7053 {
7054 status = p2pCancelRemainOnChannel (hHal, sessionId);
7055 sme_ReleaseGlobalLock( &pMac->sme );
7056 }
7057 return(status);
7058}
7059
7060//Power Save Related
7061eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7062{
7063 eHalStatus status = eHAL_STATUS_SUCCESS;
7064 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7065
7066 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7067 {
7068 status = p2pSetPs (hHal, data);
7069 sme_ReleaseGlobalLock( &pMac->sme );
7070 }
7071 return(status);
7072}
7073
Jeff Johnson295189b2012-06-20 16:38:30 -07007074
7075/* ---------------------------------------------------------------------------
7076
7077 \fn sme_ConfigureRxpFilter
7078
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007079 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007080 SME will pass this request to lower mac to set/reset the filter on RXP for
7081 multicast & broadcast traffic.
7082
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007083 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007084
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007085 hHal - The handle returned by macOpen.
7086
Jeff Johnson295189b2012-06-20 16:38:30 -07007087 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7088 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7089 on this param. In future we can use this as a mask to set various types of
7090 filters as suggested below:
7091 FILTER_ALL_MULTICAST:
7092 FILTER_ALL_BROADCAST:
7093 FILTER_ALL_MULTICAST_BROADCAST:
7094
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007095
7096 \return eHalStatus
7097
7098
Jeff Johnson295189b2012-06-20 16:38:30 -07007099--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007100eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007101 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7102{
7103 eHalStatus status = eHAL_STATUS_SUCCESS;
7104 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7105 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7106 vos_msg_t vosMessage;
7107
Katya Nigambcb705f2013-12-26 14:26:22 +05307108 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007109 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007110 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7111 {
7112 /* serialize the req through MC thread */
7113 vosMessage.bodyptr = wlanRxpFilterParam;
7114 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7115 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7116 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7117 {
7118 status = eHAL_STATUS_FAILURE;
7119 }
7120 sme_ReleaseGlobalLock( &pMac->sme );
7121 }
7122 return(status);
7123}
7124
Jeff Johnson295189b2012-06-20 16:38:30 -07007125/* ---------------------------------------------------------------------------
7126
7127 \fn sme_ConfigureSuspendInd
7128
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007129 \brief
7130 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007131 be suspended
7132
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007133 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007134
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007135 hHal - The handle returned by macOpen.
7136
Jeff Johnson295189b2012-06-20 16:38:30 -07007137 wlanSuspendParam- Depicts the wlan suspend params
7138
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007139
7140 \return eHalStatus
7141
7142
Jeff Johnson295189b2012-06-20 16:38:30 -07007143--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007144eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007145 tpSirWlanSuspendParam wlanSuspendParam)
7146{
7147 eHalStatus status = eHAL_STATUS_SUCCESS;
7148 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7149 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7150 vos_msg_t vosMessage;
7151
Katya Nigambcb705f2013-12-26 14:26:22 +05307152 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007153 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007154 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7155 {
7156 /* serialize the req through MC thread */
7157 vosMessage.bodyptr = wlanSuspendParam;
7158 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7159 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7160 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7161 {
7162 status = eHAL_STATUS_FAILURE;
7163 }
7164 sme_ReleaseGlobalLock( &pMac->sme );
7165 }
7166 return(status);
7167}
7168
7169/* ---------------------------------------------------------------------------
7170
7171 \fn sme_ConfigureResumeReq
7172
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007173 \brief
7174 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007175 be Resumed
7176
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007177 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007178
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007179 hHal - The handle returned by macOpen.
7180
Jeff Johnson295189b2012-06-20 16:38:30 -07007181 wlanResumeParam- Depicts the wlan resume params
7182
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007183
7184 \return eHalStatus
7185
7186
Jeff Johnson295189b2012-06-20 16:38:30 -07007187--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007188eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007189 tpSirWlanResumeParam wlanResumeParam)
7190{
7191 eHalStatus status = eHAL_STATUS_SUCCESS;
7192 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7193 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7194 vos_msg_t vosMessage;
7195
Katya Nigambcb705f2013-12-26 14:26:22 +05307196 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007197 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007198 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7199 {
7200 /* serialize the req through MC thread */
7201 vosMessage.bodyptr = wlanResumeParam;
7202 vosMessage.type = WDA_WLAN_RESUME_REQ;
7203 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7204 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7205 {
7206 status = eHAL_STATUS_FAILURE;
7207 }
7208 sme_ReleaseGlobalLock( &pMac->sme );
7209 }
7210 return(status);
7211}
7212
Jeff Johnson295189b2012-06-20 16:38:30 -07007213/* ---------------------------------------------------------------------------
7214
7215 \fn sme_GetInfraSessionId
7216
7217 \brief To get the session ID for infra session, if connected
7218 This is a synchronous API.
7219
7220 \param hHal - The handle returned by macOpen.
7221
7222 \return sessionid, -1 if infra session is not connected
7223
7224 -------------------------------------------------------------------------------*/
7225tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7226{
7227 eHalStatus status = eHAL_STATUS_FAILURE;
7228 tANI_S8 sessionid = -1;
7229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007230
Jeff Johnson295189b2012-06-20 16:38:30 -07007231 status = sme_AcquireGlobalLock( &pMac->sme );
7232 if ( HAL_STATUS_SUCCESS( status ) )
7233 {
7234
7235 sessionid = csrGetInfraSessionId( pMac);
7236
7237 sme_ReleaseGlobalLock( &pMac->sme );
7238 }
7239
7240 return (sessionid);
7241}
7242
7243/* ---------------------------------------------------------------------------
7244
7245 \fn sme_GetInfraOperationChannel
7246
7247 \brief To get the operating channel for infra session, if connected
7248 This is a synchronous API.
7249
7250 \param hHal - The handle returned by macOpen.
7251 \param sessionId - the sessionId returned by sme_OpenSession.
7252
7253 \return operating channel, 0 if infra session is not connected
7254
7255 -------------------------------------------------------------------------------*/
7256tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7257{
7258 eHalStatus status = eHAL_STATUS_FAILURE;
7259 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7260 tANI_U8 channel = 0;
7261 status = sme_AcquireGlobalLock( &pMac->sme );
7262 if ( HAL_STATUS_SUCCESS( status ) )
7263 {
7264
7265 channel = csrGetInfraOperationChannel( pMac, sessionId);
7266
7267 sme_ReleaseGlobalLock( &pMac->sme );
7268 }
7269
7270 return (channel);
7271}
7272
7273//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 -07007274//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007275tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7276{
7277 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007278 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007279 tANI_U8 channel = 0;
7280 status = sme_AcquireGlobalLock( &pMac->sme );
7281 if ( HAL_STATUS_SUCCESS( status ) )
7282 {
7283
7284 channel = csrGetConcurrentOperationChannel( pMac );
7285 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007286 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007287 sme_ReleaseGlobalLock( &pMac->sme );
7288 }
7289
7290 return (channel);
7291}
7292
7293#ifdef FEATURE_WLAN_SCAN_PNO
7294/******************************************************************************
7295*
7296* Name: sme_PreferredNetworkFoundInd
7297*
7298* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007299* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007300*
7301* Parameters:
7302* hHal - HAL handle for device
7303* pMsg - found network description
7304*
7305* Returns: eHalStatus
7306*
7307******************************************************************************/
7308eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7309{
7310 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7311 eHalStatus status = eHAL_STATUS_SUCCESS;
7312 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007313 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7314 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007315
7316 if (NULL == pMsg)
7317 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007318 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007319 status = eHAL_STATUS_FAILURE;
7320 }
7321 else
7322 {
7323 if (pPrefNetworkFoundInd->ssId.length > 0)
7324 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007325 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7326 pPrefNetworkFoundInd->ssId.length);
7327 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7328 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307329 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7330 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007331
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307332 /* Flush scan results, So as to avoid indication/updation of
7333 * stale entries, which may not have aged out during APPS collapse
7334 */
7335 sme_ScanFlushResult(hHal,0);
7336
Srikant Kuppa066904f2013-05-07 13:56:02 -07007337 //Save the frame to scan result
7338 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7339 {
7340 //we may have a frame
7341 status = csrScanSavePreferredNetworkFound(pMac,
7342 pPrefNetworkFoundInd);
7343 if (!HAL_STATUS_SUCCESS(status))
7344 {
7345 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7346 }
7347 }
7348 else
7349 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007350 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007351 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007352 }
7353
Srikant Kuppa066904f2013-05-07 13:56:02 -07007354 /* Call Preferred Netowrk Found Indication callback routine. */
7355 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7356 {
7357 pMac->pmc.prefNetwFoundCB(
7358 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7359 pPrefNetworkFoundInd);
7360 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007361 }
7362 else
7363 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007364 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007365 status = eHAL_STATUS_FAILURE;
7366 }
7367 }
7368
7369
7370 return(status);
7371}
7372
7373#endif // FEATURE_WLAN_SCAN_PNO
7374
7375
7376eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7377{
7378 eHalStatus status = eHAL_STATUS_FAILURE;
7379 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007380
Jeff Johnson295189b2012-06-20 16:38:30 -07007381 status = sme_AcquireGlobalLock( &pMac->sme );
7382 if ( HAL_STATUS_SUCCESS( status ) )
7383 {
7384 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7385 sme_ReleaseGlobalLock( &pMac->sme );
7386 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007387
Jeff Johnson295189b2012-06-20 16:38:30 -07007388 return (status);
7389}
7390
7391
7392/* ---------------------------------------------------------------------------
7393
7394 \fn sme_SetTxPerTracking
7395
7396 \brief Set Tx PER tracking configuration parameters
7397
7398 \param hHal - The handle returned by macOpen.
7399 \param pTxPerTrackingConf - Tx PER configuration parameters
7400
7401 \return eHalStatus
7402
7403 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007404eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7405 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007406 void *pCallbackContext,
7407 tpSirTxPerTrackingParam pTxPerTrackingParam)
7408{
7409 vos_msg_t msg;
7410 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7411 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7412
7413 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7414 {
7415 pMac->sme.pTxPerHitCallback = pCallbackfn;
7416 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7417 sme_ReleaseGlobalLock( &pMac->sme );
7418 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007419
Jeff Johnson295189b2012-06-20 16:38:30 -07007420 // free this memory in failure case or WDA request callback function
7421 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7422 if (NULL == pTxPerTrackingParamReq)
7423 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007424 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 -07007425 return eHAL_STATUS_FAILURE;
7426 }
7427
Kiet Lam64c1b492013-07-12 13:56:44 +05307428 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7429 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007430 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7431 msg.reserved = 0;
7432 msg.bodyptr = pTxPerTrackingParamReq;
7433
7434 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7435 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007436 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 -07007437 vos_mem_free(pTxPerTrackingParamReq);
7438 return eHAL_STATUS_FAILURE;
7439 }
7440
7441 return eHAL_STATUS_SUCCESS;
7442}
7443
7444/* ---------------------------------------------------------------------------
7445
7446 \fn sme_HandleChangeCountryCode
7447
7448 \brief Change Country code, Reg Domain and channel list
7449
7450 \details Country Code Priority
7451 0 = 11D > Configured Country > NV
7452 1 = Configured Country > 11D > NV
7453 If Supplicant country code is priority than 11d is disabled.
7454 If 11D is enabled, we update the country code after every scan.
7455 Hence when Supplicant country code is priority, we don't need 11D info.
7456 Country code from Supplicant is set as current courtry code.
7457 User can send reset command XX (instead of country code) to reset the
7458 country code to default values which is read from NV.
7459 In case of reset, 11D is enabled and default NV code is Set as current country code
7460 If 11D is priority,
7461 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7462
7463 \param pMac - The handle returned by macOpen.
7464 \param pMsgBuf - MSG Buffer
7465
7466 \return eHalStatus
7467
7468 -------------------------------------------------------------------------------*/
7469eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7470{
7471 eHalStatus status = eHAL_STATUS_SUCCESS;
7472 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007473 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007474 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7475 static uNvTables nvTables;
7476 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7477
7478
7479 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7480 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7481 {
7482 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7483
7484 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7485
7486 /* read the country code from NV and use it */
7487 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7488 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307489 vos_mem_copy(pMsg->countryCode,
7490 nvTables.defaultCountryTable.countryCode,
7491 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007492 }
7493 else
7494 {
7495 status = eHAL_STATUS_FAILURE;
7496 return status;
7497 }
7498 }
7499 else
7500 {
7501 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307502 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7503 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007504 {
7505 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7506 }
7507 }
7508
7509 /* WEXT set country code means
7510 * 11D should be supported?
7511 * 11D Channel should be enforced?
7512 * 11D Country code should be matched?
7513 * 11D Reg Domian should be matched?
7514 * Country string changed */
7515 if(pMac->roam.configParam.Is11dSupportEnabled &&
7516 pMac->roam.configParam.fEnforce11dChannels &&
7517 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7518 pMac->roam.configParam.fEnforceDefaultDomain &&
7519 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7520 {
7521 /* All 11D related options are already enabled
7522 * Country string is not changed
7523 * Do not need do anything for country code change request */
7524 return eHAL_STATUS_SUCCESS;
7525 }
7526
7527 /* Set Current Country code and Current Regulatory domain */
7528 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7529 if(eHAL_STATUS_SUCCESS != status)
7530 {
7531 /* Supplicant country code failed. So give 11D priority */
7532 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7533 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007534 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007535 }
7536
Jeff Johnson295189b2012-06-20 16:38:30 -07007537 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307538 vos_mem_copy(pMac->scan.countryCodeDefault,
7539 pMac->scan.countryCodeCurrent,
7540 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007541
7542 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307543 status = csrGetRegulatoryDomainForCountry(pMac,
7544 pMac->scan.countryCodeCurrent,
7545 (v_REGDOMAIN_t *) &domainIdIoctl,
7546 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007547 if ( status != eHAL_STATUS_SUCCESS )
7548 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007549 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007550 return status;
7551 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007552 else if (REGDOMAIN_WORLD == domainIdIoctl)
7553 {
7554 /* Supplicant country code is invalid, so we are on world mode now. So
7555 give 11D chance to update */
7556 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7557 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7558 }
7559
Jeff Johnson295189b2012-06-20 16:38:30 -07007560
Abhishek Singha306a442013-11-07 18:39:01 +05307561 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007562
7563 if ( status != eHAL_STATUS_SUCCESS )
7564 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007565 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007566 return status;
7567 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007568 else
7569 {
7570 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7571 //set again if we find AP with 11d info during scan
7572 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7573 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007574 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007575 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7576 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7577 }
7578 }
Kiet Lam6c583332013-10-14 05:37:09 +05307579#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007580 /* set to default domain ID */
7581 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7582
7583 /* get the channels based on new cc */
7584 status = csrInitGetChannels( pMac );
7585
7586 if ( status != eHAL_STATUS_SUCCESS )
7587 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007588 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007589 return status;
7590 }
7591
7592 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007593 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307594 /* Country code Changed, Purge Only scan result
7595 * which does not have channel number belong to 11d
7596 * channel list
7597 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307598 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307599
Kiet Lam6c583332013-10-14 05:37:09 +05307600#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007601 if( pMsg->changeCCCallback )
7602 {
7603 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7604 }
7605
7606 return eHAL_STATUS_SUCCESS;
7607}
7608
Amar Singhal0d15bd52013-10-12 23:13:13 -07007609/* ---------------------------------------------------------------------------
7610
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007611 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007612
7613 \brief Change Country code, Reg Domain and channel list
7614
7615 If Supplicant country code is priority than 11d is disabled.
7616 If 11D is enabled, we update the country code after every scan.
7617 Hence when Supplicant country code is priority, we don't need 11D info.
7618 Country code from Supplicant is set as current country code.
7619
7620 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007621 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007622
7623 \return eHalStatus
7624
7625 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007626eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7627 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007628{
7629 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007630 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307631 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007632
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007633 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007634 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7635
Kiet Lam6c583332013-10-14 05:37:09 +05307636 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7637 VOS_COUNTRY_CODE_LEN) == 0)
7638 {
7639 is11dCountry = VOS_TRUE;
7640 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007641
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307642 /* Set the country code given by userspace when 11dOriginal is FALSE
7643 * when 11doriginal is True,is11dCountry =0 and
7644 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7645 * and return failure
7646 */
7647 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007648 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307649 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
7650 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307651 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007652
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307653 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007654
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307655 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007656 pMac->scan.countryCode11d,
7657 (v_REGDOMAIN_t *) &reg_domain_id,
7658 COUNTRY_IE);
7659
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307660 return eHAL_STATUS_FAILURE;
7661 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007662 }
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307663 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007664 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307665 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007666 {
7667 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05307668 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007669 }
7670
Kiet Lamf2f201e2013-11-16 21:24:16 +05307671 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007672 WNI_CFG_COUNTRY_CODE_LEN);
7673
Abhishek Singha306a442013-11-07 18:39:01 +05307674 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007675
Kiet Lam6c583332013-10-14 05:37:09 +05307676 if (VOS_FALSE == is11dCountry )
7677 {
7678 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307679 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307680 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7681 /* set to default domain ID */
7682 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7683 }
7684
Amar Singhal0d15bd52013-10-12 23:13:13 -07007685 if ( status != eHAL_STATUS_SUCCESS )
7686 {
7687 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307688 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007689 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007690 else
7691 {
7692 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7693 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007694 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7695 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007696 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007697 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007698 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7699 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7700 }
7701 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007702
Amar Singhal0d15bd52013-10-12 23:13:13 -07007703 /* get the channels based on new cc */
7704 status = csrInitGetChannels(pMac);
7705
7706 if ( status != eHAL_STATUS_SUCCESS )
7707 {
7708 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7709 return status;
7710 }
7711
7712 /* reset info based on new cc, and we are done */
7713 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307714 if (VOS_TRUE == is11dCountry)
7715 {
Kiet Lam6c583332013-10-14 05:37:09 +05307716 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7717 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7718 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307719 /* Country code Changed, Purge Only scan result
7720 * which does not have channel number belong to 11d
7721 * channel list
7722 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307723 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307724 // Do active scans after the country is set by User hints or Country IE
7725 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05307726 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007727 smsLog(pMac, LOG1, FL(" returned"));
7728 return eHAL_STATUS_SUCCESS;
7729}
7730
7731/* ---------------------------------------------------------------------------
7732
Kiet Lamcffc5862013-10-30 16:28:45 +05307733 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007734
7735 \brief Update Country code in the driver if set by kernel as world
7736
7737 If 11D is enabled, we update the country code after every scan & notify kernel.
7738 This is to make sure kernel & driver are in sync in case of CC found in
7739 driver but not in kernel database
7740
7741 \param pMac - The handle returned by macOpen.
7742 \param pMsg - Carrying new CC set in kernel
7743
7744 \return eHalStatus
7745
7746 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307747eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007748{
Kiet Lamcffc5862013-10-30 16:28:45 +05307749 eHalStatus status;
7750
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007751 smsLog(pMac, LOG1, FL(" called"));
7752
7753 //this is to make sure kernel & driver are in sync in case of CC found in
7754 //driver but not in kernel database
7755 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7756 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007757 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307758 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007759 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307760 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007761 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007762 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307763
Abhishek Singha306a442013-11-07 18:39:01 +05307764 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307765
7766 if ( status != eHAL_STATUS_SUCCESS )
7767 {
7768 smsLog( pMac, LOGE, FL(" fail to set regId") );
7769 return status;
7770 }
7771 else
7772 {
7773 status = csrInitGetChannels(pMac);
7774 if ( status != eHAL_STATUS_SUCCESS )
7775 {
7776 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7777 }
7778 else
7779 {
7780 csrInitChannelList(pMac);
7781 }
7782 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307783 /* Country code Changed, Purge Only scan result
7784 * which does not have channel number belong to 11d
7785 * channel list
7786 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307787 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007788 smsLog(pMac, LOG1, FL(" returned"));
7789 return eHAL_STATUS_SUCCESS;
7790}
7791
7792/* ---------------------------------------------------------------------------
7793
Sushant Kaushik1d732562014-05-21 14:15:37 +05307794 \fn sme_DisconnectConnectedSessions
7795
7796 \brief Disconnect STA and P2P client session if channel is not supported
7797
7798 If new country code does not support the channel on which STA/P2P client
7799 is connetced, it sends the disconnect to the AP/P2P GO
7800
7801 \param pMac - The handle returned by macOpen
7802
7803 \return eHalStatus
7804
7805 -------------------------------------------------------------------------------*/
7806
7807void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
7808{
7809 v_U8_t i, sessionId, isChanFound = false;
7810 tANI_U8 currChannel;
7811
7812 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
7813 {
7814 if (csrIsSessionClientAndConnected(pMac, sessionId))
7815 {
7816 isChanFound = false;
7817 //Session is connected.Check the channel
7818 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
7819 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
7820 currChannel, sessionId);
7821 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
7822 {
7823 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
7824 {
7825 isChanFound = true;
7826 break;
7827 }
7828 }
7829
7830 if (!isChanFound)
7831 {
7832 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
7833 {
7834 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
7835 {
7836 isChanFound = true;
7837 break;
7838 }
7839 }
7840 }
7841 if (!isChanFound)
7842 {
7843 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
7844 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
7845 }
7846 }
7847 }
7848}
7849/* ---------------------------------------------------------------------------
7850
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007851 \fn sme_HandleGenericChangeCountryCode
7852
7853 \brief Change Country code, Reg Domain and channel list
7854
7855 If Supplicant country code is priority than 11d is disabled.
7856 If 11D is enabled, we update the country code after every scan.
7857 Hence when Supplicant country code is priority, we don't need 11D info.
7858 Country code from kernel is set as current country code.
7859
7860 \param pMac - The handle returned by macOpen.
7861 \param pMsgBuf - message buffer
7862
7863 \return eHalStatus
7864
7865 -------------------------------------------------------------------------------*/
7866eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7867{
7868 tAniGenericChangeCountryCodeReq *pMsg;
7869 v_REGDOMAIN_t reg_domain_id;
7870
7871 smsLog(pMac, LOG1, FL(" called"));
7872 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7873 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7874
7875 if (REGDOMAIN_COUNT == reg_domain_id)
7876 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307877 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007878 }
7879 else
7880 {
7881 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7882 }
7883 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007884 return eHAL_STATUS_SUCCESS;
7885}
7886
Jeff Johnson295189b2012-06-20 16:38:30 -07007887#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007888eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007889{
7890 tpSirRcvFltMcAddrList pRequestBuf;
7891 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007892 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007893 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007894
7895 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307896 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007897 pMulticastAddrs->ulMulticastAddrCnt,
7898 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007899
7900 /*
7901 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007902 */
7903 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7904 csrIsConnStateInfra(pMac, sessionId))
7905 {
7906 pSession = CSR_GET_SESSION( pMac, sessionId );
7907 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007908
7909 if(pSession == NULL )
7910 {
7911 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007912 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007913 return eHAL_STATUS_FAILURE;
7914 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007915
Jeff Johnson295189b2012-06-20 16:38:30 -07007916 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7917 if (NULL == pRequestBuf)
7918 {
7919 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007920 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007921 return eHAL_STATUS_FAILED_ALLOC;
7922 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007923
7924 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7925 {
7926 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7927 "indication as we are not connected", __func__);
7928 vos_mem_free(pRequestBuf);
7929 return eHAL_STATUS_FAILURE;
7930 }
7931
Jeff Johnson295189b2012-06-20 16:38:30 -07007932 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7933
Kiet Lam64c1b492013-07-12 13:56:44 +05307934 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7935 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007936 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7937 sizeof(tSirMacAddr));
7938
Jeff Johnson295189b2012-06-20 16:38:30 -07007939 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7940 msg.reserved = 0;
7941 msg.bodyptr = pRequestBuf;
7942 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7943 {
7944 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007945 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007946 vos_mem_free(pRequestBuf);
7947 return eHAL_STATUS_FAILURE;
7948 }
7949
7950 return eHAL_STATUS_SUCCESS;
7951}
7952
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007953eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007954 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007955{
7956 tpSirRcvPktFilterCfgType pRequestBuf;
7957 v_SINT_t allocSize;
7958 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007959 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7960 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007961 v_U8_t idx=0;
7962
7963 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007964 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007965 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007966
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007967 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007968
Jeff Johnson295189b2012-06-20 16:38:30 -07007969 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007970
7971 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007972 {
7973 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007974 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007975 return eHAL_STATUS_FAILED_ALLOC;
7976 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007977
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007978 if( NULL == pSession )
7979 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007980 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007981 vos_mem_free(pRequestBuf);
7982 return eHAL_STATUS_FAILURE;
7983 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007984
Kiet Lam64c1b492013-07-12 13:56:44 +05307985 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7986 sizeof(tSirMacAddr));
7987 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7988 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007989 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7990
Jeff Johnson295189b2012-06-20 16:38:30 -07007991 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7992 msg.reserved = 0;
7993 msg.bodyptr = pRequestBuf;
7994
7995 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007996 "FT %d FID %d ",
7997 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007998
7999 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008000 "params %d CT %d",
8001 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008002
8003 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8004 {
8005
8006 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008007 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008008 pRequestBuf->paramsData[idx].protocolLayer,
8009 pRequestBuf->paramsData[idx].cmpFlag);
8010
8011 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008012 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008013 pRequestBuf->paramsData[idx].dataOffset,
8014 pRequestBuf->paramsData[idx].dataLength);
8015
8016 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008017 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008018 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008019 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008020 pRequestBuf->paramsData[idx].compareData[2],
8021 pRequestBuf->paramsData[idx].compareData[3],
8022 pRequestBuf->paramsData[idx].compareData[4],
8023 pRequestBuf->paramsData[idx].compareData[5]);
8024
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008025 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008026 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008027 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008028 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008029 pRequestBuf->paramsData[idx].dataMask[2],
8030 pRequestBuf->paramsData[idx].dataMask[3],
8031 pRequestBuf->paramsData[idx].dataMask[4],
8032 pRequestBuf->paramsData[idx].dataMask[5]);
8033
8034 }
8035
8036 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8037 {
8038 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008039 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008040 vos_mem_free(pRequestBuf);
8041 return eHAL_STATUS_FAILURE;
8042 }
8043
8044 return eHAL_STATUS_SUCCESS;
8045}
8046
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008047eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008048 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008049 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008050 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008051{
8052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8053 eHalStatus status;
8054
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008055 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008056
8057 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8058 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008059 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008060 sme_ReleaseGlobalLock( &pMac->sme );
8061 }
8062
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008063 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008064
8065 return (status);
8066}
8067
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008068eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008069 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008070{
8071 tpSirRcvFltPktClearParam pRequestBuf;
8072 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008073 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8074 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008075
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008076 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008077 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008078
Jeff Johnson295189b2012-06-20 16:38:30 -07008079 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008080 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008081 {
8082 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8083 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008084 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008085 return eHAL_STATUS_FAILED_ALLOC;
8086 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008087 if( NULL == pSession )
8088 {
8089 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008090 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008091 vos_mem_free(pRequestBuf);
8092 return eHAL_STATUS_FAILURE;
8093 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008094
Kiet Lam64c1b492013-07-12 13:56:44 +05308095 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8096 sizeof(tSirMacAddr));
8097 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8098 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008099
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008100 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8101
Jeff Johnson295189b2012-06-20 16:38:30 -07008102 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8103 msg.reserved = 0;
8104 msg.bodyptr = pRequestBuf;
8105 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8106 {
8107 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008108 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008109 vos_mem_free(pRequestBuf);
8110 return eHAL_STATUS_FAILURE;
8111 }
8112
8113 return eHAL_STATUS_SUCCESS;
8114}
8115#endif // WLAN_FEATURE_PACKET_FILTERING
8116
8117/* ---------------------------------------------------------------------------
8118 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008119 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008120 channel switch.
8121 \param callbackContext
8122 \param status
8123 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008124void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008125 eHalStatus status)
8126{
8127 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8128 tSirMbMsg *pMsg;
8129 tANI_U16 msgLen;
8130
8131 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308132 pMsg = vos_mem_malloc(msgLen);
8133 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008134 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308135 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008136 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8137 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8138 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008139 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008140
8141 return;
8142}
8143
8144/* ---------------------------------------------------------------------------
8145 \fn sme_HandlePreChannelSwitchInd
8146 \brief Processes the indcation from PE for pre-channel switch.
8147 \param hHal
8148 \- The handle returned by macOpen. return eHalStatus
8149 ---------------------------------------------------------------------------*/
8150eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8151{
8152 eHalStatus status = eHAL_STATUS_FAILURE;
8153 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8154 status = sme_AcquireGlobalLock( &pMac->sme );
8155 if ( HAL_STATUS_SUCCESS( status ) )
8156 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008157 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8158 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008159 sme_ReleaseGlobalLock( &pMac->sme );
8160 }
8161
8162 return (status);
8163}
8164
8165/* ---------------------------------------------------------------------------
8166 \fn sme_HandlePostChannelSwitchInd
8167 \brief Processes the indcation from PE for post-channel switch.
8168 \param hHal
8169 \- The handle returned by macOpen. return eHalStatus
8170 ---------------------------------------------------------------------------*/
8171eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8172{
8173 eHalStatus status = eHAL_STATUS_FAILURE;
8174 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8175
8176 status = sme_AcquireGlobalLock( &pMac->sme );
8177 if ( HAL_STATUS_SUCCESS( status ) )
8178 {
8179 status = pmcRequestBmps(hHal, NULL, NULL);
8180 sme_ReleaseGlobalLock( &pMac->sme );
8181 }
8182
8183 return (status);
8184}
8185
8186/* ---------------------------------------------------------------------------
8187
8188 \fn sme_IsChannelValid
8189
8190 \brief To check if the channel is valid for currently established domain
8191 This is a synchronous API.
8192
8193 \param hHal - The handle returned by macOpen.
8194 \param channel - channel to verify
8195
8196 \return TRUE/FALSE, TRUE if channel is valid
8197
8198 -------------------------------------------------------------------------------*/
8199tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8200{
8201 eHalStatus status = eHAL_STATUS_FAILURE;
8202 tANI_BOOLEAN valid = FALSE;
8203 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008204
Jeff Johnson295189b2012-06-20 16:38:30 -07008205 status = sme_AcquireGlobalLock( &pMac->sme );
8206 if ( HAL_STATUS_SUCCESS( status ) )
8207 {
8208
8209 valid = csrRoamIsChannelValid( pMac, channel);
8210
8211 sme_ReleaseGlobalLock( &pMac->sme );
8212 }
8213
8214 return (valid);
8215}
8216
8217/* ---------------------------------------------------------------------------
8218 \fn sme_SetFreqBand
8219 \brief Used to set frequency band.
8220 \param hHal
8221 \eBand band value to be configured
8222 \- return eHalStatus
8223 -------------------------------------------------------------------------*/
8224eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8225{
8226 eHalStatus status = eHAL_STATUS_FAILURE;
8227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8228
8229 status = sme_AcquireGlobalLock( &pMac->sme );
8230 if ( HAL_STATUS_SUCCESS( status ) )
8231 {
8232 status = csrSetBand(hHal, eBand);
8233 sme_ReleaseGlobalLock( &pMac->sme );
8234 }
8235 return status;
8236}
8237
8238/* ---------------------------------------------------------------------------
8239 \fn sme_GetFreqBand
8240 \brief Used to get the current band settings.
8241 \param hHal
8242 \pBand pointer to hold band value
8243 \- return eHalStatus
8244 -------------------------------------------------------------------------*/
8245eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8246{
8247 eHalStatus status = eHAL_STATUS_FAILURE;
8248 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8249
8250 status = sme_AcquireGlobalLock( &pMac->sme );
8251 if ( HAL_STATUS_SUCCESS( status ) )
8252 {
8253 *pBand = csrGetCurrentBand( hHal );
8254 sme_ReleaseGlobalLock( &pMac->sme );
8255 }
8256 return status;
8257}
8258
8259#ifdef WLAN_WAKEUP_EVENTS
8260/******************************************************************************
8261 \fn sme_WakeReasonIndCallback
8262
8263 \brief
8264 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8265
8266 \param hHal - HAL handle for device
8267 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8268
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008269 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008270******************************************************************************/
8271eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8272{
8273 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8274 eHalStatus status = eHAL_STATUS_SUCCESS;
8275 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8276
8277 if (NULL == pMsg)
8278 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008279 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008280 status = eHAL_STATUS_FAILURE;
8281 }
8282 else
8283 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008284 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008285
8286 /* Call Wake Reason Indication callback routine. */
8287 if (pMac->pmc.wakeReasonIndCB != NULL)
8288 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008289
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008290 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008291 }
8292
8293 return(status);
8294}
8295#endif // WLAN_WAKEUP_EVENTS
8296
8297
8298/* ---------------------------------------------------------------------------
8299
8300 \fn sme_SetMaxTxPower
8301
8302 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8303 not persist over reboots.
8304
8305 \param hHal
8306 \param pBssid BSSID to set the power cap for
8307 \param pBssid pSelfMacAddress self MAC Address
8308 \param pBssid power to set in dB
8309 \- return eHalStatus
8310
8311 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008312eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008313 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8314{
8315 vos_msg_t msg;
8316 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308317 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008318 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008319 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8320 if (NULL == pMaxTxParams)
8321 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008322 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 -07008323 return eHAL_STATUS_FAILURE;
8324 }
8325
8326 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308327 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008328 SIR_MAC_ADDR_LENGTH);
8329 pMaxTxParams->power = dB;
8330
8331 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8332 msg.reserved = 0;
8333 msg.bodyptr = pMaxTxParams;
8334
8335 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8336 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008337 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 -07008338 vos_mem_free(pMaxTxParams);
8339 return eHAL_STATUS_FAILURE;
8340 }
8341
8342 return eHAL_STATUS_SUCCESS;
8343}
8344
Jeff Johnson295189b2012-06-20 16:38:30 -07008345/* ---------------------------------------------------------------------------
8346
Arif Hussaina5ebce02013-08-09 15:09:58 -07008347 \fn sme_SetMaxTxPowerPerBand
8348
8349 \brief Set the Maximum Transmit Power specific to band dynamically.
8350 Note: this setting will not persist over reboots.
8351
8352 \param band
8353 \param power to set in dB
8354 \- return eHalStatus
8355
8356 ----------------------------------------------------------------------------*/
8357eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8358{
8359 vos_msg_t msg;
8360 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8361
8362 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8363 if (NULL == pMaxTxPowerPerBandParams)
8364 {
8365 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8366 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8367 __func__);
8368 return eHAL_STATUS_FAILURE;
8369 }
8370
8371 pMaxTxPowerPerBandParams->power = dB;
8372 pMaxTxPowerPerBandParams->bandInfo = band;
8373
8374 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8375 msg.reserved = 0;
8376 msg.bodyptr = pMaxTxPowerPerBandParams;
8377
8378 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8379 {
8380 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8381 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8382 __func__);
8383 vos_mem_free(pMaxTxPowerPerBandParams);
8384 return eHAL_STATUS_FAILURE;
8385 }
8386
8387 return eHAL_STATUS_SUCCESS;
8388}
8389
8390/* ---------------------------------------------------------------------------
8391
schang86c22c42013-03-13 18:41:24 -07008392 \fn sme_SetTxPower
8393
8394 \brief Set Transmit Power dynamically. Note: this setting will
8395 not persist over reboots.
8396
8397 \param hHal
8398 \param sessionId Target Session ID
8399 \param mW power to set in mW
8400 \- return eHalStatus
8401
8402 -------------------------------------------------------------------------------*/
8403eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8404{
8405
8406 eHalStatus status = eHAL_STATUS_FAILURE;
8407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8408
Katya Nigambcb705f2013-12-26 14:26:22 +05308409 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008410 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008411 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8412 status = sme_AcquireGlobalLock(&pMac->sme);
8413 if (HAL_STATUS_SUCCESS(status))
8414 {
8415 status = csrSetTxPower(pMac, sessionId, mW);
8416 sme_ReleaseGlobalLock(&pMac->sme);
8417 }
8418 return status;
8419}
8420
8421/* ---------------------------------------------------------------------------
8422
Jeff Johnson295189b2012-06-20 16:38:30 -07008423 \fn sme_HideSSID
8424
8425 \brief hide/show SSID dynamically. Note: this setting will
8426 not persist over reboots.
8427
8428 \param hHal
8429 \param sessionId
8430 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8431 \- return eHalStatus
8432
8433 -------------------------------------------------------------------------------*/
8434eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8435{
8436 eHalStatus status = eHAL_STATUS_SUCCESS;
8437 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8438 tANI_U16 len;
8439
8440 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8441 {
8442 tpSirUpdateParams pMsg;
8443 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008444
8445 if(!pSession)
8446 {
8447 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008448 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008449 return eHAL_STATUS_FAILURE;
8450 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008451
8452 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008453 VOS_ASSERT(0);
8454
8455 /* Create the message and send to lim */
8456 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308457 pMsg = vos_mem_malloc(len);
8458 if ( NULL == pMsg )
8459 status = eHAL_STATUS_FAILURE;
8460 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008461 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308462 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008463 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8464 pMsg->length = len;
8465 /* Data starts from here */
8466 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008467 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008468 status = palSendMBMessage(pMac->hHdd, pMsg);
8469 }
8470 sme_ReleaseGlobalLock( &pMac->sme );
8471 }
8472 return status;
8473}
Jeff Johnson295189b2012-06-20 16:38:30 -07008474
8475/* ---------------------------------------------------------------------------
8476
8477 \fn sme_SetTmLevel
8478 \brief Set Thermal Mitigation Level to RIVA
8479 \param hHal - The handle returned by macOpen.
8480 \param newTMLevel - new Thermal Mitigation Level
8481 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008482 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008483 ---------------------------------------------------------------------------*/
8484eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8485{
8486 eHalStatus status = eHAL_STATUS_SUCCESS;
8487 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8488 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8489 vos_msg_t vosMessage;
8490 tAniSetTmLevelReq *setTmLevelReq = NULL;
8491
Katya Nigambcb705f2013-12-26 14:26:22 +05308492 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008493 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008494 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8495 {
8496 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308497 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008498 {
8499 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008500 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008501 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008502 return eHAL_STATUS_FAILURE;
8503 }
8504
8505 setTmLevelReq->tmMode = tmMode;
8506 setTmLevelReq->newTmLevel = newTMLevel;
8507
8508 /* serialize the req through MC thread */
8509 vosMessage.bodyptr = setTmLevelReq;
8510 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8511 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8512 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8513 {
8514 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008515 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008516 vos_mem_free(setTmLevelReq);
8517 status = eHAL_STATUS_FAILURE;
8518 }
8519 sme_ReleaseGlobalLock( &pMac->sme );
8520 }
8521 return(status);
8522}
8523
8524/*---------------------------------------------------------------------------
8525
8526 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8527 Host and FW.
8528
8529 \param hHal - HAL handle for device
8530
8531 \return NONE
8532
8533---------------------------------------------------------------------------*/
8534void sme_featureCapsExchange( tHalHandle hHal)
8535{
8536 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308537 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008538 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008539 WDA_featureCapsExchange(vosContext);
8540}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008541
Yathish9f22e662012-12-10 14:21:35 -08008542/*---------------------------------------------------------------------------
8543
8544 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8545 in Host.
8546
8547 \param hHal - HAL handle for device
8548
8549 \return NONE
8550
8551---------------------------------------------------------------------------*/
8552void sme_disableFeatureCapablity(tANI_U8 feature_index)
8553{
8554 WDA_disableCapablityFeature(feature_index);
8555}
8556
Jeff Johnsond13512a2012-07-17 11:42:19 -07008557/* ---------------------------------------------------------------------------
8558
8559 \fn sme_GetDefaultCountryCode
8560
8561 \brief Get the default country code from NV
8562
8563 \param hHal
8564 \param pCountry
8565 \- return eHalStatus
8566
8567 -------------------------------------------------------------------------------*/
8568eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8569{
8570 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308571 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008572 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008573 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8574}
8575
8576/* ---------------------------------------------------------------------------
8577
8578 \fn sme_GetCurrentCountryCode
8579
8580 \brief Get the current country code
8581
8582 \param hHal
8583 \param pCountry
8584 \- return eHalStatus
8585
8586 -------------------------------------------------------------------------------*/
8587eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8588{
8589 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308590 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008591 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008592 return csrGetCurrentCountryCode(pMac, pCountry);
8593}
8594
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008595/* ---------------------------------------------------------------------------
8596 \fn sme_transportDebug
8597 \brief Dynamically monitoring Transport channels
8598 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008599 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008600 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008601 \param toggleStallDetect Enable stall detect feature
8602 This feature will take effect to data performance
8603 Not integrate till fully verification
8604 \- return NONE
8605 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008606void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008607{
schang6295e542013-03-12 15:31:23 -07008608 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8609
8610 if (NULL == pMac)
8611 {
8612 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8613 "%s: invalid context", __func__);
8614 return;
8615 }
8616 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008617}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008618
Kiran4a17ebe2013-01-31 10:43:43 -08008619/* ---------------------------------------------------------------------------
8620 \fn sme_ResetPowerValuesFor5G
8621 \brief Reset the power values for 5G band with NV power values.
8622 \param hHal - HAL handle for device
8623 \- return NONE
8624 -------------------------------------------------------------------------*/
8625void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8626{
8627 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308628 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008629 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008630 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8631 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8632}
8633
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008634#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008635/* ---------------------------------------------------------------------------
8636 \fn sme_UpdateRoamPrefer5GHz
8637 \brief enable/disable Roam prefer 5G runtime option
8638 This function is called through dynamic setConfig callback function
8639 to configure the Roam prefer 5G runtime option
8640 \param hHal - HAL handle for device
8641 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8642 \- return Success or failure
8643 -------------------------------------------------------------------------*/
8644
8645eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8646{
8647 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008648 eHalStatus status = eHAL_STATUS_SUCCESS;
8649
Katya Nigambcb705f2013-12-26 14:26:22 +05308650 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008651 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008652 status = sme_AcquireGlobalLock( &pMac->sme );
8653 if ( HAL_STATUS_SUCCESS( status ) )
8654 {
8655 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8656 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8657 pMac->roam.configParam.nRoamPrefer5GHz,
8658 nRoamPrefer5GHz);
8659 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8660 sme_ReleaseGlobalLock( &pMac->sme );
8661 }
8662
8663 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008664}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008665
8666/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008667 \fn sme_setRoamIntraBand
8668 \brief enable/disable Intra band roaming
8669 This function is called through dynamic setConfig callback function
8670 to configure the intra band roaming
8671 \param hHal - HAL handle for device
8672 \param nRoamIntraBand Enable/Disable Intra band roaming
8673 \- return Success or failure
8674 -------------------------------------------------------------------------*/
8675eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8676{
8677 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8678 eHalStatus status = eHAL_STATUS_SUCCESS;
8679
Katya Nigambcb705f2013-12-26 14:26:22 +05308680 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008681 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008682 status = sme_AcquireGlobalLock( &pMac->sme );
8683 if ( HAL_STATUS_SUCCESS( status ) )
8684 {
8685 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8686 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8687 pMac->roam.configParam.nRoamIntraBand,
8688 nRoamIntraBand);
8689 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8690 sme_ReleaseGlobalLock( &pMac->sme );
8691 }
8692
8693 return status ;
8694}
8695
8696/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008697 \fn sme_UpdateRoamScanNProbes
8698 \brief function to update roam scan N probes
8699 This function is called through dynamic setConfig callback function
8700 to update roam scan N probes
8701 \param hHal - HAL handle for device
8702 \param nProbes number of probe requests to be sent out
8703 \- return Success or failure
8704 -------------------------------------------------------------------------*/
8705eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8706{
8707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8708 eHalStatus status = eHAL_STATUS_SUCCESS;
8709
8710 status = sme_AcquireGlobalLock( &pMac->sme );
8711 if ( HAL_STATUS_SUCCESS( status ) )
8712 {
8713 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8714 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8715 pMac->roam.configParam.nProbes,
8716 nProbes);
8717 pMac->roam.configParam.nProbes = nProbes;
8718 sme_ReleaseGlobalLock( &pMac->sme );
8719 }
8720#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8721 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8722 {
8723 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8724 REASON_NPROBES_CHANGED);
8725 }
8726#endif
8727 return status ;
8728}
8729
8730/* ---------------------------------------------------------------------------
8731 \fn sme_UpdateRoamScanHomeAwayTime
8732 \brief function to update roam scan Home away time
8733 This function is called through dynamic setConfig callback function
8734 to update roam scan home away time
8735 \param hHal - HAL handle for device
8736 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008737 \param bSendOffloadCmd If TRUE then send offload command to firmware
8738 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008739 \- return Success or failure
8740 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008741eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8742 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008743{
8744 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8745 eHalStatus status = eHAL_STATUS_SUCCESS;
8746
8747 status = sme_AcquireGlobalLock( &pMac->sme );
8748 if ( HAL_STATUS_SUCCESS( status ) )
8749 {
8750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8751 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8752 pMac->roam.configParam.nRoamScanHomeAwayTime,
8753 nRoamScanHomeAwayTime);
8754 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8755 sme_ReleaseGlobalLock( &pMac->sme );
8756 }
8757
8758#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008759 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008760 {
8761 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8762 REASON_HOME_AWAY_TIME_CHANGED);
8763 }
8764#endif
8765 return status;
8766}
8767
8768
8769/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008770 \fn sme_getRoamIntraBand
8771 \brief get Intra band roaming
8772 \param hHal - HAL handle for device
8773 \- return Success or failure
8774 -------------------------------------------------------------------------*/
8775v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8776{
8777 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308778 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008779 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008780 return pMac->roam.configParam.nRoamIntraBand;
8781}
8782
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008783/* ---------------------------------------------------------------------------
8784 \fn sme_getRoamScanNProbes
8785 \brief get N Probes
8786 \param hHal - HAL handle for device
8787 \- return Success or failure
8788 -------------------------------------------------------------------------*/
8789v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8790{
8791 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8792 return pMac->roam.configParam.nProbes;
8793}
8794
8795/* ---------------------------------------------------------------------------
8796 \fn sme_getRoamScanHomeAwayTime
8797 \brief get Roam scan home away time
8798 \param hHal - HAL handle for device
8799 \- return Success or failure
8800 -------------------------------------------------------------------------*/
8801v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8802{
8803 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8804 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8805}
8806
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008807
8808/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008809 \fn sme_UpdateImmediateRoamRssiDiff
8810 \brief Update nImmediateRoamRssiDiff
8811 This function is called through dynamic setConfig callback function
8812 to configure nImmediateRoamRssiDiff
8813 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8814 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008815 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008816 candidate and current AP.
8817 \- return Success or failure
8818 -------------------------------------------------------------------------*/
8819
8820eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8821{
8822 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008823 eHalStatus status = eHAL_STATUS_SUCCESS;
8824
Katya Nigambcb705f2013-12-26 14:26:22 +05308825 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008826 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008827 status = sme_AcquireGlobalLock( &pMac->sme );
8828 if ( HAL_STATUS_SUCCESS( status ) )
8829 {
8830 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308831 "LFR runtime successfully set immediate roam rssi diff to"
8832 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008833 nImmediateRoamRssiDiff,
8834 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308835 macTraceGetNeighbourRoamState(
8836 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008837 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8838 sme_ReleaseGlobalLock( &pMac->sme );
8839 }
8840
8841 return status ;
8842}
8843
8844/* ---------------------------------------------------------------------------
8845 \fn sme_UpdateRoamRssiDiff
8846 \brief Update RoamRssiDiff
8847 This function is called through dynamic setConfig callback function
8848 to configure RoamRssiDiff
8849 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8850 \param hHal - HAL handle for device
8851 \param RoamRssiDiff - minimum rssi difference between potential
8852 candidate and current AP.
8853 \- return Success or failure
8854 -------------------------------------------------------------------------*/
8855
8856eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8857{
8858 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8859 eHalStatus status = eHAL_STATUS_SUCCESS;
8860
8861 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308862 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008863 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008864 if ( HAL_STATUS_SUCCESS( status ) )
8865 {
8866 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308867 "LFR runtime successfully set roam rssi diff to %d"
8868 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008869 RoamRssiDiff,
8870 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308871 macTraceGetNeighbourRoamState(
8872 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008873 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8874 sme_ReleaseGlobalLock( &pMac->sme );
8875 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008876#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8877 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8878 {
8879 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8880 }
8881#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008882 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008883}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008884
8885/*--------------------------------------------------------------------------
8886 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008887 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008888 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008889 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008890 \param hHal - The handle returned by macOpen.
8891 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8892 Other status means SME is failed to update isFastTransitionEnabled.
8893 \sa
8894 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008895eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008896 v_BOOL_t isFastTransitionEnabled)
8897{
8898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008899 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008900
Katya Nigambcb705f2013-12-26 14:26:22 +05308901 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008902 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008903 status = sme_AcquireGlobalLock( &pMac->sme );
8904 if ( HAL_STATUS_SUCCESS( status ) )
8905 {
8906 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8907 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8908 pMac->roam.configParam.isFastTransitionEnabled,
8909 isFastTransitionEnabled);
8910 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8911 sme_ReleaseGlobalLock( &pMac->sme );
8912 }
8913
8914 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008915}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008916
8917/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008918 \fn sme_UpdateWESMode
8919 \brief Update WES Mode
8920 This function is called through dynamic setConfig callback function
8921 to configure isWESModeEnabled
8922 \param hHal - HAL handle for device
8923 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8924 Other status means SME is failed to update isWESModeEnabled.
8925 -------------------------------------------------------------------------*/
8926
8927eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8928{
8929 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8930 eHalStatus status = eHAL_STATUS_SUCCESS;
8931
8932 status = sme_AcquireGlobalLock( &pMac->sme );
8933 if ( HAL_STATUS_SUCCESS( status ) )
8934 {
8935 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308936 "LFR runtime successfully set WES Mode to %d"
8937 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008938 isWESModeEnabled,
8939 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308940 macTraceGetNeighbourRoamState(
8941 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008942 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8943 sme_ReleaseGlobalLock( &pMac->sme );
8944 }
8945
8946 return status ;
8947}
8948
8949/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008950 \fn sme_SetRoamScanControl
8951 \brief Set roam scan control
8952 This function is called to set roam scan control
8953 if roam scan control is set to 0, roaming scan cache is cleared
8954 any value other than 0 is treated as invalid value
8955 \param hHal - HAL handle for device
8956 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8957 Other status means SME failure to update
8958 -------------------------------------------------------------------------*/
8959eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8960{
8961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8962 eHalStatus status = eHAL_STATUS_SUCCESS;
8963
Katya Nigambcb705f2013-12-26 14:26:22 +05308964 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008965 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008966 status = sme_AcquireGlobalLock( &pMac->sme );
8967 if ( HAL_STATUS_SUCCESS( status ) )
8968 {
8969 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308970 "LFR runtime successfully set roam scan control to %d"
8971 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008972 roamScanControl,
8973 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308974 macTraceGetNeighbourRoamState(
8975 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008976 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8977 if ( 0 == roamScanControl)
8978 {
8979 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8980 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008981 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008982#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8983 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8984 {
8985 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8986 }
8987#endif
8988 }
8989 sme_ReleaseGlobalLock( &pMac->sme );
8990 }
8991 return status ;
8992}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008993#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008994
8995#ifdef FEATURE_WLAN_LFR
8996/*--------------------------------------------------------------------------
8997 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008998 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008999 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009000 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009001 \param hHal - The handle returned by macOpen.
9002 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9003 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9004 \sa
9005 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009006eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009007 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009008{
9009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9010
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009011 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9012 {
9013 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9014 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9015 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9016 isFastRoamIniFeatureEnabled);
9017 return eHAL_STATUS_SUCCESS;
9018 }
9019
Srinivas Girigowdade697412013-02-14 16:31:48 -08009020 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9021 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9022 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9023 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009024 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009025 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009026
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009027 return eHAL_STATUS_SUCCESS;
9028}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009029
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009030/*--------------------------------------------------------------------------
9031 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9032 Enable/disable LFR MAWC support at runtime
9033 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9034 isMAWCIniFeatureEnabled.
9035 This is a synchronous call
9036 \param hHal - The handle returned by macOpen.
9037 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9038 Other status means SME is failed to update MAWCEnabled.
9039 \sa
9040 --------------------------------------------------------------------------*/
9041eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9042 const v_BOOL_t MAWCEnabled)
9043{
9044 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9045 eHalStatus status = eHAL_STATUS_SUCCESS;
9046
9047 status = sme_AcquireGlobalLock( &pMac->sme );
9048 if ( HAL_STATUS_SUCCESS( status ) )
9049 {
9050 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9051 "%s: MAWCEnabled is changed from %d to %d", __func__,
9052 pMac->roam.configParam.MAWCEnabled,
9053 MAWCEnabled);
9054 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
9055 sme_ReleaseGlobalLock( &pMac->sme );
9056 }
9057
9058 return status ;
9059
9060}
9061
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009062#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9063/*--------------------------------------------------------------------------
9064 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
9065 This is a synchronuous call
9066 \param hHal - The handle returned by macOpen.
9067 \return eHAL_STATUS_SUCCESS
9068 Other status means SME is failed
9069 \sa
9070 --------------------------------------------------------------------------*/
9071
9072eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
9073 v_BOOL_t bFastRoamInConIniFeatureEnabled)
9074{
9075
9076 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9077 eHalStatus status = eHAL_STATUS_SUCCESS;
9078
9079 status = sme_AcquireGlobalLock( &pMac->sme );
9080 if ( HAL_STATUS_SUCCESS( status ) )
9081 {
9082 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9083 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9084 {
9085 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9086 }
9087 sme_ReleaseGlobalLock( &pMac->sme );
9088 }
9089
9090 return status;
9091}
9092#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009093#endif /* FEATURE_WLAN_LFR */
9094
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009095#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009096/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009097 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009098 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009099 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009100 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009101 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009102 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9103 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009104 \sa
9105 --------------------------------------------------------------------------*/
9106
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009107eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9108 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009109{
9110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9111
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009112 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009113 {
9114 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009115 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9116 pMac->roam.configParam.isEseIniFeatureEnabled,
9117 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009118 return eHAL_STATUS_SUCCESS;
9119 }
9120
Srinivas Girigowdade697412013-02-14 16:31:48 -08009121 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009122 "%s: EseEnabled is changed from %d to %d", __func__,
9123 pMac->roam.configParam.isEseIniFeatureEnabled,
9124 isEseIniFeatureEnabled);
9125 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9126 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009127
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009128 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009129 {
9130 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009131 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009132
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009133#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9134 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9135 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009136 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009137 }
9138#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009139 return eHAL_STATUS_SUCCESS;
9140}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009141#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009142
9143/*--------------------------------------------------------------------------
9144 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9145 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9146 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009147 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009148 \param hHal - The handle returned by macOpen.
9149 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9150 Other status means SME is failed to update fEnableFwRssiMonitoring.
9151 \sa
9152 --------------------------------------------------------------------------*/
9153
9154eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9155 v_BOOL_t fEnableFwRssiMonitoring)
9156{
9157 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9158
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009159 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9160 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9161 {
9162 halStatus = eHAL_STATUS_FAILURE;
9163 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009164 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009165 }
9166
9167 return (halStatus);
9168}
9169
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009170#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009171/*--------------------------------------------------------------------------
9172 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9173 This is a synchronous call
9174 \param hHal - The handle returned by macOpen.
9175 \return eHAL_STATUS_SUCCESS - SME update config successful.
9176 Other status means SME is failed to update
9177 \sa
9178 --------------------------------------------------------------------------*/
9179eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9180 v_U8_t neighborLookupRssiThreshold)
9181{
9182 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9183 eHalStatus status = eHAL_STATUS_SUCCESS;
9184
9185 status = sme_AcquireGlobalLock( &pMac->sme );
9186 if ( HAL_STATUS_SUCCESS( status ) )
9187 {
9188 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9189 if (HAL_STATUS_SUCCESS(status))
9190 {
9191 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309192 "LFR runtime successfully set Lookup threshold to %d"
9193 " - old value is %d - roam state is %s",
9194 neighborLookupRssiThreshold,
9195 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9196 macTraceGetNeighbourRoamState(
9197 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009198 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9199 neighborLookupRssiThreshold;
9200 }
9201 sme_ReleaseGlobalLock( &pMac->sme );
9202 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009203 return status;
9204}
9205
9206/*--------------------------------------------------------------------------
9207 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9208 This is a synchronous call
9209 \param hHal - The handle returned by macOpen.
9210 \return eHAL_STATUS_SUCCESS - SME update config successful.
9211 Other status means SME is failed to update
9212 \sa
9213 --------------------------------------------------------------------------*/
9214eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9215 v_U8_t neighborReassocRssiThreshold)
9216{
9217 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9218 eHalStatus status = eHAL_STATUS_SUCCESS;
9219
9220 status = sme_AcquireGlobalLock( &pMac->sme );
9221 if ( HAL_STATUS_SUCCESS( status ) )
9222 {
9223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309224 "LFR runtime successfully set Reassoc threshold to %d"
9225 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009226 neighborReassocRssiThreshold,
9227 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309228 macTraceGetNeighbourRoamState(
9229 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009230 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9231 neighborReassocRssiThreshold;
9232 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9233 neighborReassocRssiThreshold;
9234 sme_ReleaseGlobalLock( &pMac->sme );
9235 }
9236
9237 return status ;
9238}
9239
9240
9241/*--------------------------------------------------------------------------
9242 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9243 This is a synchronous call
9244 \param hHal - The handle returned by macOpen.
9245 \return eHAL_STATUS_SUCCESS - SME update config successful.
9246 Other status means SME is failed to update
9247 \sa
9248 --------------------------------------------------------------------------*/
9249v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9250{
9251 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9252 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9253}
9254
9255/*--------------------------------------------------------------------------
9256 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9257 This is a synchronous call
9258 \param hHal - The handle returned by macOpen.
9259 \return eHAL_STATUS_SUCCESS - SME update config successful.
9260 Other status means SME is failed to update
9261 \sa
9262 --------------------------------------------------------------------------*/
9263eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9264 v_U16_t neighborScanResultsRefreshPeriod)
9265{
9266 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9267 eHalStatus status = eHAL_STATUS_SUCCESS;
9268
9269 status = sme_AcquireGlobalLock( &pMac->sme );
9270 if ( HAL_STATUS_SUCCESS( status ) )
9271 {
9272 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309273 "LFR runtime successfully set roam scan refresh period to %d"
9274 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009275 neighborScanResultsRefreshPeriod,
9276 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309277 macTraceGetNeighbourRoamState(
9278 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009279 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9280 neighborScanResultsRefreshPeriod;
9281 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9282 neighborScanResultsRefreshPeriod;
9283
9284 sme_ReleaseGlobalLock( &pMac->sme );
9285 }
9286
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009287#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9288 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9289 {
9290 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9291 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9292 }
9293#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009294 return status ;
9295}
9296
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009297#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9298/*--------------------------------------------------------------------------
9299 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9300 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9301 gRoamScanOffloadEnabled.
9302 This is a synchronous call
9303 \param hHal - The handle returned by macOpen.
9304 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9305 Other status means SME is failed to update.
9306 \sa
9307 --------------------------------------------------------------------------*/
9308
9309eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9310 v_BOOL_t nRoamScanOffloadEnabled)
9311{
9312 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9313 eHalStatus status = eHAL_STATUS_SUCCESS;
9314
9315 status = sme_AcquireGlobalLock( &pMac->sme );
9316 if ( HAL_STATUS_SUCCESS( status ) )
9317 {
9318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9319 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9320 pMac->roam.configParam.isRoamOffloadScanEnabled,
9321 nRoamScanOffloadEnabled);
9322 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9323 sme_ReleaseGlobalLock( &pMac->sme );
9324 }
9325
9326 return status ;
9327}
9328#endif
9329
Srinivas Girigowdade697412013-02-14 16:31:48 -08009330/*--------------------------------------------------------------------------
9331 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9332 This is a synchronous call
9333 \param hHal - The handle returned by macOpen.
9334 \return v_U16_t - Neighbor scan results refresh period value
9335 \sa
9336 --------------------------------------------------------------------------*/
9337v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9338{
9339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9340 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9341}
9342
9343/*--------------------------------------------------------------------------
9344 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9345 This is a synchronuous call
9346 \param hHal - The handle returned by macOpen.
9347 \return eHAL_STATUS_SUCCESS - SME update config successful.
9348 Other status means SME is failed to update
9349 \sa
9350 --------------------------------------------------------------------------*/
9351v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9352{
9353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9354 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9355}
9356
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009357/* ---------------------------------------------------------------------------
9358 \fn sme_UpdateEmptyScanRefreshPeriod
9359 \brief Update nEmptyScanRefreshPeriod
9360 This function is called through dynamic setConfig callback function
9361 to configure nEmptyScanRefreshPeriod
9362 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9363 \param hHal - HAL handle for device
9364 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9365 \- return Success or failure
9366 -------------------------------------------------------------------------*/
9367
9368eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9369{
9370 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9371 eHalStatus status = eHAL_STATUS_SUCCESS;
9372
9373 status = sme_AcquireGlobalLock( &pMac->sme );
9374 if ( HAL_STATUS_SUCCESS( status ) )
9375 {
9376 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309377 "LFR runtime successfully set roam scan period to %d -"
9378 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009379 nEmptyScanRefreshPeriod,
9380 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309381 macTraceGetNeighbourRoamState(
9382 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009383 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9384 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9385 sme_ReleaseGlobalLock( &pMac->sme );
9386 }
9387
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009388#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9389 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9390 {
9391 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9392 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9393 }
9394#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009395 return status ;
9396}
9397
9398/* ---------------------------------------------------------------------------
9399 \fn sme_setNeighborScanMinChanTime
9400 \brief Update nNeighborScanMinChanTime
9401 This function is called through dynamic setConfig callback function
9402 to configure gNeighborScanChannelMinTime
9403 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9404 \param hHal - HAL handle for device
9405 \param nNeighborScanMinChanTime - Channel minimum dwell time
9406 \- return Success or failure
9407 -------------------------------------------------------------------------*/
9408eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9409{
9410 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9411 eHalStatus status = eHAL_STATUS_SUCCESS;
9412
9413 status = sme_AcquireGlobalLock( &pMac->sme );
9414 if ( HAL_STATUS_SUCCESS( status ) )
9415 {
9416 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309417 "LFR runtime successfully set channel min dwell time to %d"
9418 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009419 nNeighborScanMinChanTime,
9420 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309421 macTraceGetNeighbourRoamState(
9422 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009423 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9424 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9425 sme_ReleaseGlobalLock( &pMac->sme );
9426 }
9427
9428 return status ;
9429}
9430
9431/* ---------------------------------------------------------------------------
9432 \fn sme_setNeighborScanMaxChanTime
9433 \brief Update nNeighborScanMaxChanTime
9434 This function is called through dynamic setConfig callback function
9435 to configure gNeighborScanChannelMaxTime
9436 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9437 \param hHal - HAL handle for device
9438 \param nNeighborScanMinChanTime - Channel maximum dwell time
9439 \- return Success or failure
9440 -------------------------------------------------------------------------*/
9441eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9442{
9443 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9444 eHalStatus status = eHAL_STATUS_SUCCESS;
9445
9446 status = sme_AcquireGlobalLock( &pMac->sme );
9447 if ( HAL_STATUS_SUCCESS( status ) )
9448 {
9449 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309450 "LFR runtime successfully set channel max dwell time to %d"
9451 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009452 nNeighborScanMaxChanTime,
9453 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309454 macTraceGetNeighbourRoamState(
9455 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009456 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9457 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9458 sme_ReleaseGlobalLock( &pMac->sme );
9459 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009460#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9461 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9462 {
9463 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9464 REASON_SCAN_CH_TIME_CHANGED);
9465 }
9466#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009467
9468 return status ;
9469}
9470
9471/* ---------------------------------------------------------------------------
9472 \fn sme_getNeighborScanMinChanTime
9473 \brief get neighbor scan min channel time
9474 \param hHal - The handle returned by macOpen.
9475 \return v_U16_t - channel min time value
9476 -------------------------------------------------------------------------*/
9477v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9478{
9479 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9480 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9481}
9482
9483/* ---------------------------------------------------------------------------
9484 \fn sme_getNeighborScanMaxChanTime
9485 \brief get neighbor scan max channel time
9486 \param hHal - The handle returned by macOpen.
9487 \return v_U16_t - channel max time value
9488 -------------------------------------------------------------------------*/
9489v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9490{
9491 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9492 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9493}
9494
9495/* ---------------------------------------------------------------------------
9496 \fn sme_setNeighborScanPeriod
9497 \brief Update nNeighborScanPeriod
9498 This function is called through dynamic setConfig callback function
9499 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009500 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009501 \param hHal - HAL handle for device
9502 \param nNeighborScanPeriod - neighbor scan period
9503 \- return Success or failure
9504 -------------------------------------------------------------------------*/
9505eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9506{
9507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9508 eHalStatus status = eHAL_STATUS_SUCCESS;
9509
9510 status = sme_AcquireGlobalLock( &pMac->sme );
9511 if ( HAL_STATUS_SUCCESS( status ) )
9512 {
9513 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309514 "LFR runtime successfully set neighbor scan period to %d"
9515 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009516 nNeighborScanPeriod,
9517 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309518 macTraceGetNeighbourRoamState(
9519 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009520 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9521 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9522 sme_ReleaseGlobalLock( &pMac->sme );
9523 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009524#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9525 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9526 {
9527 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9528 REASON_SCAN_HOME_TIME_CHANGED);
9529 }
9530#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009531
9532 return status ;
9533}
9534
9535/* ---------------------------------------------------------------------------
9536 \fn sme_getNeighborScanPeriod
9537 \brief get neighbor scan period
9538 \param hHal - The handle returned by macOpen.
9539 \return v_U16_t - neighbor scan period
9540 -------------------------------------------------------------------------*/
9541v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9542{
9543 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9544 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9545}
9546
9547#endif
9548
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009549#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009550
Srinivas Girigowdade697412013-02-14 16:31:48 -08009551/*--------------------------------------------------------------------------
9552 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9553 This is a synchronous call
9554 \param hHal - The handle returned by macOpen.
9555 \return v_U16_t - Rssi diff value
9556 \sa
9557 --------------------------------------------------------------------------*/
9558v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9559{
9560 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9561 return pMac->roam.configParam.RoamRssiDiff;
9562}
9563
9564/*--------------------------------------------------------------------------
9565 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9566 This is a synchronous call
9567 \param hHal - The handle returned by macOpen.
9568 \return eHAL_STATUS_SUCCESS - SME update config successful.
9569 Other status means SME is failed to update
9570 \sa
9571 --------------------------------------------------------------------------*/
9572eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9573 tANI_U8 numChannels)
9574{
9575 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9576 eHalStatus status = eHAL_STATUS_SUCCESS;
9577 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009578 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309579 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009580 tANI_U8 i = 0, j = 0;
9581
9582 status = sme_AcquireGlobalLock( &pMac->sme );
9583 if ( HAL_STATUS_SUCCESS( status ) )
9584 {
9585 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9586 {
9587 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9588 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309589 if (j < sizeof(oldChannelList))
9590 {
9591 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9592 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9593 }
9594 else
9595 {
9596 break;
9597 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009598 }
9599 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009600 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009601 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009602 sme_SetRoamScanControl(hHal, 1);
9603 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009604 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009605 j = 0;
9606 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009607 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309608 if (j < sizeof(oldChannelList))
9609 {
9610 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9611 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9612 }
9613 else
9614 {
9615 break;
9616 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009617 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009618 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009619
9620 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309621 "LFR runtime successfully set roam scan channels to %s"
9622 "- old value is %s - roam state is %s",
9623 newChannelList, oldChannelList,
9624 macTraceGetNeighbourRoamState(
9625 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009626 sme_ReleaseGlobalLock( &pMac->sme );
9627 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009628#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9629 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9630 {
9631 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9632 }
9633#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009634
9635 return status ;
9636}
9637
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009638
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009639#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009640/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009641 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009642 This is a synchronuous call
9643 \param hHal - The handle returned by macOpen.
9644 \return eHAL_STATUS_SUCCESS - SME update config successful.
9645 Other status means SME is failed to update
9646 \sa
9647 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009648eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009649 tANI_U8 *pChannelList,
9650 tANI_U8 numChannels)
9651{
9652 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9653 eHalStatus status = eHAL_STATUS_SUCCESS;
9654 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9655 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9656 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9657 tANI_U8 newChannelList[128] = {0};
9658 tANI_U8 i = 0, j = 0;
9659
9660 status = sme_AcquireGlobalLock( &pMac->sme );
9661 if ( HAL_STATUS_SUCCESS( status ) )
9662 {
9663 if (NULL != currChannelListInfo->ChannelList)
9664 {
9665 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9666 {
9667 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9668 currChannelListInfo->ChannelList[i]);
9669 }
9670 }
9671 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9672
9673 if ( HAL_STATUS_SUCCESS( status ))
9674 {
9675 if (NULL != currChannelListInfo->ChannelList)
9676 {
9677 j = 0;
9678 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9679 {
9680 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9681 currChannelListInfo->ChannelList[i]);
9682 }
9683 }
9684
9685 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009686 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
9687 newChannelList, oldChannelList,
9688 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009689 }
9690 sme_ReleaseGlobalLock( &pMac->sme );
9691 }
9692#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9693 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9694 {
9695 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9696 }
9697#endif
9698
9699 return status ;
9700}
9701#endif
9702
Srinivas Girigowdade697412013-02-14 16:31:48 -08009703/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009704 \brief sme_getRoamScanChannelList() - get roam scan channel list
9705 This is a synchronous call
9706 \param hHal - The handle returned by macOpen.
9707 \return eHAL_STATUS_SUCCESS - SME update config successful.
9708 Other status means SME is failed to update
9709 \sa
9710 --------------------------------------------------------------------------*/
9711eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9712 tANI_U8 *pNumChannels)
9713{
9714 int i = 0;
9715 tANI_U8 *pOutPtr = pChannelList;
9716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9717 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9718 eHalStatus status = eHAL_STATUS_SUCCESS;
9719
9720 status = sme_AcquireGlobalLock( &pMac->sme );
9721 if ( HAL_STATUS_SUCCESS( status ) )
9722 {
9723 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9724 {
9725 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9726 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009727 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009728 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009729 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009730 }
9731
9732 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9733 for (i = 0; i < (*pNumChannels); i++)
9734 {
9735 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9736 }
9737 pOutPtr[i] = '\0';
9738 sme_ReleaseGlobalLock( &pMac->sme );
9739 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009740 return status ;
9741}
9742
9743/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009744 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009745 This is a synchronuous call
9746 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009747 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009748 FALSE (0) - if feature is disabled (compile or runtime)
9749 \sa
9750 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009751tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009752{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009753#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -08009754 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009755 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009756#else
9757 return eANI_BOOLEAN_FALSE;
9758#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009759}
9760
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009761/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009762 \brief sme_GetWESMode() - get WES Mode
9763 This is a synchronous call
9764 \param hHal - The handle returned by macOpen
9765 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9766 \sa
9767 --------------------------------------------------------------------------*/
9768v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9769{
9770 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9771 return pMac->roam.configParam.isWESModeEnabled;
9772}
9773
9774/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009775 \brief sme_GetRoamScanControl() - get scan control
9776 This is a synchronous call
9777 \param hHal - The handle returned by macOpen.
9778 \return v_BOOL_t - Enabled(1)/Disabled(0)
9779 \sa
9780 --------------------------------------------------------------------------*/
9781v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9782{
9783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9784 return pMac->roam.configParam.nRoamScanControl;
9785}
9786#endif
9787
9788/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009789 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9790 This is a synchronuous call
9791 \param hHal - The handle returned by macOpen.
9792 \return TRUE (1) - if the feature is enabled
9793 FALSE (0) - if feature is disabled (compile or runtime)
9794 \sa
9795 --------------------------------------------------------------------------*/
9796tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9797{
9798#ifdef FEATURE_WLAN_LFR
9799 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9800 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9801#else
9802 return eANI_BOOLEAN_FALSE;
9803#endif
9804}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009805
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009806/*--------------------------------------------------------------------------
9807 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9808 This is a synchronuous call
9809 \param hHal - The handle returned by macOpen.
9810 \return TRUE (1) - if the feature is enabled
9811 FALSE (0) - if feature is disabled (compile or runtime)
9812 \sa
9813 --------------------------------------------------------------------------*/
9814tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9815{
9816#ifdef WLAN_FEATURE_VOWIFI_11R
9817 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9818 return pMac->roam.configParam.isFastTransitionEnabled;
9819#else
9820 return eANI_BOOLEAN_FALSE;
9821#endif
9822}
9823
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009824/* ---------------------------------------------------------------------------
9825 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009826
Kiet Lam0f320422013-11-21 19:29:17 +05309827 \brief Check if a feature is enabled by FW
9828
9829 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009830
Kiet Lam0f320422013-11-21 19:29:17 +05309831 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009832 -------------------------------------------------------------------------*/
9833tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9834{
9835 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9836}
Kiet Lam0f320422013-11-21 19:29:17 +05309837
9838/* ---------------------------------------------------------------------------
9839 \fn sme_IsFeatureSupportedByDriver
9840 \brief Check if a feature is enabled by Driver
9841
9842 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9843 \- return 1/0 (TRUE/FALSE)
9844 -------------------------------------------------------------------------*/
9845
9846tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9847{
9848 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9849}
9850
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009851#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309852
9853/* ---------------------------------------------------------------------------
9854 \fn sme_SendTdlsMgmtFrame
9855 \brief API to send TDLS management frames.
9856
9857 \param peerMac - peer's Mac Adress.
9858 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9859 \- return VOS_STATUS_SUCCES
9860 -------------------------------------------------------------------------*/
9861VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9862 tANI_U8 sessionId,
9863 tSirMacAddr peerMac,
9864 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9865{
9866 eHalStatus status = eHAL_STATUS_SUCCESS;
9867 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9868
9869 status = sme_AcquireGlobalLock( &pMac->sme );
9870
9871 if ( HAL_STATUS_SUCCESS( status ) )
9872 {
9873 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9874 sme_ReleaseGlobalLock( &pMac->sme );
9875 }
9876 return status ;
9877}
9878
Atul Mittalc0f739f2014-07-31 13:47:47 +05309879// tdlsoffchan
9880
9881/* ---------------------------------------------------------------------------
9882 \fn sme_SendTdlsChanSwitchReq
9883 \brief API to send TDLS management frames.
9884
9885 \param peerMac - peer's Mac Adress.
9886 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9887 \- return VOS_STATUS_SUCCES
9888 -------------------------------------------------------------------------*/
9889VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
9890 tANI_U8 sessionId,
9891 tSirMacAddr peerMac,
9892 tANI_S32 tdlsOffCh,
9893 tANI_S32 tdlsOffChBwOffset,
9894 tANI_U8 tdlsSwMode)
9895{
9896 eHalStatus status = eHAL_STATUS_SUCCESS;
9897 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9898
9899 status = sme_AcquireGlobalLock( &pMac->sme );
9900
9901 if ( HAL_STATUS_SUCCESS( status ) )
9902 {
9903 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
9904 tdlsOffCh, tdlsOffChBwOffset,
9905 tdlsSwMode);
9906 }
9907 sme_ReleaseGlobalLock( &pMac->sme );
9908 return status ;
9909}
9910
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009911/* ---------------------------------------------------------------------------
9912 \fn sme_SendTdlsMgmtFrame
9913 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009914
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009915 \param peerMac - peer's Mac Adress.
9916 \param frame_type - Type of TDLS mgmt frame to be sent.
9917 \param dialog - dialog token used in the frame.
9918 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309919 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009920 \param buf - additional IEs to be included
9921 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009922 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009923 \- return VOS_STATUS_SUCCES
9924 -------------------------------------------------------------------------*/
9925VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309926 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 -08009927{
9928 eHalStatus status = eHAL_STATUS_SUCCESS;
9929 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9930 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9931
9932 status = sme_AcquireGlobalLock( &pMac->sme );
9933 if ( HAL_STATUS_SUCCESS( status ) )
9934 {
9935 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9936 sendTdlsReq.frameType = frame_type;
9937 sendTdlsReq.buf = buf;
9938 sendTdlsReq.len = len;
9939 sendTdlsReq.dialog = dialog;
9940 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009941 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309942 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009943
9944 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9945
9946 sme_ReleaseGlobalLock( &pMac->sme );
9947 }
9948
9949 return status ;
9950
9951}
9952/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009953 \fn sme_ChangeTdlsPeerSta
9954 \brief API to Update TDLS peer sta parameters.
9955
9956 \param peerMac - peer's Mac Adress.
9957 \param staParams - Peer Station Parameters
9958 \- return VOS_STATUS_SUCCES
9959 -------------------------------------------------------------------------*/
9960VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9961 tCsrStaParams *pstaParams)
9962{
9963 eHalStatus status = eHAL_STATUS_SUCCESS;
9964 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9965
Sushant Kaushikd62d9782014-02-19 15:39:40 +05309966 if (NULL == pstaParams)
9967 {
9968 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9969 "%s :pstaParams is NULL",__func__);
9970 return eHAL_STATUS_FAILURE;
9971 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009972 status = sme_AcquireGlobalLock( &pMac->sme );
9973 if ( HAL_STATUS_SUCCESS( status ) )
9974 {
9975 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9976
9977 sme_ReleaseGlobalLock( &pMac->sme );
9978 }
9979
9980 return status ;
9981
9982}
9983
9984/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009985 \fn sme_AddTdlsPeerSta
9986 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009987
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009988 \param peerMac - peer's Mac Adress.
9989 \- return VOS_STATUS_SUCCES
9990 -------------------------------------------------------------------------*/
9991VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9992{
9993 eHalStatus status = eHAL_STATUS_SUCCESS;
9994 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9995
9996 status = sme_AcquireGlobalLock( &pMac->sme );
9997 if ( HAL_STATUS_SUCCESS( status ) )
9998 {
9999 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10000
10001 sme_ReleaseGlobalLock( &pMac->sme );
10002 }
10003
10004 return status ;
10005
10006}
10007/* ---------------------------------------------------------------------------
10008 \fn sme_DeleteTdlsPeerSta
10009 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010010
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010011 \param peerMac - peer's Mac Adress.
10012 \- return VOS_STATUS_SUCCES
10013 -------------------------------------------------------------------------*/
10014VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10015{
10016 eHalStatus status = eHAL_STATUS_SUCCESS;
10017 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10018
10019 status = sme_AcquireGlobalLock( &pMac->sme );
10020 if ( HAL_STATUS_SUCCESS( status ) )
10021 {
10022 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
10023
10024 sme_ReleaseGlobalLock( &pMac->sme );
10025 }
10026
10027 return status ;
10028
10029}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070010030/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070010031 \fn sme_SetTdlsPowerSaveProhibited
10032 \API to set/reset the isTdlsPowerSaveProhibited.
10033
10034 \- return void
10035 -------------------------------------------------------------------------*/
10036void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
10037{
10038 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10039
10040 pMac->isTdlsPowerSaveProhibited = val;
10041 return;
10042}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010043#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053010044/* ---------------------------------------------------------------------------
10045 \fn sme_IsPmcBmps
10046 \API to Check if PMC state is BMPS.
10047
10048 \- return v_BOOL_t
10049 -------------------------------------------------------------------------*/
10050v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
10051{
10052 return (BMPS == pmcGetPmcState(hHal));
10053}
10054
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010055#ifdef FEATURE_WLAN_TDLS_INTERNAL
10056/*
10057 * SME API to start TDLS discovery Procedure
10058 */
10059VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10060{
10061 VOS_STATUS status = VOS_STATUS_SUCCESS;
10062 tCsrTdlsDisRequest disReq = {{0}} ;
10063 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10064 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
10065
10066 return status ;
10067
10068}
10069
10070/*
10071 * Process TDLS discovery results
10072 */
10073v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
10074 tSmeTdlsDisResult *disResult, v_U8_t listType)
10075{
10076 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
10077 tSirTdlsPeerInfo *peerInfo = NULL ;
10078 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10079 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
10080 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
10081 tListElem *pEntry = NULL ;
10082 v_U8_t peerCnt = 0 ;
10083
10084 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010085 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010086 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
10087 while(pEntry)
10088 {
10089 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
10090 tdlsPeerStaLink) ;
10091 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
10092
10093 switch(listType)
10094 {
10095 case TDLS_SETUP_LIST:
10096 {
10097 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
10098 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010099 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10100 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010101 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10102 peerCnt++ ;
10103 }
10104 break ;
10105 }
10106 case TDLS_DIS_LIST:
10107 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010108 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10109 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010110 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10111 peerCnt++ ;
10112 break ;
10113 }
10114 default:
10115 {
10116 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010117 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010118 break ;
10119 }
10120 }
10121
10122 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10123 }
10124
10125 return peerCnt ;
10126
10127}
10128
10129/*
10130 * SME API to start TDLS link setup Procedure.
10131 */
10132VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10133{
10134 VOS_STATUS status = VOS_STATUS_SUCCESS;
10135 tCsrTdlsSetupRequest setupReq = {{0}} ;
10136 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10137 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10138 return status ;
10139
10140}
10141
10142/*
10143 * SME API to start TDLS link Teardown Procedure.
10144 */
10145VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10146{
10147 VOS_STATUS status = VOS_STATUS_SUCCESS;
10148 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10149 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10150 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10151 return status ;
10152
10153}
10154
10155#endif /* FEATURE_WLAN_TDLS */
10156
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010157eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10158{
10159 eHalStatus status = eHAL_STATUS_FAILURE;
10160 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10161
10162 smsLog(pMac, LOG2, FL("enter"));
10163 status = sme_AcquireGlobalLock( &pMac->sme );
10164 if ( HAL_STATUS_SUCCESS( status ) )
10165 {
10166 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10167 sme_ReleaseGlobalLock( &pMac->sme );
10168 }
10169 smsLog(pMac, LOG2, FL("exit status %d"), status);
10170
10171 return (status);
10172}
10173
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010174/*
10175 * SME API to enable/disable WLAN driver initiated SSR
10176 */
10177void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10178{
10179 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10180 eHalStatus status = eHAL_STATUS_SUCCESS;
10181
10182 status = sme_AcquireGlobalLock(&pMac->sme);
10183 if (HAL_STATUS_SUCCESS(status))
10184 {
10185 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10186 "SSR level is changed %d", enableSSR);
10187 /* not serializing this messsage, as this is only going
10188 * to set a variable in WDA/WDI
10189 */
10190 WDA_SetEnableSSR(enableSSR);
10191 sme_ReleaseGlobalLock(&pMac->sme);
10192 }
10193 return;
10194}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010195
10196/*
10197 * SME API to determine the channel bonding mode
10198 */
10199VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10200{
10201 tSmeConfigParams smeConfig;
10202 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10203
10204 if (
10205#ifdef WLAN_FEATURE_11AC
10206 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10207 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10208#endif
10209 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010210 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10211
10212 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10213 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10214
10215 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010216 )
10217 {
10218 return VOS_STATUS_SUCCESS;
10219 }
10220
10221 /* If channel bonding mode is not required */
10222 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
10223 return VOS_STATUS_SUCCESS;
10224 }
10225
10226 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
10227 sme_GetConfigParam(pMac, &smeConfig);
10228
10229#ifdef WLAN_FEATURE_11AC
10230 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10231 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10232 {
10233 if ( channel== 36 || channel == 52 || channel == 100 ||
10234 channel == 116 || channel == 149 )
10235 {
10236 smeConfig.csrConfig.channelBondingMode5GHz =
10237 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
10238 }
10239 else if ( channel == 40 || channel == 56 || channel == 104 ||
10240 channel == 120 || channel == 153 )
10241 {
10242 smeConfig.csrConfig.channelBondingMode5GHz =
10243 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
10244 }
10245 else if ( channel == 44 || channel == 60 || channel == 108 ||
10246 channel == 124 || channel == 157 )
10247 {
10248 smeConfig.csrConfig.channelBondingMode5GHz =
10249 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
10250 }
10251 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010252 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010253 {
10254 smeConfig.csrConfig.channelBondingMode5GHz =
10255 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
10256 }
10257 else if ( channel == 165 )
10258 {
10259 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10260 }
10261 }
10262#endif
10263
10264 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10265 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10266 {
10267 if ( channel== 40 || channel == 48 || channel == 56 ||
10268 channel == 64 || channel == 104 || channel == 112 ||
10269 channel == 120 || channel == 128 || channel == 136 ||
10270 channel == 144 || channel == 153 || channel == 161 )
10271 {
10272 smeConfig.csrConfig.channelBondingMode5GHz = 1;
10273 }
10274 else if ( channel== 36 || channel == 44 || channel == 52 ||
10275 channel == 60 || channel == 100 || channel == 108 ||
10276 channel == 116 || channel == 124 || channel == 132 ||
10277 channel == 140 || channel == 149 || channel == 157 )
10278 {
10279 smeConfig.csrConfig.channelBondingMode5GHz = 2;
10280 }
10281 else if ( channel == 165 )
10282 {
10283 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10284 }
10285 }
krunal soni634aba32014-03-06 17:46:50 -080010286
10287 /*
10288 for 802.11a phy mode, channel bonding should be zero.
10289 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10290 through csrChangeDefaultConfigParam function. We will override this
10291 value here.
10292 */
10293 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10294 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10295 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10296 {
10297 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10298 }
10299
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010300 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Jeff Johnsonce8ad512013-10-30 12:34:42 -070010301 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010302
10303 sme_UpdateConfig (pMac, &smeConfig);
10304 return VOS_STATUS_SUCCESS;
10305}
10306
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010307/*--------------------------------------------------------------------------
10308
10309 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10310 \param hHal - The handle returned by macOpen.
10311 \param currDeviceMode - Current operating device mode.
10312 --------------------------------------------------------------------------*/
10313
10314void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10315{
10316 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10317 pMac->sme.currDeviceMode = currDeviceMode;
10318 return;
10319}
10320
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010321#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10322/*--------------------------------------------------------------------------
10323 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10324 from CSR.
10325 This is a synchronous call
10326 \param hHal - The handle returned by macOpen
10327 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10328 BSSID, channel etc.)
10329 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10330 Other status means SME is failed to send the request.
10331 \sa
10332 --------------------------------------------------------------------------*/
10333
10334eHalStatus sme_HandoffRequest(tHalHandle hHal,
10335 tCsrHandoffRequest *pHandoffInfo)
10336{
10337 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10338 eHalStatus status = eHAL_STATUS_SUCCESS;
10339
10340 status = sme_AcquireGlobalLock( &pMac->sme );
10341 if ( HAL_STATUS_SUCCESS( status ) )
10342 {
10343 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10344 "%s: invoked", __func__);
10345 status = csrHandoffRequest(pMac, pHandoffInfo);
10346 sme_ReleaseGlobalLock( &pMac->sme );
10347 }
10348
10349 return status ;
10350}
10351#endif
10352
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010353/*
10354 * SME API to check if there is any infra station or
10355 * P2P client is connected
10356 */
10357VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10358{
10359 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10360 if(csrIsInfraConnected(pMac))
10361 {
10362 return VOS_STATUS_SUCCESS;
10363 }
10364 return VOS_STATUS_E_FAILURE;
10365}
10366
Leo Chang9056f462013-08-01 19:21:11 -070010367
10368#ifdef FEATURE_WLAN_LPHB
10369/* ---------------------------------------------------------------------------
10370 \fn sme_LPHBConfigReq
10371 \API to make configuration LPHB within FW.
10372 \param hHal - The handle returned by macOpen
10373 \param lphdReq - LPHB request argument by client
10374 \param pCallbackfn - LPHB timeout notification callback function pointer
10375 \- return Configuration message posting status, SUCCESS or Fail
10376 -------------------------------------------------------------------------*/
10377eHalStatus sme_LPHBConfigReq
10378(
10379 tHalHandle hHal,
10380 tSirLPHBReq *lphdReq,
10381 void (*pCallbackfn)(void *pAdapter, void *indParam)
10382)
10383{
10384 eHalStatus status = eHAL_STATUS_SUCCESS;
10385 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10386 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10387 vos_msg_t vosMessage;
10388
10389 status = sme_AcquireGlobalLock(&pMac->sme);
10390 if (eHAL_STATUS_SUCCESS == status)
10391 {
10392 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10393 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010394 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010395 {
10396 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10397 "%s: Indication Call back did not registered", __func__);
10398 sme_ReleaseGlobalLock(&pMac->sme);
10399 return eHAL_STATUS_FAILURE;
10400 }
10401 else if (NULL != pCallbackfn)
10402 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010403 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010404 }
10405
10406 /* serialize the req through MC thread */
10407 vosMessage.bodyptr = lphdReq;
10408 vosMessage.type = WDA_LPHB_CONF_REQ;
10409 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10410 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10411 {
10412 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10413 "%s: Post Config LPHB MSG fail", __func__);
10414 status = eHAL_STATUS_FAILURE;
10415 }
10416 sme_ReleaseGlobalLock(&pMac->sme);
10417 }
10418
10419 return(status);
10420}
10421#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010422/*--------------------------------------------------------------------------
10423 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10424 scan parameter.
10425 This is a synchronous call
10426 \param hHal - The handle returned by macOpen
10427 \return NONE.
10428 \sa
10429 --------------------------------------------------------------------------*/
10430void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10431 tANI_U8 nNumP2PChan)
10432{
10433 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10434
10435 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10436 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10437
10438 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10439 "%s: SCAN nNumStaChanCombinedConc : %d,"
10440 "nNumP2PChanCombinedConc : %d ",
10441 __func__, nNumStaChan, nNumP2PChan);
10442
10443 return;
10444
10445}
Leo Chang9056f462013-08-01 19:21:11 -070010446
Yue Mab9c86f42013-08-14 15:59:08 -070010447/* ---------------------------------------------------------------------------
10448 \fn sme_AddPeriodicTxPtrn
10449 \brief API to Periodic TX Pattern Offload feature
10450 \param hHal - The handle returned by macOpen
10451 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10452 \return eHalStatus
10453 ---------------------------------------------------------------------------*/
10454eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10455 *addPeriodicTxPtrnParams)
10456{
10457 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10458 eHalStatus status;
10459 vos_msg_t msg;
10460
10461 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10462 {
10463 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10464 msg.bodyptr = addPeriodicTxPtrnParams;
10465
10466 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10467 {
10468 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10469 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10470 __func__);
10471
10472 sme_ReleaseGlobalLock(&pMac->sme);
10473 return eHAL_STATUS_FAILURE;
10474 }
10475
10476 sme_ReleaseGlobalLock(&pMac->sme);
10477 return eHAL_STATUS_SUCCESS;
10478 }
10479
10480 return status;
10481}
10482
10483/* ---------------------------------------------------------------------------
10484 \fn sme_DelPeriodicTxPtrn
10485 \brief API to Periodic TX Pattern Offload feature
10486 \param hHal - The handle returned by macOpen
10487 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10488 \return eHalStatus
10489 ---------------------------------------------------------------------------*/
10490eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10491 *delPeriodicTxPtrnParams)
10492{
10493 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10494 eHalStatus status;
10495 vos_msg_t msg;
10496
10497 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10498 {
10499 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10500 msg.bodyptr = delPeriodicTxPtrnParams;
10501
10502 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10503 {
10504 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10505 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10506 __func__);
10507
10508 sme_ReleaseGlobalLock(&pMac->sme);
10509 return eHAL_STATUS_FAILURE;
10510 }
10511
10512 sme_ReleaseGlobalLock(&pMac->sme);
10513 return eHAL_STATUS_SUCCESS;
10514 }
10515
10516 return status;
10517}
10518
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010519void smeGetCommandQStatus( tHalHandle hHal )
10520{
10521 tSmeCmd *pTempCmd = NULL;
10522 tListElem *pEntry;
10523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10524
10525 if (NULL == pMac)
10526 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010527 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10528 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010529 return;
10530 }
10531
10532 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10533 if( pEntry )
10534 {
10535 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10536 }
10537 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10538 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10539 if(pTempCmd)
10540 {
10541 if( eSmeCsrCommandMask & pTempCmd->command )
10542 {
10543 //CSR command is stuck. See what the reason code is for that command
10544 dumpCsrCommandInfo(pMac, pTempCmd);
10545 }
10546 } //if(pTempCmd)
10547
10548 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10549 csrLLCount(&pMac->sme.smeCmdPendingList));
10550
10551 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10552 csrLLCount(&pMac->roam.roamCmdPendingList));
10553
10554 return;
10555}
Rajeev79dbe4c2013-10-05 11:03:42 +053010556
10557#ifdef FEATURE_WLAN_BATCH_SCAN
10558/* ---------------------------------------------------------------------------
10559 \fn sme_SetBatchScanReq
10560 \brief API to set batch scan request in FW
10561 \param hHal - The handle returned by macOpen.
10562 \param pRequest - Pointer to the batch request.
10563 \param sessionId - session ID
10564 \param callbackRoutine - HDD callback which needs to be invoked after
10565 getting set batch scan response from FW
10566 \param callbackContext - pAdapter context
10567 \return eHalStatus
10568 ---------------------------------------------------------------------------*/
10569eHalStatus sme_SetBatchScanReq
10570(
10571 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10572 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10573 void *callbackContext
10574)
10575{
10576 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10577 eHalStatus status;
10578
Yue Mae36e3552014-03-05 17:06:20 -080010579 if (!pMac)
10580 {
10581 return eHAL_STATUS_FAILURE;
10582 }
10583
Rajeev79dbe4c2013-10-05 11:03:42 +053010584 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10585 {
10586 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10587 callbackContext);
10588 sme_ReleaseGlobalLock( &pMac->sme );
10589 }
10590
10591 return status;
10592}
10593
10594/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010595 \fn sme_SendRateUpdateInd
10596 \brief API to Update rate
10597 \param hHal - The handle returned by macOpen
10598 \param rateUpdateParams - Pointer to rate update params
10599 \return eHalStatus
10600 ---------------------------------------------------------------------------*/
10601eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10602{
10603 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10604 eHalStatus status;
10605 vos_msg_t msg;
10606
10607 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10608 {
10609 msg.type = WDA_RATE_UPDATE_IND;
10610 msg.bodyptr = rateUpdateParams;
10611
10612 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10613 {
10614 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10615 "to post WDA_SET_RMC_RATE_IND to WDA!",
10616 __func__);
10617
10618 sme_ReleaseGlobalLock(&pMac->sme);
10619 return eHAL_STATUS_FAILURE;
10620 }
10621
10622 sme_ReleaseGlobalLock(&pMac->sme);
10623 return eHAL_STATUS_SUCCESS;
10624 }
10625
10626 return status;
10627}
10628
10629/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010630 \fn sme_TriggerBatchScanResultInd
10631 \brief API to trigger batch scan result indications from FW
10632 \param hHal - The handle returned by macOpen.
10633 \param pRequest - Pointer to get batch request.
10634 \param sessionId - session ID
10635 \param callbackRoutine - HDD callback which needs to be invoked after
10636 getting batch scan result indication from FW
10637 \param callbackContext - pAdapter context
10638 \return eHalStatus
10639 ---------------------------------------------------------------------------*/
10640eHalStatus sme_TriggerBatchScanResultInd
10641(
10642 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10643 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10644 void *callbackContext
10645)
10646{
10647 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10648 eHalStatus status;
10649
10650 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10651 {
10652 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10653 callbackRoutine, callbackContext);
10654 sme_ReleaseGlobalLock( &pMac->sme );
10655 }
10656
10657 return status;
10658}
10659
10660
10661/* ---------------------------------------------------------------------------
10662 \fn sme_StopBatchScanInd
10663 \brief API to stop batch scan request in FW
10664 \param hHal - The handle returned by macOpen.
10665 \param pRequest - Pointer to the batch request.
10666 \param sessionId - session ID
10667 \return eHalStatus
10668 ---------------------------------------------------------------------------*/
10669eHalStatus sme_StopBatchScanInd
10670(
10671 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10672)
10673{
10674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10675 eHalStatus status;
10676
10677 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10678 {
10679 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10680 sme_ReleaseGlobalLock( &pMac->sme );
10681 }
10682
10683 return status;
10684}
10685
10686#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010687
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010688
Leo Chang0b0e45a2013-12-15 15:18:55 -080010689#ifdef FEATURE_WLAN_CH_AVOID
10690/* ---------------------------------------------------------------------------
10691 \fn sme_AddChAvoidCallback
10692 \brief Used to plug in callback function
10693 Which notify channel may not be used with SAP or P2PGO mode.
10694 Notification come from FW.
10695 \param hHal
10696 \param pCallbackfn : callback function pointer should be plugged in
10697 \- return eHalStatus
10698 -------------------------------------------------------------------------*/
10699eHalStatus sme_AddChAvoidCallback
10700(
10701 tHalHandle hHal,
10702 void (*pCallbackfn)(void *pAdapter, void *indParam)
10703)
10704{
10705 eHalStatus status = eHAL_STATUS_SUCCESS;
10706 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10707
10708 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10709 "%s: Plug in CH AVOID CB", __func__);
10710
10711 status = sme_AcquireGlobalLock(&pMac->sme);
10712 if (eHAL_STATUS_SUCCESS == status)
10713 {
10714 if (NULL != pCallbackfn)
10715 {
10716 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10717 }
10718 sme_ReleaseGlobalLock(&pMac->sme);
10719 }
10720
10721 return(status);
10722}
10723#endif /* FEATURE_WLAN_CH_AVOID */
10724
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010725void activeListCmdTimeoutHandle(void *userData)
10726{
10727 if (NULL == userData)
10728 return;
10729 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10730 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010731 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010732 smeGetCommandQStatus((tHalHandle) userData);
10733}
10734
Sunil Duttc69bccb2014-05-26 21:30:20 +053010735#ifdef WLAN_FEATURE_LINK_LAYER_STATS
10736
10737/* ---------------------------------------------------------------------------
10738 \fn sme_LLStatsSetReq
10739 \brief API to set link layer stats request to FW
10740 \param hHal - The handle returned by macOpen.
10741
10742 \Param pStatsReq - a pointer to a caller allocated object of
10743 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
10744 stats set.
10745
10746 \return eHalStatus
10747 ---------------------------------------------------------------------------*/
10748eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
10749 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
10750{
10751 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10752 vos_msg_t msg;
10753 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010754 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010755
Dino Mycledf0a5d92014-07-04 09:41:55 +053010756 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
10757 if ( !plinkLayerSetReq)
10758 {
10759 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10760 "%s: Not able to allocate memory for "
10761 "WDA_LINK_LAYER_STATS_SET_REQ",
10762 __func__);
10763 return eHAL_STATUS_FAILURE;
10764 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053010765
Dino Mycledf0a5d92014-07-04 09:41:55 +053010766 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
10767
Sunil Duttc69bccb2014-05-26 21:30:20 +053010768
10769 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10770 {
10771 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
10772 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010773 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010774
10775 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10776 {
10777 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10778 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
10779 status = eHAL_STATUS_FAILURE;
10780 }
10781 sme_ReleaseGlobalLock( &pMac->sme );
10782 }
10783 else
10784 {
10785 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10786 "sme_AcquireGlobalLock error", __func__);
10787 }
10788 return status;
10789}
10790
10791/* ---------------------------------------------------------------------------
10792 \fn sme_LLStatsGetReq
10793 \brief API to get link layer stats request to FW
10794 \param hHal - The handle returned by macOpen.
10795
10796 \Param pStatsReq - a pointer to a caller allocated object of
10797 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
10798 stats get.
10799
10800 \return eHalStatus
10801 ---------------------------------------------------------------------------*/
10802eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
10803 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
10804{
10805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10806 vos_msg_t msg;
10807 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010808 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010809
Dino Mycledf0a5d92014-07-04 09:41:55 +053010810 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
10811 if ( !pGetStatsReq)
10812 {
10813 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10814 "%s: Not able to allocate memory for "
10815 "WDA_LINK_LAYER_STATS_GET_REQ",
10816 __func__);
10817 return eHAL_STATUS_FAILURE;
10818 }
10819 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010820
10821 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10822 {
10823 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
10824 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010825 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010826 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10827 {
10828 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10829 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
10830 status = eHAL_STATUS_FAILURE;
10831 }
10832 sme_ReleaseGlobalLock( &pMac->sme );
10833 }
10834 else
10835 {
10836 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10837 "sme_AcquireGlobalLock error", __func__);
10838 }
10839 return status;
10840}
10841
10842/* ---------------------------------------------------------------------------
10843 \fn sme_LLStatsClearReq
10844 \brief API to clear link layer stats request to FW
10845 \param hHal - The handle returned by macOpen.
10846
10847 \Param pStatsReq - a pointer to a caller allocated object of
10848 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
10849 stats clear.
10850
10851 \return eHalStatus
10852 ---------------------------------------------------------------------------*/
10853eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
10854 tSirLLStatsClearReq *pLinkLayerStatsClear)
10855{
10856 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10857 vos_msg_t msg;
10858 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010859 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010860
10861
Sunil Duttc69bccb2014-05-26 21:30:20 +053010862
Dino Mycledf0a5d92014-07-04 09:41:55 +053010863 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
10864 if ( !pClearStatsReq)
10865 {
10866 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10867 "%s: Not able to allocate memory for "
10868 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
10869 __func__);
10870 return eHAL_STATUS_FAILURE;
10871 }
10872
10873 *pClearStatsReq = *pLinkLayerStatsClear;
10874
Sunil Duttc69bccb2014-05-26 21:30:20 +053010875 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10876 {
10877 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
10878 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053010879 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010880
10881 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
10882 {
10883 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10884 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
10885 status = eHAL_STATUS_FAILURE;
10886 }
10887 sme_ReleaseGlobalLock( &pMac->sme );
10888 }
10889 else
10890 {
10891 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
10892 "sme_AcquireGlobalLock error", __func__);
10893 }
10894
10895 return status;
10896}
10897
10898/* ---------------------------------------------------------------------------
10899 \fn sme_SetLinkLayerStatsIndCB
10900 \brief API to trigger Link Layer Statistic indications from FW
10901 \param hHal - The handle returned by macOpen.
10902 \param sessionId - session ID
10903 \param callbackRoutine - HDD callback which needs to be invoked after
10904 getting Link Layer Statistics from FW
10905 \param callbackContext - pAdapter context
10906 \return eHalStatus
10907 ---------------------------------------------------------------------------*/
10908eHalStatus sme_SetLinkLayerStatsIndCB
10909(
Dino Mycled3d50022014-07-07 12:58:25 +053010910 tHalHandle hHal,
10911 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
10912 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053010913)
10914{
10915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10916 eHalStatus status;
10917
10918 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10919 {
10920 if (NULL != callbackRoutine)
10921 {
10922 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053010923 }
10924 sme_ReleaseGlobalLock( &pMac->sme );
10925 }
10926
10927 return status;
10928}
10929#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
10930
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010931eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10932{
10933 eHalStatus status = eHAL_STATUS_SUCCESS;
10934 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10935 pMac->fEnableDebugLog = set_value;
10936 return (status);
10937}
10938
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010939VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070010940 sme_QosWmmUpType *dscpmapping,
10941 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010942{
10943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070010944 eHalStatus status = eHAL_STATUS_SUCCESS;
10945 v_U8_t i, j, peSessionId;
10946 tCsrRoamSession *pCsrSession = NULL;
10947 tpPESession pSession = NULL;
10948
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010949 status = sme_AcquireGlobalLock( &pMac->sme );
10950 if ( HAL_STATUS_SUCCESS( status ) )
10951 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010952 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
10953 {
10954 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10955 "%s: Invalid session Id %u", __func__, sessionId);
10956 sme_ReleaseGlobalLock( &pMac->sme);
10957 return eHAL_STATUS_FAILURE;
10958 }
10959 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
10960
10961 if (pCsrSession == NULL)
10962 {
10963 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10964 "%s: CSR Session lookup fails %u", __func__, sessionId);
10965 sme_ReleaseGlobalLock( &pMac->sme);
10966 return eHAL_STATUS_FAILURE;
10967 }
10968
10969 pSession = peFindSessionByBssid( pMac,
10970 pCsrSession->connectedProfile.bssid, &peSessionId );
10971
10972 if (pSession == NULL)
10973 {
10974 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10975 "%s: Session lookup fails for BSSID", __func__);
10976 sme_ReleaseGlobalLock( &pMac->sme);
10977 return eHAL_STATUS_FAILURE;
10978 }
10979
10980 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010981 {
10982 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10983 "%s: QOS Mapping IE not present", __func__);
10984 sme_ReleaseGlobalLock( &pMac->sme);
10985 return eHAL_STATUS_FAILURE;
10986 }
10987 else
10988 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010989 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010990 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010991 for (j = pSession->QosMapSet.dscp_range[i][0];
10992 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010993 {
Kumar Anand82c009f2014-05-29 00:29:42 -070010994 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
10995 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010996 {
10997 dscpmapping[j]= 0;
10998 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10999 "%s: User Priority %d is not used in mapping",
11000 __func__, i);
11001 break;
11002 }
11003 else
11004 {
11005 dscpmapping[j]= i;
11006 }
11007 }
11008 }
Kumar Anand82c009f2014-05-29 00:29:42 -070011009 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011010 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011011 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011012 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011013 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
11014 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011015 }
11016 }
11017 }
11018 }
11019 sme_ReleaseGlobalLock( &pMac->sme);
11020 return status;
11021}
Agarwal Ashish5e414792014-06-08 15:25:23 +053011022
Agarwal Ashish5e414792014-06-08 15:25:23 +053011023tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
11024{
11025 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11026
11027 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
11028 pMac->scan.countryCode11d, 2))
11029 {
11030 return eANI_BOOLEAN_TRUE;
11031 }
11032 else
11033 {
11034 return eANI_BOOLEAN_FALSE;
11035 }
11036}
Dino Mycle2c198072014-06-10 10:15:52 +053011037
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011038tANI_BOOLEAN sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
11039{
11040 eHalStatus status = eHAL_STATUS_SUCCESS;
11041 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11042 tANI_U16 len;
11043
11044 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
11045 {
11046 tpSirSpoofMacAddrReq pMsg;
11047
11048 /* Create the message and send to lim */
11049 len = sizeof(tSirSpoofMacAddrReq);
11050 pMsg = vos_mem_malloc(len);
11051 if ( NULL == pMsg )
11052 status = eHAL_STATUS_FAILURE;
11053 else
11054 {
11055 vos_mem_set(pMsg, sizeof(tSirSpoofMacAddrReq), 0);
11056 pMsg->messageType = eWNI_SME_MAC_SPOOF_ADDR_IND;
11057 pMsg->length = len;
11058 /* Data starts from here */
11059 vos_mem_copy(pMsg->macAddr, macaddr->bytes, VOS_MAC_ADDRESS_LEN);
11060
11061 status = palSendMBMessage(pMac->hHdd, pMsg);
11062 }
11063 sme_ReleaseGlobalLock( &pMac->sme );
11064 }
11065 return status;
11066}
11067
Dino Mycle2c198072014-06-10 10:15:52 +053011068#ifdef WLAN_FEATURE_EXTSCAN
11069/* ---------------------------------------------------------------------------
11070 \fn sme_GetValidChannelsByBand
11071 \brief SME API to fetch all valid channel filtered by band
11072 \param hHal
11073 \param wifiBand: RF band information
11074 \param aValidChannels: Array to store channel info
11075 \param len: number of channels
11076 \- return eHalStatus
11077 -------------------------------------------------------------------------*/
11078eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
11079 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
11080{
11081 eHalStatus status = eHAL_STATUS_SUCCESS;
11082 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
11083 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11084 tANI_U8 numChannels = 0;
11085 tANI_U8 i = 0;
11086 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
11087
11088 if (!aValidChannels || !pNumChannels) {
11089 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11090 FL("Output channel list/NumChannels is NULL"));
11091 return eHAL_STATUS_INVALID_PARAMETER;
11092 }
11093
11094 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
11095 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11096 FL("Invalid wifiBand (%d)"), wifiBand);
11097 return eHAL_STATUS_INVALID_PARAMETER;
11098 }
11099
11100 status = sme_GetCfgValidChannels(hHal, &chanList[0],
11101 &totValidChannels);
11102 if (!HAL_STATUS_SUCCESS(status)) {
11103 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11104 FL("Failed to get valid channel list (err=%d)"), status);
11105 return status;
11106 }
11107
11108 switch (wifiBand) {
11109 case WIFI_BAND_UNSPECIFIED:
11110 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
11111 "return all (%d) valid channels"), totValidChannels);
11112 numChannels = totValidChannels;
11113 for (i = 0; i < numChannels; i++)
11114 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
11115 break;
11116
11117 case WIFI_BAND_BG:
11118 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
11119 for (i = 0; i < totValidChannels; i++)
11120 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
11121 aValidChannels[numChannels++] =
11122 vos_chan_to_freq(chanList[i]);
11123 break;
11124
11125 case WIFI_BAND_A:
11126 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11127 FL("WIFI_BAND_A (5 GHz without DFS)"));
11128 for (i = 0; i < totValidChannels; i++)
11129 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11130 !CSR_IS_CHANNEL_DFS(chanList[i]))
11131 aValidChannels[numChannels++] =
11132 vos_chan_to_freq(chanList[i]);
11133 break;
11134
11135 case WIFI_BAND_ABG:
11136 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11137 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11138 for (i = 0; i < totValidChannels; i++)
11139 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11140 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11141 !CSR_IS_CHANNEL_DFS(chanList[i]))
11142 aValidChannels[numChannels++] =
11143 vos_chan_to_freq(chanList[i]);
11144 break;
11145
11146 case WIFI_BAND_A_DFS_ONLY:
11147 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11148 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11149 for (i = 0; i < totValidChannels; i++)
11150 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11151 CSR_IS_CHANNEL_DFS(chanList[i]))
11152 aValidChannels[numChannels++] =
11153 vos_chan_to_freq(chanList[i]);
11154 break;
11155
11156 case WIFI_BAND_A_WITH_DFS:
11157 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11158 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11159 for (i = 0; i < totValidChannels; i++)
11160 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11161 aValidChannels[numChannels++] =
11162 vos_chan_to_freq(chanList[i]);
11163 break;
11164
11165 case WIFI_BAND_ABG_WITH_DFS:
11166 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11167 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11168 for (i = 0; i < totValidChannels; i++)
11169 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11170 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11171 aValidChannels[numChannels++] =
11172 vos_chan_to_freq(chanList[i]);
11173 break;
11174
11175 default:
11176 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11177 FL("Unknown wifiBand (%d))"), wifiBand);
11178 return eHAL_STATUS_INVALID_PARAMETER;
11179 break;
11180 }
11181 *pNumChannels = numChannels;
11182
11183 return status;
11184}
11185/* ---------------------------------------------------------------------------
11186 \fn sme_EXTScanGetCapabilities
11187 \brief SME API to fetch Extended Scan capabilities
11188 \param hHal
11189 \param pReq: Extended Scan capabilities structure
11190 \- return eHalStatus
11191 -------------------------------------------------------------------------*/
11192eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11193 tSirGetEXTScanCapabilitiesReqParams *pReq)
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 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11200
11201 pGetEXTScanCapabilitiesReq =
11202 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11203 if ( !pGetEXTScanCapabilitiesReq)
11204 {
11205 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11206 "%s: Not able to allocate memory for "
11207 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11208 __func__);
11209 return eHAL_STATUS_FAILURE;
11210 }
11211
11212 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011213
11214 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11215 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, 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 = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011219 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_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 return(status);
11227}
11228
11229/* ---------------------------------------------------------------------------
11230 \fn sme_EXTScanStart
11231 \brief SME API to issue Extended Scan start
11232 \param hHal
11233 \param pStartCmd: Extended Scan start structure
11234 \- return eHalStatus
11235 -------------------------------------------------------------------------*/
11236eHalStatus sme_EXTScanStart (tHalHandle hHal,
11237 tSirEXTScanStartReqParams *pStartCmd)
11238{
11239 eHalStatus status = eHAL_STATUS_SUCCESS;
11240 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11241 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11242 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011243 tSirEXTScanStartReqParams *pextScanStartReq;
11244
11245 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11246 if ( !pextScanStartReq)
11247 {
11248 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11249 "%s: Not able to allocate memory for "
11250 "WDA_EXTSCAN_START_REQ",
11251 __func__);
11252 return eHAL_STATUS_FAILURE;
11253 }
11254
11255 *pextScanStartReq = *pStartCmd;
11256
Dino Mycle2c198072014-06-10 10:15:52 +053011257
11258 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11259 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11260 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11261 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011262 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011263 vosMessage.type = WDA_EXTSCAN_START_REQ;
11264 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11265 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11266 status = eHAL_STATUS_FAILURE;
11267
11268 sme_ReleaseGlobalLock(&pMac->sme);
11269 }
11270 return(status);
11271}
11272
11273/* ---------------------------------------------------------------------------
11274 \fn sme_EXTScanStop
11275 \brief SME API to issue Extended Scan stop
11276 \param hHal
11277 \param pStopReq: Extended Scan stop structure
11278 \- return eHalStatus
11279 -------------------------------------------------------------------------*/
11280eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11281{
11282 eHalStatus status = eHAL_STATUS_SUCCESS;
11283 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11284 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11285 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011286 tSirEXTScanStopReqParams *pEXTScanStopReq;
11287
11288 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11289 if ( !pEXTScanStopReq)
11290 {
11291 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11292 "%s: Not able to allocate memory for "
11293 "WDA_EXTSCAN_STOP_REQ",
11294 __func__);
11295 return eHAL_STATUS_FAILURE;
11296 }
11297
11298 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011299
11300 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11301 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11302 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11303 {
11304 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011305 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011306 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11307 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11308 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11309 {
11310 status = eHAL_STATUS_FAILURE;
11311 }
11312 sme_ReleaseGlobalLock(&pMac->sme);
11313 }
11314 return(status);
11315}
11316
11317/* ---------------------------------------------------------------------------
11318 \fn sme_SetBssHotlist
11319 \brief SME API to set BSSID hotlist
11320 \param hHal
11321 \param pSetHotListReq: Extended Scan set hotlist structure
11322 \- return eHalStatus
11323 -------------------------------------------------------------------------*/
11324eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11325 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11326{
11327 eHalStatus status = eHAL_STATUS_SUCCESS;
11328 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11329 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11330 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011331 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11332
11333 pEXTScanSetBssidHotlistReq =
11334 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11335 if ( !pEXTScanSetBssidHotlistReq)
11336 {
11337 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11338 "%s: Not able to allocate memory for "
11339 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11340 __func__);
11341 return eHAL_STATUS_FAILURE;
11342 }
11343
11344 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011345
11346 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11347 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11348 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11349 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011350 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011351 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11352 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11353 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11354 status = eHAL_STATUS_FAILURE;
11355
11356 sme_ReleaseGlobalLock(&pMac->sme);
11357 }
11358
11359 return(status);
11360}
11361
11362/* ---------------------------------------------------------------------------
11363 \fn sme_ResetBssHotlist
11364 \brief SME API to reset BSSID hotlist
11365 \param hHal
11366 \param pSetHotListReq: Extended Scan set hotlist structure
11367 \- return eHalStatus
11368 -------------------------------------------------------------------------*/
11369eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11370 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11371{
11372 eHalStatus status = eHAL_STATUS_SUCCESS;
11373 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11374 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11375 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011376 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11377
11378 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11379 if ( !pEXTScanHotlistResetReq)
11380 {
11381 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11382 "%s: Not able to allocate memory for "
11383 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11384 __func__);
11385 return eHAL_STATUS_FAILURE;
11386 }
11387
11388 *pEXTScanHotlistResetReq = *pResetReq;
11389
Dino Mycle2c198072014-06-10 10:15:52 +053011390
11391 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11392 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11393 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11394 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011395 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011396 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11397 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11398 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11399 status = eHAL_STATUS_FAILURE;
11400
11401 sme_ReleaseGlobalLock(&pMac->sme);
11402 }
11403 return(status);
11404}
11405
11406/* ---------------------------------------------------------------------------
11407 \fn sme_SetSignificantChange
11408 \brief SME API to set significant change
11409 \param hHal
11410 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11411 \- return eHalStatus
11412 -------------------------------------------------------------------------*/
11413eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11414 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11415{
11416 eHalStatus status = eHAL_STATUS_SUCCESS;
11417 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11418 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11419 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011420 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11421
11422 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11423 if ( !pEXTScanSetSignificantReq)
11424 {
11425 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11426 "%s: Not able to allocate memory for "
11427 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11428 __func__);
11429 return eHAL_STATUS_FAILURE;
11430 }
11431
11432 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11433
11434
Dino Mycle2c198072014-06-10 10:15:52 +053011435
11436 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11437 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11438 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11439 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011440 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011441 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11442 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11443 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11444 status = eHAL_STATUS_FAILURE;
11445
11446 sme_ReleaseGlobalLock(&pMac->sme);
11447 }
11448 return(status);
11449}
11450
11451/* ---------------------------------------------------------------------------
11452 \fn sme_ResetSignificantChange
11453 \brief SME API to reset significant change
11454 \param hHal
11455 \param pResetReq: Extended Scan reset significant change structure
11456 \- return eHalStatus
11457 -------------------------------------------------------------------------*/
11458eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11459 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11460{
11461 eHalStatus status = eHAL_STATUS_SUCCESS;
11462 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11463 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11464 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011465 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11466
11467 pEXTScanResetSignificantReq =
11468 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11469 if ( !pEXTScanResetSignificantReq)
11470 {
11471 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11472 "%s: Not able to allocate memory for "
11473 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11474 __func__);
11475 return eHAL_STATUS_FAILURE;
11476 }
11477
11478 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011479
11480 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11481 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11482 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11483 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011484 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011485 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11486 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11487 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11488 status = eHAL_STATUS_FAILURE;
11489
11490 sme_ReleaseGlobalLock(&pMac->sme);
11491 }
11492 return(status);
11493}
11494
11495/* ---------------------------------------------------------------------------
11496 \fn sme_getCachedResults
11497 \brief SME API to get cached results
11498 \param hHal
11499 \param pCachedResultsReq: Extended Scan get cached results structure
11500 \- return eHalStatus
11501 -------------------------------------------------------------------------*/
11502eHalStatus sme_getCachedResults (tHalHandle hHal,
11503 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11504{
11505 eHalStatus status = eHAL_STATUS_SUCCESS;
11506 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11507 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11508 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011509 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11510
11511 pEXTScanCachedResultsReq =
11512 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11513 if ( !pEXTScanCachedResultsReq)
11514 {
11515 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11516 "%s: Not able to allocate memory for "
11517 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11518 __func__);
11519 return eHAL_STATUS_FAILURE;
11520 }
11521
11522 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11523
Dino Mycle2c198072014-06-10 10:15:52 +053011524
11525 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11526 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11527 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11528 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011529 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011530 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11531 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11532 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11533 status = eHAL_STATUS_FAILURE;
11534
11535 sme_ReleaseGlobalLock(&pMac->sme);
11536 }
11537 return(status);
11538}
11539
11540eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
11541 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
11542 void *callbackContext)
11543{
11544 eHalStatus status = eHAL_STATUS_SUCCESS;
11545 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11546
11547 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11548 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
11549 pMac->sme.pEXTScanCallbackContext = callbackContext;
11550 sme_ReleaseGlobalLock(&pMac->sme);
11551 }
11552 return(status);
11553}
11554
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053011555void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
11556{
11557 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11558
11559 pMac->miracast_mode = mode;
11560}
Dino Mycle2c198072014-06-10 10:15:52 +053011561#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053011562
11563void sme_resetCoexEevent(tHalHandle hHal)
11564{
11565 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11566
11567 if (pMac == NULL)
11568 {
11569 printk("btc: %s pMac is NULL \n",__func__);
11570 return;
11571 }
11572
11573 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11574 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
11575
11576 if (pMac->isCoexScoIndSet)
11577 {
11578 pMac->isCoexScoIndSet = 0;
11579 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
11580 NULL, eANI_BOOLEAN_FALSE);
11581 }
11582
11583 return;
11584}
Agarwal Ashish738843c2014-09-25 12:27:56 +053011585
11586void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
11587{
11588 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11589 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
11590 csrDisableDfsChannel(pMac);
11591
11592}