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: |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 1719 | #ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP |
| 1720 | case eWNI_SME_TDLS_AP_DISAPPEAR_IND: |
| 1721 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1722 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 1723 | case eWNI_SME_TDLS_DISCOVERY_START_RSP: |
| 1724 | case eWNI_SME_TDLS_DISCOVERY_START_IND: |
| 1725 | case eWNI_SME_TDLS_LINK_START_RSP: |
| 1726 | case eWNI_SME_TDLS_LINK_START_IND: |
| 1727 | case eWNI_SME_TDLS_TEARDOWN_RSP: |
| 1728 | case eWNI_SME_TDLS_TEARDOWN_IND: |
| 1729 | case eWNI_SME_ADD_TDLS_PEER_IND: |
| 1730 | case eWNI_SME_DELETE_TDLS_PEER_IND: |
| 1731 | #endif |
| 1732 | { |
| 1733 | if (pMsg->bodyptr) |
| 1734 | { |
| 1735 | status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr); |
| 1736 | vos_mem_free( pMsg->bodyptr ); |
| 1737 | } |
| 1738 | else |
| 1739 | { |
| 1740 | smsLog( pMac, LOGE, "Empty rsp message for TDLS, \ |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1741 | nothing to process"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 1742 | } |
| 1743 | break; |
| 1744 | } |
| 1745 | #endif |
| 1746 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1747 | #ifdef WLAN_FEATURE_11W |
| 1748 | case eWNI_SME_UNPROT_MGMT_FRM_IND: |
| 1749 | if (pMsg->bodyptr) |
| 1750 | { |
| 1751 | sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr); |
| 1752 | vos_mem_free(pMsg->bodyptr); |
| 1753 | } |
| 1754 | else |
| 1755 | { |
| 1756 | smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process"); |
| 1757 | } |
| 1758 | break; |
| 1759 | #endif |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 1760 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1761 | case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP: |
| 1762 | status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval); |
| 1763 | break; |
| 1764 | #endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1765 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1766 | default: |
| 1767 | |
| 1768 | if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN ) |
| 1769 | && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) ) |
| 1770 | { |
| 1771 | //CSR |
| 1772 | if (pMsg->bodyptr) |
| 1773 | { |
| 1774 | status = csrMsgProcessor(hHal, pMsg->bodyptr); |
| 1775 | vos_mem_free( pMsg->bodyptr ); |
| 1776 | } |
| 1777 | else |
| 1778 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1779 | smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1780 | } |
| 1781 | } |
| 1782 | else |
| 1783 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1784 | smsLog( pMac, LOGW, "Unknown message type %d, nothing to process", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1785 | pMsg->type); |
| 1786 | if (pMsg->bodyptr) |
| 1787 | { |
| 1788 | vos_mem_free( pMsg->bodyptr ); |
| 1789 | } |
| 1790 | } |
| 1791 | }//switch |
| 1792 | } //SME_IS_START |
| 1793 | else |
| 1794 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1795 | smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1796 | if (pMsg->bodyptr) |
| 1797 | { |
| 1798 | vos_mem_free( pMsg->bodyptr ); |
| 1799 | } |
| 1800 | } |
| 1801 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 1802 | } |
| 1803 | else |
| 1804 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1805 | smsLog( pMac, LOGW, "Locking failed, bailing out"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1806 | if (pMsg->bodyptr) |
| 1807 | { |
| 1808 | vos_mem_free( pMsg->bodyptr ); |
| 1809 | } |
| 1810 | } |
| 1811 | |
| 1812 | return status; |
| 1813 | } |
| 1814 | |
| 1815 | |
| 1816 | //No need to hold the global lock here because this function can only be called |
| 1817 | //after sme_Stop. |
| 1818 | v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg ) |
| 1819 | { |
| 1820 | if( pMsg ) |
| 1821 | { |
| 1822 | if (pMsg->bodyptr) |
| 1823 | { |
| 1824 | vos_mem_free( pMsg->bodyptr ); |
| 1825 | } |
| 1826 | } |
| 1827 | |
| 1828 | } |
| 1829 | |
| 1830 | |
| 1831 | /*-------------------------------------------------------------------------- |
| 1832 | |
| 1833 | \brief sme_Stop() - Stop all SME modules and put them at idle state |
| 1834 | |
| 1835 | The function stops each module in SME, PMC, CCM, CSR, etc. . Upon |
| 1836 | return, all modules are at idle state ready to start. |
| 1837 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1838 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1839 | \param hHal - The handle returned by macOpen |
| 1840 | |
| 1841 | \return eHAL_STATUS_SUCCESS - SME is stopped. |
| 1842 | |
| 1843 | Other status means SME is failed to stop but caller should still |
| 1844 | consider SME is stopped. |
| 1845 | \sa |
| 1846 | |
| 1847 | --------------------------------------------------------------------------*/ |
| 1848 | eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag) |
| 1849 | { |
| 1850 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1851 | eHalStatus fail_status = eHAL_STATUS_SUCCESS; |
| 1852 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1853 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1854 | status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL)); |
| 1855 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1856 | smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1857 | status ); |
| 1858 | fail_status = status; |
| 1859 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1860 | |
| 1861 | p2pStop(hHal); |
| 1862 | |
| 1863 | if(pmcFlag) |
| 1864 | { |
| 1865 | status = pmcStop(hHal); |
| 1866 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1867 | smsLog( pMac, LOGE, "pmcStop 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 | |
| 1873 | status = csrStop(pMac); |
| 1874 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1875 | smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1876 | status ); |
| 1877 | fail_status = status; |
| 1878 | } |
| 1879 | |
| 1880 | ccmStop(hHal); |
| 1881 | |
| 1882 | purgeSmeCmdList(pMac); |
| 1883 | |
| 1884 | if (!HAL_STATUS_SUCCESS( fail_status )) { |
| 1885 | status = fail_status; |
| 1886 | } |
| 1887 | |
| 1888 | pMac->sme.state = SME_STATE_STOP; |
| 1889 | |
| 1890 | return status; |
| 1891 | } |
| 1892 | |
| 1893 | /*-------------------------------------------------------------------------- |
| 1894 | |
| 1895 | \brief sme_Close() - Release all SME modules and their resources. |
| 1896 | |
| 1897 | The function release each module in SME, PMC, CCM, CSR, etc. . Upon |
| 1898 | return, all modules are at closed state. |
| 1899 | |
| 1900 | No SME APIs can be involved after smeClose except smeOpen. |
| 1901 | smeClose must be called before macClose. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1902 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1903 | \param hHal - The handle returned by macOpen |
| 1904 | |
| 1905 | \return eHAL_STATUS_SUCCESS - SME is successfully close. |
| 1906 | |
| 1907 | Other status means SME is failed to be closed but caller still cannot |
| 1908 | call any other SME functions except smeOpen. |
| 1909 | \sa |
| 1910 | |
| 1911 | --------------------------------------------------------------------------*/ |
| 1912 | eHalStatus sme_Close(tHalHandle hHal) |
| 1913 | { |
| 1914 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 1915 | eHalStatus fail_status = eHAL_STATUS_SUCCESS; |
| 1916 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1917 | |
| 1918 | status = csrClose(pMac); |
| 1919 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1920 | smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1921 | status ); |
| 1922 | fail_status = status; |
| 1923 | } |
| 1924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1925 | status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL)); |
| 1926 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1927 | smsLog( pMac, LOGE, "WLANSAP_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 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1931 | |
| 1932 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 1933 | status = btcClose(hHal); |
| 1934 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1935 | smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1936 | status ); |
| 1937 | fail_status = status; |
| 1938 | } |
| 1939 | |
| 1940 | status = sme_QosClose(pMac); |
| 1941 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1942 | smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | status ); |
| 1944 | fail_status = status; |
| 1945 | } |
| 1946 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1947 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1948 | status = oemData_OemDataReqClose(hHal); |
| 1949 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1950 | 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] | 1951 | status ); |
| 1952 | fail_status = status; |
| 1953 | } |
| 1954 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1955 | |
| 1956 | status = ccmClose(hHal); |
| 1957 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1958 | smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1959 | status ); |
| 1960 | fail_status = status; |
| 1961 | } |
| 1962 | |
| 1963 | status = pmcClose(hHal); |
| 1964 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1965 | smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1966 | status ); |
| 1967 | fail_status = status; |
| 1968 | } |
| 1969 | #if defined WLAN_FEATURE_VOWIFI |
| 1970 | status = rrmClose(hHal); |
| 1971 | if ( ! HAL_STATUS_SUCCESS( status ) ) { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 1972 | smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1973 | status ); |
| 1974 | fail_status = status; |
| 1975 | } |
| 1976 | #endif |
| 1977 | |
| 1978 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 1979 | sme_FTClose(hHal); |
| 1980 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1981 | sme_p2pClose(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1982 | |
| 1983 | freeSmeCmdList(pMac); |
| 1984 | |
| 1985 | if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) ) |
| 1986 | { |
| 1987 | fail_status = eHAL_STATUS_FAILURE; |
| 1988 | } |
| 1989 | |
| 1990 | if (!HAL_STATUS_SUCCESS( fail_status )) { |
| 1991 | status = fail_status; |
| 1992 | } |
| 1993 | |
| 1994 | pMac->sme.state = SME_STATE_STOP; |
| 1995 | |
| 1996 | return status; |
| 1997 | } |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 1998 | #ifdef FEATURE_WLAN_LFR |
| 1999 | tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac) |
| 2000 | { |
Madan Mohan Koyyalamudi | fb534bb | 2012-10-24 14:35:45 -0700 | [diff] [blame] | 2001 | #if 0 |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2002 | switch(pMac->roam.neighborRoamInfo.neighborRoamState) { |
| 2003 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 2004 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING: |
| 2005 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE: |
| 2006 | case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING: |
| 2007 | return eANI_BOOLEAN_FALSE; |
| 2008 | default: |
| 2009 | return eANI_BOOLEAN_TRUE; |
| 2010 | } |
Madan Mohan Koyyalamudi | fb534bb | 2012-10-24 14:35:45 -0700 | [diff] [blame] | 2011 | #else |
| 2012 | /* |
| 2013 | * TODO: always return TRUE for now until |
| 2014 | * we figure out why we could be stuck in |
| 2015 | * one of the roaming states forever. |
| 2016 | */ |
| 2017 | return eANI_BOOLEAN_TRUE; |
| 2018 | #endif |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2019 | } |
| 2020 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | /* --------------------------------------------------------------------------- |
| 2022 | \fn sme_ScanRequest |
| 2023 | \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] | 2024 | This is an asynchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2025 | \param pScanRequestID - pointer to an object to get back the request ID |
| 2026 | \param callback - a callback function that scan calls upon finish, will not |
| 2027 | be called if csrScanRequest returns error |
| 2028 | \param pContext - a pointer passed in for the callback |
| 2029 | \return eHalStatus |
| 2030 | ---------------------------------------------------------------------------*/ |
| 2031 | eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq, |
| 2032 | tANI_U32 *pScanRequestID, |
| 2033 | csrScanCompleteCallback callback, void *pContext) |
| 2034 | { |
| 2035 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2036 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2037 | |
| 2038 | smsLog(pMac, LOG2, FL("enter")); |
| 2039 | do |
| 2040 | { |
| 2041 | if(pMac->scan.fScanEnable) |
| 2042 | { |
| 2043 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2044 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2045 | { |
| 2046 | { |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2047 | #ifdef FEATURE_WLAN_LFR |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2048 | if(csrIsScanAllowed(pMac)) |
| 2049 | { |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2050 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2051 | status = csrScanRequest( hHal, sessionId, pscanReq, |
| 2052 | pScanRequestID, callback, pContext ); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2053 | #ifdef FEATURE_WLAN_LFR |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2054 | } |
| 2055 | else |
| 2056 | { |
Madan Mohan Koyyalamudi | ab4ab0d | 2012-10-24 14:26:50 -0700 | [diff] [blame] | 2057 | smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"), |
| 2058 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 2059 | pMac->roam.curSubState[sessionId]); |
| 2060 | /*HandOff is in progress. So schedule this scan later*/ |
| 2061 | status = eHAL_STATUS_RESOURCES; |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 2062 | } |
| 2063 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2064 | } |
| 2065 | |
| 2066 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2067 | } //sme_AcquireGlobalLock success |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2068 | else |
| 2069 | { |
| 2070 | smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed")); |
| 2071 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | } //if(pMac->scan.fScanEnable) |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2073 | else |
| 2074 | { |
| 2075 | smsLog(pMac, LOGE, FL("fScanEnable FALSE")); |
| 2076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2077 | } while( 0 ); |
| 2078 | |
| 2079 | return (status); |
| 2080 | |
| 2081 | |
| 2082 | } |
| 2083 | |
| 2084 | /* --------------------------------------------------------------------------- |
| 2085 | \fn sme_ScanGetResult |
| 2086 | \brief a wrapper function to request scan results from CSR. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2087 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2088 | \param pFilter - If pFilter is NULL, all cached results are returned |
| 2089 | \param phResult - an object for the result. |
| 2090 | \return eHalStatus |
| 2091 | ---------------------------------------------------------------------------*/ |
| 2092 | eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter, |
| 2093 | tScanResultHandle *phResult) |
| 2094 | { |
| 2095 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2096 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2097 | |
| 2098 | smsLog(pMac, LOG2, FL("enter")); |
| 2099 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2100 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2101 | { |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 2102 | status = csrScanGetResult( hHal, pFilter, phResult ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2103 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2104 | } |
| 2105 | smsLog(pMac, LOG2, FL("exit status %d"), status); |
| 2106 | |
| 2107 | return (status); |
| 2108 | } |
| 2109 | |
| 2110 | |
| 2111 | /* --------------------------------------------------------------------------- |
| 2112 | \fn sme_ScanFlushResult |
| 2113 | \brief a wrapper function to request CSR to clear scan results. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2114 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2115 | \return eHalStatus |
| 2116 | ---------------------------------------------------------------------------*/ |
| 2117 | eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId) |
| 2118 | { |
| 2119 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2120 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2121 | |
| 2122 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2123 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2124 | { |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 2125 | status = csrScanFlushResult( hHal ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2126 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2127 | } |
| 2128 | |
| 2129 | return (status); |
| 2130 | } |
| 2131 | |
Madan Mohan Koyyalamudi | a3fcf14 | 2012-10-18 15:01:20 -0700 | [diff] [blame] | 2132 | eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId) |
| 2133 | { |
| 2134 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2135 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2136 | |
| 2137 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2138 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2139 | { |
Madan Mohan Koyyalamudi | 5850f31 | 2012-11-27 19:00:25 +0530 | [diff] [blame] | 2140 | status = csrScanFlushSelectiveResult( hHal, VOS_TRUE ); |
Madan Mohan Koyyalamudi | a3fcf14 | 2012-10-18 15:01:20 -0700 | [diff] [blame] | 2141 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2142 | } |
| 2143 | |
| 2144 | return (status); |
| 2145 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2146 | |
| 2147 | /* --------------------------------------------------------------------------- |
| 2148 | \fn sme_ScanResultGetFirst |
| 2149 | \brief a wrapper function to request CSR to returns the first element of |
| 2150 | scan result. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2151 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2152 | \param hScanResult - returned from csrScanGetResult |
| 2153 | \return tCsrScanResultInfo * - NULL if no result |
| 2154 | ---------------------------------------------------------------------------*/ |
| 2155 | tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal, |
| 2156 | tScanResultHandle hScanResult) |
| 2157 | { |
| 2158 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2159 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2160 | tCsrScanResultInfo *pRet = NULL; |
| 2161 | |
| 2162 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2163 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2164 | { |
| 2165 | pRet = csrScanResultGetFirst( pMac, hScanResult ); |
| 2166 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2167 | } |
| 2168 | |
| 2169 | return (pRet); |
| 2170 | } |
| 2171 | |
| 2172 | |
| 2173 | /* --------------------------------------------------------------------------- |
| 2174 | \fn sme_ScanResultGetNext |
| 2175 | \brief a wrapper function to request CSR to returns the next element of |
| 2176 | scan result. It can be called without calling csrScanResultGetFirst |
| 2177 | first |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2178 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2179 | \param hScanResult - returned from csrScanGetResult |
| 2180 | \return Null if no result or reach the end |
| 2181 | ---------------------------------------------------------------------------*/ |
| 2182 | tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal, |
| 2183 | tScanResultHandle hScanResult) |
| 2184 | { |
| 2185 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2186 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2187 | tCsrScanResultInfo *pRet = NULL; |
| 2188 | |
| 2189 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2190 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2191 | { |
| 2192 | pRet = csrScanResultGetNext( pMac, hScanResult ); |
| 2193 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2194 | } |
| 2195 | |
| 2196 | return (pRet); |
| 2197 | } |
| 2198 | |
| 2199 | |
| 2200 | /* --------------------------------------------------------------------------- |
| 2201 | \fn sme_ScanSetBGScanparams |
| 2202 | \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] | 2203 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2204 | \param pScanReq - BG scan request structure |
| 2205 | \return eHalStatus |
| 2206 | ---------------------------------------------------------------------------*/ |
| 2207 | eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq) |
| 2208 | { |
| 2209 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2210 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2211 | |
| 2212 | if( NULL != pScanReq ) |
| 2213 | { |
| 2214 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2215 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2216 | { |
| 2217 | status = csrScanSetBGScanparams( hHal, pScanReq ); |
| 2218 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2219 | } |
| 2220 | } |
| 2221 | |
| 2222 | return (status); |
| 2223 | } |
| 2224 | |
| 2225 | |
| 2226 | /* --------------------------------------------------------------------------- |
| 2227 | \fn sme_ScanResultPurge |
| 2228 | \brief a wrapper function to request CSR to remove all items(tCsrScanResult) |
| 2229 | in the list and free memory for each item |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2230 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2231 | \param hScanResult - returned from csrScanGetResult. hScanResult is |
| 2232 | considered gone by |
| 2233 | calling this function and even before this function reutrns. |
| 2234 | \return eHalStatus |
| 2235 | ---------------------------------------------------------------------------*/ |
| 2236 | eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult) |
| 2237 | { |
| 2238 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2239 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2240 | |
| 2241 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2242 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2243 | { |
| 2244 | status = csrScanResultPurge( hHal, hScanResult ); |
| 2245 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2246 | } |
| 2247 | |
| 2248 | return (status); |
| 2249 | } |
| 2250 | |
| 2251 | /* --------------------------------------------------------------------------- |
| 2252 | \fn sme_ScanGetPMKIDCandidateList |
| 2253 | \brief a wrapper function to return the PMKID candidate list |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2254 | This is a synchronous call |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2255 | \param pPmkidList - caller allocated buffer point to an array of |
| 2256 | tPmkidCandidateInfo |
| 2257 | \param pNumItems - pointer to a variable that has the number of |
| 2258 | tPmkidCandidateInfo allocated when retruning, this is |
| 2259 | either the number needed or number of items put into |
| 2260 | pPmkidList |
| 2261 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2262 | big enough and pNumItems |
| 2263 | has the number of tPmkidCandidateInfo. |
| 2264 | \Note: pNumItems is a number of tPmkidCandidateInfo, |
| 2265 | not sizeof(tPmkidCandidateInfo) * something |
| 2266 | ---------------------------------------------------------------------------*/ |
| 2267 | eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId, |
| 2268 | tPmkidCandidateInfo *pPmkidList, |
| 2269 | tANI_U32 *pNumItems ) |
| 2270 | { |
| 2271 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2272 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2273 | |
| 2274 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2275 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2276 | { |
| 2277 | status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems ); |
| 2278 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2279 | } |
| 2280 | |
| 2281 | return (status); |
| 2282 | } |
| 2283 | |
| 2284 | /*---------------------------------------------------------------------------- |
| 2285 | \fn sme_RoamRegisterLinkQualityIndCallback |
| 2286 | |
| 2287 | \brief |
| 2288 | a wrapper function to allow HDD to register a callback handler with CSR for |
| 2289 | link quality indications. |
| 2290 | |
| 2291 | Only one callback may be registered at any time. |
| 2292 | In order to deregister the callback, a NULL cback may be provided. |
| 2293 | |
| 2294 | Registration happens in the task context of the caller. |
| 2295 | |
| 2296 | \param callback - Call back being registered |
| 2297 | \param pContext - user data |
| 2298 | |
| 2299 | DEPENDENCIES: After CSR open |
| 2300 | |
| 2301 | \return eHalStatus |
| 2302 | -----------------------------------------------------------------------------*/ |
| 2303 | eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId, |
| 2304 | csrRoamLinkQualityIndCallback callback, |
| 2305 | void *pContext) |
| 2306 | { |
| 2307 | return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext)); |
| 2308 | } |
| 2309 | |
| 2310 | /* --------------------------------------------------------------------------- |
| 2311 | \fn sme_RoamRegisterCallback |
| 2312 | \brief a wrapper function to allow HDD to register a callback with CSR. |
| 2313 | Unlike scan, roam has one callback for all the roam requests |
| 2314 | \param callback - a callback function that roam calls upon when state changes |
| 2315 | \param pContext - a pointer passed in for the callback |
| 2316 | \return eHalStatus |
| 2317 | ---------------------------------------------------------------------------*/ |
| 2318 | eHalStatus sme_RoamRegisterCallback(tHalHandle hHal, |
| 2319 | csrRoamCompleteCallback callback, |
| 2320 | void *pContext) |
| 2321 | { |
| 2322 | return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext)); |
| 2323 | } |
| 2324 | |
| 2325 | eCsrPhyMode sme_GetPhyMode(tHalHandle hHal) |
| 2326 | { |
| 2327 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 2328 | return pMac->roam.configParam.phyMode; |
| 2329 | } |
| 2330 | |
| 2331 | /* --------------------------------------------------------------------------- |
| 2332 | \fn sme_RoamConnect |
| 2333 | \brief a wrapper function to request CSR to inititiate an association |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2334 | This is an asynchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2335 | \param sessionId - the sessionId returned by sme_OpenSession. |
| 2336 | \param pProfile - description of the network to which to connect |
| 2337 | \param hBssListIn - a list of BSS descriptor to roam to. It is returned |
| 2338 | from csrScanGetResult |
| 2339 | \param pRoamId - to get back the request ID |
| 2340 | \return eHalStatus |
| 2341 | ---------------------------------------------------------------------------*/ |
| 2342 | eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile, |
| 2343 | tANI_U32 *pRoamId) |
| 2344 | { |
| 2345 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2346 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2347 | |
| 2348 | smsLog(pMac, LOG2, FL("enter")); |
| 2349 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2350 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2351 | { |
| 2352 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2353 | { |
| 2354 | status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId ); |
| 2355 | } |
| 2356 | else |
| 2357 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2358 | smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2360 | } |
| 2361 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2362 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2363 | else |
| 2364 | { |
| 2365 | smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed")); |
| 2366 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2367 | |
| 2368 | return (status); |
| 2369 | } |
| 2370 | |
| 2371 | /* --------------------------------------------------------------------------- |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 2372 | |
| 2373 | \fn sme_SetPhyMode |
| 2374 | |
| 2375 | \brief Changes the PhyMode. |
| 2376 | |
| 2377 | \param hHal - The handle returned by macOpen. |
| 2378 | |
| 2379 | \param phyMode new phyMode which is to set |
| 2380 | |
| 2381 | \return eHalStatus SUCCESS. |
| 2382 | |
| 2383 | -------------------------------------------------------------------------------*/ |
| 2384 | eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode) |
| 2385 | { |
| 2386 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2387 | |
| 2388 | if (NULL == pMac) |
| 2389 | { |
| 2390 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 2391 | "%s: invalid context", __func__); |
| 2392 | return eHAL_STATUS_FAILURE; |
| 2393 | } |
| 2394 | |
| 2395 | pMac->roam.configParam.phyMode = phyMode; |
| 2396 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, |
| 2397 | pMac->roam.configParam.phyMode, |
| 2398 | pMac->roam.configParam.ProprietaryRatesEnabled); |
| 2399 | |
| 2400 | return eHAL_STATUS_SUCCESS; |
| 2401 | } |
| 2402 | |
| 2403 | /* --------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2404 | \fn sme_RoamReassoc |
| 2405 | \brief a wrapper function to request CSR to inititiate a re-association |
| 2406 | \param pProfile - can be NULL to join the currently connected AP. In that |
| 2407 | case modProfileFields should carry the modified field(s) which could trigger |
| 2408 | reassoc |
| 2409 | \param modProfileFields - fields which are part of tCsrRoamConnectedProfile |
| 2410 | that might need modification dynamically once STA is up & running and this |
| 2411 | could trigger a reassoc |
| 2412 | \param pRoamId - to get back the request ID |
| 2413 | \return eHalStatus |
| 2414 | -------------------------------------------------------------------------------*/ |
| 2415 | eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile, |
| 2416 | tCsrRoamModifyProfileFields modProfileFields, |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 2417 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2418 | { |
| 2419 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2420 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2421 | |
| 2422 | smsLog(pMac, LOG2, FL("enter")); |
| 2423 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2424 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2425 | { |
| 2426 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2427 | { |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 2428 | if((NULL == pProfile) && (fForce == 1)) |
| 2429 | { |
| 2430 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2431 | /* to force the AP initiate fresh 802.1x authentication need to clear |
| 2432 | * the PMKID cache for that set the following boolean. this is needed |
| 2433 | * by the HS 2.0 passpoint certification 5.2.a and b testcases */ |
| 2434 | pSession->fIgnorePMKIDCache = TRUE; |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 2435 | status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce); |
| 2436 | } |
| 2437 | else |
| 2438 | { |
| 2439 | status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId ); |
| 2440 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2441 | } |
| 2442 | else |
| 2443 | { |
| 2444 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2445 | } |
| 2446 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2447 | } |
| 2448 | |
| 2449 | return (status); |
| 2450 | } |
| 2451 | |
| 2452 | /* --------------------------------------------------------------------------- |
| 2453 | \fn sme_RoamConnectToLastProfile |
| 2454 | \brief a wrapper function to request CSR to disconnect and reconnect with |
| 2455 | the same profile |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2456 | This is an asynchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2457 | \return eHalStatus. It returns fail if currently connected |
| 2458 | ---------------------------------------------------------------------------*/ |
| 2459 | eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId) |
| 2460 | { |
| 2461 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2462 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2463 | |
| 2464 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2465 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2466 | { |
| 2467 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2468 | { |
| 2469 | status = csrRoamConnectToLastProfile( pMac, sessionId ); |
| 2470 | } |
| 2471 | else |
| 2472 | { |
| 2473 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2474 | } |
| 2475 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2476 | } |
| 2477 | |
| 2478 | return (status); |
| 2479 | } |
| 2480 | |
| 2481 | /* --------------------------------------------------------------------------- |
| 2482 | \fn sme_RoamDisconnect |
| 2483 | \brief a wrapper function to request CSR to disconnect from a network |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2484 | This is an asynchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2485 | \param reason -- To indicate the reason for disconnecting. Currently, only |
| 2486 | eCSR_DISCONNECT_REASON_MIC_ERROR is meanful. |
| 2487 | \return eHalStatus |
| 2488 | ---------------------------------------------------------------------------*/ |
| 2489 | eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason) |
| 2490 | { |
| 2491 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2492 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2493 | |
| 2494 | smsLog(pMac, LOG2, FL("enter")); |
| 2495 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2496 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2497 | { |
| 2498 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2499 | { |
| 2500 | status = csrRoamDisconnect( pMac, sessionId, reason ); |
| 2501 | } |
| 2502 | else |
| 2503 | { |
| 2504 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2505 | } |
| 2506 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2507 | } |
| 2508 | |
| 2509 | return (status); |
| 2510 | } |
| 2511 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | /* --------------------------------------------------------------------------- |
| 2513 | \fn sme_RoamStopBss |
| 2514 | \brief To stop BSS for Soft AP. This is an asynchronous API. |
| 2515 | \param hHal - Global structure |
| 2516 | \param sessionId - sessionId of SoftAP |
| 2517 | \return eHalStatus SUCCESS Roam callback will be called to indicate actual results |
| 2518 | -------------------------------------------------------------------------------*/ |
| 2519 | eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId) |
| 2520 | { |
| 2521 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2522 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2523 | |
| 2524 | smsLog(pMac, LOG2, FL("enter")); |
| 2525 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2526 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2527 | { |
| 2528 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2529 | { |
Gopichand Nakkala | f44bdc5 | 2013-02-16 00:54:45 +0530 | [diff] [blame] | 2530 | status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2531 | } |
| 2532 | else |
| 2533 | { |
| 2534 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2535 | } |
| 2536 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2537 | } |
| 2538 | |
| 2539 | return (status); |
| 2540 | } |
| 2541 | |
| 2542 | /* --------------------------------------------------------------------------- |
| 2543 | \fn sme_RoamDisconnectSta |
| 2544 | \brief To disassociate a station. This is an asynchronous API. |
| 2545 | \param hHal - Global structure |
| 2546 | \param sessionId - sessionId of SoftAP |
| 2547 | \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes) |
| 2548 | \return eHalStatus SUCCESS Roam callback will be called to indicate actual results |
| 2549 | -------------------------------------------------------------------------------*/ |
| 2550 | eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId, |
| 2551 | tANI_U8 *pPeerMacAddr) |
| 2552 | { |
| 2553 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2554 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2555 | |
| 2556 | if ( NULL == pMac ) |
| 2557 | { |
| 2558 | VOS_ASSERT(0); |
| 2559 | return status; |
| 2560 | } |
| 2561 | |
| 2562 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2563 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2564 | { |
| 2565 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2566 | { |
| 2567 | status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr, |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2568 | eSIR_MAC_DEAUTH_LEAVING_BSS_REASON); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2569 | } |
| 2570 | else |
| 2571 | { |
| 2572 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2573 | } |
| 2574 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2575 | } |
| 2576 | |
| 2577 | return (status); |
| 2578 | } |
| 2579 | |
| 2580 | /* --------------------------------------------------------------------------- |
| 2581 | \fn sme_RoamDeauthSta |
| 2582 | \brief To disassociate a station. This is an asynchronous API. |
| 2583 | \param hHal - Global structure |
| 2584 | \param sessionId - sessionId of SoftAP |
| 2585 | \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes) |
| 2586 | \return eHalStatus SUCCESS Roam callback will be called to indicate actual results |
| 2587 | -------------------------------------------------------------------------------*/ |
| 2588 | eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId, |
| 2589 | tANI_U8 *pPeerMacAddr) |
| 2590 | { |
| 2591 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2592 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2593 | |
| 2594 | if ( NULL == pMac ) |
| 2595 | { |
| 2596 | VOS_ASSERT(0); |
| 2597 | return status; |
| 2598 | } |
| 2599 | |
| 2600 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2601 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2602 | { |
| 2603 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2604 | { |
| 2605 | status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr, |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2606 | eSIR_MAC_DEAUTH_LEAVING_BSS_REASON); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2607 | } |
| 2608 | else |
| 2609 | { |
| 2610 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2611 | } |
| 2612 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2613 | } |
| 2614 | |
| 2615 | return (status); |
| 2616 | } |
| 2617 | |
| 2618 | /* --------------------------------------------------------------------------- |
| 2619 | \fn sme_RoamTKIPCounterMeasures |
| 2620 | \brief To start or stop TKIP counter measures. This is an asynchronous API. |
| 2621 | \param sessionId - sessionId of SoftAP |
| 2622 | \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes) |
| 2623 | \return eHalStatus |
| 2624 | -------------------------------------------------------------------------------*/ |
| 2625 | eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId, |
| 2626 | tANI_BOOLEAN bEnable) |
| 2627 | { |
| 2628 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2629 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2630 | |
| 2631 | if ( NULL == pMac ) |
| 2632 | { |
| 2633 | VOS_ASSERT(0); |
| 2634 | return status; |
| 2635 | } |
| 2636 | |
| 2637 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2638 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2639 | { |
| 2640 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2641 | { |
| 2642 | status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable); |
| 2643 | } |
| 2644 | else |
| 2645 | { |
| 2646 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2647 | } |
| 2648 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2649 | } |
| 2650 | |
| 2651 | return (status); |
| 2652 | } |
| 2653 | |
| 2654 | /* --------------------------------------------------------------------------- |
| 2655 | \fn sme_RoamGetAssociatedStas |
| 2656 | \brief To probe the list of associated stations from various modules of CORE stack. |
| 2657 | \This is an asynchronous API. |
| 2658 | \param sessionId - sessionId of SoftAP |
| 2659 | \param modId - Module from whom list of associtated stations is to be probed. |
| 2660 | If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed |
| 2661 | \param pUsrContext - Opaque HDD context |
| 2662 | \param pfnSapEventCallback - Sap event callback in HDD |
| 2663 | \param pAssocBuf - Caller allocated memory to be filled with associatd stations info |
| 2664 | \return eHalStatus |
| 2665 | -------------------------------------------------------------------------------*/ |
| 2666 | eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId, |
| 2667 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2668 | void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf) |
| 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 = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2685 | } |
| 2686 | else |
| 2687 | { |
| 2688 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2689 | } |
| 2690 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2691 | } |
| 2692 | |
| 2693 | return (status); |
| 2694 | } |
| 2695 | |
| 2696 | /* --------------------------------------------------------------------------- |
| 2697 | \fn sme_RoamGetWpsSessionOverlap |
| 2698 | \brief To get the WPS PBC session overlap information. |
| 2699 | \This is an asynchronous API. |
| 2700 | \param sessionId - sessionId of SoftAP |
| 2701 | \param pUsrContext - Opaque HDD context |
| 2702 | \param pfnSapEventCallback - Sap event callback in HDD |
| 2703 | \pRemoveMac - pointer to Mac address which needs to be removed from session |
| 2704 | \return eHalStatus |
| 2705 | -------------------------------------------------------------------------------*/ |
| 2706 | eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId, |
| 2707 | void *pUsrContext, void |
| 2708 | *pfnSapEventCallback, v_MACADDR_t pRemoveMac) |
| 2709 | { |
| 2710 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2711 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2712 | |
| 2713 | if ( NULL == pMac ) |
| 2714 | { |
| 2715 | VOS_ASSERT(0); |
| 2716 | return status; |
| 2717 | } |
| 2718 | |
| 2719 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2720 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2721 | { |
| 2722 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2723 | { |
| 2724 | status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2725 | } |
| 2726 | else |
| 2727 | { |
| 2728 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2729 | } |
| 2730 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2731 | } |
| 2732 | |
| 2733 | return (status); |
| 2734 | } |
| 2735 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2736 | |
| 2737 | /* --------------------------------------------------------------------------- |
| 2738 | \fn sme_RoamGetConnectState |
| 2739 | \brief a wrapper function to request CSR to return the current connect state |
| 2740 | of Roaming |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2741 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2742 | \return eHalStatus |
| 2743 | ---------------------------------------------------------------------------*/ |
| 2744 | eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState) |
| 2745 | { |
| 2746 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2747 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2748 | |
| 2749 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2750 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2751 | { |
| 2752 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2753 | { |
| 2754 | status = csrRoamGetConnectState( pMac, sessionId, pState ); |
| 2755 | } |
| 2756 | else |
| 2757 | { |
| 2758 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2759 | } |
| 2760 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2761 | } |
| 2762 | |
| 2763 | return (status); |
| 2764 | } |
| 2765 | |
| 2766 | /* --------------------------------------------------------------------------- |
| 2767 | \fn sme_RoamGetConnectProfile |
| 2768 | \brief a wrapper function to request CSR to return the current connect |
| 2769 | profile. Caller must call csrRoamFreeConnectProfile after it is done |
| 2770 | and before reuse for another csrRoamGetConnectProfile call. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2771 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2772 | \param pProfile - pointer to a caller allocated structure |
| 2773 | tCsrRoamConnectedProfile |
| 2774 | \return eHalStatus. Failure if not connected |
| 2775 | ---------------------------------------------------------------------------*/ |
| 2776 | eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId, |
| 2777 | tCsrRoamConnectedProfile *pProfile) |
| 2778 | { |
| 2779 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2780 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2781 | |
| 2782 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2783 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2784 | { |
| 2785 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2786 | { |
| 2787 | status = csrRoamGetConnectProfile( pMac, sessionId, pProfile ); |
| 2788 | } |
| 2789 | else |
| 2790 | { |
| 2791 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2792 | } |
| 2793 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2794 | } |
| 2795 | |
| 2796 | return (status); |
| 2797 | } |
| 2798 | |
| 2799 | /* --------------------------------------------------------------------------- |
| 2800 | \fn sme_RoamFreeConnectProfile |
| 2801 | \brief a wrapper function to request CSR to free and reinitialize the |
| 2802 | profile returned previously by csrRoamGetConnectProfile. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2803 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2804 | \param pProfile - pointer to a caller allocated structure |
| 2805 | tCsrRoamConnectedProfile |
| 2806 | \return eHalStatus. |
| 2807 | ---------------------------------------------------------------------------*/ |
| 2808 | eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal, |
| 2809 | tCsrRoamConnectedProfile *pProfile) |
| 2810 | { |
| 2811 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2812 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2813 | |
| 2814 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2815 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2816 | { |
| 2817 | status = csrRoamFreeConnectProfile( pMac, pProfile ); |
| 2818 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2819 | } |
| 2820 | |
| 2821 | return (status); |
| 2822 | } |
| 2823 | |
| 2824 | /* --------------------------------------------------------------------------- |
| 2825 | \fn sme_RoamSetPMKIDCache |
| 2826 | \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] | 2827 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2828 | \param pPMKIDCache - caller allocated buffer point to an array of |
| 2829 | tPmkidCacheInfo |
| 2830 | \param numItems - a variable that has the number of tPmkidCacheInfo |
| 2831 | allocated when retruning, this is either the number needed |
| 2832 | or number of items put into pPMKIDCache |
| 2833 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2834 | big enough and pNumItems has the number of |
| 2835 | tPmkidCacheInfo. |
| 2836 | \Note: pNumItems is a number of tPmkidCacheInfo, |
| 2837 | not sizeof(tPmkidCacheInfo) * something |
| 2838 | ---------------------------------------------------------------------------*/ |
| 2839 | eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache, |
| 2840 | tANI_U32 numItems ) |
| 2841 | { |
| 2842 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2843 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2844 | |
| 2845 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2846 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2847 | { |
| 2848 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2849 | { |
| 2850 | status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems ); |
| 2851 | } |
| 2852 | else |
| 2853 | { |
| 2854 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2855 | } |
| 2856 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2857 | } |
| 2858 | |
| 2859 | return (status); |
| 2860 | } |
| 2861 | |
| 2862 | /* --------------------------------------------------------------------------- |
| 2863 | \fn sme_RoamGetSecurityReqIE |
| 2864 | \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR |
| 2865 | passes to PE to JOIN request or START_BSS request |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2866 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2867 | \param pLen - caller allocated memory that has the length of pBuf as input. |
| 2868 | Upon returned, *pLen has the needed or IE length in pBuf. |
| 2869 | \param pBuf - Caller allocated memory that contain the IE field, if any, |
| 2870 | upon return |
| 2871 | \param secType - Specifies whether looking for WPA/WPA2/WAPI IE |
| 2872 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2873 | big enough |
| 2874 | ---------------------------------------------------------------------------*/ |
| 2875 | eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen, |
| 2876 | tANI_U8 *pBuf, eCsrSecurityType secType) |
| 2877 | { |
| 2878 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2879 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2880 | |
| 2881 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2882 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2883 | { |
| 2884 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2885 | { |
| 2886 | status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf ); |
| 2887 | } |
| 2888 | else |
| 2889 | { |
| 2890 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2891 | } |
| 2892 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2893 | } |
| 2894 | |
| 2895 | return (status); |
| 2896 | } |
| 2897 | |
| 2898 | /* --------------------------------------------------------------------------- |
| 2899 | \fn sme_RoamGetSecurityRspIE |
| 2900 | \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from |
| 2901 | the beacon or probe rsp if connected |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2902 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2903 | \param pLen - caller allocated memory that has the length of pBuf as input. |
| 2904 | Upon returned, *pLen has the needed or IE length in pBuf. |
| 2905 | \param pBuf - Caller allocated memory that contain the IE field, if any, |
| 2906 | upon return |
| 2907 | \param secType - Specifies whether looking for WPA/WPA2/WAPI IE |
| 2908 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2909 | big enough |
| 2910 | ---------------------------------------------------------------------------*/ |
| 2911 | eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen, |
| 2912 | tANI_U8 *pBuf, eCsrSecurityType secType) |
| 2913 | { |
| 2914 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2915 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2916 | |
| 2917 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2918 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2919 | { |
| 2920 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2921 | { |
| 2922 | status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf ); |
| 2923 | } |
| 2924 | else |
| 2925 | { |
| 2926 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2927 | } |
| 2928 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2929 | } |
| 2930 | |
| 2931 | return (status); |
| 2932 | |
| 2933 | } |
| 2934 | |
| 2935 | |
| 2936 | /* --------------------------------------------------------------------------- |
| 2937 | \fn sme_RoamGetNumPMKIDCache |
| 2938 | \brief a wrapper function to request CSR to return number of PMKID cache |
| 2939 | entries |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2940 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2941 | \return tANI_U32 - the number of PMKID cache entries |
| 2942 | ---------------------------------------------------------------------------*/ |
| 2943 | tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId) |
| 2944 | { |
| 2945 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2946 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2947 | tANI_U32 numPmkidCache = 0; |
| 2948 | |
| 2949 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2950 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2951 | { |
| 2952 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2953 | { |
| 2954 | numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId ); |
| 2955 | status = eHAL_STATUS_SUCCESS; |
| 2956 | } |
| 2957 | else |
| 2958 | { |
| 2959 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2960 | } |
| 2961 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2962 | } |
| 2963 | |
| 2964 | return (numPmkidCache); |
| 2965 | } |
| 2966 | |
| 2967 | /* --------------------------------------------------------------------------- |
| 2968 | \fn sme_RoamGetPMKIDCache |
| 2969 | \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] | 2970 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2971 | \param pNum - caller allocated memory that has the space of the number of |
| 2972 | pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the |
| 2973 | needed or actually number in tPmkidCacheInfo. |
| 2974 | \param pPmkidCache - Caller allocated memory that contains PMKID cache, if |
| 2975 | any, upon return |
| 2976 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 2977 | big enough |
| 2978 | ---------------------------------------------------------------------------*/ |
| 2979 | eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum, |
| 2980 | tPmkidCacheInfo *pPmkidCache) |
| 2981 | { |
| 2982 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2983 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2984 | |
| 2985 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 2986 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 2987 | { |
| 2988 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 2989 | { |
| 2990 | status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache ); |
| 2991 | } |
| 2992 | else |
| 2993 | { |
| 2994 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 2995 | } |
| 2996 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 2997 | } |
| 2998 | |
| 2999 | return (status); |
| 3000 | } |
| 3001 | |
| 3002 | |
| 3003 | /* --------------------------------------------------------------------------- |
| 3004 | \fn sme_GetConfigParam |
| 3005 | \brief a wrapper function that HDD calls to get the global settings |
| 3006 | currently maintained by CSR. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3007 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3008 | \param pParam - caller allocated memory |
| 3009 | \return eHalStatus |
| 3010 | ---------------------------------------------------------------------------*/ |
| 3011 | eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam) |
| 3012 | { |
| 3013 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3014 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3015 | |
| 3016 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3017 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3018 | { |
| 3019 | status = csrGetConfigParam(pMac, &pParam->csrConfig); |
| 3020 | if (status != eHAL_STATUS_SUCCESS) |
| 3021 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 3022 | smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3023 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3024 | return status; |
| 3025 | } |
| 3026 | #if defined WLAN_FEATURE_P2P_INTERNAL |
| 3027 | status = p2pGetConfigParam(pMac, &pParam->p2pConfig); |
| 3028 | if (status != eHAL_STATUS_SUCCESS) |
| 3029 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 3030 | smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3031 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3032 | return status; |
| 3033 | } |
| 3034 | #endif |
| 3035 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3036 | } |
| 3037 | |
| 3038 | return (status); |
| 3039 | } |
| 3040 | |
| 3041 | /* --------------------------------------------------------------------------- |
| 3042 | \fn sme_CfgSetInt |
| 3043 | \brief a wrapper function that HDD calls to set parameters in CFG. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3044 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3045 | \param cfgId - Configuration Parameter ID (type) for STA. |
| 3046 | \param ccmValue - The information related to Configuration Parameter ID |
| 3047 | which needs to be saved in CFG |
| 3048 | \param callback - To be registered by CSR with CCM. Once the CFG done with |
| 3049 | saving the information in the database, it notifies CCM & |
| 3050 | then the callback will be invoked to notify. |
| 3051 | \param toBeSaved - To save the request for future reference |
| 3052 | \return eHalStatus |
| 3053 | ---------------------------------------------------------------------------*/ |
| 3054 | eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue, |
| 3055 | tCcmCfgSetCallback callback, eAniBoolean toBeSaved) |
| 3056 | { |
| 3057 | return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved)); |
| 3058 | } |
| 3059 | |
| 3060 | /* --------------------------------------------------------------------------- |
| 3061 | \fn sme_CfgSetStr |
| 3062 | \brief a wrapper function that HDD calls to set parameters in CFG. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3063 | This is a synchronous call. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3064 | \param cfgId - Configuration Parameter ID (type) for STA. |
| 3065 | \param pStr - Pointer to the byte array which carries the information needs |
| 3066 | to be saved in CFG |
| 3067 | \param length - Length of the data to be saved |
| 3068 | \param callback - To be registered by CSR with CCM. Once the CFG done with |
| 3069 | saving the information in the database, it notifies CCM & |
| 3070 | then the callback will be invoked to notify. |
| 3071 | \param toBeSaved - To save the request for future reference |
| 3072 | \return eHalStatus |
| 3073 | ---------------------------------------------------------------------------*/ |
| 3074 | eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr, |
| 3075 | tANI_U32 length, tCcmCfgSetCallback callback, |
| 3076 | eAniBoolean toBeSaved) |
| 3077 | { |
| 3078 | return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved)); |
| 3079 | } |
| 3080 | |
| 3081 | /* --------------------------------------------------------------------------- |
| 3082 | \fn sme_GetModifyProfileFields |
| 3083 | \brief HDD or SME - QOS calls this function to get the current values of |
| 3084 | connected profile fields, changing which can cause reassoc. |
| 3085 | This function must be called after CFG is downloaded and STA is in connected |
| 3086 | state. Also, make sure to call this function to get the current profile |
| 3087 | fields before calling the reassoc. So that pModifyProfileFields will have |
| 3088 | all the latest values plus the one(s) has been updated as part of reassoc |
| 3089 | request. |
| 3090 | \param pModifyProfileFields - pointer to the connected profile fields |
| 3091 | changing which can cause reassoc |
| 3092 | |
| 3093 | \return eHalStatus |
| 3094 | -------------------------------------------------------------------------------*/ |
| 3095 | eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId, |
| 3096 | tCsrRoamModifyProfileFields * pModifyProfileFields) |
| 3097 | { |
| 3098 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3099 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3100 | |
| 3101 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3102 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3103 | { |
| 3104 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 3105 | { |
| 3106 | status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields); |
| 3107 | } |
| 3108 | else |
| 3109 | { |
| 3110 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 3111 | } |
| 3112 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3113 | } |
| 3114 | |
| 3115 | return (status); |
| 3116 | } |
| 3117 | |
| 3118 | /*-------------------------------------------------------------------------- |
| 3119 | \fn sme_SetConfigPowerSave |
| 3120 | \brief Wrapper fn to change power save configuration in SME (PMC) module. |
| 3121 | For BMPS related configuration, this function also updates the CFG |
| 3122 | and sends a message to FW to pick up the new values. Note: Calling |
| 3123 | this function only updates the configuration and does not enable |
| 3124 | the specified power save mode. |
| 3125 | \param hHal - The handle returned by macOpen. |
| 3126 | \param psMode - Power Saving mode being modified |
| 3127 | \param pConfigParams - a pointer to a caller allocated object of type |
| 3128 | tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams |
| 3129 | \return eHalStatus |
| 3130 | --------------------------------------------------------------------------*/ |
| 3131 | eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode, |
| 3132 | void *pConfigParams) |
| 3133 | { |
| 3134 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3135 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3136 | |
| 3137 | if (NULL == pConfigParams ) { |
| 3138 | smsLog( pMac, LOGE, "Empty config param structure for PMC, " |
| 3139 | "nothing to update"); |
| 3140 | return eHAL_STATUS_FAILURE; |
| 3141 | } |
| 3142 | |
| 3143 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3144 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3145 | { |
| 3146 | status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams); |
| 3147 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3148 | } |
| 3149 | |
| 3150 | return (status); |
| 3151 | } |
| 3152 | |
| 3153 | /*-------------------------------------------------------------------------- |
| 3154 | \fn sme_GetConfigPowerSave |
| 3155 | \brief Wrapper fn to retrieve power save configuration in SME (PMC) module |
| 3156 | \param hHal - The handle returned by macOpen. |
| 3157 | \param psMode - Power Saving mode |
| 3158 | \param pConfigParams - a pointer to a caller allocated object of type |
| 3159 | tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams |
| 3160 | \return eHalStatus |
| 3161 | --------------------------------------------------------------------------*/ |
| 3162 | eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode, |
| 3163 | void *pConfigParams) |
| 3164 | { |
| 3165 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3166 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3167 | |
| 3168 | if (NULL == pConfigParams ) { |
| 3169 | smsLog( pMac, LOGE, "Empty config param structure for PMC, " |
| 3170 | "nothing to update"); |
| 3171 | return eHAL_STATUS_FAILURE; |
| 3172 | } |
| 3173 | |
| 3174 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3175 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3176 | { |
| 3177 | status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams); |
| 3178 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3179 | } |
| 3180 | |
| 3181 | return (status); |
| 3182 | } |
| 3183 | |
| 3184 | /* --------------------------------------------------------------------------- |
| 3185 | \fn sme_SignalPowerEvent |
| 3186 | \brief Signals to PMC that a power event has occurred. Used for putting |
| 3187 | the chip into deep sleep mode. |
| 3188 | \param hHal - The handle returned by macOpen. |
| 3189 | \param event - the event that has occurred |
| 3190 | \return eHalStatus |
| 3191 | ---------------------------------------------------------------------------*/ |
| 3192 | eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event) |
| 3193 | { |
| 3194 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3195 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3196 | |
| 3197 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3198 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3199 | { |
| 3200 | status = pmcSignalPowerEvent(hHal, event); |
| 3201 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3202 | } |
| 3203 | |
| 3204 | return (status); |
| 3205 | } |
| 3206 | |
| 3207 | /* --------------------------------------------------------------------------- |
| 3208 | \fn sme_EnablePowerSave |
| 3209 | \brief Enables one of the power saving modes. |
| 3210 | \param hHal - The handle returned by macOpen. |
| 3211 | \param psMode - The power saving mode to enable. If BMPS mode is enabled |
| 3212 | while the chip is operating in Full Power, PMC will start |
| 3213 | a timer that will try to put the chip in BMPS mode after |
| 3214 | expiry. |
| 3215 | \return eHalStatus |
| 3216 | ---------------------------------------------------------------------------*/ |
| 3217 | eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode) |
| 3218 | { |
| 3219 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3220 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3221 | |
| 3222 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3223 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3224 | { |
| 3225 | status = pmcEnablePowerSave(hHal, psMode); |
| 3226 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3227 | } |
| 3228 | |
| 3229 | return (status); |
| 3230 | } |
| 3231 | |
| 3232 | /* --------------------------------------------------------------------------- |
| 3233 | \fn sme_DisablePowerSave |
| 3234 | \brief Disables one of the power saving modes. |
| 3235 | \param hHal - The handle returned by macOpen. |
| 3236 | \param psMode - The power saving mode to disable. Disabling does not imply |
| 3237 | that device will be brought out of the current PS mode. This |
| 3238 | is purely a configuration API. |
| 3239 | \return eHalStatus |
| 3240 | ---------------------------------------------------------------------------*/ |
| 3241 | eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode) |
| 3242 | { |
| 3243 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3244 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3245 | |
| 3246 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3247 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3248 | { |
| 3249 | status = pmcDisablePowerSave(hHal, psMode); |
| 3250 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3251 | } |
| 3252 | |
| 3253 | return (status); |
| 3254 | } |
| 3255 | |
| 3256 | /* --------------------------------------------------------------------------- |
Madan Mohan Koyyalamudi | 69b3418 | 2013-01-16 08:51:40 +0530 | [diff] [blame] | 3257 | + \fn sme_SetHostPowerSave |
| 3258 | + \brief Enables BMPS logic to be controlled by User level apps |
| 3259 | + \param hHal - The handle returned by macOpen. |
| 3260 | + \param psMode - The power saving mode to disable. Disabling does not imply |
| 3261 | + that device will be brought out of the current PS mode. This |
| 3262 | + is purely a configuration API. |
| 3263 | + \return eHalStatus |
| 3264 | + ---------------------------------------------------------------------------*/ |
| 3265 | eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode) |
| 3266 | { |
| 3267 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3268 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3269 | |
| 3270 | pMac->pmc.isHostPsEn = psMode; |
| 3271 | |
| 3272 | return (status); |
| 3273 | } |
| 3274 | |
| 3275 | /* --------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3276 | \fn sme_StartAutoBmpsTimer |
| 3277 | \brief Starts a timer that periodically polls all the registered |
| 3278 | module for entry into Bmps mode. This timer is started only if BMPS is |
| 3279 | enabled and whenever the device is in full power. |
| 3280 | \param hHal - The handle returned by macOpen. |
| 3281 | \return eHalStatus |
| 3282 | ---------------------------------------------------------------------------*/ |
| 3283 | eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal) |
| 3284 | { |
| 3285 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3286 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3287 | |
| 3288 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3289 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3290 | { |
| 3291 | status = pmcStartAutoBmpsTimer(hHal); |
| 3292 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3293 | } |
| 3294 | |
| 3295 | return (status); |
| 3296 | } |
| 3297 | /* --------------------------------------------------------------------------- |
| 3298 | \fn sme_StopAutoBmpsTimer |
| 3299 | \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer |
| 3300 | Stopping the timer does not cause a device state change. Only the timer |
| 3301 | is stopped. If "Full Power" is desired, use the sme_RequestFullPower API |
| 3302 | \param hHal - The handle returned by macOpen. |
| 3303 | \return eHalStatus |
| 3304 | ---------------------------------------------------------------------------*/ |
| 3305 | eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal) |
| 3306 | { |
| 3307 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3308 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3309 | |
| 3310 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3311 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3312 | { |
| 3313 | status = pmcStopAutoBmpsTimer(hHal); |
| 3314 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3315 | } |
| 3316 | |
| 3317 | return (status); |
| 3318 | } |
| 3319 | /* --------------------------------------------------------------------------- |
| 3320 | \fn sme_QueryPowerState |
| 3321 | \brief Returns the current power state of the device. |
| 3322 | \param hHal - The handle returned by macOpen. |
| 3323 | \param pPowerState - pointer to location to return power state (LOW or HIGH) |
| 3324 | \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state |
| 3325 | \return eHalStatus |
| 3326 | ---------------------------------------------------------------------------*/ |
| 3327 | eHalStatus sme_QueryPowerState ( |
| 3328 | tHalHandle hHal, |
| 3329 | tPmcPowerState *pPowerState, |
| 3330 | tPmcSwitchState *pSwWlanSwitchState) |
| 3331 | { |
| 3332 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3333 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3334 | |
| 3335 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3336 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3337 | { |
| 3338 | status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState); |
| 3339 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3340 | } |
| 3341 | |
| 3342 | return (status); |
| 3343 | } |
| 3344 | |
| 3345 | /* --------------------------------------------------------------------------- |
| 3346 | \fn sme_IsPowerSaveEnabled |
| 3347 | \brief Checks if the device is able to enter a particular power save mode |
| 3348 | This does not imply that the device is in a particular PS mode |
| 3349 | \param hHal - The handle returned by macOpen. |
| 3350 | \param psMode - the power saving mode |
| 3351 | \return eHalStatus |
| 3352 | ---------------------------------------------------------------------------*/ |
| 3353 | tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode) |
| 3354 | { |
| 3355 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3356 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3357 | tANI_BOOLEAN result = false; |
| 3358 | |
| 3359 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3360 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3361 | { |
| 3362 | result = pmcIsPowerSaveEnabled(hHal, psMode); |
| 3363 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3364 | return result; |
| 3365 | } |
| 3366 | |
| 3367 | return false; |
| 3368 | } |
| 3369 | |
| 3370 | /* --------------------------------------------------------------------------- |
| 3371 | \fn sme_RequestFullPower |
| 3372 | \brief Request that the device be brought to full power state. When the |
| 3373 | device enters Full Power PMC will start a BMPS timer if BMPS PS mode |
| 3374 | is enabled. On timer expiry PMC will attempt to put the device in |
| 3375 | BMPS mode if following holds true: |
| 3376 | - BMPS mode is enabled |
| 3377 | - Polling of all modules through the Power Save Check routine passes |
| 3378 | - STA is associated to an access point |
| 3379 | \param hHal - The handle returned by macOpen. |
| 3380 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3381 | \return eHalStatus - status |
| 3382 | eHAL_STATUS_SUCCESS - device brought to full power state |
| 3383 | eHAL_STATUS_FAILURE - device cannot be brought to full power state |
| 3384 | eHAL_STATUS_PMC_PENDING - device is being brought to full power state, |
| 3385 | ---------------------------------------------------------------------------*/ |
| 3386 | eHalStatus sme_RequestFullPower ( |
| 3387 | tHalHandle hHal, |
| 3388 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3389 | void *callbackContext, |
| 3390 | tRequestFullPowerReason fullPowerReason) |
| 3391 | { |
| 3392 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3393 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3394 | |
| 3395 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3396 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3397 | { |
| 3398 | status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason); |
| 3399 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3400 | } |
| 3401 | |
| 3402 | return (status); |
| 3403 | } |
| 3404 | |
| 3405 | /* --------------------------------------------------------------------------- |
| 3406 | \fn sme_RequestBmps |
| 3407 | \brief Request that the device be put in BMPS state. Request will be |
| 3408 | accepted only if BMPS mode is enabled and power save check routine |
| 3409 | passes. |
| 3410 | \param hHal - The handle returned by macOpen. |
| 3411 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3412 | \return eHalStatus |
| 3413 | eHAL_STATUS_SUCCESS - device is in BMPS state |
| 3414 | eHAL_STATUS_FAILURE - device cannot be brought to BMPS state |
| 3415 | eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state |
| 3416 | ---------------------------------------------------------------------------*/ |
| 3417 | eHalStatus sme_RequestBmps ( |
| 3418 | tHalHandle hHal, |
| 3419 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3420 | void *callbackContext) |
| 3421 | { |
| 3422 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3423 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3424 | |
| 3425 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3426 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3427 | { |
| 3428 | status = pmcRequestBmps(hHal, callbackRoutine, callbackContext); |
| 3429 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3430 | } |
| 3431 | |
| 3432 | return (status); |
| 3433 | } |
| 3434 | |
| 3435 | |
| 3436 | /* --------------------------------------------------------------------------- |
| 3437 | \fn sme_SetDHCPTillPowerActiveFlag |
| 3438 | \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS |
| 3439 | entry by PMC |
| 3440 | \param hHal - The handle returned by macOpen. |
| 3441 | ---------------------------------------------------------------------------*/ |
| 3442 | void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag) |
| 3443 | { |
| 3444 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3445 | |
| 3446 | // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC |
| 3447 | pMac->pmc.remainInPowerActiveTillDHCP = flag; |
| 3448 | } |
| 3449 | |
| 3450 | |
| 3451 | /* --------------------------------------------------------------------------- |
| 3452 | \fn sme_StartUapsd |
| 3453 | \brief Request that the device be put in UAPSD state. If the device is in |
| 3454 | Full Power it will be put in BMPS mode first and then into UAPSD |
| 3455 | mode. |
| 3456 | \param hHal - The handle returned by macOpen. |
| 3457 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3458 | eHAL_STATUS_SUCCESS - device is in UAPSD state |
| 3459 | eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state |
| 3460 | eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state |
| 3461 | eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled |
| 3462 | \return eHalStatus |
| 3463 | ---------------------------------------------------------------------------*/ |
| 3464 | eHalStatus sme_StartUapsd ( |
| 3465 | tHalHandle hHal, |
| 3466 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3467 | void *callbackContext) |
| 3468 | { |
| 3469 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3470 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3471 | |
| 3472 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3473 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3474 | { |
| 3475 | status = pmcStartUapsd(hHal, callbackRoutine, callbackContext); |
| 3476 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3477 | } |
| 3478 | |
| 3479 | return (status); |
| 3480 | } |
| 3481 | |
| 3482 | /* --------------------------------------------------------------------------- |
| 3483 | \fn sme_StopUapsd |
| 3484 | \brief Request that the device be put out of UAPSD state. Device will be |
| 3485 | put in in BMPS state after stop UAPSD completes. |
| 3486 | \param hHal - The handle returned by macOpen. |
| 3487 | \return eHalStatus |
| 3488 | eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state |
| 3489 | eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state |
| 3490 | ---------------------------------------------------------------------------*/ |
| 3491 | eHalStatus sme_StopUapsd (tHalHandle hHal) |
| 3492 | { |
| 3493 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3494 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3495 | |
| 3496 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3497 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3498 | { |
| 3499 | status = pmcStopUapsd(hHal); |
| 3500 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3501 | } |
| 3502 | |
| 3503 | return (status); |
| 3504 | } |
| 3505 | |
| 3506 | /* --------------------------------------------------------------------------- |
| 3507 | \fn sme_RequestStandby |
| 3508 | \brief Request that the device be put in standby. It is HDD's responsibility |
| 3509 | to bring the chip to full power and do a disassoc before calling |
| 3510 | this API. |
| 3511 | \param hHal - The handle returned by macOpen. |
| 3512 | \param - callbackRoutine Callback routine invoked in case of success/failure |
| 3513 | \return eHalStatus |
| 3514 | eHAL_STATUS_SUCCESS - device is in Standby mode |
| 3515 | eHAL_STATUS_FAILURE - device cannot be put in standby mode |
| 3516 | eHAL_STATUS_PMC_PENDING - device is being put in standby mode |
| 3517 | ---------------------------------------------------------------------------*/ |
| 3518 | eHalStatus sme_RequestStandby ( |
| 3519 | tHalHandle hHal, |
| 3520 | void (*callbackRoutine) (void *callbackContext, eHalStatus status), |
| 3521 | void *callbackContext) |
| 3522 | { |
| 3523 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3524 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3525 | |
| 3526 | smsLog( pMac, LOG1, FL("") ); |
| 3527 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3528 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3529 | { |
| 3530 | status = pmcRequestStandby(hHal, callbackRoutine, callbackContext); |
| 3531 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3532 | } |
| 3533 | |
| 3534 | return (status); |
| 3535 | } |
| 3536 | |
| 3537 | /* --------------------------------------------------------------------------- |
| 3538 | \fn sme_RegisterPowerSaveCheck |
| 3539 | \brief Register a power save check routine that is called whenever |
| 3540 | the device is about to enter one of the power save modes. |
| 3541 | \param hHal - The handle returned by macOpen. |
| 3542 | \param checkRoutine - Power save check routine to be registered |
| 3543 | \return eHalStatus |
| 3544 | eHAL_STATUS_SUCCESS - successfully registered |
| 3545 | eHAL_STATUS_FAILURE - not successfully registered |
| 3546 | ---------------------------------------------------------------------------*/ |
| 3547 | eHalStatus sme_RegisterPowerSaveCheck ( |
| 3548 | tHalHandle hHal, |
| 3549 | tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext) |
| 3550 | { |
| 3551 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3552 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3553 | |
| 3554 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3555 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3556 | { |
| 3557 | status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext); |
| 3558 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3559 | } |
| 3560 | |
| 3561 | return (status); |
| 3562 | } |
| 3563 | |
| 3564 | /* --------------------------------------------------------------------------- |
| 3565 | \fn sme_DeregisterPowerSaveCheck |
| 3566 | \brief Deregister a power save check routine |
| 3567 | \param hHal - The handle returned by macOpen. |
| 3568 | \param checkRoutine - Power save check routine to be deregistered |
| 3569 | \return eHalStatus |
| 3570 | eHAL_STATUS_SUCCESS - successfully deregistered |
| 3571 | eHAL_STATUS_FAILURE - not successfully deregistered |
| 3572 | ---------------------------------------------------------------------------*/ |
| 3573 | eHalStatus sme_DeregisterPowerSaveCheck ( |
| 3574 | tHalHandle hHal, |
| 3575 | tANI_BOOLEAN (*checkRoutine) (void *checkContext)) |
| 3576 | { |
| 3577 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3578 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3579 | |
| 3580 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3581 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3582 | { |
| 3583 | status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine); |
| 3584 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3585 | } |
| 3586 | |
| 3587 | return (status); |
| 3588 | } |
| 3589 | |
| 3590 | /* --------------------------------------------------------------------------- |
| 3591 | \fn sme_RegisterDeviceStateUpdateInd |
| 3592 | \brief Register a callback routine that is called whenever |
| 3593 | the device enters a new device state (Full Power, BMPS, UAPSD) |
| 3594 | \param hHal - The handle returned by macOpen. |
| 3595 | \param callbackRoutine - Callback routine to be registered |
| 3596 | \param callbackContext - Cookie to be passed back during callback |
| 3597 | \return eHalStatus |
| 3598 | eHAL_STATUS_SUCCESS - successfully registered |
| 3599 | eHAL_STATUS_FAILURE - not successfully registered |
| 3600 | ---------------------------------------------------------------------------*/ |
| 3601 | eHalStatus sme_RegisterDeviceStateUpdateInd ( |
| 3602 | tHalHandle hHal, |
| 3603 | void (*callbackRoutine) (void *callbackContext, tPmcState pmcState), |
| 3604 | void *callbackContext) |
| 3605 | { |
| 3606 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3607 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3608 | |
| 3609 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3610 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3611 | { |
| 3612 | status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext); |
| 3613 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3614 | } |
| 3615 | |
| 3616 | return (status); |
| 3617 | } |
| 3618 | |
| 3619 | /* --------------------------------------------------------------------------- |
| 3620 | \fn sme_DeregisterDeviceStateUpdateInd |
| 3621 | \brief Deregister a routine that was registered for device state changes |
| 3622 | \param hHal - The handle returned by macOpen. |
| 3623 | \param callbackRoutine - Callback routine to be deregistered |
| 3624 | \return eHalStatus |
| 3625 | eHAL_STATUS_SUCCESS - successfully deregistered |
| 3626 | eHAL_STATUS_FAILURE - not successfully deregistered |
| 3627 | ---------------------------------------------------------------------------*/ |
| 3628 | eHalStatus sme_DeregisterDeviceStateUpdateInd ( |
| 3629 | tHalHandle hHal, |
| 3630 | void (*callbackRoutine) (void *callbackContext, tPmcState pmcState)) |
| 3631 | { |
| 3632 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3633 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3634 | |
| 3635 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3636 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3637 | { |
| 3638 | status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine); |
| 3639 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3640 | } |
| 3641 | |
| 3642 | return (status); |
| 3643 | } |
| 3644 | |
| 3645 | /* --------------------------------------------------------------------------- |
| 3646 | \fn sme_WowlAddBcastPattern |
| 3647 | \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will |
| 3648 | do a pattern match on these patterns when Wowl is enabled during BMPS |
| 3649 | mode. Note that Firmware performs the pattern matching only on |
| 3650 | broadcast frames and while Libra is in BMPS mode. |
| 3651 | \param hHal - The handle returned by macOpen. |
| 3652 | \param pattern - Pattern to be added |
| 3653 | \return eHalStatus |
| 3654 | eHAL_STATUS_FAILURE Cannot add pattern |
| 3655 | eHAL_STATUS_SUCCESS Request accepted. |
| 3656 | ---------------------------------------------------------------------------*/ |
| 3657 | eHalStatus sme_WowlAddBcastPattern ( |
| 3658 | tHalHandle hHal, |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3659 | tpSirWowlAddBcastPtrn pattern, |
| 3660 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3661 | { |
| 3662 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3663 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3664 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3665 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3666 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3667 | status = pmcWowlAddBcastPattern (hHal, pattern, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3668 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3669 | } |
| 3670 | |
| 3671 | return (status); |
| 3672 | } |
| 3673 | |
| 3674 | /* --------------------------------------------------------------------------- |
| 3675 | \fn sme_WowlDelBcastPattern |
| 3676 | \brief Delete a pattern that was added for Pattern Byte Matching. |
| 3677 | \param hHal - The handle returned by macOpen. |
| 3678 | \param pattern - Pattern to be deleted |
| 3679 | \return eHalStatus |
| 3680 | eHAL_STATUS_FAILURE Cannot delete pattern |
| 3681 | eHAL_STATUS_SUCCESS Request accepted. |
| 3682 | ---------------------------------------------------------------------------*/ |
| 3683 | eHalStatus sme_WowlDelBcastPattern ( |
| 3684 | tHalHandle hHal, |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3685 | tpSirWowlDelBcastPtrn pattern, |
| 3686 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3687 | { |
| 3688 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3689 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3690 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3691 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3692 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3693 | status = pmcWowlDelBcastPattern (hHal, pattern, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3694 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3695 | } |
| 3696 | |
| 3697 | return (status); |
| 3698 | } |
| 3699 | |
| 3700 | /* --------------------------------------------------------------------------- |
| 3701 | \fn sme_EnterWowl |
| 3702 | \brief This is the SME API exposed to HDD to request enabling of WOWL mode. |
| 3703 | WoWLAN works on top of BMPS mode. If the device is not in BMPS mode, |
| 3704 | SME will will cache the information that WOWL has been enabled and |
| 3705 | attempt to put the device in BMPS. On entry into BMPS, SME will |
| 3706 | enable the WOWL mode. |
| 3707 | Note 1: If we exit BMPS mode (someone requests full power), we |
| 3708 | will NOT resume WOWL when we go back to BMPS again. Request for full |
| 3709 | power (while in WOWL mode) means disable WOWL and go to full power. |
| 3710 | Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME |
| 3711 | will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL |
| 3712 | are required. Currently there is no requirement or use case to support |
| 3713 | UAPSD and WOWL at the same time. |
| 3714 | |
| 3715 | \param hHal - The handle returned by macOpen. |
| 3716 | \param enterWowlCallbackRoutine - Callback routine provided by HDD. |
| 3717 | Used for success/failure notification by SME |
| 3718 | \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD |
| 3719 | at the time of callback. |
| 3720 | \param wakeReasonIndCB - Callback routine provided by HDD. |
| 3721 | Used for Wake Reason Indication by SME |
| 3722 | \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD |
| 3723 | at the time of callback. |
| 3724 | \return eHalStatus |
| 3725 | eHAL_STATUS_SUCCESS Device is already in WoWLAN mode |
| 3726 | eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode. |
| 3727 | eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after |
| 3728 | BMPS mode is entered. |
| 3729 | ---------------------------------------------------------------------------*/ |
| 3730 | eHalStatus sme_EnterWowl ( |
| 3731 | tHalHandle hHal, |
| 3732 | void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status), |
| 3733 | void *enterWowlCallbackContext, |
| 3734 | #ifdef WLAN_WAKEUP_EVENTS |
| 3735 | void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd), |
| 3736 | void *wakeIndicationCBContext, |
| 3737 | #endif // WLAN_WAKEUP_EVENTS |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3738 | tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3739 | { |
| 3740 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3741 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3742 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3743 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3744 | { |
| 3745 | status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext, |
| 3746 | #ifdef WLAN_WAKEUP_EVENTS |
| 3747 | wakeIndicationCB, wakeIndicationCBContext, |
| 3748 | #endif // WLAN_WAKEUP_EVENTS |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3749 | wowlEnterParams, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3750 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3751 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3752 | return (status); |
| 3753 | } |
| 3754 | /* --------------------------------------------------------------------------- |
| 3755 | \fn sme_ExitWowl |
| 3756 | \brief This is the SME API exposed to HDD to request exit from WoWLAN mode. |
| 3757 | SME will initiate exit from WoWLAN mode and device will be put in BMPS |
| 3758 | mode. |
| 3759 | \param hHal - The handle returned by macOpen. |
| 3760 | \return eHalStatus |
| 3761 | eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode. |
| 3762 | eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode. |
| 3763 | ---------------------------------------------------------------------------*/ |
| 3764 | eHalStatus sme_ExitWowl (tHalHandle hHal) |
| 3765 | { |
| 3766 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3767 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3768 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3769 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3770 | { |
| 3771 | status = pmcExitWowl (hHal); |
| 3772 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3773 | } |
| 3774 | |
| 3775 | return (status); |
| 3776 | } |
| 3777 | |
| 3778 | /* --------------------------------------------------------------------------- |
| 3779 | |
| 3780 | \fn sme_RoamSetKey |
| 3781 | |
| 3782 | \brief To set encryption key. This function should be called only when connected |
| 3783 | This is an asynchronous API. |
| 3784 | |
| 3785 | \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo |
| 3786 | |
| 3787 | \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback |
| 3788 | |
| 3789 | \return eHalStatus SUCCESS Roam callback will be called indicate actually results |
| 3790 | |
| 3791 | FAILURE or RESOURCES The API finished and failed. |
| 3792 | |
| 3793 | -------------------------------------------------------------------------------*/ |
| 3794 | eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId) |
| 3795 | { |
| 3796 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3797 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3798 | tANI_U32 roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3799 | tANI_U32 i; |
| 3800 | tCsrRoamSession *pSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3801 | |
Jeff Johnson | f89f4b5 | 2013-03-27 10:32:44 -0700 | [diff] [blame] | 3802 | if (pSetKey->keyLength > CSR_MAX_KEY_LEN) |
| 3803 | { |
| 3804 | smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength); |
| 3805 | return eHAL_STATUS_FAILURE; |
| 3806 | } |
| 3807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3808 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3809 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3810 | { |
| 3811 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 3812 | if(pRoamId) |
| 3813 | { |
| 3814 | *pRoamId = roamId; |
| 3815 | } |
| 3816 | |
Jeff Johnson | f89f4b5 | 2013-03-27 10:32:44 -0700 | [diff] [blame] | 3817 | smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3818 | |
| 3819 | for(i=0; i<pSetKey->keyLength; i++) |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 3820 | smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3821 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 3822 | smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3823 | |
| 3824 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 3825 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3826 | if(!pSession) |
| 3827 | { |
| 3828 | 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] | 3829 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3830 | return eHAL_STATUS_FAILURE; |
| 3831 | } |
| 3832 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3833 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 3834 | { |
| 3835 | if(pSetKey->keyDirection == eSIR_TX_DEFAULT) |
| 3836 | { |
| 3837 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 3838 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType )) |
| 3839 | { |
| 3840 | pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3841 | } |
| 3842 | if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 3843 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType )) |
| 3844 | { |
| 3845 | pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3846 | } |
| 3847 | } |
| 3848 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3849 | |
| 3850 | status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId ); |
| 3851 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3852 | } |
| 3853 | |
| 3854 | return (status); |
| 3855 | } |
| 3856 | |
| 3857 | |
| 3858 | /* --------------------------------------------------------------------------- |
| 3859 | |
| 3860 | \fn sme_RoamRemoveKey |
| 3861 | |
| 3862 | \brief To set encryption key. This is an asynchronous API. |
| 3863 | |
| 3864 | \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey |
| 3865 | |
| 3866 | \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback |
| 3867 | |
| 3868 | \return eHalStatus SUCCESS Roam callback will be called indicate actually results |
| 3869 | |
| 3870 | FAILURE or RESOURCES The API finished and failed. |
| 3871 | |
| 3872 | -------------------------------------------------------------------------------*/ |
| 3873 | eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId, |
| 3874 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId) |
| 3875 | { |
| 3876 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3877 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3878 | tANI_U32 roamId; |
| 3879 | |
| 3880 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3881 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3882 | { |
| 3883 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 3884 | if(pRoamId) |
| 3885 | { |
| 3886 | *pRoamId = roamId; |
| 3887 | } |
| 3888 | status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId ); |
| 3889 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3890 | } |
| 3891 | |
| 3892 | return (status); |
| 3893 | } |
| 3894 | |
| 3895 | /* --------------------------------------------------------------------------- |
| 3896 | \fn sme_GetRssi |
| 3897 | \brief a wrapper function that client calls to register a callback to get RSSI |
| 3898 | |
| 3899 | \param callback - SME sends back the requested stats using the callback |
| 3900 | \param staId - The station ID for which the stats is requested for |
| 3901 | \param pContext - user context to be passed back along with the callback |
| 3902 | \param pVosContext - vos context |
| 3903 | \return eHalStatus |
| 3904 | ---------------------------------------------------------------------------*/ |
| 3905 | eHalStatus sme_GetRssi(tHalHandle hHal, |
| 3906 | tCsrRssiCallback callback, |
| 3907 | tANI_U8 staId, tCsrBssid bssId, |
| 3908 | void *pContext, void* pVosContext) |
| 3909 | { |
| 3910 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3911 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3912 | |
| 3913 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3914 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3915 | { |
| 3916 | status = csrGetRssi( pMac, callback, |
| 3917 | staId, bssId, pContext, pVosContext); |
| 3918 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3919 | } |
| 3920 | return (status); |
| 3921 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 3922 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 3923 | /* --------------------------------------------------------------------------- |
| 3924 | \fn sme_GetRoamRssi |
| 3925 | \brief a wrapper function that client calls to register a callback to get Roam RSSI |
| 3926 | |
| 3927 | \param callback - SME sends back the requested stats using the callback |
| 3928 | \param staId - The station ID for which the stats is requested for |
| 3929 | \param pContext - user context to be passed back along with the callback |
| 3930 | \param pVosContext - vos context |
| 3931 | \return eHalStatus |
| 3932 | ---------------------------------------------------------------------------*/ |
| 3933 | eHalStatus sme_GetRoamRssi(tHalHandle hHal, |
| 3934 | tCsrRssiCallback callback, |
| 3935 | tANI_U8 staId, tCsrBssid bssId, |
| 3936 | void *pContext, void* pVosContext) |
| 3937 | { |
| 3938 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3939 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3940 | |
| 3941 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3942 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3943 | { |
| 3944 | status = csrGetRoamRssi( pMac, callback, |
| 3945 | staId, bssId, pContext, pVosContext); |
| 3946 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3947 | } |
| 3948 | return (status); |
| 3949 | } |
| 3950 | #endif |
| 3951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3952 | |
| 3953 | /* --------------------------------------------------------------------------- |
| 3954 | \fn sme_GetStatistics |
| 3955 | \brief a wrapper function that client calls to register a callback to get |
| 3956 | different PHY level statistics from CSR. |
| 3957 | |
| 3958 | \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc |
| 3959 | \param statsMask - The different category/categories of stats requester is looking for |
| 3960 | \param callback - SME sends back the requested stats using the callback |
| 3961 | \param periodicity - If requester needs periodic update in millisec, 0 means |
| 3962 | it's an one time request |
| 3963 | \param cache - If requester is happy with cached stats |
| 3964 | \param staId - The station ID for which the stats is requested for |
| 3965 | \param pContext - user context to be passed back along with the callback |
| 3966 | \return eHalStatus |
| 3967 | ---------------------------------------------------------------------------*/ |
| 3968 | eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId, |
| 3969 | tANI_U32 statsMask, |
| 3970 | tCsrStatsCallback callback, |
| 3971 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 3972 | tANI_U8 staId, void *pContext) |
| 3973 | { |
| 3974 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3975 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3976 | |
| 3977 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 3978 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 3979 | { |
| 3980 | status = csrGetStatistics( pMac, requesterId , statsMask, callback, |
| 3981 | periodicity, cache, staId, pContext); |
| 3982 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 3983 | } |
| 3984 | |
| 3985 | return (status); |
| 3986 | |
| 3987 | } |
| 3988 | |
| 3989 | /* --------------------------------------------------------------------------- |
| 3990 | |
| 3991 | \fn sme_GetCountryCode |
| 3992 | |
| 3993 | \brief To return the current country code. If no country code is applied, default country code is |
| 3994 | used to fill the buffer. |
| 3995 | If 11d supported is turned off, an error is return and the last applied/default country code is used. |
| 3996 | This is a synchronous API. |
| 3997 | |
| 3998 | \param pBuf - pointer to a caller allocated buffer for returned country code. |
| 3999 | |
| 4000 | \param pbLen For input, this parameter indicates how big is the buffer. |
| 4001 | Upon return, this parameter has the number of bytes for country. If pBuf |
| 4002 | doesn't have enough space, this function returns |
| 4003 | fail status and this parameter contains the number that is needed. |
| 4004 | |
| 4005 | \return eHalStatus SUCCESS. |
| 4006 | |
| 4007 | FAILURE or RESOURCES The API finished and failed. |
| 4008 | |
| 4009 | -------------------------------------------------------------------------------*/ |
| 4010 | eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen) |
| 4011 | { |
| 4012 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4013 | |
| 4014 | return ( csrGetCountryCode( pMac, pBuf, pbLen ) ); |
| 4015 | } |
| 4016 | |
| 4017 | |
| 4018 | /* --------------------------------------------------------------------------- |
| 4019 | |
| 4020 | \fn sme_SetCountryCode |
| 4021 | |
| 4022 | \brief To change the current/default country code. |
| 4023 | If 11d supported is turned off, an error is return. |
| 4024 | This is a synchronous API. |
| 4025 | |
| 4026 | \param pCountry - pointer to a caller allocated buffer for the country code. |
| 4027 | |
| 4028 | \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates |
| 4029 | whether a reset is required. |
| 4030 | |
| 4031 | \return eHalStatus SUCCESS. |
| 4032 | |
| 4033 | FAILURE or RESOURCES The API finished and failed. |
| 4034 | |
| 4035 | -------------------------------------------------------------------------------*/ |
| 4036 | eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded) |
| 4037 | { |
| 4038 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4039 | |
| 4040 | return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) ); |
| 4041 | } |
| 4042 | |
| 4043 | |
| 4044 | /* --------------------------------------------------------------------------- |
| 4045 | \fn sme_ResetCountryCodeInformation |
| 4046 | \brief this function is to reset the country code current being used back to EEPROM default |
| 4047 | this includes channel list and power setting. This is a synchronous API. |
| 4048 | \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether |
| 4049 | a restart is needed to apply the change |
| 4050 | \return eHalStatus |
| 4051 | -------------------------------------------------------------------------------*/ |
| 4052 | eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded) |
| 4053 | { |
| 4054 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4055 | |
| 4056 | return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) ); |
| 4057 | } |
| 4058 | |
| 4059 | |
| 4060 | /* --------------------------------------------------------------------------- |
| 4061 | \fn sme_GetSupportedCountryCode |
| 4062 | \brief this function is to get a list of the country code current being supported |
| 4063 | \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, |
| 4064 | this has the country code list. 3 bytes for each country code. This may be NULL if |
| 4065 | caller wants to know the needed byte count. |
| 4066 | \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return, |
| 4067 | this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0. |
| 4068 | \return eHalStatus |
| 4069 | -------------------------------------------------------------------------------*/ |
| 4070 | eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen) |
| 4071 | { |
| 4072 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4073 | |
| 4074 | return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) ); |
| 4075 | } |
| 4076 | |
| 4077 | |
| 4078 | /* --------------------------------------------------------------------------- |
| 4079 | \fn sme_GetCurrentRegulatoryDomain |
| 4080 | \brief this function is to get the current regulatory domain. This is a synchronous API. |
| 4081 | This function must be called after CFG is downloaded and all the band/mode setting already passed into |
| 4082 | SME. The function fails if 11d support is turned off. |
| 4083 | \param pDomain - Caller allocated buffer to return the current domain. |
| 4084 | \return eHalStatus SUCCESS. |
| 4085 | |
| 4086 | FAILURE or RESOURCES The API finished and failed. |
| 4087 | -------------------------------------------------------------------------------*/ |
| 4088 | eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain) |
| 4089 | { |
| 4090 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4091 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 4092 | |
| 4093 | if( pDomain ) |
| 4094 | { |
| 4095 | if( csrIs11dSupported( pMac ) ) |
| 4096 | { |
| 4097 | *pDomain = csrGetCurrentRegulatoryDomain( pMac ); |
| 4098 | status = eHAL_STATUS_SUCCESS; |
| 4099 | } |
| 4100 | else |
| 4101 | { |
| 4102 | status = eHAL_STATUS_FAILURE; |
| 4103 | } |
| 4104 | } |
| 4105 | |
| 4106 | return ( status ); |
| 4107 | } |
| 4108 | |
| 4109 | |
| 4110 | /* --------------------------------------------------------------------------- |
| 4111 | \fn sme_SetRegulatoryDomain |
| 4112 | \brief this function is to set the current regulatory domain. |
| 4113 | This function must be called after CFG is downloaded and all the band/mode setting already passed into |
| 4114 | SME. This is a synchronous API. |
| 4115 | \param domainId - indicate the domain (defined in the driver) needs to set to. |
| 4116 | See v_REGDOMAIN_t for definition |
| 4117 | \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether |
| 4118 | a restart is needed to apply the change |
| 4119 | \return eHalStatus |
| 4120 | -------------------------------------------------------------------------------*/ |
| 4121 | eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded) |
| 4122 | { |
| 4123 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4124 | |
| 4125 | return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) ); |
| 4126 | } |
| 4127 | |
| 4128 | |
| 4129 | /* --------------------------------------------------------------------------- |
| 4130 | |
| 4131 | \fn sme_GetRegulatoryDomainForCountry |
| 4132 | |
| 4133 | \brief To return a regulatory domain base on a country code. This is a synchronous API. |
| 4134 | |
| 4135 | \param pCountry - pointer to a caller allocated buffer for input country code. |
| 4136 | |
| 4137 | \param pDomainId Upon successful return, it is the domain that country belongs to. |
| 4138 | If it is NULL, returning success means that the country code is known. |
| 4139 | |
| 4140 | \return eHalStatus SUCCESS. |
| 4141 | |
| 4142 | FAILURE or RESOURCES The API finished and failed. |
| 4143 | |
| 4144 | -------------------------------------------------------------------------------*/ |
| 4145 | eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId) |
| 4146 | { |
| 4147 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4148 | |
| 4149 | return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) ); |
| 4150 | } |
| 4151 | |
| 4152 | |
| 4153 | |
| 4154 | |
| 4155 | /* --------------------------------------------------------------------------- |
| 4156 | |
| 4157 | \fn sme_GetSupportedRegulatoryDomains |
| 4158 | |
| 4159 | \brief To return a list of supported regulatory domains. This is a synchronous API. |
| 4160 | |
| 4161 | \param pDomains - pointer to a caller allocated buffer for returned regulatory domains. |
| 4162 | |
| 4163 | \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold. |
| 4164 | Upon return, this parameter has the number for supported domains. If pDomains |
| 4165 | doesn't have enough space for all the supported domains, this function returns |
| 4166 | fail status and this parameter contains the number that is needed. |
| 4167 | |
| 4168 | \return eHalStatus SUCCESS. |
| 4169 | |
| 4170 | FAILURE or RESOURCES The API finished and failed. |
| 4171 | |
| 4172 | -------------------------------------------------------------------------------*/ |
| 4173 | eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains) |
| 4174 | { |
| 4175 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 4176 | |
| 4177 | //We support all domains for now |
| 4178 | if( pNumDomains ) |
| 4179 | { |
| 4180 | if( NUM_REG_DOMAINS <= *pNumDomains ) |
| 4181 | { |
| 4182 | status = eHAL_STATUS_SUCCESS; |
| 4183 | } |
| 4184 | *pNumDomains = NUM_REG_DOMAINS; |
| 4185 | } |
| 4186 | if( HAL_STATUS_SUCCESS( status ) ) |
| 4187 | { |
| 4188 | if( pDomains ) |
| 4189 | { |
| 4190 | pDomains[0] = REGDOMAIN_FCC; |
| 4191 | pDomains[1] = REGDOMAIN_ETSI; |
| 4192 | pDomains[2] = REGDOMAIN_JAPAN; |
| 4193 | pDomains[3] = REGDOMAIN_WORLD; |
| 4194 | pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC; |
| 4195 | pDomains[5] = REGDOMAIN_APAC; |
| 4196 | pDomains[6] = REGDOMAIN_KOREA; |
| 4197 | pDomains[7] = REGDOMAIN_HI_5GHZ; |
| 4198 | pDomains[8] = REGDOMAIN_NO_5GHZ; |
| 4199 | } |
| 4200 | else |
| 4201 | { |
| 4202 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 4203 | } |
| 4204 | } |
| 4205 | |
| 4206 | return ( status ); |
| 4207 | } |
| 4208 | |
| 4209 | |
| 4210 | //some support functions |
| 4211 | tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal) |
| 4212 | { |
| 4213 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4214 | |
| 4215 | return ( csrIs11dSupported( pMac ) ); |
| 4216 | } |
| 4217 | |
| 4218 | |
| 4219 | tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal) |
| 4220 | { |
| 4221 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4222 | |
| 4223 | return ( csrIs11hSupported( pMac ) ); |
| 4224 | } |
| 4225 | |
| 4226 | |
| 4227 | tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal) |
| 4228 | { |
| 4229 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4230 | |
| 4231 | return ( csrIsWmmSupported( pMac ) ); |
| 4232 | } |
| 4233 | |
| 4234 | //Upper layer to get the list of the base channels to scan for passively 11d info from csr |
| 4235 | eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo ) |
| 4236 | { |
| 4237 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4238 | |
| 4239 | return(csrScanGetBaseChannels(pMac,pChannelInfo) ); |
| 4240 | } |
| 4241 | |
| 4242 | /* --------------------------------------------------------------------------- |
| 4243 | |
| 4244 | \fn sme_ChangeCountryCode |
| 4245 | |
| 4246 | \brief Change Country code from upperlayer during WLAN driver operation. |
| 4247 | This is a synchronous API. |
| 4248 | |
| 4249 | \param hHal - The handle returned by macOpen. |
| 4250 | |
| 4251 | \param pCountry New Country Code String |
| 4252 | |
| 4253 | \return eHalStatus SUCCESS. |
| 4254 | |
| 4255 | FAILURE or RESOURCES The API finished and failed. |
| 4256 | |
| 4257 | -------------------------------------------------------------------------------*/ |
| 4258 | eHalStatus sme_ChangeCountryCode( tHalHandle hHal, |
| 4259 | tSmeChangeCountryCallback callback, |
| 4260 | tANI_U8 *pCountry, |
| 4261 | void *pContext, |
Gopichand Nakkala | acd9411 | 2013-05-29 21:37:47 +0530 | [diff] [blame] | 4262 | void* pVosContext, |
| 4263 | tAniBool countryFromUserSpace ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4264 | { |
| 4265 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4266 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4267 | vos_msg_t msg; |
| 4268 | tAniChangeCountryCodeReq *pMsg; |
| 4269 | |
| 4270 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4271 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4272 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4273 | smsLog(pMac, LOG1, FL(" called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4274 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq)); |
| 4275 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 4276 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4277 | 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] | 4278 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4279 | return status; |
| 4280 | } |
| 4281 | |
| 4282 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE); |
| 4283 | pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq); |
| 4284 | palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3); |
Gopichand Nakkala | acd9411 | 2013-05-29 21:37:47 +0530 | [diff] [blame] | 4285 | pMsg->countryFromUserSpace = countryFromUserSpace; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4286 | pMsg->changeCCCallback = callback; |
| 4287 | pMsg->pDevContext = pContext; |
| 4288 | pMsg->pVosContext = pVosContext; |
| 4289 | |
| 4290 | msg.type = eWNI_SME_CHANGE_COUNTRY_CODE; |
| 4291 | msg.bodyptr = pMsg; |
| 4292 | msg.reserved = 0; |
| 4293 | |
| 4294 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 4295 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4296 | smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4297 | palFreeMemory(pMac->hHdd, (void *)pMsg); |
| 4298 | status = eHAL_STATUS_FAILURE; |
| 4299 | } |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4300 | smsLog(pMac, LOG1, FL(" returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4301 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4302 | } |
| 4303 | |
| 4304 | return (status); |
| 4305 | } |
| 4306 | |
| 4307 | /* --------------------------------------------------------------------------- |
| 4308 | \fn sme_BtcSignalBtEvent |
| 4309 | \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the |
| 4310 | BT event type and the current operating mode of Libra (full power, |
| 4311 | BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy |
| 4312 | would be employed. |
| 4313 | \param hHal - The handle returned by macOpen. |
| 4314 | \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent |
| 4315 | Caller owns the memory and is responsible for freeing it. |
| 4316 | \return VOS_STATUS |
| 4317 | VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen |
| 4318 | if BTC execution mode is set to BTC_WLAN_ONLY |
| 4319 | or BTC_PTA_ONLY. |
| 4320 | VOS_STATUS_SUCCESS BT Event passed to HAL |
| 4321 | ---------------------------------------------------------------------------*/ |
| 4322 | VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent) |
| 4323 | { |
| 4324 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4325 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4326 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4327 | |
| 4328 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4329 | { |
| 4330 | status = btcSignalBTEvent (hHal, pBtEvent); |
| 4331 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4332 | } |
| 4333 | #endif |
| 4334 | return (status); |
| 4335 | } |
| 4336 | |
| 4337 | /* --------------------------------------------------------------------------- |
| 4338 | \fn sme_BtcSetConfig |
| 4339 | \brief API to change the current Bluetooth Coexistence (BTC) configuration |
| 4340 | This function should be invoked only after CFG download has completed. |
| 4341 | Calling it after sme_HDDReadyInd is recommended. |
| 4342 | \param hHal - The handle returned by macOpen. |
| 4343 | \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig. |
| 4344 | Caller owns the memory and is responsible for freeing it. |
| 4345 | \return VOS_STATUS |
| 4346 | VOS_STATUS_E_FAILURE Config not passed to HAL. |
| 4347 | VOS_STATUS_SUCCESS Config passed to HAL |
| 4348 | ---------------------------------------------------------------------------*/ |
| 4349 | VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) |
| 4350 | { |
| 4351 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4352 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4353 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4354 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4355 | { |
| 4356 | status = btcSetConfig (hHal, pSmeBtcConfig); |
| 4357 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4358 | } |
| 4359 | #endif |
| 4360 | return (status); |
| 4361 | } |
| 4362 | |
| 4363 | /* --------------------------------------------------------------------------- |
| 4364 | \fn sme_BtcGetConfig |
| 4365 | \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration |
| 4366 | \param hHal - The handle returned by macOpen. |
| 4367 | \param pSmeBtcConfig - Pointer to a caller allocated object of type |
| 4368 | tSmeBtcConfig. Caller owns the memory and is responsible |
| 4369 | for freeing it. |
| 4370 | \return VOS_STATUS |
| 4371 | VOS_STATUS_E_FAILURE - failure |
| 4372 | VOS_STATUS_SUCCESS success |
| 4373 | ---------------------------------------------------------------------------*/ |
| 4374 | VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig) |
| 4375 | { |
| 4376 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4377 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4378 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4379 | |
| 4380 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4381 | { |
| 4382 | status = btcGetConfig (hHal, pSmeBtcConfig); |
| 4383 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4384 | } |
| 4385 | #endif |
| 4386 | return (status); |
| 4387 | } |
| 4388 | /* --------------------------------------------------------------------------- |
| 4389 | \fn sme_SetCfgPrivacy |
| 4390 | \brief API to set configure privacy parameters |
| 4391 | \param hHal - The handle returned by macOpen. |
| 4392 | \param pProfile - Pointer CSR Roam profile. |
| 4393 | \param fPrivacy - This parameter indicates status of privacy |
| 4394 | |
| 4395 | \return void |
| 4396 | ---------------------------------------------------------------------------*/ |
| 4397 | void sme_SetCfgPrivacy( tHalHandle hHal, |
| 4398 | tCsrRoamProfile *pProfile, |
| 4399 | tANI_BOOLEAN fPrivacy |
| 4400 | ) |
| 4401 | { |
| 4402 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4403 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4404 | { |
| 4405 | csrSetCfgPrivacy(pMac, pProfile, fPrivacy); |
| 4406 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4407 | } |
| 4408 | } |
| 4409 | |
| 4410 | #if defined WLAN_FEATURE_VOWIFI |
| 4411 | /* --------------------------------------------------------------------------- |
| 4412 | \fn sme_NeighborReportRequest |
| 4413 | \brief API to request neighbor report. |
| 4414 | \param hHal - The handle returned by macOpen. |
| 4415 | \param pRrmNeighborReq - Pointer to a caller allocated object of type |
| 4416 | tRrmNeighborReq. Caller owns the memory and is responsible |
| 4417 | for freeing it. |
| 4418 | \return VOS_STATUS |
| 4419 | VOS_STATUS_E_FAILURE - failure |
| 4420 | VOS_STATUS_SUCCESS success |
| 4421 | ---------------------------------------------------------------------------*/ |
| 4422 | VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId, |
| 4423 | tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo) |
| 4424 | { |
| 4425 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4426 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4427 | |
| 4428 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4429 | { |
| 4430 | status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo); |
| 4431 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4432 | } |
| 4433 | |
| 4434 | return (status); |
| 4435 | } |
| 4436 | #endif |
| 4437 | |
| 4438 | //The following are debug APIs to support direct read/write register/memory |
| 4439 | //They are placed in SME because HW cannot be access when in LOW_POWER state |
| 4440 | //AND not connected. The knowledge and synchronization is done in SME |
| 4441 | |
| 4442 | //sme_DbgReadRegister |
| 4443 | //Caller needs to validate the input values |
| 4444 | VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue) |
| 4445 | { |
| 4446 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4447 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4448 | tPmcPowerState PowerState; |
| 4449 | tANI_U32 sessionId = 0; |
| 4450 | |
| 4451 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4452 | |
| 4453 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4454 | { |
Hoonki Lee | 0af6aaf | 2013-02-08 12:26:44 -0800 | [diff] [blame] | 4455 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4456 | { |
| 4457 | return VOS_STATUS_SUCCESS; |
| 4458 | } |
| 4459 | return VOS_STATUS_E_FAILURE; |
| 4460 | } |
| 4461 | |
| 4462 | /* 2) NON FTM mode driver *************************************************/ |
| 4463 | |
| 4464 | /* Acquire SME global lock */ |
| 4465 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4466 | { |
| 4467 | return VOS_STATUS_E_FAILURE; |
| 4468 | } |
| 4469 | |
| 4470 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4471 | { |
| 4472 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4473 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4474 | { |
Hoonki Lee | 0af6aaf | 2013-02-08 12:26:44 -0800 | [diff] [blame] | 4475 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | { |
| 4477 | status = VOS_STATUS_SUCCESS; |
| 4478 | } |
| 4479 | else |
| 4480 | { |
| 4481 | status = VOS_STATUS_E_FAILURE; |
| 4482 | } |
| 4483 | } |
| 4484 | else |
| 4485 | { |
| 4486 | status = VOS_STATUS_E_FAILURE; |
| 4487 | } |
| 4488 | } |
| 4489 | |
| 4490 | /* This is a hack for Qualky/pttWniSocket |
| 4491 | Current implementation doesn't allow pttWniSocket to inform Qualky an error */ |
| 4492 | if ( VOS_STATUS_SUCCESS != status ) |
| 4493 | { |
| 4494 | *pRegValue = 0xDEADBEEF; |
| 4495 | status = VOS_STATUS_SUCCESS; |
| 4496 | } |
| 4497 | |
| 4498 | /* Release SME global lock */ |
| 4499 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4500 | |
| 4501 | return (status); |
| 4502 | } |
| 4503 | |
| 4504 | |
| 4505 | //sme_DbgWriteRegister |
| 4506 | //Caller needs to validate the input values |
| 4507 | VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue) |
| 4508 | { |
| 4509 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4510 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4511 | tPmcPowerState PowerState; |
| 4512 | tANI_U32 sessionId = 0; |
| 4513 | |
| 4514 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4515 | |
| 4516 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4517 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4518 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4519 | { |
| 4520 | return VOS_STATUS_SUCCESS; |
| 4521 | } |
| 4522 | return VOS_STATUS_E_FAILURE; |
| 4523 | } |
| 4524 | |
| 4525 | /* 2) NON FTM mode driver *************************************************/ |
| 4526 | |
| 4527 | /* Acquire SME global lock */ |
| 4528 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4529 | { |
| 4530 | return VOS_STATUS_E_FAILURE; |
| 4531 | } |
| 4532 | |
| 4533 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4534 | { |
| 4535 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4536 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4537 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4539 | { |
| 4540 | status = VOS_STATUS_SUCCESS; |
| 4541 | } |
| 4542 | else |
| 4543 | { |
| 4544 | status = VOS_STATUS_E_FAILURE; |
| 4545 | } |
| 4546 | } |
| 4547 | else |
| 4548 | { |
| 4549 | status = VOS_STATUS_E_FAILURE; |
| 4550 | } |
| 4551 | } |
| 4552 | |
| 4553 | /* Release SME global lock */ |
| 4554 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4555 | |
| 4556 | return (status); |
| 4557 | } |
| 4558 | |
| 4559 | |
| 4560 | |
| 4561 | //sme_DbgReadMemory |
| 4562 | //Caller needs to validate the input values |
| 4563 | //pBuf caller allocated buffer has the length of nLen |
| 4564 | VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen) |
| 4565 | { |
| 4566 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4567 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4568 | tPmcPowerState PowerState; |
| 4569 | tANI_U32 sessionId = 0; |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 4570 | tANI_U32 cmd = READ_MEMORY_DUMP_CMD; |
| 4571 | tANI_U32 arg1 = memAddr; |
| 4572 | tANI_U32 arg2 = nLen/4; |
| 4573 | tANI_U32 arg3 = 4; |
| 4574 | tANI_U32 arg4 = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4575 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4576 | |
| 4577 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4578 | { |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 4579 | 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] | 4580 | { |
| 4581 | return VOS_STATUS_SUCCESS; |
| 4582 | } |
| 4583 | return VOS_STATUS_E_FAILURE; |
| 4584 | } |
| 4585 | |
| 4586 | /* 2) NON FTM mode driver *************************************************/ |
| 4587 | |
| 4588 | /* Acquire SME global lock */ |
| 4589 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4590 | { |
| 4591 | return VOS_STATUS_E_FAILURE; |
| 4592 | } |
| 4593 | |
| 4594 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4595 | { |
| 4596 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4597 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4598 | { |
Gopichand Nakkala | fab3fae | 2013-01-07 15:01:01 -0800 | [diff] [blame] | 4599 | 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] | 4600 | { |
| 4601 | status = VOS_STATUS_SUCCESS; |
| 4602 | } |
| 4603 | else |
| 4604 | { |
| 4605 | status = VOS_STATUS_E_FAILURE; |
| 4606 | } |
| 4607 | } |
| 4608 | else |
| 4609 | { |
| 4610 | status = VOS_STATUS_E_FAILURE; |
| 4611 | } |
| 4612 | } |
| 4613 | |
| 4614 | /* This is a hack for Qualky/pttWniSocket |
| 4615 | Current implementation doesn't allow pttWniSocket to inform Qualky an error */ |
| 4616 | if (VOS_STATUS_SUCCESS != status) |
| 4617 | { |
| 4618 | vos_mem_set(pBuf, nLen, 0xCD); |
| 4619 | status = VOS_STATUS_SUCCESS; |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4620 | 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] | 4621 | } |
| 4622 | |
| 4623 | /* Release SME lock */ |
| 4624 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4625 | |
| 4626 | return (status); |
| 4627 | } |
| 4628 | |
| 4629 | |
| 4630 | //sme_DbgWriteMemory |
| 4631 | //Caller needs to validate the input values |
| 4632 | VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen) |
| 4633 | { |
| 4634 | VOS_STATUS status = VOS_STATUS_E_FAILURE; |
| 4635 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4636 | tPmcPowerState PowerState; |
| 4637 | tANI_U32 sessionId = 0; |
| 4638 | |
| 4639 | /* 1) To make Quarky work in FTM mode **************************************/ |
| 4640 | |
| 4641 | if(eDRIVER_TYPE_MFG == pMac->gDriverType) |
| 4642 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | { |
| 4644 | return VOS_STATUS_SUCCESS; |
| 4645 | } |
| 4646 | return VOS_STATUS_E_FAILURE; |
| 4647 | } |
| 4648 | |
| 4649 | /* 2) NON FTM mode driver *************************************************/ |
| 4650 | |
| 4651 | /* Acquire SME global lock */ |
| 4652 | if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme)) |
| 4653 | { |
| 4654 | return VOS_STATUS_E_FAILURE; |
| 4655 | } |
| 4656 | |
| 4657 | if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL))) |
| 4658 | { |
| 4659 | /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/ |
| 4660 | if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState)) |
| 4661 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4662 | if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4663 | { |
| 4664 | status = VOS_STATUS_SUCCESS; |
| 4665 | } |
| 4666 | else |
| 4667 | { |
| 4668 | status = VOS_STATUS_E_FAILURE; |
| 4669 | } |
| 4670 | } |
| 4671 | else |
| 4672 | { |
| 4673 | status = VOS_STATUS_E_FAILURE; |
| 4674 | } |
| 4675 | } |
| 4676 | |
| 4677 | /* Release Global lock */ |
| 4678 | sme_ReleaseGlobalLock(&pMac->sme); |
| 4679 | |
| 4680 | return (status); |
| 4681 | } |
| 4682 | |
| 4683 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4684 | void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4685 | { |
| 4686 | #ifdef WLAN_DEBUG |
| 4687 | // Verify against current log level |
| 4688 | if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] ) |
| 4689 | return; |
| 4690 | else |
| 4691 | { |
| 4692 | va_list marker; |
| 4693 | |
| 4694 | va_start( marker, pString ); /* Initialize variable arguments. */ |
| 4695 | |
| 4696 | logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker); |
| 4697 | |
| 4698 | va_end( marker ); /* Reset variable arguments. */ |
| 4699 | } |
| 4700 | #endif |
| 4701 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4703 | /* --------------------------------------------------------------------------- |
| 4704 | \fn sme_GetWcnssWlanCompiledVersion |
| 4705 | \brief This API returns the version of the WCNSS WLAN API with |
| 4706 | which the HOST driver was built |
| 4707 | \param hHal - The handle returned by macOpen. |
| 4708 | \param pVersion - Points to the Version structure to be filled |
| 4709 | \return VOS_STATUS |
| 4710 | VOS_STATUS_E_INVAL - failure |
| 4711 | VOS_STATUS_SUCCESS success |
| 4712 | ---------------------------------------------------------------------------*/ |
| 4713 | VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal, |
| 4714 | tSirVersionType *pVersion) |
| 4715 | { |
| 4716 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4717 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4718 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4719 | |
| 4720 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4721 | { |
| 4722 | if( pVersion != NULL ) |
| 4723 | { |
| 4724 | status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion); |
| 4725 | } |
| 4726 | else |
| 4727 | { |
| 4728 | status = VOS_STATUS_E_INVAL; |
| 4729 | } |
| 4730 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4731 | } |
| 4732 | |
| 4733 | return (status); |
| 4734 | } |
| 4735 | |
| 4736 | |
| 4737 | /* --------------------------------------------------------------------------- |
| 4738 | \fn sme_GetWcnssWlanReportedVersion |
| 4739 | \brief This API returns the version of the WCNSS WLAN API with |
| 4740 | which the WCNSS driver reports it was built |
| 4741 | \param hHal - The handle returned by macOpen. |
| 4742 | \param pVersion - Points to the Version structure to be filled |
| 4743 | \return VOS_STATUS |
| 4744 | VOS_STATUS_E_INVAL - failure |
| 4745 | VOS_STATUS_SUCCESS success |
| 4746 | ---------------------------------------------------------------------------*/ |
| 4747 | VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal, |
| 4748 | tSirVersionType *pVersion) |
| 4749 | { |
| 4750 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4751 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4752 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4753 | |
| 4754 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4755 | { |
| 4756 | if( pVersion != NULL ) |
| 4757 | { |
| 4758 | status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion); |
| 4759 | } |
| 4760 | else |
| 4761 | { |
| 4762 | status = VOS_STATUS_E_INVAL; |
| 4763 | } |
| 4764 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4765 | } |
| 4766 | |
| 4767 | return (status); |
| 4768 | } |
| 4769 | |
| 4770 | |
| 4771 | /* --------------------------------------------------------------------------- |
| 4772 | \fn sme_GetWcnssSoftwareVersion |
| 4773 | \brief This API returns the version string of the WCNSS driver |
| 4774 | \param hHal - The handle returned by macOpen. |
| 4775 | \param pVersion - Points to the Version string buffer to be filled |
| 4776 | \param versionBufferSize - THe size of the Version string buffer |
| 4777 | \return VOS_STATUS |
| 4778 | VOS_STATUS_E_INVAL - failure |
| 4779 | VOS_STATUS_SUCCESS success |
| 4780 | ---------------------------------------------------------------------------*/ |
| 4781 | VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal, |
| 4782 | tANI_U8 *pVersion, |
| 4783 | tANI_U32 versionBufferSize) |
| 4784 | { |
| 4785 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4786 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4787 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4788 | |
| 4789 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4790 | { |
| 4791 | if( pVersion != NULL ) |
| 4792 | { |
| 4793 | status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion, |
| 4794 | versionBufferSize); |
| 4795 | } |
| 4796 | else |
| 4797 | { |
| 4798 | status = VOS_STATUS_E_INVAL; |
| 4799 | } |
| 4800 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4801 | } |
| 4802 | |
| 4803 | return (status); |
| 4804 | } |
| 4805 | |
| 4806 | |
| 4807 | /* --------------------------------------------------------------------------- |
| 4808 | \fn sme_GetWcnssHardwareVersion |
| 4809 | \brief This API returns the version string of the WCNSS hardware |
| 4810 | \param hHal - The handle returned by macOpen. |
| 4811 | \param pVersion - Points to the Version string buffer to be filled |
| 4812 | \param versionBufferSize - THe size of the Version string buffer |
| 4813 | \return VOS_STATUS |
| 4814 | VOS_STATUS_E_INVAL - failure |
| 4815 | VOS_STATUS_SUCCESS success |
| 4816 | ---------------------------------------------------------------------------*/ |
| 4817 | VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal, |
| 4818 | tANI_U8 *pVersion, |
| 4819 | tANI_U32 versionBufferSize) |
| 4820 | { |
| 4821 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 4822 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4823 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 4824 | |
| 4825 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 4826 | { |
| 4827 | if( pVersion != NULL ) |
| 4828 | { |
| 4829 | status = WDA_GetWcnssHardwareVersion(vosContext, pVersion, |
| 4830 | versionBufferSize); |
| 4831 | } |
| 4832 | else |
| 4833 | { |
| 4834 | status = VOS_STATUS_E_INVAL; |
| 4835 | } |
| 4836 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4837 | } |
| 4838 | |
| 4839 | return (status); |
| 4840 | } |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 4841 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | |
| 4843 | #ifdef FEATURE_WLAN_WAPI |
| 4844 | /* --------------------------------------------------------------------------- |
| 4845 | \fn sme_RoamSetBKIDCache |
| 4846 | \brief The SME API exposed to HDD to allow HDD to provde SME the BKID |
| 4847 | candidate list. |
| 4848 | \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after |
| 4849 | it is opened (by calling halOpen). |
| 4850 | \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo |
| 4851 | \param numItems - a variable that has the number of tBkidCacheInfo allocated |
| 4852 | when retruning, this is the number of items put into pBKIDCache |
| 4853 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 4854 | big enough and pNumItems has the number of tBkidCacheInfo. |
| 4855 | ---------------------------------------------------------------------------*/ |
| 4856 | eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 4857 | tANI_U32 numItems ) |
| 4858 | { |
| 4859 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4860 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4861 | |
| 4862 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4863 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4864 | { |
| 4865 | status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems ); |
| 4866 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4867 | } |
| 4868 | |
| 4869 | return (status); |
| 4870 | } |
| 4871 | |
| 4872 | /* --------------------------------------------------------------------------- |
| 4873 | \fn sme_RoamGetBKIDCache |
| 4874 | \brief The SME API exposed to HDD to allow HDD to request SME to return its |
| 4875 | BKID cache. |
| 4876 | \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after |
| 4877 | it is opened (by calling halOpen). |
| 4878 | \param pNum - caller allocated memory that has the space of the number of |
| 4879 | tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries |
| 4880 | in SME cache. |
| 4881 | \param pBkidCache - Caller allocated memory that contains BKID cache, if any, |
| 4882 | upon return |
| 4883 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 4884 | big enough. |
| 4885 | ---------------------------------------------------------------------------*/ |
| 4886 | eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum, |
| 4887 | tBkidCacheInfo *pBkidCache) |
| 4888 | { |
| 4889 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4890 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4891 | |
| 4892 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4893 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4894 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 4895 | smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4896 | status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache ); |
| 4897 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4898 | } |
| 4899 | |
| 4900 | return (status); |
| 4901 | } |
| 4902 | |
| 4903 | /* --------------------------------------------------------------------------- |
| 4904 | \fn sme_RoamGetNumBKIDCache |
| 4905 | \brief The SME API exposed to HDD to allow HDD to request SME to return the |
| 4906 | number of BKID cache entries. |
| 4907 | \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after |
| 4908 | it is opened (by calling halOpen). |
| 4909 | \return tANI_U32 - the number of BKID cache entries. |
| 4910 | ---------------------------------------------------------------------------*/ |
| 4911 | tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId) |
| 4912 | { |
| 4913 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4914 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4915 | tANI_U32 numBkidCache = 0; |
| 4916 | |
| 4917 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4918 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4919 | { |
| 4920 | numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId ); |
| 4921 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4922 | } |
| 4923 | |
| 4924 | return (numBkidCache); |
| 4925 | } |
| 4926 | |
| 4927 | /* --------------------------------------------------------------------------- |
| 4928 | \fn sme_ScanGetBKIDCandidateList |
| 4929 | \brief a wrapper function to return the BKID candidate list |
| 4930 | \param pBkidList - caller allocated buffer point to an array of |
| 4931 | tBkidCandidateInfo |
| 4932 | \param pNumItems - pointer to a variable that has the number of |
| 4933 | tBkidCandidateInfo allocated when retruning, this is |
| 4934 | either the number needed or number of items put into |
| 4935 | pPmkidList |
| 4936 | \return eHalStatus - when fail, it usually means the buffer allocated is not |
| 4937 | big enough and pNumItems |
| 4938 | has the number of tBkidCandidateInfo. |
| 4939 | \Note: pNumItems is a number of tBkidCandidateInfo, |
| 4940 | not sizeof(tBkidCandidateInfo) * something |
| 4941 | ---------------------------------------------------------------------------*/ |
| 4942 | eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId, |
| 4943 | tBkidCandidateInfo *pBkidList, |
| 4944 | tANI_U32 *pNumItems ) |
| 4945 | { |
| 4946 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 4947 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4948 | |
| 4949 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 4950 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 4951 | { |
| 4952 | status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems ); |
| 4953 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 4954 | } |
| 4955 | |
| 4956 | return (status); |
| 4957 | } |
| 4958 | #endif /* FEATURE_WLAN_WAPI */ |
| 4959 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4960 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 4961 | |
| 4962 | /***************************************************************************** |
| 4963 | OEM DATA related modifications and function additions |
| 4964 | *****************************************************************************/ |
| 4965 | |
| 4966 | /* --------------------------------------------------------------------------- |
| 4967 | \fn sme_getOemDataRsp |
| 4968 | \brief a wrapper function to obtain the OEM DATA RSP |
| 4969 | \param pOemDataRsp - A pointer to the response object |
| 4970 | \param pContext - a pointer passed in for the callback |
| 4971 | \return eHalStatus |
| 4972 | ---------------------------------------------------------------------------*/ |
| 4973 | eHalStatus sme_getOemDataRsp(tHalHandle hHal, |
| 4974 | tOemDataRsp **pOemDataRsp) |
| 4975 | { |
| 4976 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4977 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4978 | |
| 4979 | do |
| 4980 | { |
| 4981 | //acquire the lock for the sme object |
| 4982 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 4983 | |
| 4984 | if(!HAL_STATUS_SUCCESS(status)) |
| 4985 | { |
| 4986 | break; |
| 4987 | } |
| 4988 | |
| 4989 | if(pMac->oemData.pOemDataRsp != NULL) |
| 4990 | { |
| 4991 | *pOemDataRsp = pMac->oemData.pOemDataRsp; |
| 4992 | } |
| 4993 | else |
| 4994 | { |
| 4995 | status = eHAL_STATUS_FAILURE; |
| 4996 | } |
| 4997 | |
| 4998 | //release the lock for the sme object |
| 4999 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5000 | |
| 5001 | } while(0); |
| 5002 | |
| 5003 | return status; |
| 5004 | } |
| 5005 | |
| 5006 | /* --------------------------------------------------------------------------- |
| 5007 | \fn sme_OemDataReq |
| 5008 | \brief a wrapper function for OEM DATA REQ |
| 5009 | \param sessionId - session id to be used. |
| 5010 | \param pOemDataReqId - pointer to an object to get back the request ID |
| 5011 | \param callback - a callback function that is called upon finish |
| 5012 | \param pContext - a pointer passed in for the callback |
| 5013 | \return eHalStatus |
| 5014 | ---------------------------------------------------------------------------*/ |
| 5015 | eHalStatus sme_OemDataReq(tHalHandle hHal, |
| 5016 | tANI_U8 sessionId, |
| 5017 | tOemDataReqConfig *pOemDataReqConfig, |
| 5018 | tANI_U32 *pOemDataReqID, |
| 5019 | oemData_OemDataReqCompleteCallback callback, |
| 5020 | void *pContext) |
| 5021 | { |
| 5022 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5023 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5024 | |
| 5025 | do |
| 5026 | { |
| 5027 | //acquire the lock for the sme object |
| 5028 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 5029 | if(HAL_STATUS_SUCCESS(status)) |
| 5030 | { |
| 5031 | tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around |
| 5032 | |
| 5033 | if(pOemDataReqID) |
| 5034 | { |
| 5035 | *pOemDataReqID = lOemDataReqId; |
| 5036 | } |
| 5037 | else |
Leela Venkata Kiran Kumar Reddy Chirala | 090cc1f | 2013-03-07 17:40:17 -0800 | [diff] [blame] | 5038 | { |
| 5039 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5040 | return eHAL_STATUS_FAILURE; |
| 5041 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5042 | |
| 5043 | status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext); |
| 5044 | |
| 5045 | //release the lock for the sme object |
| 5046 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5047 | } |
| 5048 | } while(0); |
| 5049 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5050 | smsLog(pMac, LOGW, "exiting function %s", __func__); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5051 | |
| 5052 | return(status); |
| 5053 | } |
| 5054 | |
| 5055 | #endif /*FEATURE_OEM_DATA_SUPPORT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5056 | |
| 5057 | /*-------------------------------------------------------------------------- |
| 5058 | |
| 5059 | \brief sme_OpenSession() - Open a session for scan/roam operation. |
| 5060 | |
| 5061 | This is a synchronous API. |
| 5062 | |
| 5063 | |
| 5064 | \param hHal - The handle returned by macOpen. |
| 5065 | \param callback - A pointer to the function caller specifies for roam/connect status indication |
| 5066 | \param pContext - The context passed with callback |
| 5067 | \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes) |
| 5068 | \param pbSessionId - pointer to a caller allocated buffer for returned session ID |
| 5069 | |
| 5070 | \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned. |
| 5071 | |
| 5072 | Other status means SME is failed to open the session. |
| 5073 | eHAL_STATUS_RESOURCES - no more session available. |
| 5074 | \sa |
| 5075 | |
| 5076 | --------------------------------------------------------------------------*/ |
| 5077 | eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext, |
| 5078 | tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId) |
| 5079 | { |
| 5080 | eHalStatus status; |
| 5081 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5082 | |
| 5083 | if( NULL == pbSessionId ) |
| 5084 | { |
| 5085 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 5086 | } |
| 5087 | else |
| 5088 | { |
| 5089 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5090 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5091 | { |
| 5092 | status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId ); |
| 5093 | |
| 5094 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5095 | } |
| 5096 | } |
| 5097 | |
| 5098 | return ( status ); |
| 5099 | } |
| 5100 | |
| 5101 | |
| 5102 | /*-------------------------------------------------------------------------- |
| 5103 | |
| 5104 | \brief sme_CloseSession() - Open a session for scan/roam operation. |
| 5105 | |
| 5106 | This is a synchronous API. |
| 5107 | |
| 5108 | |
| 5109 | \param hHal - The handle returned by macOpen. |
| 5110 | |
| 5111 | \param sessionId - A previous opened session's ID. |
| 5112 | |
| 5113 | \return eHAL_STATUS_SUCCESS - session is closed. |
| 5114 | |
| 5115 | Other status means SME is failed to open the session. |
| 5116 | eHAL_STATUS_INVALID_PARAMETER - session is not opened. |
| 5117 | \sa |
| 5118 | |
| 5119 | --------------------------------------------------------------------------*/ |
| 5120 | eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId, |
| 5121 | csrRoamSessionCloseCallback callback, void *pContext) |
| 5122 | { |
| 5123 | eHalStatus status; |
| 5124 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5125 | |
| 5126 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5127 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5128 | { |
| 5129 | status = csrRoamCloseSession( pMac, sessionId, FALSE, |
| 5130 | callback, pContext ); |
| 5131 | |
| 5132 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5133 | } |
| 5134 | |
| 5135 | return ( status ); |
| 5136 | } |
| 5137 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5138 | /* --------------------------------------------------------------------------- |
| 5139 | |
| 5140 | \fn sme_RoamUpdateAPWPSIE |
| 5141 | |
| 5142 | \brief To update AP's WPS IE. This function should be called after SME AP session is created |
| 5143 | This is an asynchronous API. |
| 5144 | |
| 5145 | \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs |
| 5146 | |
| 5147 | \return eHalStatus – SUCCESS – |
| 5148 | |
| 5149 | FAILURE or RESOURCES – The API finished and failed. |
| 5150 | |
| 5151 | -------------------------------------------------------------------------------*/ |
| 5152 | eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES) |
| 5153 | { |
| 5154 | |
| 5155 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5156 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5157 | |
| 5158 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5159 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5160 | { |
| 5161 | |
| 5162 | status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES ); |
| 5163 | |
| 5164 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5165 | } |
| 5166 | |
| 5167 | return (status); |
| 5168 | } |
| 5169 | /* --------------------------------------------------------------------------- |
| 5170 | |
| 5171 | \fn sme_RoamUpdateAPWPARSNIEs |
| 5172 | |
| 5173 | \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created |
| 5174 | This is an asynchronous API. |
| 5175 | |
| 5176 | \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs |
| 5177 | |
| 5178 | \return eHalStatus – SUCCESS – |
| 5179 | |
| 5180 | FAILURE or RESOURCES – The API finished and failed. |
| 5181 | |
| 5182 | -------------------------------------------------------------------------------*/ |
| 5183 | eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie) |
| 5184 | { |
| 5185 | |
| 5186 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5187 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5188 | |
| 5189 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5190 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5191 | { |
| 5192 | |
| 5193 | status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie); |
| 5194 | |
| 5195 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5196 | } |
| 5197 | |
| 5198 | return (status); |
| 5199 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5200 | /* --------------------------------------------------------------------------- |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5201 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5202 | \fn sme_ChangeMCCBeaconInterval |
| 5203 | |
| 5204 | \brief To update P2P-GO beaconInterval. This function should be called after |
| 5205 | disassociating all the station is done |
| 5206 | This is an asynchronous API. |
| 5207 | |
| 5208 | \param |
| 5209 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5210 | \return eHalStatus SUCCESS |
| 5211 | FAILURE or RESOURCES |
| 5212 | The API finished and failed. |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5213 | |
| 5214 | -------------------------------------------------------------------------------*/ |
| 5215 | eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId) |
| 5216 | { |
| 5217 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5218 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5219 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5220 | smsLog(pMac, LOG1, FL("Update Beacon PARAMS ")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 5221 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5222 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5223 | { |
| 5224 | status = csrSendChngMCCBeaconInterval( pMac, sessionId); |
| 5225 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5226 | } |
| 5227 | return (status); |
| 5228 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5229 | |
| 5230 | /*-------------------------------------------------------------------------------* |
| 5231 | |
| 5232 | \fn sme_sendBTAmpEvent |
| 5233 | |
| 5234 | \brief to receive the coex priorty request from BT-AMP PAL |
| 5235 | and send the BT_AMP link state to HAL |
| 5236 | |
| 5237 | \param btAmpEvent - btAmpEvent |
| 5238 | |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 5239 | \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5240 | |
| 5241 | FAILURE: API failed |
| 5242 | |
| 5243 | -------------------------------------------------------------------------------*/ |
| 5244 | |
| 5245 | eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent) |
| 5246 | { |
| 5247 | vos_msg_t msg; |
| 5248 | tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL; |
| 5249 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5250 | |
| 5251 | ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent)); |
| 5252 | if (NULL == ptrSmeBtAmpEvent) |
| 5253 | { |
| 5254 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5255 | "Not able to allocate memory for BTAmp event", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5256 | return status; |
| 5257 | } |
| 5258 | |
| 5259 | vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent)); |
| 5260 | msg.type = WDA_SIGNAL_BTAMP_EVENT; |
| 5261 | msg.reserved = 0; |
| 5262 | msg.bodyptr = ptrSmeBtAmpEvent; |
| 5263 | |
| 5264 | //status = halFW_SendBTAmpEventMesg(pMac, event); |
| 5265 | |
| 5266 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 5267 | { |
| 5268 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5269 | "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] | 5270 | vos_mem_free(ptrSmeBtAmpEvent); |
| 5271 | return status; |
| 5272 | } |
| 5273 | |
| 5274 | return eHAL_STATUS_SUCCESS; |
| 5275 | |
| 5276 | } |
| 5277 | |
| 5278 | /* --------------------------------------------------------------------------- |
| 5279 | \fn sme_SetHostOffload |
| 5280 | \brief API to set the host offload feature. |
| 5281 | \param hHal - The handle returned by macOpen. |
| 5282 | \param pRequest - Pointer to the offload request. |
| 5283 | \return eHalStatus |
| 5284 | ---------------------------------------------------------------------------*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5285 | eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId, |
| 5286 | tpSirHostOffloadReq pRequest) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5287 | { |
| 5288 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5289 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5290 | |
| 5291 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5292 | { |
| 5293 | #ifdef WLAN_NS_OFFLOAD |
| 5294 | if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType) |
| 5295 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5296 | status = pmcSetNSOffload( hHal, pRequest, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5297 | } |
| 5298 | else |
| 5299 | #endif //WLAN_NS_OFFLOAD |
| 5300 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5301 | status = pmcSetHostOffload (hHal, pRequest, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5302 | } |
| 5303 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5304 | } |
| 5305 | |
| 5306 | return (status); |
| 5307 | } |
| 5308 | |
| 5309 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 5310 | /* --------------------------------------------------------------------------- |
| 5311 | \fn sme_SetGTKOffload |
| 5312 | \brief API to set GTK offload information. |
| 5313 | \param hHal - The handle returned by macOpen. |
| 5314 | \param pRequest - Pointer to the GTK offload request. |
| 5315 | \return eHalStatus |
| 5316 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5317 | eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest, |
| 5318 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5319 | { |
| 5320 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5321 | eHalStatus status; |
| 5322 | |
| 5323 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5324 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5325 | status = pmcSetGTKOffload( hHal, pRequest, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5326 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5327 | } |
| 5328 | |
| 5329 | return (status); |
| 5330 | } |
| 5331 | |
| 5332 | /* --------------------------------------------------------------------------- |
| 5333 | \fn sme_GetGTKOffload |
| 5334 | \brief API to get GTK offload information. |
| 5335 | \param hHal - The handle returned by macOpen. |
| 5336 | \param pRequest - Pointer to the GTK offload response. |
| 5337 | \return eHalStatus |
| 5338 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5339 | eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, |
| 5340 | void *callbackContext, tANI_U8 sessionId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5341 | { |
| 5342 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5343 | eHalStatus status; |
| 5344 | |
| 5345 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5346 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5347 | pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5348 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5349 | } |
| 5350 | |
| 5351 | return (status); |
| 5352 | } |
| 5353 | #endif // WLAN_FEATURE_GTK_OFFLOAD |
| 5354 | |
| 5355 | /* --------------------------------------------------------------------------- |
| 5356 | \fn sme_SetKeepAlive |
| 5357 | \brief API to set the Keep Alive feature. |
| 5358 | \param hHal - The handle returned by macOpen. |
| 5359 | \param pRequest - Pointer to the Keep Alive request. |
| 5360 | \return eHalStatus |
| 5361 | ---------------------------------------------------------------------------*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5362 | eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId, |
| 5363 | tpSirKeepAliveReq pRequest) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5364 | { |
| 5365 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5366 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5367 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5368 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5369 | status = pmcSetKeepAlive (hHal, pRequest, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5370 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5371 | } |
| 5372 | |
| 5373 | return (status); |
| 5374 | } |
| 5375 | |
| 5376 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5377 | /* --------------------------------------------------------------------------- |
| 5378 | \fn sme_SetPreferredNetworkList |
| 5379 | \brief API to set the Preferred Network List Offload feature. |
| 5380 | \param hHal - The handle returned by macOpen. |
| 5381 | \param pRequest - Pointer to the offload request. |
| 5382 | \return eHalStatus |
| 5383 | ---------------------------------------------------------------------------*/ |
| 5384 | eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext ) |
| 5385 | { |
| 5386 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5387 | eHalStatus status; |
| 5388 | |
| 5389 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5390 | { |
| 5391 | pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext); |
| 5392 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5393 | } |
| 5394 | |
| 5395 | return (status); |
| 5396 | } |
| 5397 | |
| 5398 | eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold) |
| 5399 | { |
| 5400 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5401 | eHalStatus status; |
| 5402 | |
| 5403 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5404 | { |
| 5405 | pmcSetRssiFilter(hHal, rssiThreshold); |
| 5406 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5407 | } |
| 5408 | |
| 5409 | return (status); |
| 5410 | } |
| 5411 | |
| 5412 | #endif // FEATURE_WLAN_SCAN_PNO |
| 5413 | |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 5414 | eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5415 | { |
| 5416 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5417 | eHalStatus status; |
| 5418 | |
| 5419 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5420 | { |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 5421 | pmcSetPowerParams(hHal, pwParams, forced); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5422 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5423 | } |
| 5424 | |
| 5425 | return (status); |
| 5426 | } |
| 5427 | |
| 5428 | /* --------------------------------------------------------------------------- |
| 5429 | \fn sme_AbortMacScan |
| 5430 | \brief API to cancel MAC scan. |
| 5431 | \param hHal - The handle returned by macOpen. |
| 5432 | \return VOS_STATUS |
| 5433 | VOS_STATUS_E_FAILURE - failure |
| 5434 | VOS_STATUS_SUCCESS success |
| 5435 | ---------------------------------------------------------------------------*/ |
| 5436 | eHalStatus sme_AbortMacScan(tHalHandle hHal) |
| 5437 | { |
| 5438 | eHalStatus status; |
| 5439 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5440 | |
| 5441 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5442 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5443 | { |
| 5444 | status = csrScanAbortMacScan(pMac); |
| 5445 | |
| 5446 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5447 | } |
| 5448 | |
| 5449 | return ( status ); |
| 5450 | } |
| 5451 | |
| 5452 | /* ---------------------------------------------------------------------------- |
| 5453 | \fn sme_GetOperationChannel |
| 5454 | \brief API to get current channel on which STA is parked |
| 5455 | this function gives channel information only of infra station or IBSS station |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5456 | \param hHal, pointer to memory location and sessionId |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5457 | \returns eHAL_STATUS_SUCCESS |
| 5458 | eHAL_STATUS_FAILURE |
| 5459 | -------------------------------------------------------------------------------*/ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5460 | eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5461 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5462 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5463 | tCsrRoamSession *pSession; |
| 5464 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5465 | if (CSR_IS_SESSION_VALID( pMac, sessionId )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5466 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5467 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5468 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5469 | if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) || |
| 5470 | ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) || |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5471 | ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) || |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5472 | ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS )) |
| 5473 | { |
| 5474 | *pChannel =pSession->connectedProfile.operationChannel; |
| 5475 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5476 | } |
| 5477 | } |
| 5478 | return eHAL_STATUS_FAILURE; |
| 5479 | }// sme_GetOperationChannel ends here |
| 5480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5481 | /* --------------------------------------------------------------------------- |
| 5482 | |
| 5483 | \fn sme_RegisterMgtFrame |
| 5484 | |
| 5485 | \brief To register managment frame of specified type and subtype. |
| 5486 | \param frameType - type of the frame that needs to be passed to HDD. |
| 5487 | \param matchData - data which needs to be matched before passing frame |
| 5488 | to HDD. |
| 5489 | \param matchDataLen - Length of matched data. |
| 5490 | \return eHalStatus |
| 5491 | -------------------------------------------------------------------------------*/ |
| 5492 | eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, |
| 5493 | tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen) |
| 5494 | { |
| 5495 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5496 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5497 | |
| 5498 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5499 | { |
| 5500 | tSirRegisterMgmtFrame *pMsg; |
| 5501 | tANI_U16 len; |
| 5502 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5503 | |
| 5504 | if(!pSession) |
| 5505 | { |
| 5506 | 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] | 5507 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5508 | return eHAL_STATUS_FAILURE; |
| 5509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5510 | |
| 5511 | if( !pSession->sessionActive ) |
| 5512 | { |
| 5513 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5514 | "%s Invalid Sessionid", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5516 | return eHAL_STATUS_FAILURE; |
| 5517 | } |
| 5518 | |
| 5519 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5520 | |
| 5521 | status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len ); |
| 5522 | if(HAL_STATUS_SUCCESS(status)) |
| 5523 | { |
| 5524 | palZeroMemory(pMac->hHdd, pMsg, len); |
| 5525 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5526 | pMsg->length = len; |
| 5527 | pMsg->sessionId = sessionId; |
| 5528 | pMsg->registerFrame = VOS_TRUE; |
| 5529 | pMsg->frameType = frameType; |
| 5530 | pMsg->matchLen = matchLen; |
| 5531 | palCopyMemory( pMac, pMsg->matchData, matchData, matchLen); |
| 5532 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 5533 | } |
| 5534 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5535 | } |
| 5536 | return status; |
| 5537 | } |
| 5538 | |
| 5539 | /* --------------------------------------------------------------------------- |
| 5540 | |
| 5541 | \fn sme_DeregisterMgtFrame |
| 5542 | |
| 5543 | \brief To De-register managment frame of specified type and subtype. |
| 5544 | \param frameType - type of the frame that needs to be passed to HDD. |
| 5545 | \param matchData - data which needs to be matched before passing frame |
| 5546 | to HDD. |
| 5547 | \param matchDataLen - Length of matched data. |
| 5548 | \return eHalStatus |
| 5549 | -------------------------------------------------------------------------------*/ |
| 5550 | eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, |
| 5551 | tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen) |
| 5552 | { |
| 5553 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5554 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5555 | |
| 5556 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5557 | { |
| 5558 | tSirRegisterMgmtFrame *pMsg; |
| 5559 | tANI_U16 len; |
| 5560 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5561 | |
| 5562 | if(!pSession) |
| 5563 | { |
| 5564 | 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] | 5565 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5566 | return eHAL_STATUS_FAILURE; |
| 5567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5568 | |
| 5569 | if( !pSession->sessionActive ) |
| 5570 | { |
| 5571 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5572 | "%s Invalid Sessionid", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5573 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5574 | return eHAL_STATUS_FAILURE; |
| 5575 | } |
| 5576 | |
| 5577 | len = sizeof(tSirRegisterMgmtFrame) + matchLen; |
| 5578 | |
| 5579 | status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len ); |
| 5580 | if(HAL_STATUS_SUCCESS(status)) |
| 5581 | { |
| 5582 | palZeroMemory(pMac->hHdd, pMsg, len); |
| 5583 | pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ; |
| 5584 | pMsg->length = len; |
| 5585 | pMsg->registerFrame = VOS_FALSE; |
| 5586 | pMsg->frameType = frameType; |
| 5587 | pMsg->matchLen = matchLen; |
| 5588 | palCopyMemory( pMac, pMsg->matchData, matchData, matchLen); |
| 5589 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 5590 | } |
| 5591 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5592 | } |
| 5593 | return status; |
| 5594 | } |
| 5595 | |
| 5596 | /* --------------------------------------------------------------------------- |
| 5597 | \fn sme_RemainOnChannel |
| 5598 | \brief API to request remain on channel for 'x' duration. used in p2p in listen state |
| 5599 | \param hHal - The handle returned by macOpen. |
| 5600 | \param pRequest - channel |
| 5601 | \param duration - duration in ms |
| 5602 | \param callback - HDD registered callback to process reaminOnChannelRsp |
| 5603 | \param context - HDD Callback param |
| 5604 | \return eHalStatus |
| 5605 | ---------------------------------------------------------------------------*/ |
| 5606 | |
| 5607 | eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId, |
| 5608 | tANI_U8 channel, tANI_U32 duration, |
| 5609 | remainOnChanCallback callback, |
| 5610 | void *pContext) |
| 5611 | { |
| 5612 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5613 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5614 | |
| 5615 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5616 | { |
| 5617 | status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext |
| 5618 | #ifdef WLAN_FEATURE_P2P_INTERNAL |
| 5619 | , eP2PRemainOnChnReasonUnknown |
| 5620 | #endif |
| 5621 | ); |
| 5622 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5623 | } |
| 5624 | return(status); |
| 5625 | } |
| 5626 | |
| 5627 | /* --------------------------------------------------------------------------- |
| 5628 | \fn sme_ReportProbeReq |
| 5629 | \brief API to enable/disable forwarding of probeReq to apps in p2p. |
| 5630 | \param hHal - The handle returned by macOpen. |
| 5631 | \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p |
| 5632 | \return eHalStatus |
| 5633 | ---------------------------------------------------------------------------*/ |
| 5634 | |
| 5635 | #ifndef WLAN_FEATURE_CONCURRENT_P2P |
| 5636 | eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag) |
| 5637 | { |
| 5638 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5639 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5640 | |
| 5641 | do |
| 5642 | { |
| 5643 | //acquire the lock for the sme object |
| 5644 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 5645 | if(HAL_STATUS_SUCCESS(status)) |
| 5646 | { |
| 5647 | /* call set in context */ |
| 5648 | pMac->p2pContext.probeReqForwarding = flag; |
| 5649 | //release the lock for the sme object |
| 5650 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5651 | } |
| 5652 | } while(0); |
| 5653 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5654 | smsLog(pMac, LOGW, "exiting function %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5655 | |
| 5656 | return(status); |
| 5657 | } |
| 5658 | |
| 5659 | /* --------------------------------------------------------------------------- |
| 5660 | \fn sme_updateP2pIe |
| 5661 | \brief API to set the P2p Ie in p2p context |
| 5662 | \param hHal - The handle returned by macOpen. |
| 5663 | \param p2pIe - Ptr to p2pIe from HDD. |
| 5664 | \param p2pIeLength: length of p2pIe |
| 5665 | \return eHalStatus |
| 5666 | ---------------------------------------------------------------------------*/ |
| 5667 | |
| 5668 | eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength) |
| 5669 | { |
| 5670 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5671 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5672 | |
| 5673 | //acquire the lock for the sme object |
| 5674 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 5675 | if(HAL_STATUS_SUCCESS(status)) |
| 5676 | { |
| 5677 | if(NULL != pMac->p2pContext.probeRspIe){ |
| 5678 | vos_mem_free(pMac->p2pContext.probeRspIe); |
| 5679 | pMac->p2pContext.probeRspIeLength = 0; |
| 5680 | } |
| 5681 | |
| 5682 | pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength); |
| 5683 | if (NULL == pMac->p2pContext.probeRspIe) |
| 5684 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5685 | smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5686 | pMac->p2pContext.probeRspIeLength = 0; |
| 5687 | status = eHAL_STATUS_FAILURE; |
| 5688 | } |
| 5689 | else |
| 5690 | { |
| 5691 | pMac->p2pContext.probeRspIeLength = p2pIeLength; |
| 5692 | |
| 5693 | sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2, |
| 5694 | pMac->p2pContext.probeRspIe, |
| 5695 | pMac->p2pContext.probeRspIeLength ); |
| 5696 | vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe, |
| 5697 | p2pIeLength); |
| 5698 | } |
| 5699 | |
| 5700 | //release the lock for the sme object |
| 5701 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5702 | } |
| 5703 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5704 | smsLog(pMac, LOG2, "exiting function %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5705 | |
| 5706 | return(status); |
| 5707 | } |
| 5708 | #endif |
| 5709 | |
| 5710 | /* --------------------------------------------------------------------------- |
| 5711 | \fn sme_sendAction |
| 5712 | \brief API to send action frame from supplicant. |
| 5713 | \param hHal - The handle returned by macOpen. |
| 5714 | \return eHalStatus |
| 5715 | ---------------------------------------------------------------------------*/ |
| 5716 | |
| 5717 | eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5718 | const tANI_U8 *pBuf, tANI_U32 len, |
| 5719 | tANI_U16 wait, tANI_BOOLEAN noack) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5720 | { |
| 5721 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5722 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5723 | |
| 5724 | //acquire the lock for the sme object |
| 5725 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 5726 | if(HAL_STATUS_SUCCESS(status)) |
| 5727 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5728 | p2pSendAction(hHal, sessionId, pBuf, len, wait, noack); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5729 | //release the lock for the sme object |
| 5730 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5731 | } |
| 5732 | |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 5733 | smsLog(pMac, LOGW, "exiting function %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5734 | |
| 5735 | return(status); |
| 5736 | } |
| 5737 | |
| 5738 | eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId ) |
| 5739 | { |
| 5740 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5741 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5742 | |
| 5743 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5744 | { |
| 5745 | status = p2pCancelRemainOnChannel (hHal, sessionId); |
| 5746 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5747 | } |
| 5748 | return(status); |
| 5749 | } |
| 5750 | |
| 5751 | //Power Save Related |
| 5752 | eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data) |
| 5753 | { |
| 5754 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5755 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5756 | |
| 5757 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5758 | { |
| 5759 | status = p2pSetPs (hHal, data); |
| 5760 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5761 | } |
| 5762 | return(status); |
| 5763 | } |
| 5764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5765 | |
| 5766 | /* --------------------------------------------------------------------------- |
| 5767 | |
| 5768 | \fn sme_ConfigureRxpFilter |
| 5769 | |
| 5770 | \brief |
| 5771 | SME will pass this request to lower mac to set/reset the filter on RXP for |
| 5772 | multicast & broadcast traffic. |
| 5773 | |
| 5774 | \param |
| 5775 | |
| 5776 | hHal - The handle returned by macOpen. |
| 5777 | |
| 5778 | filterMask- Currently the API takes a 1 or 0 (set or reset) as filter. |
| 5779 | Basically to enable/disable the filter (to filter "all" mcbc traffic) based |
| 5780 | on this param. In future we can use this as a mask to set various types of |
| 5781 | filters as suggested below: |
| 5782 | FILTER_ALL_MULTICAST: |
| 5783 | FILTER_ALL_BROADCAST: |
| 5784 | FILTER_ALL_MULTICAST_BROADCAST: |
| 5785 | |
| 5786 | |
| 5787 | \return eHalStatus |
| 5788 | |
| 5789 | |
| 5790 | --------------------------------------------------------------------------- */ |
| 5791 | eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal, |
| 5792 | tpSirWlanSetRxpFilters wlanRxpFilterParam) |
| 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 = wlanRxpFilterParam; |
| 5803 | vosMessage.type = WDA_CFG_RXP_FILTER_REQ; |
| 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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5814 | /* --------------------------------------------------------------------------- |
| 5815 | |
| 5816 | \fn sme_ConfigureSuspendInd |
| 5817 | |
| 5818 | \brief |
| 5819 | SME will pass this request to lower mac to Indicate that the wlan needs to |
| 5820 | be suspended |
| 5821 | |
| 5822 | \param |
| 5823 | |
| 5824 | hHal - The handle returned by macOpen. |
| 5825 | |
| 5826 | wlanSuspendParam- Depicts the wlan suspend params |
| 5827 | |
| 5828 | |
| 5829 | \return eHalStatus |
| 5830 | |
| 5831 | |
| 5832 | --------------------------------------------------------------------------- */ |
| 5833 | eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal, |
| 5834 | tpSirWlanSuspendParam wlanSuspendParam) |
| 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 = wlanSuspendParam; |
| 5845 | vosMessage.type = WDA_WLAN_SUSPEND_IND; |
| 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 | |
| 5856 | /* --------------------------------------------------------------------------- |
| 5857 | |
| 5858 | \fn sme_ConfigureResumeReq |
| 5859 | |
| 5860 | \brief |
| 5861 | SME will pass this request to lower mac to Indicate that the wlan needs to |
| 5862 | be Resumed |
| 5863 | |
| 5864 | \param |
| 5865 | |
| 5866 | hHal - The handle returned by macOpen. |
| 5867 | |
| 5868 | wlanResumeParam- Depicts the wlan resume params |
| 5869 | |
| 5870 | |
| 5871 | \return eHalStatus |
| 5872 | |
| 5873 | |
| 5874 | --------------------------------------------------------------------------- */ |
| 5875 | eHalStatus sme_ConfigureResumeReq( tHalHandle hHal, |
| 5876 | tpSirWlanResumeParam wlanResumeParam) |
| 5877 | { |
| 5878 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5879 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 5880 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5881 | vos_msg_t vosMessage; |
| 5882 | |
| 5883 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 5884 | { |
| 5885 | /* serialize the req through MC thread */ |
| 5886 | vosMessage.bodyptr = wlanResumeParam; |
| 5887 | vosMessage.type = WDA_WLAN_RESUME_REQ; |
| 5888 | vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ); |
| 5889 | if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 5890 | { |
| 5891 | status = eHAL_STATUS_FAILURE; |
| 5892 | } |
| 5893 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5894 | } |
| 5895 | return(status); |
| 5896 | } |
| 5897 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5898 | /* --------------------------------------------------------------------------- |
| 5899 | |
| 5900 | \fn sme_GetInfraSessionId |
| 5901 | |
| 5902 | \brief To get the session ID for infra session, if connected |
| 5903 | This is a synchronous API. |
| 5904 | |
| 5905 | \param hHal - The handle returned by macOpen. |
| 5906 | |
| 5907 | \return sessionid, -1 if infra session is not connected |
| 5908 | |
| 5909 | -------------------------------------------------------------------------------*/ |
| 5910 | tANI_S8 sme_GetInfraSessionId(tHalHandle hHal) |
| 5911 | { |
| 5912 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5913 | tANI_S8 sessionid = -1; |
| 5914 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5915 | |
| 5916 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5917 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5918 | { |
| 5919 | |
| 5920 | sessionid = csrGetInfraSessionId( pMac); |
| 5921 | |
| 5922 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5923 | } |
| 5924 | |
| 5925 | return (sessionid); |
| 5926 | } |
| 5927 | |
| 5928 | /* --------------------------------------------------------------------------- |
| 5929 | |
| 5930 | \fn sme_GetInfraOperationChannel |
| 5931 | |
| 5932 | \brief To get the operating channel for infra session, if connected |
| 5933 | This is a synchronous API. |
| 5934 | |
| 5935 | \param hHal - The handle returned by macOpen. |
| 5936 | \param sessionId - the sessionId returned by sme_OpenSession. |
| 5937 | |
| 5938 | \return operating channel, 0 if infra session is not connected |
| 5939 | |
| 5940 | -------------------------------------------------------------------------------*/ |
| 5941 | tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId) |
| 5942 | { |
| 5943 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5944 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5945 | tANI_U8 channel = 0; |
| 5946 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5947 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5948 | { |
| 5949 | |
| 5950 | channel = csrGetInfraOperationChannel( pMac, sessionId); |
| 5951 | |
| 5952 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5953 | } |
| 5954 | |
| 5955 | return (channel); |
| 5956 | } |
| 5957 | |
| 5958 | //This routine will return poerating channel on which other BSS is operating to be used for concurrency mode. |
| 5959 | //If other BSS is not up or not connected it will return 0 |
| 5960 | tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal ) |
| 5961 | { |
| 5962 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 5963 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5964 | tANI_U8 channel = 0; |
| 5965 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 5966 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 5967 | { |
| 5968 | |
| 5969 | channel = csrGetConcurrentOperationChannel( pMac ); |
| 5970 | 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] | 5971 | " Other Concurrent Channel = %d", __func__,channel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5972 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 5973 | } |
| 5974 | |
| 5975 | return (channel); |
| 5976 | } |
| 5977 | |
| 5978 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5979 | /****************************************************************************** |
| 5980 | * |
| 5981 | * Name: sme_PreferredNetworkFoundInd |
| 5982 | * |
| 5983 | * Description: |
| 5984 | * Invoke Preferred Network Found Indication |
| 5985 | * |
| 5986 | * Parameters: |
| 5987 | * hHal - HAL handle for device |
| 5988 | * pMsg - found network description |
| 5989 | * |
| 5990 | * Returns: eHalStatus |
| 5991 | * |
| 5992 | ******************************************************************************/ |
| 5993 | eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg) |
| 5994 | { |
| 5995 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 5996 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5997 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg; |
Srikant Kuppa | 066904f | 2013-05-07 13:56:02 -0700 | [diff] [blame] | 5998 | v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1]; |
| 5999 | tANI_U8 ssIdLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6000 | |
| 6001 | if (NULL == pMsg) |
| 6002 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6003 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6004 | status = eHAL_STATUS_FAILURE; |
| 6005 | } |
| 6006 | else |
| 6007 | { |
| 6008 | if (pPrefNetworkFoundInd->ssId.length > 0) |
| 6009 | { |
Srikant Kuppa | 066904f | 2013-05-07 13:56:02 -0700 | [diff] [blame] | 6010 | ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH, |
| 6011 | pPrefNetworkFoundInd->ssId.length); |
| 6012 | vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength); |
| 6013 | dumpSsId[ssIdLength] = 0; |
| 6014 | smsLog(pMac, LOG2, "%s:SSID=%s frame length %d", |
| 6015 | __func__, dumpSsId, pPrefNetworkFoundInd->frameLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6016 | |
Srikant Kuppa | 066904f | 2013-05-07 13:56:02 -0700 | [diff] [blame] | 6017 | //Save the frame to scan result |
| 6018 | if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd)) |
| 6019 | { |
| 6020 | //we may have a frame |
| 6021 | status = csrScanSavePreferredNetworkFound(pMac, |
| 6022 | pPrefNetworkFoundInd); |
| 6023 | if (!HAL_STATUS_SUCCESS(status)) |
| 6024 | { |
| 6025 | smsLog(pMac, LOGE, FL(" fail to save preferred network")); |
| 6026 | } |
| 6027 | } |
| 6028 | else |
| 6029 | { |
| 6030 | smsLog(pMac, LOGE, FL(" not enough data length %d needed %d"), |
| 6031 | pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6032 | } |
| 6033 | |
Srikant Kuppa | 066904f | 2013-05-07 13:56:02 -0700 | [diff] [blame] | 6034 | /* Call Preferred Netowrk Found Indication callback routine. */ |
| 6035 | if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL)) |
| 6036 | { |
| 6037 | pMac->pmc.prefNetwFoundCB( |
| 6038 | pMac->pmc.preferredNetworkFoundIndCallbackContext, |
| 6039 | pPrefNetworkFoundInd); |
| 6040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6041 | } |
| 6042 | else |
| 6043 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6044 | smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6045 | status = eHAL_STATUS_FAILURE; |
| 6046 | } |
| 6047 | } |
| 6048 | |
| 6049 | |
| 6050 | return(status); |
| 6051 | } |
| 6052 | |
| 6053 | #endif // FEATURE_WLAN_SCAN_PNO |
| 6054 | |
| 6055 | |
| 6056 | eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len) |
| 6057 | { |
| 6058 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6059 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6060 | |
| 6061 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6062 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6063 | { |
| 6064 | status = csrGetCfgValidChannels(pMac, aValidChannels, len); |
| 6065 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6066 | } |
| 6067 | |
| 6068 | return (status); |
| 6069 | } |
| 6070 | |
| 6071 | |
| 6072 | /* --------------------------------------------------------------------------- |
| 6073 | |
| 6074 | \fn sme_SetTxPerTracking |
| 6075 | |
| 6076 | \brief Set Tx PER tracking configuration parameters |
| 6077 | |
| 6078 | \param hHal - The handle returned by macOpen. |
| 6079 | \param pTxPerTrackingConf - Tx PER configuration parameters |
| 6080 | |
| 6081 | \return eHalStatus |
| 6082 | |
| 6083 | -------------------------------------------------------------------------------*/ |
| 6084 | eHalStatus sme_SetTxPerTracking(tHalHandle hHal, |
| 6085 | void (*pCallbackfn) (void *pCallbackContext), |
| 6086 | void *pCallbackContext, |
| 6087 | tpSirTxPerTrackingParam pTxPerTrackingParam) |
| 6088 | { |
| 6089 | vos_msg_t msg; |
| 6090 | tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL; |
| 6091 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6092 | |
| 6093 | if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) ) |
| 6094 | { |
| 6095 | pMac->sme.pTxPerHitCallback = pCallbackfn; |
| 6096 | pMac->sme.pTxPerHitCbContext = pCallbackContext; |
| 6097 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6098 | } |
| 6099 | |
| 6100 | // free this memory in failure case or WDA request callback function |
| 6101 | pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam)); |
| 6102 | if (NULL == pTxPerTrackingParamReq) |
| 6103 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6104 | 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] | 6105 | return eHAL_STATUS_FAILURE; |
| 6106 | } |
| 6107 | |
| 6108 | vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam)); |
| 6109 | msg.type = WDA_SET_TX_PER_TRACKING_REQ; |
| 6110 | msg.reserved = 0; |
| 6111 | msg.bodyptr = pTxPerTrackingParamReq; |
| 6112 | |
| 6113 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6114 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6115 | 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] | 6116 | vos_mem_free(pTxPerTrackingParamReq); |
| 6117 | return eHAL_STATUS_FAILURE; |
| 6118 | } |
| 6119 | |
| 6120 | return eHAL_STATUS_SUCCESS; |
| 6121 | } |
| 6122 | |
| 6123 | /* --------------------------------------------------------------------------- |
| 6124 | |
| 6125 | \fn sme_HandleChangeCountryCode |
| 6126 | |
| 6127 | \brief Change Country code, Reg Domain and channel list |
| 6128 | |
| 6129 | \details Country Code Priority |
| 6130 | 0 = 11D > Configured Country > NV |
| 6131 | 1 = Configured Country > 11D > NV |
| 6132 | If Supplicant country code is priority than 11d is disabled. |
| 6133 | If 11D is enabled, we update the country code after every scan. |
| 6134 | Hence when Supplicant country code is priority, we don't need 11D info. |
| 6135 | Country code from Supplicant is set as current courtry code. |
| 6136 | User can send reset command XX (instead of country code) to reset the |
| 6137 | country code to default values which is read from NV. |
| 6138 | In case of reset, 11D is enabled and default NV code is Set as current country code |
| 6139 | If 11D is priority, |
| 6140 | Than Supplicant country code code is set to default code. But 11D code is set as current country code |
| 6141 | |
| 6142 | \param pMac - The handle returned by macOpen. |
| 6143 | \param pMsgBuf - MSG Buffer |
| 6144 | |
| 6145 | \return eHalStatus |
| 6146 | |
| 6147 | -------------------------------------------------------------------------------*/ |
| 6148 | eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf) |
| 6149 | { |
| 6150 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6151 | tAniChangeCountryCodeReq *pMsg; |
| 6152 | v_REGDOMAIN_t domainIdIoctl; |
| 6153 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 6154 | static uNvTables nvTables; |
| 6155 | pMsg = (tAniChangeCountryCodeReq *)pMsgBuf; |
| 6156 | |
| 6157 | |
| 6158 | /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */ |
| 6159 | if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) ) |
| 6160 | { |
| 6161 | pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 6162 | |
| 6163 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 6164 | |
| 6165 | /* read the country code from NV and use it */ |
| 6166 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 6167 | { |
| 6168 | palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN ); |
| 6169 | } |
| 6170 | else |
| 6171 | { |
| 6172 | status = eHAL_STATUS_FAILURE; |
| 6173 | return status; |
| 6174 | } |
| 6175 | } |
| 6176 | else |
| 6177 | { |
| 6178 | /* if Supplicant country code has priority, disable 11d */ |
Gopichand Nakkala | acd9411 | 2013-05-29 21:37:47 +0530 | [diff] [blame] | 6179 | if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority && |
| 6180 | pMsg->countryFromUserSpace) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6181 | { |
| 6182 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 6183 | } |
| 6184 | } |
| 6185 | |
| 6186 | /* WEXT set country code means |
| 6187 | * 11D should be supported? |
| 6188 | * 11D Channel should be enforced? |
| 6189 | * 11D Country code should be matched? |
| 6190 | * 11D Reg Domian should be matched? |
| 6191 | * Country string changed */ |
| 6192 | if(pMac->roam.configParam.Is11dSupportEnabled && |
| 6193 | pMac->roam.configParam.fEnforce11dChannels && |
| 6194 | pMac->roam.configParam.fEnforceCountryCodeMatch && |
| 6195 | pMac->roam.configParam.fEnforceDefaultDomain && |
| 6196 | !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE)) |
| 6197 | { |
| 6198 | /* All 11D related options are already enabled |
| 6199 | * Country string is not changed |
| 6200 | * Do not need do anything for country code change request */ |
| 6201 | return eHAL_STATUS_SUCCESS; |
| 6202 | } |
| 6203 | |
| 6204 | /* Set Current Country code and Current Regulatory domain */ |
| 6205 | status = csrSetCountryCode(pMac, pMsg->countryCode, NULL); |
| 6206 | if(eHAL_STATUS_SUCCESS != status) |
| 6207 | { |
| 6208 | /* Supplicant country code failed. So give 11D priority */ |
| 6209 | pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 6210 | smsLog(pMac, LOGE, "Set Country Code Fail %d", status); |
| 6211 | return status; |
| 6212 | } |
| 6213 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6214 | /* overwrite the defualt country code */ |
| 6215 | palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 6216 | |
| 6217 | /* Get Domain ID from country code */ |
| 6218 | status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl ); |
| 6219 | if ( status != eHAL_STATUS_SUCCESS ) |
| 6220 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6221 | smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6222 | return status; |
| 6223 | } |
| 6224 | |
| 6225 | status = WDA_SetRegDomain(pMac, domainIdIoctl); |
| 6226 | |
| 6227 | if ( status != eHAL_STATUS_SUCCESS ) |
| 6228 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6229 | smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6230 | return status; |
| 6231 | } |
| 6232 | |
| 6233 | /* set to default domain ID */ |
| 6234 | pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent; |
| 6235 | |
| 6236 | /* get the channels based on new cc */ |
| 6237 | status = csrInitGetChannels( pMac ); |
| 6238 | |
| 6239 | if ( status != eHAL_STATUS_SUCCESS ) |
| 6240 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6241 | smsLog( pMac, LOGE, FL(" fail to get Channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6242 | return status; |
| 6243 | } |
| 6244 | |
| 6245 | /* reset info based on new cc, and we are done */ |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 6246 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6247 | if( pMsg->changeCCCallback ) |
| 6248 | { |
| 6249 | ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext); |
| 6250 | } |
| 6251 | |
| 6252 | return eHAL_STATUS_SUCCESS; |
| 6253 | } |
| 6254 | |
| 6255 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6256 | eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6257 | { |
| 6258 | tpSirRcvFltMcAddrList pRequestBuf; |
| 6259 | vos_msg_t msg; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6260 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6261 | tCsrRoamSession *pSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | |
| 6263 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: " |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6264 | "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6265 | pMulticastAddrs->ulMulticastAddrCnt, |
| 6266 | pMulticastAddrs->multicastAddr[0]); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6267 | |
| 6268 | /* |
| 6269 | *Find the connected Infra / P2P_client connected session |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6270 | */ |
| 6271 | if (CSR_IS_SESSION_VALID(pMac, sessionId) && |
| 6272 | csrIsConnStateInfra(pMac, sessionId)) |
| 6273 | { |
| 6274 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6275 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6276 | |
| 6277 | if(pSession == NULL ) |
| 6278 | { |
| 6279 | 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] | 6280 | "the right session", __func__); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6281 | return eHAL_STATUS_FAILURE; |
| 6282 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6284 | pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
| 6285 | if (NULL == pRequestBuf) |
| 6286 | { |
| 6287 | 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] | 6288 | "allocate memory for 8023 Multicast List request", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6289 | return eHAL_STATUS_FAILED_ALLOC; |
| 6290 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6291 | |
| 6292 | if( !csrIsConnStateConnectedInfra (pMac, sessionId )) |
| 6293 | { |
| 6294 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the " |
| 6295 | "indication as we are not connected", __func__); |
| 6296 | vos_mem_free(pRequestBuf); |
| 6297 | return eHAL_STATUS_FAILURE; |
| 6298 | } |
| 6299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6300 | vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList)); |
| 6301 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6302 | vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
| 6303 | vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid, |
| 6304 | sizeof(tSirMacAddr)); |
| 6305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6306 | msg.type = WDA_8023_MULTICAST_LIST_REQ; |
| 6307 | msg.reserved = 0; |
| 6308 | msg.bodyptr = pRequestBuf; |
| 6309 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6310 | { |
| 6311 | 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] | 6312 | "post WDA_8023_MULTICAST_LIST message to WDA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6313 | vos_mem_free(pRequestBuf); |
| 6314 | return eHAL_STATUS_FAILURE; |
| 6315 | } |
| 6316 | |
| 6317 | return eHAL_STATUS_SUCCESS; |
| 6318 | } |
| 6319 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6320 | eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg, |
| 6321 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6322 | { |
| 6323 | tpSirRcvPktFilterCfgType pRequestBuf; |
| 6324 | v_SINT_t allocSize; |
| 6325 | vos_msg_t msg; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6326 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6327 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6328 | v_U8_t idx=0; |
| 6329 | |
| 6330 | 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] | 6331 | "filterId = %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6332 | pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId); |
| 6333 | |
Madan Mohan Koyyalamudi | d402962 | 2012-10-18 20:30:17 -0700 | [diff] [blame] | 6334 | allocSize = sizeof(tSirRcvPktFilterCfgType); |
| 6335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6336 | pRequestBuf = vos_mem_malloc(allocSize); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6337 | |
| 6338 | if (NULL == pRequestBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6339 | { |
| 6340 | 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] | 6341 | "allocate memory for Receive Filter Set Filter request", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6342 | return eHAL_STATUS_FAILED_ALLOC; |
| 6343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6344 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6345 | if( NULL == pSession ) |
| 6346 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6347 | 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] | 6348 | vos_mem_free(pRequestBuf); |
| 6349 | return eHAL_STATUS_FAILURE; |
| 6350 | } |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6351 | |
| 6352 | vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
| 6353 | vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6354 | sizeof(tSirMacAddr)); |
| 6355 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6356 | vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize); |
| 6357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6358 | msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ; |
| 6359 | msg.reserved = 0; |
| 6360 | msg.bodyptr = pRequestBuf; |
| 6361 | |
| 6362 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : " |
| 6363 | "FT %d FID %d ", |
| 6364 | pRequestBuf->filterType, pRequestBuf->filterId); |
| 6365 | |
| 6366 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : " |
| 6367 | "params %d CT %d", |
| 6368 | pRequestBuf->numFieldParams, pRequestBuf->coalesceTime); |
| 6369 | |
| 6370 | for (idx=0; idx<pRequestBuf->numFieldParams; idx++) |
| 6371 | { |
| 6372 | |
| 6373 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6374 | "Proto %d Comp Flag %d ", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6375 | pRequestBuf->paramsData[idx].protocolLayer, |
| 6376 | pRequestBuf->paramsData[idx].cmpFlag); |
| 6377 | |
| 6378 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6379 | "Data Offset %d Data Len %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6380 | pRequestBuf->paramsData[idx].dataOffset, |
| 6381 | pRequestBuf->paramsData[idx].dataLength); |
| 6382 | |
| 6383 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6384 | "CData: %d:%d:%d:%d:%d:%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | pRequestBuf->paramsData[idx].compareData[0], |
| 6386 | pRequestBuf->paramsData[idx].compareData[1], |
| 6387 | pRequestBuf->paramsData[idx].compareData[2], |
| 6388 | pRequestBuf->paramsData[idx].compareData[3], |
| 6389 | pRequestBuf->paramsData[idx].compareData[4], |
| 6390 | pRequestBuf->paramsData[idx].compareData[5]); |
| 6391 | |
| 6392 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6393 | "MData: %d:%d:%d:%d:%d:%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6394 | pRequestBuf->paramsData[idx].dataMask[0], |
| 6395 | pRequestBuf->paramsData[idx].dataMask[1], |
| 6396 | pRequestBuf->paramsData[idx].dataMask[2], |
| 6397 | pRequestBuf->paramsData[idx].dataMask[3], |
| 6398 | pRequestBuf->paramsData[idx].dataMask[4], |
| 6399 | pRequestBuf->paramsData[idx].dataMask[5]); |
| 6400 | |
| 6401 | } |
| 6402 | |
| 6403 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6404 | { |
| 6405 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6406 | "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6407 | vos_mem_free(pRequestBuf); |
| 6408 | return eHAL_STATUS_FAILURE; |
| 6409 | } |
| 6410 | |
| 6411 | return eHAL_STATUS_SUCCESS; |
| 6412 | } |
| 6413 | |
| 6414 | eHalStatus sme_GetFilterMatchCount(tHalHandle hHal, |
| 6415 | FilterMatchCountCallback callbackRoutine, |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6416 | void *callbackContext, |
| 6417 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6418 | { |
| 6419 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6420 | eHalStatus status; |
| 6421 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6422 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6423 | |
| 6424 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme))) |
| 6425 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6426 | pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6427 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6428 | } |
| 6429 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6430 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6431 | |
| 6432 | return (status); |
| 6433 | } |
| 6434 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6435 | eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam, |
| 6436 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6437 | { |
| 6438 | tpSirRcvFltPktClearParam pRequestBuf; |
| 6439 | vos_msg_t msg; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6440 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6441 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6442 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6443 | 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] | 6444 | pRcvFltPktClearParam->filterId); |
| 6445 | |
| 6446 | pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam)); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6447 | if (NULL == pRequestBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6448 | { |
| 6449 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 6450 | "%s: Not able to allocate memory for Receive Filter " |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6451 | "Clear Filter request", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6452 | return eHAL_STATUS_FAILED_ALLOC; |
| 6453 | } |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6454 | if( NULL == pSession ) |
| 6455 | { |
| 6456 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6457 | "%s: Session Not find ", __func__); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6458 | vos_mem_free(pRequestBuf); |
| 6459 | return eHAL_STATUS_FAILURE; |
| 6460 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6461 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6462 | vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
| 6463 | vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6464 | sizeof(tSirMacAddr)); |
| 6465 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6466 | vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam)); |
| 6467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6468 | msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ; |
| 6469 | msg.reserved = 0; |
| 6470 | msg.bodyptr = pRequestBuf; |
| 6471 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6472 | { |
| 6473 | 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] | 6474 | "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6475 | vos_mem_free(pRequestBuf); |
| 6476 | return eHAL_STATUS_FAILURE; |
| 6477 | } |
| 6478 | |
| 6479 | return eHAL_STATUS_SUCCESS; |
| 6480 | } |
| 6481 | #endif // WLAN_FEATURE_PACKET_FILTERING |
| 6482 | |
| 6483 | /* --------------------------------------------------------------------------- |
| 6484 | \fn sme_PreChannelSwitchIndFullPowerCB |
| 6485 | \brief call back function for the PMC full power request because of pre |
| 6486 | channel switch. |
| 6487 | \param callbackContext |
| 6488 | \param status |
| 6489 | ---------------------------------------------------------------------------*/ |
| 6490 | void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext, |
| 6491 | eHalStatus status) |
| 6492 | { |
| 6493 | tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext; |
| 6494 | tSirMbMsg *pMsg; |
| 6495 | tANI_U16 msgLen; |
| 6496 | |
| 6497 | msgLen = (tANI_U16)(sizeof( tSirMbMsg )); |
| 6498 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); |
| 6499 | if(HAL_STATUS_SUCCESS(status)) |
| 6500 | { |
| 6501 | palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen); |
| 6502 | pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER); |
| 6503 | pMsg->msgLen = pal_cpu_to_be16(msgLen); |
| 6504 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 6505 | } |
| 6506 | |
| 6507 | return; |
| 6508 | } |
| 6509 | |
| 6510 | /* --------------------------------------------------------------------------- |
| 6511 | \fn sme_HandlePreChannelSwitchInd |
| 6512 | \brief Processes the indcation from PE for pre-channel switch. |
| 6513 | \param hHal |
| 6514 | \- The handle returned by macOpen. return eHalStatus |
| 6515 | ---------------------------------------------------------------------------*/ |
| 6516 | eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal) |
| 6517 | { |
| 6518 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6519 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6520 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6521 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6522 | { |
| 6523 | status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB, |
| 6524 | pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH); |
| 6525 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6526 | } |
| 6527 | |
| 6528 | return (status); |
| 6529 | } |
| 6530 | |
| 6531 | /* --------------------------------------------------------------------------- |
| 6532 | \fn sme_HandlePostChannelSwitchInd |
| 6533 | \brief Processes the indcation from PE for post-channel switch. |
| 6534 | \param hHal |
| 6535 | \- The handle returned by macOpen. return eHalStatus |
| 6536 | ---------------------------------------------------------------------------*/ |
| 6537 | eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal) |
| 6538 | { |
| 6539 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6540 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6541 | |
| 6542 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6543 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6544 | { |
| 6545 | status = pmcRequestBmps(hHal, NULL, NULL); |
| 6546 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6547 | } |
| 6548 | |
| 6549 | return (status); |
| 6550 | } |
| 6551 | |
| 6552 | /* --------------------------------------------------------------------------- |
| 6553 | |
| 6554 | \fn sme_IsChannelValid |
| 6555 | |
| 6556 | \brief To check if the channel is valid for currently established domain |
| 6557 | This is a synchronous API. |
| 6558 | |
| 6559 | \param hHal - The handle returned by macOpen. |
| 6560 | \param channel - channel to verify |
| 6561 | |
| 6562 | \return TRUE/FALSE, TRUE if channel is valid |
| 6563 | |
| 6564 | -------------------------------------------------------------------------------*/ |
| 6565 | tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel) |
| 6566 | { |
| 6567 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6568 | tANI_BOOLEAN valid = FALSE; |
| 6569 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6570 | |
| 6571 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6572 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6573 | { |
| 6574 | |
| 6575 | valid = csrRoamIsChannelValid( pMac, channel); |
| 6576 | |
| 6577 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6578 | } |
| 6579 | |
| 6580 | return (valid); |
| 6581 | } |
| 6582 | |
| 6583 | /* --------------------------------------------------------------------------- |
| 6584 | \fn sme_SetFreqBand |
| 6585 | \brief Used to set frequency band. |
| 6586 | \param hHal |
| 6587 | \eBand band value to be configured |
| 6588 | \- return eHalStatus |
| 6589 | -------------------------------------------------------------------------*/ |
| 6590 | eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand) |
| 6591 | { |
| 6592 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6593 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6594 | |
| 6595 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6596 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6597 | { |
| 6598 | status = csrSetBand(hHal, eBand); |
| 6599 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6600 | } |
| 6601 | return status; |
| 6602 | } |
| 6603 | |
| 6604 | /* --------------------------------------------------------------------------- |
| 6605 | \fn sme_GetFreqBand |
| 6606 | \brief Used to get the current band settings. |
| 6607 | \param hHal |
| 6608 | \pBand pointer to hold band value |
| 6609 | \- return eHalStatus |
| 6610 | -------------------------------------------------------------------------*/ |
| 6611 | eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand) |
| 6612 | { |
| 6613 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6614 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6615 | |
| 6616 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6617 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6618 | { |
| 6619 | *pBand = csrGetCurrentBand( hHal ); |
| 6620 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6621 | } |
| 6622 | return status; |
| 6623 | } |
| 6624 | |
| 6625 | #ifdef WLAN_WAKEUP_EVENTS |
| 6626 | /****************************************************************************** |
| 6627 | \fn sme_WakeReasonIndCallback |
| 6628 | |
| 6629 | \brief |
| 6630 | a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA |
| 6631 | |
| 6632 | \param hHal - HAL handle for device |
| 6633 | \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter |
| 6634 | |
| 6635 | \return eHalStatus |
| 6636 | ******************************************************************************/ |
| 6637 | eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg) |
| 6638 | { |
| 6639 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6640 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6641 | tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg; |
| 6642 | |
| 6643 | if (NULL == pMsg) |
| 6644 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6645 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6646 | status = eHAL_STATUS_FAILURE; |
| 6647 | } |
| 6648 | else |
| 6649 | { |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 6650 | smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6651 | |
| 6652 | /* Call Wake Reason Indication callback routine. */ |
| 6653 | if (pMac->pmc.wakeReasonIndCB != NULL) |
| 6654 | pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd); |
| 6655 | |
| 6656 | pMac->pmc.wakeReasonIndCB = NULL; |
| 6657 | pMac->pmc.wakeReasonIndCBContext = NULL; |
| 6658 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6659 | 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] | 6660 | } |
| 6661 | |
| 6662 | return(status); |
| 6663 | } |
| 6664 | #endif // WLAN_WAKEUP_EVENTS |
| 6665 | |
| 6666 | |
| 6667 | /* --------------------------------------------------------------------------- |
| 6668 | |
| 6669 | \fn sme_SetMaxTxPower |
| 6670 | |
| 6671 | \brief Set the Maximum Transmit Power dynamically. Note: this setting will |
| 6672 | not persist over reboots. |
| 6673 | |
| 6674 | \param hHal |
| 6675 | \param pBssid BSSID to set the power cap for |
| 6676 | \param pBssid pSelfMacAddress self MAC Address |
| 6677 | \param pBssid power to set in dB |
| 6678 | \- return eHalStatus |
| 6679 | |
| 6680 | -------------------------------------------------------------------------------*/ |
| 6681 | eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid, |
| 6682 | tSirMacAddr pSelfMacAddress, v_S7_t dB) |
| 6683 | { |
| 6684 | vos_msg_t msg; |
| 6685 | tpMaxTxPowerParams pMaxTxParams = NULL; |
| 6686 | |
| 6687 | pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams)); |
| 6688 | if (NULL == pMaxTxParams) |
| 6689 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6690 | 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] | 6691 | return eHAL_STATUS_FAILURE; |
| 6692 | } |
| 6693 | |
| 6694 | vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH); |
| 6695 | vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress, |
| 6696 | SIR_MAC_ADDR_LENGTH); |
| 6697 | pMaxTxParams->power = dB; |
| 6698 | |
| 6699 | msg.type = WDA_SET_MAX_TX_POWER_REQ; |
| 6700 | msg.reserved = 0; |
| 6701 | msg.bodyptr = pMaxTxParams; |
| 6702 | |
| 6703 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 6704 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6705 | 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] | 6706 | vos_mem_free(pMaxTxParams); |
| 6707 | return eHAL_STATUS_FAILURE; |
| 6708 | } |
| 6709 | |
| 6710 | return eHAL_STATUS_SUCCESS; |
| 6711 | } |
| 6712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6713 | /* --------------------------------------------------------------------------- |
| 6714 | |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 6715 | \fn sme_SetTxPower |
| 6716 | |
| 6717 | \brief Set Transmit Power dynamically. Note: this setting will |
| 6718 | not persist over reboots. |
| 6719 | |
| 6720 | \param hHal |
| 6721 | \param sessionId Target Session ID |
| 6722 | \param mW power to set in mW |
| 6723 | \- return eHalStatus |
| 6724 | |
| 6725 | -------------------------------------------------------------------------------*/ |
| 6726 | eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW) |
| 6727 | { |
| 6728 | |
| 6729 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6730 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6731 | |
| 6732 | smsLog(pMac, LOG1, FL("set tx power %dmW"), mW); |
| 6733 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 6734 | if (HAL_STATUS_SUCCESS(status)) |
| 6735 | { |
| 6736 | status = csrSetTxPower(pMac, sessionId, mW); |
| 6737 | sme_ReleaseGlobalLock(&pMac->sme); |
| 6738 | } |
| 6739 | return status; |
| 6740 | } |
| 6741 | |
| 6742 | /* --------------------------------------------------------------------------- |
| 6743 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6744 | \fn sme_HideSSID |
| 6745 | |
| 6746 | \brief hide/show SSID dynamically. Note: this setting will |
| 6747 | not persist over reboots. |
| 6748 | |
| 6749 | \param hHal |
| 6750 | \param sessionId |
| 6751 | \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID |
| 6752 | \- return eHalStatus |
| 6753 | |
| 6754 | -------------------------------------------------------------------------------*/ |
| 6755 | eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden) |
| 6756 | { |
| 6757 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6758 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6759 | tANI_U16 len; |
| 6760 | |
| 6761 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 6762 | { |
| 6763 | tpSirUpdateParams pMsg; |
| 6764 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6765 | |
| 6766 | if(!pSession) |
| 6767 | { |
| 6768 | 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] | 6769 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6770 | return eHAL_STATUS_FAILURE; |
| 6771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6772 | |
| 6773 | if( !pSession->sessionActive ) |
| 6774 | VOS_ASSERT(0); |
| 6775 | |
| 6776 | /* Create the message and send to lim */ |
| 6777 | len = sizeof(tSirUpdateParams); |
| 6778 | status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len ); |
| 6779 | if(HAL_STATUS_SUCCESS(status)) |
| 6780 | { |
| 6781 | palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) ); |
| 6782 | pMsg->messageType = eWNI_SME_HIDE_SSID_REQ; |
| 6783 | pMsg->length = len; |
| 6784 | /* Data starts from here */ |
| 6785 | pMsg->sessionId = sessionId; |
| 6786 | pMsg->ssidHidden = ssidHidden; |
| 6787 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 6788 | } |
| 6789 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6790 | } |
| 6791 | return status; |
| 6792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6793 | |
| 6794 | /* --------------------------------------------------------------------------- |
| 6795 | |
| 6796 | \fn sme_SetTmLevel |
| 6797 | \brief Set Thermal Mitigation Level to RIVA |
| 6798 | \param hHal - The handle returned by macOpen. |
| 6799 | \param newTMLevel - new Thermal Mitigation Level |
| 6800 | \param tmMode - Thermal Mitigation handle mode, default 0 |
| 6801 | \return eHalStatus |
| 6802 | ---------------------------------------------------------------------------*/ |
| 6803 | eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode) |
| 6804 | { |
| 6805 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6806 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 6807 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6808 | vos_msg_t vosMessage; |
| 6809 | tAniSetTmLevelReq *setTmLevelReq = NULL; |
| 6810 | |
| 6811 | if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) ) |
| 6812 | { |
| 6813 | setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq)); |
| 6814 | if(NULL == setTmLevelReq) |
| 6815 | { |
| 6816 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6817 | "%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] | 6818 | sme_ReleaseGlobalLock( &pMac->sme ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6819 | return eHAL_STATUS_FAILURE; |
| 6820 | } |
| 6821 | |
| 6822 | setTmLevelReq->tmMode = tmMode; |
| 6823 | setTmLevelReq->newTmLevel = newTMLevel; |
| 6824 | |
| 6825 | /* serialize the req through MC thread */ |
| 6826 | vosMessage.bodyptr = setTmLevelReq; |
| 6827 | vosMessage.type = WDA_SET_TM_LEVEL_REQ; |
| 6828 | vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage ); |
| 6829 | if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 6830 | { |
| 6831 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6832 | "%s: Post Set TM Level MSG fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6833 | vos_mem_free(setTmLevelReq); |
| 6834 | status = eHAL_STATUS_FAILURE; |
| 6835 | } |
| 6836 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6837 | } |
| 6838 | return(status); |
| 6839 | } |
| 6840 | |
| 6841 | /*--------------------------------------------------------------------------- |
| 6842 | |
| 6843 | \brief sme_featureCapsExchange() - SME interface to exchange capabilities between |
| 6844 | Host and FW. |
| 6845 | |
| 6846 | \param hHal - HAL handle for device |
| 6847 | |
| 6848 | \return NONE |
| 6849 | |
| 6850 | ---------------------------------------------------------------------------*/ |
| 6851 | void sme_featureCapsExchange( tHalHandle hHal) |
| 6852 | { |
| 6853 | v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL); |
| 6854 | WDA_featureCapsExchange(vosContext); |
| 6855 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 6856 | |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 6857 | /*--------------------------------------------------------------------------- |
| 6858 | |
| 6859 | \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity |
| 6860 | in Host. |
| 6861 | |
| 6862 | \param hHal - HAL handle for device |
| 6863 | |
| 6864 | \return NONE |
| 6865 | |
| 6866 | ---------------------------------------------------------------------------*/ |
| 6867 | void sme_disableFeatureCapablity(tANI_U8 feature_index) |
| 6868 | { |
| 6869 | WDA_disableCapablityFeature(feature_index); |
| 6870 | } |
| 6871 | |
| 6872 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 6873 | |
| 6874 | /* --------------------------------------------------------------------------- |
| 6875 | |
| 6876 | \fn sme_GetDefaultCountryCode |
| 6877 | |
| 6878 | \brief Get the default country code from NV |
| 6879 | |
| 6880 | \param hHal |
| 6881 | \param pCountry |
| 6882 | \- return eHalStatus |
| 6883 | |
| 6884 | -------------------------------------------------------------------------------*/ |
| 6885 | eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry) |
| 6886 | { |
| 6887 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6888 | return csrGetDefaultCountryCodeFrmNv(pMac, pCountry); |
| 6889 | } |
| 6890 | |
| 6891 | /* --------------------------------------------------------------------------- |
| 6892 | |
| 6893 | \fn sme_GetCurrentCountryCode |
| 6894 | |
| 6895 | \brief Get the current country code |
| 6896 | |
| 6897 | \param hHal |
| 6898 | \param pCountry |
| 6899 | \- return eHalStatus |
| 6900 | |
| 6901 | -------------------------------------------------------------------------------*/ |
| 6902 | eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry) |
| 6903 | { |
| 6904 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6905 | return csrGetCurrentCountryCode(pMac, pCountry); |
| 6906 | } |
| 6907 | |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 6908 | /* --------------------------------------------------------------------------- |
| 6909 | \fn sme_transportDebug |
| 6910 | \brief Dynamically monitoring Transport channels |
| 6911 | Private IOCTL will querry transport channel status if driver loaded |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 6912 | \param hHal Upper MAC context |
Jeff Johnson | b88db98 | 2012-12-10 13:34:59 -0800 | [diff] [blame] | 6913 | \param displaySnapshot Display transport channel snapshot option |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 6914 | \param toggleStallDetect Enable stall detect feature |
| 6915 | This feature will take effect to data performance |
| 6916 | Not integrate till fully verification |
| 6917 | \- return NONE |
| 6918 | -------------------------------------------------------------------------*/ |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 6919 | 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] | 6920 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 6921 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 6922 | |
| 6923 | if (NULL == pMac) |
| 6924 | { |
| 6925 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 6926 | "%s: invalid context", __func__); |
| 6927 | return; |
| 6928 | } |
| 6929 | WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 6930 | } |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 6931 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 6932 | /* --------------------------------------------------------------------------- |
| 6933 | \fn sme_ResetPowerValuesFor5G |
| 6934 | \brief Reset the power values for 5G band with NV power values. |
| 6935 | \param hHal - HAL handle for device |
| 6936 | \- return NONE |
| 6937 | -------------------------------------------------------------------------*/ |
| 6938 | void sme_ResetPowerValuesFor5G (tHalHandle hHal) |
| 6939 | { |
| 6940 | tpAniSirGlobal pMac = PMAC_STRUCT (hHal); |
| 6941 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
| 6942 | csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg |
| 6943 | } |
| 6944 | |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 6945 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 6946 | /* --------------------------------------------------------------------------- |
| 6947 | \fn sme_UpdateRoamPrefer5GHz |
| 6948 | \brief enable/disable Roam prefer 5G runtime option |
| 6949 | This function is called through dynamic setConfig callback function |
| 6950 | to configure the Roam prefer 5G runtime option |
| 6951 | \param hHal - HAL handle for device |
| 6952 | \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option |
| 6953 | \- return Success or failure |
| 6954 | -------------------------------------------------------------------------*/ |
| 6955 | |
| 6956 | eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz) |
| 6957 | { |
| 6958 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 6959 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6960 | |
| 6961 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6962 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6963 | { |
| 6964 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6965 | "%s: gRoamPrefer5GHz is changed from %d to %d", __func__, |
| 6966 | pMac->roam.configParam.nRoamPrefer5GHz, |
| 6967 | nRoamPrefer5GHz); |
| 6968 | pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz; |
| 6969 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6970 | } |
| 6971 | |
| 6972 | return status ; |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 6973 | } |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 6974 | |
| 6975 | /* --------------------------------------------------------------------------- |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 6976 | \fn sme_setRoamIntraBand |
| 6977 | \brief enable/disable Intra band roaming |
| 6978 | This function is called through dynamic setConfig callback function |
| 6979 | to configure the intra band roaming |
| 6980 | \param hHal - HAL handle for device |
| 6981 | \param nRoamIntraBand Enable/Disable Intra band roaming |
| 6982 | \- return Success or failure |
| 6983 | -------------------------------------------------------------------------*/ |
| 6984 | eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand) |
| 6985 | { |
| 6986 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 6987 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6988 | |
| 6989 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 6990 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 6991 | { |
| 6992 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6993 | "%s: gRoamIntraBand is changed from %d to %d", __func__, |
| 6994 | pMac->roam.configParam.nRoamIntraBand, |
| 6995 | nRoamIntraBand); |
| 6996 | pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand; |
| 6997 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 6998 | } |
| 6999 | |
| 7000 | return status ; |
| 7001 | } |
| 7002 | |
| 7003 | /* --------------------------------------------------------------------------- |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 7004 | \fn sme_UpdateRoamScanNProbes |
| 7005 | \brief function to update roam scan N probes |
| 7006 | This function is called through dynamic setConfig callback function |
| 7007 | to update roam scan N probes |
| 7008 | \param hHal - HAL handle for device |
| 7009 | \param nProbes number of probe requests to be sent out |
| 7010 | \- return Success or failure |
| 7011 | -------------------------------------------------------------------------*/ |
| 7012 | eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes) |
| 7013 | { |
| 7014 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7015 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7016 | |
| 7017 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7018 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7019 | { |
| 7020 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7021 | "%s: gRoamScanNProbes is changed from %d to %d", __func__, |
| 7022 | pMac->roam.configParam.nProbes, |
| 7023 | nProbes); |
| 7024 | pMac->roam.configParam.nProbes = nProbes; |
| 7025 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7026 | } |
| 7027 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7028 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7029 | { |
| 7030 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7031 | REASON_NPROBES_CHANGED); |
| 7032 | } |
| 7033 | #endif |
| 7034 | return status ; |
| 7035 | } |
| 7036 | |
| 7037 | /* --------------------------------------------------------------------------- |
| 7038 | \fn sme_UpdateRoamScanHomeAwayTime |
| 7039 | \brief function to update roam scan Home away time |
| 7040 | This function is called through dynamic setConfig callback function |
| 7041 | to update roam scan home away time |
| 7042 | \param hHal - HAL handle for device |
| 7043 | \param nRoamScanAwayTime Scan home away time |
| 7044 | \- return Success or failure |
| 7045 | -------------------------------------------------------------------------*/ |
| 7046 | eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime) |
| 7047 | { |
| 7048 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7049 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7050 | |
| 7051 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7052 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7053 | { |
| 7054 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7055 | "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__, |
| 7056 | pMac->roam.configParam.nRoamScanHomeAwayTime, |
| 7057 | nRoamScanHomeAwayTime); |
| 7058 | pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime; |
| 7059 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7060 | } |
| 7061 | |
| 7062 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7063 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7064 | { |
| 7065 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7066 | REASON_HOME_AWAY_TIME_CHANGED); |
| 7067 | } |
| 7068 | #endif |
| 7069 | return status; |
| 7070 | } |
| 7071 | |
| 7072 | |
| 7073 | /* --------------------------------------------------------------------------- |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7074 | \fn sme_getRoamIntraBand |
| 7075 | \brief get Intra band roaming |
| 7076 | \param hHal - HAL handle for device |
| 7077 | \- return Success or failure |
| 7078 | -------------------------------------------------------------------------*/ |
| 7079 | v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal) |
| 7080 | { |
| 7081 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7082 | return pMac->roam.configParam.nRoamIntraBand; |
| 7083 | } |
| 7084 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 7085 | /* --------------------------------------------------------------------------- |
| 7086 | \fn sme_getRoamScanNProbes |
| 7087 | \brief get N Probes |
| 7088 | \param hHal - HAL handle for device |
| 7089 | \- return Success or failure |
| 7090 | -------------------------------------------------------------------------*/ |
| 7091 | v_U8_t sme_getRoamScanNProbes(tHalHandle hHal) |
| 7092 | { |
| 7093 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7094 | return pMac->roam.configParam.nProbes; |
| 7095 | } |
| 7096 | |
| 7097 | /* --------------------------------------------------------------------------- |
| 7098 | \fn sme_getRoamScanHomeAwayTime |
| 7099 | \brief get Roam scan home away time |
| 7100 | \param hHal - HAL handle for device |
| 7101 | \- return Success or failure |
| 7102 | -------------------------------------------------------------------------*/ |
| 7103 | v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal) |
| 7104 | { |
| 7105 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7106 | return pMac->roam.configParam.nRoamScanHomeAwayTime; |
| 7107 | } |
| 7108 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7109 | |
| 7110 | /* --------------------------------------------------------------------------- |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 7111 | \fn sme_UpdateImmediateRoamRssiDiff |
| 7112 | \brief Update nImmediateRoamRssiDiff |
| 7113 | This function is called through dynamic setConfig callback function |
| 7114 | to configure nImmediateRoamRssiDiff |
| 7115 | Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125] |
| 7116 | \param hHal - HAL handle for device |
| 7117 | \param nImmediateRoamRssiDiff - minimum rssi difference between potential |
| 7118 | candidate and current AP. |
| 7119 | \- return Success or failure |
| 7120 | -------------------------------------------------------------------------*/ |
| 7121 | |
| 7122 | eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff) |
| 7123 | { |
| 7124 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7125 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7126 | |
| 7127 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7128 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7129 | { |
| 7130 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7131 | "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d", |
| 7132 | nImmediateRoamRssiDiff, |
| 7133 | pMac->roam.configParam.nImmediateRoamRssiDiff, |
| 7134 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7135 | pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff; |
| 7136 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7137 | } |
| 7138 | |
| 7139 | return status ; |
| 7140 | } |
| 7141 | |
| 7142 | /* --------------------------------------------------------------------------- |
| 7143 | \fn sme_UpdateRoamRssiDiff |
| 7144 | \brief Update RoamRssiDiff |
| 7145 | This function is called through dynamic setConfig callback function |
| 7146 | to configure RoamRssiDiff |
| 7147 | Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125] |
| 7148 | \param hHal - HAL handle for device |
| 7149 | \param RoamRssiDiff - minimum rssi difference between potential |
| 7150 | candidate and current AP. |
| 7151 | \- return Success or failure |
| 7152 | -------------------------------------------------------------------------*/ |
| 7153 | |
| 7154 | eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff) |
| 7155 | { |
| 7156 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7157 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7158 | |
| 7159 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7160 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7161 | { |
| 7162 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7163 | "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d", |
| 7164 | RoamRssiDiff, |
| 7165 | pMac->roam.configParam.RoamRssiDiff, |
| 7166 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7167 | pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff; |
| 7168 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7169 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 7170 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7171 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7172 | { |
| 7173 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED); |
| 7174 | } |
| 7175 | #endif |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7176 | return status ; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 7177 | } |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7178 | |
| 7179 | /*-------------------------------------------------------------------------- |
| 7180 | \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime |
| 7181 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7182 | isFastTransitionEnabled. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7183 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7184 | \param hHal - The handle returned by macOpen. |
| 7185 | \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully. |
| 7186 | Other status means SME is failed to update isFastTransitionEnabled. |
| 7187 | \sa |
| 7188 | --------------------------------------------------------------------------*/ |
| 7189 | eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal, |
| 7190 | v_BOOL_t isFastTransitionEnabled) |
| 7191 | { |
| 7192 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7193 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7194 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7195 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7196 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7197 | { |
| 7198 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7199 | "%s: FastTransitionEnabled is changed from %d to %d", __func__, |
| 7200 | pMac->roam.configParam.isFastTransitionEnabled, |
| 7201 | isFastTransitionEnabled); |
| 7202 | pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled; |
| 7203 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7204 | } |
| 7205 | |
| 7206 | return status ; |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7207 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7208 | |
| 7209 | /* --------------------------------------------------------------------------- |
| 7210 | \fn sme_UpdateWESMode |
| 7211 | \brief Update WES Mode |
| 7212 | This function is called through dynamic setConfig callback function |
| 7213 | to configure isWESModeEnabled |
| 7214 | \param hHal - HAL handle for device |
| 7215 | \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully. |
| 7216 | Other status means SME is failed to update isWESModeEnabled. |
| 7217 | -------------------------------------------------------------------------*/ |
| 7218 | |
| 7219 | eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled) |
| 7220 | { |
| 7221 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7222 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7223 | |
| 7224 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7225 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7226 | { |
| 7227 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7228 | "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d", |
| 7229 | isWESModeEnabled, |
| 7230 | pMac->roam.configParam.isWESModeEnabled, |
| 7231 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7232 | pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled; |
| 7233 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7234 | } |
| 7235 | |
| 7236 | return status ; |
| 7237 | } |
| 7238 | |
| 7239 | /* --------------------------------------------------------------------------- |
| 7240 | \fn sme_SetRoamScanControl |
| 7241 | \brief Set roam scan control |
| 7242 | This function is called to set roam scan control |
| 7243 | if roam scan control is set to 0, roaming scan cache is cleared |
| 7244 | any value other than 0 is treated as invalid value |
| 7245 | \param hHal - HAL handle for device |
| 7246 | \return eHAL_STATUS_SUCCESS - SME update config successfully. |
| 7247 | Other status means SME failure to update |
| 7248 | -------------------------------------------------------------------------*/ |
| 7249 | eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl) |
| 7250 | { |
| 7251 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7252 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7253 | |
| 7254 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7255 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7256 | { |
| 7257 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7258 | "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d", |
| 7259 | roamScanControl, |
| 7260 | pMac->roam.configParam.nRoamScanControl, |
| 7261 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7262 | pMac->roam.configParam.nRoamScanControl = roamScanControl; |
| 7263 | if ( 0 == roamScanControl) |
| 7264 | { |
| 7265 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7266 | "LFR runtime successfully cleared roam scan cache"); |
| 7267 | csrFlushBgScanRoamChannelList(pMac); |
| 7268 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7269 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7270 | { |
| 7271 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST); |
| 7272 | } |
| 7273 | #endif |
| 7274 | } |
| 7275 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7276 | } |
| 7277 | return status ; |
| 7278 | } |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7279 | #endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */ |
| 7280 | |
| 7281 | #ifdef FEATURE_WLAN_LFR |
| 7282 | /*-------------------------------------------------------------------------- |
| 7283 | \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime |
| 7284 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7285 | isFastRoamIniFeatureEnabled. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7286 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7287 | \param hHal - The handle returned by macOpen. |
| 7288 | \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully. |
| 7289 | Other status means SME is failed to update isFastRoamIniFeatureEnabled. |
| 7290 | \sa |
| 7291 | --------------------------------------------------------------------------*/ |
| 7292 | eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal, |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7293 | const v_BOOL_t isFastRoamIniFeatureEnabled) |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7294 | { |
| 7295 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7296 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7297 | if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled) |
| 7298 | { |
| 7299 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7300 | "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__, |
| 7301 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 7302 | isFastRoamIniFeatureEnabled); |
| 7303 | return eHAL_STATUS_SUCCESS; |
| 7304 | } |
| 7305 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7306 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7307 | "%s: FastRoamEnabled is changed from %d to %d", __func__, |
| 7308 | pMac->roam.configParam.isFastRoamIniFeatureEnabled, |
| 7309 | isFastRoamIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7310 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7311 | csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7312 | |
| 7313 | if(TRUE == isFastRoamIniFeatureEnabled) |
| 7314 | { |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7315 | sme_UpdateConfigFwRssiMonitoring(hHal, TRUE); |
| 7316 | } |
| 7317 | else |
| 7318 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7319 | /* CCX also depend on FW Monitoring. |
| 7320 | Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */ |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7321 | #ifdef FEATURE_WLAN_CCX |
| 7322 | if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled) |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 7323 | #endif |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7324 | { |
| 7325 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7326 | "%s: Turn off FW Monitoring", __func__); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7327 | sme_UpdateConfigFwRssiMonitoring(hHal, FALSE); |
| 7328 | } |
| 7329 | } |
| 7330 | |
| 7331 | return eHAL_STATUS_SUCCESS; |
| 7332 | } |
| 7333 | #endif /* FEATURE_WLAN_LFR */ |
| 7334 | |
| 7335 | #ifdef FEATURE_WLAN_CCX |
| 7336 | /*-------------------------------------------------------------------------- |
| 7337 | \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime |
| 7338 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7339 | isCcxIniFeatureEnabled. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7340 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7341 | \param hHal - The handle returned by macOpen. |
| 7342 | \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully. |
| 7343 | Other status means SME is failed to update isCcxIniFeatureEnabled. |
| 7344 | \sa |
| 7345 | --------------------------------------------------------------------------*/ |
| 7346 | |
| 7347 | eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal, |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7348 | const v_BOOL_t isCcxIniFeatureEnabled) |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7349 | { |
| 7350 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7351 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7352 | if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled) |
| 7353 | { |
| 7354 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7355 | "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__, |
| 7356 | pMac->roam.configParam.isCcxIniFeatureEnabled, |
| 7357 | isCcxIniFeatureEnabled); |
| 7358 | return eHAL_STATUS_SUCCESS; |
| 7359 | } |
| 7360 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7361 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7362 | "%s: CcxEnabled is changed from %d to %d", __func__, |
| 7363 | pMac->roam.configParam.isCcxIniFeatureEnabled, |
| 7364 | isCcxIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7365 | pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7366 | csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled); |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7367 | |
| 7368 | if(TRUE == isCcxIniFeatureEnabled) |
| 7369 | { |
| 7370 | sme_UpdateFastTransitionEnabled(hHal, TRUE); |
| 7371 | sme_UpdateConfigFwRssiMonitoring(hHal, TRUE); |
| 7372 | } |
| 7373 | else |
| 7374 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7375 | /* LFR also depend on FW Monitoring. |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7376 | Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */ |
| 7377 | #ifdef FEATURE_WLAN_LFR |
| 7378 | if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled) |
| 7379 | #endif |
| 7380 | { |
| 7381 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7382 | "%s: Turn off FW Monitoring/Fast Transition", __func__); |
| 7383 | sme_UpdateFastTransitionEnabled(hHal, FALSE); |
| 7384 | sme_UpdateConfigFwRssiMonitoring(hHal, FALSE); |
| 7385 | } |
| 7386 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 7387 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7388 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7389 | { |
| 7390 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED); |
| 7391 | } |
| 7392 | #endif |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7393 | return eHAL_STATUS_SUCCESS; |
| 7394 | } |
| 7395 | #endif /* FEATURE_WLAN_CCX */ |
| 7396 | |
| 7397 | /*-------------------------------------------------------------------------- |
| 7398 | \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime |
| 7399 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7400 | fEnableFwRssiMonitoring. |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7401 | This is a synchronous call |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7402 | \param hHal - The handle returned by macOpen. |
| 7403 | \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully. |
| 7404 | Other status means SME is failed to update fEnableFwRssiMonitoring. |
| 7405 | \sa |
| 7406 | --------------------------------------------------------------------------*/ |
| 7407 | |
| 7408 | eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal, |
| 7409 | v_BOOL_t fEnableFwRssiMonitoring) |
| 7410 | { |
| 7411 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 7412 | |
Gopichand Nakkala | 98a98af | 2012-12-31 14:38:47 -0800 | [diff] [blame] | 7413 | if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring, |
| 7414 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 7415 | { |
| 7416 | halStatus = eHAL_STATUS_FAILURE; |
| 7417 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 7418 | "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] | 7419 | } |
| 7420 | |
| 7421 | return (halStatus); |
| 7422 | } |
| 7423 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7424 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7425 | /*-------------------------------------------------------------------------- |
| 7426 | \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold |
| 7427 | This is a synchronous call |
| 7428 | \param hHal - The handle returned by macOpen. |
| 7429 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7430 | Other status means SME is failed to update |
| 7431 | \sa |
| 7432 | --------------------------------------------------------------------------*/ |
| 7433 | eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal, |
| 7434 | v_U8_t neighborLookupRssiThreshold) |
| 7435 | { |
| 7436 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7437 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7438 | |
| 7439 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7440 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7441 | { |
| 7442 | status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold); |
| 7443 | if (HAL_STATUS_SUCCESS(status)) |
| 7444 | { |
| 7445 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7446 | "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d", |
| 7447 | neighborLookupRssiThreshold, |
| 7448 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold, |
| 7449 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7450 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = |
| 7451 | neighborLookupRssiThreshold; |
| 7452 | } |
| 7453 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7454 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7455 | return status; |
| 7456 | } |
| 7457 | |
| 7458 | /*-------------------------------------------------------------------------- |
| 7459 | \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold |
| 7460 | This is a synchronous call |
| 7461 | \param hHal - The handle returned by macOpen. |
| 7462 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7463 | Other status means SME is failed to update |
| 7464 | \sa |
| 7465 | --------------------------------------------------------------------------*/ |
| 7466 | eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal, |
| 7467 | v_U8_t neighborReassocRssiThreshold) |
| 7468 | { |
| 7469 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7470 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7471 | |
| 7472 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7473 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7474 | { |
| 7475 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7476 | "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d", |
| 7477 | neighborReassocRssiThreshold, |
| 7478 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold, |
| 7479 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7480 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = |
| 7481 | neighborReassocRssiThreshold; |
| 7482 | pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold = |
| 7483 | neighborReassocRssiThreshold; |
| 7484 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7485 | } |
| 7486 | |
| 7487 | return status ; |
| 7488 | } |
| 7489 | |
| 7490 | |
| 7491 | /*-------------------------------------------------------------------------- |
| 7492 | \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold |
| 7493 | This is a synchronous call |
| 7494 | \param hHal - The handle returned by macOpen. |
| 7495 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7496 | Other status means SME is failed to update |
| 7497 | \sa |
| 7498 | --------------------------------------------------------------------------*/ |
| 7499 | v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal) |
| 7500 | { |
| 7501 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7502 | return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold; |
| 7503 | } |
| 7504 | |
| 7505 | /*-------------------------------------------------------------------------- |
| 7506 | \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period |
| 7507 | This is a synchronous call |
| 7508 | \param hHal - The handle returned by macOpen. |
| 7509 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7510 | Other status means SME is failed to update |
| 7511 | \sa |
| 7512 | --------------------------------------------------------------------------*/ |
| 7513 | eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal, |
| 7514 | v_U16_t neighborScanResultsRefreshPeriod) |
| 7515 | { |
| 7516 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7517 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7518 | |
| 7519 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7520 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7521 | { |
| 7522 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7523 | "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d", |
| 7524 | neighborScanResultsRefreshPeriod, |
| 7525 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod, |
| 7526 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7527 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = |
| 7528 | neighborScanResultsRefreshPeriod; |
| 7529 | pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod = |
| 7530 | neighborScanResultsRefreshPeriod; |
| 7531 | |
| 7532 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7533 | } |
| 7534 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 7535 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7536 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7537 | { |
| 7538 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7539 | REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED); |
| 7540 | } |
| 7541 | #endif |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7542 | return status ; |
| 7543 | } |
| 7544 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 7545 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7546 | /*-------------------------------------------------------------------------- |
| 7547 | \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure |
| 7548 | It is used at in the REG_DYNAMIC_VARIABLE macro definition of |
| 7549 | gRoamScanOffloadEnabled. |
| 7550 | This is a synchronous call |
| 7551 | \param hHal - The handle returned by macOpen. |
| 7552 | \return eHAL_STATUS_SUCCESS - SME update config successfully. |
| 7553 | Other status means SME is failed to update. |
| 7554 | \sa |
| 7555 | --------------------------------------------------------------------------*/ |
| 7556 | |
| 7557 | eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal, |
| 7558 | v_BOOL_t nRoamScanOffloadEnabled) |
| 7559 | { |
| 7560 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7561 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7562 | |
| 7563 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7564 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7565 | { |
| 7566 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7567 | "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__, |
| 7568 | pMac->roam.configParam.isRoamOffloadScanEnabled, |
| 7569 | nRoamScanOffloadEnabled); |
| 7570 | pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled; |
| 7571 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7572 | } |
| 7573 | |
| 7574 | return status ; |
| 7575 | } |
| 7576 | #endif |
| 7577 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7578 | /*-------------------------------------------------------------------------- |
| 7579 | \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period |
| 7580 | This is a synchronous call |
| 7581 | \param hHal - The handle returned by macOpen. |
| 7582 | \return v_U16_t - Neighbor scan results refresh period value |
| 7583 | \sa |
| 7584 | --------------------------------------------------------------------------*/ |
| 7585 | v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal) |
| 7586 | { |
| 7587 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7588 | return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod; |
| 7589 | } |
| 7590 | |
| 7591 | /*-------------------------------------------------------------------------- |
| 7592 | \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period |
| 7593 | This is a synchronuous call |
| 7594 | \param hHal - The handle returned by macOpen. |
| 7595 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7596 | Other status means SME is failed to update |
| 7597 | \sa |
| 7598 | --------------------------------------------------------------------------*/ |
| 7599 | v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal) |
| 7600 | { |
| 7601 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7602 | return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod; |
| 7603 | } |
| 7604 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7605 | /* --------------------------------------------------------------------------- |
| 7606 | \fn sme_UpdateEmptyScanRefreshPeriod |
| 7607 | \brief Update nEmptyScanRefreshPeriod |
| 7608 | This function is called through dynamic setConfig callback function |
| 7609 | to configure nEmptyScanRefreshPeriod |
| 7610 | Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60] |
| 7611 | \param hHal - HAL handle for device |
| 7612 | \param nEmptyScanRefreshPeriod - scan period following empty scan results. |
| 7613 | \- return Success or failure |
| 7614 | -------------------------------------------------------------------------*/ |
| 7615 | |
| 7616 | eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod) |
| 7617 | { |
| 7618 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7619 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7620 | |
| 7621 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7622 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7623 | { |
| 7624 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7625 | "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d", |
| 7626 | nEmptyScanRefreshPeriod, |
| 7627 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod, |
| 7628 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7629 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod; |
| 7630 | pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod; |
| 7631 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7632 | } |
| 7633 | |
Varun Reddy Yeturu | ce114f7 | 2013-06-05 14:09:58 -0700 | [diff] [blame] | 7634 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7635 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7636 | { |
| 7637 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7638 | REASON_EMPTY_SCAN_REF_PERIOD_CHANGED); |
| 7639 | } |
| 7640 | #endif |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7641 | return status ; |
| 7642 | } |
| 7643 | |
| 7644 | /* --------------------------------------------------------------------------- |
| 7645 | \fn sme_setNeighborScanMinChanTime |
| 7646 | \brief Update nNeighborScanMinChanTime |
| 7647 | This function is called through dynamic setConfig callback function |
| 7648 | to configure gNeighborScanChannelMinTime |
| 7649 | Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60] |
| 7650 | \param hHal - HAL handle for device |
| 7651 | \param nNeighborScanMinChanTime - Channel minimum dwell time |
| 7652 | \- return Success or failure |
| 7653 | -------------------------------------------------------------------------*/ |
| 7654 | eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime) |
| 7655 | { |
| 7656 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7657 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7658 | |
| 7659 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7660 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7661 | { |
| 7662 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7663 | "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d", |
| 7664 | nNeighborScanMinChanTime, |
| 7665 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime, |
| 7666 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7667 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime; |
| 7668 | pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime; |
| 7669 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7670 | } |
| 7671 | |
| 7672 | return status ; |
| 7673 | } |
| 7674 | |
| 7675 | /* --------------------------------------------------------------------------- |
| 7676 | \fn sme_setNeighborScanMaxChanTime |
| 7677 | \brief Update nNeighborScanMaxChanTime |
| 7678 | This function is called through dynamic setConfig callback function |
| 7679 | to configure gNeighborScanChannelMaxTime |
| 7680 | Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60] |
| 7681 | \param hHal - HAL handle for device |
| 7682 | \param nNeighborScanMinChanTime - Channel maximum dwell time |
| 7683 | \- return Success or failure |
| 7684 | -------------------------------------------------------------------------*/ |
| 7685 | eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime) |
| 7686 | { |
| 7687 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7688 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7689 | |
| 7690 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7691 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7692 | { |
| 7693 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7694 | "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d", |
| 7695 | nNeighborScanMaxChanTime, |
| 7696 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime, |
| 7697 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7698 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime; |
| 7699 | pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime; |
| 7700 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7701 | } |
Varun Reddy Yeturu | ce114f7 | 2013-06-05 14:09:58 -0700 | [diff] [blame] | 7702 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7703 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7704 | { |
| 7705 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7706 | REASON_SCAN_CH_TIME_CHANGED); |
| 7707 | } |
| 7708 | #endif |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7709 | |
| 7710 | return status ; |
| 7711 | } |
| 7712 | |
| 7713 | /* --------------------------------------------------------------------------- |
| 7714 | \fn sme_getNeighborScanMinChanTime |
| 7715 | \brief get neighbor scan min channel time |
| 7716 | \param hHal - The handle returned by macOpen. |
| 7717 | \return v_U16_t - channel min time value |
| 7718 | -------------------------------------------------------------------------*/ |
| 7719 | v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal) |
| 7720 | { |
| 7721 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7722 | return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime; |
| 7723 | } |
| 7724 | |
| 7725 | /* --------------------------------------------------------------------------- |
| 7726 | \fn sme_getNeighborScanMaxChanTime |
| 7727 | \brief get neighbor scan max channel time |
| 7728 | \param hHal - The handle returned by macOpen. |
| 7729 | \return v_U16_t - channel max time value |
| 7730 | -------------------------------------------------------------------------*/ |
| 7731 | v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal) |
| 7732 | { |
| 7733 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7734 | return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime; |
| 7735 | } |
| 7736 | |
| 7737 | /* --------------------------------------------------------------------------- |
| 7738 | \fn sme_setNeighborScanPeriod |
| 7739 | \brief Update nNeighborScanPeriod |
| 7740 | This function is called through dynamic setConfig callback function |
| 7741 | to configure nNeighborScanPeriod |
Varun Reddy Yeturu | ce114f7 | 2013-06-05 14:09:58 -0700 | [diff] [blame] | 7742 | Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000] |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7743 | \param hHal - HAL handle for device |
| 7744 | \param nNeighborScanPeriod - neighbor scan period |
| 7745 | \- return Success or failure |
| 7746 | -------------------------------------------------------------------------*/ |
| 7747 | eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod) |
| 7748 | { |
| 7749 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7750 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7751 | |
| 7752 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7753 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7754 | { |
| 7755 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7756 | "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d", |
| 7757 | nNeighborScanPeriod, |
| 7758 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod, |
| 7759 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7760 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod; |
| 7761 | pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod; |
| 7762 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7763 | } |
Varun Reddy Yeturu | ce114f7 | 2013-06-05 14:09:58 -0700 | [diff] [blame] | 7764 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7765 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7766 | { |
| 7767 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, |
| 7768 | REASON_SCAN_HOME_TIME_CHANGED); |
| 7769 | } |
| 7770 | #endif |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7771 | |
| 7772 | return status ; |
| 7773 | } |
| 7774 | |
| 7775 | /* --------------------------------------------------------------------------- |
| 7776 | \fn sme_getNeighborScanPeriod |
| 7777 | \brief get neighbor scan period |
| 7778 | \param hHal - The handle returned by macOpen. |
| 7779 | \return v_U16_t - neighbor scan period |
| 7780 | -------------------------------------------------------------------------*/ |
| 7781 | v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal) |
| 7782 | { |
| 7783 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7784 | return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod; |
| 7785 | } |
| 7786 | |
| 7787 | #endif |
| 7788 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7789 | #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] | 7790 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7791 | /*-------------------------------------------------------------------------- |
| 7792 | \brief sme_getRoamRssiDiff() - get Roam rssi diff |
| 7793 | This is a synchronous call |
| 7794 | \param hHal - The handle returned by macOpen. |
| 7795 | \return v_U16_t - Rssi diff value |
| 7796 | \sa |
| 7797 | --------------------------------------------------------------------------*/ |
| 7798 | v_U8_t sme_getRoamRssiDiff(tHalHandle hHal) |
| 7799 | { |
| 7800 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7801 | return pMac->roam.configParam.RoamRssiDiff; |
| 7802 | } |
| 7803 | |
| 7804 | /*-------------------------------------------------------------------------- |
| 7805 | \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list |
| 7806 | This is a synchronous call |
| 7807 | \param hHal - The handle returned by macOpen. |
| 7808 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7809 | Other status means SME is failed to update |
| 7810 | \sa |
| 7811 | --------------------------------------------------------------------------*/ |
| 7812 | eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList, |
| 7813 | tANI_U8 numChannels) |
| 7814 | { |
| 7815 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7816 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7817 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7818 | tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0}; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7819 | tANI_U8 newChannelList[128] = {0}; |
| 7820 | tANI_U8 i = 0, j = 0; |
| 7821 | |
| 7822 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7823 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7824 | { |
| 7825 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 7826 | { |
| 7827 | for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++) |
| 7828 | { |
| 7829 | j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d", |
| 7830 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]); |
| 7831 | } |
| 7832 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7833 | csrFlushBgScanRoamChannelList(pMac); |
| 7834 | csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7835 | status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal)); |
| 7836 | |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7837 | if ( HAL_STATUS_SUCCESS( status )) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7838 | { |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7839 | sme_SetRoamScanControl(hHal, 1); |
| 7840 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7841 | { |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7842 | j = 0; |
| 7843 | for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++) |
| 7844 | { |
| 7845 | j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d", |
| 7846 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]); |
| 7847 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7848 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7849 | |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7850 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7851 | "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d", |
| 7852 | newChannelList, oldChannelList, |
| 7853 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7854 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7855 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7856 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 7857 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7858 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7859 | { |
| 7860 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED); |
| 7861 | } |
| 7862 | #endif |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7863 | |
| 7864 | return status ; |
| 7865 | } |
| 7866 | |
| 7867 | /*-------------------------------------------------------------------------- |
| 7868 | \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list |
| 7869 | based on country revision number |
| 7870 | This is a synchronous call |
| 7871 | \param hHal - The handle returned by macOpen. |
| 7872 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7873 | Other status means SME is failed to update |
| 7874 | \sa |
| 7875 | --------------------------------------------------------------------------*/ |
| 7876 | eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal, |
| 7877 | tANI_U8 Revision) |
| 7878 | { |
| 7879 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7880 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7881 | |
| 7882 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7883 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7884 | { |
| 7885 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 7886 | "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d", |
| 7887 | "KR", Revision, "KR", |
| 7888 | pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision, |
| 7889 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 7890 | csr_SetRevision(pMac, Revision); |
| 7891 | csrInitCountryValidChannelList(pMac, Revision); |
| 7892 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7893 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 7894 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 7895 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 7896 | { |
| 7897 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_VALID_CHANNEL_LIST_CHANGED); |
| 7898 | } |
| 7899 | #endif |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7900 | |
| 7901 | return status ; |
| 7902 | } |
| 7903 | |
| 7904 | |
| 7905 | /*-------------------------------------------------------------------------- |
| 7906 | \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache |
| 7907 | This is a synchronous call |
| 7908 | \param hHal - The handle returned by macOpen. |
| 7909 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7910 | Other status means SME is failed to update |
| 7911 | \sa |
| 7912 | --------------------------------------------------------------------------*/ |
| 7913 | eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal, |
| 7914 | eCsrBand eBand) |
| 7915 | { |
| 7916 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7917 | return csrUpdateBgScanConfigIniChannelList(pMac, eBand); |
| 7918 | } |
| 7919 | |
| 7920 | /*-------------------------------------------------------------------------- |
| 7921 | \brief sme_getRoamScanChannelList() - get roam scan channel list |
| 7922 | This is a synchronous call |
| 7923 | \param hHal - The handle returned by macOpen. |
| 7924 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7925 | Other status means SME is failed to update |
| 7926 | \sa |
| 7927 | --------------------------------------------------------------------------*/ |
| 7928 | eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList, |
| 7929 | tANI_U8 *pNumChannels) |
| 7930 | { |
| 7931 | int i = 0; |
| 7932 | tANI_U8 *pOutPtr = pChannelList; |
| 7933 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7934 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7935 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7936 | |
| 7937 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 7938 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 7939 | { |
| 7940 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 7941 | { |
| 7942 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 7943 | "Roam Scan channel list is NOT yet initialized"); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7944 | *pNumChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7945 | sme_ReleaseGlobalLock( &pMac->sme ); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7946 | return status; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7947 | } |
| 7948 | |
| 7949 | *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 7950 | for (i = 0; i < (*pNumChannels); i++) |
| 7951 | { |
| 7952 | pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]; |
| 7953 | } |
| 7954 | pOutPtr[i] = '\0'; |
| 7955 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 7956 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7957 | return status ; |
| 7958 | } |
| 7959 | |
| 7960 | /*-------------------------------------------------------------------------- |
| 7961 | \brief sme_GetCountryRevision() - get Country revision index |
| 7962 | This is a synchronous call |
| 7963 | \param hHal - The handle returned by macOpen. |
| 7964 | \return eHAL_STATUS_SUCCESS - SME update config successful. |
| 7965 | Other status means SME is failed to update |
| 7966 | \sa |
| 7967 | --------------------------------------------------------------------------*/ |
| 7968 | eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision) |
| 7969 | { |
| 7970 | /* this is valid for Country KR only now */ |
| 7971 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 7972 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7973 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7974 | |
| 7975 | *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision; |
| 7976 | |
| 7977 | return status; |
| 7978 | } |
| 7979 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7980 | /*-------------------------------------------------------------------------- |
| 7981 | \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not |
| 7982 | This is a synchronuous call |
| 7983 | \param hHal - The handle returned by macOpen. |
| 7984 | \return TRUE (1) - if the CCX feature is enabled |
| 7985 | FALSE (0) - if feature is disabled (compile or runtime) |
| 7986 | \sa |
| 7987 | --------------------------------------------------------------------------*/ |
| 7988 | tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7989 | { |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7990 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7991 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7992 | return pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 7993 | #else |
| 7994 | return eANI_BOOLEAN_FALSE; |
| 7995 | #endif |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 7996 | } |
| 7997 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 7998 | /*-------------------------------------------------------------------------- |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 7999 | \brief sme_GetWESMode() - get WES Mode |
| 8000 | This is a synchronous call |
| 8001 | \param hHal - The handle returned by macOpen |
| 8002 | \return v_U8_t - WES Mode Enabled(1)/Disabled(0) |
| 8003 | \sa |
| 8004 | --------------------------------------------------------------------------*/ |
| 8005 | v_BOOL_t sme_GetWESMode(tHalHandle hHal) |
| 8006 | { |
| 8007 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 8008 | return pMac->roam.configParam.isWESModeEnabled; |
| 8009 | } |
| 8010 | |
| 8011 | /*-------------------------------------------------------------------------- |
| 8012 | \brief sme_GetRoamScanControl() - get scan control |
| 8013 | This is a synchronous call |
| 8014 | \param hHal - The handle returned by macOpen. |
| 8015 | \return v_BOOL_t - Enabled(1)/Disabled(0) |
| 8016 | \sa |
| 8017 | --------------------------------------------------------------------------*/ |
| 8018 | v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal) |
| 8019 | { |
| 8020 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 8021 | return pMac->roam.configParam.nRoamScanControl; |
| 8022 | } |
| 8023 | #endif |
| 8024 | |
| 8025 | /*-------------------------------------------------------------------------- |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8026 | \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not |
| 8027 | This is a synchronuous call |
| 8028 | \param hHal - The handle returned by macOpen. |
| 8029 | \return TRUE (1) - if the feature is enabled |
| 8030 | FALSE (0) - if feature is disabled (compile or runtime) |
| 8031 | \sa |
| 8032 | --------------------------------------------------------------------------*/ |
| 8033 | tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal) |
| 8034 | { |
| 8035 | #ifdef FEATURE_WLAN_LFR |
| 8036 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 8037 | return pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 8038 | #else |
| 8039 | return eANI_BOOLEAN_FALSE; |
| 8040 | #endif |
| 8041 | } |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 8042 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 8043 | /*-------------------------------------------------------------------------- |
| 8044 | \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not |
| 8045 | This is a synchronuous call |
| 8046 | \param hHal - The handle returned by macOpen. |
| 8047 | \return TRUE (1) - if the feature is enabled |
| 8048 | FALSE (0) - if feature is disabled (compile or runtime) |
| 8049 | \sa |
| 8050 | --------------------------------------------------------------------------*/ |
| 8051 | tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal) |
| 8052 | { |
| 8053 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8054 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 8055 | return pMac->roam.configParam.isFastTransitionEnabled; |
| 8056 | #else |
| 8057 | return eANI_BOOLEAN_FALSE; |
| 8058 | #endif |
| 8059 | } |
| 8060 | |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 8061 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8062 | /* --------------------------------------------------------------------------- |
| 8063 | \fn sme_IsFeatureSupportedByFW |
| 8064 | \brief Check if an feature is enabled by FW |
| 8065 | |
| 8066 | \param feattEnumValue - Enumeration value from placeHolderInCapBitmap |
| 8067 | \- return 1/0 (TRUE/FALSE) |
| 8068 | -------------------------------------------------------------------------*/ |
| 8069 | tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue) |
| 8070 | { |
| 8071 | return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue); |
| 8072 | } |
| 8073 | #ifdef FEATURE_WLAN_TDLS |
| 8074 | /* --------------------------------------------------------------------------- |
| 8075 | \fn sme_SendTdlsMgmtFrame |
| 8076 | \brief API to send TDLS management frames. |
| 8077 | |
| 8078 | \param peerMac - peer's Mac Adress. |
| 8079 | \param frame_type - Type of TDLS mgmt frame to be sent. |
| 8080 | \param dialog - dialog token used in the frame. |
| 8081 | \param status - status to be incuded in the frame. |
| 8082 | \param buf - additional IEs to be included |
| 8083 | \param len - lenght of additional Ies |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8084 | \param responder - Tdls request type |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8085 | \- return VOS_STATUS_SUCCES |
| 8086 | -------------------------------------------------------------------------*/ |
| 8087 | VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8088 | 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] | 8089 | { |
| 8090 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8091 | tCsrTdlsSendMgmt sendTdlsReq = {{0}} ; |
| 8092 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8093 | |
| 8094 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 8095 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 8096 | { |
| 8097 | vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 8098 | sendTdlsReq.frameType = frame_type; |
| 8099 | sendTdlsReq.buf = buf; |
| 8100 | sendTdlsReq.len = len; |
| 8101 | sendTdlsReq.dialog = dialog; |
| 8102 | sendTdlsReq.statusCode = statusCode; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 8103 | sendTdlsReq.responder = responder; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8104 | |
| 8105 | status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ; |
| 8106 | |
| 8107 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 8108 | } |
| 8109 | |
| 8110 | return status ; |
| 8111 | |
| 8112 | } |
| 8113 | /* --------------------------------------------------------------------------- |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8114 | \fn sme_ChangeTdlsPeerSta |
| 8115 | \brief API to Update TDLS peer sta parameters. |
| 8116 | |
| 8117 | \param peerMac - peer's Mac Adress. |
| 8118 | \param staParams - Peer Station Parameters |
| 8119 | \- return VOS_STATUS_SUCCES |
| 8120 | -------------------------------------------------------------------------*/ |
| 8121 | VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac, |
| 8122 | tCsrStaParams *pstaParams) |
| 8123 | { |
| 8124 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8125 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8126 | |
| 8127 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 8128 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 8129 | { |
| 8130 | status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams); |
| 8131 | |
| 8132 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 8133 | } |
| 8134 | |
| 8135 | return status ; |
| 8136 | |
| 8137 | } |
| 8138 | |
| 8139 | /* --------------------------------------------------------------------------- |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8140 | \fn sme_AddTdlsPeerSta |
| 8141 | \brief API to Add TDLS peer sta entry. |
| 8142 | |
| 8143 | \param peerMac - peer's Mac Adress. |
| 8144 | \- return VOS_STATUS_SUCCES |
| 8145 | -------------------------------------------------------------------------*/ |
| 8146 | VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 8147 | { |
| 8148 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8149 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8150 | |
| 8151 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 8152 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 8153 | { |
| 8154 | status = csrTdlsAddPeerSta(hHal, sessionId, peerMac); |
| 8155 | |
| 8156 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 8157 | } |
| 8158 | |
| 8159 | return status ; |
| 8160 | |
| 8161 | } |
| 8162 | /* --------------------------------------------------------------------------- |
| 8163 | \fn sme_DeleteTdlsPeerSta |
| 8164 | \brief API to Delete TDLS peer sta entry. |
| 8165 | |
| 8166 | \param peerMac - peer's Mac Adress. |
| 8167 | \- return VOS_STATUS_SUCCES |
| 8168 | -------------------------------------------------------------------------*/ |
| 8169 | VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 8170 | { |
| 8171 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8172 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8173 | |
| 8174 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 8175 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 8176 | { |
| 8177 | status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ; |
| 8178 | |
| 8179 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 8180 | } |
| 8181 | |
| 8182 | return status ; |
| 8183 | |
| 8184 | } |
Gopichand Nakkala | 75e7b28 | 2013-03-15 18:37:13 -0700 | [diff] [blame] | 8185 | /* --------------------------------------------------------------------------- |
| 8186 | \fn sme_IsPmcBmps |
| 8187 | \API to Check if PMC state is BMPS. |
| 8188 | |
| 8189 | \- return v_BOOL_t |
| 8190 | -------------------------------------------------------------------------*/ |
| 8191 | v_BOOL_t sme_IsPmcBmps(tHalHandle hHal) |
| 8192 | { |
| 8193 | return (BMPS == pmcGetPmcState(hHal)); |
| 8194 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 8195 | /* --------------------------------------------------------------------------- |
| 8196 | \fn sme_SetTdlsPowerSaveProhibited |
| 8197 | \API to set/reset the isTdlsPowerSaveProhibited. |
| 8198 | |
| 8199 | \- return void |
| 8200 | -------------------------------------------------------------------------*/ |
| 8201 | void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val) |
| 8202 | { |
| 8203 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8204 | |
| 8205 | pMac->isTdlsPowerSaveProhibited = val; |
| 8206 | return; |
| 8207 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8208 | #endif |
| 8209 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 8210 | /* |
| 8211 | * SME API to start TDLS discovery Procedure |
| 8212 | */ |
| 8213 | VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 8214 | { |
| 8215 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 8216 | tCsrTdlsDisRequest disReq = {{0}} ; |
| 8217 | vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 8218 | status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ; |
| 8219 | |
| 8220 | return status ; |
| 8221 | |
| 8222 | } |
| 8223 | |
| 8224 | /* |
| 8225 | * Process TDLS discovery results |
| 8226 | */ |
| 8227 | v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal, |
| 8228 | tSmeTdlsDisResult *disResult, v_U8_t listType) |
| 8229 | { |
| 8230 | tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ; |
| 8231 | tSirTdlsPeerInfo *peerInfo = NULL ; |
| 8232 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 8233 | tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; |
| 8234 | tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ; |
| 8235 | tListElem *pEntry = NULL ; |
| 8236 | v_U8_t peerCnt = 0 ; |
| 8237 | |
| 8238 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 8239 | ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8240 | pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK ); |
| 8241 | while(pEntry) |
| 8242 | { |
| 8243 | peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo, |
| 8244 | tdlsPeerStaLink) ; |
| 8245 | peerInfo = &peerLinkInfo->tdlsDisPeerInfo ; |
| 8246 | |
| 8247 | switch(listType) |
| 8248 | { |
| 8249 | case TDLS_SETUP_LIST: |
| 8250 | { |
| 8251 | if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState) |
| 8252 | { |
| 8253 | palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac, |
| 8254 | peerInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 8255 | disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ; |
| 8256 | peerCnt++ ; |
| 8257 | } |
| 8258 | break ; |
| 8259 | } |
| 8260 | case TDLS_DIS_LIST: |
| 8261 | { |
| 8262 | palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac, |
| 8263 | peerInfo->peerMac, sizeof(tSirMacAddr)) ; |
| 8264 | disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ; |
| 8265 | peerCnt++ ; |
| 8266 | break ; |
| 8267 | } |
| 8268 | default: |
| 8269 | { |
| 8270 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 691dde1 | 2013-03-06 17:00:31 -0800 | [diff] [blame] | 8271 | ("unknown list type ")) ; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8272 | break ; |
| 8273 | } |
| 8274 | } |
| 8275 | |
| 8276 | pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ; |
| 8277 | } |
| 8278 | |
| 8279 | return peerCnt ; |
| 8280 | |
| 8281 | } |
| 8282 | |
| 8283 | /* |
| 8284 | * SME API to start TDLS link setup Procedure. |
| 8285 | */ |
| 8286 | VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 8287 | { |
| 8288 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 8289 | tCsrTdlsSetupRequest setupReq = {{0}} ; |
| 8290 | vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 8291 | status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ; |
| 8292 | return status ; |
| 8293 | |
| 8294 | } |
| 8295 | |
| 8296 | /* |
| 8297 | * SME API to start TDLS link Teardown Procedure. |
| 8298 | */ |
| 8299 | VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac) |
| 8300 | { |
| 8301 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 8302 | tCsrTdlsTeardownRequest teardownReq = {{0}} ; |
| 8303 | vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ; |
| 8304 | status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ; |
| 8305 | return status ; |
| 8306 | |
| 8307 | } |
| 8308 | |
| 8309 | #endif /* FEATURE_WLAN_TDLS */ |
| 8310 | |
Tushnim Bhattacharyya | 9cdf608 | 2013-04-21 16:33:30 -0700 | [diff] [blame] | 8311 | eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan) |
| 8312 | { |
| 8313 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 8314 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 8315 | |
| 8316 | smsLog(pMac, LOG2, FL("enter")); |
| 8317 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 8318 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 8319 | { |
| 8320 | pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan; |
| 8321 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 8322 | } |
| 8323 | smsLog(pMac, LOG2, FL("exit status %d"), status); |
| 8324 | |
| 8325 | return (status); |
| 8326 | } |
| 8327 | |
Gopichand Nakkala | e620d5a | 2013-04-26 05:45:57 -0700 | [diff] [blame] | 8328 | /* |
| 8329 | * SME API to enable/disable WLAN driver initiated SSR |
| 8330 | */ |
| 8331 | void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR) |
| 8332 | { |
| 8333 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8334 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8335 | |
| 8336 | status = sme_AcquireGlobalLock(&pMac->sme); |
| 8337 | if (HAL_STATUS_SUCCESS(status)) |
| 8338 | { |
| 8339 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 8340 | "SSR level is changed %d", enableSSR); |
| 8341 | /* not serializing this messsage, as this is only going |
| 8342 | * to set a variable in WDA/WDI |
| 8343 | */ |
| 8344 | WDA_SetEnableSSR(enableSSR); |
| 8345 | sme_ReleaseGlobalLock(&pMac->sme); |
| 8346 | } |
| 8347 | return; |
| 8348 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 8349 | |
| 8350 | /* |
| 8351 | * SME API to determine the channel bonding mode |
| 8352 | */ |
| 8353 | VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel) |
| 8354 | { |
| 8355 | tSmeConfigParams smeConfig; |
| 8356 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 8357 | |
| 8358 | if ( |
| 8359 | #ifdef WLAN_FEATURE_11AC |
| 8360 | eCSR_DOT11_MODE_11ac != eCsrPhyMode && |
| 8361 | eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode && |
| 8362 | #endif |
| 8363 | eCSR_DOT11_MODE_11n != eCsrPhyMode && |
| 8364 | eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode |
| 8365 | ) |
| 8366 | { |
| 8367 | return VOS_STATUS_SUCCESS; |
| 8368 | } |
| 8369 | |
| 8370 | /* If channel bonding mode is not required */ |
| 8371 | if ( !pMac->roam.configParam.channelBondingMode5GHz ) { |
| 8372 | return VOS_STATUS_SUCCESS; |
| 8373 | } |
| 8374 | |
| 8375 | vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams)); |
| 8376 | sme_GetConfigParam(pMac, &smeConfig); |
| 8377 | |
| 8378 | #ifdef WLAN_FEATURE_11AC |
| 8379 | if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode || |
| 8380 | eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode ) |
| 8381 | { |
| 8382 | if ( channel== 36 || channel == 52 || channel == 100 || |
| 8383 | channel == 116 || channel == 149 ) |
| 8384 | { |
| 8385 | smeConfig.csrConfig.channelBondingMode5GHz = |
| 8386 | PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1; |
| 8387 | } |
| 8388 | else if ( channel == 40 || channel == 56 || channel == 104 || |
| 8389 | channel == 120 || channel == 153 ) |
| 8390 | { |
| 8391 | smeConfig.csrConfig.channelBondingMode5GHz = |
| 8392 | PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1; |
| 8393 | } |
| 8394 | else if ( channel == 44 || channel == 60 || channel == 108 || |
| 8395 | channel == 124 || channel == 157 ) |
| 8396 | { |
| 8397 | smeConfig.csrConfig.channelBondingMode5GHz = |
| 8398 | PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1; |
| 8399 | } |
| 8400 | else if ( channel == 48 || channel == 64 || channel == 112 || |
| 8401 | channel == 128 || channel == 161 ) |
| 8402 | { |
| 8403 | smeConfig.csrConfig.channelBondingMode5GHz = |
| 8404 | PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1; |
| 8405 | } |
| 8406 | else if ( channel == 165 ) |
| 8407 | { |
| 8408 | smeConfig.csrConfig.channelBondingMode5GHz = 0; |
| 8409 | } |
| 8410 | } |
| 8411 | #endif |
| 8412 | |
| 8413 | if ( eCSR_DOT11_MODE_11n == eCsrPhyMode || |
| 8414 | eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode ) |
| 8415 | { |
| 8416 | if ( channel== 40 || channel == 48 || channel == 56 || |
| 8417 | channel == 64 || channel == 104 || channel == 112 || |
| 8418 | channel == 120 || channel == 128 || channel == 136 || |
| 8419 | channel == 144 || channel == 153 || channel == 161 ) |
| 8420 | { |
| 8421 | smeConfig.csrConfig.channelBondingMode5GHz = 1; |
| 8422 | } |
| 8423 | else if ( channel== 36 || channel == 44 || channel == 52 || |
| 8424 | channel == 60 || channel == 100 || channel == 108 || |
| 8425 | channel == 116 || channel == 124 || channel == 132 || |
| 8426 | channel == 140 || channel == 149 || channel == 157 ) |
| 8427 | { |
| 8428 | smeConfig.csrConfig.channelBondingMode5GHz = 2; |
| 8429 | } |
| 8430 | else if ( channel == 165 ) |
| 8431 | { |
| 8432 | smeConfig.csrConfig.channelBondingMode5GHz = 0; |
| 8433 | } |
| 8434 | } |
| 8435 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 8436 | "cbmode selected=%ld\n", smeConfig.csrConfig.channelBondingMode5GHz); |
| 8437 | |
| 8438 | sme_UpdateConfig (pMac, &smeConfig); |
| 8439 | return VOS_STATUS_SUCCESS; |
| 8440 | } |
| 8441 | |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 8442 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 8443 | /*-------------------------------------------------------------------------- |
| 8444 | \brief sme_HandoffRequest() - a wrapper function to Request a handoff |
| 8445 | from CSR. |
| 8446 | This is a synchronous call |
| 8447 | \param hHal - The handle returned by macOpen |
| 8448 | \param pHandoffInfo - info provided by HDD with the handoff request (namely: |
| 8449 | BSSID, channel etc.) |
| 8450 | \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully. |
| 8451 | Other status means SME is failed to send the request. |
| 8452 | \sa |
| 8453 | --------------------------------------------------------------------------*/ |
| 8454 | |
| 8455 | eHalStatus sme_HandoffRequest(tHalHandle hHal, |
| 8456 | tCsrHandoffRequest *pHandoffInfo) |
| 8457 | { |
| 8458 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 8459 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8460 | |
| 8461 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 8462 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 8463 | { |
| 8464 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 8465 | "%s: invoked", __func__); |
| 8466 | status = csrHandoffRequest(pMac, pHandoffInfo); |
| 8467 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 8468 | } |
| 8469 | |
| 8470 | return status ; |
| 8471 | } |
| 8472 | #endif |
| 8473 | |