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