Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 24 | * This file limUtils.cc contains the utility functions |
| 25 | * LIM uses. |
| 26 | * Author: Chandra Modumudi |
| 27 | * Date: 02/13/02 |
| 28 | * History:- |
| 29 | * Date Modified by Modification Information |
| 30 | * -------------------------------------------------------------------- |
| 31 | */ |
| 32 | |
| 33 | #include "schApi.h" |
| 34 | #include "limUtils.h" |
| 35 | #include "limTypes.h" |
| 36 | #include "limSecurityUtils.h" |
| 37 | #include "limPropExtsUtils.h" |
| 38 | #include "limSendMessages.h" |
| 39 | #include "limSerDesUtils.h" |
| 40 | #include "limAdmitControl.h" |
| 41 | #include "limStaHashApi.h" |
| 42 | #include "dot11f.h" |
| 43 | #include "wmmApsd.h" |
| 44 | #include "limTrace.h" |
| 45 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 46 | #include "vos_diag_core_event.h" |
| 47 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 48 | #include "limIbssPeerMgmt.h" |
| 49 | #include "limSessionUtils.h" |
| 50 | #include "limSession.h" |
| 51 | #include "vos_nvitem.h" |
| 52 | |
| 53 | /* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET |
| 54 | * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data |
| 55 | * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have |
| 56 | * this information. */ |
| 57 | static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE; |
| 58 | |
| 59 | /* 11A Channel list to decode RX BD channel information */ |
| 60 | static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116, |
| 61 | 120,124,128,132,136,140,149,153,157,161,165}; |
| 62 | |
| 63 | //#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT |
| 64 | #define SUCCESS 1 //defined temporarily for BT-AMP |
| 65 | |
| 66 | /** ------------------------------------------------------------- |
| 67 | \fn limAssignDialogueToken |
| 68 | \brief Assigns dialogue token. |
| 69 | \param tpAniSirGlobal pMac |
| 70 | \return tpDialogueToken - dialogueToken data structure. |
| 71 | -------------------------------------------------------------*/ |
| 72 | |
| 73 | tpDialogueToken |
| 74 | limAssignDialogueToken(tpAniSirGlobal pMac) |
| 75 | { |
| 76 | static tANI_U8 token = 0; |
| 77 | tpDialogueToken pCurrNode; |
| 78 | if(eHAL_STATUS_SUCCESS != |
| 79 | palAllocateMemory(pMac->hHdd, (void **) &pCurrNode, sizeof(tDialogueToken))) |
| 80 | { |
| 81 | PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed\n"));) |
| 82 | return NULL; |
| 83 | } |
| 84 | |
| 85 | palZeroMemory(pMac->hHdd, (void *) pCurrNode, sizeof(tDialogueToken)); |
| 86 | //first node in the list is being added. |
| 87 | if(NULL == pMac->lim.pDialogueTokenHead) |
| 88 | { |
| 89 | pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode; |
| 90 | } |
| 91 | else |
| 92 | { |
| 93 | pMac->lim.pDialogueTokenTail->next = pCurrNode; |
| 94 | pMac->lim.pDialogueTokenTail = pCurrNode; |
| 95 | } |
| 96 | //assocId and tid of the node will be filled in by caller. |
| 97 | pCurrNode->next = NULL; |
| 98 | pCurrNode->token = token++; |
| 99 | PELOG4(limLog(pMac, LOG4, FL("token assigned = %d\n"), token);) |
| 100 | return pCurrNode; |
| 101 | } |
| 102 | |
| 103 | /** ------------------------------------------------------------- |
| 104 | \fn limSearchAndDeleteDialogueToken |
| 105 | \brief search dialogue token in the list and deletes it if found. returns failure if not found. |
| 106 | \param tpAniSirGlobal pMac |
| 107 | \param tANI_U8 token |
| 108 | \param tANI_U16 assocId |
| 109 | \param tANI_U16 tid |
| 110 | \return eSirRetStatus - status of the search |
| 111 | -------------------------------------------------------------*/ |
| 112 | |
| 113 | |
| 114 | tSirRetStatus |
| 115 | limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid) |
| 116 | { |
| 117 | tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead; |
| 118 | tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead; |
| 119 | |
| 120 | //if the list is empty |
| 121 | if(NULL == pCurrNode) |
| 122 | return eSIR_FAILURE; |
| 123 | |
| 124 | // if the matching node is the first node. |
| 125 | if(pCurrNode && |
| 126 | (assocId == pCurrNode->assocId) && |
| 127 | (tid == pCurrNode->tid)) |
| 128 | { |
| 129 | pMac->lim.pDialogueTokenHead = pCurrNode->next; |
| 130 | //there was only one node in the list. So tail pointer also needs to be adjusted. |
| 131 | if(NULL == pMac->lim.pDialogueTokenHead) |
| 132 | pMac->lim.pDialogueTokenTail = NULL; |
| 133 | palFreeMemory(pMac->hHdd, (void *) pCurrNode); |
| 134 | return eSIR_SUCCESS; |
| 135 | } |
| 136 | |
| 137 | //first node did not match. so move to the next one. |
| 138 | pCurrNode = pCurrNode->next; |
| 139 | while(NULL != pCurrNode ) |
| 140 | { |
| 141 | if(token == pCurrNode->token) |
| 142 | { |
| 143 | break; |
| 144 | } |
| 145 | |
| 146 | pPrevNode = pCurrNode; |
| 147 | pCurrNode = pCurrNode->next; |
| 148 | } |
| 149 | |
| 150 | if(pCurrNode && |
| 151 | (assocId == pCurrNode->assocId) && |
| 152 | (tid == pCurrNode->tid)) |
| 153 | { |
| 154 | pPrevNode->next = pCurrNode->next; |
| 155 | //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode. |
| 156 | if(NULL == pCurrNode->next) |
| 157 | pMac->lim.pDialogueTokenTail = pPrevNode; |
| 158 | return eSIR_SUCCESS; |
| 159 | } |
| 160 | |
| 161 | PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node\n"));) |
| 162 | return eSIR_FAILURE; |
| 163 | |
| 164 | } |
| 165 | |
| 166 | |
| 167 | /** ------------------------------------------------------------- |
| 168 | \fn limDeleteDialogueTokenList |
| 169 | \brief deletes the complete lim dialogue token linked list. |
| 170 | \param tpAniSirGlobal pMac |
| 171 | \return None |
| 172 | -------------------------------------------------------------*/ |
| 173 | void |
| 174 | limDeleteDialogueTokenList(tpAniSirGlobal pMac) |
| 175 | { |
| 176 | tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead; |
| 177 | |
| 178 | while(NULL != pMac->lim.pDialogueTokenHead) |
| 179 | { |
| 180 | pCurrNode = pMac->lim.pDialogueTokenHead; |
| 181 | pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next; |
| 182 | palFreeMemory(pMac->hHdd, (void *) pCurrNode); |
| 183 | pCurrNode = NULL; |
| 184 | } |
| 185 | pMac->lim.pDialogueTokenTail = NULL; |
| 186 | } |
| 187 | |
| 188 | void |
| 189 | limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore) |
| 190 | { |
| 191 | tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo); |
| 192 | *pIgnore = 0; |
| 193 | |
| 194 | if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0) |
| 195 | { |
| 196 | palCopyMemory( pMac->hHdd, bssId, pMh->addr1, 6); |
| 197 | *pIgnore = 1; |
| 198 | } |
| 199 | else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1) |
| 200 | { |
| 201 | palCopyMemory( pMac->hHdd, bssId, pMh->addr2, 6); |
| 202 | *pIgnore = 1; |
| 203 | } |
| 204 | else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0) |
| 205 | { |
| 206 | palCopyMemory( pMac->hHdd, bssId, pMh->addr3, 6); |
| 207 | *pIgnore = 0; |
| 208 | } |
| 209 | else |
| 210 | { |
| 211 | palCopyMemory( pMac->hHdd, bssId, pMh->addr1, 6); |
| 212 | *pIgnore = 1; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | char * |
| 217 | limMlmStateStr(tLimMlmStates state) |
| 218 | { |
| 219 | |
| 220 | #ifdef FIXME_GEN6 |
| 221 | switch (state) |
| 222 | { |
| 223 | case eLIM_MLM_OFFLINE_STATE: |
| 224 | return "eLIM_MLM_OFFLINE_STATE\n"; |
| 225 | case eLIM_MLM_IDLE_STATE: |
| 226 | return "eLIM_MLM_IDLE_STATE\n"; |
| 227 | case eLIM_MLM_WT_PROBE_RESP_STATE: |
| 228 | return "eLIM_MLM_WT_PROBE_RESP_STATE\n"; |
| 229 | case eLIM_MLM_PASSIVE_SCAN_STATE: |
| 230 | return "eLIM_MLM_PASSIVE_SCAN_STATE\n"; |
| 231 | case eLIM_MLM_WT_JOIN_BEACON_STATE: |
| 232 | return "eLIM_MLM_WT_JOIN_BEACON_STATE\n"; |
| 233 | case eLIM_MLM_JOINED_STATE: |
| 234 | return "eLIM_MLM_JOINED_STATE\n"; |
| 235 | case eLIM_MLM_BSS_STARTED_STATE: |
| 236 | return "eLIM_MLM_BSS_STARTED_STATE\n"; |
| 237 | case eLIM_MLM_WT_AUTH_FRAME2_STATE: |
| 238 | return "eLIM_MLM_WT_AUTH_FRAME2_STATE\n"; |
| 239 | case eLIM_MLM_WT_AUTH_FRAME3_STATE: |
| 240 | return "eLIM_MLM_WT_AUTH_FRAME3_STATE\n"; |
| 241 | case eLIM_MLM_WT_AUTH_FRAME4_STATE: |
| 242 | return "eLIM_MLM_WT_AUTH_FRAME4_STATE\n"; |
| 243 | case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE: |
| 244 | return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE\n"; |
| 245 | case eLIM_MLM_AUTHENTICATED_STATE: |
| 246 | return "eLIM_MLM_AUTHENTICATED_STATE\n"; |
| 247 | case eLIM_MLM_WT_ASSOC_RSP_STATE: |
| 248 | return "eLIM_MLM_WT_ASSOC_RSP_STATE\n"; |
| 249 | case eLIM_MLM_WT_REASSOC_RSP_STATE: |
| 250 | return "eLIM_MLM_WT_REASSOC_RSP_STATE\n"; |
| 251 | case eLIM_MLM_WT_FT_REASSOC_RSP_STATE: |
| 252 | return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE"; |
| 253 | case eLIM_MLM_WT_DEL_STA_RSP_STATE: |
| 254 | return "eLIM_MLM_WT_DEL_STA_RSP_STATE\n"; |
| 255 | case eLIM_MLM_WT_DEL_BSS_RSP_STATE: |
| 256 | return "eLIM_MLM_WT_DEL_BSS_RSP_STATE\n"; |
| 257 | case eLIM_MLM_WT_ADD_STA_RSP_STATE: |
| 258 | return "eLIM_MLM_WT_ADD_STA_RSP_STATE\n"; |
| 259 | case eLIM_MLM_WT_ADD_BSS_RSP_STATE: |
| 260 | return "eLIM_MLM_WT_ADD_BSS_RSP_STATE\n"; |
| 261 | case eLIM_MLM_REASSOCIATED_STATE: |
| 262 | return "eLIM_MLM_REASSOCIATED_STATE\n"; |
| 263 | case eLIM_MLM_LINK_ESTABLISHED_STATE: |
| 264 | return "eLIM_MLM_LINK_ESTABLISHED_STATE\n"; |
| 265 | case eLIM_MLM_WT_ASSOC_CNF_STATE: |
| 266 | return "eLIM_MLM_WT_ASSOC_CNF_STATE\n"; |
| 267 | case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE: |
| 268 | return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE\n"; |
| 269 | case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE: |
| 270 | return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE\n"; |
| 271 | case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE: |
| 272 | return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE"; |
| 273 | case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE: |
| 274 | return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE\n"; |
| 275 | case eLIM_MLM_WT_SET_BSS_KEY_STATE: |
| 276 | return "eLIM_MLM_WT_SET_BSS_KEY_STATE\n"; |
| 277 | case eLIM_MLM_WT_SET_STA_KEY_STATE: |
| 278 | return "eLIM_MLM_WT_SET_STA_KEY_STATE\n"; |
| 279 | default: |
| 280 | return "INVALID MLM state\n"; |
| 281 | } |
| 282 | #endif |
| 283 | return ""; |
| 284 | } |
| 285 | |
| 286 | void |
| 287 | limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state) |
| 288 | { |
| 289 | limLog(pMac, logLevel, limMlmStateStr(state)); |
| 290 | } |
| 291 | |
| 292 | char * |
| 293 | limSmeStateStr(tLimSmeStates state) |
| 294 | { |
| 295 | #ifdef FIXME_GEN6 |
| 296 | switch (state) |
| 297 | { |
| 298 | case eLIM_SME_OFFLINE_STATE: |
| 299 | return "eLIM_SME_OFFLINE_STATE\n"; |
| 300 | case eLIM_SME_IDLE_STATE: |
| 301 | return "eLIM_SME_IDLE_STATE\n"; |
| 302 | case eLIM_SME_SUSPEND_STATE: |
| 303 | return "eLIM_SME_SUSPEND_STATE\n"; |
| 304 | case eLIM_SME_WT_SCAN_STATE: |
| 305 | return "eLIM_SME_WT_SCAN_STATE\n"; |
| 306 | case eLIM_SME_WT_JOIN_STATE: |
| 307 | return "eLIM_SME_WT_JOIN_STATE\n"; |
| 308 | case eLIM_SME_WT_AUTH_STATE: |
| 309 | return "eLIM_SME_WT_AUTH_STATE\n"; |
| 310 | case eLIM_SME_WT_ASSOC_STATE: |
| 311 | return "eLIM_SME_WT_ASSOC_STATE\n"; |
| 312 | case eLIM_SME_WT_REASSOC_STATE: |
| 313 | return "eLIM_SME_WT_REASSOC_STATE\n"; |
| 314 | case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: |
| 315 | return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE\n"; |
| 316 | case eLIM_SME_JOIN_FAILURE_STATE: |
| 317 | return "eLIM_SME_JOIN_FAILURE_STATE\n"; |
| 318 | case eLIM_SME_ASSOCIATED_STATE: |
| 319 | return "eLIM_SME_ASSOCIATED_STATE\n"; |
| 320 | case eLIM_SME_REASSOCIATED_STATE: |
| 321 | return "eLIM_SME_REASSOCIATED_STATE\n"; |
| 322 | case eLIM_SME_LINK_EST_STATE: |
| 323 | return "eLIM_SME_LINK_EST_STATE\n"; |
| 324 | case eLIM_SME_LINK_EST_WT_SCAN_STATE: |
| 325 | return "eLIM_SME_LINK_EST_WT_SCAN_STATE\n"; |
| 326 | case eLIM_SME_WT_PRE_AUTH_STATE: |
| 327 | return "eLIM_SME_WT_PRE_AUTH_STATE\n"; |
| 328 | case eLIM_SME_WT_DISASSOC_STATE: |
| 329 | return "eLIM_SME_WT_DISASSOC_STATE\n"; |
| 330 | case eLIM_SME_WT_DEAUTH_STATE: |
| 331 | return "eLIM_SME_WT_DEAUTH_STATE\n"; |
| 332 | case eLIM_SME_WT_START_BSS_STATE: |
| 333 | return "eLIM_SME_WT_START_BSS_STATE\n"; |
| 334 | case eLIM_SME_WT_STOP_BSS_STATE: |
| 335 | return "eLIM_SME_WT_STOP_BSS_STATE\n"; |
| 336 | case eLIM_SME_NORMAL_STATE: |
| 337 | return "eLIM_SME_NORMAL_STATE\n"; |
| 338 | case eLIM_SME_CHANNEL_SCAN_STATE: |
| 339 | return "eLIM_SME_CHANNEL_SCAN_STATE\n"; |
| 340 | case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: |
| 341 | return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE\n"; |
| 342 | default: |
| 343 | return "INVALID SME state\n"; |
| 344 | } |
| 345 | #endif |
| 346 | return ""; |
| 347 | } |
| 348 | |
| 349 | |
| 350 | char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode) |
| 351 | { |
| 352 | #ifdef FIXME_GEN6 |
| 353 | |
| 354 | switch(dot11Mode) |
| 355 | { |
| 356 | case WNI_CFG_DOT11_MODE_ALL: |
| 357 | return "ALL\n"; |
| 358 | case WNI_CFG_DOT11_MODE_11A: |
| 359 | return "11A\n"; |
| 360 | case WNI_CFG_DOT11_MODE_11B: |
| 361 | return "11B\n"; |
| 362 | case WNI_CFG_DOT11_MODE_11G: |
| 363 | return "11G\n"; |
| 364 | case WNI_CFG_DOT11_MODE_11N: |
| 365 | return "11N\n"; |
| 366 | case WNI_CFG_DOT11_MODE_POLARIS: |
| 367 | return "Polaris\n"; |
| 368 | case WNI_CFG_DOT11_MODE_TITAN: |
| 369 | return "Titan\n"; |
| 370 | case WNI_CFG_DOT11_MODE_TAURUS: |
| 371 | return "Taurus\n"; |
| 372 | default: |
| 373 | return "Invalid Dot11 Mode\n"; |
| 374 | } |
| 375 | #endif |
| 376 | return ""; |
| 377 | } |
| 378 | |
| 379 | |
| 380 | char* limStaOpRateModeStr(tStaRateMode opRateMode) |
| 381 | { |
| 382 | #ifdef FIXME_GEN6 |
| 383 | |
| 384 | switch(opRateMode) |
| 385 | { |
| 386 | case eSTA_TAURUS: |
| 387 | return "Taurus\n"; |
| 388 | case eSTA_11a: |
| 389 | return "11A\n"; |
| 390 | case eSTA_11b: |
| 391 | return "11B\n"; |
| 392 | case eSTA_11bg: |
| 393 | return "11G\n"; |
| 394 | case eSTA_11n: |
| 395 | return "11N\n"; |
| 396 | case eSTA_POLARIS: |
| 397 | return "Polaris\n"; |
| 398 | case eSTA_TITAN: |
| 399 | return "Titan\n"; |
| 400 | default: |
| 401 | return "Invalid Dot11 Mode\n"; |
| 402 | } |
| 403 | #endif |
| 404 | return ""; |
| 405 | } |
| 406 | |
| 407 | char* limBssTypeStr(tSirBssType bssType) |
| 408 | { |
| 409 | switch(bssType) |
| 410 | { |
| 411 | case eSIR_INFRASTRUCTURE_MODE: |
| 412 | return "eSIR_INFRASTRUCTURE_MODE"; |
| 413 | case eSIR_IBSS_MODE: |
| 414 | return "eSIR_IBSS_MODE"; |
| 415 | case eSIR_BTAMP_STA_MODE: |
| 416 | return "eSIR_BTAMP_STA_MODE"; |
| 417 | case eSIR_BTAMP_AP_MODE: |
| 418 | return "eSIR_BTAMP_AP_MODE"; |
| 419 | case eSIR_AUTO_MODE: |
| 420 | return "eSIR_AUTO_MODE"; |
| 421 | default: |
| 422 | return "Invalid BSS Type"; |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | void |
| 427 | limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state) |
| 428 | { |
| 429 | limLog(pMac, logLevel, limSmeStateStr(state)); |
| 430 | } |
| 431 | |
| 432 | char *limMsgStr(tANI_U32 msgType) |
| 433 | { |
| 434 | #ifdef FIXME_GEN6 |
| 435 | switch (msgType) |
| 436 | { |
| 437 | case eWNI_SME_START_REQ: |
| 438 | return "eWNI_SME_START_REQ\n"; |
| 439 | case eWNI_SME_START_RSP: |
| 440 | return "eWNI_SME_START_RSP\n"; |
| 441 | case eWNI_SME_SYS_READY_IND: |
| 442 | return "eWNI_SME_SYS_READY_IND\n"; |
| 443 | case eWNI_SME_SCAN_REQ: |
| 444 | return "eWNI_SME_SCAN_REQ\n"; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 445 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 446 | case eWNI_SME_OEM_DATA_REQ: |
| 447 | return "eWNI_SME_OEM_DATA_REQ\n"; |
| 448 | case eWNI_SME_OEM_DATA_RSP: |
| 449 | return "eWNI_SME_OEM_DATA_RSP\n"; |
| 450 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 451 | case eWNI_SME_SCAN_RSP: |
| 452 | return "eWNI_SME_SCAN_RSP\n"; |
| 453 | case eWNI_SME_JOIN_REQ: |
| 454 | return "eWNI_SME_JOIN_REQ\n"; |
| 455 | case eWNI_SME_JOIN_RSP: |
| 456 | return "eWNI_SME_JOIN_RSP\n"; |
| 457 | case eWNI_SME_SETCONTEXT_REQ: |
| 458 | return "eWNI_SME_SETCONTEXT_REQ\n"; |
| 459 | case eWNI_SME_SETCONTEXT_RSP: |
| 460 | return "eWNI_SME_SETCONTEXT_RSP\n"; |
| 461 | case eWNI_SME_REASSOC_REQ: |
| 462 | return "eWNI_SME_REASSOC_REQ\n"; |
| 463 | case eWNI_SME_REASSOC_RSP: |
| 464 | return "eWNI_SME_REASSOC_RSP\n"; |
| 465 | case eWNI_SME_AUTH_REQ: |
| 466 | return "eWNI_SME_AUTH_REQ\n"; |
| 467 | case eWNI_SME_AUTH_RSP: |
| 468 | return "eWNI_SME_AUTH_RSP\n"; |
| 469 | case eWNI_SME_DISASSOC_REQ: |
| 470 | return "eWNI_SME_DISASSOC_REQ\n"; |
| 471 | case eWNI_SME_DISASSOC_RSP: |
| 472 | return "eWNI_SME_DISASSOC_RSP\n"; |
| 473 | case eWNI_SME_DISASSOC_IND: |
| 474 | return "eWNI_SME_DISASSOC_IND\n"; |
| 475 | case eWNI_SME_DISASSOC_CNF: |
| 476 | return "eWNI_SME_DISASSOC_CNF\n"; |
| 477 | case eWNI_SME_DEAUTH_REQ: |
| 478 | return "eWNI_SME_DEAUTH_REQ\n"; |
| 479 | case eWNI_SME_DEAUTH_RSP: |
| 480 | return "eWNI_SME_DEAUTH_RSP\n"; |
| 481 | case eWNI_SME_DEAUTH_IND: |
| 482 | return "eWNI_SME_DEAUTH_IND\n"; |
| 483 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 484 | return "eWNI_SME_WM_STATUS_CHANGE_NTF\n"; |
| 485 | case eWNI_SME_START_BSS_REQ: |
| 486 | return "eWNI_SME_START_BSS_REQ\n"; |
| 487 | case eWNI_SME_START_BSS_RSP: |
| 488 | return "eWNI_SME_START_BSS_RSP\n"; |
| 489 | case eWNI_SME_AUTH_IND: |
| 490 | return "eWNI_SME_AUTH_IND\n"; |
| 491 | case eWNI_SME_ASSOC_IND: |
| 492 | return "eWNI_SME_ASSOC_IND\n"; |
| 493 | case eWNI_SME_ASSOC_CNF: |
| 494 | return "eWNI_SME_ASSOC_CNF\n"; |
| 495 | case eWNI_SME_REASSOC_IND: |
| 496 | return "eWNI_SME_REASSOC_IND\n"; |
| 497 | case eWNI_SME_REASSOC_CNF: |
| 498 | return "eWNI_SME_REASSOC_CNF\n"; |
| 499 | case eWNI_SME_SWITCH_CHL_REQ: |
| 500 | return "eWNI_SME_SWITCH_CHL_REQ\n"; |
| 501 | case eWNI_SME_SWITCH_CHL_RSP: |
| 502 | return "eWNI_SME_SWITCH_CHL_RSP\n"; |
| 503 | case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ: |
| 504 | return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ\n"; |
| 505 | case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ: |
| 506 | return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ\n"; |
| 507 | case eWNI_SME_STOP_BSS_REQ: |
| 508 | return "eWNI_SME_STOP_BSS_REQ\n"; |
| 509 | case eWNI_SME_STOP_BSS_RSP: |
| 510 | return "eWNI_SME_STOP_BSS_RSP\n"; |
| 511 | case eWNI_SME_PROMISCUOUS_MODE_REQ: |
| 512 | return "eWNI_SME_PROMISCUOUS_MODE_REQ\n"; |
| 513 | case eWNI_SME_PROMISCUOUS_MODE_RSP: |
| 514 | return "eWNI_SME_PROMISCUOUS_MODE_RSP\n"; |
| 515 | case eWNI_SME_NEIGHBOR_BSS_IND: |
| 516 | return "eWNI_SME_NEIGHBOR_BSS_IND\n"; |
| 517 | case eWNI_SME_MEASUREMENT_REQ: |
| 518 | return "eWNI_SME_MEASUREMENT_REQ\n"; |
| 519 | case eWNI_SME_MEASUREMENT_RSP: |
| 520 | return "eWNI_SME_MEASUREMENT_RSP\n"; |
| 521 | case eWNI_SME_MEASUREMENT_IND: |
| 522 | return "eWNI_SME_MEASUREMENT_IND\n"; |
| 523 | case eWNI_SME_SET_WDS_INFO_REQ: |
| 524 | return "eWNI_SME_SET_WDS_INFO_REQ\n"; |
| 525 | case eWNI_SME_SET_WDS_INFO_RSP: |
| 526 | return "eWNI_SME_SET_WDS_INFO_RSP\n"; |
| 527 | case eWNI_SME_WDS_INFO_IND: |
| 528 | return "eWNI_SME_WDS_INFO_IND\n"; |
| 529 | case eWNI_SME_DEAUTH_CNF: |
| 530 | return "eWNI_SME_DEAUTH_CNF\n"; |
| 531 | case eWNI_SME_MIC_FAILURE_IND: |
| 532 | return "eWNI_SME_MIC_FAILURE_IND\n"; |
| 533 | case eWNI_SME_ADDTS_REQ: |
| 534 | return "eWNI_SME_ADDTS_REQ\n"; |
| 535 | case eWNI_SME_ADDTS_RSP: |
| 536 | return "eWNI_SME_ADDTS_RSP\n"; |
| 537 | case eWNI_SME_ADDTS_CNF: |
| 538 | return "eWNI_SME_ADDTS_CNF\n"; |
| 539 | case eWNI_SME_ADDTS_IND: |
| 540 | return "eWNI_SME_ADDTS_IND\n"; |
| 541 | case eWNI_SME_DELTS_REQ: |
| 542 | return "eWNI_SME_DELTS_REQ\n"; |
| 543 | case eWNI_SME_DELTS_RSP: |
| 544 | return "eWNI_SME_DELTS_RSP\n"; |
| 545 | case eWNI_SME_DELTS_IND: |
| 546 | return "eWNI_SME_DELTS_IND\n"; |
| 547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | case WDA_SUSPEND_ACTIVITY_RSP: |
| 549 | return "WDA_SUSPEND_ACTIVITY_RSP\n"; |
| 550 | case SIR_LIM_RETRY_INTERRUPT_MSG: |
| 551 | return "SIR_LIM_RETRY_INTERRUPT_MSG\n"; |
| 552 | case SIR_BB_XPORT_MGMT_MSG: |
| 553 | return "SIR_BB_XPORT_MGMT_MSG\n"; |
| 554 | case SIR_LIM_INV_KEY_INTERRUPT_MSG: |
| 555 | return "SIR_LIM_INV_KEY_INTERRUPT_MSG\n"; |
| 556 | case SIR_LIM_KEY_ID_INTERRUPT_MSG: |
| 557 | return "SIR_LIM_KEY_ID_INTERRUPT_MSG\n"; |
| 558 | case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG: |
| 559 | return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG\n"; |
| 560 | case SIR_LIM_MIN_CHANNEL_TIMEOUT: |
| 561 | return "SIR_LIM_MIN_CHANNEL_TIMEOUT\n"; |
| 562 | case SIR_LIM_MAX_CHANNEL_TIMEOUT: |
| 563 | return "SIR_LIM_MAX_CHANNEL_TIMEOUT\n"; |
| 564 | case SIR_LIM_JOIN_FAIL_TIMEOUT: |
| 565 | return "SIR_LIM_JOIN_FAIL_TIMEOUT\n"; |
| 566 | case SIR_LIM_AUTH_FAIL_TIMEOUT: |
| 567 | return "SIR_LIM_AUTH_FAIL_TIMEOUT\n"; |
| 568 | case SIR_LIM_AUTH_RSP_TIMEOUT: |
| 569 | return "SIR_LIM_AUTH_RSP_TIMEOUT\n"; |
| 570 | case SIR_LIM_ASSOC_FAIL_TIMEOUT: |
| 571 | return "SIR_LIM_ASSOC_FAIL_TIMEOUT\n"; |
| 572 | case SIR_LIM_REASSOC_FAIL_TIMEOUT: |
| 573 | return "SIR_LIM_REASSOC_FAIL_TIMEOUT\n"; |
| 574 | case SIR_LIM_HEART_BEAT_TIMEOUT: |
| 575 | return "SIR_LIM_HEART_BEAT_TIMEOUT\n"; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 576 | case SIR_LIM_ADDTS_RSP_TIMEOUT: |
| 577 | return "SIR_LIM_ADDTS_RSP_TIMEOUT\n"; |
| 578 | case SIR_LIM_CHANNEL_SCAN_TIMEOUT: |
| 579 | return "SIR_LIM_CHANNEL_SCAN_TIMEOUT\n"; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 580 | case SIR_LIM_LINK_TEST_DURATION_TIMEOUT: |
| 581 | return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT\n"; |
| 582 | case SIR_LIM_HASH_MISS_THRES_TIMEOUT: |
| 583 | return "SIR_LIM_HASH_MISS_THRES_TIMEOUT\n"; |
| 584 | case SIR_LIM_KEEPALIVE_TIMEOUT: |
| 585 | return "SIR_LIM_KEEPALIVE_TIMEOUT\n"; |
| 586 | case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT: |
| 587 | return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT\n"; |
| 588 | case SIR_LIM_CNF_WAIT_TIMEOUT: |
| 589 | return "SIR_LIM_CNF_WAIT_TIMEOUT\n"; |
| 590 | case SIR_LIM_RADAR_DETECT_IND: |
| 591 | return "SIR_LIM_RADAR_DETECT_IND\n"; |
| 592 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 593 | case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT: |
| 594 | return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT\n"; |
| 595 | #endif |
| 596 | |
| 597 | case SIR_HAL_APP_SETUP_NTF: |
| 598 | return "SIR_HAL_APP_SETUP_NTF\n"; |
| 599 | case SIR_HAL_INITIAL_CAL_FAILED_NTF: |
| 600 | return "SIR_HAL_INITIAL_CAL_FAILED_NTF\n"; |
| 601 | case SIR_HAL_NIC_OPER_NTF: |
| 602 | return "SIR_HAL_NIC_OPER_NTF\n"; |
| 603 | case SIR_HAL_INIT_START_REQ: |
| 604 | return "SIR_HAL_INIT_START_REQ\n"; |
| 605 | case SIR_HAL_SHUTDOWN_REQ: |
| 606 | return "SIR_HAL_SHUTDOWN_REQ\n"; |
| 607 | case SIR_HAL_SHUTDOWN_CNF: |
| 608 | return "SIR_HAL_SHUTDOWN_CNF\n"; |
| 609 | case SIR_HAL_RESET_REQ: |
| 610 | return "SIR_HAL_RESET_REQ\n"; |
| 611 | case SIR_HAL_RESET_CNF: |
| 612 | return "SIR_HAL_RESET_CNF\n"; |
| 613 | case SIR_WRITE_TO_TD: |
| 614 | return "SIR_WRITE_TO_TD\n"; |
| 615 | |
| 616 | case WNI_CFG_PARAM_UPDATE_IND: |
| 617 | return "WNI_CFG_PARAM_UPDATE_IND\n"; |
| 618 | case WNI_CFG_DNLD_REQ: |
| 619 | return "WNI_CFG_DNLD_REQ\n"; |
| 620 | case WNI_CFG_DNLD_CNF: |
| 621 | return "WNI_CFG_DNLD_CNF\n"; |
| 622 | case WNI_CFG_GET_RSP: |
| 623 | return "WNI_CFG_GET_RSP\n"; |
| 624 | case WNI_CFG_SET_CNF: |
| 625 | return "WNI_CFG_SET_CNF\n"; |
| 626 | case WNI_CFG_GET_ATTRIB_RSP: |
| 627 | return "WNI_CFG_GET_ATTRIB_RSP\n"; |
| 628 | case WNI_CFG_ADD_GRP_ADDR_CNF: |
| 629 | return "WNI_CFG_ADD_GRP_ADDR_CNF\n"; |
| 630 | case WNI_CFG_DEL_GRP_ADDR_CNF: |
| 631 | return "WNI_CFG_DEL_GRP_ADDR_CNF\n"; |
| 632 | case ANI_CFG_GET_RADIO_STAT_RSP: |
| 633 | return "ANI_CFG_GET_RADIO_STAT_RSP\n"; |
| 634 | case ANI_CFG_GET_PER_STA_STAT_RSP: |
| 635 | return "ANI_CFG_GET_PER_STA_STAT_RSP\n"; |
| 636 | case ANI_CFG_GET_AGG_STA_STAT_RSP: |
| 637 | return "ANI_CFG_GET_AGG_STA_STAT_RSP\n"; |
| 638 | case ANI_CFG_CLEAR_STAT_RSP: |
| 639 | return "ANI_CFG_CLEAR_STAT_RSP\n"; |
| 640 | case WNI_CFG_DNLD_RSP: |
| 641 | return "WNI_CFG_DNLD_RSP\n"; |
| 642 | case WNI_CFG_GET_REQ: |
| 643 | return "WNI_CFG_GET_REQ\n"; |
| 644 | case WNI_CFG_SET_REQ: |
| 645 | return "WNI_CFG_SET_REQ\n"; |
| 646 | case WNI_CFG_SET_REQ_NO_RSP: |
| 647 | return "WNI_CFG_SET_REQ_NO_RSP\n"; |
| 648 | case eWNI_PMC_ENTER_IMPS_RSP: |
| 649 | return "eWNI_PMC_ENTER_IMPS_RSP\n"; |
| 650 | case eWNI_PMC_EXIT_IMPS_RSP: |
| 651 | return "eWNI_PMC_EXIT_IMPS_RSP\n"; |
| 652 | case eWNI_PMC_ENTER_BMPS_RSP: |
| 653 | return "eWNI_PMC_ENTER_BMPS_RSP\n"; |
| 654 | case eWNI_PMC_EXIT_BMPS_RSP: |
| 655 | return "eWNI_PMC_EXIT_BMPS_RSP\n"; |
| 656 | case eWNI_PMC_EXIT_BMPS_IND: |
| 657 | return "eWNI_PMC_EXIT_BMPS_IND\n"; |
| 658 | default: |
| 659 | return "INVALID SME message\n"; |
| 660 | } |
| 661 | #endif |
| 662 | return ""; |
| 663 | } |
| 664 | |
| 665 | |
| 666 | |
| 667 | char *limResultCodeStr(tSirResultCodes resultCode) |
| 668 | { |
| 669 | #ifdef FIXME_GEN6 |
| 670 | switch (resultCode) |
| 671 | { |
| 672 | case eSIR_SME_SUCCESS: |
| 673 | return "eSIR_SME_SUCCESS\n"; |
| 674 | case eSIR_EOF_SOF_EXCEPTION: |
| 675 | return "eSIR_EOF_SOF_EXCEPTION\n"; |
| 676 | case eSIR_BMU_EXCEPTION: |
| 677 | return "eSIR_BMU_EXCEPTION\n"; |
| 678 | case eSIR_LOW_PDU_EXCEPTION: |
| 679 | return "eSIR_LOW_PDU_EXCEPTION\n"; |
| 680 | case eSIR_USER_TRIG_RESET: |
| 681 | return"eSIR_USER_TRIG_RESET\n"; |
| 682 | case eSIR_LOGP_EXCEPTION: |
| 683 | return "eSIR_LOGP_EXCEPTION\n"; |
| 684 | case eSIR_CP_EXCEPTION: |
| 685 | return "eSIR_CP_EXCEPTION\n"; |
| 686 | case eSIR_STOP_BSS: |
| 687 | return "eSIR_STOP_BSS\n"; |
| 688 | case eSIR_AHB_HANG_EXCEPTION: |
| 689 | return "eSIR_AHB_HANG_EXCEPTION\n"; |
| 690 | case eSIR_DPU_EXCEPTION: |
| 691 | return "eSIR_DPU_EXCEPTION\n"; |
| 692 | case eSIR_RXP_EXCEPTION: |
| 693 | return "eSIR_RXP_EXCEPTION\n"; |
| 694 | case eSIR_MCPU_EXCEPTION: |
| 695 | return "eSIR_MCPU_EXCEPTION\n"; |
| 696 | case eSIR_MCU_EXCEPTION: |
| 697 | return "eSIR_MCU_EXCEPTION\n"; |
| 698 | case eSIR_MTU_EXCEPTION: |
| 699 | return "eSIR_MTU_EXCEPTION\n"; |
| 700 | case eSIR_MIF_EXCEPTION: |
| 701 | return "eSIR_MIF_EXCEPTION\n"; |
| 702 | case eSIR_FW_EXCEPTION: |
| 703 | return "eSIR_FW_EXCEPTION\n"; |
| 704 | case eSIR_MAILBOX_SANITY_CHK_FAILED: |
| 705 | return "eSIR_MAILBOX_SANITY_CHK_FAILED\n"; |
| 706 | case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF: |
| 707 | return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF\n"; |
| 708 | case eSIR_CFB_FLAG_STUCK_EXCEPTION: |
| 709 | return "eSIR_CFB_FLAG_STUCK_EXCEPTION\n"; |
| 710 | case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS: |
| 711 | return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS\n"; |
| 712 | case eSIR_SME_INVALID_PARAMETERS: |
| 713 | return "eSIR_SME_INVALID_PARAMETERS\n"; |
| 714 | case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE: |
| 715 | return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE\n"; |
| 716 | case eSIR_SME_RESOURCES_UNAVAILABLE: |
| 717 | return "eSIR_SME_RESOURCES_UNAVAILABLE\n"; |
| 718 | case eSIR_SME_SCAN_FAILED: |
| 719 | return "eSIR_SME_SCAN_FAILED\n"; |
| 720 | case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED: |
| 721 | return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED\n"; |
| 722 | case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE: |
| 723 | return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE\n"; |
| 724 | case eSIR_SME_REFUSED: |
| 725 | return "eSIR_SME_REFUSED\n"; |
| 726 | case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE: |
| 727 | return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE\n"; |
| 728 | case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE: |
| 729 | return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE\n"; |
| 730 | case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE: |
| 731 | return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE\n"; |
| 732 | case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE: |
| 733 | return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE\n"; |
| 734 | case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED: |
| 735 | return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED\n"; |
| 736 | case eSIR_SME_AUTH_REFUSED: |
| 737 | return "eSIR_SME_AUTH_REFUSED\n"; |
| 738 | case eSIR_SME_INVALID_WEP_DEFAULT_KEY: |
| 739 | return "eSIR_SME_INVALID_WEP_DEFAULT_KEY\n"; |
| 740 | case eSIR_SME_ASSOC_REFUSED: |
| 741 | return "eSIR_SME_ASSOC_REFUSED\n"; |
| 742 | case eSIR_SME_REASSOC_REFUSED: |
| 743 | return "eSIR_SME_REASSOC_REFUSED\n"; |
| 744 | case eSIR_SME_STA_NOT_AUTHENTICATED: |
| 745 | return "eSIR_SME_STA_NOT_AUTHENTICATED\n"; |
| 746 | case eSIR_SME_STA_NOT_ASSOCIATED: |
| 747 | return "eSIR_SME_STA_NOT_ASSOCIATED\n"; |
| 748 | case eSIR_SME_STA_DISASSOCIATED: |
| 749 | return "eSIR_SME_STA_DISASSOCIATED\n"; |
| 750 | case eSIR_SME_ALREADY_JOINED_A_BSS: |
| 751 | return "eSIR_SME_ALREADY_JOINED_A_BSS\n"; |
| 752 | case eSIR_ULA_COMPLETED: |
| 753 | return "eSIR_ULA_COMPLETED\n"; |
| 754 | case eSIR_ULA_FAILURE: |
| 755 | return "eSIR_ULA_FAILURE\n"; |
| 756 | case eSIR_SME_LINK_ESTABLISHED: |
| 757 | return "eSIR_SME_LINK_ESTABLISHED\n"; |
| 758 | case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS: |
| 759 | return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS\n"; |
| 760 | case eSIR_SME_UNABLE_TO_PERFORM_DFS: |
| 761 | return "eSIR_SME_UNABLE_TO_PERFORM_DFS\n"; |
| 762 | case eSIR_SME_DFS_FAILED: |
| 763 | return "eSIR_SME_DFS_FAILED\n"; |
| 764 | case eSIR_SME_TRANSFER_STA: |
| 765 | return "eSIR_SME_TRANSFER_STA\n"; |
| 766 | case eSIR_SME_INVALID_LINK_TEST_PARAMETERS: |
| 767 | return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS\n"; |
| 768 | case eSIR_SME_LINK_TEST_MAX_EXCEEDED: |
| 769 | return "eSIR_SME_LINK_TEST_MAX_EXCEEDED\n"; |
| 770 | case eSIR_SME_UNSUPPORTED_RATE: |
| 771 | return "eSIR_SME_UNSUPPORTED_RATE\n"; |
| 772 | case eSIR_SME_LINK_TEST_TIMEOUT: |
| 773 | return "eSIR_SME_LINK_TEST_TIMEOUT\n"; |
| 774 | case eSIR_SME_LINK_TEST_COMPLETE: |
| 775 | return "eSIR_SME_LINK_TEST_COMPLETE\n"; |
| 776 | case eSIR_SME_LINK_TEST_INVALID_STATE: |
| 777 | return "eSIR_SME_LINK_TEST_INVALID_STATE\n"; |
| 778 | case eSIR_SME_LINK_TEST_INVALID_ADDRESS: |
| 779 | return "eSIR_SME_LINK_TEST_INVALID_ADDRESS\n"; |
| 780 | case eSIR_SME_POLARIS_RESET: |
| 781 | return "eSIR_SME_POLARIS_RESET\n"; |
| 782 | case eSIR_SME_SETCONTEXT_FAILED: |
| 783 | return "eSIR_SME_SETCONTEXT_FAILED\n"; |
| 784 | case eSIR_SME_BSS_RESTART: |
| 785 | return "eSIR_SME_BSS_RESTART\n"; |
| 786 | case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW: |
| 787 | return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW\n"; |
| 788 | case eSIR_SME_INVALID_ASSOC_RSP_RXED: |
| 789 | return "eSIR_SME_INVALID_ASSOC_RSP_RXED\n"; |
| 790 | case eSIR_SME_MIC_COUNTER_MEASURES: |
| 791 | return "eSIR_SME_MIC_COUNTER_MEASURES\n"; |
| 792 | case eSIR_SME_ADDTS_RSP_TIMEOUT: |
| 793 | return "eSIR_SME_ADDTS_RSP_TIMEOUT\n"; |
| 794 | case eSIR_SME_RECEIVED: |
| 795 | return "eSIR_SME_RECEIVED\n"; |
| 796 | case eSIR_SME_CHANNEL_SWITCH_FAIL: |
| 797 | return "eSIR_SME_CHANNEL_SWITCH_FAIL\n"; |
| 798 | #ifdef GEN4_SCAN |
| 799 | case eSIR_SME_CHANNEL_SWITCH_DISABLED: |
| 800 | return "eSIR_SME_CHANNEL_SWITCH_DISABLED\n"; |
| 801 | case eSIR_SME_HAL_SCAN_INIT_FAILED: |
| 802 | return "eSIR_SME_HAL_SCAN_INIT_FAILED\n"; |
| 803 | case eSIR_SME_HAL_SCAN_START_FAILED: |
| 804 | return "eSIR_SME_HAL_SCAN_START_FAILED\n"; |
| 805 | case eSIR_SME_HAL_SCAN_END_FAILED: |
| 806 | return "eSIR_SME_HAL_SCAN_END_FAILED\n"; |
| 807 | case eSIR_SME_HAL_SCAN_FINISH_FAILED: |
| 808 | return "eSIR_SME_HAL_SCAN_FINISH_FAILED\n"; |
| 809 | case eSIR_SME_HAL_SEND_MESSAGE_FAIL: |
| 810 | return "eSIR_SME_HAL_SEND_MESSAGE_FAIL\n"; |
| 811 | #else // GEN4_SCAN |
| 812 | case eSIR_SME_CHANNEL_SWITCH_DISABLED: |
| 813 | return "eSIR_SME_CHANNEL_SWITCH_DISABLED\n"; |
| 814 | case eSIR_SME_HAL_SEND_MESSAGE_FAIL: |
| 815 | return "eSIR_SME_HAL_SEND_MESSAGE_FAIL\n"; |
| 816 | #endif // GEN4_SCAN |
| 817 | |
| 818 | default: |
| 819 | return "INVALID resultCode\n"; |
| 820 | } |
| 821 | #endif |
| 822 | return ""; |
| 823 | } |
| 824 | |
| 825 | void |
| 826 | limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType) |
| 827 | { |
| 828 | limLog(pMac, logLevel, limMsgStr(msgType)); |
| 829 | } |
| 830 | |
| 831 | |
| 832 | #if defined(ANI_MIPS) || defined(ANI_ARM) |
| 833 | #define LINK 0 |
| 834 | #else |
| 835 | #define LINK 1 |
| 836 | #endif |
| 837 | |
| 838 | void |
| 839 | limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg) |
| 840 | { |
| 841 | //tSirMacFrameCtl fc; // FIXME_GEN4 - ASAP!! |
| 842 | #if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX) |
| 843 | tANI_U32 *pRxPacketInfo; |
| 844 | #endif |
| 845 | if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID]) |
| 846 | { |
| 847 | switch (msg->type) |
| 848 | { |
| 849 | case SIR_BB_XPORT_MGMT_MSG: |
| 850 | #if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX) |
| 851 | #ifndef GEN6_ONWARDS //PAL does not provide this API GEN6 onwards. |
| 852 | palGetPacketDataPtr( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, (void *) msg->bodyptr, (void **) &pRxPacketInfo ); |
| 853 | #endif //GEN6_ONWARDS |
| 854 | #else |
| 855 | limPrintMsgName(pMac, logLevel,msg->type); |
| 856 | #endif |
| 857 | break; |
| 858 | default: |
| 859 | limPrintMsgName(pMac, logLevel,msg->type); |
| 860 | break; |
| 861 | } |
| 862 | } |
| 863 | } |
| 864 | |
| 865 | /** |
| 866 | * limInitMlm() |
| 867 | * |
| 868 | *FUNCTION: |
| 869 | * This function is called by limProcessSmeMessages() to |
| 870 | * initialize MLM state machine on STA |
| 871 | * |
| 872 | *PARAMS: |
| 873 | * |
| 874 | *LOGIC: |
| 875 | * |
| 876 | *ASSUMPTIONS: |
| 877 | * NA |
| 878 | * |
| 879 | *NOTE: |
| 880 | * NA |
| 881 | * |
| 882 | * @param pMac Pointer to Global MAC structure |
| 883 | * @return None |
| 884 | */ |
| 885 | void |
| 886 | limInitMlm(tpAniSirGlobal pMac) |
| 887 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 888 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 889 | |
| 890 | /// Initialize scan result hash table |
| 891 | limReInitScanResults(pMac); //sep26th review |
| 892 | |
| 893 | |
| 894 | /// Initialize number of pre-auth contexts |
| 895 | pMac->lim.gLimNumPreAuthContexts = 0; |
| 896 | |
| 897 | /// Initialize MAC based Authentication STA list |
| 898 | limInitPreAuthList(pMac); |
| 899 | |
| 900 | //pMac->lim.gpLimMlmJoinReq = NULL; |
| 901 | |
| 902 | if (pMac->lim.gLimTimersCreated) |
| 903 | return; |
| 904 | |
| 905 | // Create timers used by LIM |
| 906 | limCreateTimers(pMac); |
| 907 | |
| 908 | pMac->lim.gLimTimersCreated = 1; |
| 909 | } /*** end limInitMlm() ***/ |
| 910 | |
| 911 | |
| 912 | |
| 913 | /** |
| 914 | * limCleanupMlm() |
| 915 | * |
| 916 | *FUNCTION: |
| 917 | * This function is called to cleanup any resources |
| 918 | * allocated by the MLM state machine. |
| 919 | * |
| 920 | *PARAMS: |
| 921 | * |
| 922 | *LOGIC: |
| 923 | * |
| 924 | *ASSUMPTIONS: |
| 925 | * NA |
| 926 | * |
| 927 | *NOTE: |
| 928 | * It is assumed that BSS is already informed that we're leaving it |
| 929 | * before this function is called. |
| 930 | * |
| 931 | * @param pMac Pointer to Global MAC structure |
| 932 | * @param None |
| 933 | * @return None |
| 934 | */ |
| 935 | void |
| 936 | limCleanupMlm(tpAniSirGlobal pMac) |
| 937 | { |
| 938 | tANI_U32 n; |
| 939 | tLimPreAuthNode *pAuthNode; |
| 940 | |
| 941 | if (pMac->lim.gLimTimersCreated == 1) |
| 942 | { |
| 943 | // Deactivate and delete MIN/MAX channel timers. |
| 944 | tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer); |
| 945 | tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer); |
| 946 | tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer); |
| 947 | tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer); |
| 948 | tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer); |
| 949 | tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer); |
| 950 | |
| 951 | |
| 952 | // Deactivate and delete channel switch timer. |
| 953 | tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer); |
| 954 | tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer); |
| 955 | |
| 956 | |
| 957 | // Deactivate and delete addts response timer. |
| 958 | tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer); |
| 959 | tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer); |
| 960 | |
| 961 | // Deactivate and delete Join failure timer. |
| 962 | tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer); |
| 963 | tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer); |
| 964 | |
| 965 | // Deactivate and delete Association failure timer. |
| 966 | tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer); |
| 967 | tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer); |
| 968 | |
| 969 | // Deactivate and delete Reassociation failure timer. |
| 970 | tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer); |
| 971 | tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer); |
| 972 | |
| 973 | // Deactivate and delete Authentication failure timer. |
| 974 | tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer); |
| 975 | tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer); |
| 976 | |
| 977 | // Deactivate and delete Heartbeat timer. |
| 978 | tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer); |
| 979 | tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer); |
| 980 | |
| 981 | // Deactivate and delete wait-for-probe-after-Heartbeat timer. |
| 982 | tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer); |
| 983 | tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer); |
| 984 | |
| 985 | // Deactivate and delete Quiet timer. |
| 986 | tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer); |
| 987 | tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer); |
| 988 | |
| 989 | // Deactivate and delete Quiet BSS timer. |
| 990 | tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer); |
| 991 | tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer); |
| 992 | |
| 993 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 994 | // Deactivate and delete LIM background scan timer. |
| 995 | tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer); |
| 996 | tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer); |
| 997 | #endif |
| 998 | |
| 999 | |
| 1000 | // Deactivate and delete cnf wait timer |
| 1001 | for (n = 0; n < pMac->lim.maxStation; n++) |
| 1002 | { |
| 1003 | tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]); |
| 1004 | tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]); |
| 1005 | } |
| 1006 | |
| 1007 | // Deactivate and delete keepalive timer |
| 1008 | tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer); |
| 1009 | tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer); |
| 1010 | |
| 1011 | pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable; |
| 1012 | |
| 1013 | //Deactivate any Authentication response timers |
| 1014 | limDeletePreAuthList(pMac); |
| 1015 | |
| 1016 | for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++) |
| 1017 | { |
| 1018 | // Delete any Authentication response |
| 1019 | // timers, which might have been started. |
| 1020 | tx_timer_delete(&pAuthNode->timer); |
| 1021 | } |
| 1022 | |
| 1023 | #ifdef ANI_PRODUCT_TYPE_AP |
| 1024 | |
| 1025 | if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) |
| 1026 | { |
| 1027 | // Deactivate and cleanup the periodic pre-auth |
| 1028 | // cleanup timer |
| 1029 | |
| 1030 | tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer); |
| 1031 | tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer); |
| 1032 | |
| 1033 | /// Deactivate and delete OLBC cache update timeout |
| 1034 | tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer); |
| 1035 | tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer); |
| 1036 | |
| 1037 | } |
| 1038 | #endif |
| 1039 | |
| 1040 | |
| 1041 | // Deactivate and delete Hash Miss throttle timer |
| 1042 | tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer); |
| 1043 | tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer); |
| 1044 | |
| 1045 | #ifdef WLAN_SOFTAP_FEATURE |
| 1046 | tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer); |
| 1047 | tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer); |
| 1048 | tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer); |
| 1049 | tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer); |
| 1050 | |
| 1051 | #if 0 // The WPS PBC clean up timer is disabled |
| 1052 | if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) |
| 1053 | { |
| 1054 | if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE) |
| 1055 | { |
| 1056 | tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer); |
| 1057 | tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer); |
| 1058 | pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE; |
| 1059 | } |
| 1060 | } |
| 1061 | #endif |
| 1062 | #endif |
| 1063 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1064 | // Deactivate and delete FT Preauth response timer |
| 1065 | tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer); |
| 1066 | tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer); |
| 1067 | #endif |
| 1068 | |
| 1069 | #ifdef WLAN_FEATURE_P2P |
| 1070 | // Deactivate and delete remain on channel timer |
| 1071 | tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer); |
| 1072 | tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer); |
| 1073 | #endif |
| 1074 | |
| 1075 | #ifdef FEATURE_WLAN_CCX |
| 1076 | // Deactivate and delete TSM |
| 1077 | tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer); |
| 1078 | tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer); |
| 1079 | #endif |
| 1080 | |
| 1081 | pMac->lim.gLimTimersCreated = 0; |
| 1082 | } |
| 1083 | |
| 1084 | /// Cleanup cached scan list |
| 1085 | limReInitScanResults(pMac); |
| 1086 | |
| 1087 | } /*** end limCleanupMlm() ***/ |
| 1088 | |
| 1089 | |
| 1090 | |
| 1091 | /** |
| 1092 | * limCleanupLmm() |
| 1093 | * |
| 1094 | *FUNCTION: |
| 1095 | * This function is called to cleanup any resources |
| 1096 | * allocated by LMM sub-module. |
| 1097 | * |
| 1098 | *PARAMS: |
| 1099 | * |
| 1100 | *LOGIC: |
| 1101 | * |
| 1102 | *ASSUMPTIONS: |
| 1103 | * NA |
| 1104 | * |
| 1105 | *NOTE: |
| 1106 | * NA |
| 1107 | * |
| 1108 | * @param pMac Pointer to Global MAC structure |
| 1109 | * @return None |
| 1110 | */ |
| 1111 | |
| 1112 | void |
| 1113 | limCleanupLmm(tpAniSirGlobal pMac) |
| 1114 | { |
| 1115 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined (ANI_PRODUCT_TYPE_AP) |
| 1116 | limCleanupMeasResources(pMac); |
| 1117 | pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_FALSE; |
| 1118 | #endif |
| 1119 | } /*** end limCleanupLmm() ***/ |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | /** |
| 1124 | * limIsAddrBC() |
| 1125 | * |
| 1126 | *FUNCTION: |
| 1127 | * This function is called in various places within LIM code |
| 1128 | * to determine whether passed MAC address is a broadcast or not |
| 1129 | * |
| 1130 | *LOGIC: |
| 1131 | * |
| 1132 | *ASSUMPTIONS: |
| 1133 | * NA |
| 1134 | * |
| 1135 | *NOTE: |
| 1136 | * NA |
| 1137 | * |
| 1138 | * @param macAddr Indicates MAC address that need to be determined |
| 1139 | * whether it is Broadcast address or not |
| 1140 | * |
| 1141 | * @return true if passed address is Broadcast address else false |
| 1142 | */ |
| 1143 | |
| 1144 | tANI_U8 |
| 1145 | limIsAddrBC(tSirMacAddr macAddr) |
| 1146 | { |
| 1147 | int i; |
| 1148 | for (i = 0; i < 6; i++) |
| 1149 | { |
| 1150 | if ((macAddr[i] & 0xFF) != 0xFF) |
| 1151 | return false; |
| 1152 | } |
| 1153 | |
| 1154 | return true; |
| 1155 | } /****** end limIsAddrBC() ******/ |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | /** |
| 1160 | * limIsGroupAddr() |
| 1161 | * |
| 1162 | *FUNCTION: |
| 1163 | * This function is called in various places within LIM code |
| 1164 | * to determine whether passed MAC address is a group address or not |
| 1165 | * |
| 1166 | *LOGIC: |
| 1167 | * If least significant bit of first octet of the MAC address is |
| 1168 | * set to 1, it is a Group address. |
| 1169 | * |
| 1170 | *ASSUMPTIONS: |
| 1171 | * NA |
| 1172 | * |
| 1173 | *NOTE: |
| 1174 | * NA |
| 1175 | * |
| 1176 | * @param macAddr Indicates MAC address that need to be determined |
| 1177 | * whether it is Group address or not |
| 1178 | * |
| 1179 | * @return true if passed address is Group address else false |
| 1180 | */ |
| 1181 | |
| 1182 | tANI_U8 |
| 1183 | limIsGroupAddr(tSirMacAddr macAddr) |
| 1184 | { |
| 1185 | if ((macAddr[0] & 0x01) == 0x01) |
| 1186 | return true; |
| 1187 | else |
| 1188 | return false; |
| 1189 | } /****** end limIsGroupAddr() ******/ |
| 1190 | |
| 1191 | /** |
| 1192 | * limPostMsgApiNoWait() |
| 1193 | * |
| 1194 | *FUNCTION: |
| 1195 | * This function is called from other thread while posting a |
| 1196 | * message to LIM message Queue gSirLimMsgQ with NO_WAIT option |
| 1197 | * |
| 1198 | *LOGIC: |
| 1199 | * NA |
| 1200 | * |
| 1201 | *ASSUMPTIONS: |
| 1202 | * NA |
| 1203 | * |
| 1204 | *NOTE: |
| 1205 | * NA |
| 1206 | * |
| 1207 | * @param pMsg - Pointer to the Global MAC structure |
| 1208 | * @param pMsg - Pointer to the message structure |
| 1209 | * @return None |
| 1210 | */ |
| 1211 | |
| 1212 | tANI_U32 |
| 1213 | limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg) |
| 1214 | { |
| 1215 | #ifdef ANI_OS_TYPE_WINDOWS |
| 1216 | tANI_U32 retCode; |
| 1217 | |
| 1218 | if ((retCode = tx_queue_send(&pMac->sys.gSirLimMsgQ, pMsg, TX_NO_WAIT)) |
| 1219 | != TX_SUCCESS) |
| 1220 | { |
| 1221 | // Failure in sending DFS duration timeout indication |
| 1222 | // to LIM thread |
| 1223 | |
| 1224 | // Log error |
| 1225 | limLog(pMac, LOGP, |
| 1226 | FL("could not post a message %X to LIM msgq, status=%d\n"), |
| 1227 | pMsg->type, retCode); |
| 1228 | } |
| 1229 | |
| 1230 | return retCode; |
| 1231 | #else |
| 1232 | limProcessMessages(pMac, pMsg); |
| 1233 | return TX_SUCCESS; |
| 1234 | #endif |
| 1235 | } /*** end limPostMsgApiNoWait() ***/ |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | /** |
| 1240 | * limPrintMacAddr() |
| 1241 | * |
| 1242 | *FUNCTION: |
| 1243 | * This function is called to print passed MAC address |
| 1244 | * in : format. |
| 1245 | * |
| 1246 | *LOGIC: |
| 1247 | * |
| 1248 | *ASSUMPTIONS: |
| 1249 | * NA |
| 1250 | * |
| 1251 | *NOTE: |
| 1252 | * @param macAddr - MacAddr to be printed |
| 1253 | * @param logLevel - Loglevel to be used |
| 1254 | * |
| 1255 | * @return None. |
| 1256 | */ |
| 1257 | |
| 1258 | void |
| 1259 | limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel) |
| 1260 | { |
| 1261 | limLog(pMac, logLevel, |
| 1262 | FL("%X:%X:%X:%X:%X:%X\n"), |
| 1263 | macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4], |
| 1264 | macAddr[5]); |
| 1265 | } /****** end limPrintMacAddr() ******/ |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | /* |
| 1273 | * limResetDeferredMsgQ() |
| 1274 | * |
| 1275 | *FUNCTION: |
| 1276 | * This function resets the deferred message queue parameters. |
| 1277 | * |
| 1278 | *PARAMS: |
| 1279 | * @param pMac - Pointer to Global MAC structure |
| 1280 | * |
| 1281 | *LOGIC: |
| 1282 | * |
| 1283 | *ASSUMPTIONS: |
| 1284 | * NA |
| 1285 | * |
| 1286 | *NOTE: |
| 1287 | * NA |
| 1288 | * |
| 1289 | *RETURNS: |
| 1290 | * None |
| 1291 | */ |
| 1292 | |
| 1293 | void limResetDeferredMsgQ(tpAniSirGlobal pMac) |
| 1294 | { |
| 1295 | pMac->lim.gLimDeferredMsgQ.size = |
| 1296 | pMac->lim.gLimDeferredMsgQ.write = |
| 1297 | pMac->lim.gLimDeferredMsgQ.read = 0; |
| 1298 | |
| 1299 | } |
| 1300 | |
| 1301 | |
| 1302 | #define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2) |
| 1303 | #define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2) |
| 1304 | |
| 1305 | /* |
| 1306 | * limWriteDeferredMsgQ() |
| 1307 | * |
| 1308 | *FUNCTION: |
| 1309 | * This function queues up a deferred message for later processing on the |
| 1310 | * STA side. |
| 1311 | * |
| 1312 | *PARAMS: |
| 1313 | * @param pMac - Pointer to Global MAC structure |
| 1314 | * @param limMsg - a LIM message |
| 1315 | * |
| 1316 | *LOGIC: |
| 1317 | * |
| 1318 | *ASSUMPTIONS: |
| 1319 | * NA |
| 1320 | * |
| 1321 | *NOTE: |
| 1322 | * NA |
| 1323 | * |
| 1324 | *RETURNS: |
| 1325 | * None |
| 1326 | */ |
| 1327 | |
| 1328 | tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg) |
| 1329 | { |
| 1330 | PELOG1(limLog(pMac, LOG1, |
| 1331 | FL("** Queue a deferred message (size %d, write %d) - type 0x%x **\n"), |
| 1332 | pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write, |
| 1333 | limMsg->type);) |
| 1334 | |
| 1335 | /* |
| 1336 | ** check if the deferred message queue is full |
| 1337 | **/ |
| 1338 | if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN) |
| 1339 | { |
| 1340 | PELOGE(limLog(pMac, LOGE, FL("Deferred Message Queue is full. Msg: %d\n"), limMsg->type);) |
| 1341 | return TX_QUEUE_FULL; |
| 1342 | } |
| 1343 | |
| 1344 | /* |
| 1345 | ** In the application, there should not be more than 1 message get |
| 1346 | ** queued up. If happens, flags a warning. In the future, this can |
| 1347 | ** happen. |
| 1348 | **/ |
| 1349 | if (pMac->lim.gLimDeferredMsgQ.size > 0) |
| 1350 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1351 | PELOGW(limLog(pMac, LOGW, FL("%d Deferred messages (type 0x%x, scan %d, global sme %d, global mlme %d, addts %d)\n"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1352 | pMac->lim.gLimDeferredMsgQ.size, limMsg->type, |
| 1353 | limIsSystemInScanState(pMac), |
| 1354 | pMac->lim.gLimSmeState, pMac->lim.gLimMlmState, |
| 1355 | pMac->lim.gLimAddtsSent);) |
| 1356 | } |
| 1357 | |
| 1358 | /* |
| 1359 | ** To prevent the deferred Q is full of management frames, only give them certain space |
| 1360 | **/ |
| 1361 | if( SIR_BB_XPORT_MGMT_MSG == limMsg->type ) |
| 1362 | { |
| 1363 | if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size ) |
| 1364 | { |
| 1365 | tANI_U16 idx, count = 0; |
| 1366 | for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++) |
| 1367 | { |
| 1368 | if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type ) |
| 1369 | { |
| 1370 | count++; |
| 1371 | } |
| 1372 | } |
| 1373 | if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count ) |
| 1374 | { |
| 1375 | //We reach the quota for management frames, drop this one |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 1376 | PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1377 | //Return error, caller knows what to do |
| 1378 | return TX_QUEUE_FULL; |
| 1379 | } |
| 1380 | } |
| 1381 | } |
| 1382 | |
| 1383 | ++pMac->lim.gLimDeferredMsgQ.size; |
| 1384 | |
| 1385 | /* |
| 1386 | ** if the write pointer hits the end of the queue, rewind it |
| 1387 | **/ |
| 1388 | if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN) |
| 1389 | pMac->lim.gLimDeferredMsgQ.write = 0; |
| 1390 | |
| 1391 | /* |
| 1392 | ** save the message to the queue and advanced the write pointer |
| 1393 | **/ |
| 1394 | palCopyMemory(pMac->hHdd, |
| 1395 | (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.write++], |
| 1396 | (tANI_U8 *)limMsg, |
| 1397 | sizeof(tSirMsgQ)); |
| 1398 | return TX_SUCCESS; |
| 1399 | |
| 1400 | } |
| 1401 | |
| 1402 | /* |
| 1403 | * limReadDeferredMsgQ() |
| 1404 | * |
| 1405 | *FUNCTION: |
| 1406 | * This function dequeues a deferred message for processing on the |
| 1407 | * STA side. |
| 1408 | * |
| 1409 | *PARAMS: |
| 1410 | * @param pMac - Pointer to Global MAC structure |
| 1411 | * |
| 1412 | *LOGIC: |
| 1413 | * |
| 1414 | *ASSUMPTIONS: |
| 1415 | * NA |
| 1416 | * |
| 1417 | *NOTE: |
| 1418 | * |
| 1419 | * |
| 1420 | *RETURNS: |
| 1421 | * Returns the message at the head of the deferred message queue |
| 1422 | */ |
| 1423 | |
| 1424 | tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac) |
| 1425 | { |
| 1426 | tSirMsgQ *msg; |
| 1427 | |
| 1428 | /* |
| 1429 | ** check any messages left. If no, return |
| 1430 | **/ |
| 1431 | if (pMac->lim.gLimDeferredMsgQ.size <= 0) |
| 1432 | return NULL; |
| 1433 | |
| 1434 | /* |
| 1435 | ** decrement the queue size |
| 1436 | **/ |
| 1437 | pMac->lim.gLimDeferredMsgQ.size--; |
| 1438 | |
| 1439 | /* |
| 1440 | ** retrieve the message from the head of the queue |
| 1441 | **/ |
| 1442 | msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read]; |
| 1443 | |
| 1444 | /* |
| 1445 | ** advance the read pointer |
| 1446 | **/ |
| 1447 | pMac->lim.gLimDeferredMsgQ.read++; |
| 1448 | |
| 1449 | /* |
| 1450 | ** if the read pointer hits the end of the queue, rewind it |
| 1451 | **/ |
| 1452 | if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN) |
| 1453 | pMac->lim.gLimDeferredMsgQ.read = 0; |
| 1454 | |
| 1455 | PELOG1(limLog(pMac, LOG1, |
| 1456 | FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **\n"), |
| 1457 | pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read, |
| 1458 | msg->type);) |
| 1459 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1460 | PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d\n"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1461 | limIsSystemInScanState(pMac), |
| 1462 | pMac->lim.gLimSmeState, pMac->lim.gLimMlmState, |
| 1463 | pMac->lim.gLimAddtsSent);) |
| 1464 | |
| 1465 | return(msg); |
| 1466 | } |
| 1467 | |
| 1468 | tSirRetStatus |
| 1469 | limSysProcessMmhMsgApi(tpAniSirGlobal pMac, |
| 1470 | tSirMsgQ *pMsg, |
| 1471 | tANI_U8 qType) |
| 1472 | { |
| 1473 | // FIXME |
| 1474 | #if defined( FEATURE_WLAN_INTEGRATED_SOC ) |
| 1475 | SysProcessMmhMsg(pMac, pMsg); |
| 1476 | return eSIR_SUCCESS; |
| 1477 | #else |
| 1478 | return(halMmhPostMsgApi(pMac, pMsg, qType)); |
| 1479 | #endif |
| 1480 | } |
| 1481 | |
| 1482 | char *limFrameStr(tANI_U32 type, tANI_U32 subType) |
| 1483 | { |
| 1484 | #ifdef FIXME_GEN6 |
| 1485 | |
| 1486 | if (type == SIR_MAC_MGMT_FRAME) |
| 1487 | { |
| 1488 | switch (subType) |
| 1489 | { |
| 1490 | case SIR_MAC_MGMT_ASSOC_REQ: |
| 1491 | return "MAC_MGMT_ASSOC_REQ"; |
| 1492 | case SIR_MAC_MGMT_ASSOC_RSP: |
| 1493 | return "MAC_MGMT_ASSOC_RSP"; |
| 1494 | case SIR_MAC_MGMT_REASSOC_REQ: |
| 1495 | return "MAC_MGMT_REASSOC_REQ"; |
| 1496 | case SIR_MAC_MGMT_REASSOC_RSP: |
| 1497 | return "MAC_MGMT_REASSOC_RSP"; |
| 1498 | case SIR_MAC_MGMT_PROBE_REQ: |
| 1499 | return "MAC_MGMT_PROBE_REQ"; |
| 1500 | case SIR_MAC_MGMT_PROBE_RSP: |
| 1501 | return "MAC_MGMT_PROBE_RSP"; |
| 1502 | case SIR_MAC_MGMT_BEACON: |
| 1503 | return "MAC_MGMT_BEACON"; |
| 1504 | case SIR_MAC_MGMT_ATIM: |
| 1505 | return "MAC_MGMT_ATIM"; |
| 1506 | case SIR_MAC_MGMT_DISASSOC: |
| 1507 | return "MAC_MGMT_DISASSOC"; |
| 1508 | case SIR_MAC_MGMT_AUTH: |
| 1509 | return "MAC_MGMT_AUTH"; |
| 1510 | case SIR_MAC_MGMT_DEAUTH: |
| 1511 | return "MAC_MGMT_DEAUTH"; |
| 1512 | case SIR_MAC_MGMT_ACTION: |
| 1513 | return "MAC_MGMT_ACTION"; |
| 1514 | case SIR_MAC_MGMT_RESERVED15: |
| 1515 | return "MAC_MGMT_RESERVED15"; |
| 1516 | default: |
| 1517 | return "Unknown MGMT Frame"; |
| 1518 | } |
| 1519 | } |
| 1520 | |
| 1521 | else if (type == SIR_MAC_CTRL_FRAME) |
| 1522 | { |
| 1523 | switch (subType) |
| 1524 | { |
| 1525 | case SIR_MAC_CTRL_RR: |
| 1526 | return "MAC_CTRL_RR"; |
| 1527 | case SIR_MAC_CTRL_BAR: |
| 1528 | return "MAC_CTRL_BAR"; |
| 1529 | case SIR_MAC_CTRL_BA: |
| 1530 | return "MAC_CTRL_BA"; |
| 1531 | case SIR_MAC_CTRL_PS_POLL: |
| 1532 | return "MAC_CTRL_PS_POLL"; |
| 1533 | case SIR_MAC_CTRL_RTS: |
| 1534 | return "MAC_CTRL_RTS"; |
| 1535 | case SIR_MAC_CTRL_CTS: |
| 1536 | return "MAC_CTRL_CTS"; |
| 1537 | case SIR_MAC_CTRL_ACK: |
| 1538 | return "MAC_CTRL_ACK"; |
| 1539 | case SIR_MAC_CTRL_CF_END: |
| 1540 | return "MAC_CTRL_CF_END"; |
| 1541 | case SIR_MAC_CTRL_CF_END_ACK: |
| 1542 | return "MAC_CTRL_CF_END_ACK"; |
| 1543 | default: |
| 1544 | return "Unknown CTRL Frame"; |
| 1545 | } |
| 1546 | } |
| 1547 | |
| 1548 | else if (type == SIR_MAC_DATA_FRAME) |
| 1549 | { |
| 1550 | switch (subType) |
| 1551 | { |
| 1552 | case SIR_MAC_DATA_DATA: |
| 1553 | return "MAC_DATA_DATA"; |
| 1554 | case SIR_MAC_DATA_DATA_ACK: |
| 1555 | return "MAC_DATA_DATA_ACK"; |
| 1556 | case SIR_MAC_DATA_DATA_POLL: |
| 1557 | return "MAC_DATA_DATA_POLL"; |
| 1558 | case SIR_MAC_DATA_DATA_ACK_POLL: |
| 1559 | return "MAC_DATA_DATA_ACK_POLL"; |
| 1560 | case SIR_MAC_DATA_NULL: |
| 1561 | return "MAC_DATA_NULL"; |
| 1562 | case SIR_MAC_DATA_NULL_ACK: |
| 1563 | return "MAC_DATA_NULL_ACK"; |
| 1564 | case SIR_MAC_DATA_NULL_POLL: |
| 1565 | return "MAC_DATA_NULL_POLL"; |
| 1566 | case SIR_MAC_DATA_NULL_ACK_POLL: |
| 1567 | return "MAC_DATA_NULL_ACK_POLL"; |
| 1568 | case SIR_MAC_DATA_QOS_DATA: |
| 1569 | return "MAC_DATA_QOS_DATA"; |
| 1570 | case SIR_MAC_DATA_QOS_DATA_ACK: |
| 1571 | return "MAC_DATA_QOS_DATA_ACK"; |
| 1572 | case SIR_MAC_DATA_QOS_DATA_POLL: |
| 1573 | return "MAC_DATA_QOS_DATA_POLL"; |
| 1574 | case SIR_MAC_DATA_QOS_DATA_ACK_POLL: |
| 1575 | return "MAC_DATA_QOS_DATA_ACK_POLL"; |
| 1576 | case SIR_MAC_DATA_QOS_NULL: |
| 1577 | return "MAC_DATA_QOS_NULL"; |
| 1578 | case SIR_MAC_DATA_QOS_NULL_ACK: |
| 1579 | return "MAC_DATA_QOS_NULL_ACK"; |
| 1580 | case SIR_MAC_DATA_QOS_NULL_POLL: |
| 1581 | return "MAC_DATA_QOS_NULL_POLL"; |
| 1582 | case SIR_MAC_DATA_QOS_NULL_ACK_POLL: |
| 1583 | return "MAC_DATA_QOS_NULL_ACK_POLL"; |
| 1584 | default: |
| 1585 | return "Unknown Data Frame"; |
| 1586 | } |
| 1587 | } |
| 1588 | else |
| 1589 | return "Unknown"; |
| 1590 | #endif |
| 1591 | return ""; |
| 1592 | } |
| 1593 | |
| 1594 | #ifdef WLAN_SOFTAP_FEATURE |
| 1595 | void limHandleUpdateOlbcCache(tpAniSirGlobal pMac) |
| 1596 | { |
| 1597 | int i; |
| 1598 | static int enable; |
| 1599 | tUpdateBeaconParams beaconParams; |
| 1600 | |
| 1601 | tpPESession psessionEntry = limIsApSessionActive(pMac); |
| 1602 | |
| 1603 | if (psessionEntry == NULL) |
Madan Mohan Koyyalamudi | 788b4ee | 2012-09-25 10:42:09 -0700 | [diff] [blame^] | 1604 | { |
| 1605 | PELOGE(limLog(pMac, LOGE, FL(" Session not found\n"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1606 | return; |
Madan Mohan Koyyalamudi | 788b4ee | 2012-09-25 10:42:09 -0700 | [diff] [blame^] | 1607 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | |
| 1609 | beaconParams.paramChangeBitmap = 0; |
| 1610 | /* |
| 1611 | ** This is doing a 2 pass check. The first pass is to invalidate |
| 1612 | ** all the cache entries. The second pass is to decide whether to |
| 1613 | ** disable protection. |
| 1614 | **/ |
| 1615 | if (!enable) |
| 1616 | { |
| 1617 | |
| 1618 | PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache\n"));) |
| 1619 | psessionEntry->gLimOlbcParams.numSta = 0; |
| 1620 | psessionEntry->gLimOverlap11gParams.numSta = 0; |
| 1621 | psessionEntry->gLimOverlapHt20Params.numSta = 0; |
| 1622 | psessionEntry->gLimNonGfParams.numSta = 0; |
| 1623 | psessionEntry->gLimLsigTxopParams.numSta = 0; |
| 1624 | |
| 1625 | for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++) |
| 1626 | pMac->lim.protStaOverlapCache[i].active = false; |
| 1627 | |
| 1628 | enable = 1; |
| 1629 | } |
| 1630 | else |
| 1631 | { |
| 1632 | |
Madan Mohan Koyyalamudi | 788b4ee | 2012-09-25 10:42:09 -0700 | [diff] [blame^] | 1633 | if (!psessionEntry->gLimOlbcParams.numSta) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1634 | { |
| 1635 | if (psessionEntry->gLimOlbcParams.protectionEnabled) |
| 1636 | { |
| 1637 | if (!psessionEntry->gLim11bParams.protectionEnabled) |
| 1638 | { |
| 1639 | PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected\n"));) |
| 1640 | limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry); |
| 1641 | } |
| 1642 | } |
| 1643 | } |
| 1644 | |
| 1645 | if (!psessionEntry->gLimOverlap11gParams.numSta) |
| 1646 | { |
| 1647 | if (psessionEntry->gLimOverlap11gParams.protectionEnabled) |
| 1648 | { |
| 1649 | if (!psessionEntry->gLim11gParams.protectionEnabled) |
| 1650 | { |
| 1651 | PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected\n"));) |
| 1652 | limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry); |
| 1653 | } |
| 1654 | } |
| 1655 | } |
| 1656 | |
| 1657 | if (!psessionEntry->gLimOverlapHt20Params.numSta) |
| 1658 | { |
| 1659 | if (psessionEntry->gLimOverlapHt20Params.protectionEnabled) |
| 1660 | { |
| 1661 | if (!psessionEntry->gLimHt20Params.protectionEnabled) |
| 1662 | { |
| 1663 | PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected\n"));) |
| 1664 | limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry); |
| 1665 | } |
| 1666 | } |
| 1667 | } |
| 1668 | |
| 1669 | enable = 0; |
| 1670 | } |
| 1671 | |
| 1672 | if(beaconParams.paramChangeBitmap) |
| 1673 | { |
| 1674 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1675 | limSendBeaconParams(pMac, &beaconParams, psessionEntry); |
| 1676 | } |
| 1677 | |
| 1678 | // Start OLBC timer |
| 1679 | if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS) |
| 1680 | { |
| 1681 | limLog(pMac, LOGE, FL("tx_timer_activate failed\n")); |
| 1682 | } |
| 1683 | } |
| 1684 | #endif |
| 1685 | |
| 1686 | /** |
| 1687 | * limIsNullSsid() |
| 1688 | * |
| 1689 | *FUNCTION: |
| 1690 | * This function checks if Ssid supplied is Null SSID |
| 1691 | * |
| 1692 | * |
| 1693 | *LOGIC: |
| 1694 | * |
| 1695 | *ASSUMPTIONS: |
| 1696 | * NA |
| 1697 | * |
| 1698 | *NOTE: |
| 1699 | * NA |
| 1700 | * |
| 1701 | * @param tSirMacSSid * |
| 1702 | * |
| 1703 | * |
| 1704 | * @return true if SSID is Null SSID else false |
| 1705 | */ |
| 1706 | |
| 1707 | tANI_U8 |
| 1708 | limIsNullSsid( tSirMacSSid *pSsid ) |
| 1709 | { |
| 1710 | tANI_U8 fNullSsid = false; |
| 1711 | tANI_U32 SsidLength; |
| 1712 | tANI_U8 *pSsidStr; |
| 1713 | |
| 1714 | do |
| 1715 | { |
| 1716 | if ( 0 == pSsid->length ) |
| 1717 | { |
| 1718 | fNullSsid = true; |
| 1719 | break; |
| 1720 | } |
| 1721 | |
| 1722 | #define ASCII_SPACE_CHARACTER 0x20 |
| 1723 | /* If the first charactes is space, then check if all characters in |
| 1724 | * SSID are spaces to consider it as NULL SSID*/ |
| 1725 | if( ASCII_SPACE_CHARACTER == pSsid->ssId[0]) |
| 1726 | { |
| 1727 | SsidLength = pSsid->length; |
| 1728 | pSsidStr = pSsid->ssId; |
| 1729 | /* check if all the charactes in SSID are spaces*/ |
| 1730 | while ( SsidLength ) |
| 1731 | { |
| 1732 | if( ASCII_SPACE_CHARACTER != *pSsidStr ) |
| 1733 | break; |
| 1734 | |
| 1735 | pSsidStr++; |
| 1736 | SsidLength--; |
| 1737 | } |
| 1738 | |
| 1739 | if( 0 == SsidLength ) |
| 1740 | { |
| 1741 | fNullSsid = true; |
| 1742 | break; |
| 1743 | } |
| 1744 | } |
| 1745 | else |
| 1746 | { |
| 1747 | /* check if all the charactes in SSID are NULL*/ |
| 1748 | SsidLength = pSsid->length; |
| 1749 | pSsidStr = pSsid->ssId; |
| 1750 | |
| 1751 | while ( SsidLength ) |
| 1752 | { |
| 1753 | if( *pSsidStr ) |
| 1754 | break; |
| 1755 | |
| 1756 | pSsidStr++; |
| 1757 | SsidLength--; |
| 1758 | } |
| 1759 | |
| 1760 | if( 0 == SsidLength ) |
| 1761 | { |
| 1762 | fNullSsid = true; |
| 1763 | break; |
| 1764 | } |
| 1765 | } |
| 1766 | } |
| 1767 | while( 0 ); |
| 1768 | |
| 1769 | return fNullSsid; |
| 1770 | } /****** end limIsNullSsid() ******/ |
| 1771 | |
| 1772 | |
| 1773 | |
| 1774 | #ifdef WLAN_SOFTAP_FEATURE |
| 1775 | |
| 1776 | /** ------------------------------------------------------------- |
| 1777 | \fn limUpdateProtStaParams |
| 1778 | \brief updates protection related counters. |
| 1779 | \param tpAniSirGlobal pMac |
| 1780 | \param tSirMacAddr peerMacAddr |
| 1781 | \param tLimProtStaCacheType protStaCacheType |
| 1782 | \param tHalBitVal gfSupported |
| 1783 | \param tHalBitVal lsigTxopSupported |
| 1784 | \return None |
| 1785 | -------------------------------------------------------------*/ |
| 1786 | void |
| 1787 | limUpdateProtStaParams(tpAniSirGlobal pMac, |
| 1788 | tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType, |
| 1789 | tHalBitVal gfSupported, tHalBitVal lsigTxopSupported, |
| 1790 | tpPESession psessionEntry) |
| 1791 | { |
| 1792 | tANI_U32 i; |
| 1793 | |
| 1794 | PELOG1(limLog(pMac,LOG1, FL("A STA is associated:")); |
| 1795 | limLog(pMac,LOG1, FL("Addr : ")); |
| 1796 | limPrintMacAddr(pMac, peerMacAddr, LOG1);) |
| 1797 | |
| 1798 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1799 | { |
| 1800 | if (psessionEntry->protStaCache[i].active) |
| 1801 | { |
| 1802 | PELOG1(limLog(pMac, LOG1, FL("Addr: "));) |
| 1803 | PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);) |
| 1804 | |
| 1805 | if (palEqualMemory( pMac->hHdd, |
| 1806 | psessionEntry->protStaCache[i].addr, |
| 1807 | peerMacAddr, sizeof(tSirMacAddr))) |
| 1808 | { |
| 1809 | PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active.\n"), i);) |
| 1810 | return; |
| 1811 | } |
| 1812 | } |
| 1813 | } |
| 1814 | |
| 1815 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1816 | { |
| 1817 | if (!psessionEntry->protStaCache[i].active) |
| 1818 | break; |
| 1819 | } |
| 1820 | |
| 1821 | if (i >= LIM_PROT_STA_CACHE_SIZE) |
| 1822 | { |
| 1823 | PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache\n"));) |
| 1824 | return; |
| 1825 | } |
| 1826 | |
| 1827 | palCopyMemory( pMac->hHdd, psessionEntry->protStaCache[i].addr, |
| 1828 | peerMacAddr, |
| 1829 | sizeof(tSirMacAddr)); |
| 1830 | |
| 1831 | psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType; |
| 1832 | psessionEntry->protStaCache[i].active = true; |
| 1833 | if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType) |
| 1834 | { |
| 1835 | psessionEntry->gLim11bParams.numSta++; |
| 1836 | limLog(pMac,LOG1, FL("11B, ")); |
| 1837 | } |
| 1838 | else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType) |
| 1839 | { |
| 1840 | psessionEntry->gLim11gParams.numSta++; |
| 1841 | limLog(pMac,LOG1, FL("11G, ")); |
| 1842 | } |
| 1843 | else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType) |
| 1844 | { |
| 1845 | psessionEntry->gLimHt20Params.numSta++; |
| 1846 | limLog(pMac,LOG1, FL("HT20, ")); |
| 1847 | } |
| 1848 | |
| 1849 | if(!gfSupported) |
| 1850 | { |
| 1851 | psessionEntry->gLimNonGfParams.numSta++; |
| 1852 | limLog(pMac,LOG1, FL("NonGf, ")); |
| 1853 | } |
| 1854 | if(!lsigTxopSupported) |
| 1855 | { |
| 1856 | psessionEntry->gLimLsigTxopParams.numSta++; |
| 1857 | limLog(pMac,LOG1, FL("!lsigTxopSupported\n")); |
| 1858 | } |
| 1859 | }// --------------------------------------------------------------------- |
| 1860 | |
| 1861 | /** ------------------------------------------------------------- |
| 1862 | \fn limDecideApProtection |
| 1863 | \brief Decides all the protection related staiton coexistence and also sets |
| 1864 | \ short preamble and short slot appropriately. This function will be called |
| 1865 | \ when AP is ready to send assocRsp tp the station joining right now. |
| 1866 | \param tpAniSirGlobal pMac |
| 1867 | \param tSirMacAddr peerMacAddr |
| 1868 | \return None |
| 1869 | -------------------------------------------------------------*/ |
| 1870 | void |
| 1871 | limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 1872 | { |
| 1873 | tANI_U16 tmpAid; |
| 1874 | tpDphHashNode pStaDs; |
| 1875 | tSirRFBand rfBand = SIR_BAND_UNKNOWN; |
| 1876 | tANI_U32 phyMode; |
| 1877 | tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID; |
| 1878 | tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET; |
| 1879 | |
| 1880 | pBeaconParams->paramChangeBitmap = 0; |
| 1881 | // check whether to enable protection or not |
| 1882 | pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable); |
| 1883 | if(NULL == pStaDs) |
| 1884 | { |
| 1885 | PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL\n"));) |
| 1886 | return; |
| 1887 | } |
| 1888 | limGetRfBand(pMac, &rfBand, psessionEntry); |
| 1889 | //if we are in 5 GHZ band |
| 1890 | if(SIR_BAND_5_GHZ == rfBand) |
| 1891 | { |
| 1892 | //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ. |
| 1893 | //HT20 case is common between both the bands and handled down as common code. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1894 | if(true == psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1895 | { |
| 1896 | //we are 11N and 11A station is joining. |
| 1897 | //protection from 11A required. |
| 1898 | if(false == pStaDs->mlmStaContext.htCapability) |
| 1899 | { |
| 1900 | limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry); |
| 1901 | return; |
| 1902 | } |
| 1903 | } |
| 1904 | } |
| 1905 | else if(SIR_BAND_2_4_GHZ== rfBand) |
| 1906 | { |
| 1907 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1908 | |
| 1909 | //We are 11G. Check if we need protection from 11b Stations. |
| 1910 | if ((phyMode == WNI_CFG_PHY_MODE_11G) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1911 | (false == psessionEntry->htCapability)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1912 | { |
| 1913 | |
| 1914 | if (pStaDs->erpEnabled== eHAL_CLEAR) |
| 1915 | { |
| 1916 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB; |
| 1917 | // enable protection |
| 1918 | PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B\n"));) |
| 1919 | limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry); |
| 1920 | } |
| 1921 | } |
| 1922 | |
| 1923 | //HT station. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1924 | if (true == psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1925 | { |
| 1926 | //check if we need protection from 11b station |
| 1927 | if ((pStaDs->erpEnabled == eHAL_CLEAR) && |
| 1928 | (!pStaDs->mlmStaContext.htCapability)) |
| 1929 | { |
| 1930 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB; |
| 1931 | // enable protection |
| 1932 | PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B\n"));) |
| 1933 | limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry); |
| 1934 | } |
| 1935 | //station being joined is non-11b and non-ht ==> 11g device |
| 1936 | else if(!pStaDs->mlmStaContext.htCapability) |
| 1937 | { |
| 1938 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG; |
| 1939 | //enable protection |
| 1940 | limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry); |
| 1941 | } |
| 1942 | //ERP mode is enabled for the latest station joined |
| 1943 | //latest station joined is HT capable |
| 1944 | //This case is being handled in common code (commn between both the bands) below. |
| 1945 | } |
| 1946 | } |
| 1947 | |
| 1948 | //we are HT and HT station is joining. This code is common for both the bands. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1949 | if((true == psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1950 | (true == pStaDs->mlmStaContext.htCapability)) |
| 1951 | { |
| 1952 | if(!pStaDs->htGreenfield) |
| 1953 | { |
| 1954 | limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry); |
| 1955 | gfSupported = eHAL_CLEAR; |
| 1956 | } |
| 1957 | //Station joining is HT 20Mhz |
| 1958 | if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet) |
| 1959 | { |
| 1960 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20; |
| 1961 | limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry); |
| 1962 | } |
| 1963 | //Station joining does not support LSIG TXOP Protection |
| 1964 | if(!pStaDs->htLsigTXOPProtection) |
| 1965 | { |
| 1966 | limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry); |
| 1967 | lsigTxopSupported = eHAL_CLEAR; |
| 1968 | } |
| 1969 | } |
| 1970 | |
| 1971 | limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType, |
| 1972 | gfSupported, lsigTxopSupported, psessionEntry); |
| 1973 | |
| 1974 | return; |
| 1975 | } |
| 1976 | #endif |
| 1977 | |
| 1978 | |
| 1979 | /** ------------------------------------------------------------- |
| 1980 | \fn limEnableOverlap11gProtection |
| 1981 | \brief wrapper function for setting overlap 11g protection. |
| 1982 | \param tpAniSirGlobal pMac |
| 1983 | \param tpUpdateBeaconParams pBeaconParams |
| 1984 | \param tpSirMacMgmtHdr pMh |
| 1985 | \return None |
| 1986 | -------------------------------------------------------------*/ |
| 1987 | void |
| 1988 | limEnableOverlap11gProtection(tpAniSirGlobal pMac, |
| 1989 | tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry) |
| 1990 | { |
| 1991 | limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams)); |
| 1992 | |
| 1993 | if (psessionEntry->gLimOlbcParams.numSta && |
| 1994 | !psessionEntry->gLimOlbcParams.protectionEnabled) |
| 1995 | { |
| 1996 | // enable protection |
| 1997 | PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!\n"));) |
| 1998 | limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry); |
| 1999 | } |
| 2000 | } |
| 2001 | |
| 2002 | |
| 2003 | /** ------------------------------------------------------------- |
| 2004 | \fn limUpdateShortPreamble |
| 2005 | \brief Updates short preamble if needed when a new station joins. |
| 2006 | \param tpAniSirGlobal pMac |
| 2007 | \param tSirMacAddr peerMacAddr |
| 2008 | \param tpUpdateBeaconParams pBeaconParams |
| 2009 | \return None |
| 2010 | -------------------------------------------------------------*/ |
| 2011 | void |
| 2012 | limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 2013 | tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 2014 | { |
| 2015 | tANI_U16 tmpAid; |
| 2016 | tpDphHashNode pStaDs; |
| 2017 | tANI_U32 phyMode; |
| 2018 | tANI_U16 i; |
| 2019 | |
| 2020 | // check whether to enable protection or not |
| 2021 | pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable); |
| 2022 | |
| 2023 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2024 | |
| 2025 | if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G) |
| 2026 | |
| 2027 | { |
| 2028 | if (pStaDs->shortPreambleEnabled == eHAL_CLEAR) |
| 2029 | { |
| 2030 | PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from ")); |
| 2031 | limPrintMacAddr(pMac, peerMacAddr, LOG1);) |
| 2032 | |
| 2033 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 2034 | { |
| 2035 | #ifdef WLAN_SOFTAP_FEATURE |
| 2036 | if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 2037 | psessionEntry->gLimNoShortParams.staNoShortCache[i].active) |
| 2038 | { |
| 2039 | if (palEqualMemory( pMac->hHdd, |
| 2040 | psessionEntry->gLimNoShortParams.staNoShortCache[i].addr, |
| 2041 | peerMacAddr, sizeof(tSirMacAddr))) |
| 2042 | return; |
| 2043 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 2044 | #endif |
| 2045 | { |
| 2046 | if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active) |
| 2047 | { |
| 2048 | if (palEqualMemory( pMac->hHdd, |
| 2049 | pMac->lim.gLimNoShortParams.staNoShortCache[i].addr, |
| 2050 | peerMacAddr, sizeof(tSirMacAddr))) |
| 2051 | return; |
| 2052 | } |
| 2053 | } |
| 2054 | } |
| 2055 | |
| 2056 | |
| 2057 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 2058 | { |
| 2059 | #ifdef WLAN_SOFTAP_FEATURE |
| 2060 | if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 2061 | !psessionEntry->gLimNoShortParams.staNoShortCache[i].active) |
| 2062 | break; |
| 2063 | else |
| 2064 | #endif |
| 2065 | { |
| 2066 | if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active) |
| 2067 | break; |
| 2068 | } |
| 2069 | } |
| 2070 | |
| 2071 | if (i >= LIM_PROT_STA_CACHE_SIZE) |
| 2072 | { |
| 2073 | #ifdef WLAN_SOFTAP_FEATURE |
| 2074 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 2075 | limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "), |
| 2076 | i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta); |
| 2077 | limPrintMacAddr(pMac, peerMacAddr, LOGE); |
| 2078 | return; |
| 2079 | } |
| 2080 | else |
| 2081 | #endif |
| 2082 | { |
| 2083 | limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "), |
| 2084 | i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta); |
| 2085 | limPrintMacAddr(pMac, peerMacAddr, LOGE); |
| 2086 | return; |
| 2087 | } |
| 2088 | |
| 2089 | } |
| 2090 | |
| 2091 | |
| 2092 | #ifdef WLAN_SOFTAP_FEATURE |
| 2093 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 2094 | palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr, |
| 2095 | peerMacAddr, sizeof(tSirMacAddr)); |
| 2096 | psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true; |
| 2097 | psessionEntry->gLimNoShortParams.numNonShortPreambleSta++; |
| 2098 | }else |
| 2099 | #endif |
| 2100 | { |
| 2101 | palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortParams.staNoShortCache[i].addr, |
| 2102 | peerMacAddr, sizeof(tSirMacAddr)); |
| 2103 | pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true; |
| 2104 | pMac->lim.gLimNoShortParams.numNonShortPreambleSta++; |
| 2105 | } |
| 2106 | |
| 2107 | |
| 2108 | // enable long preamble |
| 2109 | PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble\n"));) |
| 2110 | |
| 2111 | #ifdef WLAN_SOFTAP_FEATURE |
| 2112 | if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS) |
| 2113 | PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble\n"));) |
| 2114 | #else |
| 2115 | if (limEnableShortPreamble(pMac, false, pBeaconParams) != eSIR_SUCCESS) |
| 2116 | PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble\n"));) |
| 2117 | |
| 2118 | #endif |
| 2119 | } |
| 2120 | } |
| 2121 | } |
| 2122 | |
| 2123 | /** ------------------------------------------------------------- |
| 2124 | \fn limUpdateShortSlotTime |
| 2125 | \brief Updates short slot time if needed when a new station joins. |
| 2126 | \param tpAniSirGlobal pMac |
| 2127 | \param tSirMacAddr peerMacAddr |
| 2128 | \param tpUpdateBeaconParams pBeaconParams |
| 2129 | \return None |
| 2130 | -------------------------------------------------------------*/ |
| 2131 | |
| 2132 | void |
| 2133 | limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, |
| 2134 | tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 2135 | { |
| 2136 | tANI_U16 tmpAid; |
| 2137 | tpDphHashNode pStaDs; |
| 2138 | tANI_U32 phyMode; |
| 2139 | tANI_U32 val; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | tANI_U16 i; |
| 2141 | |
| 2142 | // check whether to enable protection or not |
| 2143 | pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable); |
| 2144 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2145 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2146 | /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should |
| 2147 | * be always 1 and in 11b case, it should be always 0 |
| 2148 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G) |
| 2150 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2151 | /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings |
| 2152 | * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of |
| 2153 | * it in limDecideShortSlot |
| 2154 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2155 | if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR) |
| 2156 | { |
| 2157 | PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from ")); |
| 2158 | limPrintMacAddr(pMac, peerMacAddr, LOG1);) |
| 2159 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 2160 | { |
| 2161 | #ifdef WLAN_SOFTAP_FEATURE |
| 2162 | if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 2163 | psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active) |
| 2164 | { |
| 2165 | if (palEqualMemory( pMac->hHdd, |
| 2166 | psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr, |
| 2167 | peerMacAddr, sizeof(tSirMacAddr))) |
| 2168 | return; |
| 2169 | } |
| 2170 | else if(psessionEntry->limSystemRole != eLIM_AP_ROLE ) |
| 2171 | #endif |
| 2172 | { |
| 2173 | if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active) |
| 2174 | { |
| 2175 | if (palEqualMemory( pMac->hHdd, |
| 2176 | pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr, |
| 2177 | peerMacAddr, sizeof(tSirMacAddr))) |
| 2178 | return; |
| 2179 | } |
| 2180 | } |
| 2181 | } |
| 2182 | |
| 2183 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 2184 | { |
| 2185 | #ifdef WLAN_SOFTAP_FEATURE |
| 2186 | if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 2187 | !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active) |
| 2188 | break; |
| 2189 | else |
| 2190 | #endif |
| 2191 | { |
| 2192 | if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active) |
| 2193 | break; |
| 2194 | } |
| 2195 | } |
| 2196 | |
| 2197 | if (i >= LIM_PROT_STA_CACHE_SIZE) |
| 2198 | { |
| 2199 | #ifdef WLAN_SOFTAP_FEATURE |
| 2200 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 2201 | limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "), |
| 2202 | i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta); |
| 2203 | limPrintMacAddr(pMac, peerMacAddr, LOGE); |
| 2204 | return; |
| 2205 | }else |
| 2206 | #endif |
| 2207 | { |
| 2208 | limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "), |
| 2209 | i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta); |
| 2210 | limPrintMacAddr(pMac, peerMacAddr, LOGE); |
| 2211 | return; |
| 2212 | } |
| 2213 | } |
| 2214 | |
| 2215 | |
| 2216 | #ifdef WLAN_SOFTAP_FEATURE |
| 2217 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 2218 | palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr, |
| 2219 | peerMacAddr, sizeof(tSirMacAddr)); |
| 2220 | psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true; |
| 2221 | psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++; |
| 2222 | }else |
| 2223 | #endif |
| 2224 | { |
| 2225 | palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr, |
| 2226 | peerMacAddr, sizeof(tSirMacAddr)); |
| 2227 | pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true; |
| 2228 | pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++; |
| 2229 | } |
| 2230 | wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val); |
| 2231 | |
| 2232 | #ifdef WLAN_SOFTAP_FEATURE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2233 | /* Here we check if we are AP role and short slot enabled (both admin and oper modes) but we have atleast one STA connected with |
| 2234 | * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled |
| 2235 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2236 | if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2237 | (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2238 | { |
| 2239 | // enable long slot time |
| 2240 | pBeaconParams->fShortSlotTime = false; |
| 2241 | pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED; |
| 2242 | PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2243 | psessionEntry->shortSlotTimeSupported = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2244 | } |
| 2245 | else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 2246 | #endif |
| 2247 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2248 | if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2249 | { |
| 2250 | // enable long slot time |
| 2251 | pBeaconParams->fShortSlotTime = false; |
| 2252 | pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED; |
| 2253 | PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time.\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2254 | psessionEntry->shortSlotTimeSupported = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2255 | } |
| 2256 | } |
| 2257 | } |
| 2258 | } |
| 2259 | } |
| 2260 | |
| 2261 | #if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined (ANI_PRODUCT_TYPE_AP) |
| 2262 | /** |
| 2263 | * limDetectRadar() |
| 2264 | * |
| 2265 | *FUNCTION: |
| 2266 | * This function is invoked when LIM receives |
| 2267 | * SIR_LIM_RADAR_DETECT_IND in lim mesage queue. |
| 2268 | * LIM will notify WSM of this event by sending |
| 2269 | * WSM the wireless medium status change |
| 2270 | * notification message. |
| 2271 | * |
| 2272 | * |
| 2273 | *LOGIC: |
| 2274 | * |
| 2275 | *ASSUMPTIONS: |
| 2276 | * NA |
| 2277 | * |
| 2278 | *NOTE: |
| 2279 | * NA |
| 2280 | * |
| 2281 | * @param pMac - Pointer to Global MAC structure |
| 2282 | * @param message - a tSirRadarInfo struct type message send by HAL. |
| 2283 | * This message is not serialized. |
| 2284 | * |
| 2285 | * @return None |
| 2286 | */ |
| 2287 | |
| 2288 | void |
| 2289 | limDetectRadar(tpAniSirGlobal pMac, tANI_U32 *pMsg) |
| 2290 | { |
| 2291 | tpSirRadarInfo pRadarInfo; |
| 2292 | |
| 2293 | if (!pMsg) |
| 2294 | { |
| 2295 | limLog(pMac, LOGP, FL("Message is NULL\n")); |
| 2296 | return; |
| 2297 | } |
| 2298 | |
| 2299 | pRadarInfo = (tpSirRadarInfo)pMsg; |
| 2300 | |
| 2301 | if ((pMac->lim.gLimCurrentChannelId == pRadarInfo->channelNumber) && |
| 2302 | (pMac->lim.gLimSystemRole != eLIM_UNKNOWN_ROLE)) |
| 2303 | { |
| 2304 | LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_TRUE); |
| 2305 | limStopMeasTimers(pMac); |
| 2306 | /* Stop the transmission of all packets except beacons. |
| 2307 | * This is done here, assuming that we will definitely get a channel switch |
| 2308 | * request from WSM. |
| 2309 | */ |
| 2310 | PELOG1(limLog(pMac, LOG1, "Stopping the transmission on AP\n");) |
| 2311 | limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_STOP_TX); |
| 2312 | } |
| 2313 | |
| 2314 | PELOG1(limLog(pMac, LOG1, |
| 2315 | FL("limDetectRadar():: pulsewidth = %d, numPulse=%d, channelId=%d\n"), |
| 2316 | pRadarInfo->radarPulseWidth, pRadarInfo->numRadarPulse, |
| 2317 | pRadarInfo->channelNumber);) |
| 2318 | |
| 2319 | limSendSmeWmStatusChangeNtf(pMac, |
| 2320 | eSIR_SME_RADAR_DETECTED, |
| 2321 | pMsg, |
| 2322 | (tANI_U16)sizeof(*pRadarInfo),0); |
| 2323 | |
| 2324 | } |
| 2325 | #endif |
| 2326 | |
| 2327 | # if 0 |
| 2328 | //TBD_RAJESH :: TO SOLVE LINKING ISSUE |
| 2329 | void |
| 2330 | limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, //dummy to avoid linking problem |
| 2331 | tpUpdateBeaconParams pBeaconParams) |
| 2332 | { |
| 2333 | |
| 2334 | } |
| 2335 | |
| 2336 | //TBD_RAJESH :: TO SOLVE LINKING ISSUE |
| 2337 | void |
| 2338 | limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, //dummy to avoid linking problem |
| 2339 | tpUpdateBeaconParams pBeaconParams) |
| 2340 | |
| 2341 | { |
| 2342 | } |
| 2343 | |
| 2344 | //TBD_RAJESH :: TO SOLVE LINKING ISSUE |
| 2345 | |
| 2346 | void //dummy to avoid linking problem |
| 2347 | limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 2348 | { |
| 2349 | } |
| 2350 | |
| 2351 | #endif |
| 2352 | |
| 2353 | |
| 2354 | /** ------------------------------------------------------------- |
| 2355 | \fn limDecideStaProtectionOnAssoc |
| 2356 | \brief Decide protection related settings on Sta while association. |
| 2357 | \param tpAniSirGlobal pMac |
| 2358 | \param tpSchBeaconStruct pBeaconStruct |
| 2359 | \return None |
| 2360 | -------------------------------------------------------------*/ |
| 2361 | void |
| 2362 | limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac, |
| 2363 | tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry) |
| 2364 | { |
| 2365 | tSirRFBand rfBand = SIR_BAND_UNKNOWN; |
| 2366 | tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE; |
| 2367 | |
| 2368 | limGetRfBand(pMac, &rfBand, psessionEntry); |
| 2369 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2370 | |
| 2371 | if(SIR_BAND_5_GHZ == rfBand) |
| 2372 | { |
| 2373 | if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) || |
| 2374 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode)) |
| 2375 | { |
| 2376 | if(pMac->lim.cfgProtection.fromlla) |
| 2377 | psessionEntry->beaconParams.llaCoexist = true; |
| 2378 | } |
| 2379 | else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode) |
| 2380 | { |
| 2381 | if(pMac->lim.cfgProtection.ht20) |
| 2382 | psessionEntry->beaconParams.ht20Coexist = true; |
| 2383 | } |
| 2384 | |
| 2385 | } |
| 2386 | else if(SIR_BAND_2_4_GHZ == rfBand) |
| 2387 | { |
| 2388 | //spec 7.3.2.13 |
| 2389 | //UseProtection will be set when nonERP STA is associated. |
| 2390 | //NonERPPresent bit will be set when: |
| 2391 | //--nonERP Sta is associated OR |
| 2392 | //--nonERP Sta exists in overlapping BSS |
| 2393 | //when useProtection is not set then protection from nonERP stations is optional. |
| 2394 | |
| 2395 | //CFG protection from 11b is enabled and |
| 2396 | //11B device in the BSS |
| 2397 | /* TODO, This is not sessionized */ |
| 2398 | if (phyMode != WNI_CFG_PHY_MODE_11B) |
| 2399 | { |
| 2400 | if (pMac->lim.cfgProtection.fromllb && |
| 2401 | pBeaconStruct->erpPresent && |
| 2402 | (pBeaconStruct->erpIEInfo.useProtection || |
| 2403 | pBeaconStruct->erpIEInfo.nonErpPresent)) |
| 2404 | { |
| 2405 | psessionEntry->beaconParams.llbCoexist = true; |
| 2406 | } |
| 2407 | //AP has no 11b station associated. |
| 2408 | else |
| 2409 | { |
| 2410 | psessionEntry->beaconParams.llbCoexist = false; |
| 2411 | } |
| 2412 | } |
| 2413 | //following code block is only for HT station. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2414 | if((psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2415 | (pBeaconStruct->HTInfo.present)) |
| 2416 | { |
| 2417 | tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo; |
| 2418 | |
| 2419 | //Obss Non HT STA present mode |
| 2420 | psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent; |
| 2421 | |
| 2422 | |
| 2423 | //CFG protection from 11G is enabled and |
| 2424 | //our AP has at least one 11G station associated. |
| 2425 | if(pMac->lim.cfgProtection.fromllg && |
| 2426 | ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) || |
| 2427 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&& |
| 2428 | (!psessionEntry->beaconParams.llbCoexist)) |
| 2429 | { |
| 2430 | if(pMac->lim.cfgProtection.fromllg) |
| 2431 | psessionEntry->beaconParams.llgCoexist = true; |
| 2432 | } |
| 2433 | |
| 2434 | //AP has only HT stations associated and at least one station is HT 20 |
| 2435 | //disable protection from any non-HT devices. |
| 2436 | //decision for disabling protection from 11b has already been taken above. |
| 2437 | if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode) |
| 2438 | { |
| 2439 | //Disable protection from 11G station. |
| 2440 | psessionEntry->beaconParams.llgCoexist = false; |
| 2441 | //CFG protection from HT 20 is enabled. |
| 2442 | if(pMac->lim.cfgProtection.ht20) |
| 2443 | psessionEntry->beaconParams.ht20Coexist = true; |
| 2444 | } |
| 2445 | //Disable protection from non-HT and HT20 devices. |
| 2446 | //decision for disabling protection from 11b has already been taken above. |
| 2447 | if(eSIR_HT_OP_MODE_PURE == htInfo.opMode) |
| 2448 | { |
| 2449 | psessionEntry->beaconParams.llgCoexist = false; |
| 2450 | psessionEntry->beaconParams.ht20Coexist = false; |
| 2451 | } |
| 2452 | |
| 2453 | } |
| 2454 | } |
| 2455 | |
| 2456 | //protection related factors other than HT operating mode. Applies to 2.4 GHZ as well as 5 GHZ. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2457 | if((psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2458 | (pBeaconStruct->HTInfo.present)) |
| 2459 | { |
| 2460 | tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo; |
| 2461 | psessionEntry->beaconParams.fRIFSMode = |
| 2462 | ( tANI_U8 ) htInfo.rifsMode; |
| 2463 | psessionEntry->beaconParams.llnNonGFCoexist = |
| 2464 | ( tANI_U8 )htInfo.nonGFDevicesPresent; |
| 2465 | psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = |
| 2466 | ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport; |
| 2467 | } |
| 2468 | } |
| 2469 | |
| 2470 | |
| 2471 | /** ------------------------------------------------------------- |
| 2472 | \fn limDecideStaProtection |
| 2473 | \brief Decides protection related settings on Sta while processing beacon. |
| 2474 | \param tpAniSirGlobal pMac |
| 2475 | \param tpUpdateBeaconParams pBeaconParams |
| 2476 | \return None |
| 2477 | -------------------------------------------------------------*/ |
| 2478 | void |
| 2479 | limDecideStaProtection(tpAniSirGlobal pMac, |
| 2480 | tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 2481 | { |
| 2482 | |
| 2483 | tSirRFBand rfBand = SIR_BAND_UNKNOWN; |
| 2484 | tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE; |
| 2485 | |
| 2486 | limGetRfBand(pMac, &rfBand, psessionEntry); |
| 2487 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2488 | |
| 2489 | if(SIR_BAND_5_GHZ == rfBand) |
| 2490 | { |
| 2491 | //we are HT capable. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2492 | if((true == psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2493 | (pBeaconStruct->HTInfo.present)) |
| 2494 | { |
| 2495 | //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A. |
| 2496 | if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) || |
| 2497 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode)) |
| 2498 | { |
| 2499 | limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry); |
| 2500 | } |
| 2501 | //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled |
| 2502 | //protection from HT20 if needed. |
| 2503 | else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode) |
| 2504 | { |
| 2505 | limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry); |
| 2506 | limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry); |
| 2507 | } |
| 2508 | else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode) |
| 2509 | { |
| 2510 | limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry); |
| 2511 | limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry); |
| 2512 | } |
| 2513 | } |
| 2514 | } |
| 2515 | else if(SIR_BAND_2_4_GHZ == rfBand) |
| 2516 | { |
| 2517 | /* spec 7.3.2.13 |
| 2518 | * UseProtection will be set when nonERP STA is associated. |
| 2519 | * NonERPPresent bit will be set when: |
| 2520 | * --nonERP Sta is associated OR |
| 2521 | * --nonERP Sta exists in overlapping BSS |
| 2522 | * when useProtection is not set then protection from nonERP stations is optional. |
| 2523 | */ |
| 2524 | |
| 2525 | if (phyMode != WNI_CFG_PHY_MODE_11B) |
| 2526 | { |
| 2527 | if (pBeaconStruct->erpPresent && |
| 2528 | (pBeaconStruct->erpIEInfo.useProtection || |
| 2529 | pBeaconStruct->erpIEInfo.nonErpPresent)) |
| 2530 | { |
| 2531 | limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry); |
| 2532 | } |
| 2533 | //AP has no 11b station associated. |
| 2534 | else |
| 2535 | { |
| 2536 | //disable protection from 11b station |
| 2537 | limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry); |
| 2538 | } |
| 2539 | } |
| 2540 | |
| 2541 | //following code block is only for HT station. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2542 | if((psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2543 | (pBeaconStruct->HTInfo.present)) |
| 2544 | { |
| 2545 | |
| 2546 | tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo; |
| 2547 | //AP has at least one 11G station associated. |
| 2548 | if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) || |
| 2549 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&& |
| 2550 | (!psessionEntry->beaconParams.llbCoexist)) |
| 2551 | { |
| 2552 | limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry); |
| 2553 | |
| 2554 | } |
| 2555 | |
| 2556 | //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode. |
| 2557 | //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist |
| 2558 | //or 11gCoexist. that is why this check is being done after mixed/legacy mode check. |
| 2559 | if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode ) |
| 2560 | { |
| 2561 | pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode; |
| 2562 | |
| 2563 | //AP has only HT stations associated and at least one station is HT 20 |
| 2564 | //disable protection from any non-HT devices. |
| 2565 | //decision for disabling protection from 11b has already been taken above. |
| 2566 | if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode) |
| 2567 | { |
| 2568 | //Disable protection from 11G station. |
| 2569 | limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry); |
| 2570 | |
| 2571 | limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry); |
| 2572 | } |
| 2573 | //Disable protection from non-HT and HT20 devices. |
| 2574 | //decision for disabling protection from 11b has already been taken above. |
| 2575 | else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode) |
| 2576 | { |
| 2577 | limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry); |
| 2578 | limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry); |
| 2579 | |
| 2580 | } |
| 2581 | } |
| 2582 | } |
| 2583 | } |
| 2584 | |
| 2585 | //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2586 | if((psessionEntry->htCapability) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2587 | (pBeaconStruct->HTInfo.present)) |
| 2588 | { |
| 2589 | tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo; |
| 2590 | //Check for changes in protection related factors other than HT operating mode. |
| 2591 | //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport. |
| 2592 | if ( psessionEntry->beaconParams.fRIFSMode != |
| 2593 | ( tANI_U8 ) htInfo.rifsMode ) |
| 2594 | { |
| 2595 | pBeaconParams->fRIFSMode = |
| 2596 | psessionEntry->beaconParams.fRIFSMode = |
| 2597 | ( tANI_U8 ) htInfo.rifsMode; |
| 2598 | pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED; |
| 2599 | } |
| 2600 | |
| 2601 | if ( psessionEntry->beaconParams.llnNonGFCoexist != |
| 2602 | htInfo.nonGFDevicesPresent ) |
| 2603 | { |
| 2604 | pBeaconParams->llnNonGFCoexist = |
| 2605 | psessionEntry->beaconParams.llnNonGFCoexist = |
| 2606 | ( tANI_U8 )htInfo.nonGFDevicesPresent; |
| 2607 | pBeaconParams->paramChangeBitmap |= |
| 2608 | PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 2609 | } |
| 2610 | |
| 2611 | if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != |
| 2612 | ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport ) |
| 2613 | { |
| 2614 | pBeaconParams->fLsigTXOPProtectionFullSupport = |
| 2615 | psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = |
| 2616 | ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport; |
| 2617 | pBeaconParams->paramChangeBitmap |= |
| 2618 | PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 2619 | } |
| 2620 | |
| 2621 | // For Station just update the global lim variable, no need to send message to HAL |
| 2622 | // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy |
| 2623 | //stations in overlapping BSS. |
| 2624 | if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent ) |
| 2625 | psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ; |
| 2626 | |
| 2627 | } |
| 2628 | } |
| 2629 | |
| 2630 | |
| 2631 | /** |
| 2632 | * limProcessChannelSwitchTimeout() |
| 2633 | * |
| 2634 | *FUNCTION: |
| 2635 | * This function is invoked when Channel Switch Timer expires at |
| 2636 | * the STA. Now, STA must stop traffic, and then change/disable |
| 2637 | * primary or secondary channel. |
| 2638 | * |
| 2639 | * |
| 2640 | *NOTE: |
| 2641 | * @param pMac - Pointer to Global MAC structure |
| 2642 | * @return None |
| 2643 | */ |
| 2644 | void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac) |
| 2645 | { |
| 2646 | tpPESession psessionEntry = NULL; |
| 2647 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2648 | tANI_U8 channel; // This is received and stored from channelSwitch Action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2649 | |
| 2650 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) |
| 2651 | { |
| 2652 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
| 2653 | return; |
| 2654 | } |
| 2655 | |
| 2656 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 2657 | { |
| 2658 | PELOGW(limLog(pMac, LOGW, "Channel switch can be done only in STA role, Current Role = %d\n", psessionEntry->limSystemRole);) |
| 2659 | return; |
| 2660 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2661 | channel = psessionEntry->gLimChannelSwitch.primaryChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2662 | /* |
| 2663 | * This potentially can create issues if the function tries to set |
| 2664 | * channel while device is in power-save, hence putting an extra check |
| 2665 | * to verify if the device is in power-save or not |
| 2666 | */ |
| 2667 | if(!limIsSystemInActiveState(pMac)) |
| 2668 | { |
| 2669 | PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel\n"));) |
| 2670 | return; |
| 2671 | } |
| 2672 | |
| 2673 | // Restore Channel Switch parameters to default |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2674 | psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2675 | |
| 2676 | /* Channel-switch timeout has occurred. reset the state */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2677 | psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2678 | |
| 2679 | /* Check if the AP is switching to a channel that we support. |
| 2680 | * Else, just don't bother to switch. Indicate HDD to look for a |
| 2681 | * better AP to associate |
| 2682 | */ |
| 2683 | if(!limIsChannelValidForChannelSwitch(pMac, channel)) |
| 2684 | { |
| 2685 | /* We need to restore pre-channelSwitch state on the STA */ |
| 2686 | if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS) |
| 2687 | { |
| 2688 | limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system\n")); |
| 2689 | return; |
| 2690 | } |
| 2691 | |
| 2692 | /* If the channel-list that AP is asking us to switch is invalid, |
| 2693 | * then we cannot switch the channel. Just disassociate from AP. |
| 2694 | * We will find a better AP !!! |
| 2695 | */ |
| 2696 | limTearDownLinkWithAp(pMac, |
| 2697 | pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId, |
| 2698 | eSIR_MAC_UNSPEC_FAILURE_REASON); |
| 2699 | return; |
| 2700 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2701 | switch(psessionEntry->gLimChannelSwitch.state) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2702 | { |
| 2703 | case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY: |
| 2704 | PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY \n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2705 | limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry); |
| 2706 | psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2707 | break; |
| 2708 | |
| 2709 | case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY: |
| 2710 | PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY \n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2711 | limSwitchPrimarySecondaryChannel(pMac, psessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2712 | psessionEntry->currentOperChannel, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2713 | psessionEntry->gLimChannelSwitch.secondarySubBand); |
| 2714 | psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2715 | break; |
| 2716 | |
| 2717 | case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY: |
| 2718 | PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2719 | limSwitchPrimarySecondaryChannel(pMac, psessionEntry, |
| 2720 | psessionEntry->gLimChannelSwitch.primaryChannel, |
| 2721 | psessionEntry->gLimChannelSwitch.secondarySubBand); |
| 2722 | psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2723 | break; |
| 2724 | |
| 2725 | case eLIM_CHANNEL_SWITCH_IDLE: |
| 2726 | default: |
| 2727 | PELOGE(limLog(pMac, LOGE, FL("incorrect state \n"));) |
| 2728 | if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS) |
| 2729 | { |
| 2730 | limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system\n")); |
| 2731 | } |
| 2732 | return; /* Please note, this is 'return' and not 'break' */ |
| 2733 | } |
| 2734 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2735 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2736 | |
| 2737 | /** |
| 2738 | * limUpdateChannelSwitch() |
| 2739 | * |
| 2740 | *FUNCTION: |
| 2741 | * This function is invoked whenever Station receives |
| 2742 | * either 802.11h channel switch IE or airgo proprietary |
| 2743 | * channel switch IE. |
| 2744 | * |
| 2745 | *NOTE: |
| 2746 | * @param pMac - Pointer to Global MAC structure |
| 2747 | * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp |
| 2748 | * @param psessionentry |
| 2749 | */ |
| 2750 | void |
| 2751 | limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry) |
| 2752 | { |
| 2753 | |
| 2754 | tANI_U16 beaconPeriod; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2755 | tChannelSwitchPropIEStruct *pPropChnlSwitch; |
| 2756 | tDot11fIEChanSwitchAnn *pChnlSwitch; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2757 | #ifdef WLAN_FEATURE_11AC |
| 2758 | tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch; |
| 2759 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2760 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2761 | beaconPeriod = psessionEntry->beaconParams.beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2762 | |
| 2763 | /* STA either received proprietary channel switch IE or 802.11h |
| 2764 | * standard channel switch IE. |
| 2765 | */ |
| 2766 | if (pBeacon->propIEinfo.propChannelSwitchPresent) |
| 2767 | { |
| 2768 | pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch); |
| 2769 | |
| 2770 | /* Add logic to determine which change this is: */ |
| 2771 | /* primary, secondary, both. For now assume both. */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2772 | psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2773 | psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel; |
| 2774 | psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand; |
| 2775 | psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount; |
| 2776 | psessionEntry->gLimChannelSwitch.switchTimeoutValue = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2777 | SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2778 | psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2779 | } |
| 2780 | else |
| 2781 | { |
| 2782 | pChnlSwitch = &(pBeacon->channelSwitchIE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2783 | psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel; |
| 2784 | psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount; |
| 2785 | psessionEntry->gLimChannelSwitch.switchTimeoutValue = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2786 | SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2787 | psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2788 | #ifdef WLAN_FEATURE_11AC |
| 2789 | pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn); |
| 2790 | if(pBeacon->WiderBWChanSwitchAnnPresent) |
| 2791 | { |
| 2792 | psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth; |
| 2793 | psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0; |
| 2794 | psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1; |
| 2795 | } |
| 2796 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2797 | |
| 2798 | /* Only primary channel switch element is present */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2799 | psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2800 | psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2801 | |
| 2802 | /* Do not bother to look and operate on extended channel switch element |
| 2803 | * if our own channel-bonding state is not enabled |
| 2804 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2805 | if (psessionEntry->htSupportedChannelWidthSet) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2806 | { |
| 2807 | if (pBeacon->extChannelSwitchPresent) |
| 2808 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2809 | if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) || |
| 2810 | (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2811 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2812 | psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2813 | psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2814 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2815 | #ifdef WLAN_FEATURE_11AC |
| 2816 | if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent) |
| 2817 | { |
| 2818 | if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) |
| 2819 | { |
| 2820 | if(pBeacon->extChannelSwitchPresent) |
| 2821 | { |
| 2822 | if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) || |
| 2823 | (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)) |
| 2824 | { |
| 2825 | psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2826 | psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac, |
| 2827 | psessionEntry->gLimChannelSwitch.primaryChannel, |
| 2828 | pBeacon->extChannelSwitchIE.secondaryChannelOffset, |
| 2829 | pWiderChnlSwitch->newCenterChanFreq0, |
| 2830 | psessionEntry); |
| 2831 | } |
| 2832 | } |
| 2833 | } |
| 2834 | } |
| 2835 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2836 | } |
| 2837 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2838 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2839 | if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry)) |
| 2840 | { |
| 2841 | PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch\n"));) |
| 2842 | } |
| 2843 | |
| 2844 | limLog(pMac, LOGW, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2845 | FL("session %d primary chl %d, subband %d, count %d (%d ticks) \n"), |
| 2846 | psessionEntry->peSessionId, |
| 2847 | psessionEntry->gLimChannelSwitch.primaryChannel, |
| 2848 | psessionEntry->gLimChannelSwitch.secondarySubBand, |
| 2849 | psessionEntry->gLimChannelSwitch.switchCount, |
| 2850 | psessionEntry->gLimChannelSwitch.switchTimeoutValue); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2851 | return; |
| 2852 | } |
| 2853 | |
| 2854 | /** |
| 2855 | * limCancelDot11hChannelSwitch |
| 2856 | * |
| 2857 | *FUNCTION: |
| 2858 | * This function is called when STA does not send updated channel-swith IE |
| 2859 | * after indicating channel-switch start. This will cancel the channel-swith |
| 2860 | * timer which is already running. |
| 2861 | * |
| 2862 | *LOGIC: |
| 2863 | * |
| 2864 | *ASSUMPTIONS: |
| 2865 | * |
| 2866 | *NOTE: |
| 2867 | * |
| 2868 | * @param pMac - Pointer to Global MAC structure |
| 2869 | * |
| 2870 | * @return None |
| 2871 | */ |
| 2872 | void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 2873 | { |
| 2874 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 2875 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 2876 | return; |
| 2877 | |
| 2878 | PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2879 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | |
| 2881 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS) |
| 2882 | { |
| 2883 | PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!\n"));) |
| 2884 | } |
| 2885 | |
| 2886 | /* We need to restore pre-channelSwitch state on the STA */ |
| 2887 | if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS) |
| 2888 | { |
| 2889 | PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, reseting the system\n"));) |
| 2890 | |
| 2891 | } |
| 2892 | #endif |
| 2893 | } |
| 2894 | |
| 2895 | /**---------------------------------------------- |
| 2896 | \fn limCancelDot11hQuiet |
| 2897 | \brief Cancel the quieting on Station if latest |
| 2898 | beacon doesn't contain quiet IE in it. |
| 2899 | |
| 2900 | \param pMac |
| 2901 | \return NONE |
| 2902 | -----------------------------------------------*/ |
| 2903 | void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 2904 | { |
| 2905 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 2906 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 2907 | return; |
| 2908 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2909 | if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2910 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2911 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2912 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS) |
| 2913 | { |
| 2914 | PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));) |
| 2915 | } |
| 2916 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2917 | else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2918 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2919 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2920 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS) |
| 2921 | { |
| 2922 | PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed\n"));) |
| 2923 | } |
| 2924 | /** |
| 2925 | * If the channel switch is already running in silent mode, dont resume the |
| 2926 | * transmission. Channel switch timer when timeout, transmission will be resumed. |
| 2927 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2928 | if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) && |
| 2929 | (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2930 | { |
| 2931 | limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2932 | limRestorePreQuietState(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2933 | } |
| 2934 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2935 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2936 | #endif |
| 2937 | } |
| 2938 | |
| 2939 | /** |
| 2940 | * limProcessQuietTimeout |
| 2941 | * |
| 2942 | * FUNCTION: |
| 2943 | * This function is active only on the STA. |
| 2944 | * Handles SIR_LIM_QUIET_TIMEOUT |
| 2945 | * |
| 2946 | * LOGIC: |
| 2947 | * This timeout can occur under only one circumstance: |
| 2948 | * |
| 2949 | * 1) When gLimQuietState = eLIM_QUIET_BEGIN |
| 2950 | * This indicates that the timeout "interval" has |
| 2951 | * expired. This is a trigger for the STA to now |
| 2952 | * shut-off Tx/Rx for the specified gLimQuietDuration |
| 2953 | * -> The TIMER object gLimQuietBssTimer is |
| 2954 | * activated |
| 2955 | * -> With timeout = gLimQuietDuration |
| 2956 | * -> gLimQuietState is set to eLIM_QUIET_RUNNING |
| 2957 | * |
| 2958 | * ASSUMPTIONS: |
| 2959 | * Using two TIMER objects - |
| 2960 | * gLimQuietTimer & gLimQuietBssTimer |
| 2961 | * |
| 2962 | * NOTE: |
| 2963 | * |
| 2964 | * @param pMac - Pointer to Global MAC structure |
| 2965 | * |
| 2966 | * @return None |
| 2967 | */ |
| 2968 | void limProcessQuietTimeout(tpAniSirGlobal pMac) |
| 2969 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2970 | //fetch the sessionEntry based on the sessionId |
| 2971 | //priority - MEDIUM |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2972 | tpPESession psessionEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2973 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2974 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2975 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2976 | limLog(pMac, LOGE,FL("Session Does not exist for given sessionID\n")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2977 | return; |
| 2978 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2979 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2980 | PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), psessionEntry->gLimSpecMgmt.quietState);) |
| 2981 | switch( psessionEntry->gLimSpecMgmt.quietState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2982 | { |
| 2983 | case eLIM_QUIET_BEGIN: |
| 2984 | // Time to Stop data traffic for quietDuration |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2985 | //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER); |
| 2986 | if (TX_SUCCESS != |
| 2987 | tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer)) |
| 2988 | { |
| 2989 | limLog( pMac, LOGE, |
| 2990 | FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n")); |
| 2991 | } |
| 2992 | |
| 2993 | // gLimQuietDuration appears to be in units of ticks |
| 2994 | // Use it as is |
| 2995 | if (TX_SUCCESS != |
| 2996 | tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer, |
| 2997 | psessionEntry->gLimSpecMgmt.quietDuration, |
| 2998 | 0)) |
| 2999 | { |
| 3000 | limLog( pMac, LOGE, |
| 3001 | FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n")); |
| 3002 | } |
| 3003 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_QUIET_BSS_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3004 | #ifdef GEN6_TODO |
| 3005 | /* revisit this piece of code to assign the appropriate sessionId below |
| 3006 | * priority - HIGH |
| 3007 | */ |
| 3008 | pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId; |
| 3009 | #endif |
| 3010 | if( TX_SUCCESS != |
| 3011 | tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer )) |
| 3012 | { |
| 3013 | limLog( pMac, LOGW, |
| 3014 | FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS...\n")); |
| 3015 | } |
| 3016 | else |
| 3017 | { |
| 3018 | // Transition to eLIM_QUIET_RUNNING |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3019 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3020 | |
| 3021 | /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */ |
| 3022 | /* print message, otherwise, stop data traffic and stay quiet */ |
| 3023 | if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss && |
| 3024 | (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) ) |
| 3025 | { |
| 3026 | limLog( pMac, LOG2, |
| 3027 | FL("Attempting to trigger a background scan...\n")); |
| 3028 | } |
| 3029 | else |
| 3030 | { |
| 3031 | // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration |
| 3032 | /* freeze the transmission */ |
| 3033 | limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX); |
| 3034 | |
| 3035 | limLog( pMac, LOG2, |
| 3036 | FL("Quiet BSS: STA shutting down for %d ticks\n"), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3037 | psessionEntry->gLimSpecMgmt.quietDuration ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3038 | } |
| 3039 | } |
| 3040 | break; |
| 3041 | |
| 3042 | case eLIM_QUIET_RUNNING: |
| 3043 | case eLIM_QUIET_INIT: |
| 3044 | case eLIM_QUIET_END: |
| 3045 | default: |
| 3046 | // |
| 3047 | // As of now, nothing to be done |
| 3048 | // |
| 3049 | break; |
| 3050 | } |
| 3051 | } |
| 3052 | |
| 3053 | /** |
| 3054 | * limProcessQuietBssTimeout |
| 3055 | * |
| 3056 | * FUNCTION: |
| 3057 | * This function is active on the AP and STA. |
| 3058 | * Handles SIR_LIM_QUIET_BSS_TIMEOUT |
| 3059 | * |
| 3060 | * LOGIC: |
| 3061 | * On the AP - |
| 3062 | * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is |
| 3063 | * an indication for the AP to START sending out the |
| 3064 | * Quiet BSS IE. |
| 3065 | * If 802.11H is enabled, the Quiet BSS IE is sent as per |
| 3066 | * the 11H spec |
| 3067 | * If 802.11H is not enabled, the Quiet BSS IE is sent as |
| 3068 | * a Proprietary IE. This will be understood by all the |
| 3069 | * TITAN STA's |
| 3070 | * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will |
| 3071 | * initiate the SCH to include the Quiet BSS IE in all |
| 3072 | * its subsequent Beacons/PR's. |
| 3073 | * The Quiet BSS IE will be included in all the Beacons |
| 3074 | * & PR's until the next DTIM period |
| 3075 | * |
| 3076 | * On the STA - |
| 3077 | * When gLimQuietState = eLIM_QUIET_RUNNING |
| 3078 | * This indicates that the STA was successfully shut-off |
| 3079 | * for the specified gLimQuietDuration. This is a trigger |
| 3080 | * for the STA to now resume data traffic. |
| 3081 | * -> gLimQuietState is set to eLIM_QUIET_INIT |
| 3082 | * |
| 3083 | * ASSUMPTIONS: |
| 3084 | * |
| 3085 | * NOTE: |
| 3086 | * |
| 3087 | * @param pMac - Pointer to Global MAC structure |
| 3088 | * |
| 3089 | * @return None |
| 3090 | */ |
| 3091 | void limProcessQuietBssTimeout( tpAniSirGlobal pMac ) |
| 3092 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3093 | tpPESession psessionEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3094 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3095 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3096 | { |
| 3097 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
| 3098 | return; |
| 3099 | } |
| 3100 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3101 | PELOG1(limLog(pMac, LOG1, FL("quietState = %d\n"), psessionEntry->gLimSpecMgmt.quietState);) |
| 3102 | if (eLIM_AP_ROLE == psessionEntry->limSystemRole) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3103 | { |
| 3104 | #ifdef ANI_PRODUCT_TYPE_AP |
| 3105 | if (!pMac->sys.gSysEnableLearnMode) |
| 3106 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3107 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_END; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3108 | return; |
| 3109 | } |
| 3110 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3111 | if( eLIM_QUIET_INIT == psessionEntry->gLimSpecMgmt.quietState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3112 | { |
| 3113 | //QuietCount = 0 is reserved |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3114 | psessionEntry->gLimSpecMgmt.quietCount = 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3115 | // In ms. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3116 | psessionEntry->gLimSpecMgmt.quietDuration = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3117 | pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration; |
| 3118 | // TU is in multiples of 1024 (2^10) us. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3119 | psessionEntry->gLimSpecMgmt.quietDuration_TU = |
| 3120 | SYS_MS_TO_TU(psessionEntry->gLimSpecMgmt.quietDuration); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3121 | // Transition to eLIM_QUIET_BEGIN |
| 3122 | limLog( pMac, LOG2, FL("Quiet BSS state = eLIM_QUIET_BEGIN\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3123 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3124 | } |
| 3125 | #endif |
| 3126 | } |
| 3127 | else |
| 3128 | { |
| 3129 | // eLIM_STA_ROLE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3130 | switch( psessionEntry->gLimSpecMgmt.quietState ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3131 | { |
| 3132 | case eLIM_QUIET_RUNNING: |
| 3133 | // Transition to eLIM_QUIET_INIT |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3134 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3135 | |
| 3136 | if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) ) |
| 3137 | { |
| 3138 | // Resume data traffic only if channel switch is not running in silent mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3139 | if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) && |
| 3140 | (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3141 | { |
| 3142 | limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3143 | limRestorePreQuietState(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3144 | } |
| 3145 | |
| 3146 | /* Reset status flag */ |
| 3147 | if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) |
| 3148 | glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE; |
| 3149 | |
| 3150 | limLog( pMac, LOG2, |
| 3151 | FL("Quiet BSS: Resuming traffic...\n")); |
| 3152 | } |
| 3153 | else |
| 3154 | { |
| 3155 | // |
| 3156 | // Nothing specific to be done in this case |
| 3157 | // A background scan that was triggered during |
| 3158 | // SIR_LIM_QUIET_TIMEOUT will complete on its own |
| 3159 | // |
| 3160 | limLog( pMac, LOG2, |
| 3161 | FL("Background scan should be complete now...\n")); |
| 3162 | } |
| 3163 | break; |
| 3164 | |
| 3165 | case eLIM_QUIET_INIT: |
| 3166 | case eLIM_QUIET_BEGIN: |
| 3167 | case eLIM_QUIET_END: |
| 3168 | PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING\n"));) |
| 3169 | /* If the quiet period has ended, then resume the frame transmission */ |
| 3170 | limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3171 | limRestorePreQuietState(pMac, psessionEntry); |
| 3172 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3173 | break; |
| 3174 | |
| 3175 | default: |
| 3176 | // |
| 3177 | // As of now, nothing to be done |
| 3178 | // |
| 3179 | break; |
| 3180 | } |
| 3181 | } |
| 3182 | } |
| 3183 | #ifdef WLAN_SOFTAP_FEATURE |
| 3184 | /** |
| 3185 | * limProcessWPSOverlapTimeout |
| 3186 | * |
| 3187 | * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries |
| 3188 | * |
| 3189 | * LOGIC: |
| 3190 | * |
| 3191 | * ASSUMPTIONS: |
| 3192 | * |
| 3193 | * NOTE: |
| 3194 | * |
| 3195 | * @param pMac - Pointer to Global MAC structure |
| 3196 | * |
| 3197 | * @return None |
| 3198 | */ |
| 3199 | #if 0 |
| 3200 | void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac) |
| 3201 | { |
| 3202 | |
| 3203 | tpPESession psessionEntry; |
| 3204 | tANI_U32 sessionId; |
| 3205 | |
| 3206 | if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS) |
| 3207 | { |
| 3208 | limLog(pMac, LOGP, FL("tx_timer_activate failed\n")); |
| 3209 | } |
| 3210 | |
| 3211 | sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId; |
| 3212 | |
| 3213 | PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d\n"), sessionId);) |
| 3214 | |
| 3215 | if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL) |
| 3216 | { |
| 3217 | PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));) |
| 3218 | return; |
| 3219 | } |
| 3220 | |
| 3221 | limWPSPBCTimeout(pMac, psessionEntry); |
| 3222 | } |
| 3223 | #endif |
| 3224 | #endif |
| 3225 | |
| 3226 | /** |
| 3227 | * limUpdateQuietIEFromBeacon |
| 3228 | * |
| 3229 | * FUNCTION: |
| 3230 | * |
| 3231 | * LOGIC: |
| 3232 | * When the Quiet BSS IE is encountered when parsing for |
| 3233 | * Beacons/PR's, this function is called. |
| 3234 | * Based on the configuration of the Quiet Interval - |
| 3235 | * a) A TIMER (gLimQuietTimer) is started for the |
| 3236 | * specified interval |
| 3237 | * b) Upon expiry of the TIMER interval, the STA will |
| 3238 | * shut-off Tx/Rx |
| 3239 | * c) The STA will then start another TIMER (in this |
| 3240 | * case, gLimQuietBssTimer TIMER object), with the |
| 3241 | * timeout duration set to the value specified in the |
| 3242 | * Quiet BSS IE |
| 3243 | * |
| 3244 | * 1) To setup the Quiet BSS "interval". In this case, |
| 3245 | * this TIMER indicates that the STA has to shut-off its |
| 3246 | * Tx/Rx AFTER the specified interval |
| 3247 | * Set gLimQuietState = eLIM_QUIET_BEGIN |
| 3248 | * |
| 3249 | * 2) To setup the Quiet BSS "duration". After the said |
| 3250 | * specified "interval", the STA has to shut-off Tx/Rx |
| 3251 | * for this duration |
| 3252 | * Set gLimQuietState = eLIM_QUIET_RUNNING |
| 3253 | * |
| 3254 | * ASSUMPTIONS: |
| 3255 | * |
| 3256 | * NOTE: |
| 3257 | * |
| 3258 | * @param pMac - Pointer to Global MAC structure |
| 3259 | * @param pQuietIE - Pointer to tDot11fIEQuiet |
| 3260 | * |
| 3261 | * @return None |
| 3262 | */ |
| 3263 | void limUpdateQuietIEFromBeacon( struct sAniSirGlobal *pMac, |
| 3264 | tDot11fIEQuiet *pQuietIE, tpPESession psessionEntry ) |
| 3265 | { |
| 3266 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 3267 | tANI_U16 beaconPeriod; |
| 3268 | tANI_U32 val; |
| 3269 | |
| 3270 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 3271 | return; |
| 3272 | |
| 3273 | PELOG1(limLog(pMac, LOG1, FL("Quiet state = %d, Quiet Count = %d\n"), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3274 | psessionEntry->gLimSpecMgmt.quietState, pQuietIE->count);) |
| 3275 | if (!psessionEntry->lim11hEnable) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3276 | return; |
| 3277 | // The (Titan) AP is requesting this (Titan) STA to |
| 3278 | // honor this Quiet IE REQ and shut-off Tx/Rx. If we're |
| 3279 | // receiving this a second time around (because the AP |
| 3280 | // could be down-counting the Quiet BSS Count), the STA |
| 3281 | // will have to reset the timeout interval accordingly |
| 3282 | // |
| 3283 | |
| 3284 | if (pQuietIE->count == 0) |
| 3285 | { |
| 3286 | PELOG1(limLog(pMac, LOG1, FL("Ignoring quiet count == 0->reserved\n"));) |
| 3287 | return; |
| 3288 | } |
| 3289 | |
| 3290 | if( eSIR_SUCCESS != |
| 3291 | wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &val )) |
| 3292 | beaconPeriod = (tANI_U16) WNI_CFG_BEACON_INTERVAL_APDEF; |
| 3293 | else |
| 3294 | beaconPeriod = (tANI_U16) val; |
| 3295 | |
| 3296 | /* (qd * 2^10)/1000 */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3297 | psessionEntry->gLimSpecMgmt.quietDuration_TU = pQuietIE->duration; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3298 | // The STA needs to shut-off Tx/Rx "for" this interval (in milliSeconds) |
| 3299 | /* Need to convert from TU to system TICKS */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3300 | psessionEntry->gLimSpecMgmt.quietDuration = SYS_MS_TO_TICKS( |
| 3301 | SYS_TU_TO_MS(psessionEntry->gLimSpecMgmt.quietDuration_TU)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3303 | if (psessionEntry->gLimSpecMgmt.quietDuration_TU == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3304 | { |
| 3305 | PELOG1(limLog(pMac, LOG1, FL("Zero duration in quiet IE\n"));) |
| 3306 | return; |
| 3307 | } |
| 3308 | |
| 3309 | // The STA needs to shut-off Tx/Rx "after" this interval |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3310 | psessionEntry->gLimSpecMgmt.quietTimeoutValue = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3311 | (beaconPeriod * pQuietIE->count) + pQuietIE->offset; |
| 3312 | |
| 3313 | limLog( pMac, LOG2, |
| 3314 | FL( "STA shut-off will begin in %d milliseconds & last for %d ticks\n"), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3315 | psessionEntry->gLimSpecMgmt.quietTimeoutValue, |
| 3316 | psessionEntry->gLimSpecMgmt.quietDuration ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3317 | |
| 3318 | /* Disable, Stop background scan if enabled and running */ |
| 3319 | limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER); |
| 3320 | |
| 3321 | /* Stop heart-beat timer to stop heartbeat disassociation */ |
| 3322 | limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry); |
| 3323 | |
| 3324 | if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE || |
| 3325 | pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE) |
| 3326 | { |
| 3327 | PELOGW(limLog(pMac, LOGW, FL("Posting finish scan as we are in scan state\n"));) |
| 3328 | /* Stop ongoing scanning if any */ |
| 3329 | if (GET_LIM_PROCESS_DEFD_MESGS(pMac)) |
| 3330 | { |
| 3331 | //Set the resume channel to Any valid channel (invalid). |
| 3332 | //This will instruct HAL to set it to any previous valid channel. |
| 3333 | peSetResumeChannel(pMac, 0, 0); |
| 3334 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE); |
| 3335 | } |
| 3336 | else |
| 3337 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3338 | limRestorePreQuietState(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3339 | } |
| 3340 | } |
| 3341 | else |
| 3342 | { |
| 3343 | PELOG1(limLog(pMac, LOG1, FL("Not in scan state, start quiet timer\n"));) |
| 3344 | /** We are safe to switch channel at this point */ |
| 3345 | limStartQuietTimer(pMac, psessionEntry->peSessionId); |
| 3346 | } |
| 3347 | |
| 3348 | // Transition to eLIM_QUIET_BEGIN |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3349 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_BEGIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3350 | #endif |
| 3351 | } |
| 3352 | |
| 3353 | |
| 3354 | /**---------------------------------------------- |
| 3355 | \fn limStartQuietTimer |
| 3356 | \brief Starts the quiet timer. |
| 3357 | |
| 3358 | \param pMac |
| 3359 | \return NONE |
| 3360 | -----------------------------------------------*/ |
| 3361 | void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId) |
| 3362 | { |
| 3363 | tpPESession psessionEntry; |
| 3364 | psessionEntry = peFindSessionBySessionId(pMac , sessionId); |
| 3365 | |
| 3366 | if(psessionEntry == NULL) { |
| 3367 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
| 3368 | return; |
| 3369 | } |
| 3370 | |
| 3371 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 3372 | |
| 3373 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 3374 | return; |
| 3375 | // First, de-activate Timer, if its already active |
| 3376 | limCancelDot11hQuiet(pMac, psessionEntry); |
| 3377 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3378 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER)); |
| 3379 | if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer)) |
| 3380 | { |
| 3381 | limLog( pMac, LOGE, |
| 3382 | FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" )); |
| 3383 | } |
| 3384 | |
| 3385 | // Set the NEW timeout value, in ticks |
| 3386 | if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer, |
| 3387 | SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0)) |
| 3388 | { |
| 3389 | limLog( pMac, LOGE, |
| 3390 | FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" )); |
| 3391 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3392 | |
| 3393 | pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId; |
| 3394 | if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer)) |
| 3395 | { |
| 3396 | limLog( pMac, LOGE, |
| 3397 | FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3398 | limRestorePreQuietState(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3399 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3400 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3401 | return; |
| 3402 | } |
| 3403 | #endif |
| 3404 | } |
| 3405 | |
| 3406 | #ifdef ANI_PRODUCT_TYPE_AP |
| 3407 | |
| 3408 | /** |
| 3409 | * computeChannelSwitchCount |
| 3410 | * |
| 3411 | * FUNCTION: |
| 3412 | * Function used by limProcessSmeSwitchChlReq() |
| 3413 | * to compute channel switch count. |
| 3414 | * |
| 3415 | * LOGIC: |
| 3416 | * Channel Switch Count is the number of TBTT until AP switches |
| 3417 | * to a new channel. The value of Channel Switch Count is computed |
| 3418 | * in a way, such that channel switch will always take place after |
| 3419 | * a DTIM. By doing so, it is guaranteed that station in power save |
| 3420 | * mode can receive the message and switch to new channel accordingly. |
| 3421 | * AP can also announce the channel switch several dtims ahead of time. |
| 3422 | * by setting the dtimFactor value greater than 1. |
| 3423 | * |
| 3424 | * ASSUMPTIONS: |
| 3425 | * |
| 3426 | * NOTE: |
| 3427 | * |
| 3428 | * @param dtimFactor |
| 3429 | * @return channel switch count |
| 3430 | */ |
| 3431 | tANI_U32 computeChannelSwitchCount(tpAniSirGlobal pMac, tANI_U32 dtimFactor) |
| 3432 | { |
| 3433 | tANI_U32 dtimPeriod; |
| 3434 | tANI_U32 dtimCount; |
| 3435 | |
| 3436 | if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &dtimPeriod) != eSIR_SUCCESS) |
| 3437 | PELOGE(limLog(pMac, LOGE, FL("wlan_cfgGetInt failed for WNI_CFG_DTIM_PERIOD \n"));) |
| 3438 | |
| 3439 | dtimCount = pMac->pmm.gPmmTim.dtimCount; |
| 3440 | |
| 3441 | if (dtimFactor <= 1) |
| 3442 | return (dtimCount + 1); |
| 3443 | else |
| 3444 | return (((dtimFactor -1)*dtimPeriod) + 1 + dtimCount); |
| 3445 | } |
| 3446 | #endif |
| 3447 | |
| 3448 | /** ------------------------------------------------------------------------ **/ |
| 3449 | /** |
| 3450 | * keep track of the number of ANI peers associated in the BSS |
| 3451 | * For the first and last ANI peer, we have to update EDCA params as needed |
| 3452 | * |
| 3453 | * When the first ANI peer joins the BSS, we notify SCH |
| 3454 | * When the last ANI peer leaves the BSS, we notfiy SCH |
| 3455 | */ |
| 3456 | void |
| 3457 | limUtilCountStaAdd( |
| 3458 | tpAniSirGlobal pMac, |
| 3459 | tpDphHashNode pSta, |
| 3460 | tpPESession psessionEntry) |
| 3461 | { |
| 3462 | |
| 3463 | if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount)) |
| 3464 | return; |
| 3465 | |
| 3466 | pSta->fAniCount = 1; |
| 3467 | |
| 3468 | if (pMac->lim.gLimNumOfAniSTAs++ != 0) |
| 3469 | return; |
| 3470 | |
| 3471 | // get here only if this is the first ANI peer in the BSS |
| 3472 | schEdcaProfileUpdate(pMac, psessionEntry); |
| 3473 | } |
| 3474 | |
| 3475 | void |
| 3476 | limUtilCountStaDel( |
| 3477 | tpAniSirGlobal pMac, |
| 3478 | tpDphHashNode pSta, |
| 3479 | tpPESession psessionEntry) |
| 3480 | { |
| 3481 | |
| 3482 | if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount)) |
| 3483 | return; |
| 3484 | |
| 3485 | /* Only if sta is invalid and the validInDummyState bit is set to 1, |
| 3486 | * then go ahead and update the count and profiles. This ensures |
| 3487 | * that the "number of ani station" count is properly incremented/decremented. |
| 3488 | */ |
| 3489 | if (pSta->valid == 1) |
| 3490 | return; |
| 3491 | |
| 3492 | pSta->fAniCount = 0; |
| 3493 | |
| 3494 | if (pMac->lim.gLimNumOfAniSTAs <= 0) |
| 3495 | { |
| 3496 | limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d\n"), |
| 3497 | pMac->lim.gLimNumOfAniSTAs); |
| 3498 | return; |
| 3499 | } |
| 3500 | |
| 3501 | pMac->lim.gLimNumOfAniSTAs--; |
| 3502 | |
| 3503 | if (pMac->lim.gLimNumOfAniSTAs != 0) |
| 3504 | return; |
| 3505 | |
| 3506 | // get here only if this is the last ANI peer in the BSS |
| 3507 | schEdcaProfileUpdate(pMac, psessionEntry); |
| 3508 | } |
| 3509 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3510 | /** |
| 3511 | * limSwitchChannelCback() |
| 3512 | * |
| 3513 | *FUNCTION: |
| 3514 | * This is the callback function registered while requesting to switch channel |
| 3515 | * after AP indicates a channel switch for spectrum management (11h). |
| 3516 | * |
| 3517 | *NOTE: |
| 3518 | * @param pMac Pointer to Global MAC structure |
| 3519 | * @param status Status of channel switch request |
| 3520 | * @param data User data |
| 3521 | * @param psessionEntry Session information |
| 3522 | * @return NONE |
| 3523 | */ |
| 3524 | void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status, |
| 3525 | tANI_U32 *data, tpPESession psessionEntry) |
| 3526 | { |
| 3527 | tSirMsgQ mmhMsg = {0}; |
| 3528 | tSirSmeSwitchChannelInd *pSirSmeSwitchChInd; |
| 3529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3530 | psessionEntry->currentOperChannel = psessionEntry->currentReqChannel; |
| 3531 | |
| 3532 | /* We need to restore pre-channelSwitch state on the STA */ |
| 3533 | if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS) |
| 3534 | { |
| 3535 | limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system\n")); |
| 3536 | return; |
| 3537 | } |
| 3538 | |
| 3539 | mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ; |
| 3540 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSwitchChInd, sizeof(tSirSmeSwitchChannelInd))) |
| 3541 | { |
| 3542 | limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor\n")); |
| 3543 | return; |
| 3544 | } |
| 3545 | |
| 3546 | pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ; |
| 3547 | pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3548 | pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3549 | pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId; |
| 3550 | //BSS ID |
| 3551 | palCopyMemory( pMac->hHdd, pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 3552 | mmhMsg.bodyptr = pSirSmeSwitchChInd; |
| 3553 | mmhMsg.bodyval = 0; |
| 3554 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3555 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3556 | |
| 3557 | #if defined( FEATURE_WLAN_INTEGRATED_SOC ) |
| 3558 | SysProcessMmhMsg(pMac, &mmhMsg); |
| 3559 | #else |
| 3560 | if(halMmhPostMsgApi(pMac, &mmhMsg, ePROT) != eSIR_SUCCESS) |
| 3561 | { |
| 3562 | palFreeMemory(pMac->hHdd, (void *)msg2Hdd); |
| 3563 | limLog(pMac, LOGP, FL("Message posting to HAL failed\n")); |
| 3564 | } |
| 3565 | #endif |
| 3566 | } |
| 3567 | |
| 3568 | /** |
| 3569 | * limSwitchPrimaryChannel() |
| 3570 | * |
| 3571 | *FUNCTION: |
| 3572 | * This function changes the current operating channel |
| 3573 | * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL. |
| 3574 | * |
| 3575 | *NOTE: |
| 3576 | * @param pMac Pointer to Global MAC structure |
| 3577 | * @param newChannel new chnannel ID |
| 3578 | * @return NONE |
| 3579 | */ |
| 3580 | void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry) |
| 3581 | { |
| 3582 | #if !defined WLAN_FEATURE_VOWIFI |
| 3583 | tANI_U32 localPwrConstraint; |
| 3584 | #endif |
| 3585 | |
| 3586 | PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d \n"), |
| 3587 | psessionEntry->currentOperChannel, newChannel);) |
| 3588 | psessionEntry->currentReqChannel = newChannel; |
| 3589 | psessionEntry->limRFBand = limGetRFBand(newChannel); |
| 3590 | |
| 3591 | psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION; |
| 3592 | |
| 3593 | pMac->lim.gpchangeChannelCallback = limSwitchChannelCback; |
| 3594 | pMac->lim.gpchangeChannelData = NULL; |
| 3595 | |
| 3596 | #if defined WLAN_FEATURE_VOWIFI |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3597 | limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3598 | psessionEntry->maxTxPower, psessionEntry->peSessionId); |
| 3599 | #else |
| 3600 | if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) |
| 3601 | { |
| 3602 | limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg\n" )); |
| 3603 | return; |
| 3604 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3605 | limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3606 | (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId); |
| 3607 | #endif |
| 3608 | return; |
| 3609 | } |
| 3610 | |
| 3611 | /** |
| 3612 | * limSwitchPrimarySecondaryChannel() |
| 3613 | * |
| 3614 | *FUNCTION: |
| 3615 | * This function changes the primary and secondary channel. |
| 3616 | * If 11h is enabled and user provides a "new channel ID" |
| 3617 | * that is different from the current operating channel, |
| 3618 | * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL, |
| 3619 | * assign notify LIM of such change. |
| 3620 | * |
| 3621 | *NOTE: |
| 3622 | * @param pMac Pointer to Global MAC structure |
| 3623 | * @param newChannel New chnannel ID (or current channel ID) |
| 3624 | * @param subband CB secondary info: |
| 3625 | * - eANI_CB_SECONDARY_NONE |
| 3626 | * - eANI_CB_SECONDARY_UP |
| 3627 | * - eANI_CB_SECONDARY_DOWN |
| 3628 | * @return NONE |
| 3629 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3630 | void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3631 | { |
| 3632 | #if !defined WLAN_FEATURE_VOWIFI |
| 3633 | tANI_U32 localPwrConstraint; |
| 3634 | #endif |
| 3635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3636 | #if !defined WLAN_FEATURE_VOWIFI |
| 3637 | if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) { |
| 3638 | limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" )); |
| 3639 | return; |
| 3640 | } |
| 3641 | #endif |
| 3642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3643 | #if defined WLAN_FEATURE_VOWIFI |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3644 | limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3645 | #else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3646 | limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3647 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3648 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3649 | // Store the new primary and secondary channel in session entries if different |
| 3650 | if (psessionEntry->currentOperChannel != newChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3651 | { |
| 3652 | limLog(pMac, LOGW, |
| 3653 | FL("switch old chnl %d --> new chnl %d \n"), |
| 3654 | psessionEntry->currentOperChannel, newChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | psessionEntry->currentOperChannel = newChannel; |
| 3656 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3657 | if (psessionEntry->htSecondaryChannelOffset != subband) |
| 3658 | { |
| 3659 | limLog(pMac, LOGW, |
| 3660 | FL("switch old sec chnl %d --> new sec chnl %d \n"), |
| 3661 | psessionEntry->htSecondaryChannelOffset, subband); |
| 3662 | psessionEntry->htSecondaryChannelOffset = subband; |
| 3663 | if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED) |
| 3664 | { |
| 3665 | psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3666 | } |
| 3667 | else |
| 3668 | { |
| 3669 | psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 3670 | } |
| 3671 | psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet; |
| 3672 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3673 | |
| 3674 | return; |
| 3675 | } |
| 3676 | |
| 3677 | |
| 3678 | /** |
| 3679 | * limActiveScanAllowed() |
| 3680 | * |
| 3681 | *FUNCTION: |
| 3682 | * Checks if active scans are permitted on the given channel |
| 3683 | * |
| 3684 | *LOGIC: |
| 3685 | * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed) |
| 3686 | * Need to check if the channelNum matches, then depending on the corresponding |
| 3687 | * scan flag, return true (for activeScanAllowed==1) or false (otherwise). |
| 3688 | * |
| 3689 | *ASSUMPTIONS: |
| 3690 | * |
| 3691 | *NOTE: |
| 3692 | * |
| 3693 | * @param pMac Pointer to Global MAC structure |
| 3694 | * @param channelNum channel number |
| 3695 | * @return None |
| 3696 | */ |
| 3697 | |
| 3698 | tANI_U8 limActiveScanAllowed( |
| 3699 | tpAniSirGlobal pMac, |
| 3700 | tANI_U8 channelNum) |
| 3701 | { |
| 3702 | tANI_U32 i; |
| 3703 | tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN]; |
| 3704 | tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN; |
| 3705 | if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len) |
| 3706 | != eSIR_SUCCESS) |
| 3707 | { |
| 3708 | PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list\n"));) |
| 3709 | return false; |
| 3710 | } |
| 3711 | |
| 3712 | if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN) |
| 3713 | { |
| 3714 | limLog(pMac, LOGE, FL("Invalid scan control list length:%d\n"), |
| 3715 | len); |
| 3716 | return false; |
| 3717 | } |
| 3718 | |
| 3719 | for (i=0; (i+1) < len; i+=2) |
| 3720 | { |
| 3721 | if (channelPair[i] == channelNum) |
| 3722 | return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false); |
| 3723 | } |
| 3724 | return false; |
| 3725 | } |
| 3726 | |
| 3727 | /** |
| 3728 | * limTriggerBackgroundScanDuringQuietBss() |
| 3729 | * |
| 3730 | *FUNCTION: |
| 3731 | * This function is applicable to the STA only. |
| 3732 | * This function is called by limProcessQuietTimeout(), |
| 3733 | * when it is time to honor the Quiet BSS IE from the AP. |
| 3734 | * |
| 3735 | *LOGIC: |
| 3736 | * If 11H is enabled: |
| 3737 | * We cannot trigger a background scan. The STA needs to |
| 3738 | * shut-off Tx/Rx. |
| 3739 | * If 11 is not enabled: |
| 3740 | * Determine if the next channel that we are going to |
| 3741 | * scan is NOT the same channel (or not) on which the |
| 3742 | * Quiet BSS was requested. |
| 3743 | * If yes, then we cannot trigger a background scan on |
| 3744 | * this channel. Return with a false. |
| 3745 | * If no, then trigger a background scan. Return with |
| 3746 | * a true. |
| 3747 | * |
| 3748 | *ASSUMPTIONS: |
| 3749 | * |
| 3750 | *NOTE: |
| 3751 | * This API is redundant if the existing API, |
| 3752 | * limTriggerBackgroundScan(), were to return a valid |
| 3753 | * response instead of returning void. |
| 3754 | * If possible, try to revisit this API |
| 3755 | * |
| 3756 | * @param pMac Pointer to Global MAC structure |
| 3757 | * @return eSIR_TRUE, if a background scan was attempted |
| 3758 | * eSIR_FALSE, if not |
| 3759 | */ |
| 3760 | tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac ) |
| 3761 | { |
| 3762 | tAniBool bScanTriggered = eSIR_FALSE; |
| 3763 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 3764 | |
| 3765 | |
| 3766 | |
| 3767 | //TBD-RAJESH HOW TO GET sessionEntry????? |
| 3768 | tpPESession psessionEntry = &pMac->lim.gpSession[0]; |
| 3769 | |
| 3770 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 3771 | return bScanTriggered; |
| 3772 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3773 | if( !psessionEntry->lim11hEnable ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3774 | { |
| 3775 | tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN]; |
| 3776 | tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN; |
| 3777 | |
| 3778 | // Determine the next scan channel |
| 3779 | |
| 3780 | // Get background scan channel list from CFG |
| 3781 | if( eSIR_SUCCESS == wlan_cfgGetStr( pMac, |
| 3782 | WNI_CFG_BG_SCAN_CHANNEL_LIST, |
| 3783 | (tANI_U8 *) bgScanChannelList, |
| 3784 | (tANI_U32 *) &len )) |
| 3785 | { |
| 3786 | // Ensure that we do not go off scanning on the same |
| 3787 | // channel on which the Quiet BSS was requested |
| 3788 | if( psessionEntry->currentOperChannel!= |
| 3789 | bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] ) |
| 3790 | { |
| 3791 | // For now, try and attempt a background scan. It will |
| 3792 | // be ideal if this API actually returns a success or |
| 3793 | // failure instead of having a void return type |
| 3794 | limTriggerBackgroundScan( pMac ); |
| 3795 | |
| 3796 | bScanTriggered = eSIR_TRUE; |
| 3797 | } |
| 3798 | else |
| 3799 | { |
| 3800 | limLog( pMac, LOGW, |
| 3801 | FL("The next SCAN channel is the current operating channel on which a Quiet BSS is requested.! A background scan will not be triggered during this Quiet BSS period...\n")); |
| 3802 | } |
| 3803 | } |
| 3804 | else |
| 3805 | { |
| 3806 | limLog( pMac, LOGW, |
| 3807 | FL("Unable to retrieve WNI_CFG_VALID_CHANNEL_LIST from CFG! A background scan will not be triggered during this Quiet BSS period...\n")); |
| 3808 | } |
| 3809 | } |
| 3810 | #endif |
| 3811 | return bScanTriggered; |
| 3812 | } |
| 3813 | |
| 3814 | |
| 3815 | /** |
| 3816 | * limGetHTCapability() |
| 3817 | * |
| 3818 | *FUNCTION: |
| 3819 | * A utility function that returns the "current HT capability state" for the HT |
| 3820 | * capability of interest (as requested in the API) |
| 3821 | * |
| 3822 | *LOGIC: |
| 3823 | * This routine will return with the "current" setting of a requested HT |
| 3824 | * capability. This state info could be retrieved from - |
| 3825 | * a) CFG (for static entries) |
| 3826 | * b) Run time info |
| 3827 | * - Dynamic state maintained by LIM |
| 3828 | * - Configured at radio init time by SME |
| 3829 | * |
| 3830 | * |
| 3831 | *ASSUMPTIONS: |
| 3832 | * NA |
| 3833 | * |
| 3834 | *NOTE: |
| 3835 | * |
| 3836 | * @param pMac Pointer to Global MAC structure |
| 3837 | * @param htCap The HT capability being queried |
| 3838 | * @return tANI_U8 The current state of the requested HT capability is returned in a |
| 3839 | * tANI_U8 variable |
| 3840 | */ |
| 3841 | |
| 3842 | #ifdef WLAN_SOFTAP_FEATURE |
| 3843 | tANI_U8 limGetHTCapability( tpAniSirGlobal pMac, |
| 3844 | tANI_U32 htCap, tpPESession psessionEntry) |
| 3845 | #else |
| 3846 | tANI_U8 limGetHTCapability( tpAniSirGlobal pMac, |
| 3847 | tANI_U32 htCap ) |
| 3848 | #endif |
| 3849 | { |
| 3850 | tANI_U8 retVal = 0; |
| 3851 | tANI_U8 *ptr; |
| 3852 | tANI_U32 cfgValue; |
| 3853 | tSirMacHTCapabilityInfo macHTCapabilityInfo = {0}; |
| 3854 | tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0}; |
| 3855 | tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0}; |
| 3856 | tSirMacASCapabilityInfo macASCapabilityInfo = {0}; |
| 3857 | |
| 3858 | // |
| 3859 | // Determine which CFG to read from. Not ALL of the HT |
| 3860 | // related CFG's need to be read each time this API is |
| 3861 | // accessed |
| 3862 | // |
| 3863 | if( htCap >= eHT_ANTENNA_SELECTION && |
| 3864 | htCap < eHT_SI_GRANULARITY ) |
| 3865 | { |
| 3866 | // Get Antenna Seletion HT Capabilities |
| 3867 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue )) |
| 3868 | cfgValue = 0; |
| 3869 | ptr = (tANI_U8 *) &macASCapabilityInfo; |
| 3870 | *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff); |
| 3871 | } |
| 3872 | else |
| 3873 | { |
| 3874 | if( htCap >= eHT_TX_BEAMFORMING && |
| 3875 | htCap < eHT_ANTENNA_SELECTION ) |
| 3876 | { |
| 3877 | // Get Transmit Beam Forming HT Capabilities |
| 3878 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue )) |
| 3879 | cfgValue = 0; |
| 3880 | ptr = (tANI_U8 *) &macTxBFCapabilityInfo; |
| 3881 | *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue); |
| 3882 | } |
| 3883 | else |
| 3884 | { |
| 3885 | if( htCap >= eHT_PCO && |
| 3886 | htCap < eHT_TX_BEAMFORMING ) |
| 3887 | { |
| 3888 | // Get Extended HT Capabilities |
| 3889 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue )) |
| 3890 | cfgValue = 0; |
| 3891 | ptr = (tANI_U8 *) &macExtHTCapabilityInfo; |
| 3892 | *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff); |
| 3893 | } |
| 3894 | else |
| 3895 | { |
| 3896 | if( htCap < eHT_MAX_RX_AMPDU_FACTOR ) |
| 3897 | { |
| 3898 | // Get HT Capabilities |
| 3899 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue )) |
| 3900 | cfgValue = 0; |
| 3901 | ptr = (tANI_U8 *) &macHTCapabilityInfo; |
| 3902 | // CR 265282 MDM SoftAP 2.4PL: SoftAP boot up crash in 2.4 PL builds while same WLAN SU is working on 2.1 PL |
| 3903 | *ptr++ = cfgValue & 0xff; |
| 3904 | *ptr = (cfgValue >> 8) & 0xff; |
| 3905 | } |
| 3906 | } |
| 3907 | } |
| 3908 | } |
| 3909 | |
| 3910 | switch( htCap ) |
| 3911 | { |
| 3912 | case eHT_LSIG_TXOP_PROTECTION: |
| 3913 | retVal = pMac->lim.gHTLsigTXOPProtection; |
| 3914 | break; |
| 3915 | |
| 3916 | case eHT_STBC_CONTROL_FRAME: |
| 3917 | retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame; |
| 3918 | break; |
| 3919 | |
| 3920 | case eHT_PSMP: |
| 3921 | retVal = pMac->lim.gHTPSMPSupport; |
| 3922 | break; |
| 3923 | |
| 3924 | case eHT_DSSS_CCK_MODE_40MHZ: |
| 3925 | retVal = pMac->lim.gHTDsssCckRate40MHzSupport; |
| 3926 | break; |
| 3927 | |
| 3928 | case eHT_MAX_AMSDU_LENGTH: |
| 3929 | retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize; |
| 3930 | break; |
| 3931 | |
| 3932 | case eHT_DELAYED_BA: |
| 3933 | retVal = (tANI_U8) macHTCapabilityInfo.delayedBA; |
| 3934 | break; |
| 3935 | |
| 3936 | case eHT_RX_STBC: |
| 3937 | retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC; |
| 3938 | break; |
| 3939 | |
| 3940 | case eHT_TX_STBC: |
| 3941 | retVal = (tANI_U8) macHTCapabilityInfo.txSTBC; |
| 3942 | break; |
| 3943 | |
| 3944 | case eHT_SHORT_GI_40MHZ: |
| 3945 | retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz; |
| 3946 | break; |
| 3947 | |
| 3948 | case eHT_SHORT_GI_20MHZ: |
| 3949 | retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz; |
| 3950 | break; |
| 3951 | |
| 3952 | case eHT_GREENFIELD: |
| 3953 | retVal = (tANI_U8) macHTCapabilityInfo.greenField; |
| 3954 | break; |
| 3955 | |
| 3956 | case eHT_MIMO_POWER_SAVE: |
| 3957 | retVal = (tANI_U8) pMac->lim.gHTMIMOPSState; |
| 3958 | break; |
| 3959 | |
| 3960 | case eHT_SUPPORTED_CHANNEL_WIDTH_SET: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3961 | retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3962 | break; |
| 3963 | |
| 3964 | case eHT_ADVANCED_CODING: |
| 3965 | retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap; |
| 3966 | break; |
| 3967 | |
| 3968 | case eHT_MAX_RX_AMPDU_FACTOR: |
| 3969 | retVal = pMac->lim.gHTMaxRxAMpduFactor; |
| 3970 | break; |
| 3971 | |
| 3972 | case eHT_MPDU_DENSITY: |
| 3973 | retVal = pMac->lim.gHTAMpduDensity; |
| 3974 | break; |
| 3975 | |
| 3976 | case eHT_PCO: |
| 3977 | retVal = (tANI_U8) macExtHTCapabilityInfo.pco; |
| 3978 | break; |
| 3979 | |
| 3980 | case eHT_TRANSITION_TIME: |
| 3981 | retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime; |
| 3982 | break; |
| 3983 | |
| 3984 | case eHT_MCS_FEEDBACK: |
| 3985 | retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback; |
| 3986 | break; |
| 3987 | |
| 3988 | case eHT_TX_BEAMFORMING: |
| 3989 | retVal = (tANI_U8) macTxBFCapabilityInfo.txBF; |
| 3990 | break; |
| 3991 | |
| 3992 | case eHT_ANTENNA_SELECTION: |
| 3993 | retVal = (tANI_U8) macASCapabilityInfo.antennaSelection; |
| 3994 | break; |
| 3995 | |
| 3996 | case eHT_SI_GRANULARITY: |
| 3997 | retVal = pMac->lim.gHTServiceIntervalGranularity; |
| 3998 | break; |
| 3999 | |
| 4000 | case eHT_CONTROLLED_ACCESS: |
| 4001 | retVal = pMac->lim.gHTControlledAccessOnly; |
| 4002 | break; |
| 4003 | |
| 4004 | case eHT_RIFS_MODE: |
| 4005 | retVal = psessionEntry->beaconParams.fRIFSMode; |
| 4006 | break; |
| 4007 | |
| 4008 | case eHT_RECOMMENDED_TX_WIDTH_SET: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4009 | retVal = psessionEntry->htRecommendedTxWidthSet; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4010 | break; |
| 4011 | |
| 4012 | case eHT_EXTENSION_CHANNEL_OFFSET: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4013 | retVal = psessionEntry->htSecondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4014 | break; |
| 4015 | |
| 4016 | case eHT_OP_MODE: |
| 4017 | #ifdef WLAN_SOFTAP_FEATURE |
| 4018 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE ) |
| 4019 | retVal = psessionEntry->htOperMode; |
| 4020 | else |
| 4021 | #endif |
| 4022 | retVal = pMac->lim.gHTOperMode; |
| 4023 | break; |
| 4024 | |
| 4025 | case eHT_BASIC_STBC_MCS: |
| 4026 | retVal = pMac->lim.gHTSTBCBasicMCS; |
| 4027 | break; |
| 4028 | |
| 4029 | case eHT_DUAL_CTS_PROTECTION: |
| 4030 | retVal = pMac->lim.gHTDualCTSProtection; |
| 4031 | break; |
| 4032 | |
| 4033 | case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT: |
| 4034 | retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport; |
| 4035 | break; |
| 4036 | |
| 4037 | case eHT_PCO_ACTIVE: |
| 4038 | retVal = pMac->lim.gHTPCOActive; |
| 4039 | break; |
| 4040 | |
| 4041 | case eHT_PCO_PHASE: |
| 4042 | retVal = pMac->lim.gHTPCOPhase; |
| 4043 | break; |
| 4044 | |
| 4045 | default: |
| 4046 | break; |
| 4047 | } |
| 4048 | |
| 4049 | return retVal; |
| 4050 | } |
| 4051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4052 | void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac) |
| 4053 | { |
| 4054 | palCopyMemory( pMac->hHdd, mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr)); |
| 4055 | return; |
| 4056 | } |
| 4057 | |
| 4058 | |
| 4059 | |
| 4060 | |
| 4061 | /** ------------------------------------------------------------- |
| 4062 | \fn limEnable11aProtection |
| 4063 | \brief based on config setting enables\disables 11a protection. |
| 4064 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 4065 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 4066 | \param tpUpdateBeaconParams pBeaconParams |
| 4067 | \return None |
| 4068 | -------------------------------------------------------------*/ |
| 4069 | tSirRetStatus |
| 4070 | limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable, |
| 4071 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 4072 | { |
| 4073 | |
| 4074 | //overlapping protection configuration check. |
| 4075 | if(overlap) |
| 4076 | { |
| 4077 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 4078 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE && !pMac->lim.cfgProtection.overlapFromlla) |
| 4079 | { |
| 4080 | // protection disabled. |
| 4081 | PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11a is disabled\n"));) |
| 4082 | return eSIR_SUCCESS; |
| 4083 | } |
| 4084 | #endif |
| 4085 | } |
| 4086 | else |
| 4087 | { |
| 4088 | //normal protection config check |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4089 | if (( psessionEntry != NULL ) && (psessionEntry->limSystemRole == eLIM_AP_ROLE) && |
| 4090 | (!psessionEntry->cfgProtection.fromlla)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4091 | { |
| 4092 | // protection disabled. |
| 4093 | PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled\n"));) |
| 4094 | return eSIR_SUCCESS; |
| 4095 | } |
| 4096 | } |
| 4097 | |
| 4098 | if (enable) |
| 4099 | { |
| 4100 | //If we are AP and HT capable, we need to set the HT OP mode |
| 4101 | //appropriately. |
| 4102 | if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&& |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4103 | (true == psessionEntry->htCapability)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4104 | { |
| 4105 | if(overlap) |
| 4106 | { |
| 4107 | pMac->lim.gLimOverlap11aParams.protectionEnabled = true; |
| 4108 | if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) && |
| 4109 | (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)) |
| 4110 | { |
| 4111 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4112 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4113 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4114 | limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4115 | } |
| 4116 | } |
| 4117 | else |
| 4118 | { |
| 4119 | psessionEntry->gLim11aParams.protectionEnabled = true; |
| 4120 | if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) |
| 4121 | { |
| 4122 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4123 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4124 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4125 | limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4126 | |
| 4127 | } |
| 4128 | } |
| 4129 | } |
| 4130 | |
| 4131 | //This part is common for staiton as well. |
| 4132 | if(false == psessionEntry->beaconParams.llaCoexist) |
| 4133 | { |
| 4134 | PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled\n"));) |
| 4135 | pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true; |
| 4136 | pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED; |
| 4137 | } |
| 4138 | } |
| 4139 | else if (true == psessionEntry->beaconParams.llaCoexist) |
| 4140 | { |
| 4141 | //for AP role. |
| 4142 | //we need to take care of HT OP mode change if needed. |
| 4143 | //We need to take care of Overlap cases. |
| 4144 | if(eLIM_AP_ROLE == psessionEntry->limSystemRole) |
| 4145 | { |
| 4146 | if(overlap) |
| 4147 | { |
| 4148 | //Overlap Legacy protection disabled. |
| 4149 | pMac->lim.gLimOverlap11aParams.protectionEnabled = false; |
| 4150 | |
| 4151 | //We need to take care of HT OP mode iff we are HT AP. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4152 | if(psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4153 | { |
| 4154 | // no HT op mode change if any of the overlap protection enabled. |
| 4155 | if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled || |
| 4156 | pMac->lim.gLimOverlapHt20Params.protectionEnabled || |
| 4157 | pMac->lim.gLimOverlapNonGfParams.protectionEnabled)) |
| 4158 | |
| 4159 | { |
| 4160 | //Check if there is a need to change HT OP mode. |
| 4161 | if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode) |
| 4162 | { |
| 4163 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4164 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4165 | |
| 4166 | if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4167 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4168 | else |
| 4169 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 4170 | } |
| 4171 | } |
| 4172 | } |
| 4173 | } |
| 4174 | else |
| 4175 | { |
| 4176 | //Disable protection from 11A stations. |
| 4177 | psessionEntry->gLim11aParams.protectionEnabled = false; |
| 4178 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4179 | |
| 4180 | //Check if any other non-HT protection enabled. |
| 4181 | //Right now we are in HT OP Mixed mode. |
| 4182 | //Change HT op mode appropriately. |
| 4183 | |
| 4184 | //Change HT OP mode to 01 if any overlap protection enabled |
| 4185 | if(pMac->lim.gLimOverlap11aParams.protectionEnabled || |
| 4186 | pMac->lim.gLimOverlapHt20Params.protectionEnabled || |
| 4187 | pMac->lim.gLimOverlapNonGfParams.protectionEnabled) |
| 4188 | |
| 4189 | { |
| 4190 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4191 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4193 | } |
| 4194 | else if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4195 | { |
| 4196 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4197 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4198 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4199 | } |
| 4200 | else |
| 4201 | { |
| 4202 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4203 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4204 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4205 | } |
| 4206 | } |
| 4207 | if(!pMac->lim.gLimOverlap11aParams.protectionEnabled && |
| 4208 | !psessionEntry->gLim11aParams.protectionEnabled) |
| 4209 | { |
| 4210 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled\n"));) |
| 4211 | pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false; |
| 4212 | pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED; |
| 4213 | } |
| 4214 | } |
| 4215 | //for station role |
| 4216 | else |
| 4217 | { |
| 4218 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled\n"));) |
| 4219 | pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false; |
| 4220 | pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED; |
| 4221 | } |
| 4222 | } |
| 4223 | |
| 4224 | return eSIR_SUCCESS; |
| 4225 | } |
| 4226 | |
| 4227 | /** ------------------------------------------------------------- |
| 4228 | \fn limEnable11gProtection |
| 4229 | \brief based on config setting enables\disables 11g protection. |
| 4230 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 4231 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 4232 | \param tpUpdateBeaconParams pBeaconParams |
| 4233 | \return None |
| 4234 | -------------------------------------------------------------*/ |
| 4235 | |
| 4236 | tSirRetStatus |
| 4237 | limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable, |
| 4238 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 4239 | { |
| 4240 | |
| 4241 | //overlapping protection configuration check. |
| 4242 | if(overlap) |
| 4243 | { |
| 4244 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 4245 | if(((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE )) && !pMac->lim.cfgProtection.overlapFromllb) |
| 4246 | { |
| 4247 | // protection disabled. |
| 4248 | PELOG1(limLog(pMac, LOG1, FL("overlap protection from 11b is disabled\n"));) |
| 4249 | return eSIR_SUCCESS; |
| 4250 | } |
| 4251 | #endif |
| 4252 | } |
| 4253 | else |
| 4254 | { |
| 4255 | //normal protection config check |
| 4256 | #ifdef WLAN_SOFTAP_FEATURE |
| 4257 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 4258 | !psessionEntry->cfgProtection.fromllb) |
| 4259 | { |
| 4260 | // protection disabled. |
| 4261 | PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled\n"));) |
| 4262 | return eSIR_SUCCESS; |
| 4263 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 4264 | #endif |
| 4265 | { |
| 4266 | if(!pMac->lim.cfgProtection.fromllb) |
| 4267 | { |
| 4268 | // protection disabled. |
| 4269 | PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled\n"));) |
| 4270 | return eSIR_SUCCESS; |
| 4271 | } |
| 4272 | } |
| 4273 | } |
| 4274 | |
| 4275 | if (enable) |
| 4276 | { |
| 4277 | //If we are AP and HT capable, we need to set the HT OP mode |
| 4278 | //appropriately. |
| 4279 | #ifdef WLAN_SOFTAP_FEATURE |
| 4280 | if(eLIM_AP_ROLE == psessionEntry->limSystemRole) |
| 4281 | { |
| 4282 | if(overlap) |
| 4283 | { |
| 4284 | psessionEntry->gLimOlbcParams.protectionEnabled = true; |
| 4285 | PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4286 | if(true == psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4287 | { |
| 4288 | if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) && |
| 4289 | (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)) |
| 4290 | { |
| 4291 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4292 | } |
| 4293 | //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS |
| 4294 | // This fixes issue of OBSS bit not set after 11b, 11g station leaves |
| 4295 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4296 | //Not processing OBSS bit from other APs, as we are already taking care |
| 4297 | //of Protection from overlapping BSS based on erp IE or useProtection bit |
| 4298 | limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry); |
| 4299 | } |
| 4300 | } |
| 4301 | else |
| 4302 | { |
| 4303 | psessionEntry->gLim11bParams.protectionEnabled = true; |
| 4304 | PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled\n"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4305 | if(true == psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4306 | { |
| 4307 | if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode) |
| 4308 | { |
| 4309 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED; |
| 4310 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4311 | limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4312 | } |
| 4313 | } |
| 4314 | } |
| 4315 | }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4316 | (true == psessionEntry->htCapability)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4317 | #else |
| 4318 | if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)|| (eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4319 | (true == psessionEntry->htCapability)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4320 | #endif |
| 4321 | { |
| 4322 | if(overlap) |
| 4323 | { |
| 4324 | psessionEntry->gLimOlbcParams.protectionEnabled = true; |
| 4325 | if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) && |
| 4326 | (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)) |
| 4327 | { |
| 4328 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4329 | } |
| 4330 | //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS |
| 4331 | // This fixes issue of OBSS bit not set after 11b, 11g station leaves |
| 4332 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4333 | //Not processing OBSS bit from other APs, as we are already taking care |
| 4334 | //of Protection from overlapping BSS based on erp IE or useProtection bit |
| 4335 | limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry); |
| 4336 | } |
| 4337 | else |
| 4338 | { |
| 4339 | psessionEntry->gLim11bParams.protectionEnabled = true; |
| 4340 | if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) |
| 4341 | { |
| 4342 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED; |
| 4343 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4344 | limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4345 | } |
| 4346 | } |
| 4347 | } |
| 4348 | |
| 4349 | //This part is common for staiton as well. |
| 4350 | if(false == psessionEntry->beaconParams.llbCoexist) |
| 4351 | { |
| 4352 | PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled\n"));) |
| 4353 | pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true; |
| 4354 | pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED; |
| 4355 | } |
| 4356 | } |
| 4357 | else if (true == psessionEntry->beaconParams.llbCoexist) |
| 4358 | { |
| 4359 | //for AP role. |
| 4360 | //we need to take care of HT OP mode change if needed. |
| 4361 | //We need to take care of Overlap cases. |
| 4362 | #ifdef WLAN_SOFTAP_FEATURE |
| 4363 | if(eLIM_AP_ROLE == psessionEntry->limSystemRole) |
| 4364 | { |
| 4365 | if(overlap) |
| 4366 | { |
| 4367 | //Overlap Legacy protection disabled. |
| 4368 | psessionEntry->gLimOlbcParams.protectionEnabled = false; |
| 4369 | |
| 4370 | //We need to take care of HT OP mode if we are HT AP. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4371 | if(psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4372 | { |
| 4373 | // no HT op mode change if any of the overlap protection enabled. |
| 4374 | if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled || |
| 4375 | psessionEntry->gLimOverlapHt20Params.protectionEnabled || |
| 4376 | psessionEntry->gLimOverlapNonGfParams.protectionEnabled)) |
| 4377 | { |
| 4378 | //Check if there is a need to change HT OP mode. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4379 | if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4380 | { |
| 4381 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4382 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4383 | if(psessionEntry->gLimHt20Params.protectionEnabled){ |
| 4384 | //Commenting out beacuse of CR 258588 WFA cert |
| 4385 | //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4386 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4387 | } |
| 4388 | else |
| 4389 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4390 | } |
| 4391 | } |
| 4392 | } |
| 4393 | } |
| 4394 | else |
| 4395 | { |
| 4396 | //Disable protection from 11B stations. |
| 4397 | psessionEntry->gLim11bParams.protectionEnabled = false; |
| 4398 | PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled\n"));) |
| 4399 | //Check if any other non-HT protection enabled. |
| 4400 | if(!psessionEntry->gLim11gParams.protectionEnabled) |
| 4401 | { |
| 4402 | //Right now we are in HT OP Mixed mode. |
| 4403 | //Change HT op mode appropriately. |
| 4404 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4405 | |
| 4406 | //Change HT OP mode to 01 if any overlap protection enabled |
| 4407 | if(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 4408 | psessionEntry->gLimOverlap11gParams.protectionEnabled || |
| 4409 | psessionEntry->gLimOverlapHt20Params.protectionEnabled || |
| 4410 | psessionEntry->gLimOverlapNonGfParams.protectionEnabled) |
| 4411 | { |
| 4412 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4413 | PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled\n"));) |
| 4414 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4415 | } |
| 4416 | else if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4417 | { |
| 4418 | //Commenting because of CR 258588 WFA cert |
| 4419 | //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4420 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4421 | PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled\n"));) |
| 4422 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4423 | } |
| 4424 | else |
| 4425 | { |
| 4426 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4427 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4428 | } |
| 4429 | } |
| 4430 | } |
| 4431 | if(!psessionEntry->gLimOlbcParams.protectionEnabled && |
| 4432 | !psessionEntry->gLim11bParams.protectionEnabled) |
| 4433 | { |
| 4434 | PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled\n"));) |
| 4435 | pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false; |
| 4436 | pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED; |
| 4437 | } |
| 4438 | }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) |
| 4439 | #else |
| 4440 | if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))) |
| 4441 | #endif |
| 4442 | { |
| 4443 | if(overlap) |
| 4444 | { |
| 4445 | //Overlap Legacy protection disabled. |
| 4446 | psessionEntry->gLimOlbcParams.protectionEnabled = false; |
| 4447 | |
| 4448 | //We need to take care of HT OP mode iff we are HT AP. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4449 | if(psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4450 | { |
| 4451 | // no HT op mode change if any of the overlap protection enabled. |
| 4452 | if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled || |
| 4453 | pMac->lim.gLimOverlapHt20Params.protectionEnabled || |
| 4454 | pMac->lim.gLimOverlapNonGfParams.protectionEnabled)) |
| 4455 | |
| 4456 | { |
| 4457 | //Check if there is a need to change HT OP mode. |
| 4458 | if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode) |
| 4459 | { |
| 4460 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4461 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4462 | if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4463 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4464 | else |
| 4465 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 4466 | } |
| 4467 | } |
| 4468 | } |
| 4469 | } |
| 4470 | else |
| 4471 | { |
| 4472 | //Disable protection from 11B stations. |
| 4473 | psessionEntry->gLim11bParams.protectionEnabled = false; |
| 4474 | //Check if any other non-HT protection enabled. |
| 4475 | if(!psessionEntry->gLim11gParams.protectionEnabled) |
| 4476 | { |
| 4477 | //Right now we are in HT OP Mixed mode. |
| 4478 | //Change HT op mode appropriately. |
| 4479 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4480 | |
| 4481 | //Change HT OP mode to 01 if any overlap protection enabled |
| 4482 | if(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 4483 | pMac->lim.gLimOverlap11gParams.protectionEnabled || |
| 4484 | pMac->lim.gLimOverlapHt20Params.protectionEnabled || |
| 4485 | pMac->lim.gLimOverlapNonGfParams.protectionEnabled) |
| 4486 | |
| 4487 | { |
| 4488 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4489 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4490 | } |
| 4491 | else if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4492 | { |
| 4493 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4494 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4495 | } |
| 4496 | else |
| 4497 | { |
| 4498 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 4499 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4500 | } |
| 4501 | } |
| 4502 | } |
| 4503 | if(!psessionEntry->gLimOlbcParams.protectionEnabled && |
| 4504 | !psessionEntry->gLim11bParams.protectionEnabled) |
| 4505 | { |
| 4506 | PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled\n"));) |
| 4507 | pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false; |
| 4508 | pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED; |
| 4509 | } |
| 4510 | } |
| 4511 | //for station role |
| 4512 | else |
| 4513 | { |
| 4514 | PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled\n"));) |
| 4515 | pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false; |
| 4516 | pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED; |
| 4517 | } |
| 4518 | } |
| 4519 | return eSIR_SUCCESS; |
| 4520 | } |
| 4521 | |
| 4522 | /** ------------------------------------------------------------- |
| 4523 | \fn limEnableHtProtectionFrom11g |
| 4524 | \brief based on cofig enables\disables protection from 11g. |
| 4525 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 4526 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 4527 | \param tpUpdateBeaconParams pBeaconParams |
| 4528 | \return None |
| 4529 | -------------------------------------------------------------*/ |
| 4530 | tSirRetStatus |
| 4531 | limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable, |
| 4532 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 4533 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4534 | if(!psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4535 | return eSIR_SUCCESS; // protection from 11g is only for HT stations. |
| 4536 | |
| 4537 | //overlapping protection configuration check. |
| 4538 | if(overlap) |
| 4539 | { |
| 4540 | #ifdef WLAN_SOFTAP_FEATURE |
| 4541 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg)) |
| 4542 | { |
| 4543 | // protection disabled. |
| 4544 | PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled\n"));); |
| 4545 | return eSIR_SUCCESS; |
| 4546 | }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg)) |
| 4547 | #else |
| 4548 | if(((psessionEntry->limSystemRole == eLIM_AP_ROLE ) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && (!pMac->lim.cfgProtection.overlapFromllg)) |
| 4549 | #endif |
| 4550 | { |
| 4551 | // protection disabled. |
| 4552 | PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled\n"));); |
| 4553 | return eSIR_SUCCESS; |
| 4554 | } |
| 4555 | } |
| 4556 | else |
| 4557 | { |
| 4558 | //normal protection config check |
| 4559 | #ifdef WLAN_SOFTAP_FEATURE |
| 4560 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 4561 | !psessionEntry->cfgProtection.fromllg){ |
| 4562 | // protection disabled. |
| 4563 | PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled\n"));) |
| 4564 | return eSIR_SUCCESS; |
| 4565 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE ) |
| 4566 | #endif |
| 4567 | { |
| 4568 | if(!pMac->lim.cfgProtection.fromllg) |
| 4569 | { |
| 4570 | // protection disabled. |
| 4571 | PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled\n"));) |
| 4572 | return eSIR_SUCCESS; |
| 4573 | } |
| 4574 | } |
| 4575 | } |
| 4576 | if (enable) |
| 4577 | { |
| 4578 | //If we are AP and HT capable, we need to set the HT OP mode |
| 4579 | //appropriately. |
| 4580 | |
| 4581 | #ifdef WLAN_SOFTAP_FEATURE |
| 4582 | if(eLIM_AP_ROLE == psessionEntry->limSystemRole) |
| 4583 | { |
| 4584 | if(overlap) |
| 4585 | { |
| 4586 | psessionEntry->gLimOverlap11gParams.protectionEnabled = true; |
| 4587 | //11g exists in overlap BSS. |
| 4588 | //need not to change the operating mode to overlap_legacy |
| 4589 | //if higher or same protection operating mode is enabled right now. |
| 4590 | if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) && |
| 4591 | (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)) |
| 4592 | { |
| 4593 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4594 | } |
| 4595 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4596 | limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams, psessionEntry); |
| 4597 | } |
| 4598 | else |
| 4599 | { |
| 4600 | //11g is associated to an AP operating in 11n mode. |
| 4601 | //Change the HT operating mode to 'mixed mode'. |
| 4602 | psessionEntry->gLim11gParams.protectionEnabled = true; |
| 4603 | if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode) |
| 4604 | { |
| 4605 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED; |
| 4606 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4607 | limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry); |
| 4608 | } |
| 4609 | } |
| 4610 | }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) |
| 4611 | #else |
| 4612 | if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) |
| 4613 | #endif |
| 4614 | { |
| 4615 | if(overlap) |
| 4616 | { |
| 4617 | pMac->lim.gLimOverlap11gParams.protectionEnabled = true; |
| 4618 | //11g exists in overlap BSS. |
| 4619 | //need not to change the operating mode to overlap_legacy |
| 4620 | //if higher or same protection operating mode is enabled right now. |
| 4621 | if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) && |
| 4622 | (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)) |
| 4623 | { |
| 4624 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4625 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4626 | } |
| 4627 | } |
| 4628 | else |
| 4629 | { |
| 4630 | //11g is associated to an AP operating in 11n mode. |
| 4631 | //Change the HT operating mode to 'mixed mode'. |
| 4632 | psessionEntry->gLim11gParams.protectionEnabled = true; |
| 4633 | if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) |
| 4634 | { |
| 4635 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED; |
| 4636 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4637 | limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry); |
| 4638 | } |
| 4639 | } |
| 4640 | } |
| 4641 | |
| 4642 | //This part is common for staiton as well. |
| 4643 | if(false == psessionEntry->beaconParams.llgCoexist) |
| 4644 | { |
| 4645 | pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true; |
| 4646 | pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED; |
| 4647 | } |
| 4648 | #ifdef WLAN_SOFTAP_FEATURE |
| 4649 | else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled) |
| 4650 | { |
| 4651 | // As operating mode changed after G station assoc some way to update beacon |
| 4652 | // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled |
| 4653 | //pMac->sch.schObject.fBeaconChanged = 1; |
| 4654 | pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED; |
| 4655 | } |
| 4656 | #endif |
| 4657 | } |
| 4658 | else if (true == psessionEntry->beaconParams.llgCoexist) |
| 4659 | { |
| 4660 | //for AP role. |
| 4661 | //we need to take care of HT OP mode change if needed. |
| 4662 | //We need to take care of Overlap cases. |
| 4663 | |
| 4664 | #ifdef WLAN_SOFTAP_FEATURE |
| 4665 | if(eLIM_AP_ROLE == psessionEntry->limSystemRole) |
| 4666 | { |
| 4667 | if(overlap) |
| 4668 | { |
| 4669 | //Overlap Legacy protection disabled. |
| 4670 | if (psessionEntry->gLim11gParams.numSta == 0) |
| 4671 | psessionEntry->gLimOverlap11gParams.protectionEnabled = false; |
| 4672 | |
| 4673 | // no HT op mode change if any of the overlap protection enabled. |
| 4674 | if(!(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 4675 | psessionEntry->gLimOverlapHt20Params.protectionEnabled || |
| 4676 | psessionEntry->gLimOverlapNonGfParams.protectionEnabled)) |
| 4677 | { |
| 4678 | //Check if there is a need to change HT OP mode. |
| 4679 | if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode) |
| 4680 | { |
| 4681 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4682 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4683 | |
| 4684 | if(psessionEntry->gLimHt20Params.protectionEnabled){ |
| 4685 | //Commenting because of CR 258588 WFA cert |
| 4686 | //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4687 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4688 | } |
| 4689 | else |
| 4690 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4691 | } |
| 4692 | } |
| 4693 | } |
| 4694 | else |
| 4695 | { |
| 4696 | //Disable protection from 11G stations. |
| 4697 | psessionEntry->gLim11gParams.protectionEnabled = false; |
| 4698 | //Check if any other non-HT protection enabled. |
| 4699 | if(!psessionEntry->gLim11bParams.protectionEnabled) |
| 4700 | { |
| 4701 | |
| 4702 | //Right now we are in HT OP Mixed mode. |
| 4703 | //Change HT op mode appropriately. |
| 4704 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4705 | |
| 4706 | //Change HT OP mode to 01 if any overlap protection enabled |
| 4707 | if(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 4708 | psessionEntry->gLimOverlap11gParams.protectionEnabled || |
| 4709 | psessionEntry->gLimOverlapHt20Params.protectionEnabled || |
| 4710 | psessionEntry->gLimOverlapNonGfParams.protectionEnabled) |
| 4711 | |
| 4712 | { |
| 4713 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4714 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4715 | } |
| 4716 | else if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4717 | { |
| 4718 | //Commenting because of CR 258588 WFA cert |
| 4719 | //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4720 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4721 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4722 | } |
| 4723 | else |
| 4724 | { |
| 4725 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4726 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4727 | } |
| 4728 | } |
| 4729 | } |
| 4730 | if(!psessionEntry->gLimOverlap11gParams.protectionEnabled && |
| 4731 | !psessionEntry->gLim11gParams.protectionEnabled) |
| 4732 | { |
| 4733 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled\n"));) |
| 4734 | pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false; |
| 4735 | pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED; |
| 4736 | } |
| 4737 | }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) |
| 4738 | #else |
| 4739 | if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) |
| 4740 | #endif |
| 4741 | { |
| 4742 | if(overlap) |
| 4743 | { |
| 4744 | //Overlap Legacy protection disabled. |
| 4745 | pMac->lim.gLimOverlap11gParams.protectionEnabled = false; |
| 4746 | |
| 4747 | // no HT op mode change if any of the overlap protection enabled. |
| 4748 | if(!(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 4749 | psessionEntry->gLimOverlapHt20Params.protectionEnabled || |
| 4750 | psessionEntry->gLimOverlapNonGfParams.protectionEnabled)) |
| 4751 | { |
| 4752 | //Check if there is a need to change HT OP mode. |
| 4753 | if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode) |
| 4754 | { |
| 4755 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4756 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4757 | |
| 4758 | if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4759 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4760 | else |
| 4761 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 4762 | } |
| 4763 | } |
| 4764 | } |
| 4765 | else |
| 4766 | { |
| 4767 | //Disable protection from 11G stations. |
| 4768 | psessionEntry->gLim11gParams.protectionEnabled = false; |
| 4769 | //Check if any other non-HT protection enabled. |
| 4770 | if(!psessionEntry->gLim11bParams.protectionEnabled) |
| 4771 | { |
| 4772 | |
| 4773 | //Right now we are in HT OP Mixed mode. |
| 4774 | //Change HT op mode appropriately. |
| 4775 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4776 | |
| 4777 | //Change HT OP mode to 01 if any overlap protection enabled |
| 4778 | if(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 4779 | pMac->lim.gLimOverlap11gParams.protectionEnabled || |
| 4780 | pMac->lim.gLimOverlapHt20Params.protectionEnabled || |
| 4781 | pMac->lim.gLimOverlapNonGfParams.protectionEnabled) |
| 4782 | |
| 4783 | { |
| 4784 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4785 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4786 | } |
| 4787 | else if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 4788 | { |
| 4789 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4790 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4791 | } |
| 4792 | else |
| 4793 | { |
| 4794 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 4795 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4796 | } |
| 4797 | } |
| 4798 | } |
| 4799 | if(!pMac->lim.gLimOverlap11gParams.protectionEnabled && |
| 4800 | !psessionEntry->gLim11gParams.protectionEnabled) |
| 4801 | { |
| 4802 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled\n"));) |
| 4803 | pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false; |
| 4804 | pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED; |
| 4805 | } |
| 4806 | } |
| 4807 | //for station role |
| 4808 | else |
| 4809 | { |
| 4810 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled\n"));) |
| 4811 | pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false; |
| 4812 | pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED; |
| 4813 | } |
| 4814 | } |
| 4815 | return eSIR_SUCCESS; |
| 4816 | } |
| 4817 | //FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection. |
| 4818 | //This check will be done at the caller. |
| 4819 | |
| 4820 | /** ------------------------------------------------------------- |
| 4821 | \fn limEnableHtObssProtection |
| 4822 | \brief based on cofig enables\disables obss protection. |
| 4823 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 4824 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 4825 | \param tpUpdateBeaconParams pBeaconParams |
| 4826 | \return None |
| 4827 | -------------------------------------------------------------*/ |
| 4828 | tSirRetStatus |
| 4829 | limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable, |
| 4830 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 4831 | { |
| 4832 | |
| 4833 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4834 | if(!psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4835 | return eSIR_SUCCESS; // this protection is only for HT stations. |
| 4836 | |
| 4837 | //overlapping protection configuration check. |
| 4838 | if(overlap) |
| 4839 | { |
| 4840 | //overlapping protection configuration check. |
| 4841 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 4842 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && !pMac->lim.cfgProtection.overlapOBSS) |
| 4843 | { // ToDo Update this field |
| 4844 | // protection disabled. |
| 4845 | PELOG1(limLog(pMac, LOG1, FL("overlap protection from Obss is disabled\n"));) |
| 4846 | return eSIR_SUCCESS; |
| 4847 | } |
| 4848 | #endif |
| 4849 | } |
| 4850 | else |
| 4851 | { |
| 4852 | //normal protection config check |
| 4853 | #ifdef WLAN_SOFTAP_FEATURE |
| 4854 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss) |
| 4855 | { //ToDo Update this field |
| 4856 | // protection disabled. |
| 4857 | PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled\n"));) |
| 4858 | return eSIR_SUCCESS; |
| 4859 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 4860 | #endif |
| 4861 | { |
| 4862 | if(!pMac->lim.cfgProtection.obss) |
| 4863 | { //ToDo Update this field |
| 4864 | // protection disabled. |
| 4865 | PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled\n"));) |
| 4866 | return eSIR_SUCCESS; |
| 4867 | } |
| 4868 | } |
| 4869 | } |
| 4870 | |
| 4871 | |
| 4872 | #ifdef WLAN_SOFTAP_FEATURE |
| 4873 | if (eLIM_AP_ROLE == psessionEntry->limSystemRole){ |
| 4874 | if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) ) |
| 4875 | { |
| 4876 | PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled\n"));) |
| 4877 | psessionEntry->beaconParams.gHTObssMode = true; |
| 4878 | pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo> |
| 4879 | |
| 4880 | } |
| 4881 | else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode)) |
| 4882 | { |
| 4883 | PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled\n"));) |
| 4884 | psessionEntry->beaconParams.gHTObssMode = false; |
| 4885 | pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; |
| 4886 | |
| 4887 | } |
| 4888 | //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS |
| 4889 | if (!enable && !overlap) |
| 4890 | { |
| 4891 | psessionEntry->gLimOverlap11gParams.protectionEnabled = false; |
| 4892 | } |
| 4893 | } else |
| 4894 | #endif |
| 4895 | { |
| 4896 | if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) ) |
| 4897 | { |
| 4898 | PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled\n"));) |
| 4899 | psessionEntry->beaconParams.gHTObssMode = true; |
| 4900 | pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo> |
| 4901 | |
| 4902 | } |
| 4903 | else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode)) |
| 4904 | { |
| 4905 | |
| 4906 | PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled\n"));) |
| 4907 | psessionEntry->beaconParams.gHTObssMode = false; |
| 4908 | pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; |
| 4909 | |
| 4910 | } |
| 4911 | } |
| 4912 | return eSIR_SUCCESS; |
| 4913 | } |
| 4914 | /** ------------------------------------------------------------- |
| 4915 | \fn limEnableHT20Protection |
| 4916 | \brief based on cofig enables\disables protection from Ht20. |
| 4917 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 4918 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 4919 | \param tpUpdateBeaconParams pBeaconParams |
| 4920 | \return None |
| 4921 | -------------------------------------------------------------*/ |
| 4922 | tSirRetStatus |
| 4923 | limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable, |
| 4924 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 4925 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4926 | if(!psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4927 | return eSIR_SUCCESS; // this protection is only for HT stations. |
| 4928 | |
| 4929 | //overlapping protection configuration check. |
| 4930 | if(overlap) |
| 4931 | { |
| 4932 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 4933 | if(((psessionEntry->limSystemRole == eLIM_AP_ROLE )||(psessionEntry->limSystemRoleS == eLIM_BT_AMP_AP_ROLE ))&& !pMac->lim.cfgProtection.overlapHt20) |
| 4934 | { |
| 4935 | // protection disabled. |
| 4936 | PELOG3(limLog(pMac, LOG3, FL("overlap protection from HT 20 is disabled\n"));) |
| 4937 | return eSIR_SUCCESS; |
| 4938 | } |
| 4939 | #endif |
| 4940 | } |
| 4941 | else |
| 4942 | { |
| 4943 | //normal protection config check |
| 4944 | #ifdef WLAN_SOFTAP_FEATURE |
| 4945 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 4946 | !psessionEntry->cfgProtection.ht20) |
| 4947 | { |
| 4948 | // protection disabled. |
| 4949 | PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled\n"));) |
| 4950 | return eSIR_SUCCESS; |
| 4951 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE ) |
| 4952 | #endif |
| 4953 | { |
| 4954 | if(!pMac->lim.cfgProtection.ht20) |
| 4955 | { |
| 4956 | // protection disabled. |
| 4957 | PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled\n"));) |
| 4958 | return eSIR_SUCCESS; |
| 4959 | } |
| 4960 | } |
| 4961 | } |
| 4962 | |
| 4963 | if (enable) |
| 4964 | { |
| 4965 | //If we are AP and HT capable, we need to set the HT OP mode |
| 4966 | //appropriately. |
| 4967 | |
| 4968 | #ifdef WLAN_SOFTAP_FEATURE |
| 4969 | if(eLIM_AP_ROLE == psessionEntry->limSystemRole){ |
| 4970 | if(overlap) |
| 4971 | { |
| 4972 | psessionEntry->gLimOverlapHt20Params.protectionEnabled = true; |
| 4973 | if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) && |
| 4974 | (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)) |
| 4975 | { |
| 4976 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 4977 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 4978 | } |
| 4979 | } |
| 4980 | else |
| 4981 | { |
| 4982 | psessionEntry->gLimHt20Params.protectionEnabled = true; |
| 4983 | if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode) |
| 4984 | { |
| 4985 | //Commenting because of CR 258588 WFA cert |
| 4986 | //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 4987 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 4988 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4989 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 4990 | } |
| 4991 | } |
| 4992 | }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) |
| 4993 | #else |
| 4994 | if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) |
| 4995 | #endif |
| 4996 | { |
| 4997 | if(overlap) |
| 4998 | { |
| 4999 | pMac->lim.gLimOverlapHt20Params.protectionEnabled = true; |
| 5000 | if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) && |
| 5001 | (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)) |
| 5002 | { |
| 5003 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 5004 | limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry); |
| 5005 | } |
| 5006 | } |
| 5007 | else |
| 5008 | { |
| 5009 | psessionEntry->gLimHt20Params.protectionEnabled = true; |
| 5010 | if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode) |
| 5011 | { |
| 5012 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 5013 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5014 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5015 | } |
| 5016 | } |
| 5017 | } |
| 5018 | |
| 5019 | //This part is common for staiton as well. |
| 5020 | if(false == psessionEntry->beaconParams.ht20Coexist) |
| 5021 | { |
| 5022 | PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled\n"));) |
| 5023 | pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true; |
| 5024 | pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED; |
| 5025 | } |
| 5026 | } |
| 5027 | else if (true == psessionEntry->beaconParams.ht20Coexist) |
| 5028 | { |
| 5029 | //for AP role. |
| 5030 | //we need to take care of HT OP mode change if needed. |
| 5031 | //We need to take care of Overlap cases. |
| 5032 | #ifdef WLAN_SOFTAP_FEATURE |
| 5033 | if(eLIM_AP_ROLE == psessionEntry->limSystemRole){ |
| 5034 | if(overlap) |
| 5035 | { |
| 5036 | //Overlap Legacy protection disabled. |
| 5037 | psessionEntry->gLimOverlapHt20Params.protectionEnabled = false; |
| 5038 | |
| 5039 | // no HT op mode change if any of the overlap protection enabled. |
| 5040 | if(!(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 5041 | psessionEntry->gLimOverlap11gParams.protectionEnabled || |
| 5042 | psessionEntry->gLimOverlapHt20Params.protectionEnabled || |
| 5043 | psessionEntry->gLimOverlapNonGfParams.protectionEnabled)) |
| 5044 | { |
| 5045 | |
| 5046 | //Check if there is a need to change HT OP mode. |
| 5047 | if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode) |
| 5048 | { |
| 5049 | if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 5050 | { |
| 5051 | //Commented beacuse of CR 258588 for WFA Cert |
| 5052 | //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 5053 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 5054 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5055 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5056 | } |
| 5057 | else |
| 5058 | { |
| 5059 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 5060 | } |
| 5061 | } |
| 5062 | } |
| 5063 | } |
| 5064 | else |
| 5065 | { |
| 5066 | //Disable protection from 11G stations. |
| 5067 | psessionEntry->gLimHt20Params.protectionEnabled = false; |
| 5068 | |
| 5069 | //Change HT op mode appropriately. |
| 5070 | if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode) |
| 5071 | { |
| 5072 | psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 5073 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5074 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5075 | } |
| 5076 | } |
| 5077 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled\n"));) |
| 5078 | pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false; |
| 5079 | pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED; |
| 5080 | }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) |
| 5081 | #else |
| 5082 | if((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)) |
| 5083 | #endif |
| 5084 | { |
| 5085 | if(overlap) |
| 5086 | { |
| 5087 | //Overlap Legacy protection disabled. |
| 5088 | pMac->lim.gLimOverlapHt20Params.protectionEnabled = false; |
| 5089 | |
| 5090 | // no HT op mode change if any of the overlap protection enabled. |
| 5091 | if(!(psessionEntry->gLimOlbcParams.protectionEnabled || |
| 5092 | pMac->lim.gLimOverlap11gParams.protectionEnabled || |
| 5093 | pMac->lim.gLimOverlapHt20Params.protectionEnabled || |
| 5094 | pMac->lim.gLimOverlapNonGfParams.protectionEnabled)) |
| 5095 | { |
| 5096 | |
| 5097 | //Check if there is a need to change HT OP mode. |
| 5098 | if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode) |
| 5099 | { |
| 5100 | if(psessionEntry->gLimHt20Params.protectionEnabled) |
| 5101 | { |
| 5102 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 5103 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5104 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5105 | } |
| 5106 | else |
| 5107 | { |
| 5108 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 5109 | } |
| 5110 | } |
| 5111 | } |
| 5112 | } |
| 5113 | else |
| 5114 | { |
| 5115 | //Disable protection from 11G stations. |
| 5116 | psessionEntry->gLimHt20Params.protectionEnabled = false; |
| 5117 | |
| 5118 | //Change HT op mode appropriately. |
| 5119 | if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode) |
| 5120 | { |
| 5121 | pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 5122 | limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5123 | limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry); |
| 5124 | } |
| 5125 | } |
| 5126 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled\n"));) |
| 5127 | pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false; |
| 5128 | pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED; |
| 5129 | } |
| 5130 | //for station role |
| 5131 | else |
| 5132 | { |
| 5133 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled\n"));) |
| 5134 | pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false; |
| 5135 | pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED; |
| 5136 | } |
| 5137 | } |
| 5138 | |
| 5139 | return eSIR_SUCCESS; |
| 5140 | } |
| 5141 | |
| 5142 | /** ------------------------------------------------------------- |
| 5143 | \fn limEnableHTNonGfProtection |
| 5144 | \brief based on cofig enables\disables protection from NonGf. |
| 5145 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 5146 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 5147 | \param tpUpdateBeaconParams pBeaconParams |
| 5148 | \return None |
| 5149 | -------------------------------------------------------------*/ |
| 5150 | tSirRetStatus |
| 5151 | limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable, |
| 5152 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 5153 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5154 | if(!psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5155 | return eSIR_SUCCESS; // this protection is only for HT stations. |
| 5156 | |
| 5157 | //overlapping protection configuration check. |
| 5158 | if(overlap) |
| 5159 | { |
| 5160 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 5161 | if(((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && !pMac->lim.cfgProtection.overlapNonGf) |
| 5162 | { |
| 5163 | // protection disabled. |
| 5164 | PELOG3(limLog(pMac, LOG3, FL("overlap protection from NonGf is disabled\n"));) |
| 5165 | return eSIR_SUCCESS; |
| 5166 | } |
| 5167 | #endif |
| 5168 | } |
| 5169 | else |
| 5170 | { |
| 5171 | #ifdef WLAN_SOFTAP_FEATURE |
| 5172 | //normal protection config check |
| 5173 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 5174 | !psessionEntry->cfgProtection.nonGf) |
| 5175 | { |
| 5176 | // protection disabled. |
| 5177 | PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled\n"));) |
| 5178 | return eSIR_SUCCESS; |
| 5179 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 5180 | #endif |
| 5181 | { |
| 5182 | //normal protection config check |
| 5183 | if(!pMac->lim.cfgProtection.nonGf) |
| 5184 | { |
| 5185 | // protection disabled. |
| 5186 | PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled\n"));) |
| 5187 | return eSIR_SUCCESS; |
| 5188 | } |
| 5189 | } |
| 5190 | } |
| 5191 | #ifdef WLAN_SOFTAP_FEATURE |
| 5192 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 5193 | if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist)) |
| 5194 | { |
| 5195 | PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled\n"));) |
| 5196 | pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true; |
| 5197 | pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 5198 | } |
| 5199 | else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist)) |
| 5200 | { |
| 5201 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled\n"));) |
| 5202 | pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false; |
| 5203 | pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 5204 | } |
| 5205 | }else |
| 5206 | #endif |
| 5207 | { |
| 5208 | if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist)) |
| 5209 | { |
| 5210 | PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled\n"));) |
| 5211 | pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true; |
| 5212 | pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 5213 | } |
| 5214 | else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist)) |
| 5215 | { |
| 5216 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled\n"));) |
| 5217 | pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false; |
| 5218 | pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 5219 | } |
| 5220 | } |
| 5221 | |
| 5222 | return eSIR_SUCCESS; |
| 5223 | } |
| 5224 | |
| 5225 | /** ------------------------------------------------------------- |
| 5226 | \fn limEnableHTLsigTxopProtection |
| 5227 | \brief based on cofig enables\disables LsigTxop protection. |
| 5228 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 5229 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 5230 | \param tpUpdateBeaconParams pBeaconParams |
| 5231 | \return None |
| 5232 | -------------------------------------------------------------*/ |
| 5233 | tSirRetStatus |
| 5234 | limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable, |
| 5235 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 5236 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5237 | if(!psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | return eSIR_SUCCESS; // this protection is only for HT stations. |
| 5239 | |
| 5240 | //overlapping protection configuration check. |
| 5241 | if(overlap) |
| 5242 | { |
| 5243 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 5244 | if(((psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && !pMac->lim.cfgProtection.overlapLsigTxop) |
| 5245 | { |
| 5246 | // protection disabled. |
| 5247 | PELOG3(limLog(pMac, LOG3, FL(" overlap protection from LsigTxop not supported is disabled\n"));) |
| 5248 | return eSIR_SUCCESS; |
| 5249 | } |
| 5250 | #endif |
| 5251 | } |
| 5252 | else |
| 5253 | { |
| 5254 | #ifdef WLAN_SOFTAP_FEATURE |
| 5255 | //normal protection config check |
| 5256 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && |
| 5257 | !psessionEntry->cfgProtection.lsigTxop) |
| 5258 | { |
| 5259 | // protection disabled. |
| 5260 | PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled\n"));) |
| 5261 | return eSIR_SUCCESS; |
| 5262 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE) |
| 5263 | #endif |
| 5264 | { |
| 5265 | //normal protection config check |
| 5266 | if(!pMac->lim.cfgProtection.lsigTxop) |
| 5267 | { |
| 5268 | // protection disabled. |
| 5269 | PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled\n"));) |
| 5270 | return eSIR_SUCCESS; |
| 5271 | } |
| 5272 | } |
| 5273 | } |
| 5274 | |
| 5275 | |
| 5276 | #ifdef WLAN_SOFTAP_FEATURE |
| 5277 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 5278 | if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport)) |
| 5279 | { |
| 5280 | PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled\n"));) |
| 5281 | pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true; |
| 5282 | pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 5283 | } |
| 5284 | else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport)) |
| 5285 | { |
| 5286 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled\n"));) |
| 5287 | pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false; |
| 5288 | pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 5289 | } |
| 5290 | }else |
| 5291 | #endif |
| 5292 | { |
| 5293 | if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport)) |
| 5294 | { |
| 5295 | PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled\n"));) |
| 5296 | pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true; |
| 5297 | pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 5298 | } |
| 5299 | else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport)) |
| 5300 | { |
| 5301 | PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled\n"));) |
| 5302 | pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false; |
| 5303 | pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 5304 | } |
| 5305 | } |
| 5306 | return eSIR_SUCCESS; |
| 5307 | } |
| 5308 | //FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection. |
| 5309 | //This check will be done at the caller. |
| 5310 | /** ------------------------------------------------------------- |
| 5311 | \fn limEnableHtRifsProtection |
| 5312 | \brief based on cofig enables\disables Rifs protection. |
| 5313 | \param tANI_U8 enable : 1=> enable protection, 0=> disable protection. |
| 5314 | \param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 5315 | \param tpUpdateBeaconParams pBeaconParams |
| 5316 | \return None |
| 5317 | -------------------------------------------------------------*/ |
| 5318 | tSirRetStatus |
| 5319 | limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable, |
| 5320 | tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry) |
| 5321 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5322 | if(!psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5323 | return eSIR_SUCCESS; // this protection is only for HT stations. |
| 5324 | |
| 5325 | |
| 5326 | //overlapping protection configuration check. |
| 5327 | if(overlap) |
| 5328 | { |
| 5329 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 5330 | if(((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||(psessionEntry == eLIM_BT_AMP_AP_ROLE))&& !pMac->lim.cfgProtection.overlapRifs) |
| 5331 | { |
| 5332 | // protection disabled. |
| 5333 | PELOG3(limLog(pMac, LOG3, FL(" overlap protection from Rifs is disabled\n"));) |
| 5334 | return eSIR_SUCCESS; |
| 5335 | } |
| 5336 | #endif |
| 5337 | } |
| 5338 | else |
| 5339 | { |
| 5340 | #ifdef WLAN_SOFTAP_FEATURE |
| 5341 | //normal protection config check |
| 5342 | if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && |
| 5343 | !psessionEntry->cfgProtection.rifs) |
| 5344 | { |
| 5345 | // protection disabled. |
| 5346 | PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled\n"));) |
| 5347 | return eSIR_SUCCESS; |
| 5348 | }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE ) |
| 5349 | #endif |
| 5350 | { |
| 5351 | //normal protection config check |
| 5352 | if(!pMac->lim.cfgProtection.rifs) |
| 5353 | { |
| 5354 | // protection disabled. |
| 5355 | PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled\n"));) |
| 5356 | return eSIR_SUCCESS; |
| 5357 | } |
| 5358 | } |
| 5359 | } |
| 5360 | |
| 5361 | #ifdef WLAN_SOFTAP_FEATURE |
| 5362 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE){ |
| 5363 | // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS |
| 5364 | if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode)) |
| 5365 | { |
| 5366 | PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled\n"));) |
| 5367 | pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true; |
| 5368 | pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED; |
| 5369 | } |
| 5370 | // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS |
| 5371 | else if (enable && (true == psessionEntry->beaconParams.fRIFSMode)) |
| 5372 | { |
| 5373 | PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled\n"));) |
| 5374 | pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false; |
| 5375 | pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED; |
| 5376 | } |
| 5377 | }else |
| 5378 | #endif |
| 5379 | { |
| 5380 | // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS |
| 5381 | if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode)) |
| 5382 | { |
| 5383 | PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled\n"));) |
| 5384 | pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true; |
| 5385 | pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED; |
| 5386 | } |
| 5387 | // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS |
| 5388 | else if (enable && (true == psessionEntry->beaconParams.fRIFSMode)) |
| 5389 | { |
| 5390 | PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled\n"));) |
| 5391 | pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false; |
| 5392 | pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED; |
| 5393 | } |
| 5394 | } |
| 5395 | return eSIR_SUCCESS; |
| 5396 | } |
| 5397 | |
| 5398 | // --------------------------------------------------------------------- |
| 5399 | /** |
| 5400 | * limEnableShortPreamble |
| 5401 | * |
| 5402 | * FUNCTION: |
| 5403 | * Enable/Disable short preamble |
| 5404 | * |
| 5405 | * LOGIC: |
| 5406 | * |
| 5407 | * ASSUMPTIONS: |
| 5408 | * |
| 5409 | * NOTE: |
| 5410 | * |
| 5411 | * @param enable Flag to enable/disable short preamble |
| 5412 | * @return None |
| 5413 | */ |
| 5414 | |
| 5415 | tSirRetStatus |
| 5416 | limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 5417 | { |
| 5418 | tANI_U32 val; |
| 5419 | |
| 5420 | if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS) |
| 5421 | { |
| 5422 | /* Could not get short preamble enabled flag from CFG. Log error. */ |
| 5423 | limLog(pMac, LOGP, FL("could not retrieve short preamble flag\n")); |
| 5424 | return eSIR_FAILURE; |
| 5425 | } |
| 5426 | |
| 5427 | if (!val) |
| 5428 | return eSIR_SUCCESS; |
| 5429 | |
| 5430 | if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS) |
| 5431 | { |
| 5432 | limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag\n")); |
| 5433 | return eSIR_FAILURE; |
| 5434 | } |
| 5435 | |
| 5436 | if (!val) // 11G short preamble switching is disabled. |
| 5437 | return eSIR_SUCCESS; |
| 5438 | |
| 5439 | if ( psessionEntry->limSystemRole == eLIM_AP_ROLE ) |
| 5440 | { |
| 5441 | if (enable && (psessionEntry->beaconParams.fShortPreamble == 0)) |
| 5442 | { |
| 5443 | PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled\n"));) |
| 5444 | psessionEntry->beaconParams.fShortPreamble = true; |
| 5445 | pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble; |
| 5446 | pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED; |
| 5447 | } |
| 5448 | else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1)) |
| 5449 | { |
| 5450 | PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled\n"));) |
| 5451 | psessionEntry->beaconParams.fShortPreamble = false; |
| 5452 | pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble; |
| 5453 | pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED; |
| 5454 | } |
| 5455 | } |
| 5456 | |
| 5457 | return eSIR_SUCCESS; |
| 5458 | } |
| 5459 | |
| 5460 | /** |
| 5461 | * limTxComplete |
| 5462 | * |
| 5463 | * Function: |
| 5464 | * This is LIM's very own "TX MGMT frame complete" completion routine. |
| 5465 | * |
| 5466 | * Logic: |
| 5467 | * LIM wants to send a MGMT frame (broadcast or unicast) |
| 5468 | * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket ) |
| 5469 | * LIM transmits the MGMT frame using the API: |
| 5470 | * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData ) |
| 5471 | * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU |
| 5472 | * HDD, if it determines that a TX completion routine (in this case |
| 5473 | * limTxComplete) has been provided, will invoke this callback |
| 5474 | * LIM will try to free the TX MGMT packet that was earlier allocated, in order |
| 5475 | * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket ) |
| 5476 | * |
| 5477 | * Assumptions: |
| 5478 | * Presently, this is ONLY being used for MGMT frames/packets |
| 5479 | * TODO: |
| 5480 | * Would it do good for LIM to have some sort of "signature" validation to |
| 5481 | * ensure that the pData argument passed in was a buffer that was actually |
| 5482 | * allocated by LIM and/or is not corrupted? |
| 5483 | * |
| 5484 | * Note: FIXME and TODO |
| 5485 | * Looks like palPktFree() is interested in pPacket. But, when this completion |
| 5486 | * routine is called, only pData is made available to LIM!! |
| 5487 | * |
| 5488 | * @param void A pointer to pData. Shouldn't it be pPacket?! |
| 5489 | * |
| 5490 | * @return none |
| 5491 | */ |
| 5492 | void limTxComplete( tHalHandle hHal, void *pData ) |
| 5493 | { |
| 5494 | tpAniSirGlobal pMac; |
| 5495 | pMac = (tpAniSirGlobal)hHal; |
| 5496 | |
| 5497 | #ifdef FIXME_PRIMA |
| 5498 | /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */ |
| 5499 | #ifdef TRACE_RECORD |
| 5500 | { |
| 5501 | tpSirMacMgmtHdr mHdr; |
| 5502 | v_U8_t *pRxBd; |
| 5503 | vos_pkt_t *pVosPkt; |
| 5504 | VOS_STATUS vosStatus; |
| 5505 | |
| 5506 | |
| 5507 | |
| 5508 | pVosPkt = (vos_pkt_t *)pData; |
| 5509 | vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE); |
| 5510 | |
| 5511 | if(VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 5512 | { |
| 5513 | mHdr = WDA_GET_RX_MAC_HEADER(pRxBd); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5514 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | |
| 5516 | } |
| 5517 | } |
| 5518 | #endif |
| 5519 | #endif |
| 5520 | |
| 5521 | palPktFree( pMac->hHdd, |
| 5522 | HAL_TXRX_FRM_802_11_MGMT, |
| 5523 | (void *) NULL, // this is ignored and will likely be removed from this API |
| 5524 | (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine |
| 5525 | } |
| 5526 | |
| 5527 | /** |
| 5528 | * \brief This function updates lim global structure, if CB parameters in the BSS |
| 5529 | * have changed, and sends an indication to HAL also with the |
| 5530 | * updated HT Parameters. |
| 5531 | * This function does not detect the change in the primary channel, that is done as part |
| 5532 | * of channel Swtich IE processing. |
| 5533 | * If STA is configured with '20Mhz only' mode, then this function does not do anything |
| 5534 | * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz' |
| 5535 | * |
| 5536 | * |
| 5537 | * \param pMac Pointer to global MAC structure |
| 5538 | * |
| 5539 | * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or |
| 5540 | * Probe Response |
| 5541 | * |
| 5542 | * \param bssIdx BSS Index of the Bss to which Station is associated. |
| 5543 | * |
| 5544 | * |
| 5545 | */ |
| 5546 | |
| 5547 | void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac, |
| 5548 | tDot11fIEHTInfo *pHTInfo, |
| 5549 | tANI_U8 bssIdx, |
| 5550 | tpPESession psessionEntry) |
| 5551 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5552 | ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5553 | #if !defined WLAN_FEATURE_VOWIFI |
| 5554 | tANI_U32 localPwrConstraint; |
| 5555 | #endif |
| 5556 | |
| 5557 | //If self capability is set to '20Mhz only', then do not change the CB mode. |
| 5558 | #ifdef WLAN_SOFTAP_FEATURE |
| 5559 | if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry )) |
| 5560 | #else |
| 5561 | if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET )) |
| 5562 | #endif |
| 5563 | return; |
| 5564 | |
| 5565 | #if !defined WLAN_FEATURE_VOWIFI |
| 5566 | if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) { |
| 5567 | limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg\n" )); |
| 5568 | return; |
| 5569 | } |
| 5570 | #endif |
| 5571 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5572 | if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset || |
| 5573 | psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5574 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5575 | psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset; |
| 5576 | psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet; |
| 5577 | if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet ) |
| 5578 | secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5579 | |
| 5580 | // Notify HAL |
| 5581 | limLog( pMac, LOGW, FL( "Channel Information in HT IE change" |
| 5582 | "d; sending notification to HAL.\n" ) ); |
| 5583 | limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan" |
| 5584 | "nel Offset: %d, Channel Width: %d\n" ), |
| 5585 | pHTInfo->primaryChannel, secondaryChnlOffset, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5586 | psessionEntry->htRecommendedTxWidthSet ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5587 | |
| 5588 | #if defined WLAN_FEATURE_VOWIFI |
| 5589 | limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel, |
| 5590 | secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId); |
| 5591 | #else |
| 5592 | limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel, |
| 5593 | secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId); |
| 5594 | #endif |
| 5595 | |
| 5596 | //In case of IBSS, if STA should update HT Info IE in its beacons. |
| 5597 | if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole) |
| 5598 | { |
| 5599 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 5600 | } |
| 5601 | |
| 5602 | } |
| 5603 | } // End limUpdateStaRunTimeHTParams. |
| 5604 | |
| 5605 | /** |
| 5606 | * \brief This function updates the lim global structure, if any of the |
| 5607 | * HT Capabilities have changed. |
| 5608 | * |
| 5609 | * |
| 5610 | * \param pMac Pointer to Global MAC structure |
| 5611 | * |
| 5612 | * \param pHTCapability Pointer to HT Capability Information Element |
| 5613 | * obtained from a Beacon or Probe Response |
| 5614 | * |
| 5615 | * |
| 5616 | * |
| 5617 | */ |
| 5618 | |
| 5619 | void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac, |
| 5620 | tDot11fIEHTCaps *pHTCaps ) |
| 5621 | { |
| 5622 | |
| 5623 | if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection ) |
| 5624 | { |
| 5625 | pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection; |
| 5626 | // Send change notification to HAL |
| 5627 | } |
| 5628 | |
| 5629 | if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity ) |
| 5630 | { |
| 5631 | pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity; |
| 5632 | // Send change notification to HAL |
| 5633 | } |
| 5634 | |
| 5635 | if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor ) |
| 5636 | { |
| 5637 | pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor; |
| 5638 | // Send change notification to HAL |
| 5639 | } |
| 5640 | |
| 5641 | |
| 5642 | } // End limUpdateStaRunTimeHTCapability. |
| 5643 | |
| 5644 | /** |
| 5645 | * \brief This function updates lim global structure, if any of the HT |
| 5646 | * Info Parameters have changed. |
| 5647 | * |
| 5648 | * |
| 5649 | * \param pMac Pointer to the global MAC structure |
| 5650 | * |
| 5651 | * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or |
| 5652 | * Probe Response |
| 5653 | * |
| 5654 | * |
| 5655 | */ |
| 5656 | |
| 5657 | void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac, |
| 5658 | tDot11fIEHTInfo *pHTInfo , tpPESession psessionEntry) |
| 5659 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5660 | if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5661 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5662 | psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5663 | // Send change notification to HAL |
| 5664 | } |
| 5665 | |
| 5666 | if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode ) |
| 5667 | { |
| 5668 | psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode; |
| 5669 | // Send change notification to HAL |
| 5670 | } |
| 5671 | |
| 5672 | if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity ) |
| 5673 | { |
| 5674 | pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity; |
| 5675 | // Send change notification to HAL |
| 5676 | } |
| 5677 | |
| 5678 | if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode ) |
| 5679 | { |
| 5680 | pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode; |
| 5681 | // Send change notification to HAL |
| 5682 | } |
| 5683 | |
| 5684 | if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent ) |
| 5685 | { |
| 5686 | psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent; |
| 5687 | } |
| 5688 | |
| 5689 | if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS ) |
| 5690 | { |
| 5691 | pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS; |
| 5692 | // Send change notification to HAL |
| 5693 | } |
| 5694 | |
| 5695 | if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection ) |
| 5696 | { |
| 5697 | pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection; |
| 5698 | // Send change notification to HAL |
| 5699 | } |
| 5700 | |
| 5701 | if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon ) |
| 5702 | { |
| 5703 | pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon; |
| 5704 | // Send change notification to HAL |
| 5705 | } |
| 5706 | |
| 5707 | if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport ) |
| 5708 | { |
| 5709 | psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport; |
| 5710 | // Send change notification to HAL |
| 5711 | } |
| 5712 | |
| 5713 | if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive ) |
| 5714 | { |
| 5715 | pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive; |
| 5716 | // Send change notification to HAL |
| 5717 | } |
| 5718 | |
| 5719 | if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase ) |
| 5720 | { |
| 5721 | pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase; |
| 5722 | // Send change notification to HAL |
| 5723 | } |
| 5724 | |
| 5725 | } // End limUpdateStaRunTimeHTInfo. |
| 5726 | |
| 5727 | |
| 5728 | /** ------------------------------------------------------------- |
| 5729 | \fn limProcessHalIndMessages |
| 5730 | \brief callback function for HAL indication |
| 5731 | \param tpAniSirGlobal pMac |
| 5732 | \param tANI_U32 mesgId |
| 5733 | \param void *mesgParam |
| 5734 | \return tSirRetStatu - status |
| 5735 | -------------------------------------------------------------*/ |
| 5736 | |
| 5737 | tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam ) |
| 5738 | { |
| 5739 | //its PE's responsibility to free msgparam when its done extracting the message parameters. |
| 5740 | tSirMsgQ msg; |
| 5741 | |
| 5742 | switch(msgId) |
| 5743 | { |
| 5744 | case SIR_LIM_DEL_TS_IND: |
| 5745 | case SIR_LIM_ADD_BA_IND: |
| 5746 | case SIR_LIM_DEL_BA_ALL_IND: |
| 5747 | case SIR_LIM_DELETE_STA_CONTEXT_IND: |
| 5748 | case SIR_LIM_BEACON_GEN_IND: |
| 5749 | msg.type = (tANI_U16) msgId; |
| 5750 | msg.bodyptr = msgParam; |
| 5751 | msg.bodyval = 0; |
| 5752 | break; |
| 5753 | |
| 5754 | default: |
| 5755 | palFreeMemory(pMac->hHdd, msgParam); |
| 5756 | limLog(pMac, LOGP, FL("invalid message id = %d received\n"), msgId); |
| 5757 | return eSIR_FAILURE; |
| 5758 | } |
| 5759 | |
| 5760 | if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS) |
| 5761 | { |
| 5762 | palFreeMemory(pMac->hHdd, msgParam); |
| 5763 | limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type); |
| 5764 | return eSIR_FAILURE; |
| 5765 | } |
| 5766 | return eSIR_SUCCESS; |
| 5767 | } |
| 5768 | |
| 5769 | /** ------------------------------------------------------------- |
| 5770 | \fn limValidateDeltsReq |
| 5771 | \brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL |
| 5772 | \param tpAniSirGlobal pMac |
| 5773 | \param tpSirDeltsReq pDeltsReq |
| 5774 | \param tSirMacAddr peerMacAddr |
| 5775 | \return eSirRetStatus - status |
| 5776 | -------------------------------------------------------------*/ |
| 5777 | |
| 5778 | tSirRetStatus |
| 5779 | limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry) |
| 5780 | { |
| 5781 | tpDphHashNode pSta; |
| 5782 | tANI_U8 tsStatus; |
| 5783 | tSirMacTSInfo *tsinfo; |
| 5784 | tANI_U32 i; |
| 5785 | tANI_U8 tspecIdx; |
| 5786 | /* if sta |
| 5787 | * - verify assoc state |
| 5788 | * - del tspec locally |
| 5789 | * if ap, |
| 5790 | * - verify sta is in assoc state |
| 5791 | * - del sta tspec locally |
| 5792 | */ |
| 5793 | if(pDeltsReq == NULL) |
| 5794 | { |
| 5795 | PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL\n"));) |
| 5796 | return eSIR_FAILURE; |
| 5797 | } |
| 5798 | |
| 5799 | if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 5800 | { |
| 5801 | tANI_U32 val; |
| 5802 | |
| 5803 | // station always talks to the AP |
| 5804 | pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 5805 | |
| 5806 | val = sizeof(tSirMacAddr); |
| 5807 | #if 0 |
| 5808 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS) |
| 5809 | { |
| 5810 | /// Could not get BSSID from CFG. Log error. |
| 5811 | limLog(pMac, LOGP, FL("could not retrieve BSSID\n")); |
| 5812 | return eSIR_FAILURE; |
| 5813 | } |
| 5814 | #endif// TO SUPPORT BT-AMP |
| 5815 | sirCopyMacAddr(peerMacAddr,psessionEntry->bssId); |
| 5816 | |
| 5817 | } |
| 5818 | else |
| 5819 | { |
| 5820 | tANI_U16 assocId; |
| 5821 | tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr; |
| 5822 | |
| 5823 | assocId = pDeltsReq->aid; |
| 5824 | if (assocId != 0) |
| 5825 | pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable); |
| 5826 | else |
| 5827 | pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable); |
| 5828 | |
| 5829 | if (pSta != NULL) |
| 5830 | // TBD: check sta assoc state as well |
| 5831 | for (i =0; i < sizeof(tSirMacAddr); i++) |
| 5832 | macaddr[i] = pSta->staAddr[i]; |
| 5833 | } |
| 5834 | |
| 5835 | if (pSta == NULL) |
| 5836 | { |
| 5837 | PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req\n");) |
| 5838 | return eSIR_FAILURE; |
| 5839 | } |
| 5840 | |
| 5841 | if ((! pSta->valid) || |
| 5842 | (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE)) |
| 5843 | { |
| 5844 | PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq\n");) |
| 5845 | return eSIR_FAILURE; |
| 5846 | } |
| 5847 | |
| 5848 | pDeltsReq->req.wsmTspecPresent = 0; |
| 5849 | pDeltsReq->req.wmeTspecPresent = 0; |
| 5850 | pDeltsReq->req.lleTspecPresent = 0; |
| 5851 | |
| 5852 | if ((pSta->wsmEnabled) && |
| 5853 | (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA)) |
| 5854 | pDeltsReq->req.wsmTspecPresent = 1; |
| 5855 | else if (pSta->wmeEnabled) |
| 5856 | pDeltsReq->req.wmeTspecPresent = 1; |
| 5857 | else if (pSta->lleEnabled) |
| 5858 | pDeltsReq->req.lleTspecPresent = 1; |
| 5859 | else |
| 5860 | { |
| 5861 | PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled\n"));) |
| 5862 | return eSIR_FAILURE; |
| 5863 | } |
| 5864 | |
| 5865 | tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo |
| 5866 | : &pDeltsReq->req.tsinfo; |
| 5867 | PELOG1(limLog(pMac, LOG1, |
| 5868 | FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)\n"), |
| 5869 | pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent, |
| 5870 | tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);) |
| 5871 | |
| 5872 | // if no Access Control, ignore the request |
| 5873 | #if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK)) |
| 5874 | if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA)) |
| 5875 | if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))&& |
| 5876 | (! psessionEntry->gLimEdcaParamsBC[upToAc(tsinfo->traffic.userPrio)].aci.acm)) |
| 5877 | || (((psessionEntry->limSystemRole != eLIM_AP_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) && |
| 5878 | (! psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm))) |
| 5879 | { |
| 5880 | limLog(pMac, LOGW, FL("DelTs with acecssPolicy = %d and UP %d , AC = %d has no AC - ignoring request\n"), |
| 5881 | tsinfo->traffic.accessPolicy, tsinfo->traffic.userPrio, upToAc(tsinfo->traffic.userPrio)); |
| 5882 | return eSIR_FAILURE; |
| 5883 | } |
| 5884 | #endif |
| 5885 | |
| 5886 | if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx) |
| 5887 | != eSIR_SUCCESS) |
| 5888 | { |
| 5889 | PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)\n", |
| 5890 | pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);) |
| 5891 | return eSIR_FAILURE; |
| 5892 | } |
| 5893 | else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 5894 | (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)) |
| 5895 | { |
| 5896 | //edca only now. |
| 5897 | } |
| 5898 | else |
| 5899 | { |
| 5900 | if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) && |
| 5901 | psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm) |
| 5902 | { |
| 5903 | //send message to HAL to delete TS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5904 | if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req, psessionEntry->peSessionId)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5905 | { |
| 5906 | limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request\n"), |
| 5907 | tsinfo->traffic.userPrio); |
| 5908 | return eSIR_FAILURE; |
| 5909 | } |
| 5910 | } |
| 5911 | } |
| 5912 | return eSIR_SUCCESS; |
| 5913 | } |
| 5914 | |
| 5915 | /** ------------------------------------------------------------- |
| 5916 | \fn limRegisterHalIndCallBack |
| 5917 | \brief registers callback function to HAL for any indication. |
| 5918 | \param tpAniSirGlobal pMac |
| 5919 | \return none. |
| 5920 | -------------------------------------------------------------*/ |
| 5921 | void |
| 5922 | limRegisterHalIndCallBack(tpAniSirGlobal pMac) |
| 5923 | { |
| 5924 | tSirMsgQ msg; |
| 5925 | tpHalIndCB pHalCB; |
| 5926 | |
| 5927 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pHalCB, sizeof(tHalIndCB))) |
| 5928 | { |
| 5929 | limLog(pMac, LOGP, FL("palAllocateMemory() failed\n")); |
| 5930 | return; |
| 5931 | } |
| 5932 | |
| 5933 | pHalCB->pHalIndCB = limProcessHalIndMessages; |
| 5934 | |
| 5935 | msg.type = WDA_REGISTER_PE_CALLBACK; |
| 5936 | msg.bodyptr = pHalCB; |
| 5937 | msg.bodyval = 0; |
| 5938 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5939 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 5941 | { |
| 5942 | palFreeMemory(pMac->hHdd, pHalCB); |
| 5943 | limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed\n")); |
| 5944 | } |
| 5945 | |
| 5946 | return; |
| 5947 | } |
| 5948 | |
| 5949 | |
| 5950 | /** ------------------------------------------------------------- |
| 5951 | \fn limProcessAddBaInd |
| 5952 | |
| 5953 | \brief handles the BA activity check timeout indication coming from HAL. |
| 5954 | Validates the request, posts request for sending addBaReq message for every candidate in the list. |
| 5955 | \param tpAniSirGlobal pMac |
| 5956 | \param tSirMsgQ limMsg |
| 5957 | \return None |
| 5958 | -------------------------------------------------------------*/ |
| 5959 | void |
| 5960 | limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg) |
| 5961 | { |
| 5962 | tANI_U8 i; |
| 5963 | tANI_U8 tid; |
| 5964 | tANI_U16 assocId; |
| 5965 | tpDphHashNode pSta; |
| 5966 | tpAddBaCandidate pBaCandidate; |
| 5967 | tANI_U32 baCandidateCnt; |
| 5968 | tpBaActivityInd pBaActivityInd; |
| 5969 | tpPESession psessionEntry; |
| 5970 | tANI_U8 sessionId; |
| 5971 | |
| 5972 | |
| 5973 | |
| 5974 | if(limMsg->bodyptr == NULL) |
| 5975 | return; |
| 5976 | |
| 5977 | pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr; |
| 5978 | baCandidateCnt = pBaActivityInd->baCandidateCnt; |
| 5979 | |
| 5980 | if((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL) |
| 5981 | { |
| 5982 | limLog(pMac, LOGE,FL("session does not exist for given BSSId\n")); |
| 5983 | palFreeMemory(pMac->hHdd, limMsg->bodyptr); |
| 5984 | return; |
| 5985 | } |
| 5986 | |
| 5987 | //if we are not HT capable we don't need to handle BA timeout indication from HAL. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5988 | if( (baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5989 | { |
| 5990 | palFreeMemory(pMac->hHdd, limMsg->bodyptr); |
| 5991 | return; |
| 5992 | } |
| 5993 | |
| 5994 | //delete the complete dialoguetoken linked list |
| 5995 | limDeleteDialogueTokenList(pMac); |
| 5996 | pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd)); |
| 5997 | |
| 5998 | for(i=0; i<baCandidateCnt; i++, pBaCandidate++) |
| 5999 | { |
| 6000 | pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable); |
| 6001 | if( (NULL == pSta) || (!pSta->valid)) |
| 6002 | continue; |
| 6003 | |
| 6004 | for (tid=0; tid<STACFG_MAX_TC; tid++) |
| 6005 | { |
| 6006 | if( (eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) && |
| 6007 | (pBaCandidate->baInfo[tid].fBaEnable)) |
| 6008 | { |
| 6009 | PELOG2(limLog(pMac, LOG2, FL("BA setup for staId = %d, TID: %d, SSN:%d.\n"), |
| 6010 | pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);) |
| 6011 | limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry); |
| 6012 | } |
| 6013 | } |
| 6014 | } |
| 6015 | palFreeMemory(pMac->hHdd, limMsg->bodyptr); |
| 6016 | return; |
| 6017 | } |
| 6018 | |
| 6019 | |
| 6020 | /** ------------------------------------------------------------- |
| 6021 | \fn limDelAllBASessions |
| 6022 | \brief Deletes all the exisitng BA sessions. |
| 6023 | \ Note : This API is provided for Mac OSx only. The reason for this is that Mac OSx may not |
| 6024 | \ restart after CFG update. |
| 6025 | \param tpAniSirGlobal pMac |
| 6026 | \return None |
| 6027 | -------------------------------------------------------------*/ |
| 6028 | |
| 6029 | void |
| 6030 | limDelAllBASessions(tpAniSirGlobal pMac) |
| 6031 | { |
| 6032 | tANI_U32 i; |
| 6033 | tANI_U8 tid; |
| 6034 | tpDphHashNode pSta; |
| 6035 | |
| 6036 | tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry????? |
| 6037 | for(tid = 0; tid < STACFG_MAX_TC; tid++) |
| 6038 | { |
| 6039 | if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)|| |
| 6040 | (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)) |
| 6041 | { |
| 6042 | for(i = 0; i < pMac->lim.maxStation; i++) |
| 6043 | { |
| 6044 | pSta = psessionEntry->dph.dphHashTable.pDphNodeArray + i; |
| 6045 | if (pSta && pSta->added) |
| 6046 | { |
| 6047 | if(eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) |
| 6048 | { |
| 6049 | limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry); |
| 6050 | } |
| 6051 | else if(eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) |
| 6052 | { |
| 6053 | limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry); |
| 6054 | } |
| 6055 | } |
| 6056 | } |
| 6057 | } |
| 6058 | else if((eLIM_STA_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole)) |
| 6059 | { |
| 6060 | pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 6061 | if (pSta && pSta->added) |
| 6062 | { |
| 6063 | if(eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) |
| 6064 | { |
| 6065 | limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry); |
| 6066 | } |
| 6067 | if(eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) |
| 6068 | { |
| 6069 | limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry); |
| 6070 | } |
| 6071 | } |
| 6072 | } |
| 6073 | } |
| 6074 | } |
| 6075 | /** ------------------------------------------------------------- |
| 6076 | \fn limProcessDelTsInd |
| 6077 | \brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases. |
| 6078 | Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD. |
| 6079 | \param tpAniSirGlobal pMac |
| 6080 | \param tSirMsgQ limMsg |
| 6081 | \return None |
| 6082 | -------------------------------------------------------------*/ |
| 6083 | void |
| 6084 | limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg) |
| 6085 | { |
| 6086 | tpDphHashNode pSta; |
| 6087 | tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr); |
| 6088 | tpSirDeltsReq pDelTsReq = NULL; |
| 6089 | tSirMacAddr peerMacAddr; |
| 6090 | tpSirDeltsReqInfo pDelTsReqInfo; |
| 6091 | tpLimTspecInfo pTspecInfo; |
| 6092 | tpPESession psessionEntry; |
| 6093 | tANI_U8 sessionId; |
| 6094 | |
| 6095 | if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL) |
| 6096 | { |
| 6097 | limLog(pMac, LOGE,FL("session does not exist for given BssId\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6098 | palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6099 | return; |
| 6100 | } |
| 6101 | |
| 6102 | pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]); |
| 6103 | if(pTspecInfo->inuse == false) |
| 6104 | { |
| 6105 | PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use\n"), pDelTsParam->tspecIdx);) |
| 6106 | goto error1; |
| 6107 | } |
| 6108 | |
| 6109 | pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable); |
| 6110 | if(pSta == NULL) |
| 6111 | { |
| 6112 | limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d\n"), |
| 6113 | pTspecInfo->assocId); |
| 6114 | goto error1; |
| 6115 | } |
| 6116 | |
| 6117 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReq, sizeof(tSirDeltsReq))) |
| 6118 | { |
| 6119 | PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));) |
| 6120 | goto error1; |
| 6121 | } |
| 6122 | |
| 6123 | palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq)); |
| 6124 | |
| 6125 | if(pSta->wmeEnabled) |
| 6126 | palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE)); |
| 6127 | else |
| 6128 | palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo)); |
| 6129 | |
| 6130 | |
| 6131 | //validate the req |
| 6132 | if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry)) |
| 6133 | { |
| 6134 | PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed\n"));) |
| 6135 | goto error2; |
| 6136 | } |
| 6137 | PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x\n", |
| 6138 | pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2], |
| 6139 | peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);) |
| 6140 | |
| 6141 | limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec, |
| 6142 | psessionEntry); |
| 6143 | |
| 6144 | // prepare and send an sme indication to HDD |
| 6145 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReqInfo, sizeof(tSirDeltsReqInfo))) |
| 6146 | { |
| 6147 | PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));) |
| 6148 | goto error3; |
| 6149 | } |
| 6150 | palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo)); |
| 6151 | |
| 6152 | if(pSta->wmeEnabled) |
| 6153 | palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE)); |
| 6154 | else |
| 6155 | palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo)); |
| 6156 | |
| 6157 | limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry); |
| 6158 | |
| 6159 | error3: |
| 6160 | palFreeMemory(pMac->hHdd, (void *) pDelTsReqInfo); |
| 6161 | error2: |
| 6162 | palFreeMemory(pMac->hHdd, (void *) pDelTsReq); |
| 6163 | error1: |
| 6164 | palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr)); |
| 6165 | return; |
| 6166 | } |
| 6167 | |
| 6168 | /** |
| 6169 | * \brief Setup an A-MPDU/BA session |
| 6170 | * |
| 6171 | * \sa limPostMlmAddBAReq |
| 6172 | * |
| 6173 | * \param pMac The global tpAniSirGlobal object |
| 6174 | * |
| 6175 | * \param pStaDs DPH Hash Node object of peer STA |
| 6176 | * |
| 6177 | * \param tid TID for which a BA is being setup. |
| 6178 | * If this is set to 0xFFFF, then we retrieve |
| 6179 | * the default TID from the CFG |
| 6180 | * |
| 6181 | * \return eSIR_SUCCESS if setup completes successfully |
| 6182 | * eSIR_FAILURE is some problem is encountered |
| 6183 | */ |
| 6184 | tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac, |
| 6185 | tpDphHashNode pStaDs, |
| 6186 | tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry) |
| 6187 | { |
| 6188 | tSirRetStatus status = eSIR_SUCCESS; |
| 6189 | tpLimMlmAddBAReq pMlmAddBAReq; |
| 6190 | tpDialogueToken dialogueTokenNode; |
| 6191 | tANI_U32 val = 0; |
| 6192 | |
| 6193 | // Check if the peer is a 11n capable STA |
| 6194 | // FIXME - Need a 11n peer indication in DPH. |
| 6195 | // For now, using the taurusPeer attribute |
| 6196 | //if( 0 == pStaDs->taurusPeer == ) |
| 6197 | //return eSIR_SUCCESS; |
| 6198 | |
| 6199 | // Allocate for LIM_MLM_ADDBA_REQ |
| 6200 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 6201 | (void **) &pMlmAddBAReq, |
| 6202 | sizeof( tLimMlmAddBAReq ))) |
| 6203 | { |
| 6204 | limLog( pMac, LOGP, FL("palAllocateMemory failed\n")); |
| 6205 | status = eSIR_MEM_ALLOC_FAILED; |
| 6206 | goto returnFailure; |
| 6207 | } |
| 6208 | |
| 6209 | palZeroMemory( pMac->hHdd, (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq )); |
| 6210 | |
| 6211 | // Copy the peer MAC |
| 6212 | palCopyMemory( pMac->hHdd, |
| 6213 | pMlmAddBAReq->peerMacAddr, |
| 6214 | pStaDs->staAddr, |
| 6215 | sizeof( tSirMacAddr )); |
| 6216 | |
| 6217 | // Update the TID |
| 6218 | pMlmAddBAReq->baTID = tid; |
| 6219 | |
| 6220 | // Determine the supported BA policy of local STA |
| 6221 | // for the TID of interest |
| 6222 | pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1; |
| 6223 | |
| 6224 | // BA Buffer Size |
| 6225 | // Requesting the ADDBA recipient to populate the size. |
| 6226 | // If ADDBA is accepted, a non-zero buffer size should |
| 6227 | // be returned in the ADDBA Rsp |
| 6228 | pMlmAddBAReq->baBufferSize = 0; |
| 6229 | |
| 6230 | limLog( pMac, LOGW, |
| 6231 | FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d\n" ), |
| 6232 | (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"), |
| 6233 | pStaDs->staIndex, |
| 6234 | tid ); |
| 6235 | |
| 6236 | // BA Timeout |
| 6237 | // pMlmAddBAReq->baTimeout = pMac->hal.halMac.baTimeout; // In TU's |
| 6238 | if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS) |
| 6239 | { |
| 6240 | limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG\n")); |
| 6241 | status = eSIR_FAILURE; |
| 6242 | goto returnFailure; |
| 6243 | } |
| 6244 | pMlmAddBAReq->baTimeout = val; // In TU's |
| 6245 | |
| 6246 | // ADDBA Failure Timeout |
| 6247 | // FIXME_AMPDU - Need to retrieve this from CFG. |
| 6248 | //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec. |
| 6249 | pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's |
| 6250 | |
| 6251 | // BA Starting Sequence Number |
| 6252 | pMlmAddBAReq->baSSN = startingSeqNum; |
| 6253 | |
| 6254 | /* Update PE session Id*/ |
| 6255 | pMlmAddBAReq->sessionId = psessionEntry->peSessionId; |
| 6256 | |
| 6257 | LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP); |
| 6258 | |
| 6259 | if( NULL == (dialogueTokenNode = limAssignDialogueToken(pMac))) |
| 6260 | goto returnFailure; |
| 6261 | |
| 6262 | pMlmAddBAReq->baDialogToken = dialogueTokenNode->token; |
| 6263 | //set assocId and tid information in the lim linked list |
| 6264 | dialogueTokenNode->assocId = pStaDs->assocId; |
| 6265 | dialogueTokenNode->tid = tid; |
| 6266 | // Send ADDBA Req to MLME |
| 6267 | limPostMlmMessage( pMac, |
| 6268 | LIM_MLM_ADDBA_REQ, |
| 6269 | (tANI_U32 *) pMlmAddBAReq ); |
| 6270 | |
| 6271 | returnFailure: |
| 6272 | |
| 6273 | return status; |
| 6274 | } |
| 6275 | |
| 6276 | /** |
| 6277 | * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME |
| 6278 | * will then send an ADDBA Rsp to peer MAC entity |
| 6279 | * with the appropriate ADDBA status code |
| 6280 | * |
| 6281 | * \sa limPostMlmAddBARsp |
| 6282 | * |
| 6283 | * \param pMac The global tpAniSirGlobal object |
| 6284 | * |
| 6285 | * \param peerMacAddr MAC address of peer entity that will |
| 6286 | * be the recipient of this ADDBA Rsp |
| 6287 | * |
| 6288 | * \param baStatusCode ADDBA Rsp status code |
| 6289 | * |
| 6290 | * \param baDialogToken ADDBA Rsp dialog token |
| 6291 | * |
| 6292 | * \param baTID TID of interest |
| 6293 | * |
| 6294 | * \param baPolicy The BA policy |
| 6295 | * |
| 6296 | * \param baBufferSize The BA buffer size |
| 6297 | * |
| 6298 | * \param baTimeout BA timeout in TU's |
| 6299 | * |
| 6300 | * \return eSIR_SUCCESS if setup completes successfully |
| 6301 | * eSIR_FAILURE is some problem is encountered |
| 6302 | */ |
| 6303 | tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac, |
| 6304 | tSirMacAddr peerMacAddr, |
| 6305 | tSirMacStatusCodes baStatusCode, |
| 6306 | tANI_U8 baDialogToken, |
| 6307 | tANI_U8 baTID, |
| 6308 | tANI_U8 baPolicy, |
| 6309 | tANI_U16 baBufferSize, |
| 6310 | tANI_U16 baTimeout, |
| 6311 | tpPESession psessionEntry) |
| 6312 | { |
| 6313 | tSirRetStatus status = eSIR_SUCCESS; |
| 6314 | tpLimMlmAddBARsp pMlmAddBARsp; |
| 6315 | |
| 6316 | // Allocate for LIM_MLM_ADDBA_RSP |
| 6317 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 6318 | (void **) &pMlmAddBARsp, |
| 6319 | sizeof( tLimMlmAddBARsp ))) |
| 6320 | { |
| 6321 | limLog( pMac, LOGE, |
| 6322 | FL("palAllocateMemory failed with error code %d\n"), |
| 6323 | status ); |
| 6324 | |
| 6325 | status = eSIR_MEM_ALLOC_FAILED; |
| 6326 | goto returnFailure; |
| 6327 | } |
| 6328 | |
| 6329 | palZeroMemory( pMac->hHdd, (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp )); |
| 6330 | |
| 6331 | // Copy the peer MAC |
| 6332 | palCopyMemory( pMac->hHdd, |
| 6333 | pMlmAddBARsp->peerMacAddr, |
| 6334 | peerMacAddr, |
| 6335 | sizeof( tSirMacAddr )); |
| 6336 | |
| 6337 | pMlmAddBARsp->baDialogToken = baDialogToken; |
| 6338 | pMlmAddBARsp->addBAResultCode = baStatusCode; |
| 6339 | pMlmAddBARsp->baTID = baTID; |
| 6340 | pMlmAddBARsp->baPolicy = baPolicy; |
| 6341 | pMlmAddBARsp->baBufferSize = baBufferSize; |
| 6342 | pMlmAddBARsp->baTimeout = baTimeout; |
| 6343 | |
| 6344 | /* UPdate PE session ID*/ |
| 6345 | pMlmAddBARsp->sessionId = psessionEntry->peSessionId; |
| 6346 | |
| 6347 | // Send ADDBA Rsp to MLME |
| 6348 | limPostMlmMessage( pMac, |
| 6349 | LIM_MLM_ADDBA_RSP, |
| 6350 | (tANI_U32 *) pMlmAddBARsp ); |
| 6351 | |
| 6352 | returnFailure: |
| 6353 | |
| 6354 | return status; |
| 6355 | } |
| 6356 | |
| 6357 | /** |
| 6358 | * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME |
| 6359 | * will then send an DELBA Ind to peer MAC entity |
| 6360 | * with the appropriate DELBA status code |
| 6361 | * |
| 6362 | * \sa limPostMlmDelBAReq |
| 6363 | * |
| 6364 | * \param pMac The global tpAniSirGlobal object |
| 6365 | * |
| 6366 | * \param pSta DPH Hash Node object of peer MAC entity |
| 6367 | * for which the BA session is being deleted |
| 6368 | * |
| 6369 | * \param baDirection DELBA direction |
| 6370 | * |
| 6371 | * \param baTID TID for which the BA session is being deleted |
| 6372 | * |
| 6373 | * \param baReasonCode DELBA Req reason code |
| 6374 | * |
| 6375 | * \return eSIR_SUCCESS if setup completes successfully |
| 6376 | * eSIR_FAILURE is some problem is encountered |
| 6377 | */ |
| 6378 | tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac, |
| 6379 | tpDphHashNode pSta, |
| 6380 | tANI_U8 baDirection, |
| 6381 | tANI_U8 baTID, |
| 6382 | tSirMacReasonCodes baReasonCode, |
| 6383 | tpPESession psessionEntry) |
| 6384 | { |
| 6385 | tSirRetStatus status = eSIR_SUCCESS; |
| 6386 | tpLimMlmDelBAReq pMlmDelBAReq; |
| 6387 | tLimBAState curBaState; |
| 6388 | |
| 6389 | if(NULL == pSta) |
| 6390 | return eSIR_FAILURE; |
| 6391 | |
| 6392 | LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState); |
| 6393 | |
| 6394 | // Need to validate the current BA State. |
| 6395 | if( eLIM_BA_STATE_IDLE != curBaState) |
| 6396 | { |
| 6397 | limLog( pMac, LOGE, |
| 6398 | FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d\n" ), |
| 6399 | baTID, |
| 6400 | curBaState); |
| 6401 | |
| 6402 | status = eSIR_FAILURE; |
| 6403 | goto returnFailure; |
| 6404 | } |
| 6405 | |
| 6406 | // Allocate for LIM_MLM_DELBA_REQ |
| 6407 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 6408 | (void **) &pMlmDelBAReq, |
| 6409 | sizeof( tLimMlmDelBAReq ))) |
| 6410 | { |
| 6411 | limLog( pMac, LOGE, |
| 6412 | FL("palAllocateMemory failed with error code %d\n"), |
| 6413 | status ); |
| 6414 | |
| 6415 | status = eSIR_MEM_ALLOC_FAILED; |
| 6416 | goto returnFailure; |
| 6417 | } |
| 6418 | |
| 6419 | palZeroMemory( pMac->hHdd, (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq )); |
| 6420 | |
| 6421 | // Copy the peer MAC |
| 6422 | palCopyMemory( pMac->hHdd, |
| 6423 | pMlmDelBAReq->peerMacAddr, |
| 6424 | pSta->staAddr, |
| 6425 | sizeof( tSirMacAddr )); |
| 6426 | |
| 6427 | pMlmDelBAReq->baDirection = baDirection; |
| 6428 | pMlmDelBAReq->baTID = baTID; |
| 6429 | pMlmDelBAReq->delBAReasonCode = baReasonCode; |
| 6430 | |
| 6431 | /* Update PE session ID*/ |
| 6432 | pMlmDelBAReq->sessionId = psessionEntry->peSessionId; |
| 6433 | |
| 6434 | //we don't have valid BA session for the given direction. |
| 6435 | // HDD wants to get the BA session deleted on PEER in this case. |
| 6436 | // in this case we just need to send DelBA to the peer. |
| 6437 | if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) || |
| 6438 | ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx))) |
| 6439 | { |
| 6440 | // Send DELBA Ind over the air |
| 6441 | if( eSIR_SUCCESS != |
| 6442 | (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry))) |
| 6443 | status = eSIR_FAILURE; |
| 6444 | |
| 6445 | palFreeMemory(pMac->hHdd, (void*) pMlmDelBAReq); |
| 6446 | return status; |
| 6447 | } |
| 6448 | |
| 6449 | |
| 6450 | // Update the BA state in STA |
| 6451 | LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP); |
| 6452 | |
| 6453 | // Send DELBA Req to MLME |
| 6454 | limPostMlmMessage( pMac, |
| 6455 | LIM_MLM_DELBA_REQ, |
| 6456 | (tANI_U32 *) pMlmDelBAReq ); |
| 6457 | |
| 6458 | returnFailure: |
| 6459 | |
| 6460 | return status; |
| 6461 | } |
| 6462 | |
| 6463 | /** |
| 6464 | * \brief Send WDA_ADDBA_REQ to HAL, in order |
| 6465 | * to setup a new BA session with a peer |
| 6466 | * |
| 6467 | * \sa limPostMsgAddBAReq |
| 6468 | * |
| 6469 | * \param pMac The global tpAniSirGlobal object |
| 6470 | * |
| 6471 | * \param pSta Runtime, STA-related configuration cached |
| 6472 | * in the HashNode object |
| 6473 | * |
| 6474 | * \param baDialogToken The Action Frame dialog token |
| 6475 | * |
| 6476 | * \param baTID TID for which the BA session is being setup |
| 6477 | * |
| 6478 | * \param baPolicy BA Policy |
| 6479 | * |
| 6480 | * \param baBufferSize The requested BA buffer size |
| 6481 | * |
| 6482 | * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced |
| 6483 | * |
| 6484 | * \param baSSN Starting Sequence Number for this BA session |
| 6485 | * |
| 6486 | * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient |
| 6487 | * |
| 6488 | * \return none |
| 6489 | * |
| 6490 | */ |
| 6491 | tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac, |
| 6492 | tpDphHashNode pSta, |
| 6493 | tANI_U8 baDialogToken, |
| 6494 | tANI_U8 baTID, |
| 6495 | tANI_U8 baPolicy, |
| 6496 | tANI_U16 baBufferSize, |
| 6497 | tANI_U16 baTimeout, |
| 6498 | tANI_U16 baSSN, |
| 6499 | tANI_U8 baDirection, |
| 6500 | tpPESession psessionEntry) |
| 6501 | { |
| 6502 | tpAddBAParams pAddBAParams = NULL; |
| 6503 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 6504 | eHalStatus status; |
| 6505 | tSirMsgQ msgQ; |
| 6506 | |
| 6507 | #ifdef WLAN_SOFTAP_VSTA_FEATURE |
| 6508 | // we can only do BA on "hard" STAs |
| 6509 | if (!(IS_HWSTA_IDX(pSta->staIndex))) |
| 6510 | { |
| 6511 | retCode = eHAL_STATUS_FAILURE; |
| 6512 | goto returnFailure; |
| 6513 | } |
| 6514 | #endif //WLAN_SOFTAP_VSTA_FEATURE |
| 6515 | |
| 6516 | // Allocate for WDA_ADDBA_REQ |
| 6517 | if( eHAL_STATUS_SUCCESS != |
| 6518 | (status = palAllocateMemory( pMac->hHdd, |
| 6519 | (void **) &pAddBAParams, |
| 6520 | sizeof( tAddBAParams )))) |
| 6521 | { |
| 6522 | limLog( pMac, LOGE, |
| 6523 | FL("palAllocateMemory failed with error code %d\n"), |
| 6524 | status ); |
| 6525 | |
| 6526 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 6527 | goto returnFailure; |
| 6528 | } |
| 6529 | |
| 6530 | palZeroMemory( pMac->hHdd, (void *) pAddBAParams, sizeof( tAddBAParams )); |
| 6531 | |
| 6532 | // Copy the peer MAC address |
| 6533 | palCopyMemory( pMac->hHdd, |
| 6534 | (void *) pAddBAParams->peerMacAddr, |
| 6535 | (void *) pSta->staAddr, |
| 6536 | sizeof( tSirMacAddr )); |
| 6537 | |
| 6538 | // Populate the REQ parameters |
| 6539 | pAddBAParams->staIdx = pSta->staIndex; |
| 6540 | pAddBAParams->baDialogToken = baDialogToken; |
| 6541 | pAddBAParams->baTID = baTID; |
| 6542 | pAddBAParams->baPolicy = baPolicy; |
| 6543 | pAddBAParams->baBufferSize = baBufferSize; |
| 6544 | pAddBAParams->baTimeout = baTimeout; |
| 6545 | pAddBAParams->baSSN = baSSN; |
| 6546 | pAddBAParams->baDirection = baDirection; |
| 6547 | pAddBAParams->respReqd = 1; |
| 6548 | |
| 6549 | /* UPdate PE session ID */ |
| 6550 | pAddBAParams->sessionId = psessionEntry->peSessionId; |
| 6551 | |
| 6552 | // Post WDA_ADDBA_REQ to HAL. |
| 6553 | msgQ.type = WDA_ADDBA_REQ; |
| 6554 | // |
| 6555 | // FIXME_AMPDU |
| 6556 | // A global counter (dialog token) is required to keep track of |
| 6557 | // all PE <-> HAL communication(s) |
| 6558 | // |
| 6559 | msgQ.reserved = 0; |
| 6560 | msgQ.bodyptr = pAddBAParams; |
| 6561 | msgQ.bodyval = 0; |
| 6562 | |
| 6563 | limLog( pMac, LOGW, |
| 6564 | FL( "Sending WDA_ADDBA_REQ..." )); |
| 6565 | |
| 6566 | //defer any other message until we get response back. |
| 6567 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 6568 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6569 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6570 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 6571 | limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0); |
| 6572 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 6573 | |
| 6574 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 6575 | limLog( pMac, LOGE, |
| 6576 | FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d\n"), |
| 6577 | retCode ); |
| 6578 | else |
| 6579 | return retCode; |
| 6580 | |
| 6581 | returnFailure: |
| 6582 | |
| 6583 | // Clean-up... |
| 6584 | if( NULL != pAddBAParams ) |
| 6585 | palFreeMemory( pMac->hHdd, (void *) pAddBAParams ); |
| 6586 | |
| 6587 | return retCode; |
| 6588 | |
| 6589 | } |
| 6590 | |
| 6591 | /** |
| 6592 | * \brief Send WDA_DELBA_IND to HAL, in order |
| 6593 | * to delete an existing BA session with peer |
| 6594 | * |
| 6595 | * \sa limPostMsgDelBAInd |
| 6596 | * |
| 6597 | * \param pMac The global tpAniSirGlobal object |
| 6598 | * |
| 6599 | * \param pSta Runtime, STA-related configuration cached |
| 6600 | * in the HashNode object |
| 6601 | * |
| 6602 | * \param baTID TID for which the BA session is being setup |
| 6603 | * |
| 6604 | * \param baDirection Identifies whether the DELBA Ind was |
| 6605 | * sent by the BA initiator or recipient |
| 6606 | * |
| 6607 | * \return none |
| 6608 | * |
| 6609 | */ |
| 6610 | tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac, |
| 6611 | tpDphHashNode pSta, |
| 6612 | tANI_U8 baTID, |
| 6613 | tANI_U8 baDirection, |
| 6614 | tpPESession psessionEntry) |
| 6615 | { |
| 6616 | tpDelBAParams pDelBAParams = NULL; |
| 6617 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 6618 | eHalStatus status; |
| 6619 | tSirMsgQ msgQ; |
| 6620 | |
| 6621 | // Allocate for SIR_HAL_DELBA_IND |
| 6622 | if( eHAL_STATUS_SUCCESS != |
| 6623 | (status = palAllocateMemory( pMac->hHdd, |
| 6624 | (void **) &pDelBAParams, |
| 6625 | sizeof( tDelBAParams )))) |
| 6626 | { |
| 6627 | limLog( pMac, LOGE, |
| 6628 | FL("palAllocateMemory failed with error code %d\n"), |
| 6629 | status ); |
| 6630 | |
| 6631 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 6632 | goto returnFailure; |
| 6633 | } |
| 6634 | |
| 6635 | palZeroMemory( pMac->hHdd, (void *) pDelBAParams, sizeof( tDelBAParams )); |
| 6636 | |
| 6637 | // Populate the REQ parameters |
| 6638 | pDelBAParams->staIdx = pSta->staIndex; |
| 6639 | pDelBAParams->baTID = baTID; |
| 6640 | pDelBAParams->baDirection = baDirection; |
| 6641 | |
| 6642 | /* Update PE session ID */ |
| 6643 | |
| 6644 | |
| 6645 | //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND????? |
| 6646 | //pDelBAParams->sessionId = psessionEntry->peSessionId; |
| 6647 | |
| 6648 | // Post WDA_DELBA_IND to HAL. |
| 6649 | msgQ.type = WDA_DELBA_IND; |
| 6650 | // |
| 6651 | // FIXME: |
| 6652 | // A global counter (dialog token) is required to keep track of |
| 6653 | // all PE <-> HAL communication(s) |
| 6654 | // |
| 6655 | msgQ.reserved = 0; |
| 6656 | msgQ.bodyptr = pDelBAParams; |
| 6657 | msgQ.bodyval = 0; |
| 6658 | |
| 6659 | limLog( pMac, LOGW, |
| 6660 | FL( "Sending SIR_HAL_DELBA_IND..." )); |
| 6661 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6662 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 6664 | limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0); |
| 6665 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 6666 | |
| 6667 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 6668 | limLog( pMac, LOGE, |
| 6669 | FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d\n"), |
| 6670 | retCode ); |
| 6671 | else |
| 6672 | { |
| 6673 | // Update LIM's internal cache... |
| 6674 | if( eBA_INITIATOR == baDirection) |
| 6675 | { |
| 6676 | pSta->tcCfg[baTID].fUseBATx = 0; |
| 6677 | pSta->tcCfg[baTID].txBufSize = 0; |
| 6678 | } |
| 6679 | else |
| 6680 | { |
| 6681 | pSta->tcCfg[baTID].fUseBARx = 0; |
| 6682 | pSta->tcCfg[baTID].rxBufSize = 0; |
| 6683 | } |
| 6684 | |
| 6685 | return retCode; |
| 6686 | } |
| 6687 | |
| 6688 | returnFailure: |
| 6689 | |
| 6690 | // Clean-up... |
| 6691 | if( NULL != pDelBAParams ) |
| 6692 | palFreeMemory( pMac->hHdd, (void *) pDelBAParams ); |
| 6693 | |
| 6694 | return retCode; |
| 6695 | |
| 6696 | } |
| 6697 | |
| 6698 | /** |
| 6699 | * @function : limPostSMStateUpdate() |
| 6700 | * |
| 6701 | * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state. |
| 6702 | * |
| 6703 | * LOGIC: |
| 6704 | * |
| 6705 | * ASSUMPTIONS: |
| 6706 | * NA |
| 6707 | * |
| 6708 | * NOTE: |
| 6709 | * NA |
| 6710 | * |
| 6711 | * @param pMac - Pointer to Global MAC structure |
| 6712 | * @param limMsg - Lim Message structure object with the MimoPSparam in body |
| 6713 | * @return None |
| 6714 | */ |
| 6715 | tSirRetStatus |
| 6716 | limPostSMStateUpdate(tpAniSirGlobal pMac, |
| 6717 | tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state) |
| 6718 | { |
| 6719 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 6720 | tSirMsgQ msgQ; |
| 6721 | eHalStatus status; |
| 6722 | tpSetMIMOPS pMIMO_PSParams; |
| 6723 | |
| 6724 | msgQ.reserved = 0; |
| 6725 | msgQ.type = WDA_SET_MIMOPS_REQ; |
| 6726 | |
| 6727 | // Allocate for WDA_SET_MIMOPS_REQ |
| 6728 | status = palAllocateMemory( pMac->hHdd, (void **) &pMIMO_PSParams, sizeof( tSetMIMOPS)); |
| 6729 | if( eHAL_STATUS_SUCCESS != status) { |
| 6730 | limLog( pMac, LOGP,FL(" palAllocateMemory failed with error code %d\n"), status ); |
| 6731 | return eSIR_MEM_ALLOC_FAILED; |
| 6732 | } |
| 6733 | |
| 6734 | pMIMO_PSParams->htMIMOPSState = state; |
| 6735 | pMIMO_PSParams->staIdx = staIdx; |
| 6736 | pMIMO_PSParams->fsendRsp = true; |
| 6737 | msgQ.bodyptr = pMIMO_PSParams; |
| 6738 | msgQ.bodyval = 0; |
| 6739 | |
| 6740 | limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." )); |
| 6741 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6742 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6743 | retCode = wdaPostCtrlMsg( pMac, &msgQ ); |
| 6744 | if (eSIR_SUCCESS != retCode) |
| 6745 | { |
| 6746 | limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d\n"), retCode ); |
| 6747 | palFreeMemory(pMac->hHdd, (void *) pMIMO_PSParams); |
| 6748 | return retCode; |
| 6749 | } |
| 6750 | |
| 6751 | return retCode; |
| 6752 | } |
| 6753 | |
| 6754 | void limPktFree ( |
| 6755 | tpAniSirGlobal pMac, |
| 6756 | eFrameType frmType, |
| 6757 | tANI_U8 *pRxPacketInfo, |
| 6758 | void *pBody) |
| 6759 | { |
| 6760 | (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody; |
| 6761 | #if defined ANI_OS_TYPE_LINUX || defined ANI_OS_TYPE_OSX |
| 6762 | // Free up allocated SK BUF |
| 6763 | palPktFree( pMac->hHdd, frmType, pRxPacketInfo, pBody) ; |
| 6764 | #endif |
| 6765 | } |
| 6766 | |
| 6767 | /** |
| 6768 | * limGetBDfromRxPacket() |
| 6769 | * |
| 6770 | *FUNCTION: |
| 6771 | * This function is called to get pointer to Polaris |
| 6772 | * Buffer Descriptor containing MAC header & other control |
| 6773 | * info from the body of the message posted to LIM. |
| 6774 | * |
| 6775 | *LOGIC: |
| 6776 | * NA |
| 6777 | * |
| 6778 | *ASSUMPTIONS: |
| 6779 | * NA |
| 6780 | * |
| 6781 | *NOTE: |
| 6782 | * NA |
| 6783 | * |
| 6784 | * @param body - Received message body |
| 6785 | * @param pRxPacketInfo - Pointer to received BD |
| 6786 | * @return None |
| 6787 | */ |
| 6788 | |
| 6789 | void |
| 6790 | limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo) |
| 6791 | { |
| 6792 | #if defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_OSX) |
| 6793 | #ifndef GEN6_ONWARDS |
| 6794 | palGetPacketDataPtr( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, (void *) body, (void **) pRxPacketInfo ); |
| 6795 | #endif //GEN6_ONWARDS |
| 6796 | #else |
| 6797 | *pRxPacketInfo = (tANI_U32 *) body; |
| 6798 | #endif |
| 6799 | } /*** end limGetBDfromRxPacket() ***/ |
| 6800 | |
| 6801 | |
| 6802 | |
| 6803 | |
| 6804 | |
| 6805 | void limRessetScanChannelInfo(tpAniSirGlobal pMac) |
| 6806 | { |
| 6807 | palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo)); |
| 6808 | } |
| 6809 | |
| 6810 | |
| 6811 | void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId) |
| 6812 | { |
| 6813 | tANI_U8 i; |
| 6814 | tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE; |
| 6815 | |
| 6816 | for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++) |
| 6817 | { |
| 6818 | if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId) |
| 6819 | { |
| 6820 | pMac->lim.scanChnInfo.scanChn[i].numTimeScan++; |
| 6821 | fFound = eANI_BOOLEAN_TRUE; |
| 6822 | break; |
| 6823 | } |
| 6824 | } |
| 6825 | if(eANI_BOOLEAN_FALSE == fFound) |
| 6826 | { |
| 6827 | if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST) |
| 6828 | { |
| 6829 | pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId; |
| 6830 | pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1; |
| 6831 | } |
| 6832 | else |
| 6833 | { |
| 6834 | PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac\n"));) |
| 6835 | } |
| 6836 | } |
| 6837 | } |
| 6838 | |
| 6839 | |
| 6840 | /** |
| 6841 | * @function : limIsChannelValidForChannelSwitch() |
| 6842 | * |
| 6843 | * @brief : This function checks if the channel to which AP |
| 6844 | * is expecting us to switch, is a valid channel for us. |
| 6845 | * LOGIC: |
| 6846 | * |
| 6847 | * ASSUMPTIONS: |
| 6848 | * NA |
| 6849 | * |
| 6850 | * NOTE: |
| 6851 | * NA |
| 6852 | * |
| 6853 | * @param pMac - Pointer to Global MAC structure |
| 6854 | * @param channel - New channel to which we are expected to move |
| 6855 | * @return None |
| 6856 | */ |
| 6857 | tAniBool |
| 6858 | limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel) |
| 6859 | { |
| 6860 | tANI_U8 index; |
| 6861 | tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6862 | tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6863 | |
| 6864 | if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 6865 | (tANI_U8 *)validChannelList, |
| 6866 | (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS) |
| 6867 | { |
| 6868 | PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list\n"));) |
| 6869 | return (eSIR_FALSE); |
| 6870 | } |
| 6871 | |
| 6872 | for(index = 0; index < validChannelListLen; index++) |
| 6873 | { |
| 6874 | if(validChannelList[index] == channel) |
| 6875 | return (eSIR_TRUE); |
| 6876 | } |
| 6877 | |
| 6878 | /* channel does not belong to list of valid channels */ |
| 6879 | return (eSIR_FALSE); |
| 6880 | } |
| 6881 | |
| 6882 | /**------------------------------------------------------ |
| 6883 | \fn __limFillTxControlParams |
| 6884 | \brief Fill the message for stopping/resuming tx. |
| 6885 | |
| 6886 | \param pMac |
| 6887 | \param pTxCtrlMsg - Pointer to tx control message. |
| 6888 | \param type - Which way we want to stop/ resume tx. |
| 6889 | \param mode - To stop/resume. |
| 6890 | -------------------------------------------------------*/ |
| 6891 | static eHalStatus |
| 6892 | __limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg, |
| 6893 | tLimQuietTxMode type, tLimControlTx mode) |
| 6894 | { |
| 6895 | |
| 6896 | //TBD-RAJESH HOW TO GET sessionEntry????? |
| 6897 | tpPESession psessionEntry = &pMac->lim.gpSession[0]; |
| 6898 | |
| 6899 | if (mode == eLIM_STOP_TX) |
| 6900 | pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE; |
| 6901 | else |
| 6902 | pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE; |
| 6903 | |
| 6904 | switch (type) |
| 6905 | { |
| 6906 | case eLIM_TX_ALL: |
| 6907 | /** Stops/resumes transmission completely */ |
| 6908 | pTxCtrlMsg->fCtrlGlobal = 1; |
| 6909 | break; |
| 6910 | |
| 6911 | case eLIM_TX_BSS_BUT_BEACON: |
| 6912 | /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt |
| 6913 | * stop beacon transmission. |
| 6914 | */ |
| 6915 | pTxCtrlMsg->ctrlBss = 1; |
| 6916 | pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx); |
| 6917 | break; |
| 6918 | |
| 6919 | case eLIM_TX_STA: |
| 6920 | /** Memory for station bitmap is allocated dynamically in caller of this |
| 6921 | * so decode properly here and fill the bitmap. Now not implemented, |
| 6922 | * fall through. |
| 6923 | */ |
| 6924 | case eLIM_TX_BSS: |
| 6925 | //Fall thru... |
| 6926 | default: |
| 6927 | PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled\n"));) |
| 6928 | return eHAL_STATUS_FAILURE; |
| 6929 | } |
| 6930 | |
| 6931 | return eHAL_STATUS_SUCCESS; |
| 6932 | } |
| 6933 | |
| 6934 | /** |
| 6935 | * @function : limFrameTransmissionControl() |
| 6936 | * |
| 6937 | * @brief : This API is called by the user to halt/resume any frame |
| 6938 | * transmission from the device. If stopped, all frames will be |
| 6939 | * queued starting from hardware. Then back-pressure |
| 6940 | * is built till the driver. |
| 6941 | * LOGIC: |
| 6942 | * |
| 6943 | * ASSUMPTIONS: |
| 6944 | * NA |
| 6945 | * |
| 6946 | * NOTE: |
| 6947 | * NA |
| 6948 | * |
| 6949 | * @param pMac - Pointer to Global MAC structure |
| 6950 | * @return None |
| 6951 | */ |
| 6952 | void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode) |
| 6953 | { |
| 6954 | |
| 6955 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6956 | tpTxControlParams pTxCtrlMsg; |
| 6957 | tSirMsgQ msgQ; |
| 6958 | tANI_U8 nBytes = 0; // No of bytes required for station bitmap. |
| 6959 | |
| 6960 | /** Allocate only required number of bytes for station bitmap |
| 6961 | * Make it to align to 4 byte boundary */ |
| 6962 | nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation); |
| 6963 | |
| 6964 | status = palAllocateMemory(pMac->hHdd, (void **) &pTxCtrlMsg, |
| 6965 | (sizeof(*pTxCtrlMsg) + nBytes)); |
| 6966 | if (status != eHAL_STATUS_SUCCESS) |
| 6967 | { |
| 6968 | limLog(pMac, LOGP, FL("palAllocateMemory() failed\n")); |
| 6969 | return; |
| 6970 | } |
| 6971 | |
| 6972 | status = palZeroMemory(pMac->hHdd, (void *) pTxCtrlMsg, |
| 6973 | (sizeof(*pTxCtrlMsg) + nBytes)); |
| 6974 | if (status != eHAL_STATUS_SUCCESS) |
| 6975 | { |
| 6976 | palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg); |
| 6977 | limLog(pMac, LOGP, FL("palZeroMemory() failed, status = %d\n"), status); |
| 6978 | return; |
| 6979 | } |
| 6980 | |
| 6981 | status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode); |
| 6982 | if (status != eHAL_STATUS_SUCCESS) |
| 6983 | { |
| 6984 | palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg); |
| 6985 | limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d\n"), status); |
| 6986 | return; |
| 6987 | } |
| 6988 | |
| 6989 | msgQ.bodyptr = (void *) pTxCtrlMsg; |
| 6990 | msgQ.bodyval = 0; |
| 6991 | msgQ.reserved = 0; |
| 6992 | msgQ.type = WDA_TRANSMISSION_CONTROL_IND; |
| 6993 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6994 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6995 | if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS) |
| 6996 | { |
| 6997 | palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg); |
| 6998 | limLog( pMac, LOGP, FL("Posting Message to HAL failed\n")); |
| 6999 | return; |
| 7000 | } |
| 7001 | |
| 7002 | if (mode == eLIM_STOP_TX) |
| 7003 | { |
| 7004 | PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac\n"));) |
| 7005 | } |
| 7006 | else |
| 7007 | { |
| 7008 | PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac\n"));) |
| 7009 | } |
| 7010 | return; |
| 7011 | } |
| 7012 | |
| 7013 | |
| 7014 | /** |
| 7015 | * @function : limRestorePreChannelSwitchState() |
| 7016 | * |
| 7017 | * @brief : This API is called by the user to undo any |
| 7018 | * specific changes done on the device during |
| 7019 | * channel switch. |
| 7020 | * LOGIC: |
| 7021 | * |
| 7022 | * ASSUMPTIONS: |
| 7023 | * NA |
| 7024 | * |
| 7025 | * NOTE: |
| 7026 | * NA |
| 7027 | * |
| 7028 | * @param pMac - Pointer to Global MAC structure |
| 7029 | * @return None |
| 7030 | */ |
| 7031 | |
| 7032 | tSirRetStatus |
| 7033 | limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 7034 | { |
| 7035 | |
| 7036 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 7037 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 7038 | tANI_U32 val = 0; |
| 7039 | |
| 7040 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 7041 | return retCode; |
| 7042 | |
| 7043 | /* Channel switch should be ready for the next time */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7044 | psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | |
| 7046 | /* Restore the frame transmission, all the time. */ |
| 7047 | limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX); |
| 7048 | |
| 7049 | /* Free to enter BMPS */ |
| 7050 | limSendSmePostChannelSwitchInd(pMac); |
| 7051 | |
| 7052 | //Background scan is now enabled by SME |
| 7053 | if(pMac->lim.gLimBackgroundScanTerminate == FALSE) |
| 7054 | { |
| 7055 | /* Enable background scan if already enabled, else don't bother */ |
| 7056 | if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD, |
| 7057 | &val)) != eSIR_SUCCESS) |
| 7058 | |
| 7059 | { |
| 7060 | limLog(pMac, LOGP, FL("could not retrieve Background scan period value\n")); |
| 7061 | return (retCode); |
| 7062 | } |
| 7063 | |
| 7064 | if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer)) |
| 7065 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7066 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7067 | if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS) |
| 7068 | { |
| 7069 | limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP")); |
| 7070 | return (eSIR_FAILURE); |
| 7071 | } |
| 7072 | |
| 7073 | } |
| 7074 | } |
| 7075 | |
| 7076 | /* Enable heartbeat timer */ |
| 7077 | if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer)) |
| 7078 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7079 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7080 | if(limActivateHearBeatTimer(pMac) != TX_SUCCESS) |
| 7081 | { |
| 7082 | limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP")); |
| 7083 | return (eSIR_FAILURE); |
| 7084 | } |
| 7085 | } |
| 7086 | #endif |
| 7087 | return (retCode); |
| 7088 | } |
| 7089 | |
| 7090 | |
| 7091 | /**-------------------------------------------- |
| 7092 | \fn limRestorePreQuietState |
| 7093 | \brief Restore the pre quiet state |
| 7094 | |
| 7095 | \param pMac |
| 7096 | \return NONE |
| 7097 | ---------------------------------------------*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7098 | tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7099 | { |
| 7100 | |
| 7101 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 7102 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 7103 | tANI_U32 val = 0; |
| 7104 | |
| 7105 | if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE) |
| 7106 | return retCode; |
| 7107 | |
| 7108 | /* Quiet should be ready for the next time */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7109 | psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7110 | |
| 7111 | /* Restore the frame transmission, all the time. */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7112 | if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7113 | limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX); |
| 7114 | |
| 7115 | |
| 7116 | //Background scan is now enabled by SME |
| 7117 | if(pMac->lim.gLimBackgroundScanTerminate == FALSE) |
| 7118 | { |
| 7119 | /* Enable background scan if already enabled, else don't bother */ |
| 7120 | if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD, |
| 7121 | &val)) != eSIR_SUCCESS) |
| 7122 | |
| 7123 | { |
| 7124 | limLog(pMac, LOGP, FL("could not retrieve Background scan period value\n")); |
| 7125 | return (retCode); |
| 7126 | } |
| 7127 | |
| 7128 | if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer)) |
| 7129 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7130 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7131 | if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS) |
| 7132 | { |
| 7133 | limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP")); |
| 7134 | return (eSIR_FAILURE); |
| 7135 | } |
| 7136 | |
| 7137 | } |
| 7138 | } |
| 7139 | |
| 7140 | /* Enable heartbeat timer */ |
| 7141 | if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer)) |
| 7142 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7143 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_HEART_BEAT_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7144 | if(limActivateHearBeatTimer(pMac) != TX_SUCCESS) |
| 7145 | { |
| 7146 | limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP")); |
| 7147 | return (eSIR_FAILURE); |
| 7148 | } |
| 7149 | } |
| 7150 | #endif |
| 7151 | return (retCode); |
| 7152 | } |
| 7153 | |
| 7154 | |
| 7155 | /** |
| 7156 | * @function: limPrepareFor11hChannelSwitch() |
| 7157 | * |
| 7158 | * @brief : This API is called by the user to prepare for |
| 7159 | * 11h channel switch. As of now, the API does |
| 7160 | * very minimal work. User can add more into the |
| 7161 | * same API if needed. |
| 7162 | * LOGIC: |
| 7163 | * |
| 7164 | * ASSUMPTIONS: |
| 7165 | * NA |
| 7166 | * |
| 7167 | * NOTE: |
| 7168 | * NA |
| 7169 | * |
| 7170 | * @param pMac - Pointer to Global MAC structure |
| 7171 | * @param psessionEntry |
| 7172 | * @return None |
| 7173 | */ |
| 7174 | void |
| 7175 | limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 7176 | { |
| 7177 | #if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK) |
| 7178 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 7179 | return; |
| 7180 | |
| 7181 | /* Flag to indicate 11h channel switch in progress */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7182 | psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7183 | |
| 7184 | /* Disable, Stop background scan if enabled and running */ |
| 7185 | limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER); |
| 7186 | |
| 7187 | /* Stop heart-beat timer to stop heartbeat disassociation */ |
| 7188 | limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry); |
| 7189 | |
| 7190 | if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE || |
| 7191 | pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE) |
| 7192 | { |
| 7193 | PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state\n"));) |
| 7194 | /* Stop ongoing scanning if any */ |
| 7195 | if (GET_LIM_PROCESS_DEFD_MESGS(pMac)) |
| 7196 | { |
| 7197 | //Set the resume channel to Any valid channel (invalid). |
| 7198 | //This will instruct HAL to set it to any previous valid channel. |
| 7199 | peSetResumeChannel(pMac, 0, 0); |
| 7200 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE); |
| 7201 | } |
| 7202 | else |
| 7203 | { |
| 7204 | limRestorePreChannelSwitchState(pMac, psessionEntry); |
| 7205 | } |
| 7206 | return; |
| 7207 | } |
| 7208 | else |
| 7209 | { |
| 7210 | PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer\n"));) |
| 7211 | /** We are safe to switch channel at this point */ |
| 7212 | limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId); |
| 7213 | } |
| 7214 | #endif |
| 7215 | } |
| 7216 | |
| 7217 | |
| 7218 | |
| 7219 | /**---------------------------------------------------- |
| 7220 | \fn limGetNwType |
| 7221 | |
| 7222 | \brief Get type of the network from data packet or beacon |
| 7223 | \param pMac |
| 7224 | \param channelNum - Channel number |
| 7225 | \param type - Type of packet. |
| 7226 | \param pBeacon - Pointer to beacon or probe response |
| 7227 | |
| 7228 | \return Network type a/b/g. |
| 7229 | -----------------------------------------------------*/ |
| 7230 | tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon) |
| 7231 | { |
| 7232 | tSirNwType nwType = eSIR_11B_NW_TYPE; |
| 7233 | |
| 7234 | if (type == SIR_MAC_DATA_FRAME) |
| 7235 | { |
| 7236 | if ((channelNum > 0) && (channelNum < 15)) |
| 7237 | { |
| 7238 | nwType = eSIR_11G_NW_TYPE; |
| 7239 | } |
| 7240 | else |
| 7241 | { |
| 7242 | nwType = eSIR_11A_NW_TYPE; |
| 7243 | } |
| 7244 | } |
| 7245 | else |
| 7246 | { |
| 7247 | if ((channelNum > 0) && (channelNum < 15)) |
| 7248 | { |
| 7249 | int i; |
| 7250 | // 11b or 11g packet |
| 7251 | // 11g iff extended Rate IE is present or |
| 7252 | // if there is an A rate in suppRate IE |
| 7253 | for (i = 0; i < pBeacon->supportedRates.numRates; i++) |
| 7254 | { |
| 7255 | if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f)) |
| 7256 | { |
| 7257 | nwType = eSIR_11G_NW_TYPE; |
| 7258 | break; |
| 7259 | } |
| 7260 | } |
| 7261 | if (pBeacon->extendedRatesPresent) |
| 7262 | { |
| 7263 | PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G\n"));) |
| 7264 | nwType = eSIR_11G_NW_TYPE; |
| 7265 | } |
| 7266 | } |
| 7267 | else |
| 7268 | { |
| 7269 | // 11a packet |
| 7270 | PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A\n"));) |
| 7271 | nwType = eSIR_11A_NW_TYPE; |
| 7272 | } |
| 7273 | } |
| 7274 | return nwType; |
| 7275 | } |
| 7276 | |
| 7277 | |
| 7278 | /**--------------------------------------------------------- |
| 7279 | \fn limGetChannelFromBeacon |
| 7280 | \brief To extract channel number from beacon |
| 7281 | |
| 7282 | \param pMac |
| 7283 | \param pBeacon - Pointer to beacon or probe rsp |
| 7284 | \return channel number |
| 7285 | -----------------------------------------------------------*/ |
| 7286 | tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon) |
| 7287 | { |
| 7288 | tANI_U8 channelNum = 0; |
| 7289 | |
| 7290 | if (pBeacon->dsParamsPresent) |
| 7291 | channelNum = pBeacon->channelNumber; |
| 7292 | else if(pBeacon->HTInfo.present) |
| 7293 | channelNum = pBeacon->HTInfo.primaryChannel; |
| 7294 | else |
| 7295 | channelNum = pBeacon->channelNumber; |
| 7296 | |
| 7297 | return channelNum; |
| 7298 | } |
| 7299 | |
| 7300 | |
| 7301 | /** --------------------------------------------------------- |
| 7302 | \fn limSetTspecUapsdMask |
| 7303 | \brief This function sets the PE global variable: |
| 7304 | \ 1) gUapsdPerAcTriggerEnableMask and |
| 7305 | \ 2) gUapsdPerAcDeliveryEnableMask |
| 7306 | \ based on the user priority field and direction field |
| 7307 | \ in the TS Info Fields. |
| 7308 | \ |
| 7309 | \ An AC is a trigger-enabled AC if the PSB subfield |
| 7310 | \ is set to 1 in the uplink direction. |
| 7311 | \ An AC is a delivery-enabled AC if the PSB subfield |
| 7312 | \ is set to 1 in the down-link direction. |
| 7313 | \ |
| 7314 | \param tpAniSirGlobal pMac |
| 7315 | \param tSirMacTSInfo pTsInfo |
| 7316 | \param tANI_U32 action |
| 7317 | \return None |
| 7318 | ------------------------------------------------------------*/ |
| 7319 | void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action) |
| 7320 | { |
| 7321 | tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio; |
| 7322 | tANI_U16 direction = pTsInfo->traffic.direction; |
| 7323 | tANI_U8 ac = upToAc(userPrio); |
| 7324 | |
| 7325 | PELOG1(limLog(pMac, LOG1, FL(" Set UAPSD mask for AC %d, direction %d, action=%d (1=set,0=clear) \n"),ac, direction, action );) |
| 7326 | |
| 7327 | /* Converting AC to appropriate Uapsd Bit Mask |
| 7328 | * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3) |
| 7329 | * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2) |
| 7330 | * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1) |
| 7331 | * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0) |
| 7332 | */ |
| 7333 | ac = ((~ac) & 0x3); |
| 7334 | |
| 7335 | if (action == CLEAR_UAPSD_MASK) |
| 7336 | { |
| 7337 | if (direction == SIR_MAC_DIRECTION_UPLINK) |
| 7338 | pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac); |
| 7339 | else if (direction == SIR_MAC_DIRECTION_DNLINK) |
| 7340 | pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac); |
| 7341 | else if (direction == SIR_MAC_DIRECTION_BIDIR) |
| 7342 | { |
| 7343 | pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac); |
| 7344 | pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac); |
| 7345 | } |
| 7346 | } |
| 7347 | else if (action == SET_UAPSD_MASK) |
| 7348 | { |
| 7349 | if (direction == SIR_MAC_DIRECTION_UPLINK) |
| 7350 | pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac); |
| 7351 | else if (direction == SIR_MAC_DIRECTION_DNLINK) |
| 7352 | pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac); |
| 7353 | else if (direction == SIR_MAC_DIRECTION_BIDIR) |
| 7354 | { |
| 7355 | pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac); |
| 7356 | pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac); |
| 7357 | } |
| 7358 | } |
| 7359 | |
| 7360 | limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x \n"), pMac->lim.gUapsdPerAcTriggerEnableMask ); |
| 7361 | limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x \n"), pMac->lim.gUapsdPerAcDeliveryEnableMask ); |
| 7362 | |
| 7363 | return; |
| 7364 | } |
| 7365 | |
| 7366 | |
| 7367 | |
| 7368 | void limHandleHeartBeatTimeout(tpAniSirGlobal pMac ) |
| 7369 | { |
| 7370 | |
| 7371 | tANI_U8 i; |
| 7372 | for(i =0;i < pMac->lim.maxBssId;i++) |
| 7373 | { |
| 7374 | if(pMac->lim.gpSession[i].valid == TRUE ) |
| 7375 | { |
| 7376 | if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE) |
| 7377 | { |
| 7378 | limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]); |
| 7379 | break; |
| 7380 | } |
| 7381 | |
| 7382 | if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) && |
| 7383 | (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE)) |
| 7384 | { |
| 7385 | limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]); |
| 7386 | } |
| 7387 | } |
| 7388 | } |
| 7389 | for(i=0; i< pMac->lim.maxBssId; i++) |
| 7390 | { |
| 7391 | if(pMac->lim.gpSession[i].valid == TRUE ) |
| 7392 | { |
| 7393 | if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) && |
| 7394 | (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE)) |
| 7395 | { |
| 7396 | if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE) |
| 7397 | { |
| 7398 | /* Activate Probe After HeartBeat Timer incase HB Failure detected */ |
| 7399 | PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d\n"), |
| 7400 | i);) |
| 7401 | limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER); |
| 7402 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER)); |
| 7403 | if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS) |
| 7404 | { |
| 7405 | limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer\n")); |
| 7406 | limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]); |
| 7407 | } |
| 7408 | break; |
| 7409 | } |
| 7410 | } |
| 7411 | } |
| 7412 | } |
| 7413 | } |
| 7414 | |
| 7415 | tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac) |
| 7416 | { |
| 7417 | tANI_U8 i; |
| 7418 | for(i =0;i < pMac->lim.maxBssId;i++) |
| 7419 | { |
| 7420 | if(pMac->lim.gpSession[i].valid == TRUE ) |
| 7421 | { |
| 7422 | if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) && |
| 7423 | (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE)) |
| 7424 | { |
| 7425 | return pMac->lim.gpSession[i].currentOperChannel; |
| 7426 | } |
| 7427 | } |
| 7428 | } |
| 7429 | return 0; |
| 7430 | } |
| 7431 | |
| 7432 | void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ) |
| 7433 | { |
| 7434 | |
| 7435 | tpPESession psessionEntry; |
| 7436 | // tANI_U8 sessionId; |
| 7437 | tpAddStaParams pAddStaParams; |
| 7438 | |
| 7439 | pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr; |
| 7440 | |
| 7441 | if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL) |
| 7442 | { |
| 7443 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7444 | palFreeMemory(pMac, pAddStaParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7445 | return; |
| 7446 | } |
| 7447 | if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) |
| 7448 | (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry); |
| 7449 | |
| 7450 | else |
| 7451 | limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry); |
| 7452 | |
| 7453 | } |
| 7454 | |
| 7455 | |
| 7456 | void limUpdateBeacon(tpAniSirGlobal pMac) |
| 7457 | { |
| 7458 | tANI_U8 i; |
| 7459 | |
| 7460 | for(i =0;i < pMac->lim.maxBssId;i++) |
| 7461 | { |
| 7462 | if(pMac->lim.gpSession[i].valid == TRUE ) |
| 7463 | { |
| 7464 | if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) || |
| 7465 | (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) ) |
| 7466 | && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState) |
| 7467 | ) |
| 7468 | { |
| 7469 | schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]); |
| 7470 | limSendBeaconInd(pMac, &pMac->lim.gpSession[i]); |
| 7471 | } |
| 7472 | else |
| 7473 | { |
| 7474 | if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)|| |
| 7475 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE)) |
| 7476 | { |
| 7477 | |
| 7478 | if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF) |
| 7479 | { |
| 7480 | schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]); |
| 7481 | } |
| 7482 | } |
| 7483 | } |
| 7484 | } |
| 7485 | } |
| 7486 | } |
| 7487 | |
| 7488 | void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac) |
| 7489 | { |
| 7490 | tANI_U8 i; |
| 7491 | tpPESession psessionEntry; |
| 7492 | /* Probe response is not received after HB failure. This is handled by LMM sub module. */ |
| 7493 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 7494 | { |
| 7495 | if(pMac->lim.gpSession[i].valid == TRUE) |
| 7496 | { |
| 7497 | psessionEntry = &pMac->lim.gpSession[i]; |
| 7498 | if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE) |
| 7499 | { |
| 7500 | limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d\n"),psessionEntry->limSmeState, |
| 7501 | psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB); |
| 7502 | if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) |
| 7503 | { |
| 7504 | if (!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) |
| 7505 | { |
| 7506 | limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d \n" ),psessionEntry->peSessionId); |
| 7507 | /* AP did not respond to Probe Request. Tear down link with it.*/ |
| 7508 | limTearDownLinkWithAp(pMac, |
| 7509 | psessionEntry->peSessionId, |
| 7510 | eSIR_BEACON_MISSED); |
| 7511 | pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ; |
| 7512 | } |
| 7513 | else // restart heartbeat timer |
| 7514 | { |
| 7515 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
| 7516 | } |
| 7517 | } |
| 7518 | else |
| 7519 | { |
| 7520 | limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state \n")); |
| 7521 | limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState); |
| 7522 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
| 7523 | } |
| 7524 | |
| 7525 | } |
| 7526 | } |
| 7527 | } |
| 7528 | /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */ |
| 7529 | // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer); |
| 7530 | } |
| 7531 | |
| 7532 | |
| 7533 | /* |
| 7534 | * This function assumes there will not be more than one IBSS session active at any time. |
| 7535 | */ |
| 7536 | tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac) |
| 7537 | { |
| 7538 | tANI_U8 i; |
| 7539 | |
| 7540 | for(i =0;i < pMac->lim.maxBssId;i++) |
| 7541 | { |
| 7542 | if( (pMac->lim.gpSession[i].valid) && |
| 7543 | (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE)) |
| 7544 | return (&pMac->lim.gpSession[i]); |
| 7545 | } |
| 7546 | |
| 7547 | return NULL; |
| 7548 | } |
| 7549 | |
| 7550 | tpPESession limIsApSessionActive(tpAniSirGlobal pMac) |
| 7551 | { |
| 7552 | tANI_U8 i; |
| 7553 | |
| 7554 | for(i =0;i < pMac->lim.maxBssId;i++) |
| 7555 | { |
| 7556 | if( (pMac->lim.gpSession[i].valid) && |
| 7557 | ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) || |
| 7558 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE))) |
| 7559 | return (&pMac->lim.gpSession[i]); |
| 7560 | } |
| 7561 | |
| 7562 | return NULL; |
| 7563 | } |
| 7564 | |
| 7565 | /**--------------------------------------------------------- |
| 7566 | \fn limHandleDeferMsgError |
| 7567 | \brief handles error scenario, when the msg can not be deferred. |
| 7568 | \param pMac |
| 7569 | \param pLimMsg LIM msg, which could not be deferred. |
| 7570 | \return void |
| 7571 | -----------------------------------------------------------*/ |
| 7572 | |
| 7573 | void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg) |
| 7574 | { |
| 7575 | if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type) |
| 7576 | { |
| 7577 | vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr); |
| 7578 | } |
| 7579 | else if(pLimMsg->bodyptr != NULL) |
| 7580 | palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr); |
| 7581 | |
| 7582 | } |
| 7583 | |
| 7584 | |
| 7585 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 7586 | /**--------------------------------------------------------- |
| 7587 | \fn limDiagEventReport |
| 7588 | \brief This function reports Diag event |
| 7589 | \param pMac |
| 7590 | \param eventType |
| 7591 | \param bssid |
| 7592 | \param status |
| 7593 | \param reasonCode |
| 7594 | \return void |
| 7595 | -----------------------------------------------------------*/ |
| 7596 | void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode) |
| 7597 | { |
| 7598 | tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 }; |
| 7599 | WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type); |
| 7600 | |
| 7601 | palZeroMemory(pMac->hHdd, &peEvent, sizeof(vos_event_wlan_pe_payload_type)); |
| 7602 | |
| 7603 | if (NULL == pSessionEntry) |
| 7604 | { |
| 7605 | palCopyMemory(pMac->hHdd, peEvent.bssid, nullBssid, sizeof(tSirMacAddr)); |
| 7606 | peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState; |
| 7607 | peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState; |
| 7608 | |
| 7609 | } |
| 7610 | else |
| 7611 | { |
| 7612 | palCopyMemory(pMac->hHdd, peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr)); |
| 7613 | peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState; |
| 7614 | peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState; |
| 7615 | } |
| 7616 | peEvent.event_type = eventType; |
| 7617 | peEvent.status = status; |
| 7618 | peEvent.reason_code = reasonCode; |
| 7619 | |
| 7620 | WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE); |
| 7621 | return; |
| 7622 | } |
| 7623 | |
| 7624 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 7625 | |
| 7626 | void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ) |
| 7627 | { |
| 7628 | |
| 7629 | tpAddStaSelfParams pAddStaSelfParams; |
| 7630 | tSirMsgQ mmhMsg; |
| 7631 | tpSirSmeAddStaSelfRsp pRsp; |
| 7632 | |
| 7633 | |
| 7634 | pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr; |
| 7635 | |
| 7636 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeAddStaSelfRsp))) |
| 7637 | { |
| 7638 | /// Buffer not available. Log error |
| 7639 | limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7640 | palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7641 | return; |
| 7642 | } |
| 7643 | |
| 7644 | palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp)); |
| 7645 | |
| 7646 | pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP; |
| 7647 | pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp); |
| 7648 | pRsp->status = pAddStaSelfParams->status; |
| 7649 | |
| 7650 | palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) ); |
| 7651 | |
| 7652 | palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams); |
| 7653 | |
| 7654 | mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP; |
| 7655 | mmhMsg.bodyptr = pRsp; |
| 7656 | mmhMsg.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7657 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7658 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 7659 | |
| 7660 | } |
| 7661 | |
| 7662 | void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ) |
| 7663 | { |
| 7664 | |
| 7665 | tpDelStaSelfParams pDelStaSelfParams; |
| 7666 | tSirMsgQ mmhMsg; |
| 7667 | tpSirSmeDelStaSelfRsp pRsp; |
| 7668 | |
| 7669 | |
| 7670 | pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr; |
| 7671 | |
| 7672 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeDelStaSelfRsp))) |
| 7673 | { |
| 7674 | /// Buffer not available. Log error |
| 7675 | limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP\n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7676 | palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7677 | return; |
| 7678 | } |
| 7679 | |
| 7680 | palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp)); |
| 7681 | |
| 7682 | pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP; |
| 7683 | pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp); |
| 7684 | pRsp->status = pDelStaSelfParams->status; |
| 7685 | |
| 7686 | palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) ); |
| 7687 | |
| 7688 | palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams); |
| 7689 | |
| 7690 | mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP; |
| 7691 | mmhMsg.bodyptr = pRsp; |
| 7692 | mmhMsg.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7693 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7694 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 7695 | |
| 7696 | } |
| 7697 | |
| 7698 | /*************************************************************** |
| 7699 | * tANI_U8 limUnmapChannel(tANI_U8 mapChannel) |
| 7700 | * To unmap the channel to reverse the effect of mapping |
| 7701 | * a band channel in hal .Mapping was done hal to overcome the |
| 7702 | * limitation of the rxbd which use only 4 bit for channel number. |
| 7703 | *****************************************************************/ |
| 7704 | tANI_U8 limUnmapChannel(tANI_U8 mapChannel) |
| 7705 | { |
| 7706 | if( mapChannel > 0 && mapChannel < 25 ) |
| 7707 | return abChannel[mapChannel -1]; |
| 7708 | else |
| 7709 | return 0; |
| 7710 | } |
| 7711 | |
| 7712 | |
| 7713 | v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field) |
| 7714 | { |
| 7715 | int left = length; |
| 7716 | v_U8_t *ptr = pIes; |
| 7717 | v_U8_t elem_id; |
| 7718 | v_U16_t elem_len; |
| 7719 | |
| 7720 | while(left >= (size_of_len_field+1)) |
| 7721 | { |
| 7722 | elem_id = ptr[0]; |
| 7723 | if (size_of_len_field == TWO_BYTE) |
| 7724 | { |
| 7725 | elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8); |
| 7726 | } |
| 7727 | else |
| 7728 | { |
| 7729 | elem_len = ptr[1]; |
| 7730 | } |
| 7731 | |
| 7732 | |
| 7733 | left -= (size_of_len_field+1); |
| 7734 | if(elem_len > left) |
| 7735 | { |
| 7736 | limLog(pMac, LOGE, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 7737 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7738 | eid,elem_len,left); |
| 7739 | return NULL; |
| 7740 | } |
| 7741 | if (elem_id == eid) |
| 7742 | { |
| 7743 | return ptr; |
| 7744 | } |
| 7745 | |
| 7746 | left -= elem_len; |
| 7747 | ptr += (elem_len + (size_of_len_field+1)); |
| 7748 | } |
| 7749 | return NULL; |
| 7750 | } |
| 7751 | |
| 7752 | /* return NULL if oui is not found in ie |
| 7753 | return !NULL pointer to vendor IE (starting from 0xDD) if oui is found |
| 7754 | */ |
| 7755 | v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len) |
| 7756 | { |
| 7757 | int left = ie_len; |
| 7758 | v_U8_t *ptr = ie; |
| 7759 | v_U8_t elem_id, elem_len; |
| 7760 | |
| 7761 | while(left >= 2) |
| 7762 | { |
| 7763 | elem_id = ptr[0]; |
| 7764 | elem_len = ptr[1]; |
| 7765 | left -= 2; |
| 7766 | if(elem_len > left) |
| 7767 | { |
| 7768 | limLog( pMac, LOGE, |
| 7769 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****\n"), |
| 7770 | elem_id,elem_len,left); |
| 7771 | return NULL; |
| 7772 | } |
| 7773 | if (SIR_MAC_EID_VENDOR == elem_id) |
| 7774 | { |
| 7775 | if(memcmp(&ptr[2], oui, oui_size)==0) |
| 7776 | return ptr; |
| 7777 | } |
| 7778 | |
| 7779 | left -= elem_len; |
| 7780 | ptr += (elem_len + 2); |
| 7781 | } |
| 7782 | return NULL; |
| 7783 | } |
| 7784 | |
| 7785 | #ifdef WLAN_FEATURE_P2P |
| 7786 | //Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream |
| 7787 | |
| 7788 | v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len) |
| 7789 | { |
| 7790 | int length = 0; |
| 7791 | tANI_U8 *ptr = ie; |
| 7792 | |
| 7793 | ptr[length++] = SIR_MAC_EID_VENDOR; |
| 7794 | ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE; |
| 7795 | palCopyMemory( pMac->hHdd, &ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
| 7796 | palCopyMemory( pMac->hHdd, &ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len); |
| 7797 | return (ie_len + SIR_P2P_IE_HEADER_LEN); |
| 7798 | } |
| 7799 | |
| 7800 | //Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream |
| 7801 | |
| 7802 | v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen) |
| 7803 | { |
| 7804 | v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN]; |
| 7805 | palCopyMemory( pMac->hHdd, overFlowP2pStream, noaStream + noaLen - overFlowLen, overFlowLen); |
| 7806 | noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR; |
| 7807 | noaStream[noaLen - overFlowLen+1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE; |
| 7808 | palCopyMemory( pMac->hHdd, noaStream+ noaLen - overFlowLen+2,SIR_MAC_P2P_OUI,SIR_MAC_P2P_OUI_SIZE); |
| 7809 | |
| 7810 | palCopyMemory( pMac->hHdd, noaStream+ noaLen - overFlowLen+2+SIR_MAC_P2P_OUI_SIZE,overFlowP2pStream,overFlowLen); |
| 7811 | return (noaLen + SIR_P2P_IE_HEADER_LEN); |
| 7812 | |
| 7813 | } |
| 7814 | |
| 7815 | //Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream |
| 7816 | v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry) |
| 7817 | { |
| 7818 | v_U8_t len=0; |
| 7819 | |
| 7820 | v_U8_t *pBody = pNoaStream; |
| 7821 | |
| 7822 | |
| 7823 | if ( (psessionEntry != NULL) && (psessionEntry->valid) && |
| 7824 | (psessionEntry->pePersona == VOS_P2P_GO_MODE)) |
| 7825 | { |
| 7826 | if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration)) |
| 7827 | && (!psessionEntry->p2pGoPsUpdate.oppPsFlag) |
| 7828 | ) |
| 7829 | return 0; //No NoA Descriptor then return 0 |
| 7830 | |
| 7831 | |
| 7832 | pBody[0] = SIR_P2P_NOA_ATTR; |
| 7833 | |
| 7834 | pBody[3] = psessionEntry->p2pGoPsUpdate.index; |
| 7835 | pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7); |
| 7836 | len = 5; |
| 7837 | pBody += len; |
| 7838 | |
| 7839 | |
| 7840 | if (psessionEntry->p2pGoPsUpdate.uNoa1Duration) |
| 7841 | { |
| 7842 | *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt; |
| 7843 | pBody += 1; |
| 7844 | len +=1; |
| 7845 | |
| 7846 | *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration); |
| 7847 | pBody += sizeof(tANI_U32); |
| 7848 | len +=4; |
| 7849 | |
| 7850 | *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval); |
| 7851 | pBody += sizeof(tANI_U32); |
| 7852 | len +=4; |
| 7853 | |
| 7854 | *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime); |
| 7855 | pBody += sizeof(tANI_U32); |
| 7856 | len +=4; |
| 7857 | |
| 7858 | } |
| 7859 | |
| 7860 | if (psessionEntry->p2pGoPsUpdate.uNoa2Duration) |
| 7861 | { |
| 7862 | *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt; |
| 7863 | pBody += 1; |
| 7864 | len +=1; |
| 7865 | |
| 7866 | *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration); |
| 7867 | pBody += sizeof(tANI_U32); |
| 7868 | len +=4; |
| 7869 | |
| 7870 | *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval); |
| 7871 | pBody += sizeof(tANI_U32); |
| 7872 | len +=4; |
| 7873 | |
| 7874 | *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime); |
| 7875 | pBody += sizeof(tANI_U32); |
| 7876 | len +=4; |
| 7877 | |
| 7878 | } |
| 7879 | |
| 7880 | |
| 7881 | pBody = pNoaStream + 1; |
| 7882 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/ |
| 7883 | |
| 7884 | return (len); |
| 7885 | |
| 7886 | } |
| 7887 | return 0; |
| 7888 | |
| 7889 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7890 | |
| 7891 | void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7892 | { |
| 7893 | |
| 7894 | pMac->lim.gResumeChannel = channel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7895 | pMac->lim.gResumePhyCbState = phyCbState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7896 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7897 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7898 | /*-------------------------------------------------------------------------- |
| 7899 | |
| 7900 | \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session. |
| 7901 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7902 | This function returns the channel to resume to during link resume. channel id of 0 means HAL will |
| 7903 | resume to previous channel before link suspend |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7904 | |
| 7905 | \param pMac - pointer to global adapter context |
| 7906 | \return - channel to scan from valid session else zero. |
| 7907 | |
| 7908 | \sa |
| 7909 | |
| 7910 | --------------------------------------------------------------------------*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7911 | void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7912 | { |
| 7913 | |
| 7914 | //Rationale - this could be the suspend/resume for assoc and it is essential that |
| 7915 | //the new BSS is active for some time. Other BSS was anyway suspended. |
| 7916 | //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means |
| 7917 | //there will be trouble. But since it is sent on current channel, it will be missed by peer |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7918 | //and hence should be ok. Need to discuss this further |
| 7919 | if( !limIsInMCC(pMac) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | { |
| 7921 | //Get current active session channel |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7922 | peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7923 | } |
| 7924 | else |
| 7925 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7926 | *resumeChannel = pMac->lim.gResumeChannel; |
| 7927 | *resumePhyCbState = pMac->lim.gResumePhyCbState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7928 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7929 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7930 | } |
| 7931 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7933 | #endif |
| 7934 | |
| 7935 | tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel) |
| 7936 | { |
| 7937 | if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel)) |
| 7938 | { |
| 7939 | return eANI_BOOLEAN_TRUE; |
| 7940 | } |
| 7941 | else |
| 7942 | { |
| 7943 | return eANI_BOOLEAN_FALSE; |
| 7944 | } |
| 7945 | } |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 7946 | |
| 7947 | #ifdef WLAN_FEATURE_11AC |
| 7948 | tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId) |
| 7949 | { |
| 7950 | tUpdateVHTOpMode tempParam; |
| 7951 | |
| 7952 | tempParam.opMode = chanWidth; |
| 7953 | tempParam.staId = staId; |
| 7954 | |
| 7955 | limSendModeUpdate( pMac, &tempParam, psessionEntry ); |
| 7956 | |
| 7957 | return eANI_BOOLEAN_TRUE; |
| 7958 | } |
| 7959 | #endif |