blob: d10580118fff87f7f78e7284a24fdde8007c8a8b [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
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08001749#ifdef WLAN_FEATURE_AP_HT40_24G
1750/* ---------------------------------------------------------------------------
1751 \fn sme_HT2040CoexInfoInd
1752 \brief a Send 20/40 Coex info to SAP layer
1753
1754 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
1755 \return eHalStatus
1756 ---------------------------------------------------------------------------*/
1757
1758eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
1759 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
1760{
1761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1762 eHalStatus status = eHAL_STATUS_SUCCESS;
1763 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
1764 tCsrRoamInfo roamInfo = {0};
1765
1766 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
1767
1768 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
1769 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
1770 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
1771
1772 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
1773 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
1774
1775 /* forward the 20/40 BSS Coex information to HDD */
1776 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
1777 " to WLANSAP_RoamCallback "));
1778
1779 csrRoamCallCallback(pMac, SessionId, &roamInfo,
1780 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
1781 return status;
1782}
1783#endif
1784
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001785#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001786/*------------------------------------------------------------------
1787 *
1788 * Handle the tsm ie indication from LIM and forward it to HDD.
1789 *
1790 *------------------------------------------------------------------*/
1791
1792eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1793{
1794 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1795 eHalStatus status = eHAL_STATUS_SUCCESS;
1796 tCsrRoamInfo pRoamInfo = {0};
1797 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1798
1799 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1800 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1801 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1802
1803 /* forward the tsm ie information to HDD */
1804 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1805
1806 return status;
1807}
1808
1809/* ---------------------------------------------------------------------------
1810 \fn sme_SetCCKMIe
1811 \brief function to store the CCKM IE passed from supplicant and use it while packing
1812 reassociation request
1813 \param hHal - HAL handle for device
1814 \param pCckmIe - pointer to CCKM IE data
1815 \param pCckmIeLen - length of the CCKM IE
1816 \- return Success or failure
1817 -------------------------------------------------------------------------*/
1818eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1819 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1820{
1821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1822 eHalStatus status = eHAL_STATUS_SUCCESS;
1823
1824 status = sme_AcquireGlobalLock( &pMac->sme );
1825 if ( HAL_STATUS_SUCCESS( status ) )
1826 {
1827 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1828 sme_ReleaseGlobalLock( &pMac->sme );
1829 }
1830 return status;
1831}
1832
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001833/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001834 \fn sme_SetEseBeaconRequest
1835 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001836 \param hHal - HAL handle for device
1837 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001838 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001839 \- return Success or failure
1840 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001841eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1842 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001843{
1844 eHalStatus status = eSIR_SUCCESS;
1845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1846 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001847 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001848 tANI_U8 counter = 0;
1849 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1850 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1851
1852 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001853 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001854
1855 //Prepare the request to send to SME.
1856 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1857 if(NULL == pSmeBcnReportReq)
1858 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001859 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001860 return eSIR_FAILURE;
1861 }
1862
1863 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1864 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1865
1866 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1867 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1868 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1869 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001870 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1871 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001872
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001873 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001874 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001875 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001876 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1877 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1878 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1879 }
1880
1881 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1882 return status;
1883}
1884
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001885#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001886
Chet Lanctot186b5732013-03-18 10:26:30 -07001887
c_hpothu92367912014-05-01 15:18:17 +05301888/* ---------------------------------------------------------------------------
1889 \fn sme_getBcnMissRate
1890 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1891 \param hHal - HAL handle for device.
1892 \param sessionId - session ID.
1893 \- return Success or Failure.
1894 -------------------------------------------------------------------------*/
1895
1896eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1897{
1898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1899 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1900 vos_msg_t vosMessage;
1901 tSirBcnMissRateReq *pMsg;
1902 tCsrRoamSession *pSession;
1903
1904 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1905 {
1906 pSession = CSR_GET_SESSION( pMac, sessionId );
1907
1908 if (!pSession)
1909 {
1910 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1911 sme_ReleaseGlobalLock( &pMac->sme );
1912 return eHAL_STATUS_FAILURE;
1913 }
1914
c_hpothu402de812014-07-10 15:55:45 +05301915 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05301916 if (NULL == pMsg)
1917 {
1918 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1919 sme_ReleaseGlobalLock( &pMac->sme );
1920 return eHAL_STATUS_FAILURE;
1921 }
1922
1923 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1924 sizeof(tSirMacAddr));
1925
1926 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1927 pMsg->callback = callback;
1928 pMsg->data = data;
1929
1930 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1931 vosMessage.bodyptr = pMsg;
1932 vosMessage.reserved = 0;
1933 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1934 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1935 {
1936 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1937 "%s: Post Set TM Level MSG fail", __func__);
1938 vos_mem_free(pMsg);
1939 sme_ReleaseGlobalLock( &pMac->sme );
1940 return eHAL_STATUS_FAILURE;
1941 }
1942 sme_ReleaseGlobalLock( &pMac->sme);
1943 return eHAL_STATUS_SUCCESS;
1944 }
1945 return eHAL_STATUS_FAILURE;
1946}
1947
Jeff Johnson295189b2012-06-20 16:38:30 -07001948/*--------------------------------------------------------------------------
1949
1950 \brief sme_ProcessMsg() - The main message processor for SME.
1951
1952 The function is called by a message dispatcher when to process a message
1953 targeted for SME.
1954
Srinivas Girigowdade697412013-02-14 16:31:48 -08001955 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 \param hHal - The handle returned by macOpen.
1957 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1958
1959 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1960
1961 Other status means SME failed to process the message to HAL.
1962 \sa
1963
1964 --------------------------------------------------------------------------*/
1965eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1966{
1967 eHalStatus status = eHAL_STATUS_FAILURE;
1968 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1969
1970 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001971 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 return status;
1973 }
1974
1975 status = sme_AcquireGlobalLock( &pMac->sme );
1976 if ( HAL_STATUS_SUCCESS( status ) )
1977 {
1978 if( SME_IS_START(pMac) )
1979 {
1980 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1981 case eWNI_PMC_ENTER_BMPS_RSP:
1982 case eWNI_PMC_EXIT_BMPS_RSP:
1983 case eWNI_PMC_EXIT_BMPS_IND:
1984 case eWNI_PMC_ENTER_IMPS_RSP:
1985 case eWNI_PMC_EXIT_IMPS_RSP:
1986 case eWNI_PMC_SMPS_STATE_IND:
1987 case eWNI_PMC_ENTER_UAPSD_RSP:
1988 case eWNI_PMC_EXIT_UAPSD_RSP:
1989 case eWNI_PMC_ENTER_WOWL_RSP:
1990 case eWNI_PMC_EXIT_WOWL_RSP:
1991 //PMC
1992 if (pMsg->bodyptr)
1993 {
1994 pmcMessageProcessor(hHal, pMsg->bodyptr);
1995 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301996 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001998 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 }
2000 break;
2001
2002 case WNI_CFG_SET_CNF:
2003 case WNI_CFG_DNLD_CNF:
2004 case WNI_CFG_GET_RSP:
2005 case WNI_CFG_ADD_GRP_ADDR_CNF:
2006 case WNI_CFG_DEL_GRP_ADDR_CNF:
2007 //CCM
2008 if (pMsg->bodyptr)
2009 {
2010 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2011 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302012 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002014 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 }
2016 break;
2017
2018 case eWNI_SME_ADDTS_RSP:
2019 case eWNI_SME_DELTS_RSP:
2020 case eWNI_SME_DELTS_IND:
2021#ifdef WLAN_FEATURE_VOWIFI_11R
2022 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002023#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 //QoS
2025 if (pMsg->bodyptr)
2026 {
2027#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2028 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302029 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002030#endif
2031 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002032 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 }
2034 break;
2035#if defined WLAN_FEATURE_VOWIFI
2036 case eWNI_SME_NEIGHBOR_REPORT_IND:
2037 case eWNI_SME_BEACON_REPORT_REQ_IND:
2038#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002039 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002040#endif
2041 if ( pMsg->bodyptr )
2042 {
2043 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302044 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 }
2046 else
2047 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002048 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 }
2050 break;
2051#endif
2052
Jeff Johnsone7245742012-09-05 17:12:55 -07002053#ifdef FEATURE_OEM_DATA_SUPPORT
2054 //Handle the eWNI_SME_OEM_DATA_RSP:
2055 case eWNI_SME_OEM_DATA_RSP:
2056 if(pMsg->bodyptr)
2057 {
2058 status = sme_HandleOemDataRsp(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 oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002064 }
2065 smeProcessPendingQueue( pMac );
2066 break;
2067#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002068
2069 case eWNI_SME_ADD_STA_SELF_RSP:
2070 if(pMsg->bodyptr)
2071 {
2072 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2073 vos_mem_free(pMsg->bodyptr);
2074 }
2075 else
2076 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002077 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002078 }
2079 break;
2080 case eWNI_SME_DEL_STA_SELF_RSP:
2081 if(pMsg->bodyptr)
2082 {
2083 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2084 vos_mem_free(pMsg->bodyptr);
2085 }
2086 else
2087 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002088 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 }
2090 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 case eWNI_SME_REMAIN_ON_CHN_RSP:
2092 if(pMsg->bodyptr)
2093 {
2094 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2095 vos_mem_free(pMsg->bodyptr);
2096 }
2097 else
2098 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002099 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 }
2101 break;
2102 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2103 if(pMsg->bodyptr)
2104 {
2105 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2106 vos_mem_free(pMsg->bodyptr);
2107 }
2108 else
2109 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002110 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 -07002111 }
2112 break;
2113 case eWNI_SME_MGMT_FRM_IND:
2114 if(pMsg->bodyptr)
2115 {
2116 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2117 vos_mem_free(pMsg->bodyptr);
2118 }
2119 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002120 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002121 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 }
2123 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002124#ifdef WLAN_FEATURE_AP_HT40_24G
2125 case eWNI_SME_2040_COEX_IND:
2126 if(pMsg->bodyptr)
2127 {
2128 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2129 vos_mem_free(pMsg->bodyptr);
2130 }
2131 else
2132 {
2133 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2134 }
2135 break;
2136#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2138 if(pMsg->bodyptr)
2139 {
2140 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2141 vos_mem_free(pMsg->bodyptr);
2142 }
2143 else
2144 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002145 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 }
2147 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 case eWNI_SME_COEX_IND:
2149 if(pMsg->bodyptr)
2150 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302151 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2152
2153 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2154 {
2155 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2156 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2157 pMac->isCoexScoIndSet = 1;
2158 }
2159 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2160 {
2161 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2162 pMac->isCoexScoIndSet = 0;
2163 sme_RequestBmps(hHal, NULL, NULL);
2164 }
2165
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2167 vos_mem_free(pMsg->bodyptr);
2168 }
2169 else
2170 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002171 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002173 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002174
2175#ifdef FEATURE_WLAN_SCAN_PNO
2176 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2177 if(pMsg->bodyptr)
2178 {
2179 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2180 vos_mem_free(pMsg->bodyptr);
2181 }
2182 else
2183 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002184 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 }
2186 break;
2187#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002188
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 case eWNI_SME_TX_PER_HIT_IND:
2190 if (pMac->sme.pTxPerHitCallback)
2191 {
2192 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2193 }
2194 break;
2195
2196 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002197 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 {
2199 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2200 vos_mem_free(pMsg->bodyptr);
2201 }
2202 else
2203 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002204 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2205 }
2206 break;
2207
2208 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2209 if (pMsg->bodyptr)
2210 {
2211 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2212 vos_mem_free(pMsg->bodyptr);
2213 }
2214 else
2215 {
2216 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 }
2218 break;
2219
2220#ifdef WLAN_FEATURE_PACKET_FILTERING
2221 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2222 if(pMsg->bodyptr)
2223 {
2224 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2225 vos_mem_free(pMsg->bodyptr);
2226 }
2227 else
2228 {
2229 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002230 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 }
2232 break;
2233#endif // WLAN_FEATURE_PACKET_FILTERING
2234 case eWNI_SME_PRE_SWITCH_CHL_IND:
2235 {
2236 status = sme_HandlePreChannelSwitchInd(pMac);
2237 break;
2238 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002239
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 case eWNI_SME_POST_SWITCH_CHL_IND:
2241 {
2242 status = sme_HandlePostChannelSwitchInd(pMac);
2243 break;
2244 }
2245
2246#ifdef WLAN_WAKEUP_EVENTS
2247 case eWNI_SME_WAKE_REASON_IND:
2248 if(pMsg->bodyptr)
2249 {
2250 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2251 vos_mem_free(pMsg->bodyptr);
2252 }
2253 else
2254 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002255 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 }
2257 break;
2258#endif // WLAN_WAKEUP_EVENTS
2259
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002260#ifdef FEATURE_WLAN_TDLS
2261 /*
2262 * command rescived from PE, SME tdls msg processor shall be called
2263 * to process commands recieved from PE
2264 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002265 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2266 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002267 case eWNI_SME_TDLS_DEL_STA_RSP:
2268 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002269 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002270 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302271 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302272 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002273#ifdef FEATURE_WLAN_TDLS_INTERNAL
2274 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2275 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2276 case eWNI_SME_TDLS_LINK_START_RSP:
2277 case eWNI_SME_TDLS_LINK_START_IND:
2278 case eWNI_SME_TDLS_TEARDOWN_RSP:
2279 case eWNI_SME_TDLS_TEARDOWN_IND:
2280 case eWNI_SME_ADD_TDLS_PEER_IND:
2281 case eWNI_SME_DELETE_TDLS_PEER_IND:
2282#endif
2283 {
2284 if (pMsg->bodyptr)
2285 {
2286 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302287 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002288 }
2289 else
2290 {
2291 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002292 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002293 }
2294 break;
2295 }
2296#endif
2297
Chet Lanctot186b5732013-03-18 10:26:30 -07002298#ifdef WLAN_FEATURE_11W
2299 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2300 if (pMsg->bodyptr)
2301 {
2302 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2303 vos_mem_free(pMsg->bodyptr);
2304 }
2305 else
2306 {
2307 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2308 }
2309 break;
2310#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002311#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002312 case eWNI_SME_TSM_IE_IND:
2313 {
2314 if (pMsg->bodyptr)
2315 {
2316 sme_TsmIeInd(pMac, pMsg->bodyptr);
2317 vos_mem_free(pMsg->bodyptr);
2318 }
2319 else
2320 {
2321 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2322 }
2323 break;
2324 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002325#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002326#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2327 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2328 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2329 break;
2330#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002331
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302332#ifdef WLAN_FEATURE_GTK_OFFLOAD
2333 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2334 if (pMsg->bodyptr)
2335 {
2336 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302337 vos_mem_zero(pMsg->bodyptr,
2338 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302339 vos_mem_free(pMsg->bodyptr);
2340 }
2341 else
2342 {
2343 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2344 }
2345 break ;
2346#endif
Leo Chang9056f462013-08-01 19:21:11 -07002347
2348#ifdef FEATURE_WLAN_LPHB
2349 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002350 case eWNI_SME_LPHB_IND:
2351 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002352 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002353 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002354 }
2355 vos_mem_free(pMsg->bodyptr);
2356
2357 break;
2358#endif /* FEATURE_WLAN_LPHB */
2359
Leo Chang0b0e45a2013-12-15 15:18:55 -08002360#ifdef FEATURE_WLAN_CH_AVOID
2361 /* LPHB timeout indication arrived, send IND to client */
2362 case eWNI_SME_CH_AVOID_IND:
2363 if (pMac->sme.pChAvoidNotificationCb)
2364 {
2365 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2366 "%s: CH avoid notification", __func__);
2367 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2368 }
2369 vos_mem_free(pMsg->bodyptr);
2370
2371 break;
2372#endif /* FEATURE_WLAN_CH_AVOID */
2373
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 default:
2375
2376 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2377 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2378 {
2379 //CSR
2380 if (pMsg->bodyptr)
2381 {
2382 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302383 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002384 }
2385 else
2386 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002387 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 }
2389 }
2390 else
2391 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002392 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 pMsg->type);
2394 if (pMsg->bodyptr)
2395 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302396 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 }
2398 }
2399 }//switch
2400 } //SME_IS_START
2401 else
2402 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002403 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002404 if (pMsg->bodyptr)
2405 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302406 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 }
2408 }
2409 sme_ReleaseGlobalLock( &pMac->sme );
2410 }
2411 else
2412 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002413 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 if (pMsg->bodyptr)
2415 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302416 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002417 }
2418 }
2419
2420 return status;
2421}
2422
2423
2424//No need to hold the global lock here because this function can only be called
2425//after sme_Stop.
2426v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2427{
2428 if( pMsg )
2429 {
2430 if (pMsg->bodyptr)
2431 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302432 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 }
2434 }
2435
2436}
2437
2438
2439/*--------------------------------------------------------------------------
2440
2441 \brief sme_Stop() - Stop all SME modules and put them at idle state
2442
2443 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2444 return, all modules are at idle state ready to start.
2445
Srinivas Girigowdade697412013-02-14 16:31:48 -08002446 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302448 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002449
2450 \return eHAL_STATUS_SUCCESS - SME is stopped.
2451
2452 Other status means SME is failed to stop but caller should still
2453 consider SME is stopped.
2454 \sa
2455
2456 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302457eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002458{
2459 eHalStatus status = eHAL_STATUS_FAILURE;
2460 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2461 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2462
Jeff Johnson295189b2012-06-20 16:38:30 -07002463 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2464 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002465 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 status );
2467 fail_status = status;
2468 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002469
2470 p2pStop(hHal);
2471
Kiet Lama72a2322013-11-15 11:18:11 +05302472 status = pmcStop(hHal);
2473 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2474 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2475 status );
2476 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 }
2478
Kiet Lama72a2322013-11-15 11:18:11 +05302479 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002481 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 status );
2483 fail_status = status;
2484 }
2485
2486 ccmStop(hHal);
2487
2488 purgeSmeCmdList(pMac);
2489
2490 if (!HAL_STATUS_SUCCESS( fail_status )) {
2491 status = fail_status;
2492 }
2493
2494 pMac->sme.state = SME_STATE_STOP;
2495
2496 return status;
2497}
2498
2499/*--------------------------------------------------------------------------
2500
2501 \brief sme_Close() - Release all SME modules and their resources.
2502
2503 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2504 return, all modules are at closed state.
2505
2506 No SME APIs can be involved after smeClose except smeOpen.
2507 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002508 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002509 \param hHal - The handle returned by macOpen
2510
2511 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2512
2513 Other status means SME is failed to be closed but caller still cannot
2514 call any other SME functions except smeOpen.
2515 \sa
2516
2517 --------------------------------------------------------------------------*/
2518eHalStatus sme_Close(tHalHandle hHal)
2519{
2520 eHalStatus status = eHAL_STATUS_FAILURE;
2521 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2523
2524 status = csrClose(pMac);
2525 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002526 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 status );
2528 fail_status = status;
2529 }
2530
Jeff Johnson295189b2012-06-20 16:38:30 -07002531 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2532 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002533 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002534 status );
2535 fail_status = status;
2536 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002537
2538#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2539 status = btcClose(hHal);
2540 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002541 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002542 status );
2543 fail_status = status;
2544 }
2545
2546 status = sme_QosClose(pMac);
2547 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002548 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002549 status );
2550 fail_status = status;
2551 }
2552#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002553#ifdef FEATURE_OEM_DATA_SUPPORT
2554 status = oemData_OemDataReqClose(hHal);
2555 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002556 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002557 status );
2558 fail_status = status;
2559 }
2560#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002561
2562 status = ccmClose(hHal);
2563 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002564 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 status );
2566 fail_status = status;
2567 }
2568
2569 status = pmcClose(hHal);
2570 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002571 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 status );
2573 fail_status = status;
2574 }
2575#if defined WLAN_FEATURE_VOWIFI
2576 status = rrmClose(hHal);
2577 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002578 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002579 status );
2580 fail_status = status;
2581 }
2582#endif
2583
2584#if defined WLAN_FEATURE_VOWIFI_11R
2585 sme_FTClose(hHal);
2586#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002588
2589 freeSmeCmdList(pMac);
2590
2591 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2592 {
2593 fail_status = eHAL_STATUS_FAILURE;
2594 }
2595
2596 if (!HAL_STATUS_SUCCESS( fail_status )) {
2597 status = fail_status;
2598 }
2599
2600 pMac->sme.state = SME_STATE_STOP;
2601
2602 return status;
2603}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002604#ifdef FEATURE_WLAN_LFR
2605tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2606{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002607#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002608 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2609 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2610 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2611 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2612 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2613 return eANI_BOOLEAN_FALSE;
2614 default:
2615 return eANI_BOOLEAN_TRUE;
2616 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002617#else
2618 /*
2619 * TODO: always return TRUE for now until
2620 * we figure out why we could be stuck in
2621 * one of the roaming states forever.
2622 */
2623 return eANI_BOOLEAN_TRUE;
2624#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002625}
2626#endif
c_hpothu58901462014-11-01 16:44:34 +05302627
2628/* ---------------------------------------------------------------------------
2629 \fn sco_isScanAllowed
2630 \brief check for scan interface connection status
2631 \param pMac - Pointer to the global MAC parameter structure
2632 \param pScanReq - scan request structure.
2633
2634 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
2635 ---------------------------------------------------------------------------*/
2636tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
2637{
2638 tANI_BOOLEAN ret;
2639
2640 if (pscanReq->p2pSearch)
2641 ret = csrIsP2pSessionConnected(pMac);
2642 else
2643 ret = csrIsStaSessionConnected(pMac);
2644
2645 return !ret;
2646}
2647
Jeff Johnson295189b2012-06-20 16:38:30 -07002648/* ---------------------------------------------------------------------------
2649 \fn sme_ScanRequest
2650 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002651 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002652 \param pScanRequestID - pointer to an object to get back the request ID
2653 \param callback - a callback function that scan calls upon finish, will not
2654 be called if csrScanRequest returns error
2655 \param pContext - a pointer passed in for the callback
2656 \return eHalStatus
2657 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002658eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2659 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002660 csrScanCompleteCallback callback, void *pContext)
2661{
2662 eHalStatus status = eHAL_STATUS_FAILURE;
2663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 smsLog(pMac, LOG2, FL("enter"));
2667 do
2668 {
c_hpothu304c0522014-09-30 10:22:57 +05302669 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05302670 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 {
2672 status = sme_AcquireGlobalLock( &pMac->sme );
2673 if ( HAL_STATUS_SUCCESS( status ) )
2674 {
2675 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002676#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002677 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002678 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002679#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002680 status = csrScanRequest( hHal, sessionId, pscanReq,
2681 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302682 if ( !HAL_STATUS_SUCCESS( status ) )
2683 {
2684 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2685 " SId=%d"), sessionId);
2686 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002687#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002688 }
2689 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002690 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302691 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302692 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302693 macTraceGetNeighbourRoamState(
2694 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302695 macTraceGetcsrRoamSubState(
2696 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002697 /*HandOff is in progress. So schedule this scan later*/
2698 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002699 }
2700#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002701 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002702
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 sme_ReleaseGlobalLock( &pMac->sme );
2704 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002705 else
2706 {
2707 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2708 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002710 else
2711 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302712 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
2713 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002714 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002715 } while( 0 );
2716
2717 return (status);
2718
2719
2720}
2721
2722/* ---------------------------------------------------------------------------
2723 \fn sme_ScanGetResult
2724 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002725 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002726 \param pFilter - If pFilter is NULL, all cached results are returned
2727 \param phResult - an object for the result.
2728 \return eHalStatus
2729 ---------------------------------------------------------------------------*/
2730eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2731 tScanResultHandle *phResult)
2732{
2733 eHalStatus status = eHAL_STATUS_FAILURE;
2734 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2735
Katya Nigambcb705f2013-12-26 14:26:22 +05302736 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002737 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002738 smsLog(pMac, LOG2, FL("enter"));
2739 status = sme_AcquireGlobalLock( &pMac->sme );
2740 if ( HAL_STATUS_SUCCESS( status ) )
2741 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002742 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 sme_ReleaseGlobalLock( &pMac->sme );
2744 }
2745 smsLog(pMac, LOG2, FL("exit status %d"), status);
2746
2747 return (status);
2748}
2749
2750
2751/* ---------------------------------------------------------------------------
2752 \fn sme_ScanFlushResult
2753 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002754 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 \return eHalStatus
2756 ---------------------------------------------------------------------------*/
2757eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2758{
2759 eHalStatus status = eHAL_STATUS_FAILURE;
2760 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2761
Katya Nigambcb705f2013-12-26 14:26:22 +05302762 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002763 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 status = sme_AcquireGlobalLock( &pMac->sme );
2765 if ( HAL_STATUS_SUCCESS( status ) )
2766 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002767 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 sme_ReleaseGlobalLock( &pMac->sme );
2769 }
2770
2771 return (status);
2772}
2773
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302774/* ---------------------------------------------------------------------------
2775 \fn sme_FilterScanResults
2776 \brief a wrapper function to request CSR to clear scan results.
2777 This is a synchronous call
2778 \return eHalStatus
2779 ---------------------------------------------------------------------------*/
2780eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2781{
2782 eHalStatus status = eHAL_STATUS_SUCCESS;
2783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2784
2785 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2786 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2787 status = sme_AcquireGlobalLock( &pMac->sme );
2788 if ( HAL_STATUS_SUCCESS( status ) )
2789 {
2790 csrScanFilterResults(pMac);
2791 sme_ReleaseGlobalLock( &pMac->sme );
2792 }
2793
2794 return (status);
2795}
2796
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002797eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2798{
2799 eHalStatus status = eHAL_STATUS_FAILURE;
2800 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2801
Katya Nigambcb705f2013-12-26 14:26:22 +05302802 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002803 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002804 status = sme_AcquireGlobalLock( &pMac->sme );
2805 if ( HAL_STATUS_SUCCESS( status ) )
2806 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302807 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002808 sme_ReleaseGlobalLock( &pMac->sme );
2809 }
2810
2811 return (status);
2812}
Jeff Johnson295189b2012-06-20 16:38:30 -07002813
2814/* ---------------------------------------------------------------------------
2815 \fn sme_ScanResultGetFirst
2816 \brief a wrapper function to request CSR to returns the first element of
2817 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002818 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 \param hScanResult - returned from csrScanGetResult
2820 \return tCsrScanResultInfo * - NULL if no result
2821 ---------------------------------------------------------------------------*/
2822tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2823 tScanResultHandle hScanResult)
2824{
2825 eHalStatus status = eHAL_STATUS_FAILURE;
2826 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2827 tCsrScanResultInfo *pRet = NULL;
2828
Katya Nigambcb705f2013-12-26 14:26:22 +05302829 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002830 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002831 status = sme_AcquireGlobalLock( &pMac->sme );
2832 if ( HAL_STATUS_SUCCESS( status ) )
2833 {
2834 pRet = csrScanResultGetFirst( pMac, hScanResult );
2835 sme_ReleaseGlobalLock( &pMac->sme );
2836 }
2837
2838 return (pRet);
2839}
2840
2841
2842/* ---------------------------------------------------------------------------
2843 \fn sme_ScanResultGetNext
2844 \brief a wrapper function to request CSR to returns the next element of
2845 scan result. It can be called without calling csrScanResultGetFirst
2846 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002847 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 \param hScanResult - returned from csrScanGetResult
2849 \return Null if no result or reach the end
2850 ---------------------------------------------------------------------------*/
2851tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2852 tScanResultHandle hScanResult)
2853{
2854 eHalStatus status = eHAL_STATUS_FAILURE;
2855 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2856 tCsrScanResultInfo *pRet = NULL;
2857
Katya Nigambcb705f2013-12-26 14:26:22 +05302858 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002859 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002860 status = sme_AcquireGlobalLock( &pMac->sme );
2861 if ( HAL_STATUS_SUCCESS( status ) )
2862 {
2863 pRet = csrScanResultGetNext( pMac, hScanResult );
2864 sme_ReleaseGlobalLock( &pMac->sme );
2865 }
2866
2867 return (pRet);
2868}
2869
2870
2871/* ---------------------------------------------------------------------------
2872 \fn sme_ScanSetBGScanparams
2873 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002874 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002875 \param pScanReq - BG scan request structure
2876 \return eHalStatus
2877 ---------------------------------------------------------------------------*/
2878eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2879{
2880 eHalStatus status = eHAL_STATUS_FAILURE;
2881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2882
2883 if( NULL != pScanReq )
2884 {
2885 status = sme_AcquireGlobalLock( &pMac->sme );
2886 if ( HAL_STATUS_SUCCESS( status ) )
2887 {
2888 status = csrScanSetBGScanparams( hHal, pScanReq );
2889 sme_ReleaseGlobalLock( &pMac->sme );
2890 }
2891 }
2892
2893 return (status);
2894}
2895
2896
2897/* ---------------------------------------------------------------------------
2898 \fn sme_ScanResultPurge
2899 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2900 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002901 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002902 \param hScanResult - returned from csrScanGetResult. hScanResult is
2903 considered gone by
2904 calling this function and even before this function reutrns.
2905 \return eHalStatus
2906 ---------------------------------------------------------------------------*/
2907eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2908{
2909 eHalStatus status = eHAL_STATUS_FAILURE;
2910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2911
Katya Nigambcb705f2013-12-26 14:26:22 +05302912 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002913 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002914 status = sme_AcquireGlobalLock( &pMac->sme );
2915 if ( HAL_STATUS_SUCCESS( status ) )
2916 {
2917 status = csrScanResultPurge( hHal, hScanResult );
2918 sme_ReleaseGlobalLock( &pMac->sme );
2919 }
2920
2921 return (status);
2922}
2923
2924/* ---------------------------------------------------------------------------
2925 \fn sme_ScanGetPMKIDCandidateList
2926 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002927 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002928 \param pPmkidList - caller allocated buffer point to an array of
2929 tPmkidCandidateInfo
2930 \param pNumItems - pointer to a variable that has the number of
2931 tPmkidCandidateInfo allocated when retruning, this is
2932 either the number needed or number of items put into
2933 pPmkidList
2934 \return eHalStatus - when fail, it usually means the buffer allocated is not
2935 big enough and pNumItems
2936 has the number of tPmkidCandidateInfo.
2937 \Note: pNumItems is a number of tPmkidCandidateInfo,
2938 not sizeof(tPmkidCandidateInfo) * something
2939 ---------------------------------------------------------------------------*/
2940eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002941 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002942 tANI_U32 *pNumItems )
2943{
2944 eHalStatus status = eHAL_STATUS_FAILURE;
2945 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2946
2947 status = sme_AcquireGlobalLock( &pMac->sme );
2948 if ( HAL_STATUS_SUCCESS( status ) )
2949 {
2950 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2951 sme_ReleaseGlobalLock( &pMac->sme );
2952 }
2953
2954 return (status);
2955}
2956
2957/*----------------------------------------------------------------------------
2958 \fn sme_RoamRegisterLinkQualityIndCallback
2959
2960 \brief
2961 a wrapper function to allow HDD to register a callback handler with CSR for
2962 link quality indications.
2963
2964 Only one callback may be registered at any time.
2965 In order to deregister the callback, a NULL cback may be provided.
2966
2967 Registration happens in the task context of the caller.
2968
2969 \param callback - Call back being registered
2970 \param pContext - user data
2971
2972 DEPENDENCIES: After CSR open
2973
2974 \return eHalStatus
2975-----------------------------------------------------------------------------*/
2976eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2977 csrRoamLinkQualityIndCallback callback,
2978 void *pContext)
2979{
2980 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2981}
2982
2983/* ---------------------------------------------------------------------------
2984 \fn sme_RoamRegisterCallback
2985 \brief a wrapper function to allow HDD to register a callback with CSR.
2986 Unlike scan, roam has one callback for all the roam requests
2987 \param callback - a callback function that roam calls upon when state changes
2988 \param pContext - a pointer passed in for the callback
2989 \return eHalStatus
2990 ---------------------------------------------------------------------------*/
2991eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2992 csrRoamCompleteCallback callback,
2993 void *pContext)
2994{
2995 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2996}
2997
2998eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2999{
3000 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3001 return pMac->roam.configParam.phyMode;
3002}
3003
3004/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303005 \fn sme_GetChannelBondingMode5G
3006 \brief get the channel bonding mode for 5G band
3007 \param hHal - HAL handle
3008 \return channel bonding mode for 5G
3009 ---------------------------------------------------------------------------*/
3010tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3011{
3012 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3013 tSmeConfigParams smeConfig;
3014
3015 sme_GetConfigParam(pMac, &smeConfig);
3016
3017 return smeConfig.csrConfig.channelBondingMode5GHz;
3018}
3019
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303020#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303021/* ---------------------------------------------------------------------------
3022 \fn sme_GetChannelBondingMode24G
3023 \brief get the channel bonding mode for 2.4G band
3024 \param hHal - HAL handle
3025 \return channel bonding mode for 2.4G
3026 ---------------------------------------------------------------------------*/
3027tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3028{
3029 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3030 tSmeConfigParams smeConfig;
3031
3032 sme_GetConfigParam(pMac, &smeConfig);
3033
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303034 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303035}
3036
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303037/* ---------------------------------------------------------------------------
3038 \fn sme_UpdateChannelBondingMode24G
3039 \brief update the channel bonding mode for 2.4G band
3040 \param hHal - HAL handle
3041 \param cbMode - channel bonding mode
3042 \return
3043 ---------------------------------------------------------------------------*/
3044void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3045{
3046 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3047 tSmeConfigParams smeConfig;
3048
3049 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3050 sme_GetConfigParam(pMac, &smeConfig);
3051 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3052 FL("Previous Channel Bonding : = %d"),
3053 smeConfig.csrConfig.channelBondingAPMode24GHz);
3054
3055 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3056 sme_UpdateConfig(hHal, &smeConfig);
3057 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3058 FL("New Channel Bonding : = %d"),
3059 sme_GetChannelBondingMode24G(hHal));
3060 return;
3061}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303062
3063/* ---------------------------------------------------------------------------
3064
3065 \fn sme_SetHT2040Mode
3066
3067 \brief To update HT Operation beacon IE & Channel Bonding.
3068
3069 \param
3070
3071 \return eHalStatus SUCCESS
3072 FAILURE or RESOURCES
3073 The API finished and failed.
3074
3075 -------------------------------------------------------------------------------*/
3076eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3077{
3078 eHalStatus status = eHAL_STATUS_FAILURE;
3079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3080
3081 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3082 FL("Channel Bonding =%d"),
3083 cbMode);
3084
3085 status = sme_AcquireGlobalLock(&pMac->sme);
3086 if (HAL_STATUS_SUCCESS(status))
3087 {
3088 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3089 sme_ReleaseGlobalLock(&pMac->sme );
3090 }
3091 return (status);
3092}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303093#endif
Peng Xu117eab42014-09-25 13:33:27 +05303094
3095/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003096 \fn sme_RoamConnect
3097 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003098 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003099 \param sessionId - the sessionId returned by sme_OpenSession.
3100 \param pProfile - description of the network to which to connect
3101 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3102 from csrScanGetResult
3103 \param pRoamId - to get back the request ID
3104 \return eHalStatus
3105 ---------------------------------------------------------------------------*/
3106eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3107 tANI_U32 *pRoamId)
3108{
3109 eHalStatus status = eHAL_STATUS_FAILURE;
3110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3111
Yue Mae36e3552014-03-05 17:06:20 -08003112 if (!pMac)
3113 {
3114 return eHAL_STATUS_FAILURE;
3115 }
3116
Katya Nigambcb705f2013-12-26 14:26:22 +05303117 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003118 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003119 smsLog(pMac, LOG2, FL("enter"));
3120 status = sme_AcquireGlobalLock( &pMac->sme );
3121 if ( HAL_STATUS_SUCCESS( status ) )
3122 {
3123 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3124 {
3125 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3126 }
3127 else
3128 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003129 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003130 status = eHAL_STATUS_INVALID_PARAMETER;
3131 }
3132 sme_ReleaseGlobalLock( &pMac->sme );
3133 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003134 else
3135 {
3136 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3137 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003138
3139 return (status);
3140}
3141
3142/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303143
3144 \fn sme_SetPhyMode
3145
3146 \brief Changes the PhyMode.
3147
3148 \param hHal - The handle returned by macOpen.
3149
3150 \param phyMode new phyMode which is to set
3151
3152 \return eHalStatus SUCCESS.
3153
3154 -------------------------------------------------------------------------------*/
3155eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3156{
3157 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3158
3159 if (NULL == pMac)
3160 {
3161 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3162 "%s: invalid context", __func__);
3163 return eHAL_STATUS_FAILURE;
3164 }
3165
3166 pMac->roam.configParam.phyMode = phyMode;
3167 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3168 pMac->roam.configParam.phyMode,
3169 pMac->roam.configParam.ProprietaryRatesEnabled);
3170
3171 return eHAL_STATUS_SUCCESS;
3172}
3173
3174/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003175 \fn sme_RoamReassoc
3176 \brief a wrapper function to request CSR to inititiate a re-association
3177 \param pProfile - can be NULL to join the currently connected AP. In that
3178 case modProfileFields should carry the modified field(s) which could trigger
3179 reassoc
3180 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3181 that might need modification dynamically once STA is up & running and this
3182 could trigger a reassoc
3183 \param pRoamId - to get back the request ID
3184 \return eHalStatus
3185 -------------------------------------------------------------------------------*/
3186eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3187 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003188 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003189{
3190 eHalStatus status = eHAL_STATUS_FAILURE;
3191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3192
Katya Nigambcb705f2013-12-26 14:26:22 +05303193 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003194 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003195 smsLog(pMac, LOG2, FL("enter"));
3196 status = sme_AcquireGlobalLock( &pMac->sme );
3197 if ( HAL_STATUS_SUCCESS( status ) )
3198 {
3199 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3200 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003201 if((NULL == pProfile) && (fForce == 1))
3202 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003203 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3204 /* to force the AP initiate fresh 802.1x authentication need to clear
3205 * the PMKID cache for that set the following boolean. this is needed
3206 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3207 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003208 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3209 }
3210 else
3211 {
3212 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003213 }
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_RoamConnectToLastProfile
3227 \brief a wrapper function to request CSR to disconnect and reconnect with
3228 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003229 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003230 \return eHalStatus. It returns fail if currently connected
3231 ---------------------------------------------------------------------------*/
3232eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3233{
3234 eHalStatus status = eHAL_STATUS_FAILURE;
3235 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3236
3237 status = sme_AcquireGlobalLock( &pMac->sme );
3238 if ( HAL_STATUS_SUCCESS( status ) )
3239 {
3240 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3241 {
3242 status = csrRoamConnectToLastProfile( pMac, sessionId );
3243 }
3244 else
3245 {
3246 status = eHAL_STATUS_INVALID_PARAMETER;
3247 }
3248 sme_ReleaseGlobalLock( &pMac->sme );
3249 }
3250
3251 return (status);
3252}
3253
3254/* ---------------------------------------------------------------------------
3255 \fn sme_RoamDisconnect
3256 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003257 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003258 \param reason -- To indicate the reason for disconnecting. Currently, only
3259 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3260 \return eHalStatus
3261 ---------------------------------------------------------------------------*/
3262eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3263{
3264 eHalStatus status = eHAL_STATUS_FAILURE;
3265 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3266
Katya Nigambcb705f2013-12-26 14:26:22 +05303267 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003268 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003269 smsLog(pMac, LOG2, FL("enter"));
3270 status = sme_AcquireGlobalLock( &pMac->sme );
3271 if ( HAL_STATUS_SUCCESS( status ) )
3272 {
3273 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3274 {
3275 status = csrRoamDisconnect( pMac, sessionId, reason );
3276 }
3277 else
3278 {
3279 status = eHAL_STATUS_INVALID_PARAMETER;
3280 }
3281 sme_ReleaseGlobalLock( &pMac->sme );
3282 }
3283
3284 return (status);
3285}
3286
Jeff Johnson295189b2012-06-20 16:38:30 -07003287/* ---------------------------------------------------------------------------
3288 \fn sme_RoamStopBss
3289 \brief To stop BSS for Soft AP. This is an asynchronous API.
3290 \param hHal - Global structure
3291 \param sessionId - sessionId of SoftAP
3292 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3293 -------------------------------------------------------------------------------*/
3294eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3295{
3296 eHalStatus status = eHAL_STATUS_FAILURE;
3297 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3298
3299 smsLog(pMac, LOG2, FL("enter"));
3300 status = sme_AcquireGlobalLock( &pMac->sme );
3301 if ( HAL_STATUS_SUCCESS( status ) )
3302 {
3303 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3304 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303305 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 }
3307 else
3308 {
3309 status = eHAL_STATUS_INVALID_PARAMETER;
3310 }
3311 sme_ReleaseGlobalLock( &pMac->sme );
3312 }
3313
3314 return (status);
3315}
3316
3317/* ---------------------------------------------------------------------------
3318 \fn sme_RoamDisconnectSta
3319 \brief To disassociate a station. This is an asynchronous API.
3320 \param hHal - Global structure
3321 \param sessionId - sessionId of SoftAP
3322 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3323 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3324 -------------------------------------------------------------------------------*/
3325eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3326 tANI_U8 *pPeerMacAddr)
3327{
3328 eHalStatus status = eHAL_STATUS_FAILURE;
3329 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3330
3331 if ( NULL == pMac )
3332 {
3333 VOS_ASSERT(0);
3334 return status;
3335 }
3336
3337 status = sme_AcquireGlobalLock( &pMac->sme );
3338 if ( HAL_STATUS_SUCCESS( status ) )
3339 {
3340 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3341 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003342 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303343 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 }
3345 else
3346 {
3347 status = eHAL_STATUS_INVALID_PARAMETER;
3348 }
3349 sme_ReleaseGlobalLock( &pMac->sme );
3350 }
3351
3352 return (status);
3353}
3354
3355/* ---------------------------------------------------------------------------
3356 \fn sme_RoamDeauthSta
3357 \brief To disassociate a station. This is an asynchronous API.
3358 \param hHal - Global structure
3359 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303360 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003361 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3362 -------------------------------------------------------------------------------*/
3363eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303364 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003365{
3366 eHalStatus status = eHAL_STATUS_FAILURE;
3367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3368
3369 if ( NULL == pMac )
3370 {
3371 VOS_ASSERT(0);
3372 return status;
3373 }
3374
3375 status = sme_AcquireGlobalLock( &pMac->sme );
3376 if ( HAL_STATUS_SUCCESS( status ) )
3377 {
3378 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3379 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303380 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 }
3382 else
3383 {
3384 status = eHAL_STATUS_INVALID_PARAMETER;
3385 }
3386 sme_ReleaseGlobalLock( &pMac->sme );
3387 }
3388
3389 return (status);
3390}
3391
3392/* ---------------------------------------------------------------------------
3393 \fn sme_RoamTKIPCounterMeasures
3394 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3395 \param sessionId - sessionId of SoftAP
3396 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3397 \return eHalStatus
3398 -------------------------------------------------------------------------------*/
3399eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3400 tANI_BOOLEAN bEnable)
3401{
3402 eHalStatus status = eHAL_STATUS_FAILURE;
3403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3404
3405 if ( NULL == pMac )
3406 {
3407 VOS_ASSERT(0);
3408 return status;
3409 }
3410
3411 status = sme_AcquireGlobalLock( &pMac->sme );
3412 if ( HAL_STATUS_SUCCESS( status ) )
3413 {
3414 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3415 {
3416 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3417 }
3418 else
3419 {
3420 status = eHAL_STATUS_INVALID_PARAMETER;
3421 }
3422 sme_ReleaseGlobalLock( &pMac->sme );
3423 }
3424
3425 return (status);
3426}
3427
3428/* ---------------------------------------------------------------------------
3429 \fn sme_RoamGetAssociatedStas
3430 \brief To probe the list of associated stations from various modules of CORE stack.
3431 \This is an asynchronous API.
3432 \param sessionId - sessionId of SoftAP
3433 \param modId - Module from whom list of associtated stations is to be probed.
3434 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3435 \param pUsrContext - Opaque HDD context
3436 \param pfnSapEventCallback - Sap event callback in HDD
3437 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3438 \return eHalStatus
3439 -------------------------------------------------------------------------------*/
3440eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3441 VOS_MODULE_ID modId, void *pUsrContext,
3442 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3443{
3444 eHalStatus status = eHAL_STATUS_FAILURE;
3445 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3446
3447 if ( NULL == pMac )
3448 {
3449 VOS_ASSERT(0);
3450 return status;
3451 }
3452
3453 status = sme_AcquireGlobalLock( &pMac->sme );
3454 if ( HAL_STATUS_SUCCESS( status ) )
3455 {
3456 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3457 {
3458 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3459 }
3460 else
3461 {
3462 status = eHAL_STATUS_INVALID_PARAMETER;
3463 }
3464 sme_ReleaseGlobalLock( &pMac->sme );
3465 }
3466
3467 return (status);
3468}
3469
3470/* ---------------------------------------------------------------------------
3471 \fn sme_RoamGetWpsSessionOverlap
3472 \brief To get the WPS PBC session overlap information.
3473 \This is an asynchronous API.
3474 \param sessionId - sessionId of SoftAP
3475 \param pUsrContext - Opaque HDD context
3476 \param pfnSapEventCallback - Sap event callback in HDD
3477 \pRemoveMac - pointer to Mac address which needs to be removed from session
3478 \return eHalStatus
3479 -------------------------------------------------------------------------------*/
3480eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003481 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003482 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3483{
3484 eHalStatus status = eHAL_STATUS_FAILURE;
3485 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3486
3487 if ( NULL == pMac )
3488 {
3489 VOS_ASSERT(0);
3490 return status;
3491 }
3492
3493 status = sme_AcquireGlobalLock( &pMac->sme );
3494 if ( HAL_STATUS_SUCCESS( status ) )
3495 {
3496 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3497 {
3498 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3499 }
3500 else
3501 {
3502 status = eHAL_STATUS_INVALID_PARAMETER;
3503 }
3504 sme_ReleaseGlobalLock( &pMac->sme );
3505 }
3506
3507 return (status);
3508}
3509
Jeff Johnson295189b2012-06-20 16:38:30 -07003510
3511/* ---------------------------------------------------------------------------
3512 \fn sme_RoamGetConnectState
3513 \brief a wrapper function to request CSR to return the current connect state
3514 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003515 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 \return eHalStatus
3517 ---------------------------------------------------------------------------*/
3518eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3519{
3520 eHalStatus status = eHAL_STATUS_FAILURE;
3521 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3522
3523 status = sme_AcquireGlobalLock( &pMac->sme );
3524 if ( HAL_STATUS_SUCCESS( status ) )
3525 {
3526 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3527 {
3528 status = csrRoamGetConnectState( pMac, sessionId, pState );
3529 }
3530 else
3531 {
3532 status = eHAL_STATUS_INVALID_PARAMETER;
3533 }
3534 sme_ReleaseGlobalLock( &pMac->sme );
3535 }
3536
3537 return (status);
3538}
3539
3540/* ---------------------------------------------------------------------------
3541 \fn sme_RoamGetConnectProfile
3542 \brief a wrapper function to request CSR to return the current connect
3543 profile. Caller must call csrRoamFreeConnectProfile after it is done
3544 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003545 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003546 \param pProfile - pointer to a caller allocated structure
3547 tCsrRoamConnectedProfile
3548 \return eHalStatus. Failure if not connected
3549 ---------------------------------------------------------------------------*/
3550eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3551 tCsrRoamConnectedProfile *pProfile)
3552{
3553 eHalStatus status = eHAL_STATUS_FAILURE;
3554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3555
Katya Nigambcb705f2013-12-26 14:26:22 +05303556 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003557 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003558 status = sme_AcquireGlobalLock( &pMac->sme );
3559 if ( HAL_STATUS_SUCCESS( status ) )
3560 {
3561 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3562 {
3563 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3564 }
3565 else
3566 {
3567 status = eHAL_STATUS_INVALID_PARAMETER;
3568 }
3569 sme_ReleaseGlobalLock( &pMac->sme );
3570 }
3571
3572 return (status);
3573}
3574
3575/* ---------------------------------------------------------------------------
3576 \fn sme_RoamFreeConnectProfile
3577 \brief a wrapper function to request CSR to free and reinitialize the
3578 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003579 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003580 \param pProfile - pointer to a caller allocated structure
3581 tCsrRoamConnectedProfile
3582 \return eHalStatus.
3583 ---------------------------------------------------------------------------*/
3584eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3585 tCsrRoamConnectedProfile *pProfile)
3586{
3587 eHalStatus status = eHAL_STATUS_FAILURE;
3588 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3589
Katya Nigambcb705f2013-12-26 14:26:22 +05303590 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003591 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003592 status = sme_AcquireGlobalLock( &pMac->sme );
3593 if ( HAL_STATUS_SUCCESS( status ) )
3594 {
3595 status = csrRoamFreeConnectProfile( pMac, pProfile );
3596 sme_ReleaseGlobalLock( &pMac->sme );
3597 }
3598
3599 return (status);
3600}
3601
3602/* ---------------------------------------------------------------------------
3603 \fn sme_RoamSetPMKIDCache
3604 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003605 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 \param pPMKIDCache - caller allocated buffer point to an array of
3607 tPmkidCacheInfo
3608 \param numItems - a variable that has the number of tPmkidCacheInfo
3609 allocated when retruning, this is either the number needed
3610 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303611 \param update_entire_cache - this bool value specifies if the entire pmkid
3612 cache should be overwritten or should it be
3613 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 \return eHalStatus - when fail, it usually means the buffer allocated is not
3615 big enough and pNumItems has the number of
3616 tPmkidCacheInfo.
3617 \Note: pNumItems is a number of tPmkidCacheInfo,
3618 not sizeof(tPmkidCacheInfo) * something
3619 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303620eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3621 tPmkidCacheInfo *pPMKIDCache,
3622 tANI_U32 numItems,
3623 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003624{
3625 eHalStatus status = eHAL_STATUS_FAILURE;
3626 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3627
Katya Nigambcb705f2013-12-26 14:26:22 +05303628 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003629 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003630 status = sme_AcquireGlobalLock( &pMac->sme );
3631 if ( HAL_STATUS_SUCCESS( status ) )
3632 {
3633 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3634 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303635 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3636 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 }
3638 else
3639 {
3640 status = eHAL_STATUS_INVALID_PARAMETER;
3641 }
3642 sme_ReleaseGlobalLock( &pMac->sme );
3643 }
3644
3645 return (status);
3646}
3647
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303648eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
3649 tANI_U8 *pBSSId,
3650 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003651{
3652 eHalStatus status = eHAL_STATUS_FAILURE;
3653 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3654 status = sme_AcquireGlobalLock( &pMac->sme );
3655 if ( HAL_STATUS_SUCCESS( status ) )
3656 {
3657 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3658 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303659 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
3660 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003661 }
3662 else
3663 {
3664 status = eHAL_STATUS_INVALID_PARAMETER;
3665 }
3666 sme_ReleaseGlobalLock( &pMac->sme );
3667 }
3668 return (status);
3669}
Wilson Yang47b58192013-12-11 11:40:19 -08003670
Jeff Johnson295189b2012-06-20 16:38:30 -07003671/* ---------------------------------------------------------------------------
3672 \fn sme_RoamGetSecurityReqIE
3673 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3674 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003675 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003676 \param pLen - caller allocated memory that has the length of pBuf as input.
3677 Upon returned, *pLen has the needed or IE length in pBuf.
3678 \param pBuf - Caller allocated memory that contain the IE field, if any,
3679 upon return
3680 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3681 \return eHalStatus - when fail, it usually means the buffer allocated is not
3682 big enough
3683 ---------------------------------------------------------------------------*/
3684eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3685 tANI_U8 *pBuf, eCsrSecurityType secType)
3686{
3687 eHalStatus status = eHAL_STATUS_FAILURE;
3688 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3689
3690 status = sme_AcquireGlobalLock( &pMac->sme );
3691 if ( HAL_STATUS_SUCCESS( status ) )
3692 {
3693 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3694 {
3695 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3696 }
3697 else
3698 {
3699 status = eHAL_STATUS_INVALID_PARAMETER;
3700 }
3701 sme_ReleaseGlobalLock( &pMac->sme );
3702 }
3703
3704 return (status);
3705}
3706
3707/* ---------------------------------------------------------------------------
3708 \fn sme_RoamGetSecurityRspIE
3709 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3710 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003711 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 \param pLen - caller allocated memory that has the length of pBuf as input.
3713 Upon returned, *pLen has the needed or IE length in pBuf.
3714 \param pBuf - Caller allocated memory that contain the IE field, if any,
3715 upon return
3716 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3717 \return eHalStatus - when fail, it usually means the buffer allocated is not
3718 big enough
3719 ---------------------------------------------------------------------------*/
3720eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3721 tANI_U8 *pBuf, eCsrSecurityType secType)
3722{
3723 eHalStatus status = eHAL_STATUS_FAILURE;
3724 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3725
3726 status = sme_AcquireGlobalLock( &pMac->sme );
3727 if ( HAL_STATUS_SUCCESS( status ) )
3728 {
3729 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3730 {
3731 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3732 }
3733 else
3734 {
3735 status = eHAL_STATUS_INVALID_PARAMETER;
3736 }
3737 sme_ReleaseGlobalLock( &pMac->sme );
3738 }
3739
3740 return (status);
3741
3742}
3743
3744
3745/* ---------------------------------------------------------------------------
3746 \fn sme_RoamGetNumPMKIDCache
3747 \brief a wrapper function to request CSR to return number of PMKID cache
3748 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003749 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 \return tANI_U32 - the number of PMKID cache entries
3751 ---------------------------------------------------------------------------*/
3752tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3753{
3754 eHalStatus status = eHAL_STATUS_FAILURE;
3755 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3756 tANI_U32 numPmkidCache = 0;
3757
3758 status = sme_AcquireGlobalLock( &pMac->sme );
3759 if ( HAL_STATUS_SUCCESS( status ) )
3760 {
3761 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3762 {
3763 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3764 status = eHAL_STATUS_SUCCESS;
3765 }
3766 else
3767 {
3768 status = eHAL_STATUS_INVALID_PARAMETER;
3769 }
3770 sme_ReleaseGlobalLock( &pMac->sme );
3771 }
3772
3773 return (numPmkidCache);
3774}
3775
3776/* ---------------------------------------------------------------------------
3777 \fn sme_RoamGetPMKIDCache
3778 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003779 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 \param pNum - caller allocated memory that has the space of the number of
3781 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3782 needed or actually number in tPmkidCacheInfo.
3783 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3784 any, upon return
3785 \return eHalStatus - when fail, it usually means the buffer allocated is not
3786 big enough
3787 ---------------------------------------------------------------------------*/
3788eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3789 tPmkidCacheInfo *pPmkidCache)
3790{
3791 eHalStatus status = eHAL_STATUS_FAILURE;
3792 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3793
3794 status = sme_AcquireGlobalLock( &pMac->sme );
3795 if ( HAL_STATUS_SUCCESS( status ) )
3796 {
3797 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3798 {
3799 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3800 }
3801 else
3802 {
3803 status = eHAL_STATUS_INVALID_PARAMETER;
3804 }
3805 sme_ReleaseGlobalLock( &pMac->sme );
3806 }
3807
3808 return (status);
3809}
3810
3811
3812/* ---------------------------------------------------------------------------
3813 \fn sme_GetConfigParam
3814 \brief a wrapper function that HDD calls to get the global settings
3815 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003816 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003817 \param pParam - caller allocated memory
3818 \return eHalStatus
3819 ---------------------------------------------------------------------------*/
3820eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3821{
3822 eHalStatus status = eHAL_STATUS_FAILURE;
3823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3824
Katya Nigambcb705f2013-12-26 14:26:22 +05303825 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003826 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003827 status = sme_AcquireGlobalLock( &pMac->sme );
3828 if ( HAL_STATUS_SUCCESS( status ) )
3829 {
3830 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3831 if (status != eHAL_STATUS_SUCCESS)
3832 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003833 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003834 sme_ReleaseGlobalLock( &pMac->sme );
3835 return status;
3836 }
3837#if defined WLAN_FEATURE_P2P_INTERNAL
3838 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3839 if (status != eHAL_STATUS_SUCCESS)
3840 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003841 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003842 sme_ReleaseGlobalLock( &pMac->sme );
3843 return status;
3844 }
3845#endif
3846 sme_ReleaseGlobalLock( &pMac->sme );
3847 }
3848
3849 return (status);
3850}
3851
3852/* ---------------------------------------------------------------------------
3853 \fn sme_CfgSetInt
3854 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003855 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003856 \param cfgId - Configuration Parameter ID (type) for STA.
3857 \param ccmValue - The information related to Configuration Parameter ID
3858 which needs to be saved in CFG
3859 \param callback - To be registered by CSR with CCM. Once the CFG done with
3860 saving the information in the database, it notifies CCM &
3861 then the callback will be invoked to notify.
3862 \param toBeSaved - To save the request for future reference
3863 \return eHalStatus
3864 ---------------------------------------------------------------------------*/
3865eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3866 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3867{
3868 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3869}
3870
3871/* ---------------------------------------------------------------------------
3872 \fn sme_CfgSetStr
3873 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003874 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003875 \param cfgId - Configuration Parameter ID (type) for STA.
3876 \param pStr - Pointer to the byte array which carries the information needs
3877 to be saved in CFG
3878 \param length - Length of the data to be saved
3879 \param callback - To be registered by CSR with CCM. Once the CFG done with
3880 saving the information in the database, it notifies CCM &
3881 then the callback will be invoked to notify.
3882 \param toBeSaved - To save the request for future reference
3883 \return eHalStatus
3884 ---------------------------------------------------------------------------*/
3885eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3886 tANI_U32 length, tCcmCfgSetCallback callback,
3887 eAniBoolean toBeSaved)
3888{
3889 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3890}
3891
3892/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05303893 \fn sme_GetModifyProfileFields
3894 \brief HDD or SME - QOS calls this function to get the current values of
3895 connected profile fields, changing which can cause reassoc.
3896 This function must be called after CFG is downloaded and STA is in connected
3897 state. Also, make sure to call this function to get the current profile
3898 fields before calling the reassoc. So that pModifyProfileFields will have
3899 all the latest values plus the one(s) has been updated as part of reassoc
3900 request.
3901 \param pModifyProfileFields - pointer to the connected profile fields
3902 changing which can cause reassoc
3903
3904 \return eHalStatus
3905 -------------------------------------------------------------------------------*/
3906eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3907 tCsrRoamModifyProfileFields * pModifyProfileFields)
3908{
3909 eHalStatus status = eHAL_STATUS_FAILURE;
3910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3911
3912 MTRACE(vos_trace(VOS_MODULE_ID_SME,
3913 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
3914 status = sme_AcquireGlobalLock( &pMac->sme );
3915 if ( HAL_STATUS_SUCCESS( status ) )
3916 {
3917 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3918 {
3919 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3920 }
3921 else
3922 {
3923 status = eHAL_STATUS_INVALID_PARAMETER;
3924 }
3925 sme_ReleaseGlobalLock( &pMac->sme );
3926 }
3927
3928 return (status);
3929}
3930
3931/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303932 \fn sme_HT40StopOBSSScan
3933 \brief HDD or SME - Command to stop the OBSS scan
3934 THis is implemented only for debugging purpose.
3935 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3936 \param sessionId - sessionId
3937 changing which can cause reassoc
3938
3939 \return eHalStatus
3940 -------------------------------------------------------------------------------*/
3941eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3942{
3943 eHalStatus status = eHAL_STATUS_FAILURE;
3944 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3945
3946 smsLog(pMac, LOG2, FL("enter"));
3947 status = sme_AcquireGlobalLock( &pMac->sme );
3948 if ( HAL_STATUS_SUCCESS( status ) )
3949 {
3950 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3951 {
3952 csrHT40StopOBSSScan( pMac, sessionId );
3953 }
3954 else
3955 {
3956 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3957 "%s: Invalid session sessionId %d", __func__,sessionId);
3958 status = eHAL_STATUS_INVALID_PARAMETER;
3959 }
3960 sme_ReleaseGlobalLock( &pMac->sme );
3961 }
3962 return (status);
3963}
3964
Jeff Johnson295189b2012-06-20 16:38:30 -07003965/*--------------------------------------------------------------------------
3966 \fn sme_SetConfigPowerSave
3967 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3968 For BMPS related configuration, this function also updates the CFG
3969 and sends a message to FW to pick up the new values. Note: Calling
3970 this function only updates the configuration and does not enable
3971 the specified power save mode.
3972 \param hHal - The handle returned by macOpen.
3973 \param psMode - Power Saving mode being modified
3974 \param pConfigParams - a pointer to a caller allocated object of type
3975 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3976 \return eHalStatus
3977 --------------------------------------------------------------------------*/
3978eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3979 void *pConfigParams)
3980{
3981 eHalStatus status = eHAL_STATUS_FAILURE;
3982 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3983
Katya Nigambcb705f2013-12-26 14:26:22 +05303984 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003985 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 if (NULL == pConfigParams ) {
3987 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3988 "nothing to update");
3989 return eHAL_STATUS_FAILURE;
3990 }
3991
3992 status = sme_AcquireGlobalLock( &pMac->sme );
3993 if ( HAL_STATUS_SUCCESS( status ) )
3994 {
3995 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3996 sme_ReleaseGlobalLock( &pMac->sme );
3997 }
3998
3999 return (status);
4000}
4001
4002/*--------------------------------------------------------------------------
4003 \fn sme_GetConfigPowerSave
4004 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4005 \param hHal - The handle returned by macOpen.
4006 \param psMode - Power Saving mode
4007 \param pConfigParams - a pointer to a caller allocated object of type
4008 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4009 \return eHalStatus
4010 --------------------------------------------------------------------------*/
4011eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4012 void *pConfigParams)
4013{
4014 eHalStatus status = eHAL_STATUS_FAILURE;
4015 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4016
Katya Nigambcb705f2013-12-26 14:26:22 +05304017 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004018 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 if (NULL == pConfigParams ) {
4020 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4021 "nothing to update");
4022 return eHAL_STATUS_FAILURE;
4023 }
4024
4025 status = sme_AcquireGlobalLock( &pMac->sme );
4026 if ( HAL_STATUS_SUCCESS( status ) )
4027 {
4028 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4029 sme_ReleaseGlobalLock( &pMac->sme );
4030 }
4031
4032 return (status);
4033}
4034
4035/* ---------------------------------------------------------------------------
4036 \fn sme_SignalPowerEvent
4037 \brief Signals to PMC that a power event has occurred. Used for putting
4038 the chip into deep sleep mode.
4039 \param hHal - The handle returned by macOpen.
4040 \param event - the event that has occurred
4041 \return eHalStatus
4042 ---------------------------------------------------------------------------*/
4043eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4044{
4045 eHalStatus status = eHAL_STATUS_FAILURE;
4046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4047
4048 status = sme_AcquireGlobalLock( &pMac->sme );
4049 if ( HAL_STATUS_SUCCESS( status ) )
4050 {
4051 status = pmcSignalPowerEvent(hHal, event);
4052 sme_ReleaseGlobalLock( &pMac->sme );
4053 }
4054
4055 return (status);
4056}
4057
4058/* ---------------------------------------------------------------------------
4059 \fn sme_EnablePowerSave
4060 \brief Enables one of the power saving modes.
4061 \param hHal - The handle returned by macOpen.
4062 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4063 while the chip is operating in Full Power, PMC will start
4064 a timer that will try to put the chip in BMPS mode after
4065 expiry.
4066 \return eHalStatus
4067 ---------------------------------------------------------------------------*/
4068eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4069{
4070 eHalStatus status = eHAL_STATUS_FAILURE;
4071 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4072
Katya Nigambcb705f2013-12-26 14:26:22 +05304073 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004074 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004075 status = sme_AcquireGlobalLock( &pMac->sme );
4076 if ( HAL_STATUS_SUCCESS( status ) )
4077 {
4078 status = pmcEnablePowerSave(hHal, psMode);
4079 sme_ReleaseGlobalLock( &pMac->sme );
4080 }
4081
4082 return (status);
4083}
4084
4085/* ---------------------------------------------------------------------------
4086 \fn sme_DisablePowerSave
4087 \brief Disables one of the power saving modes.
4088 \param hHal - The handle returned by macOpen.
4089 \param psMode - The power saving mode to disable. Disabling does not imply
4090 that device will be brought out of the current PS mode. This
4091 is purely a configuration API.
4092 \return eHalStatus
4093 ---------------------------------------------------------------------------*/
4094eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4095{
4096 eHalStatus status = eHAL_STATUS_FAILURE;
4097 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4098
Katya Nigambcb705f2013-12-26 14:26:22 +05304099 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004100 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 status = sme_AcquireGlobalLock( &pMac->sme );
4102 if ( HAL_STATUS_SUCCESS( status ) )
4103 {
4104 status = pmcDisablePowerSave(hHal, psMode);
4105 sme_ReleaseGlobalLock( &pMac->sme );
4106 }
4107
4108 return (status);
4109 }
4110
4111/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304112+ \fn sme_SetHostPowerSave
4113+ \brief Enables BMPS logic to be controlled by User level apps
4114+ \param hHal - The handle returned by macOpen.
4115+ \param psMode - The power saving mode to disable. Disabling does not imply
4116+ that device will be brought out of the current PS mode. This
4117+ is purely a configuration API.
4118+ \return eHalStatus
4119+ ---------------------------------------------------------------------------*/
4120eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4121{
4122 eHalStatus status = eHAL_STATUS_FAILURE;
4123 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4124
4125 pMac->pmc.isHostPsEn = psMode;
4126
4127 return (status);
4128}
4129
4130/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 \fn sme_StartAutoBmpsTimer
4132 \brief Starts a timer that periodically polls all the registered
4133 module for entry into Bmps mode. This timer is started only if BMPS is
4134 enabled and whenever the device is in full power.
4135 \param hHal - The handle returned by macOpen.
4136 \return eHalStatus
4137 ---------------------------------------------------------------------------*/
4138eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4139{
4140 eHalStatus status = eHAL_STATUS_FAILURE;
4141 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4142
Katya Nigambcb705f2013-12-26 14:26:22 +05304143 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004144 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004145 status = sme_AcquireGlobalLock( &pMac->sme );
4146 if ( HAL_STATUS_SUCCESS( status ) )
4147 {
4148 status = pmcStartAutoBmpsTimer(hHal);
4149 sme_ReleaseGlobalLock( &pMac->sme );
4150 }
4151
4152 return (status);
4153}
4154/* ---------------------------------------------------------------------------
4155 \fn sme_StopAutoBmpsTimer
4156 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4157 Stopping the timer does not cause a device state change. Only the timer
4158 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4159 \param hHal - The handle returned by macOpen.
4160 \return eHalStatus
4161 ---------------------------------------------------------------------------*/
4162eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4163{
4164 eHalStatus status = eHAL_STATUS_FAILURE;
4165 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4166
Katya Nigambcb705f2013-12-26 14:26:22 +05304167 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004168 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004169 status = sme_AcquireGlobalLock( &pMac->sme );
4170 if ( HAL_STATUS_SUCCESS( status ) )
4171 {
4172 status = pmcStopAutoBmpsTimer(hHal);
4173 sme_ReleaseGlobalLock( &pMac->sme );
4174 }
4175
4176 return (status);
4177}
4178/* ---------------------------------------------------------------------------
4179 \fn sme_QueryPowerState
4180 \brief Returns the current power state of the device.
4181 \param hHal - The handle returned by macOpen.
4182 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4183 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4184 \return eHalStatus
4185 ---------------------------------------------------------------------------*/
4186eHalStatus sme_QueryPowerState (
4187 tHalHandle hHal,
4188 tPmcPowerState *pPowerState,
4189 tPmcSwitchState *pSwWlanSwitchState)
4190{
4191 eHalStatus status = eHAL_STATUS_FAILURE;
4192 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4193
4194 status = sme_AcquireGlobalLock( &pMac->sme );
4195 if ( HAL_STATUS_SUCCESS( status ) )
4196 {
4197 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4198 sme_ReleaseGlobalLock( &pMac->sme );
4199 }
4200
4201 return (status);
4202}
4203
4204/* ---------------------------------------------------------------------------
4205 \fn sme_IsPowerSaveEnabled
4206 \brief Checks if the device is able to enter a particular power save mode
4207 This does not imply that the device is in a particular PS mode
4208 \param hHal - The handle returned by macOpen.
4209 \param psMode - the power saving mode
4210 \return eHalStatus
4211 ---------------------------------------------------------------------------*/
4212tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4213{
4214 eHalStatus status = eHAL_STATUS_FAILURE;
4215 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4216 tANI_BOOLEAN result = false;
4217
Katya Nigambcb705f2013-12-26 14:26:22 +05304218 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004219 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 status = sme_AcquireGlobalLock( &pMac->sme );
4221 if ( HAL_STATUS_SUCCESS( status ) )
4222 {
4223 result = pmcIsPowerSaveEnabled(hHal, psMode);
4224 sme_ReleaseGlobalLock( &pMac->sme );
4225 return result;
4226 }
4227
4228 return false;
4229}
4230
4231/* ---------------------------------------------------------------------------
4232 \fn sme_RequestFullPower
4233 \brief Request that the device be brought to full power state. When the
4234 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4235 is enabled. On timer expiry PMC will attempt to put the device in
4236 BMPS mode if following holds true:
4237 - BMPS mode is enabled
4238 - Polling of all modules through the Power Save Check routine passes
4239 - STA is associated to an access point
4240 \param hHal - The handle returned by macOpen.
4241 \param - callbackRoutine Callback routine invoked in case of success/failure
4242 \return eHalStatus - status
4243 eHAL_STATUS_SUCCESS - device brought to full power state
4244 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4245 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4246 ---------------------------------------------------------------------------*/
4247eHalStatus sme_RequestFullPower (
4248 tHalHandle hHal,
4249 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4250 void *callbackContext,
4251 tRequestFullPowerReason fullPowerReason)
4252{
4253 eHalStatus status = eHAL_STATUS_FAILURE;
4254 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4255
Katya Nigambcb705f2013-12-26 14:26:22 +05304256 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004257 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 status = sme_AcquireGlobalLock( &pMac->sme );
4259 if ( HAL_STATUS_SUCCESS( status ) )
4260 {
4261 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4262 sme_ReleaseGlobalLock( &pMac->sme );
4263 }
4264
4265 return (status);
4266}
4267
4268/* ---------------------------------------------------------------------------
4269 \fn sme_RequestBmps
4270 \brief Request that the device be put in BMPS state. Request will be
4271 accepted only if BMPS mode is enabled and power save check routine
4272 passes.
4273 \param hHal - The handle returned by macOpen.
4274 \param - callbackRoutine Callback routine invoked in case of success/failure
4275 \return eHalStatus
4276 eHAL_STATUS_SUCCESS - device is in BMPS state
4277 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4278 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4279 ---------------------------------------------------------------------------*/
4280eHalStatus sme_RequestBmps (
4281 tHalHandle hHal,
4282 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4283 void *callbackContext)
4284{
4285 eHalStatus status = eHAL_STATUS_FAILURE;
4286 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4287
Katya Nigambcb705f2013-12-26 14:26:22 +05304288 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004289 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 status = sme_AcquireGlobalLock( &pMac->sme );
4291 if ( HAL_STATUS_SUCCESS( status ) )
4292 {
4293 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4294 sme_ReleaseGlobalLock( &pMac->sme );
4295 }
4296
4297 return (status);
4298}
4299
4300
4301/* ---------------------------------------------------------------------------
4302 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004303 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4304 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004305 \param hHal - The handle returned by macOpen.
4306 ---------------------------------------------------------------------------*/
4307void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4308{
4309 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4310
Katya Nigambcb705f2013-12-26 14:26:22 +05304311 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004312 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4314 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4315}
4316
4317
4318/* ---------------------------------------------------------------------------
4319 \fn sme_StartUapsd
4320 \brief Request that the device be put in UAPSD state. If the device is in
4321 Full Power it will be put in BMPS mode first and then into UAPSD
4322 mode.
4323 \param hHal - The handle returned by macOpen.
4324 \param - callbackRoutine Callback routine invoked in case of success/failure
4325 eHAL_STATUS_SUCCESS - device is in UAPSD state
4326 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4327 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4328 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4329 \return eHalStatus
4330 ---------------------------------------------------------------------------*/
4331eHalStatus sme_StartUapsd (
4332 tHalHandle hHal,
4333 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4334 void *callbackContext)
4335{
4336 eHalStatus status = eHAL_STATUS_FAILURE;
4337 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4338
4339 status = sme_AcquireGlobalLock( &pMac->sme );
4340 if ( HAL_STATUS_SUCCESS( status ) )
4341 {
4342 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4343 sme_ReleaseGlobalLock( &pMac->sme );
4344 }
4345
4346 return (status);
4347 }
4348
4349/* ---------------------------------------------------------------------------
4350 \fn sme_StopUapsd
4351 \brief Request that the device be put out of UAPSD state. Device will be
4352 put in in BMPS state after stop UAPSD completes.
4353 \param hHal - The handle returned by macOpen.
4354 \return eHalStatus
4355 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4356 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4357 ---------------------------------------------------------------------------*/
4358eHalStatus sme_StopUapsd (tHalHandle hHal)
4359{
4360 eHalStatus status = eHAL_STATUS_FAILURE;
4361 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4362
4363 status = sme_AcquireGlobalLock( &pMac->sme );
4364 if ( HAL_STATUS_SUCCESS( status ) )
4365 {
4366 status = pmcStopUapsd(hHal);
4367 sme_ReleaseGlobalLock( &pMac->sme );
4368 }
4369
4370 return (status);
4371}
4372
4373/* ---------------------------------------------------------------------------
4374 \fn sme_RequestStandby
4375 \brief Request that the device be put in standby. It is HDD's responsibility
4376 to bring the chip to full power and do a disassoc before calling
4377 this API.
4378 \param hHal - The handle returned by macOpen.
4379 \param - callbackRoutine Callback routine invoked in case of success/failure
4380 \return eHalStatus
4381 eHAL_STATUS_SUCCESS - device is in Standby mode
4382 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4383 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4384 ---------------------------------------------------------------------------*/
4385eHalStatus sme_RequestStandby (
4386 tHalHandle hHal,
4387 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4388 void *callbackContext)
4389{
4390 eHalStatus status = eHAL_STATUS_FAILURE;
4391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4392
Katya Nigambcb705f2013-12-26 14:26:22 +05304393 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004394 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304395 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 status = sme_AcquireGlobalLock( &pMac->sme );
4397 if ( HAL_STATUS_SUCCESS( status ) )
4398 {
4399 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4400 sme_ReleaseGlobalLock( &pMac->sme );
4401 }
4402
4403 return (status);
4404}
4405
4406/* ---------------------------------------------------------------------------
4407 \fn sme_RegisterPowerSaveCheck
4408 \brief Register a power save check routine that is called whenever
4409 the device is about to enter one of the power save modes.
4410 \param hHal - The handle returned by macOpen.
4411 \param checkRoutine - Power save check routine to be registered
4412 \return eHalStatus
4413 eHAL_STATUS_SUCCESS - successfully registered
4414 eHAL_STATUS_FAILURE - not successfully registered
4415 ---------------------------------------------------------------------------*/
4416eHalStatus sme_RegisterPowerSaveCheck (
4417 tHalHandle hHal,
4418 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4419{
4420 eHalStatus status = eHAL_STATUS_FAILURE;
4421 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4422
4423 status = sme_AcquireGlobalLock( &pMac->sme );
4424 if ( HAL_STATUS_SUCCESS( status ) )
4425 {
4426 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4427 sme_ReleaseGlobalLock( &pMac->sme );
4428 }
4429
4430 return (status);
4431}
4432
4433/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304434 \fn sme_Register11dScanDoneCallback
4435 \brief Register a routine of type csrScanCompleteCallback which is
4436 called whenever an 11d scan is done
4437 \param hHal - The handle returned by macOpen.
4438 \param callback - 11d scan complete routine to be registered
4439 \return eHalStatus
4440 ---------------------------------------------------------------------------*/
4441eHalStatus sme_Register11dScanDoneCallback (
4442 tHalHandle hHal,
4443 csrScanCompleteCallback callback)
4444{
4445 eHalStatus status = eHAL_STATUS_SUCCESS;
4446 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4447
4448 pMac->scan.callback11dScanDone = callback;
4449
4450 return (status);
4451}
4452
4453/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004454 \fn sme_DeregisterPowerSaveCheck
4455 \brief Deregister a power save check routine
4456 \param hHal - The handle returned by macOpen.
4457 \param checkRoutine - Power save check routine to be deregistered
4458 \return eHalStatus
4459 eHAL_STATUS_SUCCESS - successfully deregistered
4460 eHAL_STATUS_FAILURE - not successfully deregistered
4461 ---------------------------------------------------------------------------*/
4462eHalStatus sme_DeregisterPowerSaveCheck (
4463 tHalHandle hHal,
4464 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4465{
4466 eHalStatus status = eHAL_STATUS_FAILURE;
4467 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4468
4469 status = sme_AcquireGlobalLock( &pMac->sme );
4470 if ( HAL_STATUS_SUCCESS( status ) )
4471 {
4472 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4473 sme_ReleaseGlobalLock( &pMac->sme );
4474 }
4475
4476 return (status);
4477}
4478
4479/* ---------------------------------------------------------------------------
4480 \fn sme_RegisterDeviceStateUpdateInd
4481 \brief Register a callback routine that is called whenever
4482 the device enters a new device state (Full Power, BMPS, UAPSD)
4483 \param hHal - The handle returned by macOpen.
4484 \param callbackRoutine - Callback routine to be registered
4485 \param callbackContext - Cookie to be passed back during callback
4486 \return eHalStatus
4487 eHAL_STATUS_SUCCESS - successfully registered
4488 eHAL_STATUS_FAILURE - not successfully registered
4489 ---------------------------------------------------------------------------*/
4490eHalStatus sme_RegisterDeviceStateUpdateInd (
4491 tHalHandle hHal,
4492 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4493 void *callbackContext)
4494{
4495 eHalStatus status = eHAL_STATUS_FAILURE;
4496 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4497
4498 status = sme_AcquireGlobalLock( &pMac->sme );
4499 if ( HAL_STATUS_SUCCESS( status ) )
4500 {
4501 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4502 sme_ReleaseGlobalLock( &pMac->sme );
4503 }
4504
4505 return (status);
4506}
4507
4508/* ---------------------------------------------------------------------------
4509 \fn sme_DeregisterDeviceStateUpdateInd
4510 \brief Deregister a routine that was registered for device state changes
4511 \param hHal - The handle returned by macOpen.
4512 \param callbackRoutine - Callback routine to be deregistered
4513 \return eHalStatus
4514 eHAL_STATUS_SUCCESS - successfully deregistered
4515 eHAL_STATUS_FAILURE - not successfully deregistered
4516 ---------------------------------------------------------------------------*/
4517eHalStatus sme_DeregisterDeviceStateUpdateInd (
4518 tHalHandle hHal,
4519 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4520{
4521 eHalStatus status = eHAL_STATUS_FAILURE;
4522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4523
4524 status = sme_AcquireGlobalLock( &pMac->sme );
4525 if ( HAL_STATUS_SUCCESS( status ) )
4526 {
4527 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4528 sme_ReleaseGlobalLock( &pMac->sme );
4529 }
4530
4531 return (status);
4532}
4533
4534/* ---------------------------------------------------------------------------
4535 \fn sme_WowlAddBcastPattern
4536 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4537 do a pattern match on these patterns when Wowl is enabled during BMPS
4538 mode. Note that Firmware performs the pattern matching only on
4539 broadcast frames and while Libra is in BMPS mode.
4540 \param hHal - The handle returned by macOpen.
4541 \param pattern - Pattern to be added
4542 \return eHalStatus
4543 eHAL_STATUS_FAILURE Cannot add pattern
4544 eHAL_STATUS_SUCCESS Request accepted.
4545 ---------------------------------------------------------------------------*/
4546eHalStatus sme_WowlAddBcastPattern (
4547 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004548 tpSirWowlAddBcastPtrn pattern,
4549 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004550{
4551 eHalStatus status = eHAL_STATUS_FAILURE;
4552 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304553 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004554 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004555 status = sme_AcquireGlobalLock( &pMac->sme );
4556 if ( HAL_STATUS_SUCCESS( status ) )
4557 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004558 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004559 sme_ReleaseGlobalLock( &pMac->sme );
4560 }
4561
4562 return (status);
4563}
4564
4565/* ---------------------------------------------------------------------------
4566 \fn sme_WowlDelBcastPattern
4567 \brief Delete a pattern that was added for Pattern Byte Matching.
4568 \param hHal - The handle returned by macOpen.
4569 \param pattern - Pattern to be deleted
4570 \return eHalStatus
4571 eHAL_STATUS_FAILURE Cannot delete pattern
4572 eHAL_STATUS_SUCCESS Request accepted.
4573 ---------------------------------------------------------------------------*/
4574eHalStatus sme_WowlDelBcastPattern (
4575 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004576 tpSirWowlDelBcastPtrn pattern,
4577 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004578{
4579 eHalStatus status = eHAL_STATUS_FAILURE;
4580 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304581 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004582 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 status = sme_AcquireGlobalLock( &pMac->sme );
4584 if ( HAL_STATUS_SUCCESS( status ) )
4585 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004586 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004587 sme_ReleaseGlobalLock( &pMac->sme );
4588 }
4589
4590 return (status);
4591}
4592
4593/* ---------------------------------------------------------------------------
4594 \fn sme_EnterWowl
4595 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4596 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4597 SME will will cache the information that WOWL has been enabled and
4598 attempt to put the device in BMPS. On entry into BMPS, SME will
4599 enable the WOWL mode.
4600 Note 1: If we exit BMPS mode (someone requests full power), we
4601 will NOT resume WOWL when we go back to BMPS again. Request for full
4602 power (while in WOWL mode) means disable WOWL and go to full power.
4603 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4604 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4605 are required. Currently there is no requirement or use case to support
4606 UAPSD and WOWL at the same time.
4607
4608 \param hHal - The handle returned by macOpen.
4609 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4610 Used for success/failure notification by SME
4611 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4612 at the time of callback.
4613 \param wakeReasonIndCB - Callback routine provided by HDD.
4614 Used for Wake Reason Indication by SME
4615 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4616 at the time of callback.
4617 \return eHalStatus
4618 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4619 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4620 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4621 BMPS mode is entered.
4622 ---------------------------------------------------------------------------*/
4623eHalStatus sme_EnterWowl (
4624 tHalHandle hHal,
4625 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4626 void *enterWowlCallbackContext,
4627#ifdef WLAN_WAKEUP_EVENTS
4628 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4629 void *wakeIndicationCBContext,
4630#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004631 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004632{
4633 eHalStatus status = eHAL_STATUS_FAILURE;
4634 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304635 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004636 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004637 status = sme_AcquireGlobalLock( &pMac->sme );
4638 if ( HAL_STATUS_SUCCESS( status ) )
4639 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004640 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004641#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004642 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004643#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004644 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 sme_ReleaseGlobalLock( &pMac->sme );
4646 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004647 return (status);
4648}
4649/* ---------------------------------------------------------------------------
4650 \fn sme_ExitWowl
4651 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4652 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4653 mode.
4654 \param hHal - The handle returned by macOpen.
4655 \return eHalStatus
4656 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4657 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4658 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05304659eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004660{
4661 eHalStatus status = eHAL_STATUS_FAILURE;
4662 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304663 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004664 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004665 status = sme_AcquireGlobalLock( &pMac->sme );
4666 if ( HAL_STATUS_SUCCESS( status ) )
4667 {
c_hpothu01484c02014-05-16 14:05:15 +05304668 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004669 sme_ReleaseGlobalLock( &pMac->sme );
4670 }
4671
4672 return (status);
4673}
4674
4675/* ---------------------------------------------------------------------------
4676
4677 \fn sme_RoamSetKey
4678
4679 \brief To set encryption key. This function should be called only when connected
4680 This is an asynchronous API.
4681
4682 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4683
4684 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4685
4686 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4687
4688 FAILURE or RESOURCES The API finished and failed.
4689
4690 -------------------------------------------------------------------------------*/
4691eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4692{
4693 eHalStatus status = eHAL_STATUS_FAILURE;
4694 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4695 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 tANI_U32 i;
4697 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004698
Katya Nigambcb705f2013-12-26 14:26:22 +05304699 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004700 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004701 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4702 {
4703 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4704 return eHAL_STATUS_FAILURE;
4705 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304706 /*Once Setkey is done, we can go in BMPS*/
4707 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304708 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304709 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304710 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4711 " to allow BMPS"));
4712 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004713
Jeff Johnson295189b2012-06-20 16:38:30 -07004714 status = sme_AcquireGlobalLock( &pMac->sme );
4715 if ( HAL_STATUS_SUCCESS( status ) )
4716 {
4717 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4718 if(pRoamId)
4719 {
4720 *pRoamId = roamId;
4721 }
4722
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004723 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004724
4725 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004726 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004727
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004728 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004729
4730 pSession = CSR_GET_SESSION(pMac, sessionId);
4731
Jeff Johnson32d95a32012-09-10 13:15:23 -07004732 if(!pSession)
4733 {
4734 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004735 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004736 return eHAL_STATUS_FAILURE;
4737 }
4738
Jeff Johnson295189b2012-06-20 16:38:30 -07004739 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4740 {
4741 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4742 {
4743 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4744 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4745 {
4746 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4747 }
4748 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4749 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4750 {
4751 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4752 }
4753 }
4754 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004755
4756 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4757 sme_ReleaseGlobalLock( &pMac->sme );
4758 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304759#ifdef DEBUG_ROAM_DELAY
4760 //Store sent PTK key time
4761 if(pSetKey->keyDirection == eSIR_TX_RX)
4762 {
4763 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4764 }
4765 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4766 {
4767 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4768 }
4769 else
4770 {
4771 return (status);
4772 }
4773#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004774
4775 return (status);
4776}
4777
4778
4779/* ---------------------------------------------------------------------------
4780
4781 \fn sme_RoamRemoveKey
4782
4783 \brief To set encryption key. This is an asynchronous API.
4784
4785 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4786
4787 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4788
4789 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4790
4791 FAILURE or RESOURCES The API finished and failed.
4792
4793 -------------------------------------------------------------------------------*/
4794eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4795 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4796{
4797 eHalStatus status = eHAL_STATUS_FAILURE;
4798 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4799 tANI_U32 roamId;
4800
Katya Nigambcb705f2013-12-26 14:26:22 +05304801 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004802 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 status = sme_AcquireGlobalLock( &pMac->sme );
4804 if ( HAL_STATUS_SUCCESS( status ) )
4805 {
4806 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4807 if(pRoamId)
4808 {
4809 *pRoamId = roamId;
4810 }
4811 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4812 sme_ReleaseGlobalLock( &pMac->sme );
4813 }
4814
4815 return (status);
4816}
4817
4818/* ---------------------------------------------------------------------------
4819 \fn sme_GetRssi
4820 \brief a wrapper function that client calls to register a callback to get RSSI
4821
4822 \param callback - SME sends back the requested stats using the callback
4823 \param staId - The station ID for which the stats is requested for
4824 \param pContext - user context to be passed back along with the callback
4825 \param pVosContext - vos context
4826 \return eHalStatus
4827 ---------------------------------------------------------------------------*/
4828eHalStatus sme_GetRssi(tHalHandle hHal,
4829 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004830 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004831 void *pContext, void* pVosContext)
4832{
4833 eHalStatus status = eHAL_STATUS_FAILURE;
4834 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4835
4836 status = sme_AcquireGlobalLock( &pMac->sme );
4837 if ( HAL_STATUS_SUCCESS( status ) )
4838 {
4839 status = csrGetRssi( pMac, callback,
4840 staId, bssId, pContext, pVosContext);
4841 sme_ReleaseGlobalLock( &pMac->sme );
4842 }
4843 return (status);
4844}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304845
4846/* ---------------------------------------------------------------------------
4847 \fn sme_GetSnr
4848 \brief a wrapper function that client calls to register a callback to
4849 get SNR
4850
4851 \param callback - SME sends back the requested stats using the callback
4852 \param staId - The station ID for which the stats is requested for
4853 \param pContext - user context to be passed back along with the callback
4854 \param pVosContext - vos context
4855 \return eHalStatus
4856 ---------------------------------------------------------------------------*/
4857eHalStatus sme_GetSnr(tHalHandle hHal,
4858 tCsrSnrCallback callback,
4859 tANI_U8 staId, tCsrBssid bssId,
4860 void *pContext)
4861{
4862 eHalStatus status = eHAL_STATUS_FAILURE;
4863 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4864
4865 status = sme_AcquireGlobalLock( &pMac->sme );
4866 if ( HAL_STATUS_SUCCESS( status ) )
4867 {
4868 status = csrGetSnr(pMac, callback,
4869 staId, bssId, pContext);
4870 sme_ReleaseGlobalLock( &pMac->sme );
4871 }
4872 return status;
4873}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004874#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004875/* ---------------------------------------------------------------------------
4876 \fn sme_GetRoamRssi
4877 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4878
4879 \param callback - SME sends back the requested stats using the callback
4880 \param staId - The station ID for which the stats is requested for
4881 \param pContext - user context to be passed back along with the callback
4882 \param pVosContext - vos context
4883 \return eHalStatus
4884 ---------------------------------------------------------------------------*/
4885eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4886 tCsrRssiCallback callback,
4887 tANI_U8 staId, tCsrBssid bssId,
4888 void *pContext, void* pVosContext)
4889{
4890 eHalStatus status = eHAL_STATUS_FAILURE;
4891 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4892
4893 status = sme_AcquireGlobalLock( &pMac->sme );
4894 if ( HAL_STATUS_SUCCESS( status ) )
4895 {
4896 status = csrGetRoamRssi( pMac, callback,
4897 staId, bssId, pContext, pVosContext);
4898 sme_ReleaseGlobalLock( &pMac->sme );
4899 }
4900 return (status);
4901}
4902#endif
4903
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004904#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004905/* ---------------------------------------------------------------------------
4906 \fn sme_GetTsmStats
4907 \brief a wrapper function that client calls to register a callback to get TSM Stats
4908
4909 \param callback - SME sends back the requested stats using the callback
4910 \param staId - The station ID for which the stats is requested for
4911 \param pContext - user context to be passed back along with the callback
4912 \param pVosContext - vos context
4913 \return eHalStatus
4914 ---------------------------------------------------------------------------*/
4915eHalStatus sme_GetTsmStats(tHalHandle hHal,
4916 tCsrTsmStatsCallback callback,
4917 tANI_U8 staId, tCsrBssid bssId,
4918 void *pContext, void* pVosContext, tANI_U8 tid)
4919{
4920 eHalStatus status = eHAL_STATUS_FAILURE;
4921 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4922
4923 status = sme_AcquireGlobalLock( &pMac->sme );
4924 if ( HAL_STATUS_SUCCESS( status ) )
4925 {
4926 status = csrGetTsmStats( pMac, callback,
4927 staId, bssId, pContext, pVosContext, tid);
4928 sme_ReleaseGlobalLock( &pMac->sme );
4929 }
4930 return (status);
4931}
4932#endif
4933
4934
Jeff Johnson295189b2012-06-20 16:38:30 -07004935/* ---------------------------------------------------------------------------
4936 \fn sme_GetStatistics
4937 \brief a wrapper function that client calls to register a callback to get
4938 different PHY level statistics from CSR.
4939
4940 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4941 \param statsMask - The different category/categories of stats requester is looking for
4942 \param callback - SME sends back the requested stats using the callback
4943 \param periodicity - If requester needs periodic update in millisec, 0 means
4944 it's an one time request
4945 \param cache - If requester is happy with cached stats
4946 \param staId - The station ID for which the stats is requested for
4947 \param pContext - user context to be passed back along with the callback
4948 \return eHalStatus
4949 ---------------------------------------------------------------------------*/
4950eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4951 tANI_U32 statsMask,
4952 tCsrStatsCallback callback,
4953 tANI_U32 periodicity, tANI_BOOLEAN cache,
4954 tANI_U8 staId, void *pContext)
4955{
4956 eHalStatus status = eHAL_STATUS_FAILURE;
4957 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4958
Katya Nigambcb705f2013-12-26 14:26:22 +05304959 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004960 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 status = sme_AcquireGlobalLock( &pMac->sme );
4962 if ( HAL_STATUS_SUCCESS( status ) )
4963 {
4964 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4965 periodicity, cache, staId, pContext);
4966 sme_ReleaseGlobalLock( &pMac->sme );
4967 }
4968
4969 return (status);
4970
4971}
4972
4973/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304974 \fn smeGetTLSTAState
4975 \helper function to get the TL STA State whenever the function is called.
4976
4977 \param staId - The staID to be passed to the TL
4978 to get the relevant TL STA State
4979 \return the state as tANI_U16
4980 ---------------------------------------------------------------------------*/
4981tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4982{
4983 tANI_U16 tlSTAState = TL_INIT_STATE;
4984 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4985 eHalStatus status = eHAL_STATUS_FAILURE;
4986
4987 status = sme_AcquireGlobalLock( &pMac->sme );
4988 if ( HAL_STATUS_SUCCESS( status ) )
4989 {
4990 tlSTAState = csrGetTLSTAState( pMac, staId);
4991 sme_ReleaseGlobalLock( &pMac->sme );
4992 }
4993
4994 return tlSTAState;
4995}
4996
4997/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004998
4999 \fn sme_GetCountryCode
5000
5001 \brief To return the current country code. If no country code is applied, default country code is
5002 used to fill the buffer.
5003 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5004 This is a synchronous API.
5005
5006 \param pBuf - pointer to a caller allocated buffer for returned country code.
5007
5008 \param pbLen For input, this parameter indicates how big is the buffer.
5009 Upon return, this parameter has the number of bytes for country. If pBuf
5010 doesn't have enough space, this function returns
5011 fail status and this parameter contains the number that is needed.
5012
5013 \return eHalStatus SUCCESS.
5014
5015 FAILURE or RESOURCES The API finished and failed.
5016
5017 -------------------------------------------------------------------------------*/
5018eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5019{
5020 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5021
Katya Nigambcb705f2013-12-26 14:26:22 +05305022 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005023 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5024
Jeff Johnson295189b2012-06-20 16:38:30 -07005025 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5026}
5027
5028
5029/* ---------------------------------------------------------------------------
5030
5031 \fn sme_SetCountryCode
5032
5033 \brief To change the current/default country code.
5034 If 11d supported is turned off, an error is return.
5035 This is a synchronous API.
5036
5037 \param pCountry - pointer to a caller allocated buffer for the country code.
5038
5039 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5040 whether a reset is required.
5041
5042 \return eHalStatus SUCCESS.
5043
5044 FAILURE or RESOURCES The API finished and failed.
5045
5046 -------------------------------------------------------------------------------*/
5047eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5048{
5049 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5050
Katya Nigambcb705f2013-12-26 14:26:22 +05305051 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005052 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005053 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5054}
5055
5056
5057/* ---------------------------------------------------------------------------
5058 \fn sme_ResetCountryCodeInformation
5059 \brief this function is to reset the country code current being used back to EEPROM default
5060 this includes channel list and power setting. This is a synchronous API.
5061 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5062 a restart is needed to apply the change
5063 \return eHalStatus
5064 -------------------------------------------------------------------------------*/
5065eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5066{
5067 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5068
5069 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5070}
5071
5072
5073/* ---------------------------------------------------------------------------
5074 \fn sme_GetSupportedCountryCode
5075 \brief this function is to get a list of the country code current being supported
5076 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5077 this has the country code list. 3 bytes for each country code. This may be NULL if
5078 caller wants to know the needed byte count.
5079 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5080 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5081 \return eHalStatus
5082 -------------------------------------------------------------------------------*/
5083eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5084{
5085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5086
5087 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5088}
5089
5090
5091/* ---------------------------------------------------------------------------
5092 \fn sme_GetCurrentRegulatoryDomain
5093 \brief this function is to get the current regulatory domain. This is a synchronous API.
5094 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5095 SME. The function fails if 11d support is turned off.
5096 \param pDomain - Caller allocated buffer to return the current domain.
5097 \return eHalStatus SUCCESS.
5098
5099 FAILURE or RESOURCES The API finished and failed.
5100 -------------------------------------------------------------------------------*/
5101eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5102{
5103 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5104 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5105
5106 if( pDomain )
5107 {
5108 if( csrIs11dSupported( pMac ) )
5109 {
5110 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5111 status = eHAL_STATUS_SUCCESS;
5112 }
5113 else
5114 {
5115 status = eHAL_STATUS_FAILURE;
5116 }
5117 }
5118
5119 return ( status );
5120}
5121
5122
5123/* ---------------------------------------------------------------------------
5124 \fn sme_SetRegulatoryDomain
5125 \brief this function is to set the current regulatory domain.
5126 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5127 SME. This is a synchronous API.
5128 \param domainId - indicate the domain (defined in the driver) needs to set to.
5129 See v_REGDOMAIN_t for definition
5130 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5131 a restart is needed to apply the change
5132 \return eHalStatus
5133 -------------------------------------------------------------------------------*/
5134eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5135{
5136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5137
5138 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5139}
5140
5141
5142/* ---------------------------------------------------------------------------
5143
5144 \fn sme_GetRegulatoryDomainForCountry
5145
5146 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5147
5148 \param pCountry - pointer to a caller allocated buffer for input country code.
5149
5150 \param pDomainId Upon successful return, it is the domain that country belongs to.
5151 If it is NULL, returning success means that the country code is known.
5152
5153 \return eHalStatus SUCCESS.
5154
5155 FAILURE or RESOURCES The API finished and failed.
5156
5157 -------------------------------------------------------------------------------*/
5158eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5159{
5160 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5161
Kiet Lam6c583332013-10-14 05:37:09 +05305162 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5163 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005164}
5165
5166
5167
5168
5169/* ---------------------------------------------------------------------------
5170
5171 \fn sme_GetSupportedRegulatoryDomains
5172
5173 \brief To return a list of supported regulatory domains. This is a synchronous API.
5174
5175 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5176
5177 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5178 Upon return, this parameter has the number for supported domains. If pDomains
5179 doesn't have enough space for all the supported domains, this function returns
5180 fail status and this parameter contains the number that is needed.
5181
5182 \return eHalStatus SUCCESS.
5183
5184 FAILURE or RESOURCES The API finished and failed.
5185
5186 -------------------------------------------------------------------------------*/
5187eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5188{
5189 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5190
5191 //We support all domains for now
5192 if( pNumDomains )
5193 {
5194 if( NUM_REG_DOMAINS <= *pNumDomains )
5195 {
5196 status = eHAL_STATUS_SUCCESS;
5197 }
5198 *pNumDomains = NUM_REG_DOMAINS;
5199 }
5200 if( HAL_STATUS_SUCCESS( status ) )
5201 {
5202 if( pDomains )
5203 {
5204 pDomains[0] = REGDOMAIN_FCC;
5205 pDomains[1] = REGDOMAIN_ETSI;
5206 pDomains[2] = REGDOMAIN_JAPAN;
5207 pDomains[3] = REGDOMAIN_WORLD;
5208 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5209 pDomains[5] = REGDOMAIN_APAC;
5210 pDomains[6] = REGDOMAIN_KOREA;
5211 pDomains[7] = REGDOMAIN_HI_5GHZ;
5212 pDomains[8] = REGDOMAIN_NO_5GHZ;
5213 }
5214 else
5215 {
5216 status = eHAL_STATUS_INVALID_PARAMETER;
5217 }
5218 }
5219
5220 return ( status );
5221}
5222
5223
5224//some support functions
5225tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5226{
5227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5228
5229 return ( csrIs11dSupported( pMac ) );
5230}
5231
5232
5233tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5234{
5235 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5236
5237 return ( csrIs11hSupported( pMac ) );
5238}
5239
5240
5241tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5242{
5243 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5244
5245 return ( csrIsWmmSupported( pMac ) );
5246}
5247
5248//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5249eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5250{
5251 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5252
5253 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5254}
5255
5256/* ---------------------------------------------------------------------------
5257
5258 \fn sme_ChangeCountryCode
5259
5260 \brief Change Country code from upperlayer during WLAN driver operation.
5261 This is a synchronous API.
5262
5263 \param hHal - The handle returned by macOpen.
5264
5265 \param pCountry New Country Code String
5266
Abhishek Singha306a442013-11-07 18:39:01 +05305267 \param sendRegHint If we want to send reg hint to nl80211
5268
Jeff Johnson295189b2012-06-20 16:38:30 -07005269 \return eHalStatus SUCCESS.
5270
5271 FAILURE or RESOURCES The API finished and failed.
5272
5273 -------------------------------------------------------------------------------*/
5274eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5275 tSmeChangeCountryCallback callback,
5276 tANI_U8 *pCountry,
5277 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305278 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305279 tAniBool countryFromUserSpace,
5280 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005281{
5282 eHalStatus status = eHAL_STATUS_FAILURE;
5283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5284 vos_msg_t msg;
5285 tAniChangeCountryCodeReq *pMsg;
5286
Katya Nigambcb705f2013-12-26 14:26:22 +05305287 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005288 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005289 status = sme_AcquireGlobalLock( &pMac->sme );
5290 if ( HAL_STATUS_SUCCESS( status ) )
5291 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005292 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005293
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305294 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005295 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5296 {
5297
5298 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5299
5300 sme_ReleaseGlobalLock( &pMac->sme );
5301 status = eHAL_STATUS_FAILURE;
5302 return status;
5303 }
5304
Kiet Lam64c1b492013-07-12 13:56:44 +05305305 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5306 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005307 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005308 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005309 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305310 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005311 }
5312
5313 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5314 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305315 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305316 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305317 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005318 pMsg->changeCCCallback = callback;
5319 pMsg->pDevContext = pContext;
5320 pMsg->pVosContext = pVosContext;
5321
5322 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5323 msg.bodyptr = pMsg;
5324 msg.reserved = 0;
5325
5326 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5327 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005328 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305329 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005330 status = eHAL_STATUS_FAILURE;
5331 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005332 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005333 sme_ReleaseGlobalLock( &pMac->sme );
5334 }
5335
5336 return (status);
5337}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005338
5339/*--------------------------------------------------------------------------
5340
5341 \fn sme_GenericChangeCountryCode
5342
5343 \brief Change Country code from upperlayer during WLAN driver operation.
5344 This is a synchronous API.
5345
5346 \param hHal - The handle returned by macOpen.
5347
5348 \param pCountry New Country Code String
5349
5350 \param reg_domain regulatory domain
5351
5352 \return eHalStatus SUCCESS.
5353
5354 FAILURE or RESOURCES The API finished and failed.
5355
5356-----------------------------------------------------------------------------*/
5357eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5358 tANI_U8 *pCountry,
5359 v_REGDOMAIN_t reg_domain)
5360{
5361 eHalStatus status = eHAL_STATUS_FAILURE;
5362 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5363 vos_msg_t msg;
5364 tAniGenericChangeCountryCodeReq *pMsg;
5365
Kiet Lamcffc5862013-10-30 16:28:45 +05305366 if (NULL == pMac)
5367 {
5368 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5369 "%s: pMac is null", __func__);
5370 return status;
5371 }
5372
Amar Singhal0d15bd52013-10-12 23:13:13 -07005373 status = sme_AcquireGlobalLock( &pMac->sme );
5374 if ( HAL_STATUS_SUCCESS( status ) )
5375 {
5376 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305377 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5378 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005379 {
5380 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5381 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305382 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005383 }
5384
5385 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5386 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005387 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305388
5389 pMsg->countryCode[2] = ' '; /* For ASCII space */
5390
Amar Singhal0d15bd52013-10-12 23:13:13 -07005391 pMsg->domain_index = reg_domain;
5392
5393 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5394 msg.bodyptr = pMsg;
5395 msg.reserved = 0;
5396
5397 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5398 {
5399 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305400 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005401 status = eHAL_STATUS_FAILURE;
5402 }
5403 smsLog(pMac, LOG1, FL(" returned"));
5404 sme_ReleaseGlobalLock( &pMac->sme );
5405 }
5406
5407 return (status);
5408}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305409
5410/* ---------------------------------------------------------------------------
5411
5412 \fn sme_InitChannels
5413
5414 \brief Used to initialize CSR channel lists while driver loading
5415
5416 \param hHal - global pMac structure
5417
5418 \return eHalStatus SUCCESS.
5419
5420 FAILURE or RESOURCES The API finished and failed.
5421
5422 -------------------------------------------------------------------------------*/
5423eHalStatus sme_InitChannels(tHalHandle hHal)
5424{
5425 eHalStatus status = eHAL_STATUS_FAILURE;
5426 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5427
5428 if (NULL == pMac)
5429 {
5430 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5431 "%s: pMac is null", __func__);
5432 return status;
5433 }
5434
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305435 status = csrInitChannels(pMac);
5436
Mihir Shetee1093ba2014-01-21 20:13:32 +05305437 return status;
5438}
5439
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305440/*-------------------------------------------------------------------------
5441 \fn sme_InitChannelsForCC
5442
5443 \brief Used to issue regulatory hint to user
5444
5445 \param hHal - global pMac structure
5446
5447 \return eHalStatus SUCCESS.
5448
5449 FAILURE or RESOURCES The API finished and failed.
5450--------------------------------------------------------------------------*/
5451
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305452eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305453{
5454 eHalStatus status = eHAL_STATUS_FAILURE;
5455 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5456
5457 if (NULL == pMac)
5458 {
5459 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5460 "%s: pMac is null", __func__);
5461 return status;
5462 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305463 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305464
5465 return status;
5466}
5467
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305468/* ---------------------------------------------------------------------------
5469
5470 \fn sme_DHCPStartInd
5471
5472 \brief API to signal the FW about the DHCP Start event.
5473
5474 \param hHal - HAL handle for device.
5475
5476 \param device_mode - mode(AP,SAP etc) of the device.
5477
5478 \param macAddr - MAC address of the device.
5479
5480 \return eHalStatus SUCCESS.
5481
5482 FAILURE or RESOURCES The API finished and failed.
5483 --------------------------------------------------------------------------*/
5484eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5485 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305486 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305487{
5488 eHalStatus status;
5489 VOS_STATUS vosStatus;
5490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5491 vos_msg_t vosMessage;
5492 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305493 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305494
5495 status = sme_AcquireGlobalLock(&pMac->sme);
5496 if ( eHAL_STATUS_SUCCESS == status)
5497 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305498 pSession = CSR_GET_SESSION( pMac, sessionId );
5499
5500 if (!pSession)
5501 {
5502 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5503 sme_ReleaseGlobalLock( &pMac->sme );
5504 return eHAL_STATUS_FAILURE;
5505 }
5506
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305507 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5508 if (NULL == pMsg)
5509 {
5510 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5511 "%s: Not able to allocate memory for dhcp start", __func__);
5512 sme_ReleaseGlobalLock( &pMac->sme );
5513 return eHAL_STATUS_FAILURE;
5514 }
5515 pMsg->msgType = WDA_DHCP_START_IND;
5516 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5517 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305518 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5519 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305520 vosMessage.type = WDA_DHCP_START_IND;
5521 vosMessage.bodyptr = pMsg;
5522 vosMessage.reserved = 0;
5523
5524 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5525 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5526 {
5527 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5528 "%s: Post DHCP Start MSG fail", __func__);
5529 vos_mem_free(pMsg);
5530 status = eHAL_STATUS_FAILURE;
5531 }
5532 sme_ReleaseGlobalLock( &pMac->sme );
5533 }
5534 return (status);
5535}
5536/* ---------------------------------------------------------------------------
5537 \fn sme_DHCPStopInd
5538
5539 \brief API to signal the FW about the DHCP complete event.
5540
5541 \param hHal - HAL handle for device.
5542
5543 \param device_mode - mode(AP, SAP etc) of the device.
5544
5545 \param macAddr - MAC address of the device.
5546
5547 \return eHalStatus SUCCESS.
5548 FAILURE or RESOURCES The API finished and failed.
5549 --------------------------------------------------------------------------*/
5550eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5551 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305552 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305553{
5554 eHalStatus status;
5555 VOS_STATUS vosStatus;
5556 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5557 vos_msg_t vosMessage;
5558 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305559 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305560
5561 status = sme_AcquireGlobalLock(&pMac->sme);
5562 if ( eHAL_STATUS_SUCCESS == status)
5563 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305564 pSession = CSR_GET_SESSION( pMac, sessionId );
5565
5566 if (!pSession)
5567 {
5568 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5569 sme_ReleaseGlobalLock( &pMac->sme );
5570 return eHAL_STATUS_FAILURE;
5571 }
5572
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305573 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5574 if (NULL == pMsg)
5575 {
5576 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5577 "%s: Not able to allocate memory for dhcp stop", __func__);
5578 sme_ReleaseGlobalLock( &pMac->sme );
5579 return eHAL_STATUS_FAILURE;
5580 }
5581
5582 pMsg->msgType = WDA_DHCP_STOP_IND;
5583 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5584 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305585 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5586 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305587
5588 vosMessage.type = WDA_DHCP_STOP_IND;
5589 vosMessage.bodyptr = pMsg;
5590 vosMessage.reserved = 0;
5591
5592 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5593 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5594 {
5595 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5596 "%s: Post DHCP Stop MSG fail", __func__);
5597 vos_mem_free(pMsg);
5598 status = eHAL_STATUS_FAILURE;
5599 }
5600
5601 sme_ReleaseGlobalLock( &pMac->sme );
5602 }
5603 return (status);
5604}
5605
Jeff Johnson295189b2012-06-20 16:38:30 -07005606
5607/* ---------------------------------------------------------------------------
5608 \fn sme_BtcSignalBtEvent
5609 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5610 BT event type and the current operating mode of Libra (full power,
5611 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5612 would be employed.
5613 \param hHal - The handle returned by macOpen.
5614 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5615 Caller owns the memory and is responsible for freeing it.
5616 \return VOS_STATUS
5617 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5618 if BTC execution mode is set to BTC_WLAN_ONLY
5619 or BTC_PTA_ONLY.
5620 VOS_STATUS_SUCCESS BT Event passed to HAL
5621 ---------------------------------------------------------------------------*/
5622VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5623{
5624 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005625
Jeff Johnson295189b2012-06-20 16:38:30 -07005626#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5628
Katya Nigambcb705f2013-12-26 14:26:22 +05305629 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005630 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005631 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5632 {
5633 status = btcSignalBTEvent (hHal, pBtEvent);
5634 sme_ReleaseGlobalLock( &pMac->sme );
5635 }
5636#endif
5637 return (status);
5638}
5639
5640/* ---------------------------------------------------------------------------
5641 \fn sme_BtcSetConfig
5642 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5643 This function should be invoked only after CFG download has completed.
5644 Calling it after sme_HDDReadyInd is recommended.
5645 \param hHal - The handle returned by macOpen.
5646 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5647 Caller owns the memory and is responsible for freeing it.
5648 \return VOS_STATUS
5649 VOS_STATUS_E_FAILURE Config not passed to HAL.
5650 VOS_STATUS_SUCCESS Config passed to HAL
5651 ---------------------------------------------------------------------------*/
5652VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5653{
5654 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5655#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5656 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305657 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005658 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005659 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5660 {
5661 status = btcSetConfig (hHal, pSmeBtcConfig);
5662 sme_ReleaseGlobalLock( &pMac->sme );
5663 }
5664#endif
5665 return (status);
5666}
5667
5668/* ---------------------------------------------------------------------------
5669 \fn sme_BtcGetConfig
5670 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5671 \param hHal - The handle returned by macOpen.
5672 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5673 tSmeBtcConfig. Caller owns the memory and is responsible
5674 for freeing it.
5675 \return VOS_STATUS
5676 VOS_STATUS_E_FAILURE - failure
5677 VOS_STATUS_SUCCESS success
5678 ---------------------------------------------------------------------------*/
5679VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5680{
5681 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5682#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5683 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5684
Katya Nigambcb705f2013-12-26 14:26:22 +05305685 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005686 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005687 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5688 {
5689 status = btcGetConfig (hHal, pSmeBtcConfig);
5690 sme_ReleaseGlobalLock( &pMac->sme );
5691 }
5692#endif
5693 return (status);
5694}
5695/* ---------------------------------------------------------------------------
5696 \fn sme_SetCfgPrivacy
5697 \brief API to set configure privacy parameters
5698 \param hHal - The handle returned by macOpen.
5699 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005700 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005701
5702 \return void
5703 ---------------------------------------------------------------------------*/
5704void sme_SetCfgPrivacy( tHalHandle hHal,
5705 tCsrRoamProfile *pProfile,
5706 tANI_BOOLEAN fPrivacy
5707 )
5708{
5709 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305710 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005711 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005712 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5713 {
5714 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5715 sme_ReleaseGlobalLock( &pMac->sme );
5716 }
5717}
5718
5719#if defined WLAN_FEATURE_VOWIFI
5720/* ---------------------------------------------------------------------------
5721 \fn sme_NeighborReportRequest
5722 \brief API to request neighbor report.
5723 \param hHal - The handle returned by macOpen.
5724 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5725 tRrmNeighborReq. Caller owns the memory and is responsible
5726 for freeing it.
5727 \return VOS_STATUS
5728 VOS_STATUS_E_FAILURE - failure
5729 VOS_STATUS_SUCCESS success
5730 ---------------------------------------------------------------------------*/
5731VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5732 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5733{
5734 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5735 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305736 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005737 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005738
5739 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5740 {
5741 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5742 sme_ReleaseGlobalLock( &pMac->sme );
5743 }
5744
5745 return (status);
5746}
5747#endif
5748
5749//The following are debug APIs to support direct read/write register/memory
5750//They are placed in SME because HW cannot be access when in LOW_POWER state
5751//AND not connected. The knowledge and synchronization is done in SME
5752
5753//sme_DbgReadRegister
5754//Caller needs to validate the input values
5755VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5756{
5757 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5758 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005759 tPmcPowerState PowerState;
5760 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305761 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005762 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005763
5764 /* 1) To make Quarky work in FTM mode **************************************/
5765
5766 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5767 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005768 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
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 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005788 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005789 {
5790 status = VOS_STATUS_SUCCESS;
5791 }
5792 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005793 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005794 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 *pRegValue = 0xDEADBEEF;
5808 status = VOS_STATUS_SUCCESS;
5809 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005810
Jeff Johnson295189b2012-06-20 16:38:30 -07005811 /* Release SME global lock */
5812 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005813
Jeff Johnson295189b2012-06-20 16:38:30 -07005814 return (status);
5815}
5816
5817
5818//sme_DbgWriteRegister
5819//Caller needs to validate the input values
5820VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5821{
5822 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5823 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005824 tPmcPowerState PowerState;
5825 tANI_U32 sessionId = 0;
5826
5827 /* 1) To make Quarky work in FTM mode **************************************/
5828
Katya Nigambcb705f2013-12-26 14:26:22 +05305829 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005830 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005831 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5832 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005833 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
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 == wpalDbgWriteRegister(regAddr, regValue))
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 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005867
Jeff Johnson295189b2012-06-20 16:38:30 -07005868 /* Release SME 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
5875
5876//sme_DbgReadMemory
5877//Caller needs to validate the input values
5878//pBuf caller allocated buffer has the length of nLen
5879VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5880{
5881 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5882 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005883 tPmcPowerState PowerState;
5884 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005885 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5886 tANI_U32 arg1 = memAddr;
5887 tANI_U32 arg2 = nLen/4;
5888 tANI_U32 arg3 = 4;
5889 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005890 /* 1) To make Quarky work in FTM mode **************************************/
5891
Katya Nigambcb705f2013-12-26 14:26:22 +05305892 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005893 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005894 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5895 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005896 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005897 {
5898 return VOS_STATUS_SUCCESS;
5899 }
5900 return VOS_STATUS_E_FAILURE;
5901 }
5902
5903 /* 2) NON FTM mode driver *************************************************/
5904
5905 /* Acquire SME global lock */
5906 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5907 {
5908 return VOS_STATUS_E_FAILURE;
5909 }
5910
5911 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5912 {
5913 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5914 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5915 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005916 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005917 {
5918 status = VOS_STATUS_SUCCESS;
5919 }
5920 else
5921 {
5922 status = VOS_STATUS_E_FAILURE;
5923 }
5924 }
5925 else
5926 {
5927 status = VOS_STATUS_E_FAILURE;
5928 }
5929 }
5930
5931 /* This is a hack for Qualky/pttWniSocket
5932 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5933 if (VOS_STATUS_SUCCESS != status)
5934 {
5935 vos_mem_set(pBuf, nLen, 0xCD);
5936 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005937 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005938 }
5939
5940 /* Release SME lock */
5941 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005942
Jeff Johnson295189b2012-06-20 16:38:30 -07005943 return (status);
5944}
5945
5946
5947//sme_DbgWriteMemory
5948//Caller needs to validate the input values
5949VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5950{
5951 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5952 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005953 tPmcPowerState PowerState;
5954 tANI_U32 sessionId = 0;
5955
5956 /* 1) To make Quarky work in FTM mode **************************************/
5957
Katya Nigambcb705f2013-12-26 14:26:22 +05305958 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005959 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5961 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005962 {
5963 return VOS_STATUS_SUCCESS;
5964 }
5965 return VOS_STATUS_E_FAILURE;
5966 }
5967
5968 /* 2) NON FTM mode driver *************************************************/
5969
5970 /* Acquire SME global lock */
5971 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5972 {
5973 return VOS_STATUS_E_FAILURE;
5974 }
5975
5976 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5977 {
5978 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5979 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5980 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005981 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005982 {
5983 status = VOS_STATUS_SUCCESS;
5984 }
5985 else
5986 {
5987 status = VOS_STATUS_E_FAILURE;
5988 }
5989 }
5990 else
5991 {
5992 status = VOS_STATUS_E_FAILURE;
5993 }
5994 }
5995
5996 /* Release Global lock */
5997 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005998
Jeff Johnson295189b2012-06-20 16:38:30 -07005999 return (status);
6000}
6001
6002
Katya Nigam70d68332013-09-16 16:49:45 +05306003void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6004{
6005 VOS_TRACE_LEVEL vosDebugLevel;
6006 char logBuffer[LOG_SIZE];
6007 va_list marker;
6008
6009 /* getting proper Debug level */
6010 vosDebugLevel = getVosDebugLevel(loglevel);
6011
6012 /* extracting arguments from pstring */
6013 va_start( marker, pString );
6014 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6015
6016 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6017 va_end( marker );
6018}
6019
6020
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006021void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006022{
6023#ifdef WLAN_DEBUG
6024 // Verify against current log level
6025 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6026 return;
6027 else
6028 {
6029 va_list marker;
6030
6031 va_start( marker, pString ); /* Initialize variable arguments. */
6032
6033 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6034
6035 va_end( marker ); /* Reset variable arguments. */
6036 }
6037#endif
6038}
Jeff Johnson295189b2012-06-20 16:38:30 -07006039
Jeff Johnson295189b2012-06-20 16:38:30 -07006040/* ---------------------------------------------------------------------------
6041 \fn sme_GetWcnssWlanCompiledVersion
6042 \brief This API returns the version of the WCNSS WLAN API with
6043 which the HOST driver was built
6044 \param hHal - The handle returned by macOpen.
6045 \param pVersion - Points to the Version structure to be filled
6046 \return VOS_STATUS
6047 VOS_STATUS_E_INVAL - failure
6048 VOS_STATUS_SUCCESS success
6049 ---------------------------------------------------------------------------*/
6050VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6051 tSirVersionType *pVersion)
6052{
6053 VOS_STATUS status = VOS_STATUS_SUCCESS;
6054 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6055 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6056
6057 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6058 {
6059 if( pVersion != NULL )
6060 {
6061 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6062 }
6063 else
6064 {
6065 status = VOS_STATUS_E_INVAL;
6066 }
6067 sme_ReleaseGlobalLock( &pMac->sme );
6068 }
6069
6070 return (status);
6071}
6072
6073
6074/* ---------------------------------------------------------------------------
6075 \fn sme_GetWcnssWlanReportedVersion
6076 \brief This API returns the version of the WCNSS WLAN API with
6077 which the WCNSS driver reports it was built
6078 \param hHal - The handle returned by macOpen.
6079 \param pVersion - Points to the Version structure to be filled
6080 \return VOS_STATUS
6081 VOS_STATUS_E_INVAL - failure
6082 VOS_STATUS_SUCCESS success
6083 ---------------------------------------------------------------------------*/
6084VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6085 tSirVersionType *pVersion)
6086{
6087 VOS_STATUS status = VOS_STATUS_SUCCESS;
6088 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6089 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6090
6091 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6092 {
6093 if( pVersion != NULL )
6094 {
6095 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6096 }
6097 else
6098 {
6099 status = VOS_STATUS_E_INVAL;
6100 }
6101 sme_ReleaseGlobalLock( &pMac->sme );
6102 }
6103
6104 return (status);
6105}
6106
6107
6108/* ---------------------------------------------------------------------------
6109 \fn sme_GetWcnssSoftwareVersion
6110 \brief This API returns the version string of the WCNSS driver
6111 \param hHal - The handle returned by macOpen.
6112 \param pVersion - Points to the Version string buffer to be filled
6113 \param versionBufferSize - THe size of the Version string buffer
6114 \return VOS_STATUS
6115 VOS_STATUS_E_INVAL - failure
6116 VOS_STATUS_SUCCESS success
6117 ---------------------------------------------------------------------------*/
6118VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6119 tANI_U8 *pVersion,
6120 tANI_U32 versionBufferSize)
6121{
6122 VOS_STATUS status = VOS_STATUS_SUCCESS;
6123 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6124 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6125
6126 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6127 {
6128 if( pVersion != NULL )
6129 {
6130 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6131 versionBufferSize);
6132 }
6133 else
6134 {
6135 status = VOS_STATUS_E_INVAL;
6136 }
6137 sme_ReleaseGlobalLock( &pMac->sme );
6138 }
6139
6140 return (status);
6141}
6142
6143
6144/* ---------------------------------------------------------------------------
6145 \fn sme_GetWcnssHardwareVersion
6146 \brief This API returns the version string of the WCNSS hardware
6147 \param hHal - The handle returned by macOpen.
6148 \param pVersion - Points to the Version string buffer to be filled
6149 \param versionBufferSize - THe size of the Version string buffer
6150 \return VOS_STATUS
6151 VOS_STATUS_E_INVAL - failure
6152 VOS_STATUS_SUCCESS success
6153 ---------------------------------------------------------------------------*/
6154VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6155 tANI_U8 *pVersion,
6156 tANI_U32 versionBufferSize)
6157{
6158 VOS_STATUS status = VOS_STATUS_SUCCESS;
6159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6160 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6161
6162 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6163 {
6164 if( pVersion != NULL )
6165 {
6166 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6167 versionBufferSize);
6168 }
6169 else
6170 {
6171 status = VOS_STATUS_E_INVAL;
6172 }
6173 sme_ReleaseGlobalLock( &pMac->sme );
6174 }
6175
6176 return (status);
6177}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006178
Jeff Johnson295189b2012-06-20 16:38:30 -07006179
6180#ifdef FEATURE_WLAN_WAPI
6181/* ---------------------------------------------------------------------------
6182 \fn sme_RoamSetBKIDCache
6183 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6184 candidate list.
6185 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6186 it is opened (by calling halOpen).
6187 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6188 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6189 when retruning, this is the number of items put into pBKIDCache
6190 \return eHalStatus - when fail, it usually means the buffer allocated is not
6191 big enough and pNumItems has the number of tBkidCacheInfo.
6192 ---------------------------------------------------------------------------*/
6193eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6194 tANI_U32 numItems )
6195{
6196 eHalStatus status = eHAL_STATUS_FAILURE;
6197 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6198
6199 status = sme_AcquireGlobalLock( &pMac->sme );
6200 if ( HAL_STATUS_SUCCESS( status ) )
6201 {
6202 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6203 sme_ReleaseGlobalLock( &pMac->sme );
6204 }
6205
6206 return (status);
6207}
6208
6209/* ---------------------------------------------------------------------------
6210 \fn sme_RoamGetBKIDCache
6211 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6212 BKID cache.
6213 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6214 it is opened (by calling halOpen).
6215 \param pNum - caller allocated memory that has the space of the number of
6216 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6217 in SME cache.
6218 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6219 upon return
6220 \return eHalStatus - when fail, it usually means the buffer allocated is not
6221 big enough.
6222 ---------------------------------------------------------------------------*/
6223eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6224 tBkidCacheInfo *pBkidCache)
6225{
6226 eHalStatus status = eHAL_STATUS_FAILURE;
6227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6228
6229 status = sme_AcquireGlobalLock( &pMac->sme );
6230 if ( HAL_STATUS_SUCCESS( status ) )
6231 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006232 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006233 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6234 sme_ReleaseGlobalLock( &pMac->sme );
6235 }
6236
6237 return (status);
6238}
6239
6240/* ---------------------------------------------------------------------------
6241 \fn sme_RoamGetNumBKIDCache
6242 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6243 number of BKID cache entries.
6244 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6245 it is opened (by calling halOpen).
6246 \return tANI_U32 - the number of BKID cache entries.
6247 ---------------------------------------------------------------------------*/
6248tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6249{
6250 eHalStatus status = eHAL_STATUS_FAILURE;
6251 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6252 tANI_U32 numBkidCache = 0;
6253
6254 status = sme_AcquireGlobalLock( &pMac->sme );
6255 if ( HAL_STATUS_SUCCESS( status ) )
6256 {
6257 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6258 sme_ReleaseGlobalLock( &pMac->sme );
6259 }
6260
6261 return (numBkidCache);
6262}
6263
6264/* ---------------------------------------------------------------------------
6265 \fn sme_ScanGetBKIDCandidateList
6266 \brief a wrapper function to return the BKID candidate list
6267 \param pBkidList - caller allocated buffer point to an array of
6268 tBkidCandidateInfo
6269 \param pNumItems - pointer to a variable that has the number of
6270 tBkidCandidateInfo allocated when retruning, this is
6271 either the number needed or number of items put into
6272 pPmkidList
6273 \return eHalStatus - when fail, it usually means the buffer allocated is not
6274 big enough and pNumItems
6275 has the number of tBkidCandidateInfo.
6276 \Note: pNumItems is a number of tBkidCandidateInfo,
6277 not sizeof(tBkidCandidateInfo) * something
6278 ---------------------------------------------------------------------------*/
6279eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6280 tBkidCandidateInfo *pBkidList,
6281 tANI_U32 *pNumItems )
6282{
6283 eHalStatus status = eHAL_STATUS_FAILURE;
6284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6285
6286 status = sme_AcquireGlobalLock( &pMac->sme );
6287 if ( HAL_STATUS_SUCCESS( status ) )
6288 {
6289 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6290 sme_ReleaseGlobalLock( &pMac->sme );
6291 }
6292
6293 return (status);
6294}
6295#endif /* FEATURE_WLAN_WAPI */
6296
Jeff Johnsone7245742012-09-05 17:12:55 -07006297#ifdef FEATURE_OEM_DATA_SUPPORT
6298
6299/*****************************************************************************
6300 OEM DATA related modifications and function additions
6301 *****************************************************************************/
6302
6303/* ---------------------------------------------------------------------------
6304 \fn sme_getOemDataRsp
6305 \brief a wrapper function to obtain the OEM DATA RSP
6306 \param pOemDataRsp - A pointer to the response object
6307 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006308 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006309 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006310eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006311 tOemDataRsp **pOemDataRsp)
6312{
6313 eHalStatus status = eHAL_STATUS_SUCCESS;
6314 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6315
6316 do
6317 {
6318 //acquire the lock for the sme object
6319 status = sme_AcquireGlobalLock(&pMac->sme);
6320
6321 if(!HAL_STATUS_SUCCESS(status))
6322 {
6323 break;
6324 }
6325
6326 if(pMac->oemData.pOemDataRsp != NULL)
6327 {
6328 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6329 }
6330 else
6331 {
6332 status = eHAL_STATUS_FAILURE;
6333 }
6334
6335 //release the lock for the sme object
6336 sme_ReleaseGlobalLock( &pMac->sme );
6337
6338 } while(0);
6339
6340 return status;
6341}
6342
6343/* ---------------------------------------------------------------------------
6344 \fn sme_OemDataReq
6345 \brief a wrapper function for OEM DATA REQ
6346 \param sessionId - session id to be used.
6347 \param pOemDataReqId - pointer to an object to get back the request ID
6348 \param callback - a callback function that is called upon finish
6349 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006350 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006351 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006352eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006353 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006354 tOemDataReqConfig *pOemDataReqConfig,
6355 tANI_U32 *pOemDataReqID,
6356 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006357 void *pContext)
6358{
6359 eHalStatus status = eHAL_STATUS_SUCCESS;
6360 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6361
6362 do
6363 {
6364 //acquire the lock for the sme object
6365 status = sme_AcquireGlobalLock(&pMac->sme);
6366 if(HAL_STATUS_SUCCESS(status))
6367 {
6368 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6369
6370 if(pOemDataReqID)
6371 {
6372 *pOemDataReqID = lOemDataReqId;
6373 }
6374 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006375 {
6376 sme_ReleaseGlobalLock( &pMac->sme );
6377 return eHAL_STATUS_FAILURE;
6378 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006379
6380 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6381
6382 //release the lock for the sme object
6383 sme_ReleaseGlobalLock( &pMac->sme );
6384 }
6385 } while(0);
6386
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006387 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006388
6389 return(status);
6390}
6391
6392#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006393
6394/*--------------------------------------------------------------------------
6395
6396 \brief sme_OpenSession() - Open a session for scan/roam operation.
6397
6398 This is a synchronous API.
6399
6400
6401 \param hHal - The handle returned by macOpen.
6402 \param callback - A pointer to the function caller specifies for roam/connect status indication
6403 \param pContext - The context passed with callback
6404 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6405 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6406
6407 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6408
6409 Other status means SME is failed to open the session.
6410 eHAL_STATUS_RESOURCES - no more session available.
6411 \sa
6412
6413 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006414eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6415 void *pContext, tANI_U8 *pSelfMacAddr,
6416 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006417{
6418 eHalStatus status;
6419 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6420
6421 if( NULL == pbSessionId )
6422 {
6423 status = eHAL_STATUS_INVALID_PARAMETER;
6424 }
6425 else
6426 {
6427 status = sme_AcquireGlobalLock( &pMac->sme );
6428 if ( HAL_STATUS_SUCCESS( status ) )
6429 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006430 status = csrRoamOpenSession(pMac, callback, pContext,
6431 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006432
6433 sme_ReleaseGlobalLock( &pMac->sme );
6434 }
6435 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006436 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306437 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006438 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006439
6440 return ( status );
6441}
6442
6443
6444/*--------------------------------------------------------------------------
6445
6446 \brief sme_CloseSession() - Open a session for scan/roam operation.
6447
6448 This is a synchronous API.
6449
6450
6451 \param hHal - The handle returned by macOpen.
6452
6453 \param sessionId - A previous opened session's ID.
6454
6455 \return eHAL_STATUS_SUCCESS - session is closed.
6456
6457 Other status means SME is failed to open the session.
6458 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6459 \sa
6460
6461 --------------------------------------------------------------------------*/
6462eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6463 csrRoamSessionCloseCallback callback, void *pContext)
6464{
6465 eHalStatus status;
6466 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6467
Katya Nigambcb705f2013-12-26 14:26:22 +05306468 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006469 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006470 status = sme_AcquireGlobalLock( &pMac->sme );
6471 if ( HAL_STATUS_SUCCESS( status ) )
6472 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006473 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006474 callback, pContext );
6475
6476 sme_ReleaseGlobalLock( &pMac->sme );
6477 }
6478
6479 return ( status );
6480}
6481
Jeff Johnson295189b2012-06-20 16:38:30 -07006482/* ---------------------------------------------------------------------------
6483
6484 \fn sme_RoamUpdateAPWPSIE
6485
6486 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6487 This is an asynchronous API.
6488
6489 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6490
6491 \return eHalStatus – SUCCESS –
6492
6493 FAILURE or RESOURCES – The API finished and failed.
6494
6495 -------------------------------------------------------------------------------*/
6496eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6497{
6498
6499 eHalStatus status = eHAL_STATUS_FAILURE;
6500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6501
6502 status = sme_AcquireGlobalLock( &pMac->sme );
6503 if ( HAL_STATUS_SUCCESS( status ) )
6504 {
6505
6506 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6507
6508 sme_ReleaseGlobalLock( &pMac->sme );
6509 }
6510
6511 return (status);
6512}
6513/* ---------------------------------------------------------------------------
6514
6515 \fn sme_RoamUpdateAPWPARSNIEs
6516
6517 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6518 This is an asynchronous API.
6519
6520 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6521
6522 \return eHalStatus – SUCCESS –
6523
6524 FAILURE or RESOURCES – The API finished and failed.
6525
6526 -------------------------------------------------------------------------------*/
6527eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6528{
6529
6530 eHalStatus status = eHAL_STATUS_FAILURE;
6531 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6532
6533 status = sme_AcquireGlobalLock( &pMac->sme );
6534 if ( HAL_STATUS_SUCCESS( status ) )
6535 {
6536
6537 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6538
6539 sme_ReleaseGlobalLock( &pMac->sme );
6540 }
6541
6542 return (status);
6543}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006544/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006545
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006546 \fn sme_ChangeMCCBeaconInterval
6547
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006548 \brief To update P2P-GO beaconInterval. This function should be called after
6549 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006550 This is an asynchronous API.
6551
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006552 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006553
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006554 \return eHalStatus SUCCESS
6555 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006556 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006557
6558 -------------------------------------------------------------------------------*/
6559eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6560{
6561 eHalStatus status = eHAL_STATUS_FAILURE;
6562 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6563
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006564 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006565 status = sme_AcquireGlobalLock( &pMac->sme );
6566 if ( HAL_STATUS_SUCCESS( status ) )
6567 {
6568 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6569 sme_ReleaseGlobalLock( &pMac->sme );
6570 }
6571 return (status);
6572}
Jeff Johnson295189b2012-06-20 16:38:30 -07006573
6574/*-------------------------------------------------------------------------------*
6575
6576 \fn sme_sendBTAmpEvent
6577
6578 \brief to receive the coex priorty request from BT-AMP PAL
6579 and send the BT_AMP link state to HAL
6580
6581 \param btAmpEvent - btAmpEvent
6582
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006583 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006584
6585 FAILURE: API failed
6586
6587-------------------------------------------------------------------------------*/
6588
6589eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6590{
6591 vos_msg_t msg;
6592 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6593 eHalStatus status = eHAL_STATUS_FAILURE;
6594
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006595 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006596 if (NULL == ptrSmeBtAmpEvent)
6597 {
6598 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006599 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006600 return status;
6601 }
6602
6603 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6604 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6605 msg.reserved = 0;
6606 msg.bodyptr = ptrSmeBtAmpEvent;
6607
6608 //status = halFW_SendBTAmpEventMesg(pMac, event);
6609
6610 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6611 {
6612 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006613 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006614 vos_mem_free(ptrSmeBtAmpEvent);
6615 return status;
6616 }
6617
6618 return eHAL_STATUS_SUCCESS;
6619
6620}
6621
6622/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306623 \fn smeIssueFastRoamNeighborAPEvent
6624 \brief API to trigger fast BSS roam independent of RSSI triggers
6625 \param hHal - The handle returned by macOpen.
6626 \param bssid - Pointer to the BSSID to roam to.
6627 \param fastRoamTrig - Trigger to Scan or roam
6628 \return eHalStatus
6629 ---------------------------------------------------------------------------*/
6630eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6631 tANI_U8 *bssid,
6632 tSmeFastRoamTrigger fastRoamTrig)
6633{
6634 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6635 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6636 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6637 eHalStatus status = eHAL_STATUS_SUCCESS;
6638
6639 status = sme_AcquireGlobalLock( &pMac->sme );
6640 if ( HAL_STATUS_SUCCESS( status ) )
6641 {
6642 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6643 "%s: invoked", __func__);
6644
6645 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6646 {
6647 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6648 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6649 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6650 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006651 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6652 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306653
6654 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6655 if (VOS_STATUS_SUCCESS != vosStatus)
6656 {
6657 smsLog(pMac, LOGE,
6658 FL("CFG Channel list scan state failed with status %d "),
6659 vosStatus);
6660 }
6661 }
6662 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6663 {
6664 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6665 (void *)bssid, sizeof(tSirMacAddr));
6666 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006667 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6668 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306669
6670 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6671 0,
6672 pMac,
6673 0);
6674
6675 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6676 {
6677 smsLog(pMac,
6678 LOGE,
6679 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6680 vosStatus);
6681 }
6682 }
6683 sme_ReleaseGlobalLock( &pMac->sme );
6684 }
6685 return vosStatus;
6686}
6687/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006688 \fn sme_SetHostOffload
6689 \brief API to set the host offload feature.
6690 \param hHal - The handle returned by macOpen.
6691 \param pRequest - Pointer to the offload request.
6692 \return eHalStatus
6693 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006694eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006695 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006696{
6697 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006698 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006699
Katya Nigambcb705f2013-12-26 14:26:22 +05306700 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006701 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006702 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6703 {
6704#ifdef WLAN_NS_OFFLOAD
6705 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6706 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006707 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006708 }
6709 else
6710#endif //WLAN_NS_OFFLOAD
6711 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006712 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006713 }
6714 sme_ReleaseGlobalLock( &pMac->sme );
6715 }
6716
6717 return (status);
6718}
6719
6720#ifdef WLAN_FEATURE_GTK_OFFLOAD
6721/* ---------------------------------------------------------------------------
6722 \fn sme_SetGTKOffload
6723 \brief API to set GTK offload information.
6724 \param hHal - The handle returned by macOpen.
6725 \param pRequest - Pointer to the GTK offload request.
6726 \return eHalStatus
6727 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006728eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006729 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006730{
6731 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6732 eHalStatus status;
6733
Katya Nigambcb705f2013-12-26 14:26:22 +05306734 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006735 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006736 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6737 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006738 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006739 sme_ReleaseGlobalLock( &pMac->sme );
6740 }
6741
6742 return (status);
6743}
6744
6745/* ---------------------------------------------------------------------------
6746 \fn sme_GetGTKOffload
6747 \brief API to get GTK offload information.
6748 \param hHal - The handle returned by macOpen.
6749 \param pRequest - Pointer to the GTK offload response.
6750 \return eHalStatus
6751 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006752eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006753 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006754{
6755 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6756 eHalStatus status;
6757
Katya Nigambcb705f2013-12-26 14:26:22 +05306758 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006759 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006760 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6761 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006762 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 sme_ReleaseGlobalLock( &pMac->sme );
6764 }
6765
6766 return (status);
6767}
6768#endif // WLAN_FEATURE_GTK_OFFLOAD
6769
6770/* ---------------------------------------------------------------------------
6771 \fn sme_SetKeepAlive
6772 \brief API to set the Keep Alive feature.
6773 \param hHal - The handle returned by macOpen.
6774 \param pRequest - Pointer to the Keep Alive request.
6775 \return eHalStatus
6776 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006777eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006778 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006779{
6780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6781 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006782 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6783 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006784 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006785 sme_ReleaseGlobalLock( &pMac->sme );
6786 }
6787
6788 return (status);
6789}
6790
6791#ifdef FEATURE_WLAN_SCAN_PNO
6792/* ---------------------------------------------------------------------------
6793 \fn sme_SetPreferredNetworkList
6794 \brief API to set the Preferred Network List Offload feature.
6795 \param hHal - The handle returned by macOpen.
6796 \param pRequest - Pointer to the offload request.
6797 \return eHalStatus
6798 ---------------------------------------------------------------------------*/
6799eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6800{
6801 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6802 eHalStatus status;
6803
6804 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6805 {
6806 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6807 sme_ReleaseGlobalLock( &pMac->sme );
6808 }
6809
6810 return (status);
6811}
6812
6813eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6814{
6815 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6816 eHalStatus status;
6817
6818 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6819 {
6820 pmcSetRssiFilter(hHal, rssiThreshold);
6821 sme_ReleaseGlobalLock( &pMac->sme );
6822 }
6823
6824 return (status);
6825}
6826
6827#endif // FEATURE_WLAN_SCAN_PNO
6828
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006829eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006830{
6831 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6832 eHalStatus status;
6833
Katya Nigambcb705f2013-12-26 14:26:22 +05306834 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006835 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006836 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6837 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006838 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006839 sme_ReleaseGlobalLock( &pMac->sme );
6840 }
6841
6842 return (status);
6843}
6844
6845/* ---------------------------------------------------------------------------
6846 \fn sme_AbortMacScan
6847 \brief API to cancel MAC scan.
6848 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306849 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306850 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006851 \return VOS_STATUS
6852 VOS_STATUS_E_FAILURE - failure
6853 VOS_STATUS_SUCCESS success
6854 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306855eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6856 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006857{
6858 eHalStatus status;
6859 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6860
Katya Nigambcb705f2013-12-26 14:26:22 +05306861 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006862 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006863 status = sme_AcquireGlobalLock( &pMac->sme );
6864 if ( HAL_STATUS_SUCCESS( status ) )
6865 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306866 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006867
Jeff Johnson295189b2012-06-20 16:38:30 -07006868 sme_ReleaseGlobalLock( &pMac->sme );
6869 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006870
Jeff Johnson295189b2012-06-20 16:38:30 -07006871 return ( status );
6872}
6873
6874/* ----------------------------------------------------------------------------
6875 \fn sme_GetOperationChannel
6876 \brief API to get current channel on which STA is parked
6877 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006878 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006879 \returns eHAL_STATUS_SUCCESS
6880 eHAL_STATUS_FAILURE
6881-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006882eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006883{
Jeff Johnson295189b2012-06-20 16:38:30 -07006884 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6885 tCsrRoamSession *pSession;
6886
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006887 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006888 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006889 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006890
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006891 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006892 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006893 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006894 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6895 {
6896 *pChannel =pSession->connectedProfile.operationChannel;
6897 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006898 }
6899 }
6900 return eHAL_STATUS_FAILURE;
6901}// sme_GetOperationChannel ends here
6902
Jeff Johnson295189b2012-06-20 16:38:30 -07006903/* ---------------------------------------------------------------------------
6904
6905 \fn sme_RegisterMgtFrame
6906
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006907 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006908 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006909 \param matchData - data which needs to be matched before passing frame
6910 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006911 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006912 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006913 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006914eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006915 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6916{
6917 eHalStatus status = eHAL_STATUS_SUCCESS;
6918 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6919
Katya Nigambcb705f2013-12-26 14:26:22 +05306920 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006921 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006922 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6923 {
6924 tSirRegisterMgmtFrame *pMsg;
6925 tANI_U16 len;
6926 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006927
6928 if(!pSession)
6929 {
6930 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006931 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006932 return eHAL_STATUS_FAILURE;
6933 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006934
Jeff Johnson295189b2012-06-20 16:38:30 -07006935 if( !pSession->sessionActive )
6936 {
6937 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006938 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006939 sme_ReleaseGlobalLock( &pMac->sme );
6940 return eHAL_STATUS_FAILURE;
6941 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006942
Jeff Johnson295189b2012-06-20 16:38:30 -07006943 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6944
Kiet Lam64c1b492013-07-12 13:56:44 +05306945 pMsg = vos_mem_malloc(len);
6946 if ( NULL == pMsg )
6947 status = eHAL_STATUS_FAILURE;
6948 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006949 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306950 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006951 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6952 pMsg->length = len;
6953 pMsg->sessionId = sessionId;
6954 pMsg->registerFrame = VOS_TRUE;
6955 pMsg->frameType = frameType;
6956 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306957 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006958 status = palSendMBMessage(pMac->hHdd, pMsg);
6959 }
6960 sme_ReleaseGlobalLock( &pMac->sme );
6961 }
6962 return status;
6963}
6964
6965/* ---------------------------------------------------------------------------
6966
6967 \fn sme_DeregisterMgtFrame
6968
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006969 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006970 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006971 \param matchData - data which needs to be matched before passing frame
6972 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006973 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006974 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006975 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006976eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006977 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6978{
6979 eHalStatus status = eHAL_STATUS_SUCCESS;
6980 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6981
Katya Nigambcb705f2013-12-26 14:26:22 +05306982 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006983 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006984 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6985 {
6986 tSirRegisterMgmtFrame *pMsg;
6987 tANI_U16 len;
6988 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006989
6990 if(!pSession)
6991 {
6992 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006993 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006994 return eHAL_STATUS_FAILURE;
6995 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006996
6997 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006998 {
6999 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007000 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007001 sme_ReleaseGlobalLock( &pMac->sme );
7002 return eHAL_STATUS_FAILURE;
7003 }
7004
7005 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7006
Kiet Lam64c1b492013-07-12 13:56:44 +05307007 pMsg = vos_mem_malloc(len);
7008 if ( NULL == pMsg )
7009 status = eHAL_STATUS_FAILURE;
7010 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007011 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307012 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007013 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007014 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007015 pMsg->registerFrame = VOS_FALSE;
7016 pMsg->frameType = frameType;
7017 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307018 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007019 status = palSendMBMessage(pMac->hHdd, pMsg);
7020 }
7021 sme_ReleaseGlobalLock( &pMac->sme );
7022 }
7023 return status;
7024}
7025
7026/* ---------------------------------------------------------------------------
7027 \fn sme_RemainOnChannel
7028 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7029 \param hHal - The handle returned by macOpen.
7030 \param pRequest - channel
7031 \param duration - duration in ms
7032 \param callback - HDD registered callback to process reaminOnChannelRsp
7033 \param context - HDD Callback param
7034 \return eHalStatus
7035 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007036eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7037 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307038 remainOnChanCallback callback,
7039 void *pContext,
7040 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007041{
7042 eHalStatus status = eHAL_STATUS_SUCCESS;
7043 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7044
Katya Nigambcb705f2013-12-26 14:26:22 +05307045 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007046 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007047 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7048 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307049 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7050 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007051#ifdef WLAN_FEATURE_P2P_INTERNAL
7052 , eP2PRemainOnChnReasonUnknown
7053#endif
7054 );
7055 sme_ReleaseGlobalLock( &pMac->sme );
7056 }
7057 return(status);
7058}
7059
7060/* ---------------------------------------------------------------------------
7061 \fn sme_ReportProbeReq
7062 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7063 \param hHal - The handle returned by macOpen.
7064 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7065 \return eHalStatus
7066 ---------------------------------------------------------------------------*/
7067
7068#ifndef WLAN_FEATURE_CONCURRENT_P2P
7069eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7070{
7071 eHalStatus status = eHAL_STATUS_SUCCESS;
7072 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7073
7074 do
7075 {
7076 //acquire the lock for the sme object
7077 status = sme_AcquireGlobalLock(&pMac->sme);
7078 if(HAL_STATUS_SUCCESS(status))
7079 {
7080 /* call set in context */
7081 pMac->p2pContext.probeReqForwarding = flag;
7082 //release the lock for the sme object
7083 sme_ReleaseGlobalLock( &pMac->sme );
7084 }
7085 } while(0);
7086
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007087 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007088
7089 return(status);
7090}
7091
7092/* ---------------------------------------------------------------------------
7093 \fn sme_updateP2pIe
7094 \brief API to set the P2p Ie in p2p context
7095 \param hHal - The handle returned by macOpen.
7096 \param p2pIe - Ptr to p2pIe from HDD.
7097 \param p2pIeLength: length of p2pIe
7098 \return eHalStatus
7099 ---------------------------------------------------------------------------*/
7100
7101eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
7102{
7103 eHalStatus status = eHAL_STATUS_SUCCESS;
7104 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7105
7106 //acquire the lock for the sme object
7107 status = sme_AcquireGlobalLock(&pMac->sme);
7108 if(HAL_STATUS_SUCCESS(status))
7109 {
7110 if(NULL != pMac->p2pContext.probeRspIe){
7111 vos_mem_free(pMac->p2pContext.probeRspIe);
7112 pMac->p2pContext.probeRspIeLength = 0;
7113 }
7114
7115 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
7116 if (NULL == pMac->p2pContext.probeRspIe)
7117 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007118 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007119 pMac->p2pContext.probeRspIeLength = 0;
7120 status = eHAL_STATUS_FAILURE;
7121 }
7122 else
7123 {
7124 pMac->p2pContext.probeRspIeLength = p2pIeLength;
7125
7126 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
7127 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007128 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007129 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7130 p2pIeLength);
7131 }
7132
7133 //release the lock for the sme object
7134 sme_ReleaseGlobalLock( &pMac->sme );
7135 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007136
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007137 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007138
7139 return(status);
7140}
7141#endif
7142
7143/* ---------------------------------------------------------------------------
7144 \fn sme_sendAction
7145 \brief API to send action frame from supplicant.
7146 \param hHal - The handle returned by macOpen.
7147 \return eHalStatus
7148 ---------------------------------------------------------------------------*/
7149
7150eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007151 const tANI_U8 *pBuf, tANI_U32 len,
7152 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007153{
7154 eHalStatus status = eHAL_STATUS_SUCCESS;
7155 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7156
Katya Nigambcb705f2013-12-26 14:26:22 +05307157 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007158 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007159 //acquire the lock for the sme object
7160 status = sme_AcquireGlobalLock(&pMac->sme);
7161 if(HAL_STATUS_SUCCESS(status))
7162 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007163 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007164 //release the lock for the sme object
7165 sme_ReleaseGlobalLock( &pMac->sme );
7166 }
7167
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007168 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007169
7170 return(status);
7171}
7172
7173eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7174{
7175 eHalStatus status = eHAL_STATUS_SUCCESS;
7176 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7177
Katya Nigambcb705f2013-12-26 14:26:22 +05307178 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007179 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007180 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7181 {
7182 status = p2pCancelRemainOnChannel (hHal, sessionId);
7183 sme_ReleaseGlobalLock( &pMac->sme );
7184 }
7185 return(status);
7186}
7187
7188//Power Save Related
7189eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7190{
7191 eHalStatus status = eHAL_STATUS_SUCCESS;
7192 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7193
7194 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7195 {
7196 status = p2pSetPs (hHal, data);
7197 sme_ReleaseGlobalLock( &pMac->sme );
7198 }
7199 return(status);
7200}
7201
Jeff Johnson295189b2012-06-20 16:38:30 -07007202
7203/* ---------------------------------------------------------------------------
7204
7205 \fn sme_ConfigureRxpFilter
7206
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007207 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007208 SME will pass this request to lower mac to set/reset the filter on RXP for
7209 multicast & broadcast traffic.
7210
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007211 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007212
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007213 hHal - The handle returned by macOpen.
7214
Jeff Johnson295189b2012-06-20 16:38:30 -07007215 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7216 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7217 on this param. In future we can use this as a mask to set various types of
7218 filters as suggested below:
7219 FILTER_ALL_MULTICAST:
7220 FILTER_ALL_BROADCAST:
7221 FILTER_ALL_MULTICAST_BROADCAST:
7222
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007223
7224 \return eHalStatus
7225
7226
Jeff Johnson295189b2012-06-20 16:38:30 -07007227--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007228eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007229 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7230{
7231 eHalStatus status = eHAL_STATUS_SUCCESS;
7232 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7233 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7234 vos_msg_t vosMessage;
7235
Katya Nigambcb705f2013-12-26 14:26:22 +05307236 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007237 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007238 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7239 {
7240 /* serialize the req through MC thread */
7241 vosMessage.bodyptr = wlanRxpFilterParam;
7242 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7243 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7244 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7245 {
7246 status = eHAL_STATUS_FAILURE;
7247 }
7248 sme_ReleaseGlobalLock( &pMac->sme );
7249 }
7250 return(status);
7251}
7252
Jeff Johnson295189b2012-06-20 16:38:30 -07007253/* ---------------------------------------------------------------------------
7254
7255 \fn sme_ConfigureSuspendInd
7256
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007257 \brief
7258 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007259 be suspended
7260
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007261 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007262
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007263 hHal - The handle returned by macOpen.
7264
Jeff Johnson295189b2012-06-20 16:38:30 -07007265 wlanSuspendParam- Depicts the wlan suspend params
7266
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007267
7268 \return eHalStatus
7269
7270
Jeff Johnson295189b2012-06-20 16:38:30 -07007271--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007272eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007273 tpSirWlanSuspendParam wlanSuspendParam)
7274{
7275 eHalStatus status = eHAL_STATUS_SUCCESS;
7276 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7277 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7278 vos_msg_t vosMessage;
7279
Katya Nigambcb705f2013-12-26 14:26:22 +05307280 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007281 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007282 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7283 {
7284 /* serialize the req through MC thread */
7285 vosMessage.bodyptr = wlanSuspendParam;
7286 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7287 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7288 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7289 {
7290 status = eHAL_STATUS_FAILURE;
7291 }
7292 sme_ReleaseGlobalLock( &pMac->sme );
7293 }
7294 return(status);
7295}
7296
7297/* ---------------------------------------------------------------------------
7298
7299 \fn sme_ConfigureResumeReq
7300
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007301 \brief
7302 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007303 be Resumed
7304
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007305 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007306
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007307 hHal - The handle returned by macOpen.
7308
Jeff Johnson295189b2012-06-20 16:38:30 -07007309 wlanResumeParam- Depicts the wlan resume params
7310
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007311
7312 \return eHalStatus
7313
7314
Jeff Johnson295189b2012-06-20 16:38:30 -07007315--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007316eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007317 tpSirWlanResumeParam wlanResumeParam)
7318{
7319 eHalStatus status = eHAL_STATUS_SUCCESS;
7320 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7321 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7322 vos_msg_t vosMessage;
7323
Katya Nigambcb705f2013-12-26 14:26:22 +05307324 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007325 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007326 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7327 {
7328 /* serialize the req through MC thread */
7329 vosMessage.bodyptr = wlanResumeParam;
7330 vosMessage.type = WDA_WLAN_RESUME_REQ;
7331 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7332 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7333 {
7334 status = eHAL_STATUS_FAILURE;
7335 }
7336 sme_ReleaseGlobalLock( &pMac->sme );
7337 }
7338 return(status);
7339}
7340
Jeff Johnson295189b2012-06-20 16:38:30 -07007341/* ---------------------------------------------------------------------------
7342
7343 \fn sme_GetInfraSessionId
7344
7345 \brief To get the session ID for infra session, if connected
7346 This is a synchronous API.
7347
7348 \param hHal - The handle returned by macOpen.
7349
7350 \return sessionid, -1 if infra session is not connected
7351
7352 -------------------------------------------------------------------------------*/
7353tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7354{
7355 eHalStatus status = eHAL_STATUS_FAILURE;
7356 tANI_S8 sessionid = -1;
7357 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007358
Jeff Johnson295189b2012-06-20 16:38:30 -07007359 status = sme_AcquireGlobalLock( &pMac->sme );
7360 if ( HAL_STATUS_SUCCESS( status ) )
7361 {
7362
7363 sessionid = csrGetInfraSessionId( pMac);
7364
7365 sme_ReleaseGlobalLock( &pMac->sme );
7366 }
7367
7368 return (sessionid);
7369}
7370
7371/* ---------------------------------------------------------------------------
7372
7373 \fn sme_GetInfraOperationChannel
7374
7375 \brief To get the operating channel for infra session, if connected
7376 This is a synchronous API.
7377
7378 \param hHal - The handle returned by macOpen.
7379 \param sessionId - the sessionId returned by sme_OpenSession.
7380
7381 \return operating channel, 0 if infra session is not connected
7382
7383 -------------------------------------------------------------------------------*/
7384tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7385{
7386 eHalStatus status = eHAL_STATUS_FAILURE;
7387 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7388 tANI_U8 channel = 0;
7389 status = sme_AcquireGlobalLock( &pMac->sme );
7390 if ( HAL_STATUS_SUCCESS( status ) )
7391 {
7392
7393 channel = csrGetInfraOperationChannel( pMac, sessionId);
7394
7395 sme_ReleaseGlobalLock( &pMac->sme );
7396 }
7397
7398 return (channel);
7399}
7400
7401//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 -07007402//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007403tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7404{
7405 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007406 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007407 tANI_U8 channel = 0;
7408 status = sme_AcquireGlobalLock( &pMac->sme );
7409 if ( HAL_STATUS_SUCCESS( status ) )
7410 {
7411
7412 channel = csrGetConcurrentOperationChannel( pMac );
7413 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007414 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007415 sme_ReleaseGlobalLock( &pMac->sme );
7416 }
7417
7418 return (channel);
7419}
7420
7421#ifdef FEATURE_WLAN_SCAN_PNO
7422/******************************************************************************
7423*
7424* Name: sme_PreferredNetworkFoundInd
7425*
7426* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007427* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007428*
7429* Parameters:
7430* hHal - HAL handle for device
7431* pMsg - found network description
7432*
7433* Returns: eHalStatus
7434*
7435******************************************************************************/
7436eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7437{
7438 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7439 eHalStatus status = eHAL_STATUS_SUCCESS;
7440 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007441 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7442 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007443
7444 if (NULL == pMsg)
7445 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007446 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007447 status = eHAL_STATUS_FAILURE;
7448 }
7449 else
7450 {
7451 if (pPrefNetworkFoundInd->ssId.length > 0)
7452 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007453 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7454 pPrefNetworkFoundInd->ssId.length);
7455 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7456 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307457 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7458 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007459
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307460 /* Flush scan results, So as to avoid indication/updation of
7461 * stale entries, which may not have aged out during APPS collapse
7462 */
7463 sme_ScanFlushResult(hHal,0);
7464
Srikant Kuppa066904f2013-05-07 13:56:02 -07007465 //Save the frame to scan result
7466 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7467 {
7468 //we may have a frame
7469 status = csrScanSavePreferredNetworkFound(pMac,
7470 pPrefNetworkFoundInd);
7471 if (!HAL_STATUS_SUCCESS(status))
7472 {
7473 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7474 }
7475 }
7476 else
7477 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007478 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007479 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007480 }
7481
Srikant Kuppa066904f2013-05-07 13:56:02 -07007482 /* Call Preferred Netowrk Found Indication callback routine. */
7483 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7484 {
7485 pMac->pmc.prefNetwFoundCB(
7486 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7487 pPrefNetworkFoundInd);
7488 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007489 }
7490 else
7491 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007492 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007493 status = eHAL_STATUS_FAILURE;
7494 }
7495 }
7496
7497
7498 return(status);
7499}
7500
7501#endif // FEATURE_WLAN_SCAN_PNO
7502
7503
7504eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7505{
7506 eHalStatus status = eHAL_STATUS_FAILURE;
7507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007508
Jeff Johnson295189b2012-06-20 16:38:30 -07007509 status = sme_AcquireGlobalLock( &pMac->sme );
7510 if ( HAL_STATUS_SUCCESS( status ) )
7511 {
7512 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7513 sme_ReleaseGlobalLock( &pMac->sme );
7514 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007515
Jeff Johnson295189b2012-06-20 16:38:30 -07007516 return (status);
7517}
7518
7519
7520/* ---------------------------------------------------------------------------
7521
7522 \fn sme_SetTxPerTracking
7523
7524 \brief Set Tx PER tracking configuration parameters
7525
7526 \param hHal - The handle returned by macOpen.
7527 \param pTxPerTrackingConf - Tx PER configuration parameters
7528
7529 \return eHalStatus
7530
7531 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007532eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7533 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007534 void *pCallbackContext,
7535 tpSirTxPerTrackingParam pTxPerTrackingParam)
7536{
7537 vos_msg_t msg;
7538 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7539 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7540
7541 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7542 {
7543 pMac->sme.pTxPerHitCallback = pCallbackfn;
7544 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7545 sme_ReleaseGlobalLock( &pMac->sme );
7546 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007547
Jeff Johnson295189b2012-06-20 16:38:30 -07007548 // free this memory in failure case or WDA request callback function
7549 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7550 if (NULL == pTxPerTrackingParamReq)
7551 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007552 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 -07007553 return eHAL_STATUS_FAILURE;
7554 }
7555
Kiet Lam64c1b492013-07-12 13:56:44 +05307556 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7557 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007558 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7559 msg.reserved = 0;
7560 msg.bodyptr = pTxPerTrackingParamReq;
7561
7562 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7563 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007564 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 -07007565 vos_mem_free(pTxPerTrackingParamReq);
7566 return eHAL_STATUS_FAILURE;
7567 }
7568
7569 return eHAL_STATUS_SUCCESS;
7570}
7571
7572/* ---------------------------------------------------------------------------
7573
7574 \fn sme_HandleChangeCountryCode
7575
7576 \brief Change Country code, Reg Domain and channel list
7577
7578 \details Country Code Priority
7579 0 = 11D > Configured Country > NV
7580 1 = Configured Country > 11D > NV
7581 If Supplicant country code is priority than 11d is disabled.
7582 If 11D is enabled, we update the country code after every scan.
7583 Hence when Supplicant country code is priority, we don't need 11D info.
7584 Country code from Supplicant is set as current courtry code.
7585 User can send reset command XX (instead of country code) to reset the
7586 country code to default values which is read from NV.
7587 In case of reset, 11D is enabled and default NV code is Set as current country code
7588 If 11D is priority,
7589 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7590
7591 \param pMac - The handle returned by macOpen.
7592 \param pMsgBuf - MSG Buffer
7593
7594 \return eHalStatus
7595
7596 -------------------------------------------------------------------------------*/
7597eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7598{
7599 eHalStatus status = eHAL_STATUS_SUCCESS;
7600 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007601 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007602 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7603 static uNvTables nvTables;
7604 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7605
7606
7607 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7608 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7609 {
7610 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7611
7612 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7613
7614 /* read the country code from NV and use it */
7615 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7616 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307617 vos_mem_copy(pMsg->countryCode,
7618 nvTables.defaultCountryTable.countryCode,
7619 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007620 }
7621 else
7622 {
7623 status = eHAL_STATUS_FAILURE;
7624 return status;
7625 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05307626 /* Update the 11d country to default country from NV bin so that when
7627 * callback is received for this default country, driver will not
7628 * disable the 11d taking it as valid country by user.
7629 */
7630 smsLog(pMac, LOG1,
7631 FL("Set default country code (%c%c) from NV as invalid country received"),
7632 pMsg->countryCode[0],pMsg->countryCode[1]);
7633 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
7634 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007635 }
7636 else
7637 {
7638 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307639 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7640 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007641 {
7642 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7643 }
7644 }
7645
7646 /* WEXT set country code means
7647 * 11D should be supported?
7648 * 11D Channel should be enforced?
7649 * 11D Country code should be matched?
7650 * 11D Reg Domian should be matched?
7651 * Country string changed */
7652 if(pMac->roam.configParam.Is11dSupportEnabled &&
7653 pMac->roam.configParam.fEnforce11dChannels &&
7654 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7655 pMac->roam.configParam.fEnforceDefaultDomain &&
7656 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7657 {
7658 /* All 11D related options are already enabled
7659 * Country string is not changed
7660 * Do not need do anything for country code change request */
7661 return eHAL_STATUS_SUCCESS;
7662 }
7663
7664 /* Set Current Country code and Current Regulatory domain */
7665 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7666 if(eHAL_STATUS_SUCCESS != status)
7667 {
7668 /* Supplicant country code failed. So give 11D priority */
7669 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7670 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007671 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007672 }
7673
Jeff Johnson295189b2012-06-20 16:38:30 -07007674 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307675 vos_mem_copy(pMac->scan.countryCodeDefault,
7676 pMac->scan.countryCodeCurrent,
7677 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007678
7679 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307680 status = csrGetRegulatoryDomainForCountry(pMac,
7681 pMac->scan.countryCodeCurrent,
7682 (v_REGDOMAIN_t *) &domainIdIoctl,
7683 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007684 if ( status != eHAL_STATUS_SUCCESS )
7685 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007686 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007687 return status;
7688 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007689 else if (REGDOMAIN_WORLD == domainIdIoctl)
7690 {
7691 /* Supplicant country code is invalid, so we are on world mode now. So
7692 give 11D chance to update */
7693 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7694 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7695 }
7696
Jeff Johnson295189b2012-06-20 16:38:30 -07007697
Abhishek Singha306a442013-11-07 18:39:01 +05307698 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007699
7700 if ( status != eHAL_STATUS_SUCCESS )
7701 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007702 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007703 return status;
7704 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007705 else
7706 {
7707 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7708 //set again if we find AP with 11d info during scan
7709 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7710 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007711 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007712 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7713 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7714 }
7715 }
Kiet Lam6c583332013-10-14 05:37:09 +05307716#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007717 /* set to default domain ID */
7718 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7719
7720 /* get the channels based on new cc */
7721 status = csrInitGetChannels( pMac );
7722
7723 if ( status != eHAL_STATUS_SUCCESS )
7724 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007725 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007726 return status;
7727 }
7728
7729 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007730 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307731 /* Country code Changed, Purge Only scan result
7732 * which does not have channel number belong to 11d
7733 * channel list
7734 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307735 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307736
Kiet Lam6c583332013-10-14 05:37:09 +05307737#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007738 if( pMsg->changeCCCallback )
7739 {
7740 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7741 }
7742
7743 return eHAL_STATUS_SUCCESS;
7744}
7745
Amar Singhal0d15bd52013-10-12 23:13:13 -07007746/* ---------------------------------------------------------------------------
7747
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007748 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007749
7750 \brief Change Country code, Reg Domain and channel list
7751
7752 If Supplicant country code is priority than 11d is disabled.
7753 If 11D is enabled, we update the country code after every scan.
7754 Hence when Supplicant country code is priority, we don't need 11D info.
7755 Country code from Supplicant is set as current country code.
7756
7757 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007758 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007759
7760 \return eHalStatus
7761
7762 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007763eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7764 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007765{
7766 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007767 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307768 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007769
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007770 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007771 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7772
Kiet Lam6c583332013-10-14 05:37:09 +05307773 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7774 VOS_COUNTRY_CODE_LEN) == 0)
7775 {
7776 is11dCountry = VOS_TRUE;
7777 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007778
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307779 /* Set the country code given by userspace when 11dOriginal is FALSE
7780 * when 11doriginal is True,is11dCountry =0 and
7781 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7782 * and return failure
7783 */
7784 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007785 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307786 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
7787 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307788 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007789
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307790 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007791
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307792 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007793 pMac->scan.countryCode11d,
7794 (v_REGDOMAIN_t *) &reg_domain_id,
7795 COUNTRY_IE);
7796
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307797 return eHAL_STATUS_FAILURE;
7798 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007799 }
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307800 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007801 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307802 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007803 {
7804 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05307805 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007806 }
7807
Kiet Lamf2f201e2013-11-16 21:24:16 +05307808 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007809 WNI_CFG_COUNTRY_CODE_LEN);
7810
Abhishek Singha306a442013-11-07 18:39:01 +05307811 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007812
Kiet Lam6c583332013-10-14 05:37:09 +05307813 if (VOS_FALSE == is11dCountry )
7814 {
7815 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307816 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307817 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7818 /* set to default domain ID */
7819 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7820 }
7821
Amar Singhal0d15bd52013-10-12 23:13:13 -07007822 if ( status != eHAL_STATUS_SUCCESS )
7823 {
7824 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307825 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007826 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007827 else
7828 {
7829 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7830 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007831 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7832 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007833 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007834 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007835 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7836 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7837 }
7838 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007839
Amar Singhal0d15bd52013-10-12 23:13:13 -07007840 /* get the channels based on new cc */
7841 status = csrInitGetChannels(pMac);
7842
7843 if ( status != eHAL_STATUS_SUCCESS )
7844 {
7845 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7846 return status;
7847 }
7848
7849 /* reset info based on new cc, and we are done */
7850 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307851 if (VOS_TRUE == is11dCountry)
7852 {
Kiet Lam6c583332013-10-14 05:37:09 +05307853 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7854 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7855 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307856 /* Country code Changed, Purge Only scan result
7857 * which does not have channel number belong to 11d
7858 * channel list
7859 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307860 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307861 // Do active scans after the country is set by User hints or Country IE
7862 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05307863 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007864 smsLog(pMac, LOG1, FL(" returned"));
7865 return eHAL_STATUS_SUCCESS;
7866}
7867
7868/* ---------------------------------------------------------------------------
7869
Kiet Lamcffc5862013-10-30 16:28:45 +05307870 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007871
7872 \brief Update Country code in the driver if set by kernel as world
7873
7874 If 11D is enabled, we update the country code after every scan & notify kernel.
7875 This is to make sure kernel & driver are in sync in case of CC found in
7876 driver but not in kernel database
7877
7878 \param pMac - The handle returned by macOpen.
7879 \param pMsg - Carrying new CC set in kernel
7880
7881 \return eHalStatus
7882
7883 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307884eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007885{
Kiet Lamcffc5862013-10-30 16:28:45 +05307886 eHalStatus status;
7887
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007888 smsLog(pMac, LOG1, FL(" called"));
7889
7890 //this is to make sure kernel & driver are in sync in case of CC found in
7891 //driver but not in kernel database
7892 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7893 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007894 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307895 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007896 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307897 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007898 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007899 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307900
Abhishek Singha306a442013-11-07 18:39:01 +05307901 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307902
7903 if ( status != eHAL_STATUS_SUCCESS )
7904 {
7905 smsLog( pMac, LOGE, FL(" fail to set regId") );
7906 return status;
7907 }
7908 else
7909 {
7910 status = csrInitGetChannels(pMac);
7911 if ( status != eHAL_STATUS_SUCCESS )
7912 {
7913 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7914 }
7915 else
7916 {
7917 csrInitChannelList(pMac);
7918 }
7919 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307920 /* Country code Changed, Purge Only scan result
7921 * which does not have channel number belong to 11d
7922 * channel list
7923 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307924 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007925 smsLog(pMac, LOG1, FL(" returned"));
7926 return eHAL_STATUS_SUCCESS;
7927}
7928
7929/* ---------------------------------------------------------------------------
7930
Sushant Kaushik1d732562014-05-21 14:15:37 +05307931 \fn sme_DisconnectConnectedSessions
7932
7933 \brief Disconnect STA and P2P client session if channel is not supported
7934
7935 If new country code does not support the channel on which STA/P2P client
7936 is connetced, it sends the disconnect to the AP/P2P GO
7937
7938 \param pMac - The handle returned by macOpen
7939
7940 \return eHalStatus
7941
7942 -------------------------------------------------------------------------------*/
7943
7944void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
7945{
7946 v_U8_t i, sessionId, isChanFound = false;
7947 tANI_U8 currChannel;
7948
7949 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
7950 {
7951 if (csrIsSessionClientAndConnected(pMac, sessionId))
7952 {
7953 isChanFound = false;
7954 //Session is connected.Check the channel
7955 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
7956 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
7957 currChannel, sessionId);
7958 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
7959 {
7960 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
7961 {
7962 isChanFound = true;
7963 break;
7964 }
7965 }
7966
7967 if (!isChanFound)
7968 {
7969 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
7970 {
7971 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
7972 {
7973 isChanFound = true;
7974 break;
7975 }
7976 }
7977 }
7978 if (!isChanFound)
7979 {
7980 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
7981 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
7982 }
7983 }
7984 }
7985}
7986/* ---------------------------------------------------------------------------
7987
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007988 \fn sme_HandleGenericChangeCountryCode
7989
7990 \brief Change Country code, Reg Domain and channel list
7991
7992 If Supplicant country code is priority than 11d is disabled.
7993 If 11D is enabled, we update the country code after every scan.
7994 Hence when Supplicant country code is priority, we don't need 11D info.
7995 Country code from kernel is set as current country code.
7996
7997 \param pMac - The handle returned by macOpen.
7998 \param pMsgBuf - message buffer
7999
8000 \return eHalStatus
8001
8002 -------------------------------------------------------------------------------*/
8003eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8004{
8005 tAniGenericChangeCountryCodeReq *pMsg;
8006 v_REGDOMAIN_t reg_domain_id;
8007
8008 smsLog(pMac, LOG1, FL(" called"));
8009 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
8010 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8011
8012 if (REGDOMAIN_COUNT == reg_domain_id)
8013 {
Kiet Lamcffc5862013-10-30 16:28:45 +05308014 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008015 }
8016 else
8017 {
8018 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
8019 }
8020 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008021 return eHAL_STATUS_SUCCESS;
8022}
8023
Jeff Johnson295189b2012-06-20 16:38:30 -07008024#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08008025eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07008026{
8027 tpSirRcvFltMcAddrList pRequestBuf;
8028 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008029 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07008030 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008031
8032 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05308033 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008034 pMulticastAddrs->ulMulticastAddrCnt,
8035 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07008036
8037 /*
8038 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08008039 */
8040 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
8041 csrIsConnStateInfra(pMac, sessionId))
8042 {
8043 pSession = CSR_GET_SESSION( pMac, sessionId );
8044 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008045
8046 if(pSession == NULL )
8047 {
8048 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008049 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07008050 return eHAL_STATUS_FAILURE;
8051 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008052
Jeff Johnson295189b2012-06-20 16:38:30 -07008053 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
8054 if (NULL == pRequestBuf)
8055 {
8056 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008057 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008058 return eHAL_STATUS_FAILED_ALLOC;
8059 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008060
8061 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
8062 {
8063 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
8064 "indication as we are not connected", __func__);
8065 vos_mem_free(pRequestBuf);
8066 return eHAL_STATUS_FAILURE;
8067 }
8068
Jeff Johnson295189b2012-06-20 16:38:30 -07008069 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
8070
Kiet Lam64c1b492013-07-12 13:56:44 +05308071 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
8072 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008073 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
8074 sizeof(tSirMacAddr));
8075
Jeff Johnson295189b2012-06-20 16:38:30 -07008076 msg.type = WDA_8023_MULTICAST_LIST_REQ;
8077 msg.reserved = 0;
8078 msg.bodyptr = pRequestBuf;
8079 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8080 {
8081 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008082 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008083 vos_mem_free(pRequestBuf);
8084 return eHAL_STATUS_FAILURE;
8085 }
8086
8087 return eHAL_STATUS_SUCCESS;
8088}
8089
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008090eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07008091 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008092{
8093 tpSirRcvPktFilterCfgType pRequestBuf;
8094 v_SINT_t allocSize;
8095 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008096 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8097 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008098 v_U8_t idx=0;
8099
8100 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008101 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008102 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008103
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07008104 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008105
Jeff Johnson295189b2012-06-20 16:38:30 -07008106 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008107
8108 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008109 {
8110 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008111 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008112 return eHAL_STATUS_FAILED_ALLOC;
8113 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008114
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008115 if( NULL == pSession )
8116 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008117 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008118 vos_mem_free(pRequestBuf);
8119 return eHAL_STATUS_FAILURE;
8120 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008121
Kiet Lam64c1b492013-07-12 13:56:44 +05308122 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
8123 sizeof(tSirMacAddr));
8124 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
8125 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008126 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
8127
Jeff Johnson295189b2012-06-20 16:38:30 -07008128 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
8129 msg.reserved = 0;
8130 msg.bodyptr = pRequestBuf;
8131
8132 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008133 "FT %d FID %d ",
8134 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008135
8136 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008137 "params %d CT %d",
8138 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008139
8140 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8141 {
8142
8143 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008144 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008145 pRequestBuf->paramsData[idx].protocolLayer,
8146 pRequestBuf->paramsData[idx].cmpFlag);
8147
8148 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008149 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008150 pRequestBuf->paramsData[idx].dataOffset,
8151 pRequestBuf->paramsData[idx].dataLength);
8152
8153 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008154 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008155 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008156 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008157 pRequestBuf->paramsData[idx].compareData[2],
8158 pRequestBuf->paramsData[idx].compareData[3],
8159 pRequestBuf->paramsData[idx].compareData[4],
8160 pRequestBuf->paramsData[idx].compareData[5]);
8161
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008162 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008163 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008164 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008165 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008166 pRequestBuf->paramsData[idx].dataMask[2],
8167 pRequestBuf->paramsData[idx].dataMask[3],
8168 pRequestBuf->paramsData[idx].dataMask[4],
8169 pRequestBuf->paramsData[idx].dataMask[5]);
8170
8171 }
8172
8173 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8174 {
8175 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008176 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008177 vos_mem_free(pRequestBuf);
8178 return eHAL_STATUS_FAILURE;
8179 }
8180
8181 return eHAL_STATUS_SUCCESS;
8182}
8183
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008184eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008185 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008186 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008187 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008188{
8189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8190 eHalStatus status;
8191
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008192 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008193
8194 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8195 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008196 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008197 sme_ReleaseGlobalLock( &pMac->sme );
8198 }
8199
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008200 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008201
8202 return (status);
8203}
8204
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008205eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008206 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008207{
8208 tpSirRcvFltPktClearParam pRequestBuf;
8209 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008210 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8211 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008212
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008213 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008214 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008215
Jeff Johnson295189b2012-06-20 16:38:30 -07008216 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008217 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008218 {
8219 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8220 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008221 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008222 return eHAL_STATUS_FAILED_ALLOC;
8223 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008224 if( NULL == pSession )
8225 {
8226 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008227 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008228 vos_mem_free(pRequestBuf);
8229 return eHAL_STATUS_FAILURE;
8230 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008231
Kiet Lam64c1b492013-07-12 13:56:44 +05308232 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8233 sizeof(tSirMacAddr));
8234 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8235 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008236
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008237 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8238
Jeff Johnson295189b2012-06-20 16:38:30 -07008239 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8240 msg.reserved = 0;
8241 msg.bodyptr = pRequestBuf;
8242 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8243 {
8244 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008245 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008246 vos_mem_free(pRequestBuf);
8247 return eHAL_STATUS_FAILURE;
8248 }
8249
8250 return eHAL_STATUS_SUCCESS;
8251}
8252#endif // WLAN_FEATURE_PACKET_FILTERING
8253
8254/* ---------------------------------------------------------------------------
8255 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008256 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008257 channel switch.
8258 \param callbackContext
8259 \param status
8260 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008261void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008262 eHalStatus status)
8263{
8264 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8265 tSirMbMsg *pMsg;
8266 tANI_U16 msgLen;
8267
8268 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308269 pMsg = vos_mem_malloc(msgLen);
8270 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008271 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308272 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008273 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8274 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8275 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008276 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008277
8278 return;
8279}
8280
8281/* ---------------------------------------------------------------------------
8282 \fn sme_HandlePreChannelSwitchInd
8283 \brief Processes the indcation from PE for pre-channel switch.
8284 \param hHal
8285 \- The handle returned by macOpen. return eHalStatus
8286 ---------------------------------------------------------------------------*/
8287eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8288{
8289 eHalStatus status = eHAL_STATUS_FAILURE;
8290 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8291 status = sme_AcquireGlobalLock( &pMac->sme );
8292 if ( HAL_STATUS_SUCCESS( status ) )
8293 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008294 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8295 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008296 sme_ReleaseGlobalLock( &pMac->sme );
8297 }
8298
8299 return (status);
8300}
8301
8302/* ---------------------------------------------------------------------------
8303 \fn sme_HandlePostChannelSwitchInd
8304 \brief Processes the indcation from PE for post-channel switch.
8305 \param hHal
8306 \- The handle returned by macOpen. return eHalStatus
8307 ---------------------------------------------------------------------------*/
8308eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8309{
8310 eHalStatus status = eHAL_STATUS_FAILURE;
8311 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8312
8313 status = sme_AcquireGlobalLock( &pMac->sme );
8314 if ( HAL_STATUS_SUCCESS( status ) )
8315 {
8316 status = pmcRequestBmps(hHal, NULL, NULL);
8317 sme_ReleaseGlobalLock( &pMac->sme );
8318 }
8319
8320 return (status);
8321}
8322
8323/* ---------------------------------------------------------------------------
8324
8325 \fn sme_IsChannelValid
8326
8327 \brief To check if the channel is valid for currently established domain
8328 This is a synchronous API.
8329
8330 \param hHal - The handle returned by macOpen.
8331 \param channel - channel to verify
8332
8333 \return TRUE/FALSE, TRUE if channel is valid
8334
8335 -------------------------------------------------------------------------------*/
8336tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8337{
8338 eHalStatus status = eHAL_STATUS_FAILURE;
8339 tANI_BOOLEAN valid = FALSE;
8340 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008341
Jeff Johnson295189b2012-06-20 16:38:30 -07008342 status = sme_AcquireGlobalLock( &pMac->sme );
8343 if ( HAL_STATUS_SUCCESS( status ) )
8344 {
8345
8346 valid = csrRoamIsChannelValid( pMac, channel);
8347
8348 sme_ReleaseGlobalLock( &pMac->sme );
8349 }
8350
8351 return (valid);
8352}
8353
8354/* ---------------------------------------------------------------------------
8355 \fn sme_SetFreqBand
8356 \brief Used to set frequency band.
8357 \param hHal
8358 \eBand band value to be configured
8359 \- return eHalStatus
8360 -------------------------------------------------------------------------*/
8361eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8362{
8363 eHalStatus status = eHAL_STATUS_FAILURE;
8364 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8365
8366 status = sme_AcquireGlobalLock( &pMac->sme );
8367 if ( HAL_STATUS_SUCCESS( status ) )
8368 {
8369 status = csrSetBand(hHal, eBand);
8370 sme_ReleaseGlobalLock( &pMac->sme );
8371 }
8372 return status;
8373}
8374
8375/* ---------------------------------------------------------------------------
8376 \fn sme_GetFreqBand
8377 \brief Used to get the current band settings.
8378 \param hHal
8379 \pBand pointer to hold band value
8380 \- return eHalStatus
8381 -------------------------------------------------------------------------*/
8382eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8383{
8384 eHalStatus status = eHAL_STATUS_FAILURE;
8385 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8386
8387 status = sme_AcquireGlobalLock( &pMac->sme );
8388 if ( HAL_STATUS_SUCCESS( status ) )
8389 {
8390 *pBand = csrGetCurrentBand( hHal );
8391 sme_ReleaseGlobalLock( &pMac->sme );
8392 }
8393 return status;
8394}
8395
8396#ifdef WLAN_WAKEUP_EVENTS
8397/******************************************************************************
8398 \fn sme_WakeReasonIndCallback
8399
8400 \brief
8401 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8402
8403 \param hHal - HAL handle for device
8404 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8405
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008406 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008407******************************************************************************/
8408eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8409{
8410 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8411 eHalStatus status = eHAL_STATUS_SUCCESS;
8412 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8413
8414 if (NULL == pMsg)
8415 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008416 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008417 status = eHAL_STATUS_FAILURE;
8418 }
8419 else
8420 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008421 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008422
8423 /* Call Wake Reason Indication callback routine. */
8424 if (pMac->pmc.wakeReasonIndCB != NULL)
8425 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008426
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008427 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008428 }
8429
8430 return(status);
8431}
8432#endif // WLAN_WAKEUP_EVENTS
8433
8434
8435/* ---------------------------------------------------------------------------
8436
8437 \fn sme_SetMaxTxPower
8438
8439 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8440 not persist over reboots.
8441
8442 \param hHal
8443 \param pBssid BSSID to set the power cap for
8444 \param pBssid pSelfMacAddress self MAC Address
8445 \param pBssid power to set in dB
8446 \- return eHalStatus
8447
8448 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008449eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008450 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8451{
8452 vos_msg_t msg;
8453 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308454 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008455 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008456 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8457 if (NULL == pMaxTxParams)
8458 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008459 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 -07008460 return eHAL_STATUS_FAILURE;
8461 }
8462
8463 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308464 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008465 SIR_MAC_ADDR_LENGTH);
8466 pMaxTxParams->power = dB;
8467
8468 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8469 msg.reserved = 0;
8470 msg.bodyptr = pMaxTxParams;
8471
8472 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8473 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008474 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 -07008475 vos_mem_free(pMaxTxParams);
8476 return eHAL_STATUS_FAILURE;
8477 }
8478
8479 return eHAL_STATUS_SUCCESS;
8480}
8481
Jeff Johnson295189b2012-06-20 16:38:30 -07008482/* ---------------------------------------------------------------------------
8483
Arif Hussaina5ebce02013-08-09 15:09:58 -07008484 \fn sme_SetMaxTxPowerPerBand
8485
8486 \brief Set the Maximum Transmit Power specific to band dynamically.
8487 Note: this setting will not persist over reboots.
8488
8489 \param band
8490 \param power to set in dB
8491 \- return eHalStatus
8492
8493 ----------------------------------------------------------------------------*/
8494eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8495{
8496 vos_msg_t msg;
8497 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8498
8499 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8500 if (NULL == pMaxTxPowerPerBandParams)
8501 {
8502 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8503 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8504 __func__);
8505 return eHAL_STATUS_FAILURE;
8506 }
8507
8508 pMaxTxPowerPerBandParams->power = dB;
8509 pMaxTxPowerPerBandParams->bandInfo = band;
8510
8511 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8512 msg.reserved = 0;
8513 msg.bodyptr = pMaxTxPowerPerBandParams;
8514
8515 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8516 {
8517 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8518 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8519 __func__);
8520 vos_mem_free(pMaxTxPowerPerBandParams);
8521 return eHAL_STATUS_FAILURE;
8522 }
8523
8524 return eHAL_STATUS_SUCCESS;
8525}
8526
8527/* ---------------------------------------------------------------------------
8528
schang86c22c42013-03-13 18:41:24 -07008529 \fn sme_SetTxPower
8530
8531 \brief Set Transmit Power dynamically. Note: this setting will
8532 not persist over reboots.
8533
8534 \param hHal
8535 \param sessionId Target Session ID
8536 \param mW power to set in mW
8537 \- return eHalStatus
8538
8539 -------------------------------------------------------------------------------*/
8540eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8541{
8542
8543 eHalStatus status = eHAL_STATUS_FAILURE;
8544 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8545
Katya Nigambcb705f2013-12-26 14:26:22 +05308546 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008547 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008548 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8549 status = sme_AcquireGlobalLock(&pMac->sme);
8550 if (HAL_STATUS_SUCCESS(status))
8551 {
8552 status = csrSetTxPower(pMac, sessionId, mW);
8553 sme_ReleaseGlobalLock(&pMac->sme);
8554 }
8555 return status;
8556}
8557
8558/* ---------------------------------------------------------------------------
8559
Jeff Johnson295189b2012-06-20 16:38:30 -07008560 \fn sme_HideSSID
8561
8562 \brief hide/show SSID dynamically. Note: this setting will
8563 not persist over reboots.
8564
8565 \param hHal
8566 \param sessionId
8567 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8568 \- return eHalStatus
8569
8570 -------------------------------------------------------------------------------*/
8571eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8572{
8573 eHalStatus status = eHAL_STATUS_SUCCESS;
8574 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8575 tANI_U16 len;
8576
8577 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8578 {
8579 tpSirUpdateParams pMsg;
8580 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008581
8582 if(!pSession)
8583 {
8584 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008585 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008586 return eHAL_STATUS_FAILURE;
8587 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008588
8589 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008590 VOS_ASSERT(0);
8591
8592 /* Create the message and send to lim */
8593 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308594 pMsg = vos_mem_malloc(len);
8595 if ( NULL == pMsg )
8596 status = eHAL_STATUS_FAILURE;
8597 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008598 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308599 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008600 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8601 pMsg->length = len;
8602 /* Data starts from here */
8603 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008604 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008605 status = palSendMBMessage(pMac->hHdd, pMsg);
8606 }
8607 sme_ReleaseGlobalLock( &pMac->sme );
8608 }
8609 return status;
8610}
Jeff Johnson295189b2012-06-20 16:38:30 -07008611
8612/* ---------------------------------------------------------------------------
8613
8614 \fn sme_SetTmLevel
8615 \brief Set Thermal Mitigation Level to RIVA
8616 \param hHal - The handle returned by macOpen.
8617 \param newTMLevel - new Thermal Mitigation Level
8618 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008619 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008620 ---------------------------------------------------------------------------*/
8621eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8622{
8623 eHalStatus status = eHAL_STATUS_SUCCESS;
8624 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8625 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8626 vos_msg_t vosMessage;
8627 tAniSetTmLevelReq *setTmLevelReq = NULL;
8628
Katya Nigambcb705f2013-12-26 14:26:22 +05308629 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008630 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008631 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8632 {
8633 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308634 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008635 {
8636 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008637 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008638 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008639 return eHAL_STATUS_FAILURE;
8640 }
8641
8642 setTmLevelReq->tmMode = tmMode;
8643 setTmLevelReq->newTmLevel = newTMLevel;
8644
8645 /* serialize the req through MC thread */
8646 vosMessage.bodyptr = setTmLevelReq;
8647 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8648 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8649 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8650 {
8651 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008652 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008653 vos_mem_free(setTmLevelReq);
8654 status = eHAL_STATUS_FAILURE;
8655 }
8656 sme_ReleaseGlobalLock( &pMac->sme );
8657 }
8658 return(status);
8659}
8660
8661/*---------------------------------------------------------------------------
8662
8663 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8664 Host and FW.
8665
8666 \param hHal - HAL handle for device
8667
8668 \return NONE
8669
8670---------------------------------------------------------------------------*/
8671void sme_featureCapsExchange( tHalHandle hHal)
8672{
8673 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308674 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008675 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008676 WDA_featureCapsExchange(vosContext);
8677}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008678
Yathish9f22e662012-12-10 14:21:35 -08008679/*---------------------------------------------------------------------------
8680
8681 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8682 in Host.
8683
8684 \param hHal - HAL handle for device
8685
8686 \return NONE
8687
8688---------------------------------------------------------------------------*/
8689void sme_disableFeatureCapablity(tANI_U8 feature_index)
8690{
8691 WDA_disableCapablityFeature(feature_index);
8692}
8693
Jeff Johnsond13512a2012-07-17 11:42:19 -07008694/* ---------------------------------------------------------------------------
8695
8696 \fn sme_GetDefaultCountryCode
8697
8698 \brief Get the default country code from NV
8699
8700 \param hHal
8701 \param pCountry
8702 \- return eHalStatus
8703
8704 -------------------------------------------------------------------------------*/
8705eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8706{
8707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308708 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008709 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008710 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8711}
8712
8713/* ---------------------------------------------------------------------------
8714
8715 \fn sme_GetCurrentCountryCode
8716
8717 \brief Get the current country code
8718
8719 \param hHal
8720 \param pCountry
8721 \- return eHalStatus
8722
8723 -------------------------------------------------------------------------------*/
8724eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8725{
8726 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308727 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008728 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008729 return csrGetCurrentCountryCode(pMac, pCountry);
8730}
8731
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008732/* ---------------------------------------------------------------------------
8733 \fn sme_transportDebug
8734 \brief Dynamically monitoring Transport channels
8735 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008736 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008737 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008738 \param toggleStallDetect Enable stall detect feature
8739 This feature will take effect to data performance
8740 Not integrate till fully verification
8741 \- return NONE
8742 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008743void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008744{
schang6295e542013-03-12 15:31:23 -07008745 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8746
8747 if (NULL == pMac)
8748 {
8749 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8750 "%s: invalid context", __func__);
8751 return;
8752 }
8753 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008754}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008755
Kiran4a17ebe2013-01-31 10:43:43 -08008756/* ---------------------------------------------------------------------------
8757 \fn sme_ResetPowerValuesFor5G
8758 \brief Reset the power values for 5G band with NV power values.
8759 \param hHal - HAL handle for device
8760 \- return NONE
8761 -------------------------------------------------------------------------*/
8762void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8763{
8764 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308765 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008766 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008767 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8768 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8769}
8770
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008771#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008772/* ---------------------------------------------------------------------------
8773 \fn sme_UpdateRoamPrefer5GHz
8774 \brief enable/disable Roam prefer 5G runtime option
8775 This function is called through dynamic setConfig callback function
8776 to configure the Roam prefer 5G runtime option
8777 \param hHal - HAL handle for device
8778 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8779 \- return Success or failure
8780 -------------------------------------------------------------------------*/
8781
8782eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8783{
8784 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008785 eHalStatus status = eHAL_STATUS_SUCCESS;
8786
Katya Nigambcb705f2013-12-26 14:26:22 +05308787 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008788 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008789 status = sme_AcquireGlobalLock( &pMac->sme );
8790 if ( HAL_STATUS_SUCCESS( status ) )
8791 {
8792 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8793 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8794 pMac->roam.configParam.nRoamPrefer5GHz,
8795 nRoamPrefer5GHz);
8796 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8797 sme_ReleaseGlobalLock( &pMac->sme );
8798 }
8799
8800 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008801}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008802
8803/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008804 \fn sme_setRoamIntraBand
8805 \brief enable/disable Intra band roaming
8806 This function is called through dynamic setConfig callback function
8807 to configure the intra band roaming
8808 \param hHal - HAL handle for device
8809 \param nRoamIntraBand Enable/Disable Intra band roaming
8810 \- return Success or failure
8811 -------------------------------------------------------------------------*/
8812eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8813{
8814 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8815 eHalStatus status = eHAL_STATUS_SUCCESS;
8816
Katya Nigambcb705f2013-12-26 14:26:22 +05308817 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008818 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008819 status = sme_AcquireGlobalLock( &pMac->sme );
8820 if ( HAL_STATUS_SUCCESS( status ) )
8821 {
8822 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8823 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8824 pMac->roam.configParam.nRoamIntraBand,
8825 nRoamIntraBand);
8826 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8827 sme_ReleaseGlobalLock( &pMac->sme );
8828 }
8829
8830 return status ;
8831}
8832
8833/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008834 \fn sme_UpdateRoamScanNProbes
8835 \brief function to update roam scan N probes
8836 This function is called through dynamic setConfig callback function
8837 to update roam scan N probes
8838 \param hHal - HAL handle for device
8839 \param nProbes number of probe requests to be sent out
8840 \- return Success or failure
8841 -------------------------------------------------------------------------*/
8842eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8843{
8844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8845 eHalStatus status = eHAL_STATUS_SUCCESS;
8846
8847 status = sme_AcquireGlobalLock( &pMac->sme );
8848 if ( HAL_STATUS_SUCCESS( status ) )
8849 {
8850 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8851 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8852 pMac->roam.configParam.nProbes,
8853 nProbes);
8854 pMac->roam.configParam.nProbes = nProbes;
8855 sme_ReleaseGlobalLock( &pMac->sme );
8856 }
8857#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8858 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8859 {
8860 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8861 REASON_NPROBES_CHANGED);
8862 }
8863#endif
8864 return status ;
8865}
8866
8867/* ---------------------------------------------------------------------------
8868 \fn sme_UpdateRoamScanHomeAwayTime
8869 \brief function to update roam scan Home away time
8870 This function is called through dynamic setConfig callback function
8871 to update roam scan home away time
8872 \param hHal - HAL handle for device
8873 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008874 \param bSendOffloadCmd If TRUE then send offload command to firmware
8875 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008876 \- return Success or failure
8877 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008878eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8879 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008880{
8881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8882 eHalStatus status = eHAL_STATUS_SUCCESS;
8883
8884 status = sme_AcquireGlobalLock( &pMac->sme );
8885 if ( HAL_STATUS_SUCCESS( status ) )
8886 {
8887 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8888 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8889 pMac->roam.configParam.nRoamScanHomeAwayTime,
8890 nRoamScanHomeAwayTime);
8891 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8892 sme_ReleaseGlobalLock( &pMac->sme );
8893 }
8894
8895#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008896 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008897 {
8898 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8899 REASON_HOME_AWAY_TIME_CHANGED);
8900 }
8901#endif
8902 return status;
8903}
8904
8905
8906/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008907 \fn sme_getRoamIntraBand
8908 \brief get Intra band roaming
8909 \param hHal - HAL handle for device
8910 \- return Success or failure
8911 -------------------------------------------------------------------------*/
8912v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8913{
8914 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308915 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008916 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008917 return pMac->roam.configParam.nRoamIntraBand;
8918}
8919
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008920/* ---------------------------------------------------------------------------
8921 \fn sme_getRoamScanNProbes
8922 \brief get N Probes
8923 \param hHal - HAL handle for device
8924 \- return Success or failure
8925 -------------------------------------------------------------------------*/
8926v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8927{
8928 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8929 return pMac->roam.configParam.nProbes;
8930}
8931
8932/* ---------------------------------------------------------------------------
8933 \fn sme_getRoamScanHomeAwayTime
8934 \brief get Roam scan home away time
8935 \param hHal - HAL handle for device
8936 \- return Success or failure
8937 -------------------------------------------------------------------------*/
8938v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8939{
8940 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8941 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8942}
8943
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008944
8945/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008946 \fn sme_UpdateImmediateRoamRssiDiff
8947 \brief Update nImmediateRoamRssiDiff
8948 This function is called through dynamic setConfig callback function
8949 to configure nImmediateRoamRssiDiff
8950 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8951 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008952 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008953 candidate and current AP.
8954 \- return Success or failure
8955 -------------------------------------------------------------------------*/
8956
8957eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8958{
8959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008960 eHalStatus status = eHAL_STATUS_SUCCESS;
8961
Katya Nigambcb705f2013-12-26 14:26:22 +05308962 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008963 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008964 status = sme_AcquireGlobalLock( &pMac->sme );
8965 if ( HAL_STATUS_SUCCESS( status ) )
8966 {
8967 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308968 "LFR runtime successfully set immediate roam rssi diff to"
8969 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008970 nImmediateRoamRssiDiff,
8971 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308972 macTraceGetNeighbourRoamState(
8973 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008974 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8975 sme_ReleaseGlobalLock( &pMac->sme );
8976 }
8977
8978 return status ;
8979}
8980
8981/* ---------------------------------------------------------------------------
8982 \fn sme_UpdateRoamRssiDiff
8983 \brief Update RoamRssiDiff
8984 This function is called through dynamic setConfig callback function
8985 to configure RoamRssiDiff
8986 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8987 \param hHal - HAL handle for device
8988 \param RoamRssiDiff - minimum rssi difference between potential
8989 candidate and current AP.
8990 \- return Success or failure
8991 -------------------------------------------------------------------------*/
8992
8993eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8994{
8995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8996 eHalStatus status = eHAL_STATUS_SUCCESS;
8997
8998 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308999 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009000 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009001 if ( HAL_STATUS_SUCCESS( status ) )
9002 {
9003 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309004 "LFR runtime successfully set roam rssi diff to %d"
9005 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009006 RoamRssiDiff,
9007 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309008 macTraceGetNeighbourRoamState(
9009 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009010 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
9011 sme_ReleaseGlobalLock( &pMac->sme );
9012 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009013#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9014 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9015 {
9016 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
9017 }
9018#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009019 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009020}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009021
9022/*--------------------------------------------------------------------------
9023 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009024 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009025 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009026 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009027 \param hHal - The handle returned by macOpen.
9028 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
9029 Other status means SME is failed to update isFastTransitionEnabled.
9030 \sa
9031 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009032eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009033 v_BOOL_t isFastTransitionEnabled)
9034{
9035 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009036 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009037
Katya Nigambcb705f2013-12-26 14:26:22 +05309038 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009039 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009040 status = sme_AcquireGlobalLock( &pMac->sme );
9041 if ( HAL_STATUS_SUCCESS( status ) )
9042 {
9043 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9044 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
9045 pMac->roam.configParam.isFastTransitionEnabled,
9046 isFastTransitionEnabled);
9047 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
9048 sme_ReleaseGlobalLock( &pMac->sme );
9049 }
9050
9051 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009052}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009053
9054/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009055 \fn sme_UpdateWESMode
9056 \brief Update WES Mode
9057 This function is called through dynamic setConfig callback function
9058 to configure isWESModeEnabled
9059 \param hHal - HAL handle for device
9060 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
9061 Other status means SME is failed to update isWESModeEnabled.
9062 -------------------------------------------------------------------------*/
9063
9064eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
9065{
9066 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9067 eHalStatus status = eHAL_STATUS_SUCCESS;
9068
9069 status = sme_AcquireGlobalLock( &pMac->sme );
9070 if ( HAL_STATUS_SUCCESS( status ) )
9071 {
9072 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309073 "LFR runtime successfully set WES Mode to %d"
9074 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009075 isWESModeEnabled,
9076 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309077 macTraceGetNeighbourRoamState(
9078 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009079 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
9080 sme_ReleaseGlobalLock( &pMac->sme );
9081 }
9082
9083 return status ;
9084}
9085
9086/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009087 \fn sme_SetRoamScanControl
9088 \brief Set roam scan control
9089 This function is called to set roam scan control
9090 if roam scan control is set to 0, roaming scan cache is cleared
9091 any value other than 0 is treated as invalid value
9092 \param hHal - HAL handle for device
9093 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9094 Other status means SME failure to update
9095 -------------------------------------------------------------------------*/
9096eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
9097{
9098 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9099 eHalStatus status = eHAL_STATUS_SUCCESS;
9100
Katya Nigambcb705f2013-12-26 14:26:22 +05309101 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009102 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009103 status = sme_AcquireGlobalLock( &pMac->sme );
9104 if ( HAL_STATUS_SUCCESS( status ) )
9105 {
9106 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309107 "LFR runtime successfully set roam scan control to %d"
9108 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009109 roamScanControl,
9110 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309111 macTraceGetNeighbourRoamState(
9112 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009113 pMac->roam.configParam.nRoamScanControl = roamScanControl;
9114 if ( 0 == roamScanControl)
9115 {
9116 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9117 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009118 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009119#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9120 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9121 {
9122 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
9123 }
9124#endif
9125 }
9126 sme_ReleaseGlobalLock( &pMac->sme );
9127 }
9128 return status ;
9129}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009130#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009131
9132#ifdef FEATURE_WLAN_LFR
9133/*--------------------------------------------------------------------------
9134 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009135 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009136 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009137 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009138 \param hHal - The handle returned by macOpen.
9139 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9140 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9141 \sa
9142 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009143eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009144 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009145{
9146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9147
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009148 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9149 {
9150 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9151 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9152 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9153 isFastRoamIniFeatureEnabled);
9154 return eHAL_STATUS_SUCCESS;
9155 }
9156
Srinivas Girigowdade697412013-02-14 16:31:48 -08009157 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9158 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9159 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9160 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009161 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009162 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009163
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009164 return eHAL_STATUS_SUCCESS;
9165}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009166
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009167/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +05309168 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
9169 When Supplicant issue enabled / disable fwr based roaming on the basis
9170 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
9171
9172 This is a synchronous call
9173 \param hHal - The handle returned by macOpen.
9174 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
9175 Other status means SME is failed to (enabled/disabled) offload scan.
9176 \sa
9177 --------------------------------------------------------------------------*/
9178
9179eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
9180 const v_BOOL_t isFastRoamEnabled)
9181{
9182 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9183 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
9184 {
9185 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9186 "%s: FastRoam is disabled through ini", __func__);
9187 return eHAL_STATUS_FAILURE;
9188 }
9189 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
9190 return eHAL_STATUS_SUCCESS;
9191}
9192
9193/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009194 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9195 Enable/disable LFR MAWC support at runtime
9196 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9197 isMAWCIniFeatureEnabled.
9198 This is a synchronous call
9199 \param hHal - The handle returned by macOpen.
9200 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9201 Other status means SME is failed to update MAWCEnabled.
9202 \sa
9203 --------------------------------------------------------------------------*/
9204eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9205 const v_BOOL_t MAWCEnabled)
9206{
9207 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9208 eHalStatus status = eHAL_STATUS_SUCCESS;
9209
9210 status = sme_AcquireGlobalLock( &pMac->sme );
9211 if ( HAL_STATUS_SUCCESS( status ) )
9212 {
9213 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9214 "%s: MAWCEnabled is changed from %d to %d", __func__,
9215 pMac->roam.configParam.MAWCEnabled,
9216 MAWCEnabled);
9217 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
9218 sme_ReleaseGlobalLock( &pMac->sme );
9219 }
9220
9221 return status ;
9222
9223}
9224
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009225#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9226/*--------------------------------------------------------------------------
9227 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
9228 This is a synchronuous call
9229 \param hHal - The handle returned by macOpen.
9230 \return eHAL_STATUS_SUCCESS
9231 Other status means SME is failed
9232 \sa
9233 --------------------------------------------------------------------------*/
9234
9235eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
9236 v_BOOL_t bFastRoamInConIniFeatureEnabled)
9237{
9238
9239 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9240 eHalStatus status = eHAL_STATUS_SUCCESS;
9241
9242 status = sme_AcquireGlobalLock( &pMac->sme );
9243 if ( HAL_STATUS_SUCCESS( status ) )
9244 {
9245 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9246 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9247 {
9248 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9249 }
9250 sme_ReleaseGlobalLock( &pMac->sme );
9251 }
9252
9253 return status;
9254}
9255#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009256#endif /* FEATURE_WLAN_LFR */
9257
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009258#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009259/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009260 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009261 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009262 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009263 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009264 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009265 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9266 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009267 \sa
9268 --------------------------------------------------------------------------*/
9269
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009270eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9271 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009272{
9273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9274
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009275 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009276 {
9277 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009278 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9279 pMac->roam.configParam.isEseIniFeatureEnabled,
9280 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009281 return eHAL_STATUS_SUCCESS;
9282 }
9283
Srinivas Girigowdade697412013-02-14 16:31:48 -08009284 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009285 "%s: EseEnabled is changed from %d to %d", __func__,
9286 pMac->roam.configParam.isEseIniFeatureEnabled,
9287 isEseIniFeatureEnabled);
9288 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9289 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009290
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009291 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009292 {
9293 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009294 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009295
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009296#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9297 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9298 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009299 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009300 }
9301#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009302 return eHAL_STATUS_SUCCESS;
9303}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009304#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009305
9306/*--------------------------------------------------------------------------
9307 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9308 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9309 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009310 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009311 \param hHal - The handle returned by macOpen.
9312 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9313 Other status means SME is failed to update fEnableFwRssiMonitoring.
9314 \sa
9315 --------------------------------------------------------------------------*/
9316
9317eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9318 v_BOOL_t fEnableFwRssiMonitoring)
9319{
9320 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9321
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009322 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9323 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9324 {
9325 halStatus = eHAL_STATUS_FAILURE;
9326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009327 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009328 }
9329
9330 return (halStatus);
9331}
9332
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009333#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009334/*--------------------------------------------------------------------------
9335 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9336 This is a synchronous call
9337 \param hHal - The handle returned by macOpen.
9338 \return eHAL_STATUS_SUCCESS - SME update config successful.
9339 Other status means SME is failed to update
9340 \sa
9341 --------------------------------------------------------------------------*/
9342eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9343 v_U8_t neighborLookupRssiThreshold)
9344{
9345 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9346 eHalStatus status = eHAL_STATUS_SUCCESS;
9347
9348 status = sme_AcquireGlobalLock( &pMac->sme );
9349 if ( HAL_STATUS_SUCCESS( status ) )
9350 {
9351 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9352 if (HAL_STATUS_SUCCESS(status))
9353 {
9354 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309355 "LFR runtime successfully set Lookup threshold to %d"
9356 " - old value is %d - roam state is %s",
9357 neighborLookupRssiThreshold,
9358 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9359 macTraceGetNeighbourRoamState(
9360 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009361 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9362 neighborLookupRssiThreshold;
9363 }
9364 sme_ReleaseGlobalLock( &pMac->sme );
9365 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009366 return status;
9367}
9368
9369/*--------------------------------------------------------------------------
9370 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9371 This is a synchronous call
9372 \param hHal - The handle returned by macOpen.
9373 \return eHAL_STATUS_SUCCESS - SME update config successful.
9374 Other status means SME is failed to update
9375 \sa
9376 --------------------------------------------------------------------------*/
9377eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9378 v_U8_t neighborReassocRssiThreshold)
9379{
9380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9381 eHalStatus status = eHAL_STATUS_SUCCESS;
9382
9383 status = sme_AcquireGlobalLock( &pMac->sme );
9384 if ( HAL_STATUS_SUCCESS( status ) )
9385 {
9386 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309387 "LFR runtime successfully set Reassoc threshold to %d"
9388 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009389 neighborReassocRssiThreshold,
9390 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309391 macTraceGetNeighbourRoamState(
9392 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009393 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9394 neighborReassocRssiThreshold;
9395 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9396 neighborReassocRssiThreshold;
9397 sme_ReleaseGlobalLock( &pMac->sme );
9398 }
9399
9400 return status ;
9401}
9402
9403
9404/*--------------------------------------------------------------------------
9405 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9406 This is a synchronous call
9407 \param hHal - The handle returned by macOpen.
9408 \return eHAL_STATUS_SUCCESS - SME update config successful.
9409 Other status means SME is failed to update
9410 \sa
9411 --------------------------------------------------------------------------*/
9412v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9413{
9414 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9415 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9416}
9417
9418/*--------------------------------------------------------------------------
9419 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9420 This is a synchronous call
9421 \param hHal - The handle returned by macOpen.
9422 \return eHAL_STATUS_SUCCESS - SME update config successful.
9423 Other status means SME is failed to update
9424 \sa
9425 --------------------------------------------------------------------------*/
9426eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9427 v_U16_t neighborScanResultsRefreshPeriod)
9428{
9429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9430 eHalStatus status = eHAL_STATUS_SUCCESS;
9431
9432 status = sme_AcquireGlobalLock( &pMac->sme );
9433 if ( HAL_STATUS_SUCCESS( status ) )
9434 {
9435 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309436 "LFR runtime successfully set roam scan refresh period to %d"
9437 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009438 neighborScanResultsRefreshPeriod,
9439 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309440 macTraceGetNeighbourRoamState(
9441 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009442 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9443 neighborScanResultsRefreshPeriod;
9444 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9445 neighborScanResultsRefreshPeriod;
9446
9447 sme_ReleaseGlobalLock( &pMac->sme );
9448 }
9449
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009450#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9451 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9452 {
9453 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9454 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9455 }
9456#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009457 return status ;
9458}
9459
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009460#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9461/*--------------------------------------------------------------------------
9462 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9463 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9464 gRoamScanOffloadEnabled.
9465 This is a synchronous call
9466 \param hHal - The handle returned by macOpen.
9467 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9468 Other status means SME is failed to update.
9469 \sa
9470 --------------------------------------------------------------------------*/
9471
9472eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9473 v_BOOL_t nRoamScanOffloadEnabled)
9474{
9475 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9476 eHalStatus status = eHAL_STATUS_SUCCESS;
9477
9478 status = sme_AcquireGlobalLock( &pMac->sme );
9479 if ( HAL_STATUS_SUCCESS( status ) )
9480 {
9481 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9482 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9483 pMac->roam.configParam.isRoamOffloadScanEnabled,
9484 nRoamScanOffloadEnabled);
9485 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9486 sme_ReleaseGlobalLock( &pMac->sme );
9487 }
9488
9489 return status ;
9490}
9491#endif
9492
Srinivas Girigowdade697412013-02-14 16:31:48 -08009493/*--------------------------------------------------------------------------
9494 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9495 This is a synchronous call
9496 \param hHal - The handle returned by macOpen.
9497 \return v_U16_t - Neighbor scan results refresh period value
9498 \sa
9499 --------------------------------------------------------------------------*/
9500v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9501{
9502 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9503 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9504}
9505
9506/*--------------------------------------------------------------------------
9507 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9508 This is a synchronuous call
9509 \param hHal - The handle returned by macOpen.
9510 \return eHAL_STATUS_SUCCESS - SME update config successful.
9511 Other status means SME is failed to update
9512 \sa
9513 --------------------------------------------------------------------------*/
9514v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9515{
9516 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9517 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9518}
9519
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009520/* ---------------------------------------------------------------------------
9521 \fn sme_UpdateEmptyScanRefreshPeriod
9522 \brief Update nEmptyScanRefreshPeriod
9523 This function is called through dynamic setConfig callback function
9524 to configure nEmptyScanRefreshPeriod
9525 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9526 \param hHal - HAL handle for device
9527 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9528 \- return Success or failure
9529 -------------------------------------------------------------------------*/
9530
9531eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9532{
9533 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9534 eHalStatus status = eHAL_STATUS_SUCCESS;
9535
9536 status = sme_AcquireGlobalLock( &pMac->sme );
9537 if ( HAL_STATUS_SUCCESS( status ) )
9538 {
9539 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309540 "LFR runtime successfully set roam scan period to %d -"
9541 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009542 nEmptyScanRefreshPeriod,
9543 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309544 macTraceGetNeighbourRoamState(
9545 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009546 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9547 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9548 sme_ReleaseGlobalLock( &pMac->sme );
9549 }
9550
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009551#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9552 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9553 {
9554 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9555 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9556 }
9557#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009558 return status ;
9559}
9560
9561/* ---------------------------------------------------------------------------
9562 \fn sme_setNeighborScanMinChanTime
9563 \brief Update nNeighborScanMinChanTime
9564 This function is called through dynamic setConfig callback function
9565 to configure gNeighborScanChannelMinTime
9566 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9567 \param hHal - HAL handle for device
9568 \param nNeighborScanMinChanTime - Channel minimum dwell time
9569 \- return Success or failure
9570 -------------------------------------------------------------------------*/
9571eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9572{
9573 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9574 eHalStatus status = eHAL_STATUS_SUCCESS;
9575
9576 status = sme_AcquireGlobalLock( &pMac->sme );
9577 if ( HAL_STATUS_SUCCESS( status ) )
9578 {
9579 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309580 "LFR runtime successfully set channel min dwell time to %d"
9581 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009582 nNeighborScanMinChanTime,
9583 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309584 macTraceGetNeighbourRoamState(
9585 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009586 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9587 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9588 sme_ReleaseGlobalLock( &pMac->sme );
9589 }
9590
9591 return status ;
9592}
9593
9594/* ---------------------------------------------------------------------------
9595 \fn sme_setNeighborScanMaxChanTime
9596 \brief Update nNeighborScanMaxChanTime
9597 This function is called through dynamic setConfig callback function
9598 to configure gNeighborScanChannelMaxTime
9599 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9600 \param hHal - HAL handle for device
9601 \param nNeighborScanMinChanTime - Channel maximum dwell time
9602 \- return Success or failure
9603 -------------------------------------------------------------------------*/
9604eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9605{
9606 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9607 eHalStatus status = eHAL_STATUS_SUCCESS;
9608
9609 status = sme_AcquireGlobalLock( &pMac->sme );
9610 if ( HAL_STATUS_SUCCESS( status ) )
9611 {
9612 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309613 "LFR runtime successfully set channel max dwell time to %d"
9614 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009615 nNeighborScanMaxChanTime,
9616 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309617 macTraceGetNeighbourRoamState(
9618 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009619 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9620 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9621 sme_ReleaseGlobalLock( &pMac->sme );
9622 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009623#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9624 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9625 {
9626 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9627 REASON_SCAN_CH_TIME_CHANGED);
9628 }
9629#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009630
9631 return status ;
9632}
9633
9634/* ---------------------------------------------------------------------------
9635 \fn sme_getNeighborScanMinChanTime
9636 \brief get neighbor scan min channel time
9637 \param hHal - The handle returned by macOpen.
9638 \return v_U16_t - channel min time value
9639 -------------------------------------------------------------------------*/
9640v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9641{
9642 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9643 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9644}
9645
9646/* ---------------------------------------------------------------------------
9647 \fn sme_getNeighborScanMaxChanTime
9648 \brief get neighbor scan max channel time
9649 \param hHal - The handle returned by macOpen.
9650 \return v_U16_t - channel max time value
9651 -------------------------------------------------------------------------*/
9652v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9653{
9654 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9655 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9656}
9657
9658/* ---------------------------------------------------------------------------
9659 \fn sme_setNeighborScanPeriod
9660 \brief Update nNeighborScanPeriod
9661 This function is called through dynamic setConfig callback function
9662 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009663 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009664 \param hHal - HAL handle for device
9665 \param nNeighborScanPeriod - neighbor scan period
9666 \- return Success or failure
9667 -------------------------------------------------------------------------*/
9668eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9669{
9670 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9671 eHalStatus status = eHAL_STATUS_SUCCESS;
9672
9673 status = sme_AcquireGlobalLock( &pMac->sme );
9674 if ( HAL_STATUS_SUCCESS( status ) )
9675 {
9676 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309677 "LFR runtime successfully set neighbor scan period to %d"
9678 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009679 nNeighborScanPeriod,
9680 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309681 macTraceGetNeighbourRoamState(
9682 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009683 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9684 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9685 sme_ReleaseGlobalLock( &pMac->sme );
9686 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009687#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9688 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9689 {
9690 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9691 REASON_SCAN_HOME_TIME_CHANGED);
9692 }
9693#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009694
9695 return status ;
9696}
9697
9698/* ---------------------------------------------------------------------------
9699 \fn sme_getNeighborScanPeriod
9700 \brief get neighbor scan period
9701 \param hHal - The handle returned by macOpen.
9702 \return v_U16_t - neighbor scan period
9703 -------------------------------------------------------------------------*/
9704v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9705{
9706 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9707 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9708}
9709
9710#endif
9711
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009712#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009713
Srinivas Girigowdade697412013-02-14 16:31:48 -08009714/*--------------------------------------------------------------------------
9715 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9716 This is a synchronous call
9717 \param hHal - The handle returned by macOpen.
9718 \return v_U16_t - Rssi diff value
9719 \sa
9720 --------------------------------------------------------------------------*/
9721v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9722{
9723 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9724 return pMac->roam.configParam.RoamRssiDiff;
9725}
9726
9727/*--------------------------------------------------------------------------
9728 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9729 This is a synchronous call
9730 \param hHal - The handle returned by macOpen.
9731 \return eHAL_STATUS_SUCCESS - SME update config successful.
9732 Other status means SME is failed to update
9733 \sa
9734 --------------------------------------------------------------------------*/
9735eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9736 tANI_U8 numChannels)
9737{
9738 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9739 eHalStatus status = eHAL_STATUS_SUCCESS;
9740 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009741 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309742 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009743 tANI_U8 i = 0, j = 0;
9744
9745 status = sme_AcquireGlobalLock( &pMac->sme );
9746 if ( HAL_STATUS_SUCCESS( status ) )
9747 {
9748 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9749 {
9750 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9751 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309752 if (j < sizeof(oldChannelList))
9753 {
9754 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9755 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9756 }
9757 else
9758 {
9759 break;
9760 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009761 }
9762 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009763 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009764 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009765 sme_SetRoamScanControl(hHal, 1);
9766 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009767 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009768 j = 0;
9769 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009770 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309771 if (j < sizeof(oldChannelList))
9772 {
9773 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9774 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9775 }
9776 else
9777 {
9778 break;
9779 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009780 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009781 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009782
9783 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309784 "LFR runtime successfully set roam scan channels to %s"
9785 "- old value is %s - roam state is %s",
9786 newChannelList, oldChannelList,
9787 macTraceGetNeighbourRoamState(
9788 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009789 sme_ReleaseGlobalLock( &pMac->sme );
9790 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009791#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9792 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9793 {
9794 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9795 }
9796#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009797
9798 return status ;
9799}
9800
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009801
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009802#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009803/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009804 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009805 This is a synchronuous call
9806 \param hHal - The handle returned by macOpen.
9807 \return eHAL_STATUS_SUCCESS - SME update config successful.
9808 Other status means SME is failed to update
9809 \sa
9810 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009811eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009812 tANI_U8 *pChannelList,
9813 tANI_U8 numChannels)
9814{
9815 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9816 eHalStatus status = eHAL_STATUS_SUCCESS;
9817 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9818 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9819 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9820 tANI_U8 newChannelList[128] = {0};
9821 tANI_U8 i = 0, j = 0;
9822
9823 status = sme_AcquireGlobalLock( &pMac->sme );
9824 if ( HAL_STATUS_SUCCESS( status ) )
9825 {
9826 if (NULL != currChannelListInfo->ChannelList)
9827 {
9828 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9829 {
9830 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9831 currChannelListInfo->ChannelList[i]);
9832 }
9833 }
9834 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9835
9836 if ( HAL_STATUS_SUCCESS( status ))
9837 {
9838 if (NULL != currChannelListInfo->ChannelList)
9839 {
9840 j = 0;
9841 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9842 {
9843 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9844 currChannelListInfo->ChannelList[i]);
9845 }
9846 }
9847
9848 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009849 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
9850 newChannelList, oldChannelList,
9851 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009852 }
9853 sme_ReleaseGlobalLock( &pMac->sme );
9854 }
9855#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9856 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9857 {
9858 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9859 }
9860#endif
9861
9862 return status ;
9863}
9864#endif
9865
Srinivas Girigowdade697412013-02-14 16:31:48 -08009866/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009867 \brief sme_getRoamScanChannelList() - get roam scan channel list
9868 This is a synchronous call
9869 \param hHal - The handle returned by macOpen.
9870 \return eHAL_STATUS_SUCCESS - SME update config successful.
9871 Other status means SME is failed to update
9872 \sa
9873 --------------------------------------------------------------------------*/
9874eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9875 tANI_U8 *pNumChannels)
9876{
9877 int i = 0;
9878 tANI_U8 *pOutPtr = pChannelList;
9879 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9880 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9881 eHalStatus status = eHAL_STATUS_SUCCESS;
9882
9883 status = sme_AcquireGlobalLock( &pMac->sme );
9884 if ( HAL_STATUS_SUCCESS( status ) )
9885 {
9886 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9887 {
9888 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9889 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009890 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009891 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009892 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009893 }
9894
9895 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9896 for (i = 0; i < (*pNumChannels); i++)
9897 {
9898 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9899 }
9900 pOutPtr[i] = '\0';
9901 sme_ReleaseGlobalLock( &pMac->sme );
9902 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009903 return status ;
9904}
9905
9906/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009907 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009908 This is a synchronuous call
9909 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009910 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009911 FALSE (0) - if feature is disabled (compile or runtime)
9912 \sa
9913 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009914tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009915{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009916#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -08009917 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009918 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009919#else
9920 return eANI_BOOLEAN_FALSE;
9921#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009922}
9923
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009924/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009925 \brief sme_GetWESMode() - get WES Mode
9926 This is a synchronous call
9927 \param hHal - The handle returned by macOpen
9928 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9929 \sa
9930 --------------------------------------------------------------------------*/
9931v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9932{
9933 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9934 return pMac->roam.configParam.isWESModeEnabled;
9935}
9936
9937/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009938 \brief sme_GetRoamScanControl() - get scan control
9939 This is a synchronous call
9940 \param hHal - The handle returned by macOpen.
9941 \return v_BOOL_t - Enabled(1)/Disabled(0)
9942 \sa
9943 --------------------------------------------------------------------------*/
9944v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9945{
9946 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9947 return pMac->roam.configParam.nRoamScanControl;
9948}
9949#endif
9950
9951/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009952 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9953 This is a synchronuous call
9954 \param hHal - The handle returned by macOpen.
9955 \return TRUE (1) - if the feature is enabled
9956 FALSE (0) - if feature is disabled (compile or runtime)
9957 \sa
9958 --------------------------------------------------------------------------*/
9959tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9960{
9961#ifdef FEATURE_WLAN_LFR
9962 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9963 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9964#else
9965 return eANI_BOOLEAN_FALSE;
9966#endif
9967}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009968
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009969/*--------------------------------------------------------------------------
9970 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9971 This is a synchronuous call
9972 \param hHal - The handle returned by macOpen.
9973 \return TRUE (1) - if the feature is enabled
9974 FALSE (0) - if feature is disabled (compile or runtime)
9975 \sa
9976 --------------------------------------------------------------------------*/
9977tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9978{
9979#ifdef WLAN_FEATURE_VOWIFI_11R
9980 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9981 return pMac->roam.configParam.isFastTransitionEnabled;
9982#else
9983 return eANI_BOOLEAN_FALSE;
9984#endif
9985}
9986
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009987/* ---------------------------------------------------------------------------
9988 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009989
Kiet Lam0f320422013-11-21 19:29:17 +05309990 \brief Check if a feature is enabled by FW
9991
9992 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009993
Kiet Lam0f320422013-11-21 19:29:17 +05309994 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009995 -------------------------------------------------------------------------*/
9996tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9997{
9998 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9999}
Kiet Lam0f320422013-11-21 19:29:17 +053010000
10001/* ---------------------------------------------------------------------------
10002 \fn sme_IsFeatureSupportedByDriver
10003 \brief Check if a feature is enabled by Driver
10004
10005 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
10006 \- return 1/0 (TRUE/FALSE)
10007 -------------------------------------------------------------------------*/
10008
10009tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
10010{
10011 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
10012}
10013
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010014#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010015
10016/* ---------------------------------------------------------------------------
10017 \fn sme_SendTdlsMgmtFrame
10018 \brief API to send TDLS management frames.
10019
10020 \param peerMac - peer's Mac Adress.
10021 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10022 \- return VOS_STATUS_SUCCES
10023 -------------------------------------------------------------------------*/
10024VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
10025 tANI_U8 sessionId,
10026 tSirMacAddr peerMac,
10027 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
10028{
10029 eHalStatus status = eHAL_STATUS_SUCCESS;
10030 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10031
10032 status = sme_AcquireGlobalLock( &pMac->sme );
10033
10034 if ( HAL_STATUS_SUCCESS( status ) )
10035 {
10036 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
10037 sme_ReleaseGlobalLock( &pMac->sme );
10038 }
10039 return status ;
10040}
10041
Atul Mittalc0f739f2014-07-31 13:47:47 +053010042// tdlsoffchan
10043
10044/* ---------------------------------------------------------------------------
10045 \fn sme_SendTdlsChanSwitchReq
10046 \brief API to send TDLS management frames.
10047
10048 \param peerMac - peer's Mac Adress.
10049 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10050 \- return VOS_STATUS_SUCCES
10051 -------------------------------------------------------------------------*/
10052VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
10053 tANI_U8 sessionId,
10054 tSirMacAddr peerMac,
10055 tANI_S32 tdlsOffCh,
10056 tANI_S32 tdlsOffChBwOffset,
10057 tANI_U8 tdlsSwMode)
10058{
10059 eHalStatus status = eHAL_STATUS_SUCCESS;
10060 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10061
10062 status = sme_AcquireGlobalLock( &pMac->sme );
10063
10064 if ( HAL_STATUS_SUCCESS( status ) )
10065 {
10066 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
10067 tdlsOffCh, tdlsOffChBwOffset,
10068 tdlsSwMode);
10069 }
10070 sme_ReleaseGlobalLock( &pMac->sme );
10071 return status ;
10072}
10073
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010074/* ---------------------------------------------------------------------------
10075 \fn sme_SendTdlsMgmtFrame
10076 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010077
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010078 \param peerMac - peer's Mac Adress.
10079 \param frame_type - Type of TDLS mgmt frame to be sent.
10080 \param dialog - dialog token used in the frame.
10081 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010082 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010083 \param buf - additional IEs to be included
10084 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080010085 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010086 \- return VOS_STATUS_SUCCES
10087 -------------------------------------------------------------------------*/
10088VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010089 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 -080010090{
10091 eHalStatus status = eHAL_STATUS_SUCCESS;
10092 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
10093 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10094
10095 status = sme_AcquireGlobalLock( &pMac->sme );
10096 if ( HAL_STATUS_SUCCESS( status ) )
10097 {
10098 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10099 sendTdlsReq.frameType = frame_type;
10100 sendTdlsReq.buf = buf;
10101 sendTdlsReq.len = len;
10102 sendTdlsReq.dialog = dialog;
10103 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080010104 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010105 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010106
10107 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
10108
10109 sme_ReleaseGlobalLock( &pMac->sme );
10110 }
10111
10112 return status ;
10113
10114}
10115/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010116 \fn sme_ChangeTdlsPeerSta
10117 \brief API to Update TDLS peer sta parameters.
10118
10119 \param peerMac - peer's Mac Adress.
10120 \param staParams - Peer Station Parameters
10121 \- return VOS_STATUS_SUCCES
10122 -------------------------------------------------------------------------*/
10123VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
10124 tCsrStaParams *pstaParams)
10125{
10126 eHalStatus status = eHAL_STATUS_SUCCESS;
10127 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10128
Sushant Kaushikd62d9782014-02-19 15:39:40 +053010129 if (NULL == pstaParams)
10130 {
10131 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10132 "%s :pstaParams is NULL",__func__);
10133 return eHAL_STATUS_FAILURE;
10134 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010135 status = sme_AcquireGlobalLock( &pMac->sme );
10136 if ( HAL_STATUS_SUCCESS( status ) )
10137 {
10138 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
10139
10140 sme_ReleaseGlobalLock( &pMac->sme );
10141 }
10142
10143 return status ;
10144
10145}
10146
10147/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010148 \fn sme_AddTdlsPeerSta
10149 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010150
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010151 \param peerMac - peer's Mac Adress.
10152 \- return VOS_STATUS_SUCCES
10153 -------------------------------------------------------------------------*/
10154VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10155{
10156 eHalStatus status = eHAL_STATUS_SUCCESS;
10157 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10158
10159 status = sme_AcquireGlobalLock( &pMac->sme );
10160 if ( HAL_STATUS_SUCCESS( status ) )
10161 {
10162 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10163
10164 sme_ReleaseGlobalLock( &pMac->sme );
10165 }
10166
10167 return status ;
10168
10169}
10170/* ---------------------------------------------------------------------------
10171 \fn sme_DeleteTdlsPeerSta
10172 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010173
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010174 \param peerMac - peer's Mac Adress.
10175 \- return VOS_STATUS_SUCCES
10176 -------------------------------------------------------------------------*/
10177VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10178{
10179 eHalStatus status = eHAL_STATUS_SUCCESS;
10180 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10181
10182 status = sme_AcquireGlobalLock( &pMac->sme );
10183 if ( HAL_STATUS_SUCCESS( status ) )
10184 {
10185 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
10186
10187 sme_ReleaseGlobalLock( &pMac->sme );
10188 }
10189
10190 return status ;
10191
10192}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070010193/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070010194 \fn sme_SetTdlsPowerSaveProhibited
10195 \API to set/reset the isTdlsPowerSaveProhibited.
10196
10197 \- return void
10198 -------------------------------------------------------------------------*/
10199void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
10200{
10201 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10202
10203 pMac->isTdlsPowerSaveProhibited = val;
10204 return;
10205}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010206#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053010207/* ---------------------------------------------------------------------------
10208 \fn sme_IsPmcBmps
10209 \API to Check if PMC state is BMPS.
10210
10211 \- return v_BOOL_t
10212 -------------------------------------------------------------------------*/
10213v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
10214{
10215 return (BMPS == pmcGetPmcState(hHal));
10216}
10217
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010218#ifdef FEATURE_WLAN_TDLS_INTERNAL
10219/*
10220 * SME API to start TDLS discovery Procedure
10221 */
10222VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10223{
10224 VOS_STATUS status = VOS_STATUS_SUCCESS;
10225 tCsrTdlsDisRequest disReq = {{0}} ;
10226 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10227 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
10228
10229 return status ;
10230
10231}
10232
10233/*
10234 * Process TDLS discovery results
10235 */
10236v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
10237 tSmeTdlsDisResult *disResult, v_U8_t listType)
10238{
10239 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
10240 tSirTdlsPeerInfo *peerInfo = NULL ;
10241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10242 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
10243 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
10244 tListElem *pEntry = NULL ;
10245 v_U8_t peerCnt = 0 ;
10246
10247 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010248 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010249 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
10250 while(pEntry)
10251 {
10252 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
10253 tdlsPeerStaLink) ;
10254 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
10255
10256 switch(listType)
10257 {
10258 case TDLS_SETUP_LIST:
10259 {
10260 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
10261 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010262 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10263 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010264 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10265 peerCnt++ ;
10266 }
10267 break ;
10268 }
10269 case TDLS_DIS_LIST:
10270 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010271 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10272 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010273 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10274 peerCnt++ ;
10275 break ;
10276 }
10277 default:
10278 {
10279 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010280 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010281 break ;
10282 }
10283 }
10284
10285 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10286 }
10287
10288 return peerCnt ;
10289
10290}
10291
10292/*
10293 * SME API to start TDLS link setup Procedure.
10294 */
10295VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10296{
10297 VOS_STATUS status = VOS_STATUS_SUCCESS;
10298 tCsrTdlsSetupRequest setupReq = {{0}} ;
10299 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10300 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10301 return status ;
10302
10303}
10304
10305/*
10306 * SME API to start TDLS link Teardown Procedure.
10307 */
10308VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10309{
10310 VOS_STATUS status = VOS_STATUS_SUCCESS;
10311 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10312 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10313 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10314 return status ;
10315
10316}
10317
10318#endif /* FEATURE_WLAN_TDLS */
10319
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010320eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10321{
10322 eHalStatus status = eHAL_STATUS_FAILURE;
10323 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10324
10325 smsLog(pMac, LOG2, FL("enter"));
10326 status = sme_AcquireGlobalLock( &pMac->sme );
10327 if ( HAL_STATUS_SUCCESS( status ) )
10328 {
10329 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10330 sme_ReleaseGlobalLock( &pMac->sme );
10331 }
10332 smsLog(pMac, LOG2, FL("exit status %d"), status);
10333
10334 return (status);
10335}
10336
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010337/*
10338 * SME API to enable/disable WLAN driver initiated SSR
10339 */
10340void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10341{
10342 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10343 eHalStatus status = eHAL_STATUS_SUCCESS;
10344
10345 status = sme_AcquireGlobalLock(&pMac->sme);
10346 if (HAL_STATUS_SUCCESS(status))
10347 {
10348 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10349 "SSR level is changed %d", enableSSR);
10350 /* not serializing this messsage, as this is only going
10351 * to set a variable in WDA/WDI
10352 */
10353 WDA_SetEnableSSR(enableSSR);
10354 sme_ReleaseGlobalLock(&pMac->sme);
10355 }
10356 return;
10357}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010358
10359/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010360 * SME API to stringify bonding mode. (hostapd convention)
10361 */
10362
10363static const char* sme_CBMode2String( tANI_U32 mode)
10364{
10365 switch (mode)
10366 {
10367 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
10368 return "HT20";
10369 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
10370 return "HT40-"; /* lower secondary channel */
10371 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
10372 return "HT40+"; /* upper secondary channel */
10373#ifdef WLAN_FEATURE_11AC
10374 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
10375 return "VHT80+40+"; /* upper secondary channels */
10376 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
10377 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
10378 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
10379 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
10380 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
10381 return "VHT80-40-"; /* lower secondary channels */
10382#endif
10383 default:
10384 VOS_ASSERT(0);
10385 return "Unknown";
10386 }
10387}
10388
10389/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010390 * SME API to determine the channel bonding mode
10391 */
10392VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10393{
10394 tSmeConfigParams smeConfig;
10395 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10396
10397 if (
10398#ifdef WLAN_FEATURE_11AC
10399 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10400 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10401#endif
10402 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010403 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10404
10405 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10406 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10407
10408 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010409 )
10410 {
10411 return VOS_STATUS_SUCCESS;
10412 }
10413
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010414 sme_GetConfigParam(pMac, &smeConfig);
10415
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010416 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010417#ifdef WLAN_FEATURE_AP_HT40_24G
10418 if ( !pMac->roam.configParam.channelBondingMode5GHz
10419 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
10420#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010421 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010422#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010423 return VOS_STATUS_SUCCESS;
10424 }
10425
10426 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
10427 sme_GetConfigParam(pMac, &smeConfig);
10428
10429#ifdef WLAN_FEATURE_11AC
10430 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10431 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10432 {
10433 if ( channel== 36 || channel == 52 || channel == 100 ||
10434 channel == 116 || channel == 149 )
10435 {
10436 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010437 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010438 }
10439 else if ( channel == 40 || channel == 56 || channel == 104 ||
10440 channel == 120 || channel == 153 )
10441 {
10442 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010443 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010444 }
10445 else if ( channel == 44 || channel == 60 || channel == 108 ||
10446 channel == 124 || channel == 157 )
10447 {
10448 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010449 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010450 }
10451 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010452 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010453 {
10454 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010455 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010456 }
10457 else if ( channel == 165 )
10458 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010459 smeConfig.csrConfig.channelBondingMode5GHz =
10460 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010461 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010462
10463#ifdef WLAN_FEATURE_AP_HT40_24G
10464 if (smeConfig.csrConfig.apHT40_24GEnabled)
10465 {
10466 if (channel >= 1 && channel <= 7)
10467 smeConfig.csrConfig.channelBondingAPMode24GHz =
10468 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10469 else if (channel >= 8 && channel <= 13)
10470 smeConfig.csrConfig.channelBondingAPMode24GHz =
10471 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10472 else if (channel ==14)
10473 smeConfig.csrConfig.channelBondingAPMode24GHz =
10474 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10475 }
10476#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010477 }
10478#endif
10479
10480 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10481 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10482 {
10483 if ( channel== 40 || channel == 48 || channel == 56 ||
10484 channel == 64 || channel == 104 || channel == 112 ||
10485 channel == 120 || channel == 128 || channel == 136 ||
10486 channel == 144 || channel == 153 || channel == 161 )
10487 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010488 smeConfig.csrConfig.channelBondingMode5GHz =
10489 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010490 }
10491 else if ( channel== 36 || channel == 44 || channel == 52 ||
10492 channel == 60 || channel == 100 || channel == 108 ||
10493 channel == 116 || channel == 124 || channel == 132 ||
10494 channel == 140 || channel == 149 || channel == 157 )
10495 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010496 smeConfig.csrConfig.channelBondingMode5GHz =
10497 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010498 }
10499 else if ( channel == 165 )
10500 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010501 smeConfig.csrConfig.channelBondingMode5GHz =
10502 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010503 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010504
10505#ifdef WLAN_FEATURE_AP_HT40_24G
10506 if (smeConfig.csrConfig.apHT40_24GEnabled)
10507 {
10508 if (channel >= 1 && channel <= 7)
10509 smeConfig.csrConfig.channelBondingAPMode24GHz =
10510 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10511 else if (channel >= 8 && channel <= 13)
10512 smeConfig.csrConfig.channelBondingAPMode24GHz =
10513 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10514 else if (channel ==14)
10515 smeConfig.csrConfig.channelBondingAPMode24GHz =
10516 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10517 }
10518#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010519 }
krunal soni634aba32014-03-06 17:46:50 -080010520
10521 /*
10522 for 802.11a phy mode, channel bonding should be zero.
10523 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10524 through csrChangeDefaultConfigParam function. We will override this
10525 value here.
10526 */
10527 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10528 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10529 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10530 {
10531 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010532#ifdef WLAN_FEATURE_AP_HT40_24G
10533 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
10534 smeConfig.csrConfig.channelBondingAPMode24GHz =
10535 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10536#else
krunal soni634aba32014-03-06 17:46:50 -080010537 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010538#endif
krunal soni634aba32014-03-06 17:46:50 -080010539
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010540#ifdef WLAN_FEATURE_AP_HT40_24G
10541 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10542 FL("%s cbmode selected=%d bonding mode:%s"),
10543 (channel <= 14) ? "2G" : "5G",
10544 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
10545 smeConfig.csrConfig.channelBondingMode5GHz,
10546 (channel <= 14) ?
10547 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
10548 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
10549#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010550 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010551 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
10552#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010553
10554 sme_UpdateConfig (pMac, &smeConfig);
10555 return VOS_STATUS_SUCCESS;
10556}
10557
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010558/*--------------------------------------------------------------------------
10559
10560 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10561 \param hHal - The handle returned by macOpen.
10562 \param currDeviceMode - Current operating device mode.
10563 --------------------------------------------------------------------------*/
10564
10565void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10566{
10567 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10568 pMac->sme.currDeviceMode = currDeviceMode;
10569 return;
10570}
10571
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010572#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10573/*--------------------------------------------------------------------------
10574 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10575 from CSR.
10576 This is a synchronous call
10577 \param hHal - The handle returned by macOpen
10578 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10579 BSSID, channel etc.)
10580 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10581 Other status means SME is failed to send the request.
10582 \sa
10583 --------------------------------------------------------------------------*/
10584
10585eHalStatus sme_HandoffRequest(tHalHandle hHal,
10586 tCsrHandoffRequest *pHandoffInfo)
10587{
10588 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10589 eHalStatus status = eHAL_STATUS_SUCCESS;
10590
10591 status = sme_AcquireGlobalLock( &pMac->sme );
10592 if ( HAL_STATUS_SUCCESS( status ) )
10593 {
10594 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10595 "%s: invoked", __func__);
10596 status = csrHandoffRequest(pMac, pHandoffInfo);
10597 sme_ReleaseGlobalLock( &pMac->sme );
10598 }
10599
10600 return status ;
10601}
10602#endif
10603
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010604/*
10605 * SME API to check if there is any infra station or
10606 * P2P client is connected
10607 */
10608VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10609{
10610 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10611 if(csrIsInfraConnected(pMac))
10612 {
10613 return VOS_STATUS_SUCCESS;
10614 }
10615 return VOS_STATUS_E_FAILURE;
10616}
10617
Leo Chang9056f462013-08-01 19:21:11 -070010618
10619#ifdef FEATURE_WLAN_LPHB
10620/* ---------------------------------------------------------------------------
10621 \fn sme_LPHBConfigReq
10622 \API to make configuration LPHB within FW.
10623 \param hHal - The handle returned by macOpen
10624 \param lphdReq - LPHB request argument by client
10625 \param pCallbackfn - LPHB timeout notification callback function pointer
10626 \- return Configuration message posting status, SUCCESS or Fail
10627 -------------------------------------------------------------------------*/
10628eHalStatus sme_LPHBConfigReq
10629(
10630 tHalHandle hHal,
10631 tSirLPHBReq *lphdReq,
10632 void (*pCallbackfn)(void *pAdapter, void *indParam)
10633)
10634{
10635 eHalStatus status = eHAL_STATUS_SUCCESS;
10636 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10637 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10638 vos_msg_t vosMessage;
10639
10640 status = sme_AcquireGlobalLock(&pMac->sme);
10641 if (eHAL_STATUS_SUCCESS == status)
10642 {
10643 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10644 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010645 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010646 {
10647 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10648 "%s: Indication Call back did not registered", __func__);
10649 sme_ReleaseGlobalLock(&pMac->sme);
10650 return eHAL_STATUS_FAILURE;
10651 }
10652 else if (NULL != pCallbackfn)
10653 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010654 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010655 }
10656
10657 /* serialize the req through MC thread */
10658 vosMessage.bodyptr = lphdReq;
10659 vosMessage.type = WDA_LPHB_CONF_REQ;
10660 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10661 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10662 {
10663 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10664 "%s: Post Config LPHB MSG fail", __func__);
10665 status = eHAL_STATUS_FAILURE;
10666 }
10667 sme_ReleaseGlobalLock(&pMac->sme);
10668 }
10669
10670 return(status);
10671}
10672#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010673/*--------------------------------------------------------------------------
10674 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10675 scan parameter.
10676 This is a synchronous call
10677 \param hHal - The handle returned by macOpen
10678 \return NONE.
10679 \sa
10680 --------------------------------------------------------------------------*/
10681void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10682 tANI_U8 nNumP2PChan)
10683{
10684 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10685
10686 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10687 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10688
10689 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10690 "%s: SCAN nNumStaChanCombinedConc : %d,"
10691 "nNumP2PChanCombinedConc : %d ",
10692 __func__, nNumStaChan, nNumP2PChan);
10693
10694 return;
10695
10696}
Leo Chang9056f462013-08-01 19:21:11 -070010697
Yue Mab9c86f42013-08-14 15:59:08 -070010698/* ---------------------------------------------------------------------------
10699 \fn sme_AddPeriodicTxPtrn
10700 \brief API to Periodic TX Pattern Offload feature
10701 \param hHal - The handle returned by macOpen
10702 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10703 \return eHalStatus
10704 ---------------------------------------------------------------------------*/
10705eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10706 *addPeriodicTxPtrnParams)
10707{
10708 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10709 eHalStatus status;
10710 vos_msg_t msg;
10711
10712 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10713 {
10714 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10715 msg.bodyptr = addPeriodicTxPtrnParams;
10716
10717 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10718 {
10719 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10720 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10721 __func__);
10722
10723 sme_ReleaseGlobalLock(&pMac->sme);
10724 return eHAL_STATUS_FAILURE;
10725 }
10726
10727 sme_ReleaseGlobalLock(&pMac->sme);
10728 return eHAL_STATUS_SUCCESS;
10729 }
10730
10731 return status;
10732}
10733
10734/* ---------------------------------------------------------------------------
10735 \fn sme_DelPeriodicTxPtrn
10736 \brief API to Periodic TX Pattern Offload feature
10737 \param hHal - The handle returned by macOpen
10738 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10739 \return eHalStatus
10740 ---------------------------------------------------------------------------*/
10741eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10742 *delPeriodicTxPtrnParams)
10743{
10744 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10745 eHalStatus status;
10746 vos_msg_t msg;
10747
10748 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10749 {
10750 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10751 msg.bodyptr = delPeriodicTxPtrnParams;
10752
10753 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10754 {
10755 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10756 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10757 __func__);
10758
10759 sme_ReleaseGlobalLock(&pMac->sme);
10760 return eHAL_STATUS_FAILURE;
10761 }
10762
10763 sme_ReleaseGlobalLock(&pMac->sme);
10764 return eHAL_STATUS_SUCCESS;
10765 }
10766
10767 return status;
10768}
10769
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010770void smeGetCommandQStatus( tHalHandle hHal )
10771{
10772 tSmeCmd *pTempCmd = NULL;
10773 tListElem *pEntry;
10774 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10775
10776 if (NULL == pMac)
10777 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010778 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10779 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010780 return;
10781 }
10782
10783 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10784 if( pEntry )
10785 {
10786 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10787 }
10788 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10789 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10790 if(pTempCmd)
10791 {
10792 if( eSmeCsrCommandMask & pTempCmd->command )
10793 {
10794 //CSR command is stuck. See what the reason code is for that command
10795 dumpCsrCommandInfo(pMac, pTempCmd);
10796 }
10797 } //if(pTempCmd)
10798
10799 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10800 csrLLCount(&pMac->sme.smeCmdPendingList));
10801
10802 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10803 csrLLCount(&pMac->roam.roamCmdPendingList));
10804
10805 return;
10806}
Rajeev79dbe4c2013-10-05 11:03:42 +053010807
10808#ifdef FEATURE_WLAN_BATCH_SCAN
10809/* ---------------------------------------------------------------------------
10810 \fn sme_SetBatchScanReq
10811 \brief API to set batch scan request in FW
10812 \param hHal - The handle returned by macOpen.
10813 \param pRequest - Pointer to the batch request.
10814 \param sessionId - session ID
10815 \param callbackRoutine - HDD callback which needs to be invoked after
10816 getting set batch scan response from FW
10817 \param callbackContext - pAdapter context
10818 \return eHalStatus
10819 ---------------------------------------------------------------------------*/
10820eHalStatus sme_SetBatchScanReq
10821(
10822 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10823 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10824 void *callbackContext
10825)
10826{
10827 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10828 eHalStatus status;
10829
Yue Mae36e3552014-03-05 17:06:20 -080010830 if (!pMac)
10831 {
10832 return eHAL_STATUS_FAILURE;
10833 }
10834
Rajeev79dbe4c2013-10-05 11:03:42 +053010835 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10836 {
10837 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10838 callbackContext);
10839 sme_ReleaseGlobalLock( &pMac->sme );
10840 }
10841
10842 return status;
10843}
10844
10845/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010846 \fn sme_SendRateUpdateInd
10847 \brief API to Update rate
10848 \param hHal - The handle returned by macOpen
10849 \param rateUpdateParams - Pointer to rate update params
10850 \return eHalStatus
10851 ---------------------------------------------------------------------------*/
10852eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10853{
10854 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10855 eHalStatus status;
10856 vos_msg_t msg;
10857
10858 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10859 {
10860 msg.type = WDA_RATE_UPDATE_IND;
10861 msg.bodyptr = rateUpdateParams;
10862
10863 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10864 {
10865 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10866 "to post WDA_SET_RMC_RATE_IND to WDA!",
10867 __func__);
10868
10869 sme_ReleaseGlobalLock(&pMac->sme);
10870 return eHAL_STATUS_FAILURE;
10871 }
10872
10873 sme_ReleaseGlobalLock(&pMac->sme);
10874 return eHAL_STATUS_SUCCESS;
10875 }
10876
10877 return status;
10878}
10879
10880/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010881 \fn sme_TriggerBatchScanResultInd
10882 \brief API to trigger batch scan result indications from FW
10883 \param hHal - The handle returned by macOpen.
10884 \param pRequest - Pointer to get batch request.
10885 \param sessionId - session ID
10886 \param callbackRoutine - HDD callback which needs to be invoked after
10887 getting batch scan result indication from FW
10888 \param callbackContext - pAdapter context
10889 \return eHalStatus
10890 ---------------------------------------------------------------------------*/
10891eHalStatus sme_TriggerBatchScanResultInd
10892(
10893 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10894 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10895 void *callbackContext
10896)
10897{
10898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10899 eHalStatus status;
10900
10901 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10902 {
10903 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10904 callbackRoutine, callbackContext);
10905 sme_ReleaseGlobalLock( &pMac->sme );
10906 }
10907
10908 return status;
10909}
10910
10911
10912/* ---------------------------------------------------------------------------
10913 \fn sme_StopBatchScanInd
10914 \brief API to stop batch scan request in FW
10915 \param hHal - The handle returned by macOpen.
10916 \param pRequest - Pointer to the batch request.
10917 \param sessionId - session ID
10918 \return eHalStatus
10919 ---------------------------------------------------------------------------*/
10920eHalStatus sme_StopBatchScanInd
10921(
10922 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10923)
10924{
10925 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10926 eHalStatus status;
10927
10928 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10929 {
10930 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10931 sme_ReleaseGlobalLock( &pMac->sme );
10932 }
10933
10934 return status;
10935}
10936
10937#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010938
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010939
Leo Chang0b0e45a2013-12-15 15:18:55 -080010940#ifdef FEATURE_WLAN_CH_AVOID
10941/* ---------------------------------------------------------------------------
10942 \fn sme_AddChAvoidCallback
10943 \brief Used to plug in callback function
10944 Which notify channel may not be used with SAP or P2PGO mode.
10945 Notification come from FW.
10946 \param hHal
10947 \param pCallbackfn : callback function pointer should be plugged in
10948 \- return eHalStatus
10949 -------------------------------------------------------------------------*/
10950eHalStatus sme_AddChAvoidCallback
10951(
10952 tHalHandle hHal,
10953 void (*pCallbackfn)(void *pAdapter, void *indParam)
10954)
10955{
10956 eHalStatus status = eHAL_STATUS_SUCCESS;
10957 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10958
10959 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10960 "%s: Plug in CH AVOID CB", __func__);
10961
10962 status = sme_AcquireGlobalLock(&pMac->sme);
10963 if (eHAL_STATUS_SUCCESS == status)
10964 {
10965 if (NULL != pCallbackfn)
10966 {
10967 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10968 }
10969 sme_ReleaseGlobalLock(&pMac->sme);
10970 }
10971
10972 return(status);
10973}
10974#endif /* FEATURE_WLAN_CH_AVOID */
10975
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010976void activeListCmdTimeoutHandle(void *userData)
10977{
10978 if (NULL == userData)
10979 return;
10980 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10981 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010982 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010983 smeGetCommandQStatus((tHalHandle) userData);
10984}
10985
Sunil Duttc69bccb2014-05-26 21:30:20 +053010986#ifdef WLAN_FEATURE_LINK_LAYER_STATS
10987
10988/* ---------------------------------------------------------------------------
10989 \fn sme_LLStatsSetReq
10990 \brief API to set link layer stats request to FW
10991 \param hHal - The handle returned by macOpen.
10992
10993 \Param pStatsReq - a pointer to a caller allocated object of
10994 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
10995 stats set.
10996
10997 \return eHalStatus
10998 ---------------------------------------------------------------------------*/
10999eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
11000 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
11001{
11002 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11003 vos_msg_t msg;
11004 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011005 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011006
Dino Mycledf0a5d92014-07-04 09:41:55 +053011007 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
11008 if ( !plinkLayerSetReq)
11009 {
11010 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11011 "%s: Not able to allocate memory for "
11012 "WDA_LINK_LAYER_STATS_SET_REQ",
11013 __func__);
11014 return eHAL_STATUS_FAILURE;
11015 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053011016
Dino Mycledf0a5d92014-07-04 09:41:55 +053011017 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
11018
Sunil Duttc69bccb2014-05-26 21:30:20 +053011019
11020 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11021 {
11022 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
11023 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011024 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011025
11026 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11027 {
11028 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11029 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
11030 status = eHAL_STATUS_FAILURE;
11031 }
11032 sme_ReleaseGlobalLock( &pMac->sme );
11033 }
11034 else
11035 {
11036 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11037 "sme_AcquireGlobalLock error", __func__);
11038 }
11039 return status;
11040}
11041
11042/* ---------------------------------------------------------------------------
11043 \fn sme_LLStatsGetReq
11044 \brief API to get link layer stats request to FW
11045 \param hHal - The handle returned by macOpen.
11046
11047 \Param pStatsReq - a pointer to a caller allocated object of
11048 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
11049 stats get.
11050
11051 \return eHalStatus
11052 ---------------------------------------------------------------------------*/
11053eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
11054 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
11055{
11056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11057 vos_msg_t msg;
11058 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011059 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011060
Dino Mycledf0a5d92014-07-04 09:41:55 +053011061 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
11062 if ( !pGetStatsReq)
11063 {
11064 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11065 "%s: Not able to allocate memory for "
11066 "WDA_LINK_LAYER_STATS_GET_REQ",
11067 __func__);
11068 return eHAL_STATUS_FAILURE;
11069 }
11070 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011071
11072 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11073 {
11074 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
11075 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011076 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011077 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11078 {
11079 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11080 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
11081 status = eHAL_STATUS_FAILURE;
11082 }
11083 sme_ReleaseGlobalLock( &pMac->sme );
11084 }
11085 else
11086 {
11087 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11088 "sme_AcquireGlobalLock error", __func__);
11089 }
11090 return status;
11091}
11092
11093/* ---------------------------------------------------------------------------
11094 \fn sme_LLStatsClearReq
11095 \brief API to clear link layer stats request to FW
11096 \param hHal - The handle returned by macOpen.
11097
11098 \Param pStatsReq - a pointer to a caller allocated object of
11099 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
11100 stats clear.
11101
11102 \return eHalStatus
11103 ---------------------------------------------------------------------------*/
11104eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
11105 tSirLLStatsClearReq *pLinkLayerStatsClear)
11106{
11107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11108 vos_msg_t msg;
11109 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011110 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011111
11112
Sunil Duttc69bccb2014-05-26 21:30:20 +053011113
Dino Mycledf0a5d92014-07-04 09:41:55 +053011114 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
11115 if ( !pClearStatsReq)
11116 {
11117 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11118 "%s: Not able to allocate memory for "
11119 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
11120 __func__);
11121 return eHAL_STATUS_FAILURE;
11122 }
11123
11124 *pClearStatsReq = *pLinkLayerStatsClear;
11125
Sunil Duttc69bccb2014-05-26 21:30:20 +053011126 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11127 {
11128 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
11129 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011130 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011131
11132 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11133 {
11134 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11135 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
11136 status = eHAL_STATUS_FAILURE;
11137 }
11138 sme_ReleaseGlobalLock( &pMac->sme );
11139 }
11140 else
11141 {
11142 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11143 "sme_AcquireGlobalLock error", __func__);
11144 }
11145
11146 return status;
11147}
11148
11149/* ---------------------------------------------------------------------------
11150 \fn sme_SetLinkLayerStatsIndCB
11151 \brief API to trigger Link Layer Statistic indications from FW
11152 \param hHal - The handle returned by macOpen.
11153 \param sessionId - session ID
11154 \param callbackRoutine - HDD callback which needs to be invoked after
11155 getting Link Layer Statistics from FW
11156 \param callbackContext - pAdapter context
11157 \return eHalStatus
11158 ---------------------------------------------------------------------------*/
11159eHalStatus sme_SetLinkLayerStatsIndCB
11160(
Dino Mycled3d50022014-07-07 12:58:25 +053011161 tHalHandle hHal,
11162 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
11163 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053011164)
11165{
11166 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11167 eHalStatus status;
11168
11169 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11170 {
11171 if (NULL != callbackRoutine)
11172 {
11173 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011174 }
11175 sme_ReleaseGlobalLock( &pMac->sme );
11176 }
11177
11178 return status;
11179}
11180#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
11181
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011182eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
11183{
11184 eHalStatus status = eHAL_STATUS_SUCCESS;
11185 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11186 pMac->fEnableDebugLog = set_value;
11187 return (status);
11188}
11189
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011190VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070011191 sme_QosWmmUpType *dscpmapping,
11192 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011193{
11194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070011195 eHalStatus status = eHAL_STATUS_SUCCESS;
11196 v_U8_t i, j, peSessionId;
11197 tCsrRoamSession *pCsrSession = NULL;
11198 tpPESession pSession = NULL;
11199
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011200 status = sme_AcquireGlobalLock( &pMac->sme );
11201 if ( HAL_STATUS_SUCCESS( status ) )
11202 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011203 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
11204 {
11205 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11206 "%s: Invalid session Id %u", __func__, sessionId);
11207 sme_ReleaseGlobalLock( &pMac->sme);
11208 return eHAL_STATUS_FAILURE;
11209 }
11210 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
11211
11212 if (pCsrSession == NULL)
11213 {
11214 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11215 "%s: CSR Session lookup fails %u", __func__, sessionId);
11216 sme_ReleaseGlobalLock( &pMac->sme);
11217 return eHAL_STATUS_FAILURE;
11218 }
11219
11220 pSession = peFindSessionByBssid( pMac,
11221 pCsrSession->connectedProfile.bssid, &peSessionId );
11222
11223 if (pSession == NULL)
11224 {
11225 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11226 "%s: Session lookup fails for BSSID", __func__);
11227 sme_ReleaseGlobalLock( &pMac->sme);
11228 return eHAL_STATUS_FAILURE;
11229 }
11230
11231 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011232 {
11233 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11234 "%s: QOS Mapping IE not present", __func__);
11235 sme_ReleaseGlobalLock( &pMac->sme);
11236 return eHAL_STATUS_FAILURE;
11237 }
11238 else
11239 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011240 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011241 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011242 for (j = pSession->QosMapSet.dscp_range[i][0];
11243 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011244 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011245 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
11246 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011247 {
11248 dscpmapping[j]= 0;
11249 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11250 "%s: User Priority %d is not used in mapping",
11251 __func__, i);
11252 break;
11253 }
11254 else
11255 {
11256 dscpmapping[j]= i;
11257 }
11258 }
11259 }
Kumar Anand82c009f2014-05-29 00:29:42 -070011260 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011261 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011262 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011263 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011264 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
11265 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011266 }
11267 }
11268 }
11269 }
11270 sme_ReleaseGlobalLock( &pMac->sme);
11271 return status;
11272}
Agarwal Ashish5e414792014-06-08 15:25:23 +053011273
Agarwal Ashish5e414792014-06-08 15:25:23 +053011274tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
11275{
11276 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11277
11278 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
11279 pMac->scan.countryCode11d, 2))
11280 {
11281 return eANI_BOOLEAN_TRUE;
11282 }
11283 else
11284 {
11285 return eANI_BOOLEAN_FALSE;
11286 }
11287}
Dino Mycle2c198072014-06-10 10:15:52 +053011288
Siddharth Bhal76972212014-10-15 16:22:51 +053011289tANI_BOOLEAN sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011290{
11291 eHalStatus status = eHAL_STATUS_SUCCESS;
11292 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11293 tANI_U16 len;
11294
11295 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
11296 {
11297 tpSirSpoofMacAddrReq pMsg;
11298
11299 /* Create the message and send to lim */
11300 len = sizeof(tSirSpoofMacAddrReq);
11301 pMsg = vos_mem_malloc(len);
11302 if ( NULL == pMsg )
11303 status = eHAL_STATUS_FAILURE;
11304 else
11305 {
11306 vos_mem_set(pMsg, sizeof(tSirSpoofMacAddrReq), 0);
11307 pMsg->messageType = eWNI_SME_MAC_SPOOF_ADDR_IND;
11308 pMsg->length = len;
11309 /* Data starts from here */
11310 vos_mem_copy(pMsg->macAddr, macaddr->bytes, VOS_MAC_ADDRESS_LEN);
11311
11312 status = palSendMBMessage(pMac->hHdd, pMsg);
11313 }
11314 sme_ReleaseGlobalLock( &pMac->sme );
11315 }
11316 return status;
11317}
11318
Dino Mycle2c198072014-06-10 10:15:52 +053011319#ifdef WLAN_FEATURE_EXTSCAN
11320/* ---------------------------------------------------------------------------
11321 \fn sme_GetValidChannelsByBand
11322 \brief SME API to fetch all valid channel filtered by band
11323 \param hHal
11324 \param wifiBand: RF band information
11325 \param aValidChannels: Array to store channel info
11326 \param len: number of channels
11327 \- return eHalStatus
11328 -------------------------------------------------------------------------*/
11329eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
11330 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
11331{
11332 eHalStatus status = eHAL_STATUS_SUCCESS;
11333 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
11334 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11335 tANI_U8 numChannels = 0;
11336 tANI_U8 i = 0;
11337 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
11338
11339 if (!aValidChannels || !pNumChannels) {
11340 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11341 FL("Output channel list/NumChannels is NULL"));
11342 return eHAL_STATUS_INVALID_PARAMETER;
11343 }
11344
11345 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
11346 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11347 FL("Invalid wifiBand (%d)"), wifiBand);
11348 return eHAL_STATUS_INVALID_PARAMETER;
11349 }
11350
11351 status = sme_GetCfgValidChannels(hHal, &chanList[0],
11352 &totValidChannels);
11353 if (!HAL_STATUS_SUCCESS(status)) {
11354 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11355 FL("Failed to get valid channel list (err=%d)"), status);
11356 return status;
11357 }
11358
11359 switch (wifiBand) {
11360 case WIFI_BAND_UNSPECIFIED:
11361 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
11362 "return all (%d) valid channels"), totValidChannels);
11363 numChannels = totValidChannels;
11364 for (i = 0; i < numChannels; i++)
11365 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
11366 break;
11367
11368 case WIFI_BAND_BG:
11369 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
11370 for (i = 0; i < totValidChannels; i++)
11371 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
11372 aValidChannels[numChannels++] =
11373 vos_chan_to_freq(chanList[i]);
11374 break;
11375
11376 case WIFI_BAND_A:
11377 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11378 FL("WIFI_BAND_A (5 GHz without DFS)"));
11379 for (i = 0; i < totValidChannels; i++)
11380 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11381 !CSR_IS_CHANNEL_DFS(chanList[i]))
11382 aValidChannels[numChannels++] =
11383 vos_chan_to_freq(chanList[i]);
11384 break;
11385
11386 case WIFI_BAND_ABG:
11387 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11388 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11389 for (i = 0; i < totValidChannels; i++)
11390 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11391 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11392 !CSR_IS_CHANNEL_DFS(chanList[i]))
11393 aValidChannels[numChannels++] =
11394 vos_chan_to_freq(chanList[i]);
11395 break;
11396
11397 case WIFI_BAND_A_DFS_ONLY:
11398 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11399 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11400 for (i = 0; i < totValidChannels; i++)
11401 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11402 CSR_IS_CHANNEL_DFS(chanList[i]))
11403 aValidChannels[numChannels++] =
11404 vos_chan_to_freq(chanList[i]);
11405 break;
11406
11407 case WIFI_BAND_A_WITH_DFS:
11408 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11409 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11410 for (i = 0; i < totValidChannels; i++)
11411 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11412 aValidChannels[numChannels++] =
11413 vos_chan_to_freq(chanList[i]);
11414 break;
11415
11416 case WIFI_BAND_ABG_WITH_DFS:
11417 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11418 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11419 for (i = 0; i < totValidChannels; i++)
11420 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11421 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11422 aValidChannels[numChannels++] =
11423 vos_chan_to_freq(chanList[i]);
11424 break;
11425
11426 default:
11427 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11428 FL("Unknown wifiBand (%d))"), wifiBand);
11429 return eHAL_STATUS_INVALID_PARAMETER;
11430 break;
11431 }
11432 *pNumChannels = numChannels;
11433
11434 return status;
11435}
11436/* ---------------------------------------------------------------------------
11437 \fn sme_EXTScanGetCapabilities
11438 \brief SME API to fetch Extended Scan capabilities
11439 \param hHal
11440 \param pReq: Extended Scan capabilities structure
11441 \- return eHalStatus
11442 -------------------------------------------------------------------------*/
11443eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11444 tSirGetEXTScanCapabilitiesReqParams *pReq)
11445{
11446 eHalStatus status = eHAL_STATUS_SUCCESS;
11447 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11448 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11449 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011450 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11451
11452 pGetEXTScanCapabilitiesReq =
11453 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11454 if ( !pGetEXTScanCapabilitiesReq)
11455 {
11456 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11457 "%s: Not able to allocate memory for "
11458 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11459 __func__);
11460 return eHAL_STATUS_FAILURE;
11461 }
11462
11463 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011464
11465 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11466 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11467 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11468 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011469 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011470 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11471 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11472 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11473 status = eHAL_STATUS_FAILURE;
11474
11475 sme_ReleaseGlobalLock(&pMac->sme);
11476 }
11477 return(status);
11478}
11479
11480/* ---------------------------------------------------------------------------
11481 \fn sme_EXTScanStart
11482 \brief SME API to issue Extended Scan start
11483 \param hHal
11484 \param pStartCmd: Extended Scan start structure
11485 \- return eHalStatus
11486 -------------------------------------------------------------------------*/
11487eHalStatus sme_EXTScanStart (tHalHandle hHal,
11488 tSirEXTScanStartReqParams *pStartCmd)
11489{
11490 eHalStatus status = eHAL_STATUS_SUCCESS;
11491 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11492 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11493 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011494 tSirEXTScanStartReqParams *pextScanStartReq;
11495
11496 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11497 if ( !pextScanStartReq)
11498 {
11499 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11500 "%s: Not able to allocate memory for "
11501 "WDA_EXTSCAN_START_REQ",
11502 __func__);
11503 return eHAL_STATUS_FAILURE;
11504 }
11505
11506 *pextScanStartReq = *pStartCmd;
11507
Dino Mycle2c198072014-06-10 10:15:52 +053011508
11509 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11510 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11511 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11512 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011513 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011514 vosMessage.type = WDA_EXTSCAN_START_REQ;
11515 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11516 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11517 status = eHAL_STATUS_FAILURE;
11518
11519 sme_ReleaseGlobalLock(&pMac->sme);
11520 }
11521 return(status);
11522}
11523
11524/* ---------------------------------------------------------------------------
11525 \fn sme_EXTScanStop
11526 \brief SME API to issue Extended Scan stop
11527 \param hHal
11528 \param pStopReq: Extended Scan stop structure
11529 \- return eHalStatus
11530 -------------------------------------------------------------------------*/
11531eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11532{
11533 eHalStatus status = eHAL_STATUS_SUCCESS;
11534 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11535 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11536 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011537 tSirEXTScanStopReqParams *pEXTScanStopReq;
11538
11539 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11540 if ( !pEXTScanStopReq)
11541 {
11542 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11543 "%s: Not able to allocate memory for "
11544 "WDA_EXTSCAN_STOP_REQ",
11545 __func__);
11546 return eHAL_STATUS_FAILURE;
11547 }
11548
11549 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011550
11551 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11552 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11553 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11554 {
11555 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011556 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011557 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11558 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11559 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11560 {
11561 status = eHAL_STATUS_FAILURE;
11562 }
11563 sme_ReleaseGlobalLock(&pMac->sme);
11564 }
11565 return(status);
11566}
11567
11568/* ---------------------------------------------------------------------------
11569 \fn sme_SetBssHotlist
11570 \brief SME API to set BSSID hotlist
11571 \param hHal
11572 \param pSetHotListReq: Extended Scan set hotlist structure
11573 \- return eHalStatus
11574 -------------------------------------------------------------------------*/
11575eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11576 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11577{
11578 eHalStatus status = eHAL_STATUS_SUCCESS;
11579 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11580 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11581 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011582 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11583
11584 pEXTScanSetBssidHotlistReq =
11585 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11586 if ( !pEXTScanSetBssidHotlistReq)
11587 {
11588 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11589 "%s: Not able to allocate memory for "
11590 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11591 __func__);
11592 return eHAL_STATUS_FAILURE;
11593 }
11594
11595 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011596
11597 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11598 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11599 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11600 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011601 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011602 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11603 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11604 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11605 status = eHAL_STATUS_FAILURE;
11606
11607 sme_ReleaseGlobalLock(&pMac->sme);
11608 }
11609
11610 return(status);
11611}
11612
11613/* ---------------------------------------------------------------------------
11614 \fn sme_ResetBssHotlist
11615 \brief SME API to reset BSSID hotlist
11616 \param hHal
11617 \param pSetHotListReq: Extended Scan set hotlist structure
11618 \- return eHalStatus
11619 -------------------------------------------------------------------------*/
11620eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11621 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11622{
11623 eHalStatus status = eHAL_STATUS_SUCCESS;
11624 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11625 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11626 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011627 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11628
11629 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11630 if ( !pEXTScanHotlistResetReq)
11631 {
11632 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11633 "%s: Not able to allocate memory for "
11634 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11635 __func__);
11636 return eHAL_STATUS_FAILURE;
11637 }
11638
11639 *pEXTScanHotlistResetReq = *pResetReq;
11640
Dino Mycle2c198072014-06-10 10:15:52 +053011641
11642 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11643 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11644 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11645 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011646 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011647 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11648 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11649 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11650 status = eHAL_STATUS_FAILURE;
11651
11652 sme_ReleaseGlobalLock(&pMac->sme);
11653 }
11654 return(status);
11655}
11656
11657/* ---------------------------------------------------------------------------
11658 \fn sme_SetSignificantChange
11659 \brief SME API to set significant change
11660 \param hHal
11661 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11662 \- return eHalStatus
11663 -------------------------------------------------------------------------*/
11664eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11665 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11666{
11667 eHalStatus status = eHAL_STATUS_SUCCESS;
11668 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11669 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11670 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011671 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11672
11673 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11674 if ( !pEXTScanSetSignificantReq)
11675 {
11676 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11677 "%s: Not able to allocate memory for "
11678 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11679 __func__);
11680 return eHAL_STATUS_FAILURE;
11681 }
11682
11683 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11684
11685
Dino Mycle2c198072014-06-10 10:15:52 +053011686
11687 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11688 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11689 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11690 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011691 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011692 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11693 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11694 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11695 status = eHAL_STATUS_FAILURE;
11696
11697 sme_ReleaseGlobalLock(&pMac->sme);
11698 }
11699 return(status);
11700}
11701
11702/* ---------------------------------------------------------------------------
11703 \fn sme_ResetSignificantChange
11704 \brief SME API to reset significant change
11705 \param hHal
11706 \param pResetReq: Extended Scan reset significant change structure
11707 \- return eHalStatus
11708 -------------------------------------------------------------------------*/
11709eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11710 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11711{
11712 eHalStatus status = eHAL_STATUS_SUCCESS;
11713 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11714 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11715 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011716 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11717
11718 pEXTScanResetSignificantReq =
11719 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11720 if ( !pEXTScanResetSignificantReq)
11721 {
11722 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11723 "%s: Not able to allocate memory for "
11724 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11725 __func__);
11726 return eHAL_STATUS_FAILURE;
11727 }
11728
11729 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011730
11731 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11732 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11733 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11734 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011735 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011736 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11737 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11738 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11739 status = eHAL_STATUS_FAILURE;
11740
11741 sme_ReleaseGlobalLock(&pMac->sme);
11742 }
11743 return(status);
11744}
11745
11746/* ---------------------------------------------------------------------------
11747 \fn sme_getCachedResults
11748 \brief SME API to get cached results
11749 \param hHal
11750 \param pCachedResultsReq: Extended Scan get cached results structure
11751 \- return eHalStatus
11752 -------------------------------------------------------------------------*/
11753eHalStatus sme_getCachedResults (tHalHandle hHal,
11754 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11755{
11756 eHalStatus status = eHAL_STATUS_SUCCESS;
11757 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11758 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11759 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011760 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11761
11762 pEXTScanCachedResultsReq =
11763 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11764 if ( !pEXTScanCachedResultsReq)
11765 {
11766 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11767 "%s: Not able to allocate memory for "
11768 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11769 __func__);
11770 return eHAL_STATUS_FAILURE;
11771 }
11772
11773 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11774
Dino Mycle2c198072014-06-10 10:15:52 +053011775
11776 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11777 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11778 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11779 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011780 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011781 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11782 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11783 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11784 status = eHAL_STATUS_FAILURE;
11785
11786 sme_ReleaseGlobalLock(&pMac->sme);
11787 }
11788 return(status);
11789}
11790
11791eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
11792 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
11793 void *callbackContext)
11794{
11795 eHalStatus status = eHAL_STATUS_SUCCESS;
11796 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11797
11798 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11799 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
11800 pMac->sme.pEXTScanCallbackContext = callbackContext;
11801 sme_ReleaseGlobalLock(&pMac->sme);
11802 }
11803 return(status);
11804}
11805
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053011806void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
11807{
11808 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11809
11810 pMac->miracast_mode = mode;
11811}
Dino Mycle2c198072014-06-10 10:15:52 +053011812#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053011813
11814void sme_resetCoexEevent(tHalHandle hHal)
11815{
11816 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11817
11818 if (pMac == NULL)
11819 {
11820 printk("btc: %s pMac is NULL \n",__func__);
11821 return;
11822 }
11823
11824 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11825 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
11826
11827 if (pMac->isCoexScoIndSet)
11828 {
11829 pMac->isCoexScoIndSet = 0;
11830 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
11831 NULL, eANI_BOOLEAN_FALSE);
11832 }
11833
11834 return;
11835}
Agarwal Ashish738843c2014-09-25 12:27:56 +053011836
11837void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
11838{
11839 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11840 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
11841 csrDisableDfsChannel(pMac);
11842
11843}