Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, 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 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /**========================================================================= |
| 43 | |
| 44 | \file smeApi.c |
| 45 | |
| 46 | \brief Definitions for SME APIs |
| 47 | |
| 48 | Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved. |
| 49 | |
| 50 | Qualcomm Confidential and Proprietary. |
| 51 | |
| 52 | ========================================================================*/ |
| 53 | |
| 54 | /*=========================================================================== |
| 55 | |
| 56 | EDIT HISTORY FOR FILE |
| 57 | |
| 58 | |
| 59 | This section contains comments describing changes made to the module. |
| 60 | Notice that changes are listed in reverse chronological order. |
| 61 | |
| 62 | |
| 63 | |
| 64 | when who what, where, why |
| 65 | ---------- --- -------------------------------------------------------- |
| 66 | 06/03/10 js Added support to hostapd driven |
| 67 | * deauth/disassoc/mic failure |
| 68 | |
| 69 | ===========================================================================*/ |
| 70 | |
| 71 | /*-------------------------------------------------------------------------- |
| 72 | Include Files |
| 73 | ------------------------------------------------------------------------*/ |
| 74 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | |
| 76 | #include "smsDebug.h" |
| 77 | #include "sme_Api.h" |
| 78 | #include "csrInsideApi.h" |
| 79 | #include "smeInside.h" |
| 80 | #include "csrInternal.h" |
| 81 | #include "wlan_qct_wda.h" |
| 82 | #include "halMsgApi.h" |
| 83 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 84 | #include "sapApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 85 | |
| 86 | |
| 87 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 88 | extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb); |
| 89 | |
| 90 | #include <wlan_qct_pal_api.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 91 | |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 92 | #define READ_MEMORY_DUMP_CMD 9 |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 93 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 94 | // TxMB Functions |
| 95 | extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam, |
| 96 | tANI_U32 size, tSmeCmd **ppCmd ); |
| 97 | extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 98 | extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 99 | extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn); |
| 100 | extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg); |
| 101 | extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm); |
| 102 | extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg); |
| 103 | extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg); |
| 104 | extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | |
| 106 | static eHalStatus initSmeCmdList(tpAniSirGlobal pMac); |
| 107 | static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ); |
| 108 | |
| 109 | eCsrPhyMode sme_GetPhyMode(tHalHandle hHal); |
| 110 | |
| 111 | eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf); |
| 112 | |
| 113 | eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal); |
| 114 | |
| 115 | eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal); |
| 116 | |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 117 | #ifdef FEATURE_WLAN_LFR |
| 118 | tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac); |
| 119 | #endif |
| 120 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 121 | #ifdef WLAN_FEATURE_11W |
| 122 | eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal, |
| 123 | tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm ); |
| 124 | #endif |
| 125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 126 | //Internal SME APIs |
| 127 | eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme) |
| 128 | { |
| 129 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 130 | |
| 131 | if(psSme) |
| 132 | { |
| 133 | if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) ) |
| 134 | { |
| 135 | status = eHAL_STATUS_SUCCESS; |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | return (status); |
| 140 | } |
| 141 | |
| 142 | |
| 143 | eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme) |
| 144 | { |
| 145 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 146 | |
| 147 | if(psSme) |
| 148 | { |
| 149 | if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) ) |
| 150 | { |
| 151 | status = eHAL_STATUS_SUCCESS; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | return (status); |
| 156 | } |
| 157 | |
| 158 | |
| 159 | |
| 160 | static eHalStatus initSmeCmdList(tpAniSirGlobal pMac) |
| 161 | { |
| 162 | eHalStatus status; |
| 163 | tSmeCmd *pCmd; |
| 164 | |
| 165 | pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND; |
| 166 | if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdActiveList))) |
| 167 | { |
| 168 | if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdPendingList))) |
| 169 | { |
| 170 | if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdFreeList))) |
| 171 | { |
| 172 | status = palAllocateMemory(pMac->hHdd, (void **)&pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd); |
| 173 | if(HAL_STATUS_SUCCESS(status)) |
| 174 | { |
| 175 | tANI_U32 c; |
| 176 | |
| 177 | palZeroMemory(pMac->hHdd, pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd); |
| 178 | pMac->sme.pSmeCmdBufAddr = pCmd; |
| 179 | for(c = 0; c < pMac->sme.totalSmeCmd; c++) |
| 180 | { |
| 181 | csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd[c].Link, LL_ACCESS_LOCK); |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | return (status); |
| 189 | } |
| 190 | |
| 191 | |
| 192 | void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd) |
| 193 | { |
| 194 | pCmd->command = eSmeNoCommand; |
| 195 | csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK); |
| 196 | } |
| 197 | |
| 198 | |
| 199 | |
| 200 | static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList) |
| 201 | { |
| 202 | tListElem *pEntry; |
| 203 | tSmeCmd *pCommand; |
| 204 | |
| 205 | while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL) |
| 206 | { |
| 207 | //TODO: base on command type to call release functions |
| 208 | //reinitialize different command types so they can be reused |
| 209 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 210 | smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | static void purgeSmeCmdList(tpAniSirGlobal pMac) |
| 215 | { |
| 216 | //release any out standing commands back to free command list |
| 217 | smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList); |
| 218 | smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList); |
| 219 | } |
| 220 | |
| 221 | void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 222 | { |
| 223 | //release any out standing commands back to free command list |
| 224 | tListElem *pEntry, *pNext; |
| 225 | tSmeCmd *pCommand; |
| 226 | tDblLinkList *pList = &pMac->sme.smeCmdPendingList; |
| 227 | tDblLinkList localList; |
| 228 | |
| 229 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 230 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 231 | { |
| 232 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 233 | return; |
| 234 | } |
| 235 | |
| 236 | csrLLLock(pList); |
| 237 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 238 | while(pEntry != NULL) |
| 239 | { |
| 240 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 241 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 242 | if(pCommand->sessionId == sessionId) |
| 243 | { |
| 244 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 245 | { |
| 246 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 247 | } |
| 248 | } |
| 249 | pEntry = pNext; |
| 250 | } |
| 251 | csrLLUnlock(pList); |
| 252 | |
| 253 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 254 | { |
| 255 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 256 | smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 257 | } |
| 258 | csrLLClose(&localList); |
| 259 | |
| 260 | } |
| 261 | |
| 262 | |
| 263 | static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac) |
| 264 | { |
| 265 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 266 | |
| 267 | purgeSmeCmdList(pMac); |
| 268 | csrLLClose(&pMac->sme.smeCmdPendingList); |
| 269 | csrLLClose(&pMac->sme.smeCmdActiveList); |
| 270 | csrLLClose(&pMac->sme.smeCmdFreeList); |
| 271 | |
Madan Mohan Koyyalamudi | 7a5fb7e | 2012-12-06 13:05:42 -0800 | [diff] [blame] | 272 | status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock); |
| 273 | if(status != eHAL_STATUS_SUCCESS) |
| 274 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 275 | smsLog(pMac, LOGE, |
| 276 | FL("Failed to acquire the lock status = %d"), status); |
Madan Mohan Koyyalamudi | 7a5fb7e | 2012-12-06 13:05:42 -0800 | [diff] [blame] | 277 | goto done; |
| 278 | } |
| 279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 280 | if(NULL != pMac->sme.pSmeCmdBufAddr) |
| 281 | { |
| 282 | status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr); |
| 283 | pMac->sme.pSmeCmdBufAddr = NULL; |
| 284 | } |
| 285 | |
Madan Mohan Koyyalamudi | 7a5fb7e | 2012-12-06 13:05:42 -0800 | [diff] [blame] | 286 | status = vos_lock_release(&pMac->sme.lkSmeGlobalLock); |
| 287 | if(status != eHAL_STATUS_SUCCESS) |
| 288 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 289 | smsLog(pMac, LOGE, |
| 290 | FL("Failed to release the lock status = %d"), status); |
Madan Mohan Koyyalamudi | 7a5fb7e | 2012-12-06 13:05:42 -0800 | [diff] [blame] | 291 | } |
| 292 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | return (status); |
| 294 | } |
| 295 | |
| 296 | |
| 297 | void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd) |
| 298 | { |
| 299 | #ifdef WLAN_DEBUG |
| 300 | switch( pCmd->command ) |
| 301 | { |
| 302 | case eSmeCommandScan: |
| 303 | smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason ); |
| 304 | break; |
| 305 | |
| 306 | case eSmeCommandRoam: |
| 307 | smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason ); |
| 308 | break; |
| 309 | |
| 310 | case eSmeCommandWmStatusChange: |
| 311 | smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type ); |
| 312 | break; |
| 313 | |
| 314 | case eSmeCommandSetKey: |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 315 | smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType ); |
| 317 | break; |
| 318 | |
| 319 | case eSmeCommandRemoveKey: |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 320 | smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 321 | pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType ); |
| 322 | break; |
| 323 | |
| 324 | default: |
| 325 | break; |
| 326 | } |
| 327 | #endif //#ifdef WLAN_DEBUG |
| 328 | } |
| 329 | |
| 330 | tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac ) |
| 331 | { |
| 332 | tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL; |
| 333 | tListElem *pEntry; |
| 334 | |
| 335 | pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK ); |
| 336 | |
| 337 | // If we can get another MS Msg buffer, then we are ok. Just link |
| 338 | // the entry onto the linked list. (We are using the linked list |
| 339 | // to keep track of tfhe message buffers). |
| 340 | if ( pEntry ) |
| 341 | { |
| 342 | pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 343 | } |
| 344 | else { |
| 345 | int idx = 1; |
| 346 | |
| 347 | //Cannot change pRetCmd here since it needs to return later. |
| 348 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 349 | if( pEntry ) |
| 350 | { |
| 351 | pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 352 | } |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 353 | smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 354 | (pTempCmd) ? pTempCmd->command : eSmeNoCommand ); |
| 355 | if(pTempCmd) |
| 356 | { |
| 357 | if( eSmeCsrCommandMask & pTempCmd->command ) |
| 358 | { |
| 359 | //CSR command is stuck. See what the reason code is for that command |
| 360 | dumpCsrCommandInfo(pMac, pTempCmd); |
| 361 | } |
| 362 | } //if(pTempCmd) |
| 363 | |
| 364 | //dump what is in the pending queue |
| 365 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 366 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 367 | while(pEntry) |
| 368 | { |
| 369 | pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 370 | smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 371 | idx++, pTempCmd->command ); |
| 372 | if( eSmeCsrCommandMask & pTempCmd->command ) |
| 373 | { |
| 374 | //CSR command is stuck. See what the reason code is for that command |
| 375 | dumpCsrCommandInfo(pMac, pTempCmd); |
| 376 | } |
| 377 | pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 378 | } |
| 379 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 380 | |
| 381 | //There may be some more command in CSR's own pending queue |
| 382 | csrLLLock(&pMac->roam.roamCmdPendingList); |
| 383 | pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK ); |
| 384 | while(pEntry) |
| 385 | { |
| 386 | pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 387 | smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | idx++, pTempCmd->command ); |
| 389 | dumpCsrCommandInfo(pMac, pTempCmd); |
| 390 | pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 391 | } |
| 392 | csrLLUnlock(&pMac->roam.roamCmdPendingList); |
| 393 | } |
| 394 | |
| 395 | return( pRetCmd ); |
| 396 | } |
| 397 | |
| 398 | |
| 399 | void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority ) |
| 400 | { |
| 401 | if ( fHighPriority ) |
| 402 | { |
| 403 | csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK ); |
| 404 | } |
| 405 | else |
| 406 | { |
| 407 | csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK ); |
| 408 | } |
| 409 | |
| 410 | // process the command queue... |
| 411 | smeProcessPendingQueue( pMac ); |
| 412 | |
| 413 | return; |
| 414 | } |
| 415 | |
| 416 | |
| 417 | static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 418 | { |
| 419 | eSmeCommandType pmcCommand = eSmeNoCommand; |
| 420 | tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE; |
| 421 | tPmcState pmcState; |
| 422 | eHalStatus status; |
| 423 | |
| 424 | do |
| 425 | { |
| 426 | pmcState = pmcGetPmcState(pMac); |
| 427 | |
| 428 | status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded ); |
| 429 | if( !HAL_STATUS_SUCCESS(status) ) |
| 430 | { |
| 431 | //PMC state is not right for the command, drop it |
| 432 | return ( eSmeDropCommand ); |
| 433 | } |
| 434 | if( fFullPowerNeeded ) break; |
| 435 | fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) || |
| 436 | ( eSmeCommandDelTs == pCommand->command ) ); |
| 437 | if( fFullPowerNeeded ) break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 438 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 439 | fFullPowerNeeded = (pmcState == IMPS && |
| 440 | eSmeCommandOemDataReq == pCommand->command); |
| 441 | if(fFullPowerNeeded) break; |
| 442 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 443 | fFullPowerNeeded = (pmcState == IMPS && |
| 444 | eSmeCommandRemainOnChannel == pCommand->command); |
| 445 | if(fFullPowerNeeded) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 446 | } while(0); |
| 447 | |
| 448 | if( fFullPowerNeeded ) |
| 449 | { |
| 450 | switch( pmcState ) |
| 451 | { |
| 452 | case IMPS: |
| 453 | case STANDBY: |
| 454 | pmcCommand = eSmeCommandExitImps; |
| 455 | break; |
| 456 | |
| 457 | case BMPS: |
| 458 | pmcCommand = eSmeCommandExitBmps; |
| 459 | break; |
| 460 | |
| 461 | case UAPSD: |
| 462 | pmcCommand = eSmeCommandExitUapsd; |
| 463 | break; |
| 464 | |
| 465 | case WOWL: |
| 466 | pmcCommand = eSmeCommandExitWowl; |
| 467 | break; |
| 468 | |
| 469 | default: |
| 470 | break; |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | return ( pmcCommand ); |
| 475 | } |
| 476 | |
| 477 | |
| 478 | //For commands that need to do extra cleanup. |
| 479 | static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 480 | { |
| 481 | if( eSmePmcCommandMask & pCommand->command ) |
| 482 | { |
| 483 | pmcAbortCommand( pMac, pCommand, fStopping ); |
| 484 | } |
| 485 | else if ( eSmeCsrCommandMask & pCommand->command ) |
| 486 | { |
| 487 | csrAbortCommand( pMac, pCommand, fStopping ); |
| 488 | } |
| 489 | else |
| 490 | { |
| 491 | switch( pCommand->command ) |
| 492 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | case eSmeCommandRemainOnChannel: |
| 494 | if (NULL != pCommand->u.remainChlCmd.callback) |
| 495 | { |
| 496 | remainOnChanCallback callback = |
| 497 | pCommand->u.remainChlCmd.callback; |
| 498 | /* process the msg */ |
| 499 | if( callback ) |
| 500 | { |
| 501 | callback(pMac, pCommand->u.remainChlCmd.callbackCtx, |
| 502 | eCSR_SCAN_ABORT ); |
| 503 | } |
| 504 | } |
| 505 | smeReleaseCommand( pMac, pCommand ); |
| 506 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 507 | default: |
| 508 | smeReleaseCommand( pMac, pCommand ); |
| 509 | break; |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | |
| 515 | |
| 516 | tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac ) |
| 517 | { |
| 518 | tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE; |
| 519 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 520 | tListElem *pEntry; |
| 521 | tSmeCmd *pCommand; |
| 522 | eSmeCommandType pmcCommand = eSmeNoCommand; |
| 523 | |
| 524 | // if the ActiveList is empty, then nothing is active so we can process a |
| 525 | // pending command... |
| 526 | //alwasy lock active list before locking pending list |
| 527 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 528 | if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ) |
| 529 | { |
| 530 | if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK)) |
| 531 | { |
| 532 | //Peek the command |
| 533 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK ); |
| 534 | if( pEntry ) |
| 535 | { |
| 536 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 537 | //We cannot execute any command in wait-for-key state until setKey is through. |
| 538 | if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) ) |
| 539 | { |
| 540 | if( !CSR_IS_SET_KEY_COMMAND( pCommand ) ) |
| 541 | { |
| 542 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 543 | smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 544 | return ( eANI_BOOLEAN_FALSE ); |
| 545 | } |
| 546 | } |
| 547 | pmcCommand = smeIsFullPowerNeeded( pMac, pCommand ); |
| 548 | if( eSmeDropCommand == pmcCommand ) |
| 549 | { |
| 550 | //This command is not ok for current PMC state |
| 551 | if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) ) |
| 552 | { |
| 553 | smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
| 554 | } |
| 555 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 556 | //tell caller to continue |
| 557 | return (eANI_BOOLEAN_TRUE); |
| 558 | } |
| 559 | else if( eSmeNoCommand != pmcCommand ) |
| 560 | { |
| 561 | tExitBmpsInfo exitBmpsInfo; |
| 562 | void *pv = NULL; |
| 563 | tANI_U32 size = 0; |
| 564 | tSmeCmd *pPmcCmd = NULL; |
| 565 | |
| 566 | if( eSmeCommandExitBmps == pmcCommand ) |
| 567 | { |
| 568 | exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER; |
| 569 | pv = (void *)&exitBmpsInfo; |
| 570 | size = sizeof(tExitBmpsInfo); |
| 571 | } |
| 572 | //pmcCommand has to be one of the exit power save command |
| 573 | status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd ); |
| 574 | if( HAL_STATUS_SUCCESS( status ) && pPmcCmd ) |
| 575 | { |
| 576 | //Force this command to wake up the chip |
| 577 | csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ); |
| 578 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 579 | fContinue = pmcProcessCommand( pMac, pPmcCmd ); |
| 580 | if( fContinue ) |
| 581 | { |
| 582 | //The command failed, remove it |
| 583 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) ) |
| 584 | { |
| 585 | pmcReleaseCommand( pMac, pPmcCmd ); |
| 586 | } |
| 587 | } |
| 588 | } |
| 589 | else |
| 590 | { |
| 591 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 592 | smsLog( pMac, LOGE, FL( "Cannot issue command(0x%X) to wake up the chip. Status = %d"), pmcCommand, status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 593 | //Let it retry |
| 594 | fContinue = eANI_BOOLEAN_TRUE; |
| 595 | } |
| 596 | return fContinue; |
| 597 | } |
| 598 | if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) ) |
| 599 | { |
| 600 | // we can reuse the pCommand |
| 601 | |
| 602 | // Insert the command onto the ActiveList... |
| 603 | csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK ); |
| 604 | |
| 605 | // .... and process the command. |
| 606 | |
| 607 | switch ( pCommand->command ) |
| 608 | { |
| 609 | |
| 610 | case eSmeCommandScan: |
| 611 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 612 | status = csrProcessScanCommand( pMac, pCommand ); |
| 613 | break; |
| 614 | |
| 615 | case eSmeCommandRoam: |
| 616 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 617 | status = csrRoamProcessCommand( pMac, pCommand ); |
Madan Mohan Koyyalamudi | 59efbe0 | 2013-01-10 15:38:42 -0800 | [diff] [blame] | 618 | if(!HAL_STATUS_SUCCESS(status)) |
| 619 | { |
| 620 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 621 | &pCommand->Link, LL_ACCESS_LOCK ) ) |
| 622 | { |
| 623 | csrReleaseCommandRoam( pMac, pCommand ); |
| 624 | } |
| 625 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 626 | break; |
| 627 | |
| 628 | case eSmeCommandWmStatusChange: |
| 629 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 630 | csrRoamProcessWmStatusChangeCommand(pMac, pCommand); |
| 631 | break; |
| 632 | |
| 633 | case eSmeCommandSetKey: |
| 634 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 635 | status = csrRoamProcessSetKeyCommand( pMac, pCommand ); |
| 636 | if(!HAL_STATUS_SUCCESS(status)) |
| 637 | { |
| 638 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 639 | &pCommand->Link, LL_ACCESS_LOCK ) ) |
| 640 | { |
| 641 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 642 | } |
| 643 | } |
| 644 | break; |
| 645 | |
| 646 | case eSmeCommandRemoveKey: |
| 647 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 648 | status = csrRoamProcessRemoveKeyCommand( pMac, pCommand ); |
| 649 | if(!HAL_STATUS_SUCCESS(status)) |
| 650 | { |
| 651 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 652 | &pCommand->Link, LL_ACCESS_LOCK ) ) |
| 653 | { |
| 654 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 655 | } |
| 656 | } |
| 657 | break; |
| 658 | |
| 659 | case eSmeCommandAddStaSession: |
| 660 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 661 | csrProcessAddStaSessionCommand( pMac, pCommand ); |
| 662 | break; |
| 663 | case eSmeCommandDelStaSession: |
| 664 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 665 | csrProcessDelStaSessionCommand( pMac, pCommand ); |
| 666 | break; |
| 667 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 668 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 669 | case eSmeCommandOemDataReq: |
| 670 | csrLLUnlock(&pMac->sme.smeCmdActiveList); |
| 671 | oemData_ProcessOemDataReqCommand(pMac, pCommand); |
| 672 | break; |
| 673 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 674 | case eSmeCommandRemainOnChannel: |
| 675 | csrLLUnlock(&pMac->sme.smeCmdActiveList); |
| 676 | p2pProcessRemainOnChannelCmd(pMac, pCommand); |
| 677 | break; |
| 678 | case eSmeCommandNoAUpdate: |
| 679 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 680 | p2pProcessNoAReq(pMac,pCommand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 681 | case eSmeCommandEnterImps: |
| 682 | case eSmeCommandExitImps: |
| 683 | case eSmeCommandEnterBmps: |
| 684 | case eSmeCommandExitBmps: |
| 685 | case eSmeCommandEnterUapsd: |
| 686 | case eSmeCommandExitUapsd: |
| 687 | case eSmeCommandEnterWowl: |
| 688 | case eSmeCommandExitWowl: |
| 689 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 690 | fContinue = pmcProcessCommand( pMac, pCommand ); |
| 691 | if( fContinue ) |
| 692 | { |
| 693 | //The command failed, remove it |
| 694 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 695 | &pCommand->Link, LL_ACCESS_LOCK ) ) |
| 696 | { |
| 697 | pmcReleaseCommand( pMac, pCommand ); |
| 698 | } |
| 699 | } |
| 700 | break; |
| 701 | |
| 702 | //Treat standby differently here because caller may not be able to handle |
| 703 | //the failure so we do our best here |
| 704 | case eSmeCommandEnterStandby: |
| 705 | if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) ) |
| 706 | { |
| 707 | //It can continue |
| 708 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 709 | fContinue = pmcProcessCommand( pMac, pCommand ); |
| 710 | if( fContinue ) |
| 711 | { |
| 712 | //The command failed, remove it |
| 713 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 714 | &pCommand->Link, LL_ACCESS_LOCK ) ) |
| 715 | { |
| 716 | pmcReleaseCommand( pMac, pCommand ); |
| 717 | } |
| 718 | } |
| 719 | } |
| 720 | else |
| 721 | { |
| 722 | //Need to issue a disconnect first before processing this command |
| 723 | tSmeCmd *pNewCmd; |
| 724 | |
| 725 | //We need to re-run the command |
| 726 | fContinue = eANI_BOOLEAN_TRUE; |
| 727 | //Pull off the standby command first |
| 728 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 729 | &pCommand->Link, LL_ACCESS_NOLOCK ) ) |
| 730 | { |
| 731 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 732 | //Need to call CSR function here because the disconnect command |
| 733 | //is handled by CSR |
| 734 | pNewCmd = csrGetCommandBuffer( pMac ); |
| 735 | if( NULL != pNewCmd ) |
| 736 | { |
| 737 | //Put the standby command to the head of the pending list first |
| 738 | csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link, |
| 739 | LL_ACCESS_LOCK ); |
| 740 | pNewCmd->command = eSmeCommandRoam; |
| 741 | pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 742 | //Put the disassoc command before the standby command |
| 743 | csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link, |
| 744 | LL_ACCESS_LOCK ); |
| 745 | } |
| 746 | else |
| 747 | { |
| 748 | //Continue the command here |
| 749 | fContinue = pmcProcessCommand( pMac, pCommand ); |
| 750 | if( fContinue ) |
| 751 | { |
| 752 | //The command failed, remove it |
| 753 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 754 | &pCommand->Link, LL_ACCESS_LOCK ) ) |
| 755 | { |
| 756 | pmcReleaseCommand( pMac, pCommand ); |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | else |
| 762 | { |
| 763 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 764 | smsLog( pMac, LOGE, FL(" failed to remove standby command") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 765 | VOS_ASSERT(0); |
| 766 | } |
| 767 | } |
| 768 | break; |
| 769 | |
| 770 | case eSmeCommandAddTs: |
| 771 | case eSmeCommandDelTs: |
| 772 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 773 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 774 | fContinue = qosProcessCommand( pMac, pCommand ); |
| 775 | if( fContinue ) |
| 776 | { |
| 777 | //The command failed, remove it |
| 778 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, |
| 779 | &pCommand->Link, LL_ACCESS_NOLOCK ) ) |
| 780 | { |
| 781 | //#ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 782 | qosReleaseCommand( pMac, pCommand ); |
| 783 | //#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 784 | } |
| 785 | } |
| 786 | #endif |
| 787 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 788 | #ifdef FEATURE_WLAN_TDLS |
| 789 | case eSmeCommandTdlsSendMgmt: |
| 790 | case eSmeCommandTdlsAddPeer: |
| 791 | case eSmeCommandTdlsDelPeer: |
| 792 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 793 | case eSmeCommandTdlsDiscovery: |
| 794 | case eSmeCommandTdlsLinkSetup: |
| 795 | case eSmeCommandTdlsLinkTear: |
| 796 | case eSmeCommandTdlsEnterUapsd: |
| 797 | case eSmeCommandTdlsExitUapsd: |
| 798 | #endif |
| 799 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 800 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 801 | "sending TDLS Command 0x%x to PE", pCommand->command); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 802 | |
| 803 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 804 | status = csrTdlsProcessCmd( pMac, pCommand ); |
| 805 | } |
| 806 | break ; |
| 807 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 808 | |
| 809 | default: |
| 810 | //something is wrong |
| 811 | //remove it from the active list |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 812 | smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ); |
| 814 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 815 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 816 | smeReleaseCommand( pMac, pCommand ); |
| 817 | status = eHAL_STATUS_FAILURE; |
| 818 | break; |
| 819 | } |
| 820 | if(!HAL_STATUS_SUCCESS(status)) |
| 821 | { |
| 822 | fContinue = eANI_BOOLEAN_TRUE; |
| 823 | } |
| 824 | }//if(pEntry) |
| 825 | else |
| 826 | { |
| 827 | //This is odd. Some one else pull off the command. |
| 828 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 829 | } |
| 830 | } |
| 831 | else |
| 832 | { |
| 833 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 834 | } |
| 835 | } |
| 836 | else |
| 837 | { |
| 838 | //No command waiting |
| 839 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 840 | //This is only used to restart an idle mode scan, it means at least one other idle scan has finished. |
| 841 | if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan) |
| 842 | { |
| 843 | tANI_U32 nTime = 0; |
| 844 | |
| 845 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
| 846 | if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime))) |
| 847 | { |
| 848 | csrScanStartIdleScanTimer(pMac, nTime); |
| 849 | } |
| 850 | } |
| 851 | } |
| 852 | } |
| 853 | else { |
| 854 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
| 855 | } |
| 856 | |
| 857 | return ( fContinue ); |
| 858 | } |
| 859 | |
| 860 | void smeProcessPendingQueue( tpAniSirGlobal pMac ) |
| 861 | { |
| 862 | while( smeProcessCommand( pMac ) ); |
| 863 | } |
| 864 | |
| 865 | |
| 866 | tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac) |
| 867 | { |
| 868 | return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) || |
| 869 | !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) ); |
| 870 | } |
| 871 | |
| 872 | |
| 873 | |
| 874 | //Global APIs |
| 875 | |
| 876 | /*-------------------------------------------------------------------------- |
| 877 | |
| 878 | \brief sme_Open() - Initialze all SME modules and put them at idle state |
| 879 | |
| 880 | The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon |
| 881 | successfully return, all modules are at idle state ready to start. |
| 882 | |
| 883 | smeOpen must be called before any other SME APIs can be involved. |
| 884 | smeOpen must be called after macOpen. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 885 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 886 | \param hHal - The handle returned by macOpen. |
| 887 | |
| 888 | \return eHAL_STATUS_SUCCESS - SME is successfully initialized. |
| 889 | |
| 890 | Other status means SME is failed to be initialized |
| 891 | \sa |
| 892 | |
| 893 | --------------------------------------------------------------------------*/ |
| 894 | eHalStatus sme_Open(tHalHandle hHal) |
| 895 | { |
| 896 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 897 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 898 | |
| 899 | do { |
| 900 | pMac->sme.state = SME_STATE_STOP; |
| 901 | if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) ) |
| 902 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 903 | smsLog( pMac, LOGE, "sme_Open failed init lock" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 904 | status = eHAL_STATUS_FAILURE; |
| 905 | break; |
| 906 | } |
| 907 | |
| 908 | status = ccmOpen(hHal); |
| 909 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 910 | smsLog( pMac, LOGE, |
| 911 | "ccmOpen failed during initialization with status=%d", status ); |
| 912 | break; |
| 913 | } |
| 914 | |
| 915 | status = csrOpen(pMac); |
| 916 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 917 | smsLog( pMac, LOGE, |
| 918 | "csrOpen failed during initialization with status=%d", status ); |
| 919 | break; |
| 920 | } |
| 921 | |
| 922 | status = pmcOpen(hHal); |
| 923 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 924 | smsLog( pMac, LOGE, |
| 925 | "pmcOpen failed during initialization with status=%d", status ); |
| 926 | break; |
| 927 | } |
| 928 | |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 929 | #ifdef FEATURE_WLAN_TDLS |
| 930 | pMac->isTdlsPowerSaveProhibited = 0; |
| 931 | #endif |
| 932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 934 | status = sme_QosOpen(pMac); |
| 935 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 936 | smsLog( pMac, LOGE, |
| 937 | "Qos open failed during initialization with status=%d", status ); |
| 938 | break; |
| 939 | } |
| 940 | |
| 941 | status = btcOpen(pMac); |
| 942 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 943 | smsLog( pMac, LOGE, |
| 944 | "btcOpen open failed during initialization with status=%d", status ); |
| 945 | break; |
| 946 | } |
| 947 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 948 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 949 | status = oemData_OemDataReqOpen(pMac); |
| 950 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 951 | smsLog(pMac, LOGE, |
| 952 | "oemData_OemDataReqOpen failed during initialization with status=%d", status ); |
| 953 | break; |
| 954 | } |
| 955 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 956 | |
| 957 | if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac)))) |
| 958 | break; |
| 959 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 960 | { |
| 961 | v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL); |
| 962 | if ( NULL == pvosGCtx ){ |
| 963 | smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization"); |
| 964 | status = eHAL_STATUS_FAILURE; |
| 965 | break; |
| 966 | } |
| 967 | |
| 968 | status = WLANSAP_Open( pvosGCtx ); |
| 969 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 970 | smsLog( pMac, LOGE, |
| 971 | "WLANSAP_Open open failed during initialization with status=%d", status ); |
| 972 | break; |
| 973 | } |
| 974 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | #if defined WLAN_FEATURE_VOWIFI |
| 976 | status = rrmOpen(pMac); |
| 977 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
| 978 | smsLog( pMac, LOGE, |
| 979 | "rrmOpen open failed during initialization with status=%d", status ); |
| 980 | break; |
| 981 | } |
| 982 | #endif |
| 983 | |
| 984 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 985 | sme_FTOpen(pMac); |
| 986 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 987 | sme_p2pOpen(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 988 | |
| 989 | }while (0); |
| 990 | |
| 991 | return status; |
| 992 | } |
| 993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 994 | /*-------------------------------------------------------------------------- |
| 995 | |
| 996 | \brief sme_set11dinfo() - Set the 11d information about valid channels |
| 997 | and there power using information from nvRAM |
| 998 | This function is called only for AP. |
| 999 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1000 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1001 | |
| 1002 | \param hHal - The handle returned by macOpen. |
| 1003 | \Param pSmeConfigParams - a pointer to a caller allocated object of |
| 1004 | typedef struct _smeConfigParams. |
| 1005 | |
| 1006 | \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully. |
| 1007 | |
| 1008 | Other status means SME is failed to update the config parameters. |
| 1009 | \sa |
| 1010 | --------------------------------------------------------------------------*/ |
| 1011 | |
| 1012 | eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams) |
| 1013 | { |
| 1014 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1015 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1016 | |
| 1017 | if (NULL == pSmeConfigParams ) { |
| 1018 | smsLog( pMac, LOGE, |
| 1019 | "Empty config param structure for SME, nothing to update"); |
| 1020 | return status; |
| 1021 | } |
| 1022 | |
| 1023 | status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig ); |
| 1024 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1025 | smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1026 | status ); |
| 1027 | } |
| 1028 | return status; |
| 1029 | } |
| 1030 | |
| 1031 | /*-------------------------------------------------------------------------- |
| 1032 | |
| 1033 | \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp. |
| 1034 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1035 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | |
| 1037 | \param hHal - The handle returned by HostapdAdapter. |
| 1038 | \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp. |
| 1039 | |
| 1040 | \return eHAL_STATUS_SUCCESS - SME successfully completed the request. |
| 1041 | |
| 1042 | Other status means, failed to get the current regulatory domain. |
| 1043 | \sa |
| 1044 | --------------------------------------------------------------------------*/ |
| 1045 | |
| 1046 | eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp) |
| 1047 | { |
| 1048 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1049 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1050 | |
| 1051 | if (NULL == domainIdSoftAp ) { |
| 1052 | smsLog( pMac, LOGE, "Uninitialized domain Id"); |
| 1053 | return status; |
| 1054 | } |
| 1055 | |
| 1056 | *domainIdSoftAp = pMac->scan.domainIdCurrent; |
| 1057 | status = eHAL_STATUS_SUCCESS; |
| 1058 | |
| 1059 | return status; |
| 1060 | } |
| 1061 | |
| 1062 | |
| 1063 | eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode) |
| 1064 | { |
| 1065 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1066 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1067 | |
| 1068 | if (NULL == apCntryCode ) { |
| 1069 | smsLog( pMac, LOGE, "Empty Country Code, nothing to update"); |
| 1070 | return status; |
| 1071 | } |
| 1072 | |
| 1073 | status = csrSetRegInfo(hHal, apCntryCode ); |
| 1074 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1075 | smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | status ); |
| 1077 | } |
| 1078 | return status; |
| 1079 | } |
| 1080 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 1082 | /*-------------------------------------------------------------------------- |
| 1083 | |
| 1084 | \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA. |
| 1085 | |
| 1086 | It is used at driver start up to inform RIVA of the default channel |
| 1087 | configuration. |
| 1088 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1089 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1090 | |
| 1091 | \param hHal - The handle returned by macOpen. |
| 1092 | |
| 1093 | \return eHAL_STATUS_SUCCESS - SME update the channel config successfully. |
| 1094 | |
| 1095 | Other status means SME is failed to update the channel config. |
| 1096 | \sa |
| 1097 | |
| 1098 | --------------------------------------------------------------------------*/ |
| 1099 | eHalStatus sme_UpdateChannelConfig(tHalHandle hHal) |
| 1100 | { |
| 1101 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1102 | |
| 1103 | pmcUpdateScanParams( pMac, &(pMac->roam.configParam), |
| 1104 | &pMac->scan.base20MHzChannels, FALSE); |
| 1105 | return eHAL_STATUS_SUCCESS; |
| 1106 | } |
| 1107 | #endif // FEATURE_WLAN_SCAN_PNLO |
| 1108 | |
| 1109 | /*-------------------------------------------------------------------------- |
| 1110 | |
| 1111 | \brief sme_UpdateConfig() - Change configurations for all SME moduels |
| 1112 | |
| 1113 | The function updates some configuration for modules in SME, CCM, CSR, etc |
| 1114 | during SMEs close open sequence. |
| 1115 | |
| 1116 | Modules inside SME apply the new configuration at the next transaction. |
| 1117 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1118 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | |
| 1120 | \param hHal - The handle returned by macOpen. |
| 1121 | \Param pSmeConfigParams - a pointer to a caller allocated object of |
| 1122 | typedef struct _smeConfigParams. |
| 1123 | |
| 1124 | \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully. |
| 1125 | |
| 1126 | Other status means SME is failed to update the config parameters. |
| 1127 | \sa |
| 1128 | |
| 1129 | --------------------------------------------------------------------------*/ |
| 1130 | eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams) |
| 1131 | { |
| 1132 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1133 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1134 | |
| 1135 | if (NULL == pSmeConfigParams ) { |
| 1136 | smsLog( pMac, LOGE, |
| 1137 | "Empty config param structure for SME, nothing to update"); |
| 1138 | return status; |
| 1139 | } |
| 1140 | |
| 1141 | status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig); |
| 1142 | |
| 1143 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1144 | smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1145 | status ); |
| 1146 | } |
| 1147 | #if defined WLAN_FEATURE_P2P_INTERNAL |
| 1148 | status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig); |
| 1149 | |
| 1150 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1151 | smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1152 | status ); |
| 1153 | } |
| 1154 | #endif |
| 1155 | #if defined WLAN_FEATURE_VOWIFI |
| 1156 | status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig); |
| 1157 | |
| 1158 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1159 | smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1160 | status ); |
| 1161 | } |
| 1162 | #endif |
| 1163 | //For SOC, CFG is set before start |
| 1164 | //We don't want to apply global CFG in connect state because that may cause some side affect |
| 1165 | if( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | csrIsAllSessionDisconnected( pMac) ) |
| 1167 | { |
| 1168 | csrSetGlobalCfgs(pMac); |
| 1169 | } |
| 1170 | |
| 1171 | return status; |
| 1172 | } |
| 1173 | |
| 1174 | /* --------------------------------------------------------------------------- |
| 1175 | \fn sme_ChangeConfigParams |
| 1176 | \brief The SME API exposed for HDD to provide config params to SME during |
| 1177 | SMEs stop -> start sequence. |
| 1178 | |
| 1179 | If HDD changed the domain that will cause a reset. This function will |
| 1180 | provide the new set of 11d information for the new domain. Currrently this |
| 1181 | API provides info regarding 11d only at reset but we can extend this for |
| 1182 | other params (PMC, QoS) which needs to be initialized again at reset. |
| 1183 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1184 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1185 | |
| 1186 | \param hHal - The handle returned by macOpen. |
| 1187 | |
| 1188 | \Param |
| 1189 | pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that |
| 1190 | currently provides 11d related information like Country code, |
| 1191 | Regulatory domain, valid channel list, Tx power per channel, a |
| 1192 | list with active/passive scan allowed per valid channel. |
| 1193 | |
| 1194 | \return eHalStatus |
| 1195 | ---------------------------------------------------------------------------*/ |
| 1196 | eHalStatus sme_ChangeConfigParams(tHalHandle hHal, |
| 1197 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 1198 | { |
| 1199 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1200 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1201 | |
| 1202 | if (NULL == pUpdateConfigParam ) { |
| 1203 | smsLog( pMac, LOGE, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1204 | "Empty config param structure for SME, nothing to reset"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1205 | return status; |
| 1206 | } |
| 1207 | |
| 1208 | status = csrChangeConfigParams(pMac, pUpdateConfigParam); |
| 1209 | |
| 1210 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1211 | smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1212 | status ); |
| 1213 | } |
| 1214 | |
| 1215 | return status; |
| 1216 | |
| 1217 | } |
| 1218 | |
| 1219 | /*-------------------------------------------------------------------------- |
| 1220 | |
| 1221 | \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform |
| 1222 | that the NIC is ready tio run. |
| 1223 | |
| 1224 | The function is called by HDD at the end of initialization stage so PE/HAL can |
| 1225 | enable the NIC to running state. |
| 1226 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1227 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1228 | \param hHal - The handle returned by macOpen. |
| 1229 | |
| 1230 | \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE |
| 1231 | successfully. |
| 1232 | |
| 1233 | Other status means SME failed to send the message to PE. |
| 1234 | \sa |
| 1235 | |
| 1236 | --------------------------------------------------------------------------*/ |
| 1237 | eHalStatus sme_HDDReadyInd(tHalHandle hHal) |
| 1238 | { |
| 1239 | tSirSmeReadyReq Msg; |
| 1240 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1241 | tPmcPowerState powerState; |
| 1242 | tPmcSwitchState hwWlanSwitchState; |
| 1243 | tPmcSwitchState swWlanSwitchState; |
| 1244 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1245 | |
| 1246 | do |
| 1247 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1248 | |
| 1249 | Msg.messageType = eWNI_SME_SYS_READY_IND; |
| 1250 | Msg.length = sizeof( tSirSmeReadyReq ); |
| 1251 | |
| 1252 | if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg )) |
| 1253 | { |
| 1254 | status = eHAL_STATUS_SUCCESS; |
| 1255 | } |
| 1256 | else |
| 1257 | { |
| 1258 | smsLog( pMac, LOGE, |
| 1259 | "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND"); |
| 1260 | break; |
| 1261 | } |
| 1262 | |
| 1263 | status = pmcQueryPowerState( hHal, &powerState, |
| 1264 | &hwWlanSwitchState, &swWlanSwitchState ); |
| 1265 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 1266 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1267 | smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1268 | status ); |
| 1269 | break; |
| 1270 | } |
| 1271 | |
| 1272 | if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) && |
| 1273 | (ePMC_SWITCH_OFF != swWlanSwitchState) ) |
| 1274 | { |
| 1275 | status = csrReady(pMac); |
| 1276 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 1277 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1278 | smsLog( pMac, LOGE, "csrReady failed with status=%d", status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1279 | break; |
| 1280 | } |
| 1281 | status = pmcReady(hHal); |
| 1282 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 1283 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1284 | smsLog( pMac, LOGE, "pmcReady failed with status=%d", status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1285 | break; |
| 1286 | } |
| 1287 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1288 | if(VOS_STATUS_SUCCESS != btcReady(hHal)) |
| 1289 | { |
| 1290 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1291 | smsLog( pMac, LOGE, "btcReady failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1292 | break; |
| 1293 | } |
| 1294 | #endif |
| 1295 | |
| 1296 | #if defined WLAN_FEATURE_VOWIFI |
| 1297 | if(VOS_STATUS_SUCCESS != rrmReady(hHal)) |
| 1298 | { |
| 1299 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1300 | smsLog( pMac, LOGE, "rrmReady failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1301 | break; |
| 1302 | } |
| 1303 | #endif |
| 1304 | } |
| 1305 | pMac->sme.state = SME_STATE_READY; |
| 1306 | } while( 0 ); |
| 1307 | |
| 1308 | return status; |
| 1309 | } |
| 1310 | |
| 1311 | /*-------------------------------------------------------------------------- |
| 1312 | |
| 1313 | \brief sme_Start() - Put all SME modules at ready state. |
| 1314 | |
| 1315 | The function starts each module in SME, PMC, CCM, CSR, etc. . Upon |
| 1316 | successfully return, all modules are ready to run. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1317 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1318 | \param hHal - The handle returned by macOpen. |
| 1319 | |
| 1320 | \return eHAL_STATUS_SUCCESS - SME is ready. |
| 1321 | |
| 1322 | Other status means SME is failed to start |
| 1323 | \sa |
| 1324 | |
| 1325 | --------------------------------------------------------------------------*/ |
| 1326 | eHalStatus sme_Start(tHalHandle hHal) |
| 1327 | { |
| 1328 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1329 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1330 | |
| 1331 | do |
| 1332 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1333 | status = csrStart(pMac); |
| 1334 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1335 | smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1336 | status ); |
| 1337 | break; |
| 1338 | } |
| 1339 | |
| 1340 | status = pmcStart(hHal); |
| 1341 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1342 | smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1343 | status ); |
| 1344 | break; |
| 1345 | } |
| 1346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL)); |
| 1348 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1349 | smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1350 | status ); |
| 1351 | break; |
| 1352 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | pMac->sme.state = SME_STATE_START; |
| 1354 | }while (0); |
| 1355 | |
| 1356 | return status; |
| 1357 | } |
| 1358 | |
| 1359 | |
| 1360 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 1361 | /****************************************************************************** |
| 1362 | * |
| 1363 | * Name: sme_PCFilterMatchCountResponseHandler |
| 1364 | * |
| 1365 | * Description: |
| 1366 | * Invoke Packet Coalescing Filter Match Count callback routine |
| 1367 | * |
| 1368 | * Parameters: |
| 1369 | * hHal - HAL handle for device |
| 1370 | * pMsg - Pointer to tRcvFltPktMatchRsp structure |
| 1371 | * |
| 1372 | * Returns: eHalStatus |
| 1373 | * |
| 1374 | ******************************************************************************/ |
| 1375 | eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg) |
| 1376 | { |
| 1377 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 1378 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1379 | tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg; |
| 1380 | |
| 1381 | if (NULL == pMsg) |
| 1382 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1383 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1384 | status = eHAL_STATUS_FAILURE; |
| 1385 | } |
| 1386 | else |
| 1387 | { |
| 1388 | smsLog(pMac, LOG2, "SME: entering " |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1389 | "sme_FilterMatchCountResponseHandler"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1390 | |
| 1391 | /* Call Packet Coalescing Filter Match Count callback routine. */ |
| 1392 | if (pMac->pmc.FilterMatchCountCB != NULL) |
| 1393 | pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext, |
| 1394 | pRcvFltPktMatchRsp); |
| 1395 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1396 | smsLog(pMac, LOG1, "%s: status=0x%x", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1397 | pRcvFltPktMatchRsp->status); |
| 1398 | |
| 1399 | pMac->pmc.FilterMatchCountCB = NULL; |
| 1400 | pMac->pmc.FilterMatchCountCBContext = NULL; |
| 1401 | } |
| 1402 | |
| 1403 | return(status); |
| 1404 | } |
| 1405 | #endif // WLAN_FEATURE_PACKET_FILTERING |
| 1406 | |
| 1407 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1408 | #ifdef WLAN_FEATURE_11W |
| 1409 | /*------------------------------------------------------------------ |
| 1410 | * |
| 1411 | * Handle the unprotected management frame indication from LIM and |
| 1412 | * forward it to HDD. |
| 1413 | * |
| 1414 | *------------------------------------------------------------------*/ |
| 1415 | |
| 1416 | eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal, |
| 1417 | tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm) |
| 1418 | { |
| 1419 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1420 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1421 | tCsrRoamInfo pRoamInfo = {0}; |
| 1422 | tANI_U32 SessionId = pSmeMgmtFrm->sessionId; |
| 1423 | |
| 1424 | pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen; |
| 1425 | pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf; |
| 1426 | pRoamInfo.frameType = pSmeMgmtFrm->frameType; |
| 1427 | |
| 1428 | /* forward the mgmt frame to HDD */ |
| 1429 | csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0); |
| 1430 | |
| 1431 | return status; |
| 1432 | } |
| 1433 | #endif |
| 1434 | |
| 1435 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1436 | /*-------------------------------------------------------------------------- |
| 1437 | |
| 1438 | \brief sme_ProcessMsg() - The main message processor for SME. |
| 1439 | |
| 1440 | The function is called by a message dispatcher when to process a message |
| 1441 | targeted for SME. |
| 1442 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1443 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1444 | \param hHal - The handle returned by macOpen. |
| 1445 | \param pMsg - A pointer to a caller allocated object of tSirMsgQ. |
| 1446 | |
| 1447 | \return eHAL_STATUS_SUCCESS - SME successfully process the message. |
| 1448 | |
| 1449 | Other status means SME failed to process the message to HAL. |
| 1450 | \sa |
| 1451 | |
| 1452 | --------------------------------------------------------------------------*/ |
| 1453 | eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg) |
| 1454 | { |
| 1455 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1456 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1457 | |
| 1458 | if (pMsg == NULL) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1459 | smsLog( pMac, LOGE, "Empty message for SME, nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1460 | return status; |
| 1461 | } |
| 1462 | |
| 1463 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 1464 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 1465 | { |
| 1466 | if( SME_IS_START(pMac) ) |
| 1467 | { |
| 1468 | switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs |
| 1469 | case eWNI_PMC_ENTER_BMPS_RSP: |
| 1470 | case eWNI_PMC_EXIT_BMPS_RSP: |
| 1471 | case eWNI_PMC_EXIT_BMPS_IND: |
| 1472 | case eWNI_PMC_ENTER_IMPS_RSP: |
| 1473 | case eWNI_PMC_EXIT_IMPS_RSP: |
| 1474 | case eWNI_PMC_SMPS_STATE_IND: |
| 1475 | case eWNI_PMC_ENTER_UAPSD_RSP: |
| 1476 | case eWNI_PMC_EXIT_UAPSD_RSP: |
| 1477 | case eWNI_PMC_ENTER_WOWL_RSP: |
| 1478 | case eWNI_PMC_EXIT_WOWL_RSP: |
| 1479 | //PMC |
| 1480 | if (pMsg->bodyptr) |
| 1481 | { |
| 1482 | pmcMessageProcessor(hHal, pMsg->bodyptr); |
| 1483 | status = eHAL_STATUS_SUCCESS; |
| 1484 | vos_mem_free( pMsg->bodyptr ); |
| 1485 | } else { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1486 | smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1487 | } |
| 1488 | break; |
| 1489 | |
| 1490 | case WNI_CFG_SET_CNF: |
| 1491 | case WNI_CFG_DNLD_CNF: |
| 1492 | case WNI_CFG_GET_RSP: |
| 1493 | case WNI_CFG_ADD_GRP_ADDR_CNF: |
| 1494 | case WNI_CFG_DEL_GRP_ADDR_CNF: |
| 1495 | //CCM |
| 1496 | if (pMsg->bodyptr) |
| 1497 | { |
| 1498 | ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr); |
| 1499 | status = eHAL_STATUS_SUCCESS; |
| 1500 | vos_mem_free( pMsg->bodyptr ); |
| 1501 | } else { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1502 | smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1503 | } |
| 1504 | break; |
| 1505 | |
| 1506 | case eWNI_SME_ADDTS_RSP: |
| 1507 | case eWNI_SME_DELTS_RSP: |
| 1508 | case eWNI_SME_DELTS_IND: |
| 1509 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1510 | case eWNI_SME_FT_AGGR_QOS_RSP: |
| 1511 | #endif |
| 1512 | //QoS |
| 1513 | if (pMsg->bodyptr) |
| 1514 | { |
| 1515 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1516 | status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr); |
| 1517 | vos_mem_free( pMsg->bodyptr ); |
| 1518 | #endif |
| 1519 | } else { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1520 | smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1521 | } |
| 1522 | break; |
| 1523 | #if defined WLAN_FEATURE_VOWIFI |
| 1524 | case eWNI_SME_NEIGHBOR_REPORT_IND: |
| 1525 | case eWNI_SME_BEACON_REPORT_REQ_IND: |
| 1526 | #if defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1527 | smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1528 | #endif |
| 1529 | if ( pMsg->bodyptr ) |
| 1530 | { |
| 1531 | status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr ); |
| 1532 | vos_mem_free( pMsg->bodyptr ); |
| 1533 | } |
| 1534 | else |
| 1535 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1536 | smsLog( pMac, LOGE, "Empty message for RRM, nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1537 | } |
| 1538 | break; |
| 1539 | #endif |
| 1540 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1541 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1542 | //Handle the eWNI_SME_OEM_DATA_RSP: |
| 1543 | case eWNI_SME_OEM_DATA_RSP: |
| 1544 | if(pMsg->bodyptr) |
| 1545 | { |
| 1546 | status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr); |
| 1547 | vos_mem_free(pMsg->bodyptr); |
| 1548 | } |
| 1549 | else |
| 1550 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1551 | smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1552 | } |
| 1553 | smeProcessPendingQueue( pMac ); |
| 1554 | break; |
| 1555 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1556 | |
| 1557 | case eWNI_SME_ADD_STA_SELF_RSP: |
| 1558 | if(pMsg->bodyptr) |
| 1559 | { |
| 1560 | status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr); |
| 1561 | vos_mem_free(pMsg->bodyptr); |
| 1562 | } |
| 1563 | else |
| 1564 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1565 | smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1566 | } |
| 1567 | break; |
| 1568 | case eWNI_SME_DEL_STA_SELF_RSP: |
| 1569 | if(pMsg->bodyptr) |
| 1570 | { |
| 1571 | status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr); |
| 1572 | vos_mem_free(pMsg->bodyptr); |
| 1573 | } |
| 1574 | else |
| 1575 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1576 | smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1577 | } |
| 1578 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1579 | case eWNI_SME_REMAIN_ON_CHN_RSP: |
| 1580 | if(pMsg->bodyptr) |
| 1581 | { |
| 1582 | status = sme_remainOnChnRsp(pMac, pMsg->bodyptr); |
| 1583 | vos_mem_free(pMsg->bodyptr); |
| 1584 | } |
| 1585 | else |
| 1586 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1587 | smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1588 | } |
| 1589 | break; |
| 1590 | case eWNI_SME_REMAIN_ON_CHN_RDY_IND: |
| 1591 | if(pMsg->bodyptr) |
| 1592 | { |
| 1593 | status = sme_remainOnChnReady(pMac, pMsg->bodyptr); |
| 1594 | vos_mem_free(pMsg->bodyptr); |
| 1595 | } |
| 1596 | else |
| 1597 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1598 | smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RDY_IND), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1599 | } |
| 1600 | break; |
| 1601 | case eWNI_SME_MGMT_FRM_IND: |
| 1602 | if(pMsg->bodyptr) |
| 1603 | { |
| 1604 | sme_mgmtFrmInd(pMac, pMsg->bodyptr); |
| 1605 | vos_mem_free(pMsg->bodyptr); |
| 1606 | } |
| 1607 | else |
| 1608 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1609 | smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1610 | } |
| 1611 | break; |
| 1612 | case eWNI_SME_ACTION_FRAME_SEND_CNF: |
| 1613 | if(pMsg->bodyptr) |
| 1614 | { |
| 1615 | status = sme_sendActionCnf(pMac, pMsg->bodyptr); |
| 1616 | vos_mem_free(pMsg->bodyptr); |
| 1617 | } |
| 1618 | else |
| 1619 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1620 | smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1621 | } |
| 1622 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1623 | case eWNI_SME_COEX_IND: |
| 1624 | if(pMsg->bodyptr) |
| 1625 | { |
| 1626 | status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr); |
| 1627 | vos_mem_free(pMsg->bodyptr); |
| 1628 | } |
| 1629 | else |
| 1630 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1631 | smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1632 | } |
| 1633 | break; |
| 1634 | |
| 1635 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 1636 | case eWNI_SME_PREF_NETWORK_FOUND_IND: |
| 1637 | if(pMsg->bodyptr) |
| 1638 | { |
| 1639 | status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr); |
| 1640 | vos_mem_free(pMsg->bodyptr); |
| 1641 | } |
| 1642 | else |
| 1643 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1644 | smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1645 | } |
| 1646 | break; |
| 1647 | #endif // FEATURE_WLAN_SCAN_PNO |
| 1648 | |
| 1649 | case eWNI_SME_TX_PER_HIT_IND: |
| 1650 | if (pMac->sme.pTxPerHitCallback) |
| 1651 | { |
| 1652 | pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext); |
| 1653 | } |
| 1654 | break; |
| 1655 | |
| 1656 | case eWNI_SME_CHANGE_COUNTRY_CODE: |
| 1657 | if(pMsg->bodyptr) |
| 1658 | { |
| 1659 | status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr); |
| 1660 | vos_mem_free(pMsg->bodyptr); |
| 1661 | } |
| 1662 | else |
| 1663 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1664 | smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1665 | } |
| 1666 | break; |
| 1667 | |
| 1668 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 1669 | case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP: |
| 1670 | if(pMsg->bodyptr) |
| 1671 | { |
| 1672 | status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr); |
| 1673 | vos_mem_free(pMsg->bodyptr); |
| 1674 | } |
| 1675 | else |
| 1676 | { |
| 1677 | smsLog(pMac, LOGE, "Empty rsp message for meas " |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1678 | "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1679 | } |
| 1680 | break; |
| 1681 | #endif // WLAN_FEATURE_PACKET_FILTERING |
| 1682 | case eWNI_SME_PRE_SWITCH_CHL_IND: |
| 1683 | { |
| 1684 | status = sme_HandlePreChannelSwitchInd(pMac); |
| 1685 | break; |
| 1686 | } |
| 1687 | |
| 1688 | case eWNI_SME_POST_SWITCH_CHL_IND: |
| 1689 | { |
| 1690 | status = sme_HandlePostChannelSwitchInd(pMac); |
| 1691 | break; |
| 1692 | } |
| 1693 | |
| 1694 | #ifdef WLAN_WAKEUP_EVENTS |
| 1695 | case eWNI_SME_WAKE_REASON_IND: |
| 1696 | if(pMsg->bodyptr) |
| 1697 | { |
| 1698 | status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr); |
| 1699 | vos_mem_free(pMsg->bodyptr); |
| 1700 | } |
| 1701 | else |
| 1702 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1703 | smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1704 | } |
| 1705 | break; |
| 1706 | #endif // WLAN_WAKEUP_EVENTS |
| 1707 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1708 | #ifdef FEATURE_WLAN_TDLS |
| 1709 | /* |
| 1710 | * command rescived from PE, SME tdls msg processor shall be called |
| 1711 | * to process commands recieved from PE |
| 1712 | */ |
| 1713 | case eWNI_SME_TDLS_SEND_MGMT_RSP: |
| 1714 | case eWNI_SME_TDLS_ADD_STA_RSP: |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 1715 | case eWNI_SME_TDLS_DEL_STA_RSP: |
| 1716 | case eWNI_SME_TDLS_DEL_STA_IND: |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 1717 | case eWNI_SME_TDLS_DEL_ALL_PEER_IND: |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1718 | case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND: |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1719 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 1720 | case eWNI_SME_TDLS_DISCOVERY_START_RSP: |
| 1721 | case eWNI_SME_TDLS_DISCOVERY_START_IND: |
| 1722 | case eWNI_SME_TDLS_LINK_START_RSP: |
| 1723 | case eWNI_SME_TDLS_LINK_START_IND: |
| 1724 | case eWNI_SME_TDLS_TEARDOWN_RSP: |
| 1725 | case eWNI_SME_TDLS_TEARDOWN_IND: |
| 1726 | case eWNI_SME_ADD_TDLS_PEER_IND: |
| 1727 | case eWNI_SME_DELETE_TDLS_PEER_IND: |
| 1728 | #endif |
| 1729 | { |
| 1730 | if (pMsg->bodyptr) |
| 1731 | { |
| 1732 | status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr); |
| 1733 | vos_mem_free( pMsg->bodyptr ); |
| 1734 | } |
| 1735 | else |
| 1736 | { |
| 1737 | smsLog( pMac, LOGE, "Empty rsp message for TDLS, \ |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1738 | nothing to process"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1739 | } |
| 1740 | break; |
| 1741 | } |
| 1742 | #endif |
| 1743 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1744 | #ifdef WLAN_FEATURE_11W |
| 1745 | case eWNI_SME_UNPROT_MGMT_FRM_IND: |
| 1746 | if (pMsg->bodyptr) |
| 1747 | { |
| 1748 | sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr); |
| 1749 | vos_mem_free(pMsg->bodyptr); |
| 1750 | } |
| 1751 | else |
| 1752 | { |
| 1753 | smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process"); |
| 1754 | } |
| 1755 | break; |
| 1756 | #endif |
| 1757 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1758 | default: |
| 1759 | |
| 1760 | if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN ) |
| 1761 | && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) ) |
| 1762 | { |
| 1763 | //CSR |
| 1764 | if (pMsg->bodyptr) |
| 1765 | { |
| 1766 | status = csrMsgProcessor(hHal, pMsg->bodyptr); |
| 1767 | vos_mem_free( pMsg->bodyptr ); |
| 1768 | } |
| 1769 | else |
| 1770 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1771 | smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1772 | } |
| 1773 | } |
| 1774 | else |
| 1775 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1776 | smsLog( pMac, LOGW, "Unknown message type %d, nothing to process", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1777 | pMsg->type); |
| 1778 | if (pMsg->bodyptr) |
| 1779 | { |
| 1780 | vos_mem_free( pMsg->bodyptr ); |
| 1781 | } |
| 1782 | } |
| 1783 | }//switch |
| 1784 | } //SME_IS_START |
| 1785 | else |
| 1786 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1787 | smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1788 | if (pMsg->bodyptr) |
| 1789 | { |
| 1790 | vos_mem_free( pMsg->bodyptr ); |
| 1791 | } |
| 1792 | } |
| 1793 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 1794 | } |
| 1795 | else |
| 1796 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1797 | smsLog( pMac, LOGW, "Locking failed, bailing out"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1798 | if (pMsg->bodyptr) |
| 1799 | { |
| 1800 | vos_mem_free( pMsg->bodyptr ); |
| 1801 | } |
| 1802 | } |
| 1803 | |
| 1804 | return status; |
| 1805 | } |
| 1806 | |
| 1807 | |
| 1808 | //No need to hold the global lock here because this function can only be called |
| 1809 | //after sme_Stop. |
| 1810 | v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg ) |
| 1811 | { |
| 1812 | if( pMsg ) |
| 1813 | { |
| 1814 | if (pMsg->bodyptr) |
| 1815 | { |
| 1816 | vos_mem_free( pMsg->bodyptr ); |
| 1817 | } |
| 1818 | } |
| 1819 | |
| 1820 | } |
| 1821 | |
| 1822 | |
| 1823 | /*-------------------------------------------------------------------------- |
| 1824 | |
| 1825 | \brief sme_Stop() - Stop all SME modules and put them at idle state |
| 1826 | |
| 1827 | The function stops each module in SME, PMC, CCM, CSR, etc. . Upon |
| 1828 | return, all modules are at idle state ready to start. |
| 1829 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1830 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1831 | \param hHal - The handle returned by macOpen |
| 1832 | |
| 1833 | \return eHAL_STATUS_SUCCESS - SME is stopped. |
| 1834 | |
| 1835 | Other status means SME is failed to stop but caller should still |
| 1836 | consider SME is stopped. |
| 1837 | \sa |
| 1838 | |
| 1839 | --------------------------------------------------------------------------*/ |
| 1840 | eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag) |
| 1841 | { |
| 1842 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1843 | eHalStatus fail_status = eHAL_STATUS_SUCCESS; |
| 1844 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1845 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1846 | status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL)); |
| 1847 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1848 | smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1849 | status ); |
| 1850 | fail_status = status; |
| 1851 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1852 | |
| 1853 | p2pStop(hHal); |
| 1854 | |
| 1855 | if(pmcFlag) |
| 1856 | { |
| 1857 | status = pmcStop(hHal); |
| 1858 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1859 | smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1860 | status ); |
| 1861 | fail_status = status; |
| 1862 | } |
| 1863 | } |
| 1864 | |
| 1865 | status = csrStop(pMac); |
| 1866 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1867 | smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1868 | status ); |
| 1869 | fail_status = status; |
| 1870 | } |
| 1871 | |
| 1872 | ccmStop(hHal); |
| 1873 | |
| 1874 | purgeSmeCmdList(pMac); |
| 1875 | |
| 1876 | if (!HAL_STATUS_SUCCESS( fail_status )) { |
| 1877 | status = fail_status; |
| 1878 | } |
| 1879 | |
| 1880 | pMac->sme.state = SME_STATE_STOP; |
| 1881 | |
| 1882 | return status; |
| 1883 | } |
| 1884 | |
| 1885 | /*-------------------------------------------------------------------------- |
| 1886 | |
| 1887 | \brief sme_Close() - Release all SME modules and their resources. |
| 1888 | |
| 1889 | The function release each module in SME, PMC, CCM, CSR, etc. . Upon |
| 1890 | return, all modules are at closed state. |
| 1891 | |
| 1892 | No SME APIs can be involved after smeClose except smeOpen. |
| 1893 | smeClose must be called before macClose. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1894 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1895 | \param hHal - The handle returned by macOpen |
| 1896 | |
| 1897 | \return eHAL_STATUS_SUCCESS - SME is successfully close. |
| 1898 | |
| 1899 | Other status means SME is failed to be closed but caller still cannot |
| 1900 | call any other SME functions except smeOpen. |
| 1901 | \sa |
| 1902 | |
| 1903 | --------------------------------------------------------------------------*/ |
| 1904 | eHalStatus sme_Close(tHalHandle hHal) |
| 1905 | { |
| 1906 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1907 | eHalStatus fail_status = eHAL_STATUS_SUCCESS; |
| 1908 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1909 | |
| 1910 | status = csrClose(pMac); |
| 1911 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1912 | smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1913 | status ); |
| 1914 | fail_status = status; |
| 1915 | } |
| 1916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1917 | status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL)); |
| 1918 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1919 | smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1920 | status ); |
| 1921 | fail_status = status; |
| 1922 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | |
| 1924 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1925 | status = btcClose(hHal); |
| 1926 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1927 | smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1928 | status ); |
| 1929 | fail_status = status; |
| 1930 | } |
| 1931 | |
| 1932 | status = sme_QosClose(pMac); |
| 1933 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1934 | smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1935 | status ); |
| 1936 | fail_status = status; |
| 1937 | } |
| 1938 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1939 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1940 | status = oemData_OemDataReqClose(hHal); |
| 1941 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1942 | smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1943 | status ); |
| 1944 | fail_status = status; |
| 1945 | } |
| 1946 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1947 | |
| 1948 | status = ccmClose(hHal); |
| 1949 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1950 | smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | status ); |
| 1952 | fail_status = status; |
| 1953 | } |
| 1954 | |
| 1955 | status = pmcClose(hHal); |
| 1956 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1957 | smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | status ); |
| 1959 | fail_status = status; |
| 1960 | } |
| 1961 | #if defined WLAN_FEATURE_VOWIFI |
| 1962 | status = rrmClose(hHal); |
| 1963 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1964 | smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | status ); |
| 1966 | fail_status = status; |
| 1967 | } |
| 1968 | #endif |
| 1969 | |
| 1970 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 1971 | sme_FTClose(hHal); |
| 1972 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1973 | sme_p2pClose(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1974 | |
| 1975 | freeSmeCmdList(pMac); |
| 1976 | |
| 1977 | if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) ) |
| 1978 | { |
| 1979 | fail_status = eHAL_STATUS_FAILURE; |
| 1980 | } |
| 1981 | |
| 1982 | if (!HAL_STATUS_SUCCESS( fail_status )) { |
| 1983 | status = fail_status; |
| 1984 | } |
| 1985 | |
| 1986 | pMac->sme.state = SME_STATE_STOP; |
| 1987 | |
| 1988 | return status; |
| 1989 | } |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 1990 | #ifdef FEATURE_WLAN_LFR |
| 1991 | tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac) |
| 1992 | { |
Madan Mohan Koyyalamudi | fb534bb | 2012-10-24 14:35:45 -0700 | [diff] [blame] | 1993 | #if 0 |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 1994 | switch(pMac->roam.neighborRoamInfo.neighborRoamState) { |
| 1995 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 1996 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING: |
| 1997 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE: |
| 1998 | case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING: |
| 1999 | return eANI_BOOLEAN_FALSE; |
| 2000 | default: |
| 2001 | return eANI_BOOLEAN_TRUE; |
| 2002 | } |
Madan Mohan Koyyalamudi | fb534bb | 2012-10-24 14:35:45 -0700 | [diff] [blame] | 2003 | #else |
| 2004 | /* |
| 2005 | * TODO: always return TRUE for now until |
| 2006 | * we figure out why we could be stuck in |
| 2007 | * one of the roaming states forever. |
| 2008 | */ |
| 2009 | return eANI_BOOLEAN_TRUE; |
| 2010 | #endif |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2011 | } |
| 2012 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2013 | /* --------------------------------------------------------------------------- |
| 2014 | \fn sme_ScanRequest |
| 2015 | \brief a wrapper function to Request a 11d or full scan from CSR. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2016 | This is an asynchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2017 | \param pScanRequestID - pointer to an object to get back the request ID |
| 2018 | \param callback - a callback function that scan calls upon finish, will not |
| 2019 | be called if csrScanRequest returns error |
| 2020 | \param pContext - a pointer passed in for the callback |
| 2021 | \return eHalStatus |
| 2022 | ---------------------------------------------------------------------------*/ |
| 2023 | eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq, |
| 2024 | tANI_U32 *pScanRequestID, |
| 2025 | csrScanCompleteCallback callback, void *pContext) |
| 2026 | { |
| 2027 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2028 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2029 | |
| 2030 | smsLog(pMac, LOG2, FL("enter")); |
| 2031 | do |
| 2032 | { |
| 2033 | if(pMac->scan.fScanEnable) |
| 2034 | { |
| 2035 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2036 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2037 | { |
| 2038 | { |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2039 | #ifdef FEATURE_WLAN_LFR |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2040 | if(csrIsScanAllowed(pMac)) |
| 2041 | { |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2042 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2043 | status = csrScanRequest( hHal, sessionId, pscanReq, |
| 2044 | pScanRequestID, callback, pContext ); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2045 | #ifdef FEATURE_WLAN_LFR |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2046 | } |
| 2047 | else |
| 2048 | { |
Madan Mohan Koyyalamudi | ab4ab0d | 2012-10-24 14:26:50 -0700 | [diff] [blame] | 2049 | smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"), |
| 2050 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 2051 | pMac->roam.curSubState[sessionId]); |
| 2052 | /*HandOff is in progress. So schedule this scan later*/ |
| 2053 | status = eHAL_STATUS_RESOURCES; |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2054 | } |
| 2055 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2056 | } |
| 2057 | |
| 2058 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2059 | } //sme_AcquireGlobalLock success |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2060 | else |
| 2061 | { |
| 2062 | smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed")); |
| 2063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2064 | } //if(pMac->scan.fScanEnable) |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2065 | else |
| 2066 | { |
| 2067 | smsLog(pMac, LOGE, FL("fScanEnable FALSE")); |
| 2068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2069 | } while( 0 ); |
| 2070 | |
| 2071 | return (status); |
| 2072 | |
| 2073 | |
| 2074 | } |
| 2075 | |
| 2076 | /* --------------------------------------------------------------------------- |
| 2077 | \fn sme_ScanGetResult |
| 2078 | \brief a wrapper function to request scan results from CSR. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2079 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2080 | \param pFilter - If pFilter is NULL, all cached results are returned |
| 2081 | \param phResult - an object for the result. |
| 2082 | \return eHalStatus |
| 2083 | ---------------------------------------------------------------------------*/ |
| 2084 | eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter, |
| 2085 | tScanResultHandle *phResult) |
| 2086 | { |
| 2087 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2088 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2089 | |
| 2090 | smsLog(pMac, LOG2, FL("enter")); |
| 2091 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2092 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2093 | { |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 2094 | status = csrScanGetResult( hHal, pFilter, phResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2095 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2096 | } |
| 2097 | smsLog(pMac, LOG2, FL("exit status %d"), status); |
| 2098 | |
| 2099 | return (status); |
| 2100 | } |
| 2101 | |
| 2102 | |
| 2103 | /* --------------------------------------------------------------------------- |
| 2104 | \fn sme_ScanFlushResult |
| 2105 | \brief a wrapper function to request CSR to clear scan results. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2106 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2107 | \return eHalStatus |
| 2108 | ---------------------------------------------------------------------------*/ |
| 2109 | eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId) |
| 2110 | { |
| 2111 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2112 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2113 | |
| 2114 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2115 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2116 | { |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 2117 | status = csrScanFlushResult( hHal ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2118 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2119 | } |
| 2120 | |
| 2121 | return (status); |
| 2122 | } |
| 2123 | |
Madan Mohan Koyyalamudi | a3fcf14 | 2012-10-18 15:01:20 -0700 | [diff] [blame] | 2124 | eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId) |
| 2125 | { |
| 2126 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2127 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2128 | |
| 2129 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2130 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2131 | { |
Madan Mohan Koyyalamudi | 5850f31 | 2012-11-27 19:00:25 +0530 | [diff] [blame] | 2132 | status = csrScanFlushSelectiveResult( hHal, VOS_TRUE ); |
Madan Mohan Koyyalamudi | a3fcf14 | 2012-10-18 15:01:20 -0700 | [diff] [blame] | 2133 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2134 | } |
| 2135 | |
| 2136 | return (status); |
| 2137 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2138 | |
| 2139 | /* --------------------------------------------------------------------------- |
| 2140 | \fn sme_ScanResultGetFirst |
| 2141 | \brief a wrapper function to request CSR to returns the first element of |
| 2142 | scan result. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2143 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2144 | \param hScanResult - returned from csrScanGetResult |
| 2145 | \return tCsrScanResultInfo * - NULL if no result |
| 2146 | ---------------------------------------------------------------------------*/ |
| 2147 | tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal, |
| 2148 | tScanResultHandle hScanResult) |
| 2149 | { |
| 2150 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2151 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2152 | tCsrScanResultInfo *pRet = NULL; |
| 2153 | |
| 2154 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2155 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2156 | { |
| 2157 | pRet = csrScanResultGetFirst( pMac, hScanResult ); |
| 2158 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2159 | } |
| 2160 | |
| 2161 | return (pRet); |
| 2162 | } |
| 2163 | |
| 2164 | |
| 2165 | /* --------------------------------------------------------------------------- |
| 2166 | \fn sme_ScanResultGetNext |
| 2167 | \brief a wrapper function to request CSR to returns the next element of |
| 2168 | scan result. It can be called without calling csrScanResultGetFirst |
| 2169 | first |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2170 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2171 | \param hScanResult - returned from csrScanGetResult |
| 2172 | \return Null if no result or reach the end |
| 2173 | ---------------------------------------------------------------------------*/ |
| 2174 | tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal, |
| 2175 | tScanResultHandle hScanResult) |
| 2176 | { |
| 2177 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2178 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2179 | tCsrScanResultInfo *pRet = NULL; |
| 2180 | |
| 2181 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2182 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2183 | { |
| 2184 | pRet = csrScanResultGetNext( pMac, hScanResult ); |
| 2185 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2186 | } |
| 2187 | |
| 2188 | return (pRet); |
| 2189 | } |
| 2190 | |
| 2191 | |
| 2192 | /* --------------------------------------------------------------------------- |
| 2193 | \fn sme_ScanSetBGScanparams |
| 2194 | \brief a wrapper function to request CSR to set BG scan params in PE |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2195 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2196 | \param pScanReq - BG scan request structure |
| 2197 | \return eHalStatus |
| 2198 | ---------------------------------------------------------------------------*/ |
| 2199 | eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq) |
| 2200 | { |
| 2201 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2202 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2203 | |
| 2204 | if( NULL != pScanReq ) |
| 2205 | { |
| 2206 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2207 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2208 | { |
| 2209 | status = csrScanSetBGScanparams( hHal, pScanReq ); |
| 2210 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2211 | } |
| 2212 | } |
| 2213 | |
| 2214 | return (status); |
| 2215 | } |
| 2216 | |
| 2217 | |
| 2218 | /* --------------------------------------------------------------------------- |
| 2219 | \fn sme_ScanResultPurge |
| 2220 | \brief a wrapper function to request CSR to remove all items(tCsrScanResult) |
| 2221 | in the list and free memory for each item |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2222 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2223 | \param hScanResult - returned from csrScanGetResult. hScanResult is |
| 2224 | considered gone by |
| 2225 | calling this function and even before this function reutrns. |
| 2226 | \return eHalStatus |
| 2227 | ---------------------------------------------------------------------------*/ |
| 2228 | eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult) |
| 2229 | { |
| 2230 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2231 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2232 | |
| 2233 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2234 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2235 | { |
| 2236 | status = csrScanResultPurge( hHal, hScanResult ); |
| 2237 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2238 | } |
| 2239 | |
| 2240 | return (status); |
| 2241 | } |
| 2242 | |
| 2243 | /* --------------------------------------------------------------------------- |
| 2244 | \fn sme_ScanGetPMKIDCandidateList |
| 2245 | \brief a wrapper function to return the PMKID candidate list |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2246 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2247 | \param pPmkidList - caller allocated buffer point to an array of |
| 2248 | tPmkidCandidateInfo |
| 2249 | \param pNumItems - pointer to a variable that has the number of |
| 2250 | tPmkidCandidateInfo allocated when retruning, this is |
| 2251 | either the number needed or number of items put into |
| 2252 | pPmkidList |
| 2253 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2254 | big enough and pNumItems |
| 2255 | has the number of tPmkidCandidateInfo. |
| 2256 | \Note: pNumItems is a number of tPmkidCandidateInfo, |
| 2257 | not sizeof(tPmkidCandidateInfo) * something |
| 2258 | ---------------------------------------------------------------------------*/ |
| 2259 | eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId, |
| 2260 | tPmkidCandidateInfo *pPmkidList, |
| 2261 | tANI_U32 *pNumItems ) |
| 2262 | { |
| 2263 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2264 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2265 | |
| 2266 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2267 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2268 | { |
| 2269 | status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems ); |
| 2270 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2271 | } |
| 2272 | |
| 2273 | return (status); |
| 2274 | } |
| 2275 | |
| 2276 | /*---------------------------------------------------------------------------- |
| 2277 | \fn sme_RoamRegisterLinkQualityIndCallback |
| 2278 | |
| 2279 | \brief |
| 2280 | a wrapper function to allow HDD to register a callback handler with CSR for |
| 2281 | link quality indications. |
| 2282 | |
| 2283 | Only one callback may be registered at any time. |
| 2284 | In order to deregister the callback, a NULL cback may be provided. |
| 2285 | |
| 2286 | Registration happens in the task context of the caller. |
| 2287 | |
| 2288 | \param callback - Call back being registered |
| 2289 | \param pContext - user data |
| 2290 | |
| 2291 | DEPENDENCIES: After CSR open |
| 2292 | |
| 2293 | \return eHalStatus |
| 2294 | -----------------------------------------------------------------------------*/ |
| 2295 | eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId, |
| 2296 | csrRoamLinkQualityIndCallback callback, |
| 2297 | void *pContext) |
| 2298 | { |
| 2299 | return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext)); |
| 2300 | } |
| 2301 | |
| 2302 | /* --------------------------------------------------------------------------- |
| 2303 | \fn sme_RoamRegisterCallback |
| 2304 | \brief a wrapper function to allow HDD to register a callback with CSR. |
| 2305 | Unlike scan, roam has one callback for all the roam requests |
| 2306 | \param callback - a callback function that roam calls upon when state changes |
| 2307 | \param pContext - a pointer passed in for the callback |
| 2308 | \return eHalStatus |
| 2309 | ---------------------------------------------------------------------------*/ |
| 2310 | eHalStatus sme_RoamRegisterCallback(tHalHandle hHal, |
| 2311 | csrRoamCompleteCallback callback, |
| 2312 | void *pContext) |
| 2313 | { |
| 2314 | return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext)); |
| 2315 | } |
| 2316 | |
| 2317 | eCsrPhyMode sme_GetPhyMode(tHalHandle hHal) |
| 2318 | { |
| 2319 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2320 | return pMac->roam.configParam.phyMode; |
| 2321 | } |
| 2322 | |
| 2323 | /* --------------------------------------------------------------------------- |
| 2324 | \fn sme_RoamConnect |
| 2325 | \brief a wrapper function to request CSR to inititiate an association |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2326 | This is an asynchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2327 | \param sessionId - the sessionId returned by sme_OpenSession. |
| 2328 | \param pProfile - description of the network to which to connect |
| 2329 | \param hBssListIn - a list of BSS descriptor to roam to. It is returned |
| 2330 | from csrScanGetResult |
| 2331 | \param pRoamId - to get back the request ID |
| 2332 | \return eHalStatus |
| 2333 | ---------------------------------------------------------------------------*/ |
| 2334 | eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile, |
| 2335 | tANI_U32 *pRoamId) |
| 2336 | { |
| 2337 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2338 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2339 | |
| 2340 | smsLog(pMac, LOG2, FL("enter")); |
| 2341 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2342 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2343 | { |
| 2344 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2345 | { |
| 2346 | status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId ); |
| 2347 | } |
| 2348 | else |
| 2349 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2350 | smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2351 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2352 | } |
| 2353 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2354 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2355 | else |
| 2356 | { |
| 2357 | smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed")); |
| 2358 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | |
| 2360 | return (status); |
| 2361 | } |
| 2362 | |
| 2363 | /* --------------------------------------------------------------------------- |
| 2364 | \fn sme_RoamReassoc |
| 2365 | \brief a wrapper function to request CSR to inititiate a re-association |
| 2366 | \param pProfile - can be NULL to join the currently connected AP. In that |
| 2367 | case modProfileFields should carry the modified field(s) which could trigger |
| 2368 | reassoc |
| 2369 | \param modProfileFields - fields which are part of tCsrRoamConnectedProfile |
| 2370 | that might need modification dynamically once STA is up & running and this |
| 2371 | could trigger a reassoc |
| 2372 | \param pRoamId - to get back the request ID |
| 2373 | \return eHalStatus |
| 2374 | -------------------------------------------------------------------------------*/ |
| 2375 | eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile, |
| 2376 | tCsrRoamModifyProfileFields modProfileFields, |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 2377 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | { |
| 2379 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2380 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2381 | |
| 2382 | smsLog(pMac, LOG2, FL("enter")); |
| 2383 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2384 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2385 | { |
| 2386 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2387 | { |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 2388 | if((NULL == pProfile) && (fForce == 1)) |
| 2389 | { |
| 2390 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2391 | /* to force the AP initiate fresh 802.1x authentication need to clear |
| 2392 | * the PMKID cache for that set the following boolean. this is needed |
| 2393 | * by the HS 2.0 passpoint certification 5.2.a and b testcases */ |
| 2394 | pSession->fIgnorePMKIDCache = TRUE; |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 2395 | status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce); |
| 2396 | } |
| 2397 | else |
| 2398 | { |
| 2399 | status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId ); |
| 2400 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2401 | } |
| 2402 | else |
| 2403 | { |
| 2404 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2405 | } |
| 2406 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2407 | } |
| 2408 | |
| 2409 | return (status); |
| 2410 | } |
| 2411 | |
| 2412 | /* --------------------------------------------------------------------------- |
| 2413 | \fn sme_RoamConnectToLastProfile |
| 2414 | \brief a wrapper function to request CSR to disconnect and reconnect with |
| 2415 | the same profile |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2416 | This is an asynchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2417 | \return eHalStatus. It returns fail if currently connected |
| 2418 | ---------------------------------------------------------------------------*/ |
| 2419 | eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId) |
| 2420 | { |
| 2421 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2422 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2423 | |
| 2424 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2425 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2426 | { |
| 2427 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2428 | { |
| 2429 | status = csrRoamConnectToLastProfile( pMac, sessionId ); |
| 2430 | } |
| 2431 | else |
| 2432 | { |
| 2433 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2434 | } |
| 2435 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2436 | } |
| 2437 | |
| 2438 | return (status); |
| 2439 | } |
| 2440 | |
| 2441 | /* --------------------------------------------------------------------------- |
| 2442 | \fn sme_RoamDisconnect |
| 2443 | \brief a wrapper function to request CSR to disconnect from a network |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2444 | This is an asynchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2445 | \param reason -- To indicate the reason for disconnecting. Currently, only |
| 2446 | eCSR_DISCONNECT_REASON_MIC_ERROR is meanful. |
| 2447 | \return eHalStatus |
| 2448 | ---------------------------------------------------------------------------*/ |
| 2449 | eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason) |
| 2450 | { |
| 2451 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2452 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2453 | |
| 2454 | smsLog(pMac, LOG2, FL("enter")); |
| 2455 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2456 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2457 | { |
| 2458 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2459 | { |
| 2460 | status = csrRoamDisconnect( pMac, sessionId, reason ); |
| 2461 | } |
| 2462 | else |
| 2463 | { |
| 2464 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2465 | } |
| 2466 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2467 | } |
| 2468 | |
| 2469 | return (status); |
| 2470 | } |
| 2471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2472 | /* --------------------------------------------------------------------------- |
| 2473 | \fn sme_RoamStopBss |
| 2474 | \brief To stop BSS for Soft AP. This is an asynchronous API. |
| 2475 | \param hHal - Global structure |
| 2476 | \param sessionId - sessionId of SoftAP |
| 2477 | \return eHalStatus SUCCESS Roam callback will be called to indicate actual results |
| 2478 | -------------------------------------------------------------------------------*/ |
| 2479 | eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId) |
| 2480 | { |
| 2481 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2482 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2483 | |
| 2484 | smsLog(pMac, LOG2, FL("enter")); |
| 2485 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2486 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2487 | { |
| 2488 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2489 | { |
Gopichand Nakkala | f44bdc5 | 2013-02-16 00:54:45 +0530 | [diff] [blame] | 2490 | status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2491 | } |
| 2492 | else |
| 2493 | { |
| 2494 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2495 | } |
| 2496 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2497 | } |
| 2498 | |
| 2499 | return (status); |
| 2500 | } |
| 2501 | |
| 2502 | /* --------------------------------------------------------------------------- |
| 2503 | \fn sme_RoamDisconnectSta |
| 2504 | \brief To disassociate a station. This is an asynchronous API. |
| 2505 | \param hHal - Global structure |
| 2506 | \param sessionId - sessionId of SoftAP |
| 2507 | \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes) |
| 2508 | \return eHalStatus SUCCESS Roam callback will be called to indicate actual results |
| 2509 | -------------------------------------------------------------------------------*/ |
| 2510 | eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId, |
| 2511 | tANI_U8 *pPeerMacAddr) |
| 2512 | { |
| 2513 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2514 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2515 | |
| 2516 | if ( NULL == pMac ) |
| 2517 | { |
| 2518 | VOS_ASSERT(0); |
| 2519 | return status; |
| 2520 | } |
| 2521 | |
| 2522 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2523 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2524 | { |
| 2525 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2526 | { |
| 2527 | status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr, |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2528 | eSIR_MAC_DEAUTH_LEAVING_BSS_REASON); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2529 | } |
| 2530 | else |
| 2531 | { |
| 2532 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2533 | } |
| 2534 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2535 | } |
| 2536 | |
| 2537 | return (status); |
| 2538 | } |
| 2539 | |
| 2540 | /* --------------------------------------------------------------------------- |
| 2541 | \fn sme_RoamDeauthSta |
| 2542 | \brief To disassociate a station. This is an asynchronous API. |
| 2543 | \param hHal - Global structure |
| 2544 | \param sessionId - sessionId of SoftAP |
| 2545 | \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes) |
| 2546 | \return eHalStatus SUCCESS Roam callback will be called to indicate actual results |
| 2547 | -------------------------------------------------------------------------------*/ |
| 2548 | eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId, |
| 2549 | tANI_U8 *pPeerMacAddr) |
| 2550 | { |
| 2551 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2552 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2553 | |
| 2554 | if ( NULL == pMac ) |
| 2555 | { |
| 2556 | VOS_ASSERT(0); |
| 2557 | return status; |
| 2558 | } |
| 2559 | |
| 2560 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2561 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2562 | { |
| 2563 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2564 | { |
| 2565 | status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr, |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2566 | eSIR_MAC_DEAUTH_LEAVING_BSS_REASON); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2567 | } |
| 2568 | else |
| 2569 | { |
| 2570 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2571 | } |
| 2572 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2573 | } |
| 2574 | |
| 2575 | return (status); |
| 2576 | } |
| 2577 | |
| 2578 | /* --------------------------------------------------------------------------- |
| 2579 | \fn sme_RoamTKIPCounterMeasures |
| 2580 | \brief To start or stop TKIP counter measures. This is an asynchronous API. |
| 2581 | \param sessionId - sessionId of SoftAP |
| 2582 | \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes) |
| 2583 | \return eHalStatus |
| 2584 | -------------------------------------------------------------------------------*/ |
| 2585 | eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId, |
| 2586 | tANI_BOOLEAN bEnable) |
| 2587 | { |
| 2588 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2589 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2590 | |
| 2591 | if ( NULL == pMac ) |
| 2592 | { |
| 2593 | VOS_ASSERT(0); |
| 2594 | return status; |
| 2595 | } |
| 2596 | |
| 2597 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2598 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2599 | { |
| 2600 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2601 | { |
| 2602 | status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable); |
| 2603 | } |
| 2604 | else |
| 2605 | { |
| 2606 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2607 | } |
| 2608 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2609 | } |
| 2610 | |
| 2611 | return (status); |
| 2612 | } |
| 2613 | |
| 2614 | /* --------------------------------------------------------------------------- |
| 2615 | \fn sme_RoamGetAssociatedStas |
| 2616 | \brief To probe the list of associated stations from various modules of CORE stack. |
| 2617 | \This is an asynchronous API. |
| 2618 | \param sessionId - sessionId of SoftAP |
| 2619 | \param modId - Module from whom list of associtated stations is to be probed. |
| 2620 | If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed |
| 2621 | \param pUsrContext - Opaque HDD context |
| 2622 | \param pfnSapEventCallback - Sap event callback in HDD |
| 2623 | \param pAssocBuf - Caller allocated memory to be filled with associatd stations info |
| 2624 | \return eHalStatus |
| 2625 | -------------------------------------------------------------------------------*/ |
| 2626 | eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId, |
| 2627 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2628 | void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf) |
| 2629 | { |
| 2630 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2631 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2632 | |
| 2633 | if ( NULL == pMac ) |
| 2634 | { |
| 2635 | VOS_ASSERT(0); |
| 2636 | return status; |
| 2637 | } |
| 2638 | |
| 2639 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2640 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2641 | { |
| 2642 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2643 | { |
| 2644 | status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2645 | } |
| 2646 | else |
| 2647 | { |
| 2648 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2649 | } |
| 2650 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2651 | } |
| 2652 | |
| 2653 | return (status); |
| 2654 | } |
| 2655 | |
| 2656 | /* --------------------------------------------------------------------------- |
| 2657 | \fn sme_RoamGetWpsSessionOverlap |
| 2658 | \brief To get the WPS PBC session overlap information. |
| 2659 | \This is an asynchronous API. |
| 2660 | \param sessionId - sessionId of SoftAP |
| 2661 | \param pUsrContext - Opaque HDD context |
| 2662 | \param pfnSapEventCallback - Sap event callback in HDD |
| 2663 | \pRemoveMac - pointer to Mac address which needs to be removed from session |
| 2664 | \return eHalStatus |
| 2665 | -------------------------------------------------------------------------------*/ |
| 2666 | eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId, |
| 2667 | void *pUsrContext, void |
| 2668 | *pfnSapEventCallback, v_MACADDR_t pRemoveMac) |
| 2669 | { |
| 2670 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2671 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2672 | |
| 2673 | if ( NULL == pMac ) |
| 2674 | { |
| 2675 | VOS_ASSERT(0); |
| 2676 | return status; |
| 2677 | } |
| 2678 | |
| 2679 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2680 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2681 | { |
| 2682 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2683 | { |
| 2684 | status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2685 | } |
| 2686 | else |
| 2687 | { |
| 2688 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2689 | } |
| 2690 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2691 | } |
| 2692 | |
| 2693 | return (status); |
| 2694 | } |
| 2695 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2696 | |
| 2697 | /* --------------------------------------------------------------------------- |
| 2698 | \fn sme_RoamGetConnectState |
| 2699 | \brief a wrapper function to request CSR to return the current connect state |
| 2700 | of Roaming |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2701 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2702 | \return eHalStatus |
| 2703 | ---------------------------------------------------------------------------*/ |
| 2704 | eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState) |
| 2705 | { |
| 2706 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2707 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2708 | |
| 2709 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2710 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2711 | { |
| 2712 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2713 | { |
| 2714 | status = csrRoamGetConnectState( pMac, sessionId, pState ); |
| 2715 | } |
| 2716 | else |
| 2717 | { |
| 2718 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2719 | } |
| 2720 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2721 | } |
| 2722 | |
| 2723 | return (status); |
| 2724 | } |
| 2725 | |
| 2726 | /* --------------------------------------------------------------------------- |
| 2727 | \fn sme_RoamGetConnectProfile |
| 2728 | \brief a wrapper function to request CSR to return the current connect |
| 2729 | profile. Caller must call csrRoamFreeConnectProfile after it is done |
| 2730 | and before reuse for another csrRoamGetConnectProfile call. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2731 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2732 | \param pProfile - pointer to a caller allocated structure |
| 2733 | tCsrRoamConnectedProfile |
| 2734 | \return eHalStatus. Failure if not connected |
| 2735 | ---------------------------------------------------------------------------*/ |
| 2736 | eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId, |
| 2737 | tCsrRoamConnectedProfile *pProfile) |
| 2738 | { |
| 2739 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2740 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2741 | |
| 2742 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2743 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2744 | { |
| 2745 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2746 | { |
| 2747 | status = csrRoamGetConnectProfile( pMac, sessionId, pProfile ); |
| 2748 | } |
| 2749 | else |
| 2750 | { |
| 2751 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2752 | } |
| 2753 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2754 | } |
| 2755 | |
| 2756 | return (status); |
| 2757 | } |
| 2758 | |
| 2759 | /* --------------------------------------------------------------------------- |
| 2760 | \fn sme_RoamFreeConnectProfile |
| 2761 | \brief a wrapper function to request CSR to free and reinitialize the |
| 2762 | profile returned previously by csrRoamGetConnectProfile. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2763 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | \param pProfile - pointer to a caller allocated structure |
| 2765 | tCsrRoamConnectedProfile |
| 2766 | \return eHalStatus. |
| 2767 | ---------------------------------------------------------------------------*/ |
| 2768 | eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal, |
| 2769 | tCsrRoamConnectedProfile *pProfile) |
| 2770 | { |
| 2771 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2772 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2773 | |
| 2774 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2775 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2776 | { |
| 2777 | status = csrRoamFreeConnectProfile( pMac, pProfile ); |
| 2778 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2779 | } |
| 2780 | |
| 2781 | return (status); |
| 2782 | } |
| 2783 | |
| 2784 | /* --------------------------------------------------------------------------- |
| 2785 | \fn sme_RoamSetPMKIDCache |
| 2786 | \brief a wrapper function to request CSR to return the PMKID candidate list |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2787 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2788 | \param pPMKIDCache - caller allocated buffer point to an array of |
| 2789 | tPmkidCacheInfo |
| 2790 | \param numItems - a variable that has the number of tPmkidCacheInfo |
| 2791 | allocated when retruning, this is either the number needed |
| 2792 | or number of items put into pPMKIDCache |
| 2793 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2794 | big enough and pNumItems has the number of |
| 2795 | tPmkidCacheInfo. |
| 2796 | \Note: pNumItems is a number of tPmkidCacheInfo, |
| 2797 | not sizeof(tPmkidCacheInfo) * something |
| 2798 | ---------------------------------------------------------------------------*/ |
| 2799 | eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache, |
| 2800 | tANI_U32 numItems ) |
| 2801 | { |
| 2802 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2803 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2804 | |
| 2805 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2806 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2807 | { |
| 2808 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2809 | { |
| 2810 | status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems ); |
| 2811 | } |
| 2812 | else |
| 2813 | { |
| 2814 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2815 | } |
| 2816 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2817 | } |
| 2818 | |
| 2819 | return (status); |
| 2820 | } |
| 2821 | |
| 2822 | /* --------------------------------------------------------------------------- |
| 2823 | \fn sme_RoamGetSecurityReqIE |
| 2824 | \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR |
| 2825 | passes to PE to JOIN request or START_BSS request |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2826 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2827 | \param pLen - caller allocated memory that has the length of pBuf as input. |
| 2828 | Upon returned, *pLen has the needed or IE length in pBuf. |
| 2829 | \param pBuf - Caller allocated memory that contain the IE field, if any, |
| 2830 | upon return |
| 2831 | \param secType - Specifies whether looking for WPA/WPA2/WAPI IE |
| 2832 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2833 | big enough |
| 2834 | ---------------------------------------------------------------------------*/ |
| 2835 | eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen, |
| 2836 | tANI_U8 *pBuf, eCsrSecurityType secType) |
| 2837 | { |
| 2838 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2839 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2840 | |
| 2841 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2842 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2843 | { |
| 2844 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2845 | { |
| 2846 | status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf ); |
| 2847 | } |
| 2848 | else |
| 2849 | { |
| 2850 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2851 | } |
| 2852 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2853 | } |
| 2854 | |
| 2855 | return (status); |
| 2856 | } |
| 2857 | |
| 2858 | /* --------------------------------------------------------------------------- |
| 2859 | \fn sme_RoamGetSecurityRspIE |
| 2860 | \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from |
| 2861 | the beacon or probe rsp if connected |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2862 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2863 | \param pLen - caller allocated memory that has the length of pBuf as input. |
| 2864 | Upon returned, *pLen has the needed or IE length in pBuf. |
| 2865 | \param pBuf - Caller allocated memory that contain the IE field, if any, |
| 2866 | upon return |
| 2867 | \param secType - Specifies whether looking for WPA/WPA2/WAPI IE |
| 2868 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2869 | big enough |
| 2870 | ---------------------------------------------------------------------------*/ |
| 2871 | eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen, |
| 2872 | tANI_U8 *pBuf, eCsrSecurityType secType) |
| 2873 | { |
| 2874 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2875 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2876 | |
| 2877 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2878 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2879 | { |
| 2880 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2881 | { |
| 2882 | status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf ); |
| 2883 | } |
| 2884 | else |
| 2885 | { |
| 2886 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2887 | } |
| 2888 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2889 | } |
| 2890 | |
| 2891 | return (status); |
| 2892 | |
| 2893 | } |
| 2894 | |
| 2895 | |
| 2896 | /* --------------------------------------------------------------------------- |
| 2897 | \fn sme_RoamGetNumPMKIDCache |
| 2898 | \brief a wrapper function to request CSR to return number of PMKID cache |
| 2899 | entries |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2900 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2901 | \return tANI_U32 - the number of PMKID cache entries |
| 2902 | ---------------------------------------------------------------------------*/ |
| 2903 | tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId) |
| 2904 | { |
| 2905 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2906 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2907 | tANI_U32 numPmkidCache = 0; |
| 2908 | |
| 2909 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2910 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2911 | { |
| 2912 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2913 | { |
| 2914 | numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId ); |
| 2915 | status = eHAL_STATUS_SUCCESS; |
| 2916 | } |
| 2917 | else |
| 2918 | { |
| 2919 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2920 | } |
| 2921 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2922 | } |
| 2923 | |
| 2924 | return (numPmkidCache); |
| 2925 | } |
| 2926 | |
| 2927 | /* --------------------------------------------------------------------------- |
| 2928 | \fn sme_RoamGetPMKIDCache |
| 2929 | \brief a wrapper function to request CSR to return PMKID cache from CSR |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2930 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2931 | \param pNum - caller allocated memory that has the space of the number of |
| 2932 | pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the |
| 2933 | needed or actually number in tPmkidCacheInfo. |
| 2934 | \param pPmkidCache - Caller allocated memory that contains PMKID cache, if |
| 2935 | any, upon return |
| 2936 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2937 | big enough |
| 2938 | ---------------------------------------------------------------------------*/ |
| 2939 | eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum, |
| 2940 | tPmkidCacheInfo *pPmkidCache) |
| 2941 | { |
| 2942 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2943 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2944 | |
| 2945 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2946 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2947 | { |
| 2948 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2949 | { |
| 2950 | status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache ); |
| 2951 | } |
| 2952 | else |
| 2953 | { |
| 2954 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2955 | } |
| 2956 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2957 | } |
| 2958 | |
| 2959 | return (status); |
| 2960 | } |
| 2961 | |
| 2962 | |
| 2963 | /* --------------------------------------------------------------------------- |
| 2964 | \fn sme_GetConfigParam |
| 2965 | \brief a wrapper function that HDD calls to get the global settings |
| 2966 | currently maintained by CSR. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2967 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2968 | \param pParam - caller allocated memory |
| 2969 | \return eHalStatus |
| 2970 | ---------------------------------------------------------------------------*/ |
| 2971 | eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam) |
| 2972 | { |
| 2973 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2974 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2975 | |
| 2976 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2977 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2978 | { |
| 2979 | status = csrGetConfigParam(pMac, &pParam->csrConfig); |
| 2980 | if (status != eHAL_STATUS_SUCCESS) |
| 2981 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 2982 | smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2983 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2984 | return status; |
| 2985 | } |
| 2986 | #if defined WLAN_FEATURE_P2P_INTERNAL |
| 2987 | status = p2pGetConfigParam(pMac, &pParam->p2pConfig); |
| 2988 | if (status != eHAL_STATUS_SUCCESS) |
| 2989 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 2990 | smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2991 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2992 | return status; |
| 2993 | } |
| 2994 | #endif |
| 2995 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2996 | } |
| 2997 | |
| 2998 | return (status); |
| 2999 | } |
| 3000 | |
| 3001 | /* --------------------------------------------------------------------------- |
| 3002 | \fn sme_CfgSetInt |
| 3003 | \brief a wrapper function that HDD calls to set parameters in CFG. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3004 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3005 | \param cfgId - Configuration Parameter ID (type) for STA. |
| 3006 | \param ccmValue - The information related to Configuration Parameter ID |
| 3007 | which needs to be saved in CFG |
| 3008 | \param callback - To be registered by CSR with CCM. Once the CFG done with |
| 3009 | saving the information in the database, it notifies CCM & |
| 3010 | then the callback will be invoked to notify. |
| 3011 | \param toBeSaved - To save the request for future reference |
| 3012 | \return eHalStatus |
| 3013 | ---------------------------------------------------------------------------*/ |
| 3014 | eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue, |
| 3015 | tCcmCfgSetCallback callback, eAniBoolean toBeSaved) |
| 3016 | { |
| 3017 | return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved)); |
| 3018 | } |
| 3019 | |
| 3020 | /* --------------------------------------------------------------------------- |
| 3021 | \fn sme_CfgSetStr |
| 3022 | \brief a wrapper function that HDD calls to set parameters in CFG. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3023 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3024 | \param cfgId - Configuration Parameter ID (type) for STA. |
| 3025 | \param pStr - Pointer to the byte array which carries the information needs |
| 3026 | to be saved in CFG |
| 3027 | \param length - Length of the data to be saved |
| 3028 | \param callback - To be registered by CSR with CCM. Once the CFG done with |
| 3029 | saving the information in the database, it notifies CCM & |
| 3030 | then the callback will be invoked to notify. |
| 3031 | \param toBeSaved - To save the request for future reference |
| 3032 | \return eHalStatus |
| 3033 | ---------------------------------------------------------------------------*/ |
| 3034 | eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr, |
| 3035 | tANI_U32 length, tCcmCfgSetCallback callback, |
| 3036 | eAniBoolean toBeSaved) |
| 3037 | { |
| 3038 | return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved)); |
| 3039 | } |
| 3040 | |
| 3041 | /* --------------------------------------------------------------------------- |
| 3042 | \fn sme_GetModifyProfileFields |
| 3043 | \brief HDD or SME - QOS calls this function to get the current values of |
| 3044 | connected profile fields, changing which can cause reassoc. |
| 3045 | This function must be called after CFG is downloaded and STA is in connected |
| 3046 | state. Also, make sure to call this function to get the current profile |
| 3047 | fields before calling the reassoc. So that pModifyProfileFields will have |
| 3048 | all the latest values plus the one(s) has been updated as part of reassoc |
| 3049 | request. |
| 3050 | \param pModifyProfileFields - pointer to the connected profile fields |
| 3051 | changing which can cause reassoc |
| 3052 | |
| 3053 | \return eHalStatus |
| 3054 | -------------------------------------------------------------------------------*/ |
| 3055 | eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId, |
| 3056 | tCsrRoamModifyProfileFields * pModifyProfileFields) |
| 3057 | { |
| 3058 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3059 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3060 | |
| 3061 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3062 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3063 | { |
| 3064 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 3065 | { |
| 3066 | status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields); |
| 3067 | } |
| 3068 | else |
| 3069 | { |
| 3070 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 3071 | } |
| 3072 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3073 | } |
| 3074 | |
| 3075 | return (status); |
| 3076 | } |
| 3077 | |
| 3078 | /*-------------------------------------------------------------------------- |
| 3079 | \fn sme_SetConfigPowerSave |
| 3080 | \brief Wrapper fn to change power save configuration in SME (PMC) module. |
| 3081 | For BMPS related configuration, this function also updates the CFG |
| 3082 | and sends a message to FW to pick up the new values. Note: Calling |
| 3083 | this function only updates the configuration and does not enable |
| 3084 | the specified power save mode. |
| 3085 | \param hHal - The handle returned by macOpen. |
| 3086 | \param psMode - Power Saving mode being modified |
| 3087 | \param pConfigParams - a pointer to a caller allocated object of type |
| 3088 | tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams |
| 3089 | \return eHalStatus |
| 3090 | --------------------------------------------------------------------------*/ |
| 3091 | eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode, |
| 3092 | void *pConfigParams) |
| 3093 | { |
| 3094 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3095 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3096 | |
| 3097 | if (NULL == pConfigParams ) { |
| 3098 | smsLog( pMac, LOGE, "Empty config param structure for PMC, " |
| 3099 | "nothing to update"); |
| 3100 | return eHAL_STATUS_FAILURE; |
| 3101 | } |
| 3102 | |
| 3103 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3104 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3105 | { |
| 3106 | status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams); |
| 3107 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3108 | } |
| 3109 | |
| 3110 | return (status); |
| 3111 | } |
| 3112 | |
| 3113 | /*-------------------------------------------------------------------------- |
| 3114 | \fn sme_GetConfigPowerSave |
| 3115 | \brief Wrapper fn to retrieve power save configuration in SME (PMC) module |
| 3116 | \param hHal - The handle returned by macOpen. |
| 3117 | \param psMode - Power Saving mode |
| 3118 | \param pConfigParams - a pointer to a caller allocated object of type |
| 3119 | tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams |
| 3120 | \return eHalStatus |
| 3121 | --------------------------------------------------------------------------*/ |
| 3122 | eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode, |
| 3123 | void *pConfigParams) |
| 3124 | { |
| 3125 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3126 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3127 | |
| 3128 | if (NULL == pConfigParams ) { |
| 3129 | smsLog( pMac, LOGE, "Empty config param structure for PMC, " |
| 3130 | "nothing to update"); |
| 3131 | return eHAL_STATUS_FAILURE; |
| 3132 | } |
| 3133 | |
| 3134 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3135 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3136 | { |
| 3137 | status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams); |
| 3138 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3139 | } |
| 3140 | |
| 3141 | return (status); |
| 3142 | } |
| 3143 | |
| 3144 | /* --------------------------------------------------------------------------- |
| 3145 | \fn sme_SignalPowerEvent |
| 3146 | \brief Signals to PMC that a power event has occurred. Used for putting |
| 3147 | the chip into deep sleep mode. |
| 3148 | \param hHal - The handle returned by macOpen. |
| 3149 | \param event - the event that has occurred |
| 3150 | \return eHalStatus |
| 3151 | ---------------------------------------------------------------------------*/ |
| 3152 | eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event) |
| 3153 | { |
| 3154 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3155 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3156 | |
| 3157 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3158 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3159 | { |
| 3160 | status = pmcSignalPowerEvent(hHal, event); |
| 3161 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3162 | } |
| 3163 | |
| 3164 | return (status); |
| 3165 | } |
| 3166 | |
| 3167 | /* --------------------------------------------------------------------------- |
| 3168 | \fn sme_EnablePowerSave |
| 3169 | \brief Enables one of the power saving modes. |
| 3170 | \param hHal - The handle returned by macOpen. |
| 3171 | \param psMode - The power saving mode to enable. If BMPS mode is enabled |
| 3172 | while the chip is operating in Full Power, PMC will start |
| 3173 | a timer that will try to put the chip in BMPS mode after |
| 3174 | expiry. |
| 3175 | \return eHalStatus |
| 3176 | ---------------------------------------------------------------------------*/ |
| 3177 | eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode) |
| 3178 | { |
| 3179 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3180 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3181 | |
| 3182 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3183 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3184 | { |
| 3185 | status = pmcEnablePowerSave(hHal, psMode); |
| 3186 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3187 | } |
| 3188 | |
| 3189 | return (status); |
| 3190 | } |
| 3191 | |
| 3192 | /* --------------------------------------------------------------------------- |
| 3193 | \fn sme_DisablePowerSave |
| 3194 | \brief Disables one of the power saving modes. |
| 3195 | \param hHal - The handle returned by macOpen. |
| 3196 | \param psMode - The power saving mode to disable. Disabling does not imply |
| 3197 | that device will be brought out of the current PS mode. This |
| 3198 | is purely a configuration API. |
| 3199 | \return eHalStatus |
| 3200 | ---------------------------------------------------------------------------*/ |
| 3201 | eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode) |
| 3202 | { |
| 3203 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3204 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3205 | |
| 3206 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3207 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3208 | { |
| 3209 | status = pmcDisablePowerSave(hHal, psMode); |
| 3210 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3211 | } |
| 3212 | |
| 3213 | return (status); |
| 3214 | } |
| 3215 | |
| 3216 | /* --------------------------------------------------------------------------- |
Madan Mohan Koyyalamudi | 69b3418 | 2013-01-16 08:51:40 +0530 | [diff] [blame] | 3217 | + \fn sme_SetHostPowerSave |
| 3218 | + \brief Enables BMPS logic to be controlled by User level apps |
| 3219 | + \param hHal - The handle returned by macOpen. |
| 3220 | + \param psMode - The power saving mode to disable. Disabling does not imply |
| 3221 | + that device will be brought out of the current PS mode. This |
| 3222 | + is purely a configuration API. |
| 3223 | + \return eHalStatus |
| 3224 | + ---------------------------------------------------------------------------*/ |
| 3225 | eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode) |
| 3226 | { |
| 3227 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3228 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3229 | |
| 3230 | pMac->pmc.isHostPsEn = psMode; |
| 3231 | |
| 3232 | return (status); |
| 3233 | } |
| 3234 | |
| 3235 | /* --------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3236 | \fn sme_StartAutoBmpsTimer |
| 3237 | \brief Starts a timer that periodically polls all the registered |
| 3238 | module for entry into Bmps mode. This timer is started only if BMPS is |
| 3239 | enabled and whenever the device is in full power. |
| 3240 | \param hHal - The handle returned by macOpen. |
| 3241 | \return eHalStatus |
| 3242 | ---------------------------------------------------------------------------*/ |
| 3243 | eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal) |
| 3244 | { |
| 3245 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3246 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3247 | |
| 3248 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3249 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3250 | { |
| 3251 | status = pmcStartAutoBmpsTimer(hHal); |
| 3252 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3253 | } |
| 3254 | |
| 3255 | return (status); |
| 3256 | } |
| 3257 | /* --------------------------------------------------------------------------- |
| 3258 | \fn sme_StopAutoBmpsTimer |
| 3259 | \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer |
| 3260 | Stopping the timer does not cause a device state change. Only the timer |
| 3261 | is stopped. If "Full Power" is desired, use the sme_RequestFullPower API |
| 3262 | \param hHal - The handle returned by macOpen. |
| 3263 | \return eHalStatus |
| 3264 | ---------------------------------------------------------------------------*/ |
| 3265 | eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal) |
| 3266 | { |
| 3267 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3268 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3269 | |
| 3270 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3271 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3272 | { |
| 3273 | status = pmcStopAutoBmpsTimer(hHal); |
| 3274 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3275 | } |
| 3276 | |
| 3277 | return (status); |
| 3278 | } |
| 3279 | /* --------------------------------------------------------------------------- |
| 3280 | \fn sme_QueryPowerState |
| 3281 | \brief Returns the current power state of the device. |
| 3282 | \param hHal - The handle returned by macOpen. |
| 3283 | \param pPowerState - pointer to location to return power state (LOW or HIGH) |
| 3284 | \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state |
| 3285 | \return eHalStatus |
| 3286 | ---------------------------------------------------------------------------*/ |
| 3287 | eHalStatus sme_QueryPowerState ( |
| 3288 | tHalHandle hHal, |
| 3289 | tPmcPowerState *pPowerState, |
| 3290 | tPmcSwitchState *pSwWlanSwitchState) |
| 3291 | { |
| 3292 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3293 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3294 | |
| 3295 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3296 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3297 | { |
| 3298 | status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState); |
| 3299 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3300 | } |
| 3301 | |
| 3302 | return (status); |
| 3303 | } |
| 3304 | |
| 3305 | /* --------------------------------------------------------------------------- |
| 3306 | \fn sme_IsPowerSaveEnabled |
| 3307 | \brief Checks if the device is able to enter a particular power save mode |
| 3308 | This does not imply that the device is in a particular PS mode |
| 3309 | \param hHal - The handle returned by macOpen. |
| 3310 | \param psMode - the power saving mode |
| 3311 | \return eHalStatus |
| 3312 | ---------------------------------------------------------------------------*/ |
| 3313 | tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode) |
| 3314 | { |
| 3315 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3316 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3317 | tANI_BOOLEAN result = false; |
| 3318 | |
| 3319 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3320 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3321 | { |
| 3322 | result = pmcIsPowerSaveEnabled(hHal, psMode); |
| 3323 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3324 | return result; |
| 3325 | } |
| 3326 | |
| 3327 | return false; |
| 3328 | } |
| 3329 | |
| 3330 | /* --------------------------------------------------------------------------- |
| 3331 | \fn sme_RequestFullPower |
| 3332 | \brief Request that the device be brought to full power state. When the |
| 3333 | device enters Full Power PMC will start a BMPS timer if BMPS PS mode |
| 3334 | is enabled. On timer expiry PMC will attempt to put the device in |
| 3335 | BMPS mode if following holds true: |
| 3336 | - BMPS mode is enabled |
| 3337 | - Polling of all modules through the Power Save Check routine passes |
| 3338 | - STA is associated to an access point |
| 3339 | \param hHal - The handle returned by macOpen. |
| 3340 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3341 | \return eHalStatus - status |
| 3342 | eHAL_STATUS_SUCCESS - device brought to full power state |
| 3343 | eHAL_STATUS_FAILURE - device cannot be brought to full power state |
| 3344 | eHAL_STATUS_PMC_PENDING - device is being brought to full power state, |
| 3345 | ---------------------------------------------------------------------------*/ |
| 3346 | eHalStatus sme_RequestFullPower ( |
| 3347 | tHalHandle hHal, |
| 3348 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3349 | void *callbackContext, |
| 3350 | tRequestFullPowerReason fullPowerReason) |
| 3351 | { |
| 3352 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3353 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3354 | |
| 3355 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3356 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3357 | { |
| 3358 | status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason); |
| 3359 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3360 | } |
| 3361 | |
| 3362 | return (status); |
| 3363 | } |
| 3364 | |
| 3365 | /* --------------------------------------------------------------------------- |
| 3366 | \fn sme_RequestBmps |
| 3367 | \brief Request that the device be put in BMPS state. Request will be |
| 3368 | accepted only if BMPS mode is enabled and power save check routine |
| 3369 | passes. |
| 3370 | \param hHal - The handle returned by macOpen. |
| 3371 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3372 | \return eHalStatus |
| 3373 | eHAL_STATUS_SUCCESS - device is in BMPS state |
| 3374 | eHAL_STATUS_FAILURE - device cannot be brought to BMPS state |
| 3375 | eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state |
| 3376 | ---------------------------------------------------------------------------*/ |
| 3377 | eHalStatus sme_RequestBmps ( |
| 3378 | tHalHandle hHal, |
| 3379 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3380 | void *callbackContext) |
| 3381 | { |
| 3382 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3383 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3384 | |
| 3385 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3386 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3387 | { |
| 3388 | status = pmcRequestBmps(hHal, callbackRoutine, callbackContext); |
| 3389 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3390 | } |
| 3391 | |
| 3392 | return (status); |
| 3393 | } |
| 3394 | |
| 3395 | |
| 3396 | /* --------------------------------------------------------------------------- |
| 3397 | \fn sme_SetDHCPTillPowerActiveFlag |
| 3398 | \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS |
| 3399 | entry by PMC |
| 3400 | \param hHal - The handle returned by macOpen. |
| 3401 | ---------------------------------------------------------------------------*/ |
| 3402 | void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag) |
| 3403 | { |
| 3404 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3405 | |
| 3406 | // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC |
| 3407 | pMac->pmc.remainInPowerActiveTillDHCP = flag; |
| 3408 | } |
| 3409 | |
| 3410 | |
| 3411 | /* --------------------------------------------------------------------------- |
| 3412 | \fn sme_StartUapsd |
| 3413 | \brief Request that the device be put in UAPSD state. If the device is in |
| 3414 | Full Power it will be put in BMPS mode first and then into UAPSD |
| 3415 | mode. |
| 3416 | \param hHal - The handle returned by macOpen. |
| 3417 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3418 | eHAL_STATUS_SUCCESS - device is in UAPSD state |
| 3419 | eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state |
| 3420 | eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state |
| 3421 | eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled |
| 3422 | \return eHalStatus |
| 3423 | ---------------------------------------------------------------------------*/ |
| 3424 | eHalStatus sme_StartUapsd ( |
| 3425 | tHalHandle hHal, |
| 3426 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3427 | void *callbackContext) |
| 3428 | { |
| 3429 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3430 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3431 | |
| 3432 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3433 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3434 | { |
| 3435 | status = pmcStartUapsd(hHal, callbackRoutine, callbackContext); |
| 3436 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3437 | } |
| 3438 | |
| 3439 | return (status); |
| 3440 | } |
| 3441 | |
| 3442 | /* --------------------------------------------------------------------------- |
| 3443 | \fn sme_StopUapsd |
| 3444 | \brief Request that the device be put out of UAPSD state. Device will be |
| 3445 | put in in BMPS state after stop UAPSD completes. |
| 3446 | \param hHal - The handle returned by macOpen. |
| 3447 | \return eHalStatus |
| 3448 | eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state |
| 3449 | eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state |
| 3450 | ---------------------------------------------------------------------------*/ |
| 3451 | eHalStatus sme_StopUapsd (tHalHandle hHal) |
| 3452 | { |
| 3453 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3454 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3455 | |
| 3456 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3457 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3458 | { |
| 3459 | status = pmcStopUapsd(hHal); |
| 3460 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3461 | } |
| 3462 | |
| 3463 | return (status); |
| 3464 | } |
| 3465 | |
| 3466 | /* --------------------------------------------------------------------------- |
| 3467 | \fn sme_RequestStandby |
| 3468 | \brief Request that the device be put in standby. It is HDD's responsibility |
| 3469 | to bring the chip to full power and do a disassoc before calling |
| 3470 | this API. |
| 3471 | \param hHal - The handle returned by macOpen. |
| 3472 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3473 | \return eHalStatus |
| 3474 | eHAL_STATUS_SUCCESS - device is in Standby mode |
| 3475 | eHAL_STATUS_FAILURE - device cannot be put in standby mode |
| 3476 | eHAL_STATUS_PMC_PENDING - device is being put in standby mode |
| 3477 | ---------------------------------------------------------------------------*/ |
| 3478 | eHalStatus sme_RequestStandby ( |
| 3479 | tHalHandle hHal, |
| 3480 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3481 | void *callbackContext) |
| 3482 | { |
| 3483 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3484 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3485 | |
| 3486 | smsLog( pMac, LOG1, FL("") ); |
| 3487 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3488 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3489 | { |
| 3490 | status = pmcRequestStandby(hHal, callbackRoutine, callbackContext); |
| 3491 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3492 | } |
| 3493 | |
| 3494 | return (status); |
| 3495 | } |
| 3496 | |
| 3497 | /* --------------------------------------------------------------------------- |
| 3498 | \fn sme_RegisterPowerSaveCheck |
| 3499 | \brief Register a power save check routine that is called whenever |
| 3500 | the device is about to enter one of the power save modes. |
| 3501 | \param hHal - The handle returned by macOpen. |
| 3502 | \param checkRoutine - Power save check routine to be registered |
| 3503 | \return eHalStatus |
| 3504 | eHAL_STATUS_SUCCESS - successfully registered |
| 3505 | eHAL_STATUS_FAILURE - not successfully registered |
| 3506 | ---------------------------------------------------------------------------*/ |
| 3507 | eHalStatus sme_RegisterPowerSaveCheck ( |
| 3508 | tHalHandle hHal, |
| 3509 | tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext) |
| 3510 | { |
| 3511 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3512 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3513 | |
| 3514 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3515 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3516 | { |
| 3517 | status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext); |
| 3518 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3519 | } |
| 3520 | |
| 3521 | return (status); |
| 3522 | } |
| 3523 | |
| 3524 | /* --------------------------------------------------------------------------- |
| 3525 | \fn sme_DeregisterPowerSaveCheck |
| 3526 | \brief Deregister a power save check routine |
| 3527 | \param hHal - The handle returned by macOpen. |
| 3528 | \param checkRoutine - Power save check routine to be deregistered |
| 3529 | \return eHalStatus |
| 3530 | eHAL_STATUS_SUCCESS - successfully deregistered |
| 3531 | eHAL_STATUS_FAILURE - not successfully deregistered |
| 3532 | ---------------------------------------------------------------------------*/ |
| 3533 | eHalStatus sme_DeregisterPowerSaveCheck ( |
| 3534 | tHalHandle hHal, |
| 3535 | tANI_BOOLEAN (*checkRoutine) (void *checkContext)) |
| 3536 | { |
| 3537 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3538 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3539 | |
| 3540 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3541 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3542 | { |
| 3543 | status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine); |
| 3544 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3545 | } |
| 3546 | |
| 3547 | return (status); |
| 3548 | } |
| 3549 | |
| 3550 | /* --------------------------------------------------------------------------- |
| 3551 | \fn sme_RegisterDeviceStateUpdateInd |
| 3552 | \brief Register a callback routine that is called whenever |
| 3553 | the device enters a new device state (Full Power, BMPS, UAPSD) |
| 3554 | \param hHal - The handle returned by macOpen. |
| 3555 | \param callbackRoutine - Callback routine to be registered |
| 3556 | \param callbackContext - Cookie to be passed back during callback |
| 3557 | \return eHalStatus |
| 3558 | eHAL_STATUS_SUCCESS - successfully registered |
| 3559 | eHAL_STATUS_FAILURE - not successfully registered |
| 3560 | ---------------------------------------------------------------------------*/ |
| 3561 | eHalStatus sme_RegisterDeviceStateUpdateInd ( |
| 3562 | tHalHandle hHal, |
| 3563 | void (*callbackRoutine) (void *callbackContext, tPmcState pmcState), |
| 3564 | void *callbackContext) |
| 3565 | { |
| 3566 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3567 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3568 | |
| 3569 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3570 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3571 | { |
| 3572 | status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext); |
| 3573 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3574 | } |
| 3575 | |
| 3576 | return (status); |
| 3577 | } |
| 3578 | |
| 3579 | /* --------------------------------------------------------------------------- |
| 3580 | \fn sme_DeregisterDeviceStateUpdateInd |
| 3581 | \brief Deregister a routine that was registered for device state changes |
| 3582 | \param hHal - The handle returned by macOpen. |
| 3583 | \param callbackRoutine - Callback routine to be deregistered |
| 3584 | \return eHalStatus |
| 3585 | eHAL_STATUS_SUCCESS - successfully deregistered |
| 3586 | eHAL_STATUS_FAILURE - not successfully deregistered |
| 3587 | ---------------------------------------------------------------------------*/ |
| 3588 | eHalStatus sme_DeregisterDeviceStateUpdateInd ( |
| 3589 | tHalHandle hHal, |
| 3590 | void (*callbackRoutine) (void *callbackContext, tPmcState pmcState)) |
| 3591 | { |
| 3592 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3593 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3594 | |
| 3595 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3596 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3597 | { |
| 3598 | status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine); |
| 3599 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3600 | } |
| 3601 | |
| 3602 | return (status); |
| 3603 | } |
| 3604 | |
| 3605 | /* --------------------------------------------------------------------------- |
| 3606 | \fn sme_WowlAddBcastPattern |
| 3607 | \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will |
| 3608 | do a pattern match on these patterns when Wowl is enabled during BMPS |
| 3609 | mode. Note that Firmware performs the pattern matching only on |
| 3610 | broadcast frames and while Libra is in BMPS mode. |
| 3611 | \param hHal - The handle returned by macOpen. |
| 3612 | \param pattern - Pattern to be added |
| 3613 | \return eHalStatus |
| 3614 | eHAL_STATUS_FAILURE Cannot add pattern |
| 3615 | eHAL_STATUS_SUCCESS Request accepted. |
| 3616 | ---------------------------------------------------------------------------*/ |
| 3617 | eHalStatus sme_WowlAddBcastPattern ( |
| 3618 | tHalHandle hHal, |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3619 | tpSirWowlAddBcastPtrn pattern, |
| 3620 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3621 | { |
| 3622 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3623 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3624 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3625 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3626 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3627 | status = pmcWowlAddBcastPattern (hHal, pattern, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3628 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3629 | } |
| 3630 | |
| 3631 | return (status); |
| 3632 | } |
| 3633 | |
| 3634 | /* --------------------------------------------------------------------------- |
| 3635 | \fn sme_WowlDelBcastPattern |
| 3636 | \brief Delete a pattern that was added for Pattern Byte Matching. |
| 3637 | \param hHal - The handle returned by macOpen. |
| 3638 | \param pattern - Pattern to be deleted |
| 3639 | \return eHalStatus |
| 3640 | eHAL_STATUS_FAILURE Cannot delete pattern |
| 3641 | eHAL_STATUS_SUCCESS Request accepted. |
| 3642 | ---------------------------------------------------------------------------*/ |
| 3643 | eHalStatus sme_WowlDelBcastPattern ( |
| 3644 | tHalHandle hHal, |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3645 | tpSirWowlDelBcastPtrn pattern, |
| 3646 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3647 | { |
| 3648 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3649 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3650 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3651 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3652 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3653 | status = pmcWowlDelBcastPattern (hHal, pattern, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3654 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3655 | } |
| 3656 | |
| 3657 | return (status); |
| 3658 | } |
| 3659 | |
| 3660 | /* --------------------------------------------------------------------------- |
| 3661 | \fn sme_EnterWowl |
| 3662 | \brief This is the SME API exposed to HDD to request enabling of WOWL mode. |
| 3663 | WoWLAN works on top of BMPS mode. If the device is not in BMPS mode, |
| 3664 | SME will will cache the information that WOWL has been enabled and |
| 3665 | attempt to put the device in BMPS. On entry into BMPS, SME will |
| 3666 | enable the WOWL mode. |
| 3667 | Note 1: If we exit BMPS mode (someone requests full power), we |
| 3668 | will NOT resume WOWL when we go back to BMPS again. Request for full |
| 3669 | power (while in WOWL mode) means disable WOWL and go to full power. |
| 3670 | Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME |
| 3671 | will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL |
| 3672 | are required. Currently there is no requirement or use case to support |
| 3673 | UAPSD and WOWL at the same time. |
| 3674 | |
| 3675 | \param hHal - The handle returned by macOpen. |
| 3676 | \param enterWowlCallbackRoutine - Callback routine provided by HDD. |
| 3677 | Used for success/failure notification by SME |
| 3678 | \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD |
| 3679 | at the time of callback. |
| 3680 | \param wakeReasonIndCB - Callback routine provided by HDD. |
| 3681 | Used for Wake Reason Indication by SME |
| 3682 | \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD |
| 3683 | at the time of callback. |
| 3684 | \return eHalStatus |
| 3685 | eHAL_STATUS_SUCCESS Device is already in WoWLAN mode |
| 3686 | eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode. |
| 3687 | eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after |
| 3688 | BMPS mode is entered. |
| 3689 | ---------------------------------------------------------------------------*/ |
| 3690 | eHalStatus sme_EnterWowl ( |
| 3691 | tHalHandle hHal, |
| 3692 | void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status), |
| 3693 | void *enterWowlCallbackContext, |
| 3694 | #ifdef WLAN_WAKEUP_EVENTS |
| 3695 | void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd), |
| 3696 | void *wakeIndicationCBContext, |
| 3697 | #endif // WLAN_WAKEUP_EVENTS |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3698 | tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3699 | { |
| 3700 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3701 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3702 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3703 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3704 | { |
| 3705 | status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext, |
| 3706 | #ifdef WLAN_WAKEUP_EVENTS |
| 3707 | wakeIndicationCB, wakeIndicationCBContext, |
| 3708 | #endif // WLAN_WAKEUP_EVENTS |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3709 | wowlEnterParams, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3710 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3711 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3712 | return (status); |
| 3713 | } |
| 3714 | /* --------------------------------------------------------------------------- |
| 3715 | \fn sme_ExitWowl |
| 3716 | \brief This is the SME API exposed to HDD to request exit from WoWLAN mode. |
| 3717 | SME will initiate exit from WoWLAN mode and device will be put in BMPS |
| 3718 | mode. |
| 3719 | \param hHal - The handle returned by macOpen. |
| 3720 | \return eHalStatus |
| 3721 | eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode. |
| 3722 | eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode. |
| 3723 | ---------------------------------------------------------------------------*/ |
| 3724 | eHalStatus sme_ExitWowl (tHalHandle hHal) |
| 3725 | { |
| 3726 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3727 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3728 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3729 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3730 | { |
| 3731 | status = pmcExitWowl (hHal); |
| 3732 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3733 | } |
| 3734 | |
| 3735 | return (status); |
| 3736 | } |
| 3737 | |
| 3738 | /* --------------------------------------------------------------------------- |
| 3739 | |
| 3740 | \fn sme_RoamSetKey |
| 3741 | |
| 3742 | \brief To set encryption key. This function should be called only when connected |
| 3743 | This is an asynchronous API. |
| 3744 | |
| 3745 | \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo |
| 3746 | |
| 3747 | \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback |
| 3748 | |
| 3749 | \return eHalStatus SUCCESS Roam callback will be called indicate actually results |
| 3750 | |
| 3751 | FAILURE or RESOURCES The API finished and failed. |
| 3752 | |
| 3753 | -------------------------------------------------------------------------------*/ |
| 3754 | eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId) |
| 3755 | { |
| 3756 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3757 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3758 | tANI_U32 roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3759 | tANI_U32 i; |
| 3760 | tCsrRoamSession *pSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3761 | |
Jeff Johnson | f89f4b5 | 2013-03-27 10:32:44 -0700 | [diff] [blame] | 3762 | if (pSetKey->keyLength > CSR_MAX_KEY_LEN) |
| 3763 | { |
| 3764 | smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength); |
| 3765 | return eHAL_STATUS_FAILURE; |
| 3766 | } |
| 3767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3768 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3769 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3770 | { |
| 3771 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 3772 | if(pRoamId) |
| 3773 | { |
| 3774 | *pRoamId = roamId; |
| 3775 | } |
| 3776 | |
Jeff Johnson | f89f4b5 | 2013-03-27 10:32:44 -0700 | [diff] [blame] | 3777 | smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3778 | |
| 3779 | for(i=0; i<pSetKey->keyLength; i++) |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 3780 | smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3781 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 3782 | smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3783 | |
| 3784 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 3785 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3786 | if(!pSession) |
| 3787 | { |
| 3788 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 3789 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3790 | return eHAL_STATUS_FAILURE; |
| 3791 | } |
| 3792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3793 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 3794 | { |
| 3795 | if(pSetKey->keyDirection == eSIR_TX_DEFAULT) |
| 3796 | { |
| 3797 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 3798 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType )) |
| 3799 | { |
| 3800 | pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3801 | } |
| 3802 | if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 3803 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType )) |
| 3804 | { |
| 3805 | pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3806 | } |
| 3807 | } |
| 3808 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3809 | |
| 3810 | status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId ); |
| 3811 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3812 | } |
| 3813 | |
| 3814 | return (status); |
| 3815 | } |
| 3816 | |
| 3817 | |
| 3818 | /* --------------------------------------------------------------------------- |
| 3819 | |
| 3820 | \fn sme_RoamRemoveKey |
| 3821 | |
| 3822 | \brief To set encryption key. This is an asynchronous API. |
| 3823 | |
| 3824 | \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey |
| 3825 | |
| 3826 | \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback |
| 3827 | |
| 3828 | \return eHalStatus SUCCESS Roam callback will be called indicate actually results |
| 3829 | |
| 3830 | FAILURE or RESOURCES The API finished and failed. |
| 3831 | |
| 3832 | -------------------------------------------------------------------------------*/ |
| 3833 | eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId, |
| 3834 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId) |
| 3835 | { |
| 3836 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3837 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3838 | tANI_U32 roamId; |
| 3839 | |
| 3840 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3841 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3842 | { |
| 3843 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 3844 | if(pRoamId) |
| 3845 | { |
| 3846 | *pRoamId = roamId; |
| 3847 | } |
| 3848 | status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId ); |
| 3849 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3850 | } |
| 3851 | |
| 3852 | return (status); |
| 3853 | } |
| 3854 | |
| 3855 | /* --------------------------------------------------------------------------- |
| 3856 | \fn sme_GetRssi |
| 3857 | \brief a wrapper function that client calls to register a callback to get RSSI |
| 3858 | |
| 3859 | \param callback - SME sends back the requested stats using the callback |
| 3860 | \param staId - The station ID for which the stats is requested for |
| 3861 | \param pContext - user context to be passed back along with the callback |
| 3862 | \param pVosContext - vos context |
| 3863 | \return eHalStatus |
| 3864 | ---------------------------------------------------------------------------*/ |
| 3865 | eHalStatus sme_GetRssi(tHalHandle hHal, |
| 3866 | tCsrRssiCallback callback, |
| 3867 | tANI_U8 staId, tCsrBssid bssId, |
| 3868 | void *pContext, void* pVosContext) |
| 3869 | { |
| 3870 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3871 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3872 | |
| 3873 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3874 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3875 | { |
| 3876 | status = csrGetRssi( pMac, callback, |
| 3877 | staId, bssId, pContext, pVosContext); |
| 3878 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3879 | } |
| 3880 | return (status); |
| 3881 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 3882 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 3883 | /* --------------------------------------------------------------------------- |
| 3884 | \fn sme_GetRoamRssi |
| 3885 | \brief a wrapper function that client calls to register a callback to get Roam RSSI |
| 3886 | |
| 3887 | \param callback - SME sends back the requested stats using the callback |
| 3888 | \param staId - The station ID for which the stats is requested for |
| 3889 | \param pContext - user context to be passed back along with the callback |
| 3890 | \param pVosContext - vos context |
| 3891 | \return eHalStatus |
| 3892 | ---------------------------------------------------------------------------*/ |
| 3893 | eHalStatus sme_GetRoamRssi(tHalHandle hHal, |
| 3894 | tCsrRssiCallback callback, |
| 3895 | tANI_U8 staId, tCsrBssid bssId, |
| 3896 | void *pContext, void* pVosContext) |
| 3897 | { |
| 3898 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3899 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3900 | |
| 3901 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3902 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3903 | { |
| 3904 | status = csrGetRoamRssi( pMac, callback, |
| 3905 | staId, bssId, pContext, pVosContext); |
| 3906 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3907 | } |
| 3908 | return (status); |
| 3909 | } |
| 3910 | #endif |
| 3911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3912 | |
| 3913 | /* --------------------------------------------------------------------------- |
| 3914 | \fn sme_GetStatistics |
| 3915 | \brief a wrapper function that client calls to register a callback to get |
| 3916 | different PHY level statistics from CSR. |
| 3917 | |
| 3918 | \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc |
| 3919 | \param statsMask - The different category/categories of stats requester is looking for |
| 3920 | \param callback - SME sends back the requested stats using the callback |
| 3921 | \param periodicity - If requester needs periodic update in millisec, 0 means |
| 3922 | it's an one time request |
| 3923 | \param cache - If requester is happy with cached stats |
| 3924 | \param staId - The station ID for which the stats is requested for |
| 3925 | \param pContext - user context to be passed back along with the callback |
| 3926 | \return eHalStatus |
| 3927 | ---------------------------------------------------------------------------*/ |
| 3928 | eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId, |
| 3929 | tANI_U32 statsMask, |
| 3930 | tCsrStatsCallback callback, |
| 3931 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 3932 | tANI_U8 staId, void *pContext) |
| 3933 | { |
| 3934 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3935 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3936 | |
| 3937 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3938 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3939 | { |
| 3940 | status = csrGetStatistics( pMac, requesterId , statsMask, callback, |
| 3941 | periodicity, cache, staId, pContext); |
| 3942 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3943 | } |
| 3944 | |
| 3945 | return (status); |
| 3946 | |
| 3947 | } |
| 3948 | |
| 3949 | /* --------------------------------------------------------------------------- |
| 3950 | |
| 3951 | \fn sme_GetCountryCode |
| 3952 | |
| 3953 | \brief To return the current country code. If no country code is applied, default country code is |
| 3954 | used to fill the buffer. |
| 3955 | If 11d supported is turned off, an error is return and the last applied/default country code is used. |
| 3956 | This is a synchronous API. |
| 3957 | |
| 3958 | \param pBuf - pointer to a caller allocated buffer for returned country code. |
| 3959 | |
| 3960 | \param pbLen For input, this parameter indicates how big is the buffer. |
| 3961 | Upon return, this parameter has the number of bytes for country. If pBuf |
| 3962 | doesn't have enough space, this function returns |
| 3963 | fail status and this parameter contains the number that is needed. |
| 3964 | |
| 3965 | \return eHalStatus SUCCESS. |
| 3966 | |
| 3967 | FAILURE or RESOURCES The API finished and failed. |
| 3968 | |
| 3969 | -------------------------------------------------------------------------------*/ |
| 3970 | eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen) |
| 3971 | { |
| 3972 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3973 | |
| 3974 | return ( csrGetCountryCode( pMac, pBuf, pbLen ) ); |
| 3975 | } |
| 3976 | |
| 3977 | |
| 3978 | /* --------------------------------------------------------------------------- |
| 3979 | |
| 3980 | \fn sme_SetCountryCode |
| 3981 | |
| 3982 | \brief To change the current/default country code. |
| 3983 | If 11d supported is turned off, an error is return. |
| 3984 | This is a synchronous API. |
| 3985 | |
| 3986 | \param pCountry - pointer to a caller allocated buffer for the country code. |
| 3987 | |
| 3988 | \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates |
| 3989 | whether a reset is required. |
| 3990 | |
| 3991 | \return eHalStatus SUCCESS. |
| 3992 | |
| 3993 | FAILURE or RESOURCES The API finished and failed. |
| 3994 | |
| 3995 | -------------------------------------------------------------------------------*/ |
| 3996 | eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded) |
| 3997 | { |
| 3998 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3999 | |
| 4000 | return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) ); |
| 4001 | } |
| 4002 | |
| 4003 | |
| 4004 | /* --------------------------------------------------------------------------- |
| 4005 | \fn sme_ResetCountryCodeInformation |
| 4006 | \brief this function is to reset the country code current being used back to EEPROM default |
| 4007 | this includes channel list and power setting. This is a synchronous API. |
| 4008 | \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether |
| 4009 | a restart is needed to apply the change |
| 4010 | \return eHalStatus |
| 4011 | -------------------------------------------------------------------------------*/ |
| 4012 | eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded) |
| 4013 | { |
| 4014 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4015 | |
| 4016 | return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) ); |
| 4017 | } |
| 4018 | |
| 4019 | |
| 4020 | /* --------------------------------------------------------------------------- |
| 4021 | \fn sme_GetSupportedCountryCode |
| 4022 | \brief this function is to get a list of the country code current being supported |
| 4023 | \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, |
| 4024 | this has the country code list. 3 bytes for each country code. This may be NULL if |
| 4025 | caller wants to know the needed byte count. |
| 4026 | \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return, |
| 4027 | this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0. |
| 4028 | \return eHalStatus |
| 4029 | -------------------------------------------------------------------------------*/ |
| 4030 | eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen) |
| 4031 | { |
| 4032 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4033 | |
| 4034 | return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) ); |
| 4035 | } |
| 4036 | |
| 4037 | |
| 4038 | /* --------------------------------------------------------------------------- |
| 4039 | \fn sme_GetCurrentRegulatoryDomain |
| 4040 | \brief this function is to get the current regulatory domain. This is a synchronous API. |
| 4041 | This function must be called after CFG is downloaded and all the band/mode setting already passed into |
| 4042 | SME. The function fails if 11d support is turned off. |
| 4043 | \param pDomain - Caller allocated buffer to return the current domain. |
| 4044 | \return eHalStatus SUCCESS. |
| 4045 | |
| 4046 | FAILURE or RESOURCES The API finished and failed. |
| 4047 | -------------------------------------------------------------------------------*/ |
| 4048 | eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain) |
| 4049 | { |
| 4050 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4051 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 4052 | |
| 4053 | if( pDomain ) |
| 4054 | { |
| 4055 | if( csrIs11dSupported( pMac ) ) |
| 4056 | { |
| 4057 | *pDomain = csrGetCurrentRegulatoryDomain( pMac ); |
| 4058 | status = eHAL_STATUS_SUCCESS; |
| 4059 | } |
| 4060 | else |
| 4061 | { |
| 4062 | status = eHAL_STATUS_FAILURE; |
| 4063 | } |
| 4064 | } |
| 4065 | |
| 4066 | return ( status ); |
| 4067 | } |
| 4068 | |
| 4069 | |
| 4070 | /* --------------------------------------------------------------------------- |
| 4071 | \fn sme_SetRegulatoryDomain |
| 4072 | \brief this function is to set the current regulatory domain. |
| 4073 | This function must be called after CFG is downloaded and all the band/mode setting already passed into |
| 4074 | SME. This is a synchronous API. |
| 4075 | \param domainId - indicate the domain (defined in the driver) needs to set to. |
| 4076 | See v_REGDOMAIN_t for definition |
| 4077 | \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether |
| 4078 | a restart is needed to apply the change |
| 4079 | \return eHalStatus |
| 4080 | -------------------------------------------------------------------------------*/ |
| 4081 | eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded) |
| 4082 | { |
| 4083 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4084 | |
| 4085 | return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) ); |
| 4086 | } |
| 4087 | |
| 4088 | |
| 4089 | /* --------------------------------------------------------------------------- |
| 4090 | |
| 4091 | \fn sme_GetRegulatoryDomainForCountry |
| 4092 | |
| 4093 | \brief To return a regulatory domain base on a country code. This is a synchronous API. |
| 4094 | |
| 4095 | \param pCountry - pointer to a caller allocated buffer for input country code. |
| 4096 | |
| 4097 | \param pDomainId Upon successful return, it is the domain that country belongs to. |
| 4098 | If it is NULL, returning success means that the country code is known. |
| 4099 | |
| 4100 | \return eHalStatus SUCCESS. |
| 4101 | |
| 4102 | FAILURE or RESOURCES The API finished and failed. |
| 4103 | |
| 4104 | -------------------------------------------------------------------------------*/ |
| 4105 | eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId) |
| 4106 | { |
| 4107 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4108 | |
| 4109 | return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) ); |
| 4110 | } |
| 4111 | |
| 4112 | |
| 4113 | |
| 4114 | |
| 4115 | /* --------------------------------------------------------------------------- |
| 4116 | |
| 4117 | \fn sme_GetSupportedRegulatoryDomains |
| 4118 | |
| 4119 | \brief To return a list of supported regulatory domains. This is a synchronous API. |
| 4120 | |
| 4121 | \param pDomains - pointer to a caller allocated buffer for returned regulatory domains. |
| 4122 | |
| 4123 | \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold. |
| 4124 | Upon return, this parameter has the number for supported domains. If pDomains |
| 4125 | doesn't have enough space for all the supported domains, this function returns |
| 4126 | fail status and this parameter contains the number that is needed. |
| 4127 | |
| 4128 | \return eHalStatus SUCCESS. |
| 4129 | |
| 4130 | FAILURE or RESOURCES The API finished and failed. |
| 4131 | |
| 4132 | -------------------------------------------------------------------------------*/ |
| 4133 | eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains) |
| 4134 | { |
| 4135 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 4136 | |
| 4137 | //We support all domains for now |
| 4138 | if( pNumDomains ) |
| 4139 | { |
| 4140 | if( NUM_REG_DOMAINS <= *pNumDomains ) |
| 4141 | { |
| 4142 | status = eHAL_STATUS_SUCCESS; |
| 4143 | } |
| 4144 | *pNumDomains = NUM_REG_DOMAINS; |
| 4145 | } |
| 4146 | if( HAL_STATUS_SUCCESS( status ) ) |
| 4147 | { |
| 4148 | if( pDomains ) |
| 4149 | { |
| 4150 | pDomains[0] = REGDOMAIN_FCC; |
| 4151 | pDomains[1] = REGDOMAIN_ETSI; |
| 4152 | pDomains[2] = REGDOMAIN_JAPAN; |
| 4153 | pDomains[3] = REGDOMAIN_WORLD; |
| 4154 | pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC; |
| 4155 | pDomains[5] = REGDOMAIN_APAC; |
| 4156 | pDomains[6] = REGDOMAIN_KOREA; |
| 4157 | pDomains[7] = REGDOMAIN_HI_5GHZ; |
| 4158 | pDomains[8] = REGDOMAIN_NO_5GHZ; |
| 4159 | } |
| 4160 | else |
| 4161 | { |
| 4162 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 4163 | } |
| 4164 | } |
| 4165 | |
| 4166 | return ( status ); |
| 4167 | } |
| 4168 | |
| 4169 | |
| 4170 | //some support functions |
| 4171 | tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal) |
| 4172 | { |
| 4173 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4174 | |
| 4175 | return ( csrIs11dSupported( pMac ) ); |
| 4176 | } |
| 4177 | |
| 4178 | |
| 4179 | tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal) |
| 4180 | { |
| 4181 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4182 | |
| 4183 | return ( csrIs11hSupported( pMac ) ); |
| 4184 | } |
| 4185 | |
| 4186 | |
| 4187 | tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal) |
| 4188 | { |
| 4189 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4190 | |
| 4191 | return ( csrIsWmmSupported( pMac ) ); |
| 4192 | } |
| 4193 | |
| 4194 | //Upper layer to get the list of the base channels to scan for passively 11d info from csr |
| 4195 | eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo ) |
| 4196 | { |
| 4197 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4198 | |
| 4199 | return(csrScanGetBaseChannels(pMac,pChannelInfo) ); |
| 4200 | } |
| 4201 | |
| 4202 | /* --------------------------------------------------------------------------- |
| 4203 | |
| 4204 | \fn sme_ChangeCountryCode |
| 4205 | |
| 4206 | \brief Change Country code from upperlayer during WLAN driver operation. |
| 4207 | This is a synchronous API. |
| 4208 | |
| 4209 | \param hHal - The handle returned by macOpen. |
| 4210 | |
| 4211 | \param pCountry New Country Code String |
| 4212 | |
| 4213 | \return eHalStatus SUCCESS. |
| 4214 | |
| 4215 | FAILURE or RESOURCES The API finished and failed. |
| 4216 | |
| 4217 | -------------------------------------------------------------------------------*/ |
| 4218 | eHalStatus sme_ChangeCountryCode( tHalHandle hHal, |
| 4219 | tSmeChangeCountryCallback callback, |
| 4220 | tANI_U8 *pCountry, |
| 4221 | void *pContext, |
| 4222 | void* pVosContext ) |
| 4223 | { |
| 4224 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4225 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4226 | vos_msg_t msg; |
| 4227 | tAniChangeCountryCodeReq *pMsg; |
| 4228 | |
| 4229 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4230 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4231 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4232 | smsLog(pMac, LOG1, FL(" called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4233 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq)); |
| 4234 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 4235 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4236 | smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req"); |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 4237 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4238 | return status; |
| 4239 | } |
| 4240 | |
| 4241 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE); |
| 4242 | pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq); |
| 4243 | palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3); |
| 4244 | pMsg->changeCCCallback = callback; |
| 4245 | pMsg->pDevContext = pContext; |
| 4246 | pMsg->pVosContext = pVosContext; |
| 4247 | |
| 4248 | msg.type = eWNI_SME_CHANGE_COUNTRY_CODE; |
| 4249 | msg.bodyptr = pMsg; |
| 4250 | msg.reserved = 0; |
| 4251 | |
| 4252 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 4253 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4254 | smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4255 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 4256 | status = eHAL_STATUS_FAILURE; |
| 4257 | } |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4258 | smsLog(pMac, LOG1, FL(" returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4259 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4260 | } |
| 4261 | |
| 4262 | return (status); |
| 4263 | } |
| 4264 | |
| 4265 | /* --------------------------------------------------------------------------- |
| 4266 | \fn sme_BtcSignalBtEvent |
| 4267 | \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the |
| 4268 | BT event type and the current operating mode of Libra (full power, |
| 4269 | BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy |
| 4270 | would be employed. |
| 4271 | \param hHal - The handle returned by macOpen. |
| 4272 | \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent |
| 4273 | Caller owns the memory and is responsible for freeing it. |
| 4274 | \return VOS_STATUS |
| 4275 | VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen |
| 4276 | if BTC execution mode is set to BTC_WLAN_ONLY |
| 4277 | or BTC_PTA_ONLY. |
| 4278 | VOS_STATUS_SUCCESS BT Event passed to HAL |
| 4279 | ---------------------------------------------------------------------------*/ |
| 4280 | VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent) |
| 4281 | { |
| 4282 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4283 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4284 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4285 | |
| 4286 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4287 | { |
| 4288 | status = btcSignalBTEvent (hHal, pBtEvent); |
| 4289 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4290 | } |
| 4291 | #endif |
| 4292 | return (status); |
| 4293 | } |
| 4294 | |
| 4295 | /* --------------------------------------------------------------------------- |
| 4296 | \fn sme_BtcSetConfig |
| 4297 | \brief API to change the current Bluetooth Coexistence (BTC) configuration |
| 4298 | This function should be invoked only after CFG download has completed. |
| 4299 | Calling it after sme_HDDReadyInd is recommended. |
| 4300 | \param hHal - The handle returned by macOpen. |
| 4301 | \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig. |
| 4302 | Caller owns the memory and is responsible for freeing it. |
| 4303 | \return VOS_STATUS |
| 4304 | VOS_STATUS_E_FAILURE Config not passed to HAL. |
| 4305 | VOS_STATUS_SUCCESS Config passed to HAL |
| 4306 | ---------------------------------------------------------------------------*/ |
| 4307 | VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) |
| 4308 | { |
| 4309 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4310 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4311 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4312 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4313 | { |
| 4314 | status = btcSetConfig (hHal, pSmeBtcConfig); |
| 4315 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4316 | } |
| 4317 | #endif |
| 4318 | return (status); |
| 4319 | } |
| 4320 | |
| 4321 | /* --------------------------------------------------------------------------- |
| 4322 | \fn sme_BtcGetConfig |
| 4323 | \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration |
| 4324 | \param hHal - The handle returned by macOpen. |
| 4325 | \param pSmeBtcConfig - Pointer to a caller allocated object of type |
| 4326 | tSmeBtcConfig. Caller owns the memory and is responsible |
| 4327 | for freeing it. |
| 4328 | \return VOS_STATUS |
| 4329 | VOS_STATUS_E_FAILURE - failure |
| 4330 | VOS_STATUS_SUCCESS success |
| 4331 | ---------------------------------------------------------------------------*/ |
| 4332 | VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) |
| 4333 | { |
| 4334 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4335 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4336 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4337 | |
| 4338 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4339 | { |
| 4340 | status = btcGetConfig (hHal, pSmeBtcConfig); |
| 4341 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4342 | } |
| 4343 | #endif |
| 4344 | return (status); |
| 4345 | } |
| 4346 | /* --------------------------------------------------------------------------- |
| 4347 | \fn sme_SetCfgPrivacy |
| 4348 | \brief API to set configure privacy parameters |
| 4349 | \param hHal - The handle returned by macOpen. |
| 4350 | \param pProfile - Pointer CSR Roam profile. |
| 4351 | \param fPrivacy - This parameter indicates status of privacy |
| 4352 | |
| 4353 | \return void |
| 4354 | ---------------------------------------------------------------------------*/ |
| 4355 | void sme_SetCfgPrivacy( tHalHandle hHal, |
| 4356 | tCsrRoamProfile *pProfile, |
| 4357 | tANI_BOOLEAN fPrivacy |
| 4358 | ) |
| 4359 | { |
| 4360 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4361 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4362 | { |
| 4363 | csrSetCfgPrivacy(pMac, pProfile, fPrivacy); |
| 4364 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4365 | } |
| 4366 | } |
| 4367 | |
| 4368 | #if defined WLAN_FEATURE_VOWIFI |
| 4369 | /* --------------------------------------------------------------------------- |
| 4370 | \fn sme_NeighborReportRequest |
| 4371 | \brief API to request neighbor report. |
| 4372 | \param hHal - The handle returned by macOpen. |
| 4373 | \param pRrmNeighborReq - Pointer to a caller allocated object of type |
| 4374 | tRrmNeighborReq. Caller owns the memory and is responsible |
| 4375 | for freeing it. |
| 4376 | \return VOS_STATUS |
| 4377 | VOS_STATUS_E_FAILURE - failure |
| 4378 | VOS_STATUS_SUCCESS success |
| 4379 | ---------------------------------------------------------------------------*/ |
| 4380 | VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId, |
| 4381 | tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo) |
| 4382 | { |
| 4383 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4384 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4385 | |
| 4386 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4387 | { |
| 4388 | status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo); |
| 4389 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4390 | } |
| 4391 | |
| 4392 | return (status); |
| 4393 | } |
| 4394 | #endif |
| 4395 | |
| 4396 | //The following are debug APIs to support direct read/write register/memory |
| 4397 | //They are placed in SME because HW cannot be access when in LOW_POWER state |
| 4398 | //AND not connected. The knowledge and synchronization is done in SME |
| 4399 | |
| 4400 | //sme_DbgReadRegister |
| 4401 | //Caller needs to validate the input values |
| 4402 | VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue) |
| 4403 | { |
| 4404 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4405 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4406 | tPmcPowerState PowerState; |
| 4407 | tANI_U32 sessionId = 0; |
| 4408 | |
| 4409 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4410 | |
| 4411 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4412 | { |
Hoonki Lee | 0af6aaf | 2013-02-08 12:26:44 -0800 | [diff] [blame] | 4413 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4414 | { |
| 4415 | return VOS_STATUS_SUCCESS; |
| 4416 | } |
| 4417 | return VOS_STATUS_E_FAILURE; |
| 4418 | } |
| 4419 | |
| 4420 | /* 2) NON FTM mode driver *************************************************/ |
| 4421 | |
| 4422 | /* Acquire SME global lock */ |
| 4423 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4424 | { |
| 4425 | return VOS_STATUS_E_FAILURE; |
| 4426 | } |
| 4427 | |
| 4428 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4429 | { |
| 4430 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4431 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4432 | { |
Hoonki Lee | 0af6aaf | 2013-02-08 12:26:44 -0800 | [diff] [blame] | 4433 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4434 | { |
| 4435 | status = VOS_STATUS_SUCCESS; |
| 4436 | } |
| 4437 | else |
| 4438 | { |
| 4439 | status = VOS_STATUS_E_FAILURE; |
| 4440 | } |
| 4441 | } |
| 4442 | else |
| 4443 | { |
| 4444 | status = VOS_STATUS_E_FAILURE; |
| 4445 | } |
| 4446 | } |
| 4447 | |
| 4448 | /* This is a hack for Qualky/pttWniSocket |
| 4449 | Current implementation doesn't allow pttWniSocket to inform Qualky an error */ |
| 4450 | if ( VOS_STATUS_SUCCESS != status ) |
| 4451 | { |
| 4452 | *pRegValue = 0xDEADBEEF; |
| 4453 | status = VOS_STATUS_SUCCESS; |
| 4454 | } |
| 4455 | |
| 4456 | /* Release SME global lock */ |
| 4457 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4458 | |
| 4459 | return (status); |
| 4460 | } |
| 4461 | |
| 4462 | |
| 4463 | //sme_DbgWriteRegister |
| 4464 | //Caller needs to validate the input values |
| 4465 | VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue) |
| 4466 | { |
| 4467 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4468 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4469 | tPmcPowerState PowerState; |
| 4470 | tANI_U32 sessionId = 0; |
| 4471 | |
| 4472 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4473 | |
| 4474 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4475 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4477 | { |
| 4478 | return VOS_STATUS_SUCCESS; |
| 4479 | } |
| 4480 | return VOS_STATUS_E_FAILURE; |
| 4481 | } |
| 4482 | |
| 4483 | /* 2) NON FTM mode driver *************************************************/ |
| 4484 | |
| 4485 | /* Acquire SME global lock */ |
| 4486 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4487 | { |
| 4488 | return VOS_STATUS_E_FAILURE; |
| 4489 | } |
| 4490 | |
| 4491 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4492 | { |
| 4493 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4494 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4495 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4496 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4497 | { |
| 4498 | status = VOS_STATUS_SUCCESS; |
| 4499 | } |
| 4500 | else |
| 4501 | { |
| 4502 | status = VOS_STATUS_E_FAILURE; |
| 4503 | } |
| 4504 | } |
| 4505 | else |
| 4506 | { |
| 4507 | status = VOS_STATUS_E_FAILURE; |
| 4508 | } |
| 4509 | } |
| 4510 | |
| 4511 | /* Release SME global lock */ |
| 4512 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4513 | |
| 4514 | return (status); |
| 4515 | } |
| 4516 | |
| 4517 | |
| 4518 | |
| 4519 | //sme_DbgReadMemory |
| 4520 | //Caller needs to validate the input values |
| 4521 | //pBuf caller allocated buffer has the length of nLen |
| 4522 | VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen) |
| 4523 | { |
| 4524 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4525 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4526 | tPmcPowerState PowerState; |
| 4527 | tANI_U32 sessionId = 0; |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 4528 | tANI_U32 cmd = READ_MEMORY_DUMP_CMD; |
| 4529 | tANI_U32 arg1 = memAddr; |
| 4530 | tANI_U32 arg2 = nLen/4; |
| 4531 | tANI_U32 arg3 = 4; |
| 4532 | tANI_U32 arg4 = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4533 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4534 | |
| 4535 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4536 | { |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 4537 | if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | { |
| 4539 | return VOS_STATUS_SUCCESS; |
| 4540 | } |
| 4541 | return VOS_STATUS_E_FAILURE; |
| 4542 | } |
| 4543 | |
| 4544 | /* 2) NON FTM mode driver *************************************************/ |
| 4545 | |
| 4546 | /* Acquire SME global lock */ |
| 4547 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4548 | { |
| 4549 | return VOS_STATUS_E_FAILURE; |
| 4550 | } |
| 4551 | |
| 4552 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4553 | { |
| 4554 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4555 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4556 | { |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 4557 | if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4558 | { |
| 4559 | status = VOS_STATUS_SUCCESS; |
| 4560 | } |
| 4561 | else |
| 4562 | { |
| 4563 | status = VOS_STATUS_E_FAILURE; |
| 4564 | } |
| 4565 | } |
| 4566 | else |
| 4567 | { |
| 4568 | status = VOS_STATUS_E_FAILURE; |
| 4569 | } |
| 4570 | } |
| 4571 | |
| 4572 | /* This is a hack for Qualky/pttWniSocket |
| 4573 | Current implementation doesn't allow pttWniSocket to inform Qualky an error */ |
| 4574 | if (VOS_STATUS_SUCCESS != status) |
| 4575 | { |
| 4576 | vos_mem_set(pBuf, nLen, 0xCD); |
| 4577 | status = VOS_STATUS_SUCCESS; |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4578 | smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4579 | } |
| 4580 | |
| 4581 | /* Release SME lock */ |
| 4582 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4583 | |
| 4584 | return (status); |
| 4585 | } |
| 4586 | |
| 4587 | |
| 4588 | //sme_DbgWriteMemory |
| 4589 | //Caller needs to validate the input values |
| 4590 | VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen) |
| 4591 | { |
| 4592 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4593 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4594 | tPmcPowerState PowerState; |
| 4595 | tANI_U32 sessionId = 0; |
| 4596 | |
| 4597 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4598 | |
| 4599 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4600 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4601 | { |
| 4602 | return VOS_STATUS_SUCCESS; |
| 4603 | } |
| 4604 | return VOS_STATUS_E_FAILURE; |
| 4605 | } |
| 4606 | |
| 4607 | /* 2) NON FTM mode driver *************************************************/ |
| 4608 | |
| 4609 | /* Acquire SME global lock */ |
| 4610 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4611 | { |
| 4612 | return VOS_STATUS_E_FAILURE; |
| 4613 | } |
| 4614 | |
| 4615 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4616 | { |
| 4617 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4618 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4619 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4620 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4621 | { |
| 4622 | status = VOS_STATUS_SUCCESS; |
| 4623 | } |
| 4624 | else |
| 4625 | { |
| 4626 | status = VOS_STATUS_E_FAILURE; |
| 4627 | } |
| 4628 | } |
| 4629 | else |
| 4630 | { |
| 4631 | status = VOS_STATUS_E_FAILURE; |
| 4632 | } |
| 4633 | } |
| 4634 | |
| 4635 | /* Release Global lock */ |
| 4636 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4637 | |
| 4638 | return (status); |
| 4639 | } |
| 4640 | |
| 4641 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4642 | void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | { |
| 4644 | #ifdef WLAN_DEBUG |
| 4645 | // Verify against current log level |
| 4646 | if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] ) |
| 4647 | return; |
| 4648 | else |
| 4649 | { |
| 4650 | va_list marker; |
| 4651 | |
| 4652 | va_start( marker, pString ); /* Initialize variable arguments. */ |
| 4653 | |
| 4654 | logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker); |
| 4655 | |
| 4656 | va_end( marker ); /* Reset variable arguments. */ |
| 4657 | } |
| 4658 | #endif |
| 4659 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4661 | /* --------------------------------------------------------------------------- |
| 4662 | \fn sme_GetWcnssWlanCompiledVersion |
| 4663 | \brief This API returns the version of the WCNSS WLAN API with |
| 4664 | which the HOST driver was built |
| 4665 | \param hHal - The handle returned by macOpen. |
| 4666 | \param pVersion - Points to the Version structure to be filled |
| 4667 | \return VOS_STATUS |
| 4668 | VOS_STATUS_E_INVAL - failure |
| 4669 | VOS_STATUS_SUCCESS success |
| 4670 | ---------------------------------------------------------------------------*/ |
| 4671 | VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal, |
| 4672 | tSirVersionType *pVersion) |
| 4673 | { |
| 4674 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4675 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4676 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4677 | |
| 4678 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4679 | { |
| 4680 | if( pVersion != NULL ) |
| 4681 | { |
| 4682 | status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion); |
| 4683 | } |
| 4684 | else |
| 4685 | { |
| 4686 | status = VOS_STATUS_E_INVAL; |
| 4687 | } |
| 4688 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4689 | } |
| 4690 | |
| 4691 | return (status); |
| 4692 | } |
| 4693 | |
| 4694 | |
| 4695 | /* --------------------------------------------------------------------------- |
| 4696 | \fn sme_GetWcnssWlanReportedVersion |
| 4697 | \brief This API returns the version of the WCNSS WLAN API with |
| 4698 | which the WCNSS driver reports it was built |
| 4699 | \param hHal - The handle returned by macOpen. |
| 4700 | \param pVersion - Points to the Version structure to be filled |
| 4701 | \return VOS_STATUS |
| 4702 | VOS_STATUS_E_INVAL - failure |
| 4703 | VOS_STATUS_SUCCESS success |
| 4704 | ---------------------------------------------------------------------------*/ |
| 4705 | VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal, |
| 4706 | tSirVersionType *pVersion) |
| 4707 | { |
| 4708 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4709 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4710 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4711 | |
| 4712 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4713 | { |
| 4714 | if( pVersion != NULL ) |
| 4715 | { |
| 4716 | status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion); |
| 4717 | } |
| 4718 | else |
| 4719 | { |
| 4720 | status = VOS_STATUS_E_INVAL; |
| 4721 | } |
| 4722 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4723 | } |
| 4724 | |
| 4725 | return (status); |
| 4726 | } |
| 4727 | |
| 4728 | |
| 4729 | /* --------------------------------------------------------------------------- |
| 4730 | \fn sme_GetWcnssSoftwareVersion |
| 4731 | \brief This API returns the version string of the WCNSS driver |
| 4732 | \param hHal - The handle returned by macOpen. |
| 4733 | \param pVersion - Points to the Version string buffer to be filled |
| 4734 | \param versionBufferSize - THe size of the Version string buffer |
| 4735 | \return VOS_STATUS |
| 4736 | VOS_STATUS_E_INVAL - failure |
| 4737 | VOS_STATUS_SUCCESS success |
| 4738 | ---------------------------------------------------------------------------*/ |
| 4739 | VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal, |
| 4740 | tANI_U8 *pVersion, |
| 4741 | tANI_U32 versionBufferSize) |
| 4742 | { |
| 4743 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4744 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4745 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4746 | |
| 4747 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4748 | { |
| 4749 | if( pVersion != NULL ) |
| 4750 | { |
| 4751 | status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion, |
| 4752 | versionBufferSize); |
| 4753 | } |
| 4754 | else |
| 4755 | { |
| 4756 | status = VOS_STATUS_E_INVAL; |
| 4757 | } |
| 4758 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4759 | } |
| 4760 | |
| 4761 | return (status); |
| 4762 | } |
| 4763 | |
| 4764 | |
| 4765 | /* --------------------------------------------------------------------------- |
| 4766 | \fn sme_GetWcnssHardwareVersion |
| 4767 | \brief This API returns the version string of the WCNSS hardware |
| 4768 | \param hHal - The handle returned by macOpen. |
| 4769 | \param pVersion - Points to the Version string buffer to be filled |
| 4770 | \param versionBufferSize - THe size of the Version string buffer |
| 4771 | \return VOS_STATUS |
| 4772 | VOS_STATUS_E_INVAL - failure |
| 4773 | VOS_STATUS_SUCCESS success |
| 4774 | ---------------------------------------------------------------------------*/ |
| 4775 | VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal, |
| 4776 | tANI_U8 *pVersion, |
| 4777 | tANI_U32 versionBufferSize) |
| 4778 | { |
| 4779 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4780 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4781 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4782 | |
| 4783 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4784 | { |
| 4785 | if( pVersion != NULL ) |
| 4786 | { |
| 4787 | status = WDA_GetWcnssHardwareVersion(vosContext, pVersion, |
| 4788 | versionBufferSize); |
| 4789 | } |
| 4790 | else |
| 4791 | { |
| 4792 | status = VOS_STATUS_E_INVAL; |
| 4793 | } |
| 4794 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4795 | } |
| 4796 | |
| 4797 | return (status); |
| 4798 | } |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 4799 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4800 | |
| 4801 | #ifdef FEATURE_WLAN_WAPI |
| 4802 | /* --------------------------------------------------------------------------- |
| 4803 | \fn sme_RoamSetBKIDCache |
| 4804 | \brief The SME API exposed to HDD to allow HDD to provde SME the BKID |
| 4805 | candidate list. |
| 4806 | \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after |
| 4807 | it is opened (by calling halOpen). |
| 4808 | \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo |
| 4809 | \param numItems - a variable that has the number of tBkidCacheInfo allocated |
| 4810 | when retruning, this is the number of items put into pBKIDCache |
| 4811 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 4812 | big enough and pNumItems has the number of tBkidCacheInfo. |
| 4813 | ---------------------------------------------------------------------------*/ |
| 4814 | eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 4815 | tANI_U32 numItems ) |
| 4816 | { |
| 4817 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4818 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4819 | |
| 4820 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4821 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4822 | { |
| 4823 | status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems ); |
| 4824 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4825 | } |
| 4826 | |
| 4827 | return (status); |
| 4828 | } |
| 4829 | |
| 4830 | /* --------------------------------------------------------------------------- |
| 4831 | \fn sme_RoamGetBKIDCache |
| 4832 | \brief The SME API exposed to HDD to allow HDD to request SME to return its |
| 4833 | BKID cache. |
| 4834 | \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after |
| 4835 | it is opened (by calling halOpen). |
| 4836 | \param pNum - caller allocated memory that has the space of the number of |
| 4837 | tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries |
| 4838 | in SME cache. |
| 4839 | \param pBkidCache - Caller allocated memory that contains BKID cache, if any, |
| 4840 | upon return |
| 4841 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 4842 | big enough. |
| 4843 | ---------------------------------------------------------------------------*/ |
| 4844 | eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum, |
| 4845 | tBkidCacheInfo *pBkidCache) |
| 4846 | { |
| 4847 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4848 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4849 | |
| 4850 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4851 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4852 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4853 | smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4854 | status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache ); |
| 4855 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4856 | } |
| 4857 | |
| 4858 | return (status); |
| 4859 | } |
| 4860 | |
| 4861 | /* --------------------------------------------------------------------------- |
| 4862 | \fn sme_RoamGetNumBKIDCache |
| 4863 | \brief The SME API exposed to HDD to allow HDD to request SME to return the |
| 4864 | number of BKID cache entries. |
| 4865 | \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after |
| 4866 | it is opened (by calling halOpen). |
| 4867 | \return tANI_U32 - the number of BKID cache entries. |
| 4868 | ---------------------------------------------------------------------------*/ |
| 4869 | tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId) |
| 4870 | { |
| 4871 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4872 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4873 | tANI_U32 numBkidCache = 0; |
| 4874 | |
| 4875 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4876 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4877 | { |
| 4878 | numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId ); |
| 4879 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4880 | } |
| 4881 | |
| 4882 | return (numBkidCache); |
| 4883 | } |
| 4884 | |
| 4885 | /* --------------------------------------------------------------------------- |
| 4886 | \fn sme_ScanGetBKIDCandidateList |
| 4887 | \brief a wrapper function to return the BKID candidate list |
| 4888 | \param pBkidList - caller allocated buffer point to an array of |
| 4889 | tBkidCandidateInfo |
| 4890 | \param pNumItems - pointer to a variable that has the number of |
| 4891 | tBkidCandidateInfo allocated when retruning, this is |
| 4892 | either the number needed or number of items put into |
| 4893 | pPmkidList |
| 4894 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 4895 | big enough and pNumItems |
| 4896 | has the number of tBkidCandidateInfo. |
| 4897 | \Note: pNumItems is a number of tBkidCandidateInfo, |
| 4898 | not sizeof(tBkidCandidateInfo) * something |
| 4899 | ---------------------------------------------------------------------------*/ |
| 4900 | eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId, |
| 4901 | tBkidCandidateInfo *pBkidList, |
| 4902 | tANI_U32 *pNumItems ) |
| 4903 | { |
| 4904 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4905 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4906 | |
| 4907 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4908 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4909 | { |
| 4910 | status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems ); |
| 4911 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4912 | } |
| 4913 | |
| 4914 | return (status); |
| 4915 | } |
| 4916 | #endif /* FEATURE_WLAN_WAPI */ |
| 4917 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4918 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 4919 | |
| 4920 | /***************************************************************************** |
| 4921 | OEM DATA related modifications and function additions |
| 4922 | *****************************************************************************/ |
| 4923 | |
| 4924 | /* --------------------------------------------------------------------------- |
| 4925 | \fn sme_getOemDataRsp |
| 4926 | \brief a wrapper function to obtain the OEM DATA RSP |
| 4927 | \param pOemDataRsp - A pointer to the response object |
| 4928 | \param pContext - a pointer passed in for the callback |
| 4929 | \return eHalStatus |
| 4930 | ---------------------------------------------------------------------------*/ |
| 4931 | eHalStatus sme_getOemDataRsp(tHalHandle hHal, |
| 4932 | tOemDataRsp **pOemDataRsp) |
| 4933 | { |
| 4934 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4935 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4936 | |
| 4937 | do |
| 4938 | { |
| 4939 | //acquire the lock for the sme object |
| 4940 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 4941 | |
| 4942 | if(!HAL_STATUS_SUCCESS(status)) |
| 4943 | { |
| 4944 | break; |
| 4945 | } |
| 4946 | |
| 4947 | if(pMac->oemData.pOemDataRsp != NULL) |
| 4948 | { |
| 4949 | *pOemDataRsp = pMac->oemData.pOemDataRsp; |
| 4950 | } |
| 4951 | else |
| 4952 | { |
| 4953 | status = eHAL_STATUS_FAILURE; |
| 4954 | } |
| 4955 | |
| 4956 | //release the lock for the sme object |
| 4957 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4958 | |
| 4959 | } while(0); |
| 4960 | |
| 4961 | return status; |
| 4962 | } |
| 4963 | |
| 4964 | /* --------------------------------------------------------------------------- |
| 4965 | \fn sme_OemDataReq |
| 4966 | \brief a wrapper function for OEM DATA REQ |
| 4967 | \param sessionId - session id to be used. |
| 4968 | \param pOemDataReqId - pointer to an object to get back the request ID |
| 4969 | \param callback - a callback function that is called upon finish |
| 4970 | \param pContext - a pointer passed in for the callback |
| 4971 | \return eHalStatus |
| 4972 | ---------------------------------------------------------------------------*/ |
| 4973 | eHalStatus sme_OemDataReq(tHalHandle hHal, |
| 4974 | tANI_U8 sessionId, |
| 4975 | tOemDataReqConfig *pOemDataReqConfig, |
| 4976 | tANI_U32 *pOemDataReqID, |
| 4977 | oemData_OemDataReqCompleteCallback callback, |
| 4978 | void *pContext) |
| 4979 | { |
| 4980 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4981 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4982 | |
| 4983 | do |
| 4984 | { |
| 4985 | //acquire the lock for the sme object |
| 4986 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 4987 | if(HAL_STATUS_SUCCESS(status)) |
| 4988 | { |
| 4989 | tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around |
| 4990 | |
| 4991 | if(pOemDataReqID) |
| 4992 | { |
| 4993 | *pOemDataReqID = lOemDataReqId; |
| 4994 | } |
| 4995 | else |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 4996 | { |
| 4997 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4998 | return eHAL_STATUS_FAILURE; |
| 4999 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5000 | |
| 5001 | status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext); |
| 5002 | |
| 5003 | //release the lock for the sme object |
| 5004 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5005 | } |
| 5006 | } while(0); |
| 5007 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5008 | smsLog(pMac, LOGW, "exiting function %s", __func__); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5009 | |
| 5010 | return(status); |
| 5011 | } |
| 5012 | |
| 5013 | #endif /*FEATURE_OEM_DATA_SUPPORT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5014 | |
| 5015 | /*-------------------------------------------------------------------------- |
| 5016 | |
| 5017 | \brief sme_OpenSession() - Open a session for scan/roam operation. |
| 5018 | |
| 5019 | This is a synchronous API. |
| 5020 | |
| 5021 | |
| 5022 | \param hHal - The handle returned by macOpen. |
| 5023 | \param callback - A pointer to the function caller specifies for roam/connect status indication |
| 5024 | \param pContext - The context passed with callback |
| 5025 | \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes) |
| 5026 | \param pbSessionId - pointer to a caller allocated buffer for returned session ID |
| 5027 | |
| 5028 | \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned. |
| 5029 | |
| 5030 | Other status means SME is failed to open the session. |
| 5031 | eHAL_STATUS_RESOURCES - no more session available. |
| 5032 | \sa |
| 5033 | |
| 5034 | --------------------------------------------------------------------------*/ |
| 5035 | eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext, |
| 5036 | tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId) |
| 5037 | { |
| 5038 | eHalStatus status; |
| 5039 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5040 | |
| 5041 | if( NULL == pbSessionId ) |
| 5042 | { |
| 5043 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 5044 | } |
| 5045 | else |
| 5046 | { |
| 5047 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5048 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5049 | { |
| 5050 | status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId ); |
| 5051 | |
| 5052 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5053 | } |
| 5054 | } |
| 5055 | |
| 5056 | return ( status ); |
| 5057 | } |
| 5058 | |
| 5059 | |
| 5060 | /*-------------------------------------------------------------------------- |
| 5061 | |
| 5062 | \brief sme_CloseSession() - Open a session for scan/roam operation. |
| 5063 | |
| 5064 | This is a synchronous API. |
| 5065 | |
| 5066 | |
| 5067 | \param hHal - The handle returned by macOpen. |
| 5068 | |
| 5069 | \param sessionId - A previous opened session's ID. |
| 5070 | |
| 5071 | \return eHAL_STATUS_SUCCESS - session is closed. |
| 5072 | |
| 5073 | Other status means SME is failed to open the session. |
| 5074 | eHAL_STATUS_INVALID_PARAMETER - session is not opened. |
| 5075 | \sa |
| 5076 | |
| 5077 | --------------------------------------------------------------------------*/ |
| 5078 | eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId, |
| 5079 | csrRoamSessionCloseCallback callback, void *pContext) |
| 5080 | { |
| 5081 | eHalStatus status; |
| 5082 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5083 | |
| 5084 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5085 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5086 | { |
| 5087 | status = csrRoamCloseSession( pMac, sessionId, FALSE, |
| 5088 | callback, pContext ); |
| 5089 | |
| 5090 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5091 | } |
| 5092 | |
| 5093 | return ( status ); |
| 5094 | } |
| 5095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5096 | /* --------------------------------------------------------------------------- |
| 5097 | |
| 5098 | \fn sme_RoamUpdateAPWPSIE |
| 5099 | |
| 5100 | \brief To update AP's WPS IE. This function should be called after SME AP session is created |
| 5101 | This is an asynchronous API. |
| 5102 | |
| 5103 | \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs |
| 5104 | |
| 5105 | \return eHalStatus – SUCCESS – |
| 5106 | |
| 5107 | FAILURE or RESOURCES – The API finished and failed. |
| 5108 | |
| 5109 | -------------------------------------------------------------------------------*/ |
| 5110 | eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES) |
| 5111 | { |
| 5112 | |
| 5113 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5114 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5115 | |
| 5116 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5117 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5118 | { |
| 5119 | |
| 5120 | status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES ); |
| 5121 | |
| 5122 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5123 | } |
| 5124 | |
| 5125 | return (status); |
| 5126 | } |
| 5127 | /* --------------------------------------------------------------------------- |
| 5128 | |
| 5129 | \fn sme_RoamUpdateAPWPARSNIEs |
| 5130 | |
| 5131 | \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created |
| 5132 | This is an asynchronous API. |
| 5133 | |
| 5134 | \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs |
| 5135 | |
| 5136 | \return eHalStatus – SUCCESS – |
| 5137 | |
| 5138 | FAILURE or RESOURCES – The API finished and failed. |
| 5139 | |
| 5140 | -------------------------------------------------------------------------------*/ |
| 5141 | eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie) |
| 5142 | { |
| 5143 | |
| 5144 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5145 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5146 | |
| 5147 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5148 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5149 | { |
| 5150 | |
| 5151 | status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie); |
| 5152 | |
| 5153 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5154 | } |
| 5155 | |
| 5156 | return (status); |
| 5157 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5158 | /* --------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5159 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5160 | \fn sme_ChangeMCCBeaconInterval |
| 5161 | |
| 5162 | \brief To update P2P-GO beaconInterval. This function should be called after |
| 5163 | disassociating all the station is done |
| 5164 | This is an asynchronous API. |
| 5165 | |
| 5166 | \param |
| 5167 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5168 | \return eHalStatus SUCCESS |
| 5169 | FAILURE or RESOURCES |
| 5170 | The API finished and failed. |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5171 | |
| 5172 | -------------------------------------------------------------------------------*/ |
| 5173 | eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId) |
| 5174 | { |
| 5175 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5176 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5177 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5178 | smsLog(pMac, LOG1, FL("Update Beacon PARAMS ")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5179 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5180 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5181 | { |
| 5182 | status = csrSendChngMCCBeaconInterval( pMac, sessionId); |
| 5183 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5184 | } |
| 5185 | return (status); |
| 5186 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5187 | |
| 5188 | /*-------------------------------------------------------------------------------* |
| 5189 | |
| 5190 | \fn sme_sendBTAmpEvent |
| 5191 | |
| 5192 | \brief to receive the coex priorty request from BT-AMP PAL |
| 5193 | and send the BT_AMP link state to HAL |
| 5194 | |
| 5195 | \param btAmpEvent - btAmpEvent |
| 5196 | |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 5197 | \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5198 | |
| 5199 | FAILURE: API failed |
| 5200 | |
| 5201 | -------------------------------------------------------------------------------*/ |
| 5202 | |
| 5203 | eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent) |
| 5204 | { |
| 5205 | vos_msg_t msg; |
| 5206 | tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL; |
| 5207 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5208 | |
| 5209 | ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent)); |
| 5210 | if (NULL == ptrSmeBtAmpEvent) |
| 5211 | { |
| 5212 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5213 | "Not able to allocate memory for BTAmp event", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5214 | return status; |
| 5215 | } |
| 5216 | |
| 5217 | vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent)); |
| 5218 | msg.type = WDA_SIGNAL_BTAMP_EVENT; |
| 5219 | msg.reserved = 0; |
| 5220 | msg.bodyptr = ptrSmeBtAmpEvent; |
| 5221 | |
| 5222 | //status = halFW_SendBTAmpEventMesg(pMac, event); |
| 5223 | |
| 5224 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 5225 | { |
| 5226 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5227 | "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5228 | vos_mem_free(ptrSmeBtAmpEvent); |
| 5229 | return status; |
| 5230 | } |
| 5231 | |
| 5232 | return eHAL_STATUS_SUCCESS; |
| 5233 | |
| 5234 | } |
| 5235 | |
| 5236 | /* --------------------------------------------------------------------------- |
| 5237 | \fn sme_SetHostOffload |
| 5238 | \brief API to set the host offload feature. |
| 5239 | \param hHal - The handle returned by macOpen. |
| 5240 | \param pRequest - Pointer to the offload request. |
| 5241 | \return eHalStatus |
| 5242 | ---------------------------------------------------------------------------*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5243 | eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId, |
| 5244 | tpSirHostOffloadReq pRequest) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5245 | { |
| 5246 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5247 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5248 | |
| 5249 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5250 | { |
| 5251 | #ifdef WLAN_NS_OFFLOAD |
| 5252 | if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType) |
| 5253 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5254 | status = pmcSetNSOffload( hHal, pRequest, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5255 | } |
| 5256 | else |
| 5257 | #endif //WLAN_NS_OFFLOAD |
| 5258 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5259 | status = pmcSetHostOffload (hHal, pRequest, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5260 | } |
| 5261 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5262 | } |
| 5263 | |
| 5264 | return (status); |
| 5265 | } |
| 5266 | |
| 5267 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 5268 | /* --------------------------------------------------------------------------- |
| 5269 | \fn sme_SetGTKOffload |
| 5270 | \brief API to set GTK offload information. |
| 5271 | \param hHal - The handle returned by macOpen. |
| 5272 | \param pRequest - Pointer to the GTK offload request. |
| 5273 | \return eHalStatus |
| 5274 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5275 | eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest, |
| 5276 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5277 | { |
| 5278 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5279 | eHalStatus status; |
| 5280 | |
| 5281 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5282 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5283 | status = pmcSetGTKOffload( hHal, pRequest, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5284 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5285 | } |
| 5286 | |
| 5287 | return (status); |
| 5288 | } |
| 5289 | |
| 5290 | /* --------------------------------------------------------------------------- |
| 5291 | \fn sme_GetGTKOffload |
| 5292 | \brief API to get GTK offload information. |
| 5293 | \param hHal - The handle returned by macOpen. |
| 5294 | \param pRequest - Pointer to the GTK offload response. |
| 5295 | \return eHalStatus |
| 5296 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5297 | eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, |
| 5298 | void *callbackContext, tANI_U8 sessionId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5299 | { |
| 5300 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5301 | eHalStatus status; |
| 5302 | |
| 5303 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5304 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5305 | pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5306 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5307 | } |
| 5308 | |
| 5309 | return (status); |
| 5310 | } |
| 5311 | #endif // WLAN_FEATURE_GTK_OFFLOAD |
| 5312 | |
| 5313 | /* --------------------------------------------------------------------------- |
| 5314 | \fn sme_SetKeepAlive |
| 5315 | \brief API to set the Keep Alive feature. |
| 5316 | \param hHal - The handle returned by macOpen. |
| 5317 | \param pRequest - Pointer to the Keep Alive request. |
| 5318 | \return eHalStatus |
| 5319 | ---------------------------------------------------------------------------*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5320 | eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId, |
| 5321 | tpSirKeepAliveReq pRequest) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5322 | { |
| 5323 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5324 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5325 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5326 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5327 | status = pmcSetKeepAlive (hHal, pRequest, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5328 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5329 | } |
| 5330 | |
| 5331 | return (status); |
| 5332 | } |
| 5333 | |
| 5334 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5335 | /* --------------------------------------------------------------------------- |
| 5336 | \fn sme_SetPreferredNetworkList |
| 5337 | \brief API to set the Preferred Network List Offload feature. |
| 5338 | \param hHal - The handle returned by macOpen. |
| 5339 | \param pRequest - Pointer to the offload request. |
| 5340 | \return eHalStatus |
| 5341 | ---------------------------------------------------------------------------*/ |
| 5342 | eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext ) |
| 5343 | { |
| 5344 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5345 | eHalStatus status; |
| 5346 | |
| 5347 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5348 | { |
| 5349 | pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext); |
| 5350 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5351 | } |
| 5352 | |
| 5353 | return (status); |
| 5354 | } |
| 5355 | |
| 5356 | eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold) |
| 5357 | { |
| 5358 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5359 | eHalStatus status; |
| 5360 | |
| 5361 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5362 | { |
| 5363 | pmcSetRssiFilter(hHal, rssiThreshold); |
| 5364 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5365 | } |
| 5366 | |
| 5367 | return (status); |
| 5368 | } |
| 5369 | |
| 5370 | #endif // FEATURE_WLAN_SCAN_PNO |
| 5371 | |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 5372 | eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5373 | { |
| 5374 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5375 | eHalStatus status; |
| 5376 | |
| 5377 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5378 | { |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 5379 | pmcSetPowerParams(hHal, pwParams, forced); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5380 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5381 | } |
| 5382 | |
| 5383 | return (status); |
| 5384 | } |
| 5385 | |
| 5386 | /* --------------------------------------------------------------------------- |
| 5387 | \fn sme_AbortMacScan |
| 5388 | \brief API to cancel MAC scan. |
| 5389 | \param hHal - The handle returned by macOpen. |
| 5390 | \return VOS_STATUS |
| 5391 | VOS_STATUS_E_FAILURE - failure |
| 5392 | VOS_STATUS_SUCCESS success |
| 5393 | ---------------------------------------------------------------------------*/ |
| 5394 | eHalStatus sme_AbortMacScan(tHalHandle hHal) |
| 5395 | { |
| 5396 | eHalStatus status; |
| 5397 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5398 | |
| 5399 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5400 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5401 | { |
| 5402 | status = csrScanAbortMacScan(pMac); |
| 5403 | |
| 5404 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5405 | } |
| 5406 | |
| 5407 | return ( status ); |
| 5408 | } |
| 5409 | |
| 5410 | /* ---------------------------------------------------------------------------- |
| 5411 | \fn sme_GetOperationChannel |
| 5412 | \brief API to get current channel on which STA is parked |
| 5413 | this function gives channel information only of infra station or IBSS station |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5414 | \param hHal, pointer to memory location and sessionId |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5415 | \returns eHAL_STATUS_SUCCESS |
| 5416 | eHAL_STATUS_FAILURE |
| 5417 | -------------------------------------------------------------------------------*/ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5418 | eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5419 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5420 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5421 | tCsrRoamSession *pSession; |
| 5422 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5423 | if (CSR_IS_SESSION_VALID( pMac, sessionId )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5424 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5425 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5426 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5427 | if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) || |
| 5428 | ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) || |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5429 | ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) || |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5430 | ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS )) |
| 5431 | { |
| 5432 | *pChannel =pSession->connectedProfile.operationChannel; |
| 5433 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5434 | } |
| 5435 | } |
| 5436 | return eHAL_STATUS_FAILURE; |
| 5437 | }// sme_GetOperationChannel ends here |
| 5438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5439 | /* --------------------------------------------------------------------------- |
| 5440 | |
| 5441 | \fn sme_RegisterMgtFrame |
| 5442 | |
| 5443 | \brief To register managment frame of specified type and subtype. |
| 5444 | \param frameType - type of the frame that needs to be passed to HDD. |
| 5445 | \param matchData - data which needs to be matched before passing frame |
| 5446 | to HDD. |
| 5447 | \param matchDataLen - Length of matched data. |
| 5448 | \return eHalStatus |
| 5449 | -------------------------------------------------------------------------------*/ |
| 5450 | eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, |
| 5451 | tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen) |
| 5452 | { |
| 5453 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5454 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5455 | |
| 5456 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5457 | { |
| 5458 | tSirRegisterMgmtFrame *pMsg; |
| 5459 | tANI_U16 len; |
| 5460 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5461 | |
| 5462 | if(!pSession) |
| 5463 | { |
| 5464 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 5465 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5466 | return eHAL_STATUS_FAILURE; |
| 5467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5468 | |
| 5469 | if( !pSession->sessionActive ) |
| 5470 | { |
| 5471 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5472 | "%s Invalid Sessionid", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5473 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5474 | return eHAL_STATUS_FAILURE; |
| 5475 | } |
| 5476 | |
| 5477 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5478 | |
| 5479 | status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len ); |
| 5480 | if(HAL_STATUS_SUCCESS(status)) |
| 5481 | { |
| 5482 | palZeroMemory(pMac->hHdd, pMsg, len); |
| 5483 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5484 | pMsg->length = len; |
| 5485 | pMsg->sessionId = sessionId; |
| 5486 | pMsg->registerFrame = VOS_TRUE; |
| 5487 | pMsg->frameType = frameType; |
| 5488 | pMsg->matchLen = matchLen; |
| 5489 | palCopyMemory( pMac, pMsg->matchData, matchData, matchLen); |
| 5490 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 5491 | } |
| 5492 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5493 | } |
| 5494 | return status; |
| 5495 | } |
| 5496 | |
| 5497 | /* --------------------------------------------------------------------------- |
| 5498 | |
| 5499 | \fn sme_DeregisterMgtFrame |
| 5500 | |
| 5501 | \brief To De-register managment frame of specified type and subtype. |
| 5502 | \param frameType - type of the frame that needs to be passed to HDD. |
| 5503 | \param matchData - data which needs to be matched before passing frame |
| 5504 | to HDD. |
| 5505 | \param matchDataLen - Length of matched data. |
| 5506 | \return eHalStatus |
| 5507 | -------------------------------------------------------------------------------*/ |
| 5508 | eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, |
| 5509 | tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen) |
| 5510 | { |
| 5511 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5512 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5513 | |
| 5514 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5515 | { |
| 5516 | tSirRegisterMgmtFrame *pMsg; |
| 5517 | tANI_U16 len; |
| 5518 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5519 | |
| 5520 | if(!pSession) |
| 5521 | { |
| 5522 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 5523 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5524 | return eHAL_STATUS_FAILURE; |
| 5525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5526 | |
| 5527 | if( !pSession->sessionActive ) |
| 5528 | { |
| 5529 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5530 | "%s Invalid Sessionid", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5531 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5532 | return eHAL_STATUS_FAILURE; |
| 5533 | } |
| 5534 | |
| 5535 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5536 | |
| 5537 | status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len ); |
| 5538 | if(HAL_STATUS_SUCCESS(status)) |
| 5539 | { |
| 5540 | palZeroMemory(pMac->hHdd, pMsg, len); |
| 5541 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5542 | pMsg->length = len; |
| 5543 | pMsg->registerFrame = VOS_FALSE; |
| 5544 | pMsg->frameType = frameType; |
| 5545 | pMsg->matchLen = matchLen; |
| 5546 | palCopyMemory( pMac, pMsg->matchData, matchData, matchLen); |
| 5547 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 5548 | } |
| 5549 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5550 | } |
| 5551 | return status; |
| 5552 | } |
| 5553 | |
| 5554 | /* --------------------------------------------------------------------------- |
| 5555 | \fn sme_RemainOnChannel |
| 5556 | \brief API to request remain on channel for 'x' duration. used in p2p in listen state |
| 5557 | \param hHal - The handle returned by macOpen. |
| 5558 | \param pRequest - channel |
| 5559 | \param duration - duration in ms |
| 5560 | \param callback - HDD registered callback to process reaminOnChannelRsp |
| 5561 | \param context - HDD Callback param |
| 5562 | \return eHalStatus |
| 5563 | ---------------------------------------------------------------------------*/ |
| 5564 | |
| 5565 | eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId, |
| 5566 | tANI_U8 channel, tANI_U32 duration, |
| 5567 | remainOnChanCallback callback, |
| 5568 | void *pContext) |
| 5569 | { |
| 5570 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5571 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5572 | |
| 5573 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5574 | { |
| 5575 | status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext |
| 5576 | #ifdef WLAN_FEATURE_P2P_INTERNAL |
| 5577 | , eP2PRemainOnChnReasonUnknown |
| 5578 | #endif |
| 5579 | ); |
| 5580 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5581 | } |
| 5582 | return(status); |
| 5583 | } |
| 5584 | |
| 5585 | /* --------------------------------------------------------------------------- |
| 5586 | \fn sme_ReportProbeReq |
| 5587 | \brief API to enable/disable forwarding of probeReq to apps in p2p. |
| 5588 | \param hHal - The handle returned by macOpen. |
| 5589 | \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p |
| 5590 | \return eHalStatus |
| 5591 | ---------------------------------------------------------------------------*/ |
| 5592 | |
| 5593 | #ifndef WLAN_FEATURE_CONCURRENT_P2P |
| 5594 | eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag) |
| 5595 | { |
| 5596 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5597 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5598 | |
| 5599 | do |
| 5600 | { |
| 5601 | //acquire the lock for the sme object |
| 5602 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 5603 | if(HAL_STATUS_SUCCESS(status)) |
| 5604 | { |
| 5605 | /* call set in context */ |
| 5606 | pMac->p2pContext.probeReqForwarding = flag; |
| 5607 | //release the lock for the sme object |
| 5608 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5609 | } |
| 5610 | } while(0); |
| 5611 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5612 | smsLog(pMac, LOGW, "exiting function %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5613 | |
| 5614 | return(status); |
| 5615 | } |
| 5616 | |
| 5617 | /* --------------------------------------------------------------------------- |
| 5618 | \fn sme_updateP2pIe |
| 5619 | \brief API to set the P2p Ie in p2p context |
| 5620 | \param hHal - The handle returned by macOpen. |
| 5621 | \param p2pIe - Ptr to p2pIe from HDD. |
| 5622 | \param p2pIeLength: length of p2pIe |
| 5623 | \return eHalStatus |
| 5624 | ---------------------------------------------------------------------------*/ |
| 5625 | |
| 5626 | eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength) |
| 5627 | { |
| 5628 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5629 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5630 | |
| 5631 | //acquire the lock for the sme object |
| 5632 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 5633 | if(HAL_STATUS_SUCCESS(status)) |
| 5634 | { |
| 5635 | if(NULL != pMac->p2pContext.probeRspIe){ |
| 5636 | vos_mem_free(pMac->p2pContext.probeRspIe); |
| 5637 | pMac->p2pContext.probeRspIeLength = 0; |
| 5638 | } |
| 5639 | |
| 5640 | pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength); |
| 5641 | if (NULL == pMac->p2pContext.probeRspIe) |
| 5642 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5643 | smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5644 | pMac->p2pContext.probeRspIeLength = 0; |
| 5645 | status = eHAL_STATUS_FAILURE; |
| 5646 | } |
| 5647 | else |
| 5648 | { |
| 5649 | pMac->p2pContext.probeRspIeLength = p2pIeLength; |
| 5650 | |
| 5651 | sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2, |
| 5652 | pMac->p2pContext.probeRspIe, |
| 5653 | pMac->p2pContext.probeRspIeLength ); |
| 5654 | vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe, |
| 5655 | p2pIeLength); |
| 5656 | } |
| 5657 | |
| 5658 | //release the lock for the sme object |
| 5659 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5660 | } |
| 5661 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5662 | smsLog(pMac, LOG2, "exiting function %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5663 | |
| 5664 | return(status); |
| 5665 | } |
| 5666 | #endif |
| 5667 | |
| 5668 | /* --------------------------------------------------------------------------- |
| 5669 | \fn sme_sendAction |
| 5670 | \brief API to send action frame from supplicant. |
| 5671 | \param hHal - The handle returned by macOpen. |
| 5672 | \return eHalStatus |
| 5673 | ---------------------------------------------------------------------------*/ |
| 5674 | |
| 5675 | eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5676 | const tANI_U8 *pBuf, tANI_U32 len, |
| 5677 | tANI_U16 wait, tANI_BOOLEAN noack) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5678 | { |
| 5679 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5680 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5681 | |
| 5682 | //acquire the lock for the sme object |
| 5683 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 5684 | if(HAL_STATUS_SUCCESS(status)) |
| 5685 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5686 | p2pSendAction(hHal, sessionId, pBuf, len, wait, noack); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5687 | //release the lock for the sme object |
| 5688 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5689 | } |
| 5690 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5691 | smsLog(pMac, LOGW, "exiting function %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5692 | |
| 5693 | return(status); |
| 5694 | } |
| 5695 | |
| 5696 | eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId ) |
| 5697 | { |
| 5698 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5699 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5700 | |
| 5701 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5702 | { |
| 5703 | status = p2pCancelRemainOnChannel (hHal, sessionId); |
| 5704 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5705 | } |
| 5706 | return(status); |
| 5707 | } |
| 5708 | |
| 5709 | //Power Save Related |
| 5710 | eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data) |
| 5711 | { |
| 5712 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5713 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5714 | |
| 5715 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5716 | { |
| 5717 | status = p2pSetPs (hHal, data); |
| 5718 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5719 | } |
| 5720 | return(status); |
| 5721 | } |
| 5722 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5723 | |
| 5724 | /* --------------------------------------------------------------------------- |
| 5725 | |
| 5726 | \fn sme_ConfigureRxpFilter |
| 5727 | |
| 5728 | \brief |
| 5729 | SME will pass this request to lower mac to set/reset the filter on RXP for |
| 5730 | multicast & broadcast traffic. |
| 5731 | |
| 5732 | \param |
| 5733 | |
| 5734 | hHal - The handle returned by macOpen. |
| 5735 | |
| 5736 | filterMask- Currently the API takes a 1 or 0 (set or reset) as filter. |
| 5737 | Basically to enable/disable the filter (to filter "all" mcbc traffic) based |
| 5738 | on this param. In future we can use this as a mask to set various types of |
| 5739 | filters as suggested below: |
| 5740 | FILTER_ALL_MULTICAST: |
| 5741 | FILTER_ALL_BROADCAST: |
| 5742 | FILTER_ALL_MULTICAST_BROADCAST: |
| 5743 | |
| 5744 | |
| 5745 | \return eHalStatus |
| 5746 | |
| 5747 | |
| 5748 | --------------------------------------------------------------------------- */ |
| 5749 | eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal, |
| 5750 | tpSirWlanSetRxpFilters wlanRxpFilterParam) |
| 5751 | { |
| 5752 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5753 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 5754 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5755 | vos_msg_t vosMessage; |
| 5756 | |
| 5757 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5758 | { |
| 5759 | /* serialize the req through MC thread */ |
| 5760 | vosMessage.bodyptr = wlanRxpFilterParam; |
| 5761 | vosMessage.type = WDA_CFG_RXP_FILTER_REQ; |
| 5762 | vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ); |
| 5763 | if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 5764 | { |
| 5765 | status = eHAL_STATUS_FAILURE; |
| 5766 | } |
| 5767 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5768 | } |
| 5769 | return(status); |
| 5770 | } |
| 5771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5772 | /* --------------------------------------------------------------------------- |
| 5773 | |
| 5774 | \fn sme_ConfigureSuspendInd |
| 5775 | |
| 5776 | \brief |
| 5777 | SME will pass this request to lower mac to Indicate that the wlan needs to |
| 5778 | be suspended |
| 5779 | |
| 5780 | \param |
| 5781 | |
| 5782 | hHal - The handle returned by macOpen. |
| 5783 | |
| 5784 | wlanSuspendParam- Depicts the wlan suspend params |
| 5785 | |
| 5786 | |
| 5787 | \return eHalStatus |
| 5788 | |
| 5789 | |
| 5790 | --------------------------------------------------------------------------- */ |
| 5791 | eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal, |
| 5792 | tpSirWlanSuspendParam wlanSuspendParam) |
| 5793 | { |
| 5794 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5795 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 5796 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5797 | vos_msg_t vosMessage; |
| 5798 | |
| 5799 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5800 | { |
| 5801 | /* serialize the req through MC thread */ |
| 5802 | vosMessage.bodyptr = wlanSuspendParam; |
| 5803 | vosMessage.type = WDA_WLAN_SUSPEND_IND; |
| 5804 | vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ); |
| 5805 | if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 5806 | { |
| 5807 | status = eHAL_STATUS_FAILURE; |
| 5808 | } |
| 5809 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5810 | } |
| 5811 | return(status); |
| 5812 | } |
| 5813 | |
| 5814 | /* --------------------------------------------------------------------------- |
| 5815 | |
| 5816 | \fn sme_ConfigureResumeReq |
| 5817 | |
| 5818 | \brief |
| 5819 | SME will pass this request to lower mac to Indicate that the wlan needs to |
| 5820 | be Resumed |
| 5821 | |
| 5822 | \param |
| 5823 | |
| 5824 | hHal - The handle returned by macOpen. |
| 5825 | |
| 5826 | wlanResumeParam- Depicts the wlan resume params |
| 5827 | |
| 5828 | |
| 5829 | \return eHalStatus |
| 5830 | |
| 5831 | |
| 5832 | --------------------------------------------------------------------------- */ |
| 5833 | eHalStatus sme_ConfigureResumeReq( tHalHandle hHal, |
| 5834 | tpSirWlanResumeParam wlanResumeParam) |
| 5835 | { |
| 5836 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5837 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 5838 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5839 | vos_msg_t vosMessage; |
| 5840 | |
| 5841 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5842 | { |
| 5843 | /* serialize the req through MC thread */ |
| 5844 | vosMessage.bodyptr = wlanResumeParam; |
| 5845 | vosMessage.type = WDA_WLAN_RESUME_REQ; |
| 5846 | vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ); |
| 5847 | if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 5848 | { |
| 5849 | status = eHAL_STATUS_FAILURE; |
| 5850 | } |
| 5851 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5852 | } |
| 5853 | return(status); |
| 5854 | } |
| 5855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5856 | /* --------------------------------------------------------------------------- |
| 5857 | |
| 5858 | \fn sme_GetInfraSessionId |
| 5859 | |
| 5860 | \brief To get the session ID for infra session, if connected |
| 5861 | This is a synchronous API. |
| 5862 | |
| 5863 | \param hHal - The handle returned by macOpen. |
| 5864 | |
| 5865 | \return sessionid, -1 if infra session is not connected |
| 5866 | |
| 5867 | -------------------------------------------------------------------------------*/ |
| 5868 | tANI_S8 sme_GetInfraSessionId(tHalHandle hHal) |
| 5869 | { |
| 5870 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5871 | tANI_S8 sessionid = -1; |
| 5872 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5873 | |
| 5874 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5875 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5876 | { |
| 5877 | |
| 5878 | sessionid = csrGetInfraSessionId( pMac); |
| 5879 | |
| 5880 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5881 | } |
| 5882 | |
| 5883 | return (sessionid); |
| 5884 | } |
| 5885 | |
| 5886 | /* --------------------------------------------------------------------------- |
| 5887 | |
| 5888 | \fn sme_GetInfraOperationChannel |
| 5889 | |
| 5890 | \brief To get the operating channel for infra session, if connected |
| 5891 | This is a synchronous API. |
| 5892 | |
| 5893 | \param hHal - The handle returned by macOpen. |
| 5894 | \param sessionId - the sessionId returned by sme_OpenSession. |
| 5895 | |
| 5896 | \return operating channel, 0 if infra session is not connected |
| 5897 | |
| 5898 | -------------------------------------------------------------------------------*/ |
| 5899 | tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId) |
| 5900 | { |
| 5901 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5902 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5903 | tANI_U8 channel = 0; |
| 5904 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5905 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5906 | { |
| 5907 | |
| 5908 | channel = csrGetInfraOperationChannel( pMac, sessionId); |
| 5909 | |
| 5910 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5911 | } |
| 5912 | |
| 5913 | return (channel); |
| 5914 | } |
| 5915 | |
| 5916 | //This routine will return poerating channel on which other BSS is operating to be used for concurrency mode. |
| 5917 | //If other BSS is not up or not connected it will return 0 |
| 5918 | tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal ) |
| 5919 | { |
| 5920 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5921 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5922 | tANI_U8 channel = 0; |
| 5923 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5924 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5925 | { |
| 5926 | |
| 5927 | channel = csrGetConcurrentOperationChannel( pMac ); |
| 5928 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5929 | " Other Concurrent Channel = %d", __func__,channel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5931 | } |
| 5932 | |
| 5933 | return (channel); |
| 5934 | } |
| 5935 | |
| 5936 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5937 | /****************************************************************************** |
| 5938 | * |
| 5939 | * Name: sme_PreferredNetworkFoundInd |
| 5940 | * |
| 5941 | * Description: |
| 5942 | * Invoke Preferred Network Found Indication |
| 5943 | * |
| 5944 | * Parameters: |
| 5945 | * hHal - HAL handle for device |
| 5946 | * pMsg - found network description |
| 5947 | * |
| 5948 | * Returns: eHalStatus |
| 5949 | * |
| 5950 | ******************************************************************************/ |
| 5951 | eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg) |
| 5952 | { |
| 5953 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5954 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5955 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg; |
| 5956 | |
| 5957 | if (NULL == pMsg) |
| 5958 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5959 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5960 | status = eHAL_STATUS_FAILURE; |
| 5961 | } |
| 5962 | else |
| 5963 | { |
| 5964 | if (pPrefNetworkFoundInd->ssId.length > 0) |
| 5965 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5966 | smsLog(pMac, LOG1, "Preferred Network Found Indication in %s(), SSID=%s", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5967 | __func__, pPrefNetworkFoundInd->ssId.ssId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5968 | |
| 5969 | |
| 5970 | /* Call Preferred Netowrk Found Indication callback routine. */ |
| 5971 | if (pMac->pmc.prefNetwFoundCB != NULL) |
| 5972 | { |
| 5973 | pMac->pmc.prefNetwFoundCB(pMac->pmc.preferredNetworkFoundIndCallbackContext, pPrefNetworkFoundInd); |
| 5974 | } |
| 5975 | |
| 5976 | } |
| 5977 | else |
| 5978 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5979 | smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5980 | status = eHAL_STATUS_FAILURE; |
| 5981 | } |
| 5982 | } |
| 5983 | |
| 5984 | |
| 5985 | return(status); |
| 5986 | } |
| 5987 | |
| 5988 | #endif // FEATURE_WLAN_SCAN_PNO |
| 5989 | |
| 5990 | |
| 5991 | eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len) |
| 5992 | { |
| 5993 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5994 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5995 | |
| 5996 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5997 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5998 | { |
| 5999 | status = csrGetCfgValidChannels(pMac, aValidChannels, len); |
| 6000 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6001 | } |
| 6002 | |
| 6003 | return (status); |
| 6004 | } |
| 6005 | |
| 6006 | |
| 6007 | /* --------------------------------------------------------------------------- |
| 6008 | |
| 6009 | \fn sme_SetTxPerTracking |
| 6010 | |
| 6011 | \brief Set Tx PER tracking configuration parameters |
| 6012 | |
| 6013 | \param hHal - The handle returned by macOpen. |
| 6014 | \param pTxPerTrackingConf - Tx PER configuration parameters |
| 6015 | |
| 6016 | \return eHalStatus |
| 6017 | |
| 6018 | -------------------------------------------------------------------------------*/ |
| 6019 | eHalStatus sme_SetTxPerTracking(tHalHandle hHal, |
| 6020 | void (*pCallbackfn) (void *pCallbackContext), |
| 6021 | void *pCallbackContext, |
| 6022 | tpSirTxPerTrackingParam pTxPerTrackingParam) |
| 6023 | { |
| 6024 | vos_msg_t msg; |
| 6025 | tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL; |
| 6026 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6027 | |
| 6028 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 6029 | { |
| 6030 | pMac->sme.pTxPerHitCallback = pCallbackfn; |
| 6031 | pMac->sme.pTxPerHitCbContext = pCallbackContext; |
| 6032 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6033 | } |
| 6034 | |
| 6035 | // free this memory in failure case or WDA request callback function |
| 6036 | pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam)); |
| 6037 | if (NULL == pTxPerTrackingParamReq) |
| 6038 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6039 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for tSirTxPerTrackingParam", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6040 | return eHAL_STATUS_FAILURE; |
| 6041 | } |
| 6042 | |
| 6043 | vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam)); |
| 6044 | msg.type = WDA_SET_TX_PER_TRACKING_REQ; |
| 6045 | msg.reserved = 0; |
| 6046 | msg.bodyptr = pTxPerTrackingParamReq; |
| 6047 | |
| 6048 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6049 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6050 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6051 | vos_mem_free(pTxPerTrackingParamReq); |
| 6052 | return eHAL_STATUS_FAILURE; |
| 6053 | } |
| 6054 | |
| 6055 | return eHAL_STATUS_SUCCESS; |
| 6056 | } |
| 6057 | |
| 6058 | /* --------------------------------------------------------------------------- |
| 6059 | |
| 6060 | \fn sme_HandleChangeCountryCode |
| 6061 | |
| 6062 | \brief Change Country code, Reg Domain and channel list |
| 6063 | |
| 6064 | \details Country Code Priority |
| 6065 | 0 = 11D > Configured Country > NV |
| 6066 | 1 = Configured Country > 11D > NV |
| 6067 | If Supplicant country code is priority than 11d is disabled. |
| 6068 | If 11D is enabled, we update the country code after every scan. |
| 6069 | Hence when Supplicant country code is priority, we don't need 11D info. |
| 6070 | Country code from Supplicant is set as current courtry code. |
| 6071 | User can send reset command XX (instead of country code) to reset the |
| 6072 | country code to default values which is read from NV. |
| 6073 | In case of reset, 11D is enabled and default NV code is Set as current country code |
| 6074 | If 11D is priority, |
| 6075 | Than Supplicant country code code is set to default code. But 11D code is set as current country code |
| 6076 | |
| 6077 | \param pMac - The handle returned by macOpen. |
| 6078 | \param pMsgBuf - MSG Buffer |
| 6079 | |
| 6080 | \return eHalStatus |
| 6081 | |
| 6082 | -------------------------------------------------------------------------------*/ |
| 6083 | eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf) |
| 6084 | { |
| 6085 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6086 | tAniChangeCountryCodeReq *pMsg; |
| 6087 | v_REGDOMAIN_t domainIdIoctl; |
| 6088 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 6089 | static uNvTables nvTables; |
| 6090 | pMsg = (tAniChangeCountryCodeReq *)pMsgBuf; |
| 6091 | |
| 6092 | |
| 6093 | /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */ |
| 6094 | if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) ) |
| 6095 | { |
| 6096 | pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 6097 | |
| 6098 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 6099 | |
| 6100 | /* read the country code from NV and use it */ |
| 6101 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 6102 | { |
| 6103 | palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN ); |
| 6104 | } |
| 6105 | else |
| 6106 | { |
| 6107 | status = eHAL_STATUS_FAILURE; |
| 6108 | return status; |
| 6109 | } |
| 6110 | } |
| 6111 | else |
| 6112 | { |
| 6113 | /* if Supplicant country code has priority, disable 11d */ |
| 6114 | if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority) |
| 6115 | { |
| 6116 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 6117 | } |
| 6118 | } |
| 6119 | |
| 6120 | /* WEXT set country code means |
| 6121 | * 11D should be supported? |
| 6122 | * 11D Channel should be enforced? |
| 6123 | * 11D Country code should be matched? |
| 6124 | * 11D Reg Domian should be matched? |
| 6125 | * Country string changed */ |
| 6126 | if(pMac->roam.configParam.Is11dSupportEnabled && |
| 6127 | pMac->roam.configParam.fEnforce11dChannels && |
| 6128 | pMac->roam.configParam.fEnforceCountryCodeMatch && |
| 6129 | pMac->roam.configParam.fEnforceDefaultDomain && |
| 6130 | !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE)) |
| 6131 | { |
| 6132 | /* All 11D related options are already enabled |
| 6133 | * Country string is not changed |
| 6134 | * Do not need do anything for country code change request */ |
| 6135 | return eHAL_STATUS_SUCCESS; |
| 6136 | } |
| 6137 | |
| 6138 | /* Set Current Country code and Current Regulatory domain */ |
| 6139 | status = csrSetCountryCode(pMac, pMsg->countryCode, NULL); |
| 6140 | if(eHAL_STATUS_SUCCESS != status) |
| 6141 | { |
| 6142 | /* Supplicant country code failed. So give 11D priority */ |
| 6143 | pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 6144 | smsLog(pMac, LOGE, "Set Country Code Fail %d", status); |
| 6145 | return status; |
| 6146 | } |
| 6147 | |
| 6148 | /* purge current scan results |
| 6149 | if i don't do this than I still get old ap's (of different country code) as available (even if they are powered off). |
| 6150 | Looks like a bug in current scan sequence. |
| 6151 | */ |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 6152 | csrScanFlushResult(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | |
| 6154 | /* overwrite the defualt country code */ |
| 6155 | palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 6156 | |
| 6157 | /* Get Domain ID from country code */ |
| 6158 | status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl ); |
| 6159 | if ( status != eHAL_STATUS_SUCCESS ) |
| 6160 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6161 | smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6162 | return status; |
| 6163 | } |
| 6164 | |
| 6165 | status = WDA_SetRegDomain(pMac, domainIdIoctl); |
| 6166 | |
| 6167 | if ( status != eHAL_STATUS_SUCCESS ) |
| 6168 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6169 | smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6170 | return status; |
| 6171 | } |
| 6172 | |
| 6173 | /* set to default domain ID */ |
| 6174 | pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent; |
| 6175 | |
| 6176 | /* get the channels based on new cc */ |
| 6177 | status = csrInitGetChannels( pMac ); |
| 6178 | |
| 6179 | if ( status != eHAL_STATUS_SUCCESS ) |
| 6180 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6181 | smsLog( pMac, LOGE, FL(" fail to get Channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6182 | return status; |
| 6183 | } |
| 6184 | |
| 6185 | /* reset info based on new cc, and we are done */ |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 6186 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6187 | if( pMsg->changeCCCallback ) |
| 6188 | { |
| 6189 | ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext); |
| 6190 | } |
| 6191 | |
| 6192 | return eHAL_STATUS_SUCCESS; |
| 6193 | } |
| 6194 | |
| 6195 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6196 | eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6197 | { |
| 6198 | tpSirRcvFltMcAddrList pRequestBuf; |
| 6199 | vos_msg_t msg; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6200 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6201 | tCsrRoamSession *pSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6202 | |
| 6203 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: " |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame^] | 6204 | "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6205 | pMulticastAddrs->ulMulticastAddrCnt, |
| 6206 | pMulticastAddrs->multicastAddr[0]); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6207 | |
| 6208 | /* |
| 6209 | *Find the connected Infra / P2P_client connected session |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6210 | */ |
| 6211 | if (CSR_IS_SESSION_VALID(pMac, sessionId) && |
| 6212 | csrIsConnStateInfra(pMac, sessionId)) |
| 6213 | { |
| 6214 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6215 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6216 | |
| 6217 | if(pSession == NULL ) |
| 6218 | { |
| 6219 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6220 | "the right session", __func__); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6221 | return eHAL_STATUS_FAILURE; |
| 6222 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6223 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6224 | pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
| 6225 | if (NULL == pRequestBuf) |
| 6226 | { |
| 6227 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6228 | "allocate memory for 8023 Multicast List request", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6229 | return eHAL_STATUS_FAILED_ALLOC; |
| 6230 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6231 | |
| 6232 | if( !csrIsConnStateConnectedInfra (pMac, sessionId )) |
| 6233 | { |
| 6234 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the " |
| 6235 | "indication as we are not connected", __func__); |
| 6236 | vos_mem_free(pRequestBuf); |
| 6237 | return eHAL_STATUS_FAILURE; |
| 6238 | } |
| 6239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6240 | vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList)); |
| 6241 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6242 | vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
| 6243 | vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid, |
| 6244 | sizeof(tSirMacAddr)); |
| 6245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6246 | msg.type = WDA_8023_MULTICAST_LIST_REQ; |
| 6247 | msg.reserved = 0; |
| 6248 | msg.bodyptr = pRequestBuf; |
| 6249 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6250 | { |
| 6251 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6252 | "post WDA_8023_MULTICAST_LIST message to WDA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6253 | vos_mem_free(pRequestBuf); |
| 6254 | return eHAL_STATUS_FAILURE; |
| 6255 | } |
| 6256 | |
| 6257 | return eHAL_STATUS_SUCCESS; |
| 6258 | } |
| 6259 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6260 | eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg, |
| 6261 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | { |
| 6263 | tpSirRcvPktFilterCfgType pRequestBuf; |
| 6264 | v_SINT_t allocSize; |
| 6265 | vos_msg_t msg; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6266 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6267 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6268 | v_U8_t idx=0; |
| 6269 | |
| 6270 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6271 | "filterId = %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6272 | pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId); |
| 6273 | |
Madan Mohan Koyyalamudi | d402962 | 2012-10-18 20:30:17 -0700 | [diff] [blame] | 6274 | allocSize = sizeof(tSirRcvPktFilterCfgType); |
| 6275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6276 | pRequestBuf = vos_mem_malloc(allocSize); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6277 | |
| 6278 | if (NULL == pRequestBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6279 | { |
| 6280 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6281 | "allocate memory for Receive Filter Set Filter request", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6282 | return eHAL_STATUS_FAILED_ALLOC; |
| 6283 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6284 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6285 | if( NULL == pSession ) |
| 6286 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6287 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6288 | vos_mem_free(pRequestBuf); |
| 6289 | return eHAL_STATUS_FAILURE; |
| 6290 | } |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6291 | |
| 6292 | vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
| 6293 | vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6294 | sizeof(tSirMacAddr)); |
| 6295 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6296 | vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize); |
| 6297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6298 | msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ; |
| 6299 | msg.reserved = 0; |
| 6300 | msg.bodyptr = pRequestBuf; |
| 6301 | |
| 6302 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : " |
| 6303 | "FT %d FID %d ", |
| 6304 | pRequestBuf->filterType, pRequestBuf->filterId); |
| 6305 | |
| 6306 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : " |
| 6307 | "params %d CT %d", |
| 6308 | pRequestBuf->numFieldParams, pRequestBuf->coalesceTime); |
| 6309 | |
| 6310 | for (idx=0; idx<pRequestBuf->numFieldParams; idx++) |
| 6311 | { |
| 6312 | |
| 6313 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6314 | "Proto %d Comp Flag %d ", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6315 | pRequestBuf->paramsData[idx].protocolLayer, |
| 6316 | pRequestBuf->paramsData[idx].cmpFlag); |
| 6317 | |
| 6318 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6319 | "Data Offset %d Data Len %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6320 | pRequestBuf->paramsData[idx].dataOffset, |
| 6321 | pRequestBuf->paramsData[idx].dataLength); |
| 6322 | |
| 6323 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6324 | "CData: %d:%d:%d:%d:%d:%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6325 | pRequestBuf->paramsData[idx].compareData[0], |
| 6326 | pRequestBuf->paramsData[idx].compareData[1], |
| 6327 | pRequestBuf->paramsData[idx].compareData[2], |
| 6328 | pRequestBuf->paramsData[idx].compareData[3], |
| 6329 | pRequestBuf->paramsData[idx].compareData[4], |
| 6330 | pRequestBuf->paramsData[idx].compareData[5]); |
| 6331 | |
| 6332 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6333 | "MData: %d:%d:%d:%d:%d:%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6334 | pRequestBuf->paramsData[idx].dataMask[0], |
| 6335 | pRequestBuf->paramsData[idx].dataMask[1], |
| 6336 | pRequestBuf->paramsData[idx].dataMask[2], |
| 6337 | pRequestBuf->paramsData[idx].dataMask[3], |
| 6338 | pRequestBuf->paramsData[idx].dataMask[4], |
| 6339 | pRequestBuf->paramsData[idx].dataMask[5]); |
| 6340 | |
| 6341 | } |
| 6342 | |
| 6343 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6344 | { |
| 6345 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6346 | "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6347 | vos_mem_free(pRequestBuf); |
| 6348 | return eHAL_STATUS_FAILURE; |
| 6349 | } |
| 6350 | |
| 6351 | return eHAL_STATUS_SUCCESS; |
| 6352 | } |
| 6353 | |
| 6354 | eHalStatus sme_GetFilterMatchCount(tHalHandle hHal, |
| 6355 | FilterMatchCountCallback callbackRoutine, |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6356 | void *callbackContext, |
| 6357 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6358 | { |
| 6359 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6360 | eHalStatus status; |
| 6361 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6362 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6363 | |
| 6364 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme))) |
| 6365 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6366 | pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6367 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6368 | } |
| 6369 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6370 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6371 | |
| 6372 | return (status); |
| 6373 | } |
| 6374 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6375 | eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam, |
| 6376 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6377 | { |
| 6378 | tpSirRcvFltPktClearParam pRequestBuf; |
| 6379 | vos_msg_t msg; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6380 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6381 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6382 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6383 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6384 | pRcvFltPktClearParam->filterId); |
| 6385 | |
| 6386 | pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam)); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6387 | if (NULL == pRequestBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6388 | { |
| 6389 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 6390 | "%s: Not able to allocate memory for Receive Filter " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6391 | "Clear Filter request", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6392 | return eHAL_STATUS_FAILED_ALLOC; |
| 6393 | } |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6394 | if( NULL == pSession ) |
| 6395 | { |
| 6396 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6397 | "%s: Session Not find ", __func__); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6398 | vos_mem_free(pRequestBuf); |
| 6399 | return eHAL_STATUS_FAILURE; |
| 6400 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6401 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6402 | vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
| 6403 | vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6404 | sizeof(tSirMacAddr)); |
| 6405 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6406 | vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam)); |
| 6407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ; |
| 6409 | msg.reserved = 0; |
| 6410 | msg.bodyptr = pRequestBuf; |
| 6411 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6412 | { |
| 6413 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6414 | "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6415 | vos_mem_free(pRequestBuf); |
| 6416 | return eHAL_STATUS_FAILURE; |
| 6417 | } |
| 6418 | |
| 6419 | return eHAL_STATUS_SUCCESS; |
| 6420 | } |
| 6421 | #endif // WLAN_FEATURE_PACKET_FILTERING |
| 6422 | |
| 6423 | /* --------------------------------------------------------------------------- |
| 6424 | \fn sme_PreChannelSwitchIndFullPowerCB |
| 6425 | \brief call back function for the PMC full power request because of pre |
| 6426 | channel switch. |
| 6427 | \param callbackContext |
| 6428 | \param status |
| 6429 | ---------------------------------------------------------------------------*/ |
| 6430 | void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext, |
| 6431 | eHalStatus status) |
| 6432 | { |
| 6433 | tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext; |
| 6434 | tSirMbMsg *pMsg; |
| 6435 | tANI_U16 msgLen; |
| 6436 | |
| 6437 | msgLen = (tANI_U16)(sizeof( tSirMbMsg )); |
| 6438 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 6439 | if(HAL_STATUS_SUCCESS(status)) |
| 6440 | { |
| 6441 | palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen); |
| 6442 | pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER); |
| 6443 | pMsg->msgLen = pal_cpu_to_be16(msgLen); |
| 6444 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 6445 | } |
| 6446 | |
| 6447 | return; |
| 6448 | } |
| 6449 | |
| 6450 | /* --------------------------------------------------------------------------- |
| 6451 | \fn sme_HandlePreChannelSwitchInd |
| 6452 | \brief Processes the indcation from PE for pre-channel switch. |
| 6453 | \param hHal |
| 6454 | \- The handle returned by macOpen. return eHalStatus |
| 6455 | ---------------------------------------------------------------------------*/ |
| 6456 | eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal) |
| 6457 | { |
| 6458 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6459 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6460 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6461 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6462 | { |
| 6463 | status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB, |
| 6464 | pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH); |
| 6465 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6466 | } |
| 6467 | |
| 6468 | return (status); |
| 6469 | } |
| 6470 | |
| 6471 | /* --------------------------------------------------------------------------- |
| 6472 | \fn sme_HandlePostChannelSwitchInd |
| 6473 | \brief Processes the indcation from PE for post-channel switch. |
| 6474 | \param hHal |
| 6475 | \- The handle returned by macOpen. return eHalStatus |
| 6476 | ---------------------------------------------------------------------------*/ |
| 6477 | eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal) |
| 6478 | { |
| 6479 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6480 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6481 | |
| 6482 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6483 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6484 | { |
| 6485 | status = pmcRequestBmps(hHal, NULL, NULL); |
| 6486 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6487 | } |
| 6488 | |
| 6489 | return (status); |
| 6490 | } |
| 6491 | |
| 6492 | /* --------------------------------------------------------------------------- |
| 6493 | |
| 6494 | \fn sme_IsChannelValid |
| 6495 | |
| 6496 | \brief To check if the channel is valid for currently established domain |
| 6497 | This is a synchronous API. |
| 6498 | |
| 6499 | \param hHal - The handle returned by macOpen. |
| 6500 | \param channel - channel to verify |
| 6501 | |
| 6502 | \return TRUE/FALSE, TRUE if channel is valid |
| 6503 | |
| 6504 | -------------------------------------------------------------------------------*/ |
| 6505 | tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel) |
| 6506 | { |
| 6507 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6508 | tANI_BOOLEAN valid = FALSE; |
| 6509 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6510 | |
| 6511 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6512 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6513 | { |
| 6514 | |
| 6515 | valid = csrRoamIsChannelValid( pMac, channel); |
| 6516 | |
| 6517 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6518 | } |
| 6519 | |
| 6520 | return (valid); |
| 6521 | } |
| 6522 | |
| 6523 | /* --------------------------------------------------------------------------- |
| 6524 | \fn sme_SetFreqBand |
| 6525 | \brief Used to set frequency band. |
| 6526 | \param hHal |
| 6527 | \eBand band value to be configured |
| 6528 | \- return eHalStatus |
| 6529 | -------------------------------------------------------------------------*/ |
| 6530 | eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand) |
| 6531 | { |
| 6532 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6533 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6534 | |
| 6535 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6536 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6537 | { |
| 6538 | status = csrSetBand(hHal, eBand); |
| 6539 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6540 | } |
| 6541 | return status; |
| 6542 | } |
| 6543 | |
| 6544 | /* --------------------------------------------------------------------------- |
| 6545 | \fn sme_GetFreqBand |
| 6546 | \brief Used to get the current band settings. |
| 6547 | \param hHal |
| 6548 | \pBand pointer to hold band value |
| 6549 | \- return eHalStatus |
| 6550 | -------------------------------------------------------------------------*/ |
| 6551 | eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand) |
| 6552 | { |
| 6553 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6554 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6555 | |
| 6556 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6557 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6558 | { |
| 6559 | *pBand = csrGetCurrentBand( hHal ); |
| 6560 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6561 | } |
| 6562 | return status; |
| 6563 | } |
| 6564 | |
| 6565 | #ifdef WLAN_WAKEUP_EVENTS |
| 6566 | /****************************************************************************** |
| 6567 | \fn sme_WakeReasonIndCallback |
| 6568 | |
| 6569 | \brief |
| 6570 | a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA |
| 6571 | |
| 6572 | \param hHal - HAL handle for device |
| 6573 | \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter |
| 6574 | |
| 6575 | \return eHalStatus |
| 6576 | ******************************************************************************/ |
| 6577 | eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg) |
| 6578 | { |
| 6579 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6580 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6581 | tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg; |
| 6582 | |
| 6583 | if (NULL == pMsg) |
| 6584 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6585 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6586 | status = eHAL_STATUS_FAILURE; |
| 6587 | } |
| 6588 | else |
| 6589 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6590 | smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6591 | |
| 6592 | /* Call Wake Reason Indication callback routine. */ |
| 6593 | if (pMac->pmc.wakeReasonIndCB != NULL) |
| 6594 | pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd); |
| 6595 | |
| 6596 | pMac->pmc.wakeReasonIndCB = NULL; |
| 6597 | pMac->pmc.wakeReasonIndCBContext = NULL; |
| 6598 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6599 | smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6600 | } |
| 6601 | |
| 6602 | return(status); |
| 6603 | } |
| 6604 | #endif // WLAN_WAKEUP_EVENTS |
| 6605 | |
| 6606 | |
| 6607 | /* --------------------------------------------------------------------------- |
| 6608 | |
| 6609 | \fn sme_SetMaxTxPower |
| 6610 | |
| 6611 | \brief Set the Maximum Transmit Power dynamically. Note: this setting will |
| 6612 | not persist over reboots. |
| 6613 | |
| 6614 | \param hHal |
| 6615 | \param pBssid BSSID to set the power cap for |
| 6616 | \param pBssid pSelfMacAddress self MAC Address |
| 6617 | \param pBssid power to set in dB |
| 6618 | \- return eHalStatus |
| 6619 | |
| 6620 | -------------------------------------------------------------------------------*/ |
| 6621 | eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid, |
| 6622 | tSirMacAddr pSelfMacAddress, v_S7_t dB) |
| 6623 | { |
| 6624 | vos_msg_t msg; |
| 6625 | tpMaxTxPowerParams pMaxTxParams = NULL; |
| 6626 | |
| 6627 | pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams)); |
| 6628 | if (NULL == pMaxTxParams) |
| 6629 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6630 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for pMaxTxParams", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | return eHAL_STATUS_FAILURE; |
| 6632 | } |
| 6633 | |
| 6634 | vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH); |
| 6635 | vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress, |
| 6636 | SIR_MAC_ADDR_LENGTH); |
| 6637 | pMaxTxParams->power = dB; |
| 6638 | |
| 6639 | msg.type = WDA_SET_MAX_TX_POWER_REQ; |
| 6640 | msg.reserved = 0; |
| 6641 | msg.bodyptr = pMaxTxParams; |
| 6642 | |
| 6643 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6644 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6645 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | vos_mem_free(pMaxTxParams); |
| 6647 | return eHAL_STATUS_FAILURE; |
| 6648 | } |
| 6649 | |
| 6650 | return eHAL_STATUS_SUCCESS; |
| 6651 | } |
| 6652 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6653 | /* --------------------------------------------------------------------------- |
| 6654 | |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 6655 | \fn sme_SetTxPower |
| 6656 | |
| 6657 | \brief Set Transmit Power dynamically. Note: this setting will |
| 6658 | not persist over reboots. |
| 6659 | |
| 6660 | \param hHal |
| 6661 | \param sessionId Target Session ID |
| 6662 | \param mW power to set in mW |
| 6663 | \- return eHalStatus |
| 6664 | |
| 6665 | -------------------------------------------------------------------------------*/ |
| 6666 | eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW) |
| 6667 | { |
| 6668 | |
| 6669 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6670 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6671 | |
| 6672 | smsLog(pMac, LOG1, FL("set tx power %dmW"), mW); |
| 6673 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 6674 | if (HAL_STATUS_SUCCESS(status)) |
| 6675 | { |
| 6676 | status = csrSetTxPower(pMac, sessionId, mW); |
| 6677 | sme_ReleaseGlobalLock(&pMac->sme); |
| 6678 | } |
| 6679 | return status; |
| 6680 | } |
| 6681 | |
| 6682 | /* --------------------------------------------------------------------------- |
| 6683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6684 | \fn sme_HideSSID |
| 6685 | |
| 6686 | \brief hide/show SSID dynamically. Note: this setting will |
| 6687 | not persist over reboots. |
| 6688 | |
| 6689 | \param hHal |
| 6690 | \param sessionId |
| 6691 | \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID |
| 6692 | \- return eHalStatus |
| 6693 | |
| 6694 | -------------------------------------------------------------------------------*/ |
| 6695 | eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden) |
| 6696 | { |
| 6697 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6698 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6699 | tANI_U16 len; |
| 6700 | |
| 6701 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 6702 | { |
| 6703 | tpSirUpdateParams pMsg; |
| 6704 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6705 | |
| 6706 | if(!pSession) |
| 6707 | { |
| 6708 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 6709 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6710 | return eHAL_STATUS_FAILURE; |
| 6711 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6712 | |
| 6713 | if( !pSession->sessionActive ) |
| 6714 | VOS_ASSERT(0); |
| 6715 | |
| 6716 | /* Create the message and send to lim */ |
| 6717 | len = sizeof(tSirUpdateParams); |
| 6718 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 6719 | if(HAL_STATUS_SUCCESS(status)) |
| 6720 | { |
| 6721 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) ); |
| 6722 | pMsg->messageType = eWNI_SME_HIDE_SSID_REQ; |
| 6723 | pMsg->length = len; |
| 6724 | /* Data starts from here */ |
| 6725 | pMsg->sessionId = sessionId; |
| 6726 | pMsg->ssidHidden = ssidHidden; |
| 6727 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 6728 | } |
| 6729 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6730 | } |
| 6731 | return status; |
| 6732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6733 | |
| 6734 | /* --------------------------------------------------------------------------- |
| 6735 | |
| 6736 | \fn sme_SetTmLevel |
| 6737 | \brief Set Thermal Mitigation Level to RIVA |
| 6738 | \param hHal - The handle returned by macOpen. |
| 6739 | \param newTMLevel - new Thermal Mitigation Level |
| 6740 | \param tmMode - Thermal Mitigation handle mode, default 0 |
| 6741 | \return eHalStatus |
| 6742 | ---------------------------------------------------------------------------*/ |
| 6743 | eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode) |
| 6744 | { |
| 6745 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6746 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 6747 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6748 | vos_msg_t vosMessage; |
| 6749 | tAniSetTmLevelReq *setTmLevelReq = NULL; |
| 6750 | |
| 6751 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 6752 | { |
| 6753 | setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq)); |
| 6754 | if(NULL == setTmLevelReq) |
| 6755 | { |
| 6756 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6757 | "%s: Not able to allocate memory for sme_SetTmLevel", __func__); |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 6758 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6759 | return eHAL_STATUS_FAILURE; |
| 6760 | } |
| 6761 | |
| 6762 | setTmLevelReq->tmMode = tmMode; |
| 6763 | setTmLevelReq->newTmLevel = newTMLevel; |
| 6764 | |
| 6765 | /* serialize the req through MC thread */ |
| 6766 | vosMessage.bodyptr = setTmLevelReq; |
| 6767 | vosMessage.type = WDA_SET_TM_LEVEL_REQ; |
| 6768 | vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ); |
| 6769 | if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 6770 | { |
| 6771 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6772 | "%s: Post Set TM Level MSG fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6773 | vos_mem_free(setTmLevelReq); |
| 6774 | status = eHAL_STATUS_FAILURE; |
| 6775 | } |
| 6776 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6777 | } |
| 6778 | return(status); |
| 6779 | } |
| 6780 | |
| 6781 | /*--------------------------------------------------------------------------- |
| 6782 | |
| 6783 | \brief sme_featureCapsExchange() - SME interface to exchange capabilities between |
| 6784 | Host and FW. |
| 6785 | |
| 6786 | \param hHal - HAL handle for device |
| 6787 | |
| 6788 | \return NONE |
| 6789 | |
| 6790 | ---------------------------------------------------------------------------*/ |
| 6791 | void sme_featureCapsExchange( tHalHandle hHal) |
| 6792 | { |
| 6793 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 6794 | WDA_featureCapsExchange(vosContext); |
| 6795 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 6796 | |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 6797 | /*--------------------------------------------------------------------------- |
| 6798 | |
| 6799 | \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity |
| 6800 | in Host. |
| 6801 | |
| 6802 | \param hHal - HAL handle for device |
| 6803 | |
| 6804 | \return NONE |
| 6805 | |
| 6806 | ---------------------------------------------------------------------------*/ |
| 6807 | void sme_disableFeatureCapablity(tANI_U8 feature_index) |
| 6808 | { |
| 6809 | WDA_disableCapablityFeature(feature_index); |
| 6810 | } |
| 6811 | |
| 6812 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 6813 | |
| 6814 | /* --------------------------------------------------------------------------- |
| 6815 | |
| 6816 | \fn sme_GetDefaultCountryCode |
| 6817 | |
| 6818 | \brief Get the default country code from NV |
| 6819 | |
| 6820 | \param hHal |
| 6821 | \param pCountry |
| 6822 | \- return eHalStatus |
| 6823 | |
| 6824 | -------------------------------------------------------------------------------*/ |
| 6825 | eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry) |
| 6826 | { |
| 6827 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6828 | return csrGetDefaultCountryCodeFrmNv(pMac, pCountry); |
| 6829 | } |
| 6830 | |
| 6831 | /* --------------------------------------------------------------------------- |
| 6832 | |
| 6833 | \fn sme_GetCurrentCountryCode |
| 6834 | |
| 6835 | \brief Get the current country code |
| 6836 | |
| 6837 | \param hHal |
| 6838 | \param pCountry |
| 6839 | \- return eHalStatus |
| 6840 | |
| 6841 | -------------------------------------------------------------------------------*/ |
| 6842 | eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry) |
| 6843 | { |
| 6844 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6845 | return csrGetCurrentCountryCode(pMac, pCountry); |
| 6846 | } |
| 6847 | |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 6848 | /* --------------------------------------------------------------------------- |
| 6849 | \fn sme_transportDebug |
| 6850 | \brief Dynamically monitoring Transport channels |
| 6851 | Private IOCTL will querry transport channel status if driver loaded |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 6852 | \param hHal Upper MAC context |
Jeff Johnson | b88db98 | 2012-12-10 13:34:59 -0800 | [diff] [blame] | 6853 | \param displaySnapshot Display transport channel snapshot option |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 6854 | \param toggleStallDetect Enable stall detect feature |
| 6855 | This feature will take effect to data performance |
| 6856 | Not integrate till fully verification |
| 6857 | \- return NONE |
| 6858 | -------------------------------------------------------------------------*/ |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 6859 | void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect) |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 6860 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 6861 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6862 | |
| 6863 | if (NULL == pMac) |
| 6864 | { |
| 6865 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 6866 | "%s: invalid context", __func__); |
| 6867 | return; |
| 6868 | } |
| 6869 | WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 6870 | } |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 6871 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 6872 | /* --------------------------------------------------------------------------- |
| 6873 | \fn sme_ResetPowerValuesFor5G |
| 6874 | \brief Reset the power values for 5G band with NV power values. |
| 6875 | \param hHal - HAL handle for device |
| 6876 | \- return NONE |
| 6877 | -------------------------------------------------------------------------*/ |
| 6878 | void sme_ResetPowerValuesFor5G (tHalHandle hHal) |
| 6879 | { |
| 6880 | tpAniSirGlobal pMac = PMAC_STRUCT (hHal); |
| 6881 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
| 6882 | csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg |
| 6883 | } |
| 6884 | |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 6885 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 6886 | /* --------------------------------------------------------------------------- |
| 6887 | \fn sme_UpdateRoamPrefer5GHz |
| 6888 | \brief enable/disable Roam prefer 5G runtime option |
| 6889 | This function is called through dynamic setConfig callback function |
| 6890 | to configure the Roam prefer 5G runtime option |
| 6891 | \param hHal - HAL handle for device |
| 6892 | \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option |
| 6893 | \- return Success or failure |
| 6894 | -------------------------------------------------------------------------*/ |
| 6895 | |
| 6896 | eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz) |
| 6897 | { |
| 6898 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 6899 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6900 | |
| 6901 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6902 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6903 | { |
| 6904 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6905 | "%s: gRoamPrefer5GHz is changed from %d to %d", __func__, |
| 6906 | pMac->roam.configParam.nRoamPrefer5GHz, |
| 6907 | nRoamPrefer5GHz); |
| 6908 | pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz; |
| 6909 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6910 | } |
| 6911 | |
| 6912 | return status ; |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 6913 | } |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 6914 | |
| 6915 | /* --------------------------------------------------------------------------- |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 6916 | \fn sme_setRoamIntraBand |
| 6917 | \brief enable/disable Intra band roaming |
| 6918 | This function is called through dynamic setConfig callback function |
| 6919 | to configure the intra band roaming |
| 6920 | \param hHal - HAL handle for device |
| 6921 | \param nRoamIntraBand Enable/Disable Intra band roaming |
| 6922 | \- return Success or failure |
| 6923 | -------------------------------------------------------------------------*/ |
| 6924 | eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand) |
| 6925 | { |
| 6926 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6927 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6928 | |
| 6929 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6930 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6931 | { |
| 6932 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6933 | "%s: gRoamIntraBand is changed from %d to %d", __func__, |
| 6934 | pMac->roam.configParam.nRoamIntraBand, |
| 6935 | nRoamIntraBand); |
| 6936 | pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand; |
| 6937 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6938 | } |
| 6939 | |
| 6940 | return status ; |
| 6941 | } |
| 6942 | |
| 6943 | /* --------------------------------------------------------------------------- |
| 6944 | \fn sme_getRoamIntraBand |
| 6945 | \brief get Intra band roaming |
| 6946 | \param hHal - HAL handle for device |
| 6947 | \- return Success or failure |
| 6948 | -------------------------------------------------------------------------*/ |
| 6949 | v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal) |
| 6950 | { |
| 6951 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6952 | return pMac->roam.configParam.nRoamIntraBand; |
| 6953 | } |
| 6954 | |
| 6955 | |
| 6956 | /* --------------------------------------------------------------------------- |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 6957 | \fn sme_UpdateImmediateRoamRssiDiff |
| 6958 | \brief Update nImmediateRoamRssiDiff |
| 6959 | This function is called through dynamic setConfig callback function |
| 6960 | to configure nImmediateRoamRssiDiff |
| 6961 | Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125] |
| 6962 | \param hHal - HAL handle for device |
| 6963 | \param nImmediateRoamRssiDiff - minimum rssi difference between potential |
| 6964 | candidate and current AP. |
| 6965 | \- return Success or failure |
| 6966 | -------------------------------------------------------------------------*/ |
| 6967 | |
| 6968 | eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff) |
| 6969 | { |
| 6970 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 6971 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6972 | |
| 6973 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6974 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6975 | { |
| 6976 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 6977 | "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d", |
| 6978 | nImmediateRoamRssiDiff, |
| 6979 | pMac->roam.configParam.nImmediateRoamRssiDiff, |
| 6980 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 6981 | pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff; |
| 6982 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6983 | } |
| 6984 | |
| 6985 | return status ; |
| 6986 | } |
| 6987 | |
| 6988 | /* --------------------------------------------------------------------------- |
| 6989 | \fn sme_UpdateRoamRssiDiff |
| 6990 | \brief Update RoamRssiDiff |
| 6991 | This function is called through dynamic setConfig callback function |
| 6992 | to configure RoamRssiDiff |
| 6993 | Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125] |
| 6994 | \param hHal - HAL handle for device |
| 6995 | \param RoamRssiDiff - minimum rssi difference between potential |
| 6996 | candidate and current AP. |
| 6997 | \- return Success or failure |
| 6998 | -------------------------------------------------------------------------*/ |
| 6999 | |
| 7000 | eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff) |
| 7001 | { |
| 7002 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7003 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7004 | |
| 7005 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7006 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7007 | { |
| 7008 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7009 | "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d", |
| 7010 | RoamRssiDiff, |
| 7011 | pMac->roam.configParam.RoamRssiDiff, |
| 7012 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7013 | pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff; |
| 7014 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7015 | } |
| 7016 | |
| 7017 | return status ; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 7018 | } |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7019 | |
| 7020 | /*-------------------------------------------------------------------------- |
| 7021 | \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime |
| 7022 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7023 | isFastTransitionEnabled. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7024 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7025 | \param hHal - The handle returned by macOpen. |
| 7026 | \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully. |
| 7027 | Other status means SME is failed to update isFastTransitionEnabled. |
| 7028 | \sa |
| 7029 | --------------------------------------------------------------------------*/ |
| 7030 | eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal, |
| 7031 | v_BOOL_t isFastTransitionEnabled) |
| 7032 | { |
| 7033 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7034 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7035 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7036 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7037 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7038 | { |
| 7039 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7040 | "%s: FastTransitionEnabled is changed from %d to %d", __func__, |
| 7041 | pMac->roam.configParam.isFastTransitionEnabled, |
| 7042 | isFastTransitionEnabled); |
| 7043 | pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled; |
| 7044 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7045 | } |
| 7046 | |
| 7047 | return status ; |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7048 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7049 | |
| 7050 | /* --------------------------------------------------------------------------- |
| 7051 | \fn sme_UpdateWESMode |
| 7052 | \brief Update WES Mode |
| 7053 | This function is called through dynamic setConfig callback function |
| 7054 | to configure isWESModeEnabled |
| 7055 | \param hHal - HAL handle for device |
| 7056 | \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully. |
| 7057 | Other status means SME is failed to update isWESModeEnabled. |
| 7058 | -------------------------------------------------------------------------*/ |
| 7059 | |
| 7060 | eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled) |
| 7061 | { |
| 7062 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7063 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7064 | |
| 7065 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7066 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7067 | { |
| 7068 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7069 | "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d", |
| 7070 | isWESModeEnabled, |
| 7071 | pMac->roam.configParam.isWESModeEnabled, |
| 7072 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7073 | pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled; |
| 7074 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7075 | } |
| 7076 | |
| 7077 | return status ; |
| 7078 | } |
| 7079 | |
| 7080 | /* --------------------------------------------------------------------------- |
| 7081 | \fn sme_SetRoamScanControl |
| 7082 | \brief Set roam scan control |
| 7083 | This function is called to set roam scan control |
| 7084 | if roam scan control is set to 0, roaming scan cache is cleared |
| 7085 | any value other than 0 is treated as invalid value |
| 7086 | \param hHal - HAL handle for device |
| 7087 | \return eHAL_STATUS_SUCCESS - SME update config successfully. |
| 7088 | Other status means SME failure to update |
| 7089 | -------------------------------------------------------------------------*/ |
| 7090 | eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl) |
| 7091 | { |
| 7092 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7093 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7094 | |
| 7095 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7096 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7097 | { |
| 7098 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7099 | "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d", |
| 7100 | roamScanControl, |
| 7101 | pMac->roam.configParam.nRoamScanControl, |
| 7102 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7103 | pMac->roam.configParam.nRoamScanControl = roamScanControl; |
| 7104 | if ( 0 == roamScanControl) |
| 7105 | { |
| 7106 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7107 | "LFR runtime successfully cleared roam scan cache"); |
| 7108 | csrFlushBgScanRoamChannelList(pMac); |
| 7109 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7110 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7111 | { |
| 7112 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST); |
| 7113 | } |
| 7114 | #endif |
| 7115 | } |
| 7116 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7117 | } |
| 7118 | return status ; |
| 7119 | } |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7120 | #endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */ |
| 7121 | |
| 7122 | #ifdef FEATURE_WLAN_LFR |
| 7123 | /*-------------------------------------------------------------------------- |
| 7124 | \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime |
| 7125 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7126 | isFastRoamIniFeatureEnabled. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7127 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7128 | \param hHal - The handle returned by macOpen. |
| 7129 | \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully. |
| 7130 | Other status means SME is failed to update isFastRoamIniFeatureEnabled. |
| 7131 | \sa |
| 7132 | --------------------------------------------------------------------------*/ |
| 7133 | eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal, |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7134 | const v_BOOL_t isFastRoamIniFeatureEnabled) |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7135 | { |
| 7136 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7137 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7138 | if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled) |
| 7139 | { |
| 7140 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7141 | "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__, |
| 7142 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 7143 | isFastRoamIniFeatureEnabled); |
| 7144 | return eHAL_STATUS_SUCCESS; |
| 7145 | } |
| 7146 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7147 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7148 | "%s: FastRoamEnabled is changed from %d to %d", __func__, |
| 7149 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 7150 | isFastRoamIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7151 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7152 | csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7153 | |
| 7154 | if(TRUE == isFastRoamIniFeatureEnabled) |
| 7155 | { |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7156 | sme_UpdateConfigFwRssiMonitoring(hHal, TRUE); |
| 7157 | } |
| 7158 | else |
| 7159 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7160 | /* CCX also depend on FW Monitoring. |
| 7161 | Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */ |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7162 | #ifdef FEATURE_WLAN_CCX |
| 7163 | if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled) |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 7164 | #endif |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7165 | { |
| 7166 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7167 | "%s: Turn off FW Monitoring", __func__); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7168 | sme_UpdateConfigFwRssiMonitoring(hHal, FALSE); |
| 7169 | } |
| 7170 | } |
| 7171 | |
| 7172 | return eHAL_STATUS_SUCCESS; |
| 7173 | } |
| 7174 | #endif /* FEATURE_WLAN_LFR */ |
| 7175 | |
| 7176 | #ifdef FEATURE_WLAN_CCX |
| 7177 | /*-------------------------------------------------------------------------- |
| 7178 | \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime |
| 7179 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7180 | isCcxIniFeatureEnabled. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7181 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7182 | \param hHal - The handle returned by macOpen. |
| 7183 | \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully. |
| 7184 | Other status means SME is failed to update isCcxIniFeatureEnabled. |
| 7185 | \sa |
| 7186 | --------------------------------------------------------------------------*/ |
| 7187 | |
| 7188 | eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal, |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7189 | const v_BOOL_t isCcxIniFeatureEnabled) |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7190 | { |
| 7191 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7192 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7193 | if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled) |
| 7194 | { |
| 7195 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7196 | "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__, |
| 7197 | pMac->roam.configParam.isCcxIniFeatureEnabled, |
| 7198 | isCcxIniFeatureEnabled); |
| 7199 | return eHAL_STATUS_SUCCESS; |
| 7200 | } |
| 7201 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7202 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7203 | "%s: CcxEnabled is changed from %d to %d", __func__, |
| 7204 | pMac->roam.configParam.isCcxIniFeatureEnabled, |
| 7205 | isCcxIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7206 | pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7207 | csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7208 | |
| 7209 | if(TRUE == isCcxIniFeatureEnabled) |
| 7210 | { |
| 7211 | sme_UpdateFastTransitionEnabled(hHal, TRUE); |
| 7212 | sme_UpdateConfigFwRssiMonitoring(hHal, TRUE); |
| 7213 | } |
| 7214 | else |
| 7215 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7216 | /* LFR also depend on FW Monitoring. |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7217 | Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */ |
| 7218 | #ifdef FEATURE_WLAN_LFR |
| 7219 | if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled) |
| 7220 | #endif |
| 7221 | { |
| 7222 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7223 | "%s: Turn off FW Monitoring/Fast Transition", __func__); |
| 7224 | sme_UpdateFastTransitionEnabled(hHal, FALSE); |
| 7225 | sme_UpdateConfigFwRssiMonitoring(hHal, FALSE); |
| 7226 | } |
| 7227 | } |
| 7228 | return eHAL_STATUS_SUCCESS; |
| 7229 | } |
| 7230 | #endif /* FEATURE_WLAN_CCX */ |
| 7231 | |
| 7232 | /*-------------------------------------------------------------------------- |
| 7233 | \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime |
| 7234 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7235 | fEnableFwRssiMonitoring. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7236 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7237 | \param hHal - The handle returned by macOpen. |
| 7238 | \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully. |
| 7239 | Other status means SME is failed to update fEnableFwRssiMonitoring. |
| 7240 | \sa |
| 7241 | --------------------------------------------------------------------------*/ |
| 7242 | |
| 7243 | eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal, |
| 7244 | v_BOOL_t fEnableFwRssiMonitoring) |
| 7245 | { |
| 7246 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 7247 | |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7248 | if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring, |
| 7249 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 7250 | { |
| 7251 | halStatus = eHAL_STATUS_FAILURE; |
| 7252 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 7253 | "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM"); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7254 | } |
| 7255 | |
| 7256 | return (halStatus); |
| 7257 | } |
| 7258 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7259 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7260 | /*-------------------------------------------------------------------------- |
| 7261 | \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold |
| 7262 | This is a synchronous call |
| 7263 | \param hHal - The handle returned by macOpen. |
| 7264 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7265 | Other status means SME is failed to update |
| 7266 | \sa |
| 7267 | --------------------------------------------------------------------------*/ |
| 7268 | eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal, |
| 7269 | v_U8_t neighborLookupRssiThreshold) |
| 7270 | { |
| 7271 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7272 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7273 | |
| 7274 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7275 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7276 | { |
| 7277 | status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold); |
| 7278 | if (HAL_STATUS_SUCCESS(status)) |
| 7279 | { |
| 7280 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7281 | "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d", |
| 7282 | neighborLookupRssiThreshold, |
| 7283 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold, |
| 7284 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7285 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = |
| 7286 | neighborLookupRssiThreshold; |
| 7287 | } |
| 7288 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7289 | } |
| 7290 | |
| 7291 | return status; |
| 7292 | } |
| 7293 | |
| 7294 | /*-------------------------------------------------------------------------- |
| 7295 | \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold |
| 7296 | This is a synchronous call |
| 7297 | \param hHal - The handle returned by macOpen. |
| 7298 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7299 | Other status means SME is failed to update |
| 7300 | \sa |
| 7301 | --------------------------------------------------------------------------*/ |
| 7302 | eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal, |
| 7303 | v_U8_t neighborReassocRssiThreshold) |
| 7304 | { |
| 7305 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7306 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7307 | |
| 7308 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7309 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7310 | { |
| 7311 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7312 | "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d", |
| 7313 | neighborReassocRssiThreshold, |
| 7314 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold, |
| 7315 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7316 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = |
| 7317 | neighborReassocRssiThreshold; |
| 7318 | pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold = |
| 7319 | neighborReassocRssiThreshold; |
| 7320 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7321 | } |
| 7322 | |
| 7323 | return status ; |
| 7324 | } |
| 7325 | |
| 7326 | |
| 7327 | /*-------------------------------------------------------------------------- |
| 7328 | \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold |
| 7329 | This is a synchronous call |
| 7330 | \param hHal - The handle returned by macOpen. |
| 7331 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7332 | Other status means SME is failed to update |
| 7333 | \sa |
| 7334 | --------------------------------------------------------------------------*/ |
| 7335 | v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal) |
| 7336 | { |
| 7337 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7338 | return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold; |
| 7339 | } |
| 7340 | |
| 7341 | /*-------------------------------------------------------------------------- |
| 7342 | \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period |
| 7343 | This is a synchronous call |
| 7344 | \param hHal - The handle returned by macOpen. |
| 7345 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7346 | Other status means SME is failed to update |
| 7347 | \sa |
| 7348 | --------------------------------------------------------------------------*/ |
| 7349 | eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal, |
| 7350 | v_U16_t neighborScanResultsRefreshPeriod) |
| 7351 | { |
| 7352 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7353 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7354 | |
| 7355 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7356 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7357 | { |
| 7358 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7359 | "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d", |
| 7360 | neighborScanResultsRefreshPeriod, |
| 7361 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod, |
| 7362 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7363 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = |
| 7364 | neighborScanResultsRefreshPeriod; |
| 7365 | pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod = |
| 7366 | neighborScanResultsRefreshPeriod; |
| 7367 | |
| 7368 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7369 | } |
| 7370 | |
| 7371 | return status ; |
| 7372 | } |
| 7373 | |
| 7374 | /*-------------------------------------------------------------------------- |
| 7375 | \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period |
| 7376 | This is a synchronous call |
| 7377 | \param hHal - The handle returned by macOpen. |
| 7378 | \return v_U16_t - Neighbor scan results refresh period value |
| 7379 | \sa |
| 7380 | --------------------------------------------------------------------------*/ |
| 7381 | v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal) |
| 7382 | { |
| 7383 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7384 | return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod; |
| 7385 | } |
| 7386 | |
| 7387 | /*-------------------------------------------------------------------------- |
| 7388 | \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period |
| 7389 | This is a synchronuous call |
| 7390 | \param hHal - The handle returned by macOpen. |
| 7391 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7392 | Other status means SME is failed to update |
| 7393 | \sa |
| 7394 | --------------------------------------------------------------------------*/ |
| 7395 | v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal) |
| 7396 | { |
| 7397 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7398 | return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod; |
| 7399 | } |
| 7400 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7401 | /* --------------------------------------------------------------------------- |
| 7402 | \fn sme_UpdateEmptyScanRefreshPeriod |
| 7403 | \brief Update nEmptyScanRefreshPeriod |
| 7404 | This function is called through dynamic setConfig callback function |
| 7405 | to configure nEmptyScanRefreshPeriod |
| 7406 | Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60] |
| 7407 | \param hHal - HAL handle for device |
| 7408 | \param nEmptyScanRefreshPeriod - scan period following empty scan results. |
| 7409 | \- return Success or failure |
| 7410 | -------------------------------------------------------------------------*/ |
| 7411 | |
| 7412 | eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod) |
| 7413 | { |
| 7414 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7415 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7416 | |
| 7417 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7418 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7419 | { |
| 7420 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7421 | "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d", |
| 7422 | nEmptyScanRefreshPeriod, |
| 7423 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod, |
| 7424 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7425 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod; |
| 7426 | pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod; |
| 7427 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7428 | } |
| 7429 | |
| 7430 | return status ; |
| 7431 | } |
| 7432 | |
| 7433 | /* --------------------------------------------------------------------------- |
| 7434 | \fn sme_setNeighborScanMinChanTime |
| 7435 | \brief Update nNeighborScanMinChanTime |
| 7436 | This function is called through dynamic setConfig callback function |
| 7437 | to configure gNeighborScanChannelMinTime |
| 7438 | Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60] |
| 7439 | \param hHal - HAL handle for device |
| 7440 | \param nNeighborScanMinChanTime - Channel minimum dwell time |
| 7441 | \- return Success or failure |
| 7442 | -------------------------------------------------------------------------*/ |
| 7443 | eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime) |
| 7444 | { |
| 7445 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7446 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7447 | |
| 7448 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7449 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7450 | { |
| 7451 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7452 | "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d", |
| 7453 | nNeighborScanMinChanTime, |
| 7454 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime, |
| 7455 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7456 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime; |
| 7457 | pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime; |
| 7458 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7459 | } |
| 7460 | |
| 7461 | return status ; |
| 7462 | } |
| 7463 | |
| 7464 | /* --------------------------------------------------------------------------- |
| 7465 | \fn sme_setNeighborScanMaxChanTime |
| 7466 | \brief Update nNeighborScanMaxChanTime |
| 7467 | This function is called through dynamic setConfig callback function |
| 7468 | to configure gNeighborScanChannelMaxTime |
| 7469 | Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60] |
| 7470 | \param hHal - HAL handle for device |
| 7471 | \param nNeighborScanMinChanTime - Channel maximum dwell time |
| 7472 | \- return Success or failure |
| 7473 | -------------------------------------------------------------------------*/ |
| 7474 | eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime) |
| 7475 | { |
| 7476 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7477 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7478 | |
| 7479 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7480 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7481 | { |
| 7482 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7483 | "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d", |
| 7484 | nNeighborScanMaxChanTime, |
| 7485 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime, |
| 7486 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7487 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime; |
| 7488 | pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime; |
| 7489 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7490 | } |
| 7491 | |
| 7492 | return status ; |
| 7493 | } |
| 7494 | |
| 7495 | /* --------------------------------------------------------------------------- |
| 7496 | \fn sme_getNeighborScanMinChanTime |
| 7497 | \brief get neighbor scan min channel time |
| 7498 | \param hHal - The handle returned by macOpen. |
| 7499 | \return v_U16_t - channel min time value |
| 7500 | -------------------------------------------------------------------------*/ |
| 7501 | v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal) |
| 7502 | { |
| 7503 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7504 | return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime; |
| 7505 | } |
| 7506 | |
| 7507 | /* --------------------------------------------------------------------------- |
| 7508 | \fn sme_getNeighborScanMaxChanTime |
| 7509 | \brief get neighbor scan max channel time |
| 7510 | \param hHal - The handle returned by macOpen. |
| 7511 | \return v_U16_t - channel max time value |
| 7512 | -------------------------------------------------------------------------*/ |
| 7513 | v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal) |
| 7514 | { |
| 7515 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7516 | return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime; |
| 7517 | } |
| 7518 | |
| 7519 | /* --------------------------------------------------------------------------- |
| 7520 | \fn sme_setNeighborScanPeriod |
| 7521 | \brief Update nNeighborScanPeriod |
| 7522 | This function is called through dynamic setConfig callback function |
| 7523 | to configure nNeighborScanPeriod |
| 7524 | Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 60] |
| 7525 | \param hHal - HAL handle for device |
| 7526 | \param nNeighborScanPeriod - neighbor scan period |
| 7527 | \- return Success or failure |
| 7528 | -------------------------------------------------------------------------*/ |
| 7529 | eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod) |
| 7530 | { |
| 7531 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7532 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7533 | |
| 7534 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7535 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7536 | { |
| 7537 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7538 | "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d", |
| 7539 | nNeighborScanPeriod, |
| 7540 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod, |
| 7541 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7542 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod; |
| 7543 | pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod; |
| 7544 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7545 | } |
| 7546 | |
| 7547 | return status ; |
| 7548 | } |
| 7549 | |
| 7550 | /* --------------------------------------------------------------------------- |
| 7551 | \fn sme_getNeighborScanPeriod |
| 7552 | \brief get neighbor scan period |
| 7553 | \param hHal - The handle returned by macOpen. |
| 7554 | \return v_U16_t - neighbor scan period |
| 7555 | -------------------------------------------------------------------------*/ |
| 7556 | v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal) |
| 7557 | { |
| 7558 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7559 | return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod; |
| 7560 | } |
| 7561 | |
| 7562 | #endif |
| 7563 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7564 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7565 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7566 | /*-------------------------------------------------------------------------- |
| 7567 | \brief sme_getRoamRssiDiff() - get Roam rssi diff |
| 7568 | This is a synchronous call |
| 7569 | \param hHal - The handle returned by macOpen. |
| 7570 | \return v_U16_t - Rssi diff value |
| 7571 | \sa |
| 7572 | --------------------------------------------------------------------------*/ |
| 7573 | v_U8_t sme_getRoamRssiDiff(tHalHandle hHal) |
| 7574 | { |
| 7575 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7576 | return pMac->roam.configParam.RoamRssiDiff; |
| 7577 | } |
| 7578 | |
| 7579 | /*-------------------------------------------------------------------------- |
| 7580 | \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list |
| 7581 | This is a synchronous call |
| 7582 | \param hHal - The handle returned by macOpen. |
| 7583 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7584 | Other status means SME is failed to update |
| 7585 | \sa |
| 7586 | --------------------------------------------------------------------------*/ |
| 7587 | eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList, |
| 7588 | tANI_U8 numChannels) |
| 7589 | { |
| 7590 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7591 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7592 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7593 | tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0}; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7594 | tANI_U8 newChannelList[128] = {0}; |
| 7595 | tANI_U8 i = 0, j = 0; |
| 7596 | |
| 7597 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7598 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7599 | { |
| 7600 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 7601 | { |
| 7602 | for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++) |
| 7603 | { |
| 7604 | j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d", |
| 7605 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]); |
| 7606 | } |
| 7607 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7608 | csrFlushBgScanRoamChannelList(pMac); |
| 7609 | csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7610 | status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal)); |
| 7611 | |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7612 | if ( HAL_STATUS_SUCCESS( status )) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7613 | { |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7614 | sme_SetRoamScanControl(hHal, 1); |
| 7615 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7616 | { |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7617 | j = 0; |
| 7618 | for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++) |
| 7619 | { |
| 7620 | j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d", |
| 7621 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]); |
| 7622 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7623 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7624 | |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7625 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7626 | "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d", |
| 7627 | newChannelList, oldChannelList, |
| 7628 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7629 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7630 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7631 | } |
| 7632 | |
| 7633 | return status ; |
| 7634 | } |
| 7635 | |
| 7636 | /*-------------------------------------------------------------------------- |
| 7637 | \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list |
| 7638 | based on country revision number |
| 7639 | This is a synchronous call |
| 7640 | \param hHal - The handle returned by macOpen. |
| 7641 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7642 | Other status means SME is failed to update |
| 7643 | \sa |
| 7644 | --------------------------------------------------------------------------*/ |
| 7645 | eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal, |
| 7646 | tANI_U8 Revision) |
| 7647 | { |
| 7648 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7649 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7650 | |
| 7651 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7652 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7653 | { |
| 7654 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7655 | "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d", |
| 7656 | "KR", Revision, "KR", |
| 7657 | pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision, |
| 7658 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7659 | csr_SetRevision(pMac, Revision); |
| 7660 | csrInitCountryValidChannelList(pMac, Revision); |
| 7661 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7662 | } |
| 7663 | |
| 7664 | return status ; |
| 7665 | } |
| 7666 | |
| 7667 | |
| 7668 | /*-------------------------------------------------------------------------- |
| 7669 | \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache |
| 7670 | This is a synchronous call |
| 7671 | \param hHal - The handle returned by macOpen. |
| 7672 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7673 | Other status means SME is failed to update |
| 7674 | \sa |
| 7675 | --------------------------------------------------------------------------*/ |
| 7676 | eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal, |
| 7677 | eCsrBand eBand) |
| 7678 | { |
| 7679 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7680 | return csrUpdateBgScanConfigIniChannelList(pMac, eBand); |
| 7681 | } |
| 7682 | |
| 7683 | /*-------------------------------------------------------------------------- |
| 7684 | \brief sme_getRoamScanChannelList() - get roam scan channel list |
| 7685 | This is a synchronous call |
| 7686 | \param hHal - The handle returned by macOpen. |
| 7687 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7688 | Other status means SME is failed to update |
| 7689 | \sa |
| 7690 | --------------------------------------------------------------------------*/ |
| 7691 | eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList, |
| 7692 | tANI_U8 *pNumChannels) |
| 7693 | { |
| 7694 | int i = 0; |
| 7695 | tANI_U8 *pOutPtr = pChannelList; |
| 7696 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7697 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7698 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7699 | |
| 7700 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7701 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7702 | { |
| 7703 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 7704 | { |
| 7705 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 7706 | "Roam Scan channel list is NOT yet initialized"); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7707 | *pNumChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7708 | sme_ReleaseGlobalLock( &pMac->sme ); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7709 | return status; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7710 | } |
| 7711 | |
| 7712 | *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 7713 | for (i = 0; i < (*pNumChannels); i++) |
| 7714 | { |
| 7715 | pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]; |
| 7716 | } |
| 7717 | pOutPtr[i] = '\0'; |
| 7718 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7719 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7720 | return status ; |
| 7721 | } |
| 7722 | |
| 7723 | /*-------------------------------------------------------------------------- |
| 7724 | \brief sme_GetCountryRevision() - get Country revision index |
| 7725 | This is a synchronous call |
| 7726 | \param hHal - The handle returned by macOpen. |
| 7727 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7728 | Other status means SME is failed to update |
| 7729 | \sa |
| 7730 | --------------------------------------------------------------------------*/ |
| 7731 | eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision) |
| 7732 | { |
| 7733 | /* this is valid for Country KR only now */ |
| 7734 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7735 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7736 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7737 | |
| 7738 | *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision; |
| 7739 | |
| 7740 | return status; |
| 7741 | } |
| 7742 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7743 | /*-------------------------------------------------------------------------- |
| 7744 | \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not |
| 7745 | This is a synchronuous call |
| 7746 | \param hHal - The handle returned by macOpen. |
| 7747 | \return TRUE (1) - if the CCX feature is enabled |
| 7748 | FALSE (0) - if feature is disabled (compile or runtime) |
| 7749 | \sa |
| 7750 | --------------------------------------------------------------------------*/ |
| 7751 | tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7752 | { |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7753 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7754 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7755 | return pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 7756 | #else |
| 7757 | return eANI_BOOLEAN_FALSE; |
| 7758 | #endif |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7759 | } |
| 7760 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7761 | /*-------------------------------------------------------------------------- |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7762 | \brief sme_GetWESMode() - get WES Mode |
| 7763 | This is a synchronous call |
| 7764 | \param hHal - The handle returned by macOpen |
| 7765 | \return v_U8_t - WES Mode Enabled(1)/Disabled(0) |
| 7766 | \sa |
| 7767 | --------------------------------------------------------------------------*/ |
| 7768 | v_BOOL_t sme_GetWESMode(tHalHandle hHal) |
| 7769 | { |
| 7770 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7771 | return pMac->roam.configParam.isWESModeEnabled; |
| 7772 | } |
| 7773 | |
| 7774 | /*-------------------------------------------------------------------------- |
| 7775 | \brief sme_GetRoamScanControl() - get scan control |
| 7776 | This is a synchronous call |
| 7777 | \param hHal - The handle returned by macOpen. |
| 7778 | \return v_BOOL_t - Enabled(1)/Disabled(0) |
| 7779 | \sa |
| 7780 | --------------------------------------------------------------------------*/ |
| 7781 | v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal) |
| 7782 | { |
| 7783 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7784 | return pMac->roam.configParam.nRoamScanControl; |
| 7785 | } |
| 7786 | #endif |
| 7787 | |
| 7788 | /*-------------------------------------------------------------------------- |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7789 | \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not |
| 7790 | This is a synchronuous call |
| 7791 | \param hHal - The handle returned by macOpen. |
| 7792 | \return TRUE (1) - if the feature is enabled |
| 7793 | FALSE (0) - if feature is disabled (compile or runtime) |
| 7794 | \sa |
| 7795 | --------------------------------------------------------------------------*/ |
| 7796 | tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal) |
| 7797 | { |
| 7798 | #ifdef FEATURE_WLAN_LFR |
| 7799 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7800 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 7801 | #else |
| 7802 | return eANI_BOOLEAN_FALSE; |
| 7803 | #endif |
| 7804 | } |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 7805 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7806 | /*-------------------------------------------------------------------------- |
| 7807 | \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not |
| 7808 | This is a synchronuous call |
| 7809 | \param hHal - The handle returned by macOpen. |
| 7810 | \return TRUE (1) - if the feature is enabled |
| 7811 | FALSE (0) - if feature is disabled (compile or runtime) |
| 7812 | \sa |
| 7813 | --------------------------------------------------------------------------*/ |
| 7814 | tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal) |
| 7815 | { |
| 7816 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7817 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7818 | return pMac->roam.configParam.isFastTransitionEnabled; |
| 7819 | #else |
| 7820 | return eANI_BOOLEAN_FALSE; |
| 7821 | #endif |
| 7822 | } |
| 7823 | |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 7824 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7825 | /* --------------------------------------------------------------------------- |
| 7826 | \fn sme_IsFeatureSupportedByFW |
| 7827 | \brief Check if an feature is enabled by FW |
| 7828 | |
| 7829 | \param feattEnumValue - Enumeration value from placeHolderInCapBitmap |
| 7830 | \- return 1/0 (TRUE/FALSE) |
| 7831 | -------------------------------------------------------------------------*/ |
| 7832 | tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue) |
| 7833 | { |
| 7834 | return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue); |
| 7835 | } |
| 7836 | #ifdef FEATURE_WLAN_TDLS |
| 7837 | /* --------------------------------------------------------------------------- |
| 7838 | \fn sme_SendTdlsMgmtFrame |
| 7839 | \brief API to send TDLS management frames. |
| 7840 | |
| 7841 | \param peerMac - peer's Mac Adress. |
| 7842 | \param frame_type - Type of TDLS mgmt frame to be sent. |
| 7843 | \param dialog - dialog token used in the frame. |
| 7844 | \param status - status to be incuded in the frame. |
| 7845 | \param buf - additional IEs to be included |
| 7846 | \param len - lenght of additional Ies |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7847 | \param responder - Tdls request type |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7848 | \- return VOS_STATUS_SUCCES |
| 7849 | -------------------------------------------------------------------------*/ |
| 7850 | VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7851 | tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7852 | { |
| 7853 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7854 | tCsrTdlsSendMgmt sendTdlsReq = {{0}} ; |
| 7855 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7856 | |
| 7857 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7858 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7859 | { |
| 7860 | vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 7861 | sendTdlsReq.frameType = frame_type; |
| 7862 | sendTdlsReq.buf = buf; |
| 7863 | sendTdlsReq.len = len; |
| 7864 | sendTdlsReq.dialog = dialog; |
| 7865 | sendTdlsReq.statusCode = statusCode; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 7866 | sendTdlsReq.responder = responder; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7867 | |
| 7868 | status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ; |
| 7869 | |
| 7870 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7871 | } |
| 7872 | |
| 7873 | return status ; |
| 7874 | |
| 7875 | } |
| 7876 | /* --------------------------------------------------------------------------- |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 7877 | \fn sme_ChangeTdlsPeerSta |
| 7878 | \brief API to Update TDLS peer sta parameters. |
| 7879 | |
| 7880 | \param peerMac - peer's Mac Adress. |
| 7881 | \param staParams - Peer Station Parameters |
| 7882 | \- return VOS_STATUS_SUCCES |
| 7883 | -------------------------------------------------------------------------*/ |
| 7884 | VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac, |
| 7885 | tCsrStaParams *pstaParams) |
| 7886 | { |
| 7887 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7888 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7889 | |
| 7890 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7891 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7892 | { |
| 7893 | status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams); |
| 7894 | |
| 7895 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7896 | } |
| 7897 | |
| 7898 | return status ; |
| 7899 | |
| 7900 | } |
| 7901 | |
| 7902 | /* --------------------------------------------------------------------------- |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7903 | \fn sme_AddTdlsPeerSta |
| 7904 | \brief API to Add TDLS peer sta entry. |
| 7905 | |
| 7906 | \param peerMac - peer's Mac Adress. |
| 7907 | \- return VOS_STATUS_SUCCES |
| 7908 | -------------------------------------------------------------------------*/ |
| 7909 | VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 7910 | { |
| 7911 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7912 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7913 | |
| 7914 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7915 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7916 | { |
| 7917 | status = csrTdlsAddPeerSta(hHal, sessionId, peerMac); |
| 7918 | |
| 7919 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7920 | } |
| 7921 | |
| 7922 | return status ; |
| 7923 | |
| 7924 | } |
| 7925 | /* --------------------------------------------------------------------------- |
| 7926 | \fn sme_DeleteTdlsPeerSta |
| 7927 | \brief API to Delete TDLS peer sta entry. |
| 7928 | |
| 7929 | \param peerMac - peer's Mac Adress. |
| 7930 | \- return VOS_STATUS_SUCCES |
| 7931 | -------------------------------------------------------------------------*/ |
| 7932 | VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 7933 | { |
| 7934 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7935 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7936 | |
| 7937 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7938 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7939 | { |
| 7940 | status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ; |
| 7941 | |
| 7942 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7943 | } |
| 7944 | |
| 7945 | return status ; |
| 7946 | |
| 7947 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 7948 | /* --------------------------------------------------------------------------- |
| 7949 | \fn sme_IsPmcBmps |
| 7950 | \API to Check if PMC state is BMPS. |
| 7951 | |
| 7952 | \- return v_BOOL_t |
| 7953 | -------------------------------------------------------------------------*/ |
| 7954 | v_BOOL_t sme_IsPmcBmps(tHalHandle hHal) |
| 7955 | { |
| 7956 | return (BMPS == pmcGetPmcState(hHal)); |
| 7957 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 7958 | /* --------------------------------------------------------------------------- |
| 7959 | \fn sme_SetTdlsPowerSaveProhibited |
| 7960 | \API to set/reset the isTdlsPowerSaveProhibited. |
| 7961 | |
| 7962 | \- return void |
| 7963 | -------------------------------------------------------------------------*/ |
| 7964 | void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val) |
| 7965 | { |
| 7966 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 7967 | |
| 7968 | pMac->isTdlsPowerSaveProhibited = val; |
| 7969 | return; |
| 7970 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7971 | #endif |
| 7972 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 7973 | /* |
| 7974 | * SME API to start TDLS discovery Procedure |
| 7975 | */ |
| 7976 | VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 7977 | { |
| 7978 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 7979 | tCsrTdlsDisRequest disReq = {{0}} ; |
| 7980 | vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 7981 | status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ; |
| 7982 | |
| 7983 | return status ; |
| 7984 | |
| 7985 | } |
| 7986 | |
| 7987 | /* |
| 7988 | * Process TDLS discovery results |
| 7989 | */ |
| 7990 | v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal, |
| 7991 | tSmeTdlsDisResult *disResult, v_U8_t listType) |
| 7992 | { |
| 7993 | tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ; |
| 7994 | tSirTdlsPeerInfo *peerInfo = NULL ; |
| 7995 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7996 | tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; |
| 7997 | tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ; |
| 7998 | tListElem *pEntry = NULL ; |
| 7999 | v_U8_t peerCnt = 0 ; |
| 8000 | |
| 8001 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 8002 | ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8003 | pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK ); |
| 8004 | while(pEntry) |
| 8005 | { |
| 8006 | peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo, |
| 8007 | tdlsPeerStaLink) ; |
| 8008 | peerInfo = &peerLinkInfo->tdlsDisPeerInfo ; |
| 8009 | |
| 8010 | switch(listType) |
| 8011 | { |
| 8012 | case TDLS_SETUP_LIST: |
| 8013 | { |
| 8014 | if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState) |
| 8015 | { |
| 8016 | palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac, |
| 8017 | peerInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 8018 | disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ; |
| 8019 | peerCnt++ ; |
| 8020 | } |
| 8021 | break ; |
| 8022 | } |
| 8023 | case TDLS_DIS_LIST: |
| 8024 | { |
| 8025 | palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac, |
| 8026 | peerInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 8027 | disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ; |
| 8028 | peerCnt++ ; |
| 8029 | break ; |
| 8030 | } |
| 8031 | default: |
| 8032 | { |
| 8033 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 8034 | ("unknown list type ")) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8035 | break ; |
| 8036 | } |
| 8037 | } |
| 8038 | |
| 8039 | pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ; |
| 8040 | } |
| 8041 | |
| 8042 | return peerCnt ; |
| 8043 | |
| 8044 | } |
| 8045 | |
| 8046 | /* |
| 8047 | * SME API to start TDLS link setup Procedure. |
| 8048 | */ |
| 8049 | VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 8050 | { |
| 8051 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 8052 | tCsrTdlsSetupRequest setupReq = {{0}} ; |
| 8053 | vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 8054 | status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ; |
| 8055 | return status ; |
| 8056 | |
| 8057 | } |
| 8058 | |
| 8059 | /* |
| 8060 | * SME API to start TDLS link Teardown Procedure. |
| 8061 | */ |
| 8062 | VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 8063 | { |
| 8064 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 8065 | tCsrTdlsTeardownRequest teardownReq = {{0}} ; |
| 8066 | vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 8067 | status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ; |
| 8068 | return status ; |
| 8069 | |
| 8070 | } |
| 8071 | |
| 8072 | #endif /* FEATURE_WLAN_TDLS */ |
| 8073 | |