Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013 Qualcomm Atheros, Inc. |
| 3 | * All Rights Reserved. |
| 4 | * Qualcomm Atheros Confidential and Proprietary. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 5 | */ |
| 6 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 8 | * This file limIbssPeerMgmt.cc contains the utility functions |
| 9 | * LIM uses to maintain peers in IBSS. |
| 10 | * Author: Chandra Modumudi |
| 11 | * Date: 03/12/04 |
| 12 | * History:- |
| 13 | * Date Modified by Modification Information |
| 14 | * -------------------------------------------------------------------- |
| 15 | */ |
| 16 | #include "palTypes.h" |
| 17 | #include "aniGlobal.h" |
| 18 | #include "sirCommon.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19 | #include "wniCfgSta.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20 | #include "limUtils.h" |
| 21 | #include "limAssocUtils.h" |
| 22 | #include "limStaHashApi.h" |
| 23 | #include "schApi.h" // schSetFixedBeaconFields for IBSS coalesce |
| 24 | #include "limSecurityUtils.h" |
| 25 | #include "limSendMessages.h" |
| 26 | #include "limSession.h" |
| 27 | #include "limIbssPeerMgmt.h" |
| 28 | |
| 29 | |
| 30 | /** |
| 31 | * ibss_peer_find |
| 32 | * |
| 33 | *FUNCTION: |
| 34 | * This function is called while adding a context at |
| 35 | * DPH & Polaris for a peer in IBSS. |
| 36 | * If peer is found in the list, capabilities from the |
| 37 | * returned BSS description are used at DPH node & Polaris. |
| 38 | * |
| 39 | *LOGIC: |
| 40 | * |
| 41 | *ASSUMPTIONS: |
| 42 | * |
| 43 | *NOTE: |
| 44 | * |
| 45 | * @param macAddr - MAC address of the peer |
| 46 | * |
| 47 | * @return Pointer to peer node if found, else NULL |
| 48 | */ |
| 49 | |
| 50 | static tLimIbssPeerNode * |
| 51 | ibss_peer_find( |
| 52 | tpAniSirGlobal pMac, |
| 53 | tSirMacAddr macAddr) |
| 54 | { |
| 55 | tLimIbssPeerNode *pTempNode = pMac->lim.gLimIbssPeerList; |
| 56 | |
| 57 | while (pTempNode != NULL) |
| 58 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 59 | if (vos_mem_compare((tANI_U8 *) macAddr, |
| 60 | (tANI_U8 *) &pTempNode->peerMacAddr, |
| 61 | sizeof(tSirMacAddr))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | break; |
| 63 | pTempNode = pTempNode->next; |
| 64 | } |
| 65 | return pTempNode; |
| 66 | } /*** end ibss_peer_find() ***/ |
| 67 | |
| 68 | /** |
| 69 | * ibss_peer_add |
| 70 | * |
| 71 | *FUNCTION: |
| 72 | * This is called on a STA in IBSS upon receiving Beacon/ |
| 73 | * Probe Response from a peer. |
| 74 | * |
| 75 | *LOGIC: |
| 76 | * Node is always added to the front of the list |
| 77 | * |
| 78 | *ASSUMPTIONS: |
| 79 | * |
| 80 | *NOTE: |
| 81 | * |
| 82 | * @param pMac - Pointer to Global MAC structure |
| 83 | * @param pPeerNode - Pointer to peer node to be added to the list. |
| 84 | * |
| 85 | * @return None |
| 86 | */ |
| 87 | |
| 88 | static tSirRetStatus |
| 89 | ibss_peer_add(tpAniSirGlobal pMac, tLimIbssPeerNode *pPeerNode) |
| 90 | { |
| 91 | #ifdef ANI_SIR_IBSS_PEER_CACHING |
| 92 | tANI_U32 numIbssPeers = (2 * pMac->lim.maxStation); |
| 93 | |
| 94 | if (pMac->lim.gLimNumIbssPeers >= numIbssPeers) |
| 95 | { |
| 96 | /** |
| 97 | * Reached max number of peers to be maintained. |
| 98 | * Delete last entry & add new entry at the beginning. |
| 99 | */ |
| 100 | tLimIbssPeerNode *pTemp, *pPrev; |
| 101 | pTemp = pPrev = pMac->lim.gLimIbssPeerList; |
| 102 | while (pTemp->next != NULL) |
| 103 | { |
| 104 | pPrev = pTemp; |
| 105 | pTemp = pTemp->next; |
| 106 | } |
| 107 | if(pTemp->beacon) |
| 108 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 109 | vos_mem_free(pTemp->beacon); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | } |
| 111 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 112 | vos_mem_free(pTemp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | pPrev->next = NULL; |
| 114 | } |
| 115 | else |
| 116 | #endif |
| 117 | pMac->lim.gLimNumIbssPeers++; |
| 118 | |
| 119 | pPeerNode->next = pMac->lim.gLimIbssPeerList; |
| 120 | pMac->lim.gLimIbssPeerList = pPeerNode; |
| 121 | |
| 122 | return eSIR_SUCCESS; |
| 123 | |
| 124 | } /*** end limAddIbssPeerToList() ***/ |
| 125 | |
| 126 | /** |
| 127 | * ibss_peer_collect |
| 128 | * |
| 129 | *FUNCTION: |
| 130 | * This is called to collect IBSS peer information |
| 131 | * from received Beacon/Probe Response frame from it. |
| 132 | * |
| 133 | *LOGIC: |
| 134 | * |
| 135 | *ASSUMPTIONS: |
| 136 | * |
| 137 | *NOTE: |
| 138 | * |
| 139 | * @param pMac - Pointer to Global MAC structure |
| 140 | * @param pBeacon - Parsed Beacon Frame structure |
| 141 | * @param pBD - Pointer to received BD |
| 142 | * @param pPeer - Pointer to IBSS peer node |
| 143 | * |
| 144 | * @return None |
| 145 | */ |
| 146 | |
| 147 | static void |
| 148 | ibss_peer_collect( |
| 149 | tpAniSirGlobal pMac, |
| 150 | tpSchBeaconStruct pBeacon, |
| 151 | tpSirMacMgmtHdr pHdr, |
| 152 | tLimIbssPeerNode *pPeer, |
| 153 | tpPESession psessionEntry) |
| 154 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 155 | vos_mem_copy(pPeer->peerMacAddr, pHdr->sa, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 156 | |
| 157 | pPeer->capabilityInfo = pBeacon->capabilityInfo; |
| 158 | pPeer->extendedRatesPresent = pBeacon->extendedRatesPresent; |
| 159 | pPeer->edcaPresent = pBeacon->edcaPresent; |
| 160 | pPeer->wmeEdcaPresent = pBeacon->wmeEdcaPresent; |
| 161 | pPeer->wmeInfoPresent = pBeacon->wmeInfoPresent; |
| 162 | |
| 163 | if(IS_DOT11_MODE_HT(psessionEntry->dot11mode) && |
| 164 | (pBeacon->HTCaps.present)) |
| 165 | { |
| 166 | pPeer->htCapable = pBeacon->HTCaps.present; |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 167 | vos_mem_copy((tANI_U8 *)pPeer->supportedMCSSet, |
| 168 | (tANI_U8 *)pBeacon->HTCaps.supportedMCSSet, |
| 169 | sizeof(pPeer->supportedMCSSet)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 170 | pPeer->htGreenfield = (tANI_U8)pBeacon->HTCaps.greenField; |
| 171 | pPeer->htSupportedChannelWidthSet = ( tANI_U8 ) pBeacon->HTCaps.supportedChannelWidthSet; |
| 172 | pPeer->htMIMOPSState = (tSirMacHTMIMOPowerSaveState)pBeacon->HTCaps.mimoPowerSave; |
| 173 | pPeer->htMaxAmsduLength = ( tANI_U8 ) pBeacon->HTCaps.maximalAMSDUsize; |
| 174 | pPeer->htAMpduDensity = pBeacon->HTCaps.mpduDensity; |
| 175 | pPeer->htDsssCckRate40MHzSupport = (tANI_U8)pBeacon->HTCaps.dsssCckMode40MHz; |
| 176 | pPeer->htShortGI20Mhz = (tANI_U8)pBeacon->HTCaps.shortGI20MHz; |
| 177 | pPeer->htShortGI40Mhz = (tANI_U8)pBeacon->HTCaps.shortGI40MHz; |
| 178 | pPeer->htMaxRxAMpduFactor = pBeacon->HTCaps.maxRxAMPDUFactor; |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 179 | pPeer->htSecondaryChannelOffset = pBeacon->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | } |
| 181 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 182 | /* Collect peer VHT capabilities based on the received beacon from the peer */ |
| 183 | #ifdef WLAN_FEATURE_11AC |
| 184 | if ( pBeacon->VHTCaps.present ) |
| 185 | { |
Bansidhar Gopalachari | 5fd3d13 | 2013-07-30 13:35:35 -0700 | [diff] [blame] | 186 | pPeer->vhtSupportedChannelWidthSet = pBeacon->VHTOperation.chanWidth; |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 187 | pPeer->vhtCapable = pBeacon->VHTCaps.present; |
| 188 | |
| 189 | // Collect VHT capabilities from beacon |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 190 | vos_mem_copy((tANI_U8 *) &pPeer->VHTCaps, |
| 191 | (tANI_U8 *) &pBeacon->VHTCaps, |
| 192 | sizeof(tDot11fIEVHTCaps)); |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 193 | } |
| 194 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 195 | pPeer->erpIePresent = pBeacon->erpPresent; |
| 196 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 197 | vos_mem_copy((tANI_U8 *) &pPeer->supportedRates, |
| 198 | (tANI_U8 *) &pBeacon->supportedRates, |
| 199 | pBeacon->supportedRates.numRates + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 200 | if (pPeer->extendedRatesPresent) |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 201 | vos_mem_copy((tANI_U8 *) &pPeer->extendedRates, |
| 202 | (tANI_U8 *) &pBeacon->extendedRates, |
| 203 | pBeacon->extendedRates.numRates + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 204 | else |
| 205 | pPeer->extendedRates.numRates = 0; |
| 206 | |
| 207 | // TBD copy EDCA parameters |
| 208 | // pPeer->edcaParams; |
| 209 | |
| 210 | pPeer->next = NULL; |
| 211 | } /*** end ibss_peer_collect() ***/ |
| 212 | |
| 213 | // handle change in peer qos/wme capabilities |
| 214 | static void |
| 215 | ibss_sta_caps_update( |
| 216 | tpAniSirGlobal pMac, |
| 217 | tLimIbssPeerNode *pPeerNode, |
| 218 | tpPESession psessionEntry) |
| 219 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 220 | tANI_U16 peerIdx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 221 | tpDphHashNode pStaDs; |
| 222 | |
| 223 | pPeerNode->beaconHBCount++; //Update beacon count. |
| 224 | |
| 225 | // if the peer node exists, update its qos capabilities |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 226 | if ((pStaDs = dphLookupHashEntry(pMac, pPeerNode->peerMacAddr, &peerIdx, &psessionEntry->dph.dphHashTable)) == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 227 | return; |
| 228 | |
| 229 | |
| 230 | //Update HT Capabilities |
| 231 | if(IS_DOT11_MODE_HT(psessionEntry->dot11mode)) |
| 232 | { |
| 233 | pStaDs->mlmStaContext.htCapability = pPeerNode->htCapable; |
| 234 | if (pPeerNode->htCapable) |
| 235 | { |
| 236 | pStaDs->htGreenfield = pPeerNode->htGreenfield; |
| 237 | pStaDs->htSupportedChannelWidthSet = pPeerNode->htSupportedChannelWidthSet; |
| 238 | pStaDs->htMIMOPSState = pPeerNode->htMIMOPSState; |
| 239 | pStaDs->htMaxAmsduLength = pPeerNode->htMaxAmsduLength; |
| 240 | pStaDs->htAMpduDensity = pPeerNode->htAMpduDensity; |
| 241 | pStaDs->htDsssCckRate40MHzSupport = pPeerNode->htDsssCckRate40MHzSupport; |
| 242 | pStaDs->htShortGI20Mhz = pPeerNode->htShortGI20Mhz; |
| 243 | pStaDs->htShortGI40Mhz = pPeerNode->htShortGI40Mhz; |
| 244 | pStaDs->htMaxRxAMpduFactor = pPeerNode->htMaxRxAMpduFactor; |
| 245 | // In the future, may need to check for "delayedBA" |
| 246 | // For now, it is IMMEDIATE BA only on ALL TID's |
| 247 | pStaDs->baPolicyFlag = 0xFF; |
| 248 | } |
| 249 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 250 | #ifdef WLAN_FEATURE_11AC |
| 251 | if ( IS_DOT11_MODE_VHT(psessionEntry->dot11mode) ) |
| 252 | { |
| 253 | pStaDs->mlmStaContext.vhtCapability = pPeerNode->vhtCapable; |
| 254 | if ( pPeerNode->vhtCapable ) |
| 255 | { |
| 256 | pStaDs->vhtSupportedChannelWidthSet = pPeerNode->vhtSupportedChannelWidthSet; |
| 257 | } |
| 258 | } |
| 259 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 260 | |
| 261 | if(IS_DOT11_MODE_PROPRIETARY(psessionEntry->dot11mode) && |
| 262 | pPeerNode->aniIndicator) |
| 263 | { |
| 264 | pStaDs->aniPeer = pPeerNode->aniIndicator; |
| 265 | pStaDs->propCapability = pPeerNode->propCapability; |
| 266 | } |
| 267 | |
| 268 | |
| 269 | // peer is 11e capable but is not 11e enabled yet |
| 270 | // some STA's when joining Airgo IBSS, assert qos capability even when |
| 271 | // they don't suport qos. however, they do not include the edca parameter |
| 272 | // set. so let's check for edcaParam in addition to the qos capability |
| 273 | if (pPeerNode->capabilityInfo.qos && (psessionEntry->limQosEnabled) && pPeerNode->edcaPresent) |
| 274 | { |
| 275 | pStaDs->qosMode = 1; |
| 276 | pStaDs->wmeEnabled = 0; |
| 277 | if (! pStaDs->lleEnabled) |
| 278 | { |
| 279 | pStaDs->lleEnabled = 1; |
| 280 | //dphSetACM(pMac, pStaDs); |
| 281 | } |
| 282 | return; |
| 283 | } |
| 284 | // peer is not 11e capable now but was 11e enabled earlier |
| 285 | else if (pStaDs->lleEnabled) |
| 286 | { |
| 287 | pStaDs->qosMode = 0; |
| 288 | pStaDs->lleEnabled = 0; |
| 289 | } |
| 290 | |
| 291 | // peer is wme capable but is not wme enabled yet |
| 292 | if (pPeerNode->wmeInfoPresent && psessionEntry->limWmeEnabled) |
| 293 | { |
| 294 | pStaDs->qosMode = 1; |
| 295 | pStaDs->lleEnabled = 0; |
| 296 | if (! pStaDs->wmeEnabled) |
| 297 | { |
| 298 | pStaDs->wmeEnabled = 1; |
| 299 | //dphSetACM(pMac, pStaDs); |
| 300 | } |
| 301 | return; |
| 302 | } |
| 303 | /* When the peer device supports EDCA parameters, then we were not |
| 304 | considering. Added this code when we saw that one of the Peer Device |
| 305 | was advertising WMM param where we were not honouring that. CR# 210756 |
| 306 | */ |
| 307 | if (pPeerNode->wmeEdcaPresent && psessionEntry->limWmeEnabled) { |
| 308 | pStaDs->qosMode = 1; |
| 309 | pStaDs->lleEnabled = 0; |
| 310 | if (! pStaDs->wmeEnabled) { |
| 311 | pStaDs->wmeEnabled = 1; |
| 312 | } |
| 313 | return; |
| 314 | } |
| 315 | |
| 316 | // peer is not wme capable now but was wme enabled earlier |
| 317 | else if (pStaDs->wmeEnabled) |
| 318 | { |
| 319 | pStaDs->qosMode = 0; |
| 320 | pStaDs->wmeEnabled = 0; |
| 321 | } |
| 322 | |
| 323 | } |
| 324 | |
| 325 | static void |
| 326 | ibss_sta_rates_update( |
| 327 | tpAniSirGlobal pMac, |
| 328 | tpDphHashNode pStaDs, |
| 329 | tLimIbssPeerNode *pPeer, |
| 330 | tpPESession psessionEntry) |
| 331 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 332 | #ifdef WLAN_FEATURE_11AC |
| 333 | limPopulateMatchingRateSet(pMac, pStaDs, &pPeer->supportedRates, |
| 334 | &pPeer->extendedRates, pPeer->supportedMCSSet, |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 335 | &pStaDs->mlmStaContext.propRateSet,psessionEntry, &pPeer->VHTCaps); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 336 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | // Populate supported rateset |
| 338 | limPopulateMatchingRateSet(pMac, pStaDs, &pPeer->supportedRates, |
| 339 | &pPeer->extendedRates, pPeer->supportedMCSSet, |
| 340 | &pStaDs->mlmStaContext.propRateSet,psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 341 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 342 | |
| 343 | pStaDs->mlmStaContext.capabilityInfo = pPeer->capabilityInfo; |
| 344 | } /*** end ibss_sta_info_update() ***/ |
| 345 | |
| 346 | /** |
| 347 | * ibss_sta_info_update |
| 348 | * |
| 349 | *FUNCTION: |
| 350 | * This is called to program both SW & Polaris context |
| 351 | * for peer in IBSS. |
| 352 | * |
| 353 | *LOGIC: |
| 354 | * |
| 355 | *ASSUMPTIONS: |
| 356 | * |
| 357 | *NOTE: |
| 358 | * |
| 359 | * @param pMac - Pointer to Global MAC structure |
| 360 | * @param pStaDs - Pointer to DPH node |
| 361 | * @param pPeer - Pointer to IBSS peer node |
| 362 | * |
| 363 | * @return None |
| 364 | */ |
| 365 | |
| 366 | static void |
| 367 | ibss_sta_info_update( |
| 368 | tpAniSirGlobal pMac, |
| 369 | tpDphHashNode pStaDs, |
| 370 | tLimIbssPeerNode *pPeer, |
| 371 | tpPESession psessionEntry) |
| 372 | { |
| 373 | pStaDs->staType = STA_ENTRY_PEER; |
| 374 | ibss_sta_caps_update(pMac, pPeer,psessionEntry); |
| 375 | ibss_sta_rates_update(pMac, pStaDs, pPeer,psessionEntry); |
| 376 | } /*** end ibss_sta_info_update() ***/ |
| 377 | |
| 378 | static void |
| 379 | ibss_coalesce_free( |
| 380 | tpAniSirGlobal pMac) |
| 381 | { |
| 382 | if (pMac->lim.ibssInfo.pHdr != NULL) |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 383 | vos_mem_free(pMac->lim.ibssInfo.pHdr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 384 | if (pMac->lim.ibssInfo.pBeacon != NULL) |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 385 | vos_mem_free(pMac->lim.ibssInfo.pBeacon); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 386 | |
| 387 | pMac->lim.ibssInfo.pHdr = NULL; |
| 388 | pMac->lim.ibssInfo.pBeacon = NULL; |
| 389 | } |
| 390 | |
| 391 | /* |
| 392 | * save the beacon params for use when adding the bss |
| 393 | */ |
| 394 | static void |
| 395 | ibss_coalesce_save( |
| 396 | tpAniSirGlobal pMac, |
| 397 | tpSirMacMgmtHdr pHdr, |
| 398 | tpSchBeaconStruct pBeacon) |
| 399 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 400 | // get rid of any saved info |
| 401 | ibss_coalesce_free(pMac); |
| 402 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 403 | pMac->lim.ibssInfo.pHdr = vos_mem_malloc(sizeof(*pHdr)); |
| 404 | if (NULL == pMac->lim.ibssInfo.pHdr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 405 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 406 | PELOGE(limLog(pMac, LOGE, FL("ibbs-save: Failed malloc pHdr"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 407 | return; |
| 408 | } |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 409 | pMac->lim.ibssInfo.pBeacon = vos_mem_malloc(sizeof(*pBeacon)); |
| 410 | if (NULL == pMac->lim.ibssInfo.pBeacon) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 411 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 412 | PELOGE(limLog(pMac, LOGE, FL("ibbs-save: Failed malloc pBeacon"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | ibss_coalesce_free(pMac); |
| 414 | return; |
| 415 | } |
| 416 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 417 | vos_mem_copy(pMac->lim.ibssInfo.pHdr, pHdr, sizeof(*pHdr)); |
| 418 | vos_mem_copy(pMac->lim.ibssInfo.pBeacon, pBeacon, sizeof(*pBeacon)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | /* |
| 422 | * tries to add a new entry to dph hash node |
| 423 | * if necessary, an existing entry is eliminated |
| 424 | */ |
| 425 | static tSirRetStatus |
| 426 | ibss_dph_entry_add( |
| 427 | tpAniSirGlobal pMac, |
| 428 | tSirMacAddr peerAddr, |
| 429 | tpDphHashNode *ppSta, |
| 430 | tpPESession psessionEntry) |
| 431 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 432 | tANI_U16 peerIdx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 433 | tpDphHashNode pStaDs; |
| 434 | |
| 435 | *ppSta = NULL; |
| 436 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 437 | pStaDs = dphLookupHashEntry(pMac, peerAddr, &peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 438 | if (pStaDs != NULL) |
| 439 | { |
| 440 | /* Trying to add context for already existing STA in IBSS */ |
| 441 | PELOGE(limLog(pMac, LOGE, FL("STA exists already "));) |
| 442 | limPrintMacAddr(pMac, peerAddr, LOGE); |
| 443 | return eSIR_FAILURE; |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * Assign an AID, delete context existing with that |
| 448 | * AID and then add an entry to hash table maintained |
| 449 | * by DPH module. |
| 450 | */ |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 451 | peerIdx = limAssignPeerIdx(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 452 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 453 | pStaDs = dphGetHashEntry(pMac, peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 454 | if (pStaDs) |
| 455 | { |
| 456 | (void) limDelSta(pMac, pStaDs, false /*asynchronous*/,psessionEntry); |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 457 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, peerIdx,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 458 | } |
| 459 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 460 | pStaDs = dphAddHashEntry(pMac, peerAddr, peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 461 | if (pStaDs == NULL) |
| 462 | { |
| 463 | // Could not add hash table entry |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 464 | PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for peerIdx/aid=%d MACaddr:"), peerIdx);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 465 | limPrintMacAddr(pMac, peerAddr, LOGE); |
| 466 | return eSIR_FAILURE; |
| 467 | } |
| 468 | |
| 469 | *ppSta = pStaDs; |
| 470 | return eSIR_SUCCESS; |
| 471 | } |
| 472 | |
| 473 | // send a status change notification |
| 474 | static void |
| 475 | ibss_status_chg_notify( |
| 476 | tpAniSirGlobal pMac, |
| 477 | tSirMacAddr peerAddr, |
| 478 | tANI_U16 staIndex, |
| 479 | tANI_U8 ucastSig, |
| 480 | tANI_U8 bcastSig, |
| 481 | tANI_U16 status, |
| 482 | tANI_U8 sessionId) |
| 483 | { |
| 484 | |
| 485 | tLimIbssPeerNode *peerNode; |
| 486 | tANI_U8 *beacon = NULL; |
| 487 | tANI_U16 bcnLen = 0; |
| 488 | |
| 489 | |
| 490 | peerNode = ibss_peer_find(pMac,peerAddr); |
| 491 | if(peerNode != NULL) |
| 492 | { |
| 493 | if(peerNode->beacon == NULL) peerNode->beaconLen = 0; |
| 494 | beacon = peerNode->beacon; |
| 495 | bcnLen = peerNode->beaconLen; |
| 496 | peerNode->beacon = NULL; |
| 497 | peerNode->beaconLen = 0; |
| 498 | } |
| 499 | |
| 500 | limSendSmeIBSSPeerInd(pMac,peerAddr, staIndex, ucastSig, bcastSig, |
| 501 | beacon, bcnLen, status, sessionId); |
| 502 | |
| 503 | if(beacon != NULL) |
| 504 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 505 | vos_mem_free(beacon); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 506 | } |
| 507 | } |
| 508 | |
| 509 | |
| 510 | static void |
| 511 | ibss_bss_add( |
| 512 | tpAniSirGlobal pMac, |
| 513 | tpPESession psessionEntry) |
| 514 | { |
| 515 | tLimMlmStartReq mlmStartReq; |
| 516 | tANI_U32 cfg; |
| 517 | tpSirMacMgmtHdr pHdr = (tpSirMacMgmtHdr) pMac->lim.ibssInfo.pHdr; |
| 518 | tpSchBeaconStruct pBeacon = (tpSchBeaconStruct) pMac->lim.ibssInfo.pBeacon; |
| 519 | tANI_U8 numExtRates = 0; |
| 520 | |
| 521 | if ((pHdr == NULL) || (pBeacon == NULL)) |
| 522 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 523 | PELOGE(limLog(pMac, LOGE, FL("Unable to add BSS (no cached BSS info)"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 524 | return; |
| 525 | } |
| 526 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 527 | vos_mem_copy(psessionEntry->bssId, pHdr->bssId, |
| 528 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 529 | |
| 530 | #if 0 |
| 531 | if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) pHdr->bssId, sizeof(tSirMacAddr)) |
| 532 | != eSIR_SUCCESS) |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 533 | limLog(pMac, LOGP, FL("could not update BSSID at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 534 | #endif //TO SUPPORT BT-AMP |
| 535 | |
| 536 | sirCopyMacAddr(pHdr->bssId,psessionEntry->bssId); |
| 537 | /* We need not use global Mac address since per seesion BSSID is available */ |
| 538 | //limSetBssid(pMac, pHdr->bssId); |
| 539 | |
| 540 | #if 0 |
| 541 | if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &cfg) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 542 | limLog(pMac, LOGP, FL("Can't read beacon interval")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 543 | #endif //TO SUPPORT BT-AMP |
| 544 | /* Copy beacon interval from sessionTable */ |
| 545 | cfg = psessionEntry->beaconParams.beaconInterval; |
| 546 | if (cfg != pBeacon->beaconInterval) |
| 547 | #if 0 |
| 548 | if (cfgSetInt(pMac, WNI_CFG_BEACON_INTERVAL, pBeacon->beaconInterval) |
| 549 | != eSIR_SUCCESS) |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 550 | limLog(pMac, LOGP, FL("Can't update beacon interval")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | #endif//TO SUPPORT BT-AMP |
| 552 | psessionEntry->beaconParams.beaconInterval = pBeacon->beaconInterval; |
| 553 | |
| 554 | /* This function ibss_bss_add (and hence the below code) is only called during ibss coalescing. We need to |
| 555 | * adapt to peer's capability with respect to short slot time. Changes have been made to limApplyConfiguration() |
| 556 | * so that the IBSS doesnt blindly start with short slot = 1. If IBSS start is part of coalescing then it will adapt |
| 557 | * to peer's short slot using code below. |
| 558 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 559 | /* If cfg is already set to current peer's capability then no need to set it again */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 560 | if (psessionEntry->shortSlotTimeSupported != pBeacon->capabilityInfo.shortSlotTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 561 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 562 | psessionEntry->shortSlotTimeSupported = pBeacon->capabilityInfo.shortSlotTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 563 | } |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 564 | vos_mem_copy((tANI_U8 *) &psessionEntry->pLimStartBssReq->operationalRateSet, |
| 565 | (tANI_U8 *) &pBeacon->supportedRates, |
| 566 | pBeacon->supportedRates.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 567 | |
| 568 | #if 0 |
| 569 | if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 570 | (tANI_U8 *) &pMac->lim.gpLimStartBssReq->operationalRateSet.rate, |
| 571 | pMac->lim.gpLimStartBssReq->operationalRateSet.numRates) |
| 572 | != eSIR_SUCCESS) |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 573 | limLog(pMac, LOGP, FL("could not update OperRateset at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 574 | #endif //TO SUPPORT BT-AMP |
| 575 | |
| 576 | /** |
| 577 | * WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET CFG needs to be reset, when |
| 578 | * there is no extended rate IE present in beacon. This is especially important when |
| 579 | * supportedRateSet IE contains all the extended rates as well and STA decides to coalesce. |
| 580 | * In this IBSS coalescing scenario LIM will tear down the BSS and Add a new one. So LIM needs to |
| 581 | * reset this CFG, just in case CSR originally had set this CFG when IBSS was started from the local profile. |
| 582 | * If IBSS was started by CSR from the BssDescription, then it would reset this CFG before StartBss is issued. |
| 583 | * The idea is that the count of OpRateSet and ExtendedOpRateSet rates should not be more than 12. |
| 584 | */ |
| 585 | |
| 586 | if(pBeacon->extendedRatesPresent) |
| 587 | numExtRates = pBeacon->extendedRates.numRates; |
| 588 | if (cfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 589 | (tANI_U8 *) &pBeacon->extendedRates.rate, numExtRates) != eSIR_SUCCESS) |
| 590 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 591 | limLog(pMac, LOGP, FL("could not update ExtendedOperRateset at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 592 | return; |
| 593 | } |
| 594 | |
| 595 | |
| 596 | /* |
| 597 | * Each IBSS node will advertise its own HT Capabilities instead of adapting to the Peer's capabilities |
| 598 | * If we don't do this then IBSS may not go back to full capabilities when the STA with lower capabilities |
| 599 | * leaves the IBSS. e.g. when non-CB STA joins an IBSS and then leaves, the IBSS will be stuck at non-CB mode |
| 600 | * even though all the nodes are capable of doing CB. |
| 601 | * so it is decided to leave the self HT capabilties intact. This may change if some issues are found in interop. |
| 602 | */ |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 603 | vos_mem_set((void *) &mlmStartReq, sizeof(mlmStartReq), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 604 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 605 | vos_mem_copy(mlmStartReq.bssId, pHdr->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 606 | mlmStartReq.rateSet.numRates = psessionEntry->pLimStartBssReq->operationalRateSet.numRates; |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 607 | vos_mem_copy(&mlmStartReq.rateSet.rate[0], |
| 608 | &psessionEntry->pLimStartBssReq->operationalRateSet.rate[0], |
| 609 | mlmStartReq.rateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 610 | mlmStartReq.bssType = eSIR_IBSS_MODE; |
| 611 | mlmStartReq.beaconPeriod = pBeacon->beaconInterval; |
| 612 | mlmStartReq.nwType = psessionEntry->pLimStartBssReq->nwType; //psessionEntry->nwType is also OK???? |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 613 | mlmStartReq.htCapable = psessionEntry->htCapability; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 614 | mlmStartReq.htOperMode = pMac->lim.gHTOperMode; |
| 615 | mlmStartReq.dualCTSProtection = pMac->lim.gHTDualCTSProtection; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 616 | mlmStartReq.txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 617 | |
| 618 | #if 0 |
| 619 | if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &cfg) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 620 | limLog(pMac, LOGP, FL("CurrentChannel CFG get fialed!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 621 | #endif |
| 622 | |
| 623 | //mlmStartReq.channelNumber = (tSirMacChanNum) cfg; |
| 624 | |
| 625 | /* reading the channel num from session Table */ |
| 626 | mlmStartReq.channelNumber = psessionEntry->currentOperChannel; |
| 627 | |
| 628 | mlmStartReq.cbMode = psessionEntry->pLimStartBssReq->cbMode; |
| 629 | |
| 630 | // Copy the SSID for RxP filtering based on SSID. |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 631 | vos_mem_copy((tANI_U8 *) &mlmStartReq.ssId, |
| 632 | (tANI_U8 *) &psessionEntry->pLimStartBssReq->ssId, |
| 633 | psessionEntry->pLimStartBssReq->ssId.length + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 634 | |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 635 | PELOG1(limLog(pMac, LOG1, FL("invoking ADD_BSS as part of coalescing!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 636 | if (limMlmAddBss(pMac, &mlmStartReq,psessionEntry) != eSIR_SME_SUCCESS) |
| 637 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 638 | PELOGE(limLog(pMac, LOGE, FL("AddBss failure"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 639 | return; |
| 640 | } |
| 641 | |
| 642 | // Update fields in Beacon |
| 643 | if (schSetFixedBeaconFields(pMac,psessionEntry) != eSIR_SUCCESS) |
| 644 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 645 | PELOGE(limLog(pMac, LOGE, FL("*** Unable to set fixed Beacon fields ***"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 646 | return; |
| 647 | } |
| 648 | |
| 649 | } |
| 650 | |
| 651 | |
| 652 | |
| 653 | /* delete the current BSS */ |
| 654 | static void |
| 655 | ibss_bss_delete( |
| 656 | tpAniSirGlobal pMac, |
| 657 | tpPESession psessionEntry) |
| 658 | { |
| 659 | tSirRetStatus status; |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 660 | PELOGW(limLog(pMac, LOGW, FL("Initiating IBSS Delete BSS"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 661 | if (psessionEntry->limMlmState != eLIM_MLM_BSS_STARTED_STATE) |
| 662 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 663 | limLog(pMac, LOGW, FL("Incorrect LIM MLM state for delBss (%d)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | psessionEntry->limMlmState); |
| 665 | return; |
| 666 | } |
| 667 | status = limDelBss(pMac, NULL, psessionEntry->bssIdx, psessionEntry); |
| 668 | if (status != eSIR_SUCCESS) |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 669 | PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 670 | } |
| 671 | |
| 672 | /** |
| 673 | * limIbssInit |
| 674 | * |
| 675 | *FUNCTION: |
| 676 | * This function is called while starting an IBSS |
| 677 | * to initialize list used to maintain IBSS peers. |
| 678 | * |
| 679 | *LOGIC: |
| 680 | * |
| 681 | *ASSUMPTIONS: |
| 682 | * |
| 683 | *NOTE: |
| 684 | * |
| 685 | * @param pMac - Pointer to Global MAC structure |
| 686 | * @return None |
| 687 | */ |
| 688 | |
| 689 | void |
| 690 | limIbssInit( |
| 691 | tpAniSirGlobal pMac) |
| 692 | { |
| 693 | //pMac->lim.gLimIbssActive = 0; |
| 694 | pMac->lim.gLimIbssCoalescingHappened = 0; |
| 695 | pMac->lim.gLimIbssPeerList = NULL; |
| 696 | pMac->lim.gLimNumIbssPeers = 0; |
| 697 | |
| 698 | // ibss info - params for which ibss to join while coalescing |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 699 | vos_mem_set(&pMac->lim.ibssInfo, sizeof(tAniSirLimIbss), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 700 | } /*** end limIbssInit() ***/ |
| 701 | |
| 702 | /** |
| 703 | * limIbssDeleteAllPeers |
| 704 | * |
| 705 | *FUNCTION: |
| 706 | * This function is called to delete all peers. |
| 707 | * |
| 708 | *LOGIC: |
| 709 | * |
| 710 | *ASSUMPTIONS: |
| 711 | * |
| 712 | *NOTE: |
| 713 | * |
| 714 | * @param pMac - Pointer to Global MAC structure |
| 715 | * @return None |
| 716 | */ |
| 717 | |
| 718 | void limIbssDeleteAllPeers( tpAniSirGlobal pMac ,tpPESession psessionEntry) |
| 719 | { |
| 720 | tLimIbssPeerNode *pCurrNode, *pTempNode; |
| 721 | tpDphHashNode pStaDs; |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 722 | tANI_U16 peerIdx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | |
| 724 | pCurrNode = pTempNode = pMac->lim.gLimIbssPeerList; |
| 725 | |
| 726 | while (pCurrNode != NULL) |
| 727 | { |
| 728 | if (!pMac->lim.gLimNumIbssPeers) |
| 729 | { |
| 730 | limLog(pMac, LOGP, |
| 731 | FL("Number of peers in the list is zero and node present")); |
| 732 | return; |
| 733 | } |
| 734 | /* Delete the dph entry for the station |
| 735 | * Since it is called to remove all peers, just delete from dph, |
| 736 | * no need to do any beacon related params i.e., dont call limDeleteDphHashEntry |
| 737 | */ |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 738 | pStaDs = dphLookupHashEntry(pMac, pCurrNode->peerMacAddr, &peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 739 | if( pStaDs ) |
| 740 | { |
| 741 | |
| 742 | ibss_status_chg_notify( pMac, pCurrNode->peerMacAddr, pStaDs->staIndex, |
| 743 | pStaDs->ucUcastSig, pStaDs->ucBcastSig, |
| 744 | eWNI_SME_IBSS_PEER_DEPARTED_IND, psessionEntry->smeSessionId ); |
Ravi Joshi | 492be3c | 2013-05-16 19:20:00 -0700 | [diff] [blame] | 745 | limReleasePeerIdx(pMac, peerIdx, psessionEntry); |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 746 | dphDeleteHashEntry(pMac, pStaDs->staAddr, peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 747 | } |
| 748 | |
| 749 | pTempNode = pCurrNode->next; |
| 750 | |
| 751 | /* TODO :Sessionize this code */ |
| 752 | /* Fix CR 227642: PeerList should point to the next node since the current node is being |
| 753 | * freed in the next line. In ibss_peerfind in ibss_status_chg_notify above, we use this |
| 754 | * peer list to find the next peer. So this list needs to be updated with the no of peers left |
| 755 | * after each iteration in this while loop since one by one peers are deleted (freed) in this |
| 756 | * loop causing the lim.gLimIbssPeerList to point to some freed memory. |
| 757 | */ |
| 758 | pMac->lim.gLimIbssPeerList = pTempNode; |
| 759 | |
| 760 | if(pCurrNode->beacon) |
| 761 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 762 | vos_mem_free(pCurrNode->beacon); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 763 | } |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 764 | vos_mem_free(pCurrNode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 765 | if (pMac->lim.gLimNumIbssPeers > 0) // be paranoid |
| 766 | pMac->lim.gLimNumIbssPeers--; |
| 767 | pCurrNode = pTempNode; |
| 768 | } |
| 769 | |
| 770 | if (pMac->lim.gLimNumIbssPeers) |
| 771 | limLog(pMac, LOGP, FL("Number of peers[%d] in the list is non-zero"), |
| 772 | pMac->lim.gLimNumIbssPeers); |
| 773 | |
| 774 | pMac->lim.gLimNumIbssPeers = 0; |
| 775 | pMac->lim.gLimIbssPeerList = NULL; |
| 776 | |
| 777 | } |
| 778 | /** |
| 779 | * limIbssDelete |
| 780 | * |
| 781 | *FUNCTION: |
| 782 | * This function is called while tearing down an IBSS. |
| 783 | * |
| 784 | *LOGIC: |
| 785 | * |
| 786 | *ASSUMPTIONS: |
| 787 | * |
| 788 | *NOTE: |
| 789 | * |
| 790 | * @param pMac - Pointer to Global MAC structure |
| 791 | * @return None |
| 792 | */ |
| 793 | |
| 794 | void |
| 795 | limIbssDelete( |
| 796 | tpAniSirGlobal pMac,tpPESession psessionEntry) |
| 797 | { |
| 798 | limIbssDeleteAllPeers(pMac,psessionEntry); |
| 799 | |
| 800 | ibss_coalesce_free(pMac); |
| 801 | } /*** end limIbssDelete() ***/ |
| 802 | |
| 803 | /** Commenting this Code as from no where it is being invoked */ |
| 804 | #if 0 |
| 805 | /** |
| 806 | * limIbssPeerDelete |
| 807 | * |
| 808 | *FUNCTION: |
| 809 | * This may be called on a STA in IBSS to delete a peer |
| 810 | * from the list. |
| 811 | * |
| 812 | *LOGIC: |
| 813 | * |
| 814 | *ASSUMPTIONS: |
| 815 | * |
| 816 | *NOTE: |
| 817 | * |
| 818 | * @param pMac - Pointer to Global MAC structure |
| 819 | * @param peerMacAddr - MAC address of the peer STA that |
| 820 | * need to be deleted from peer list. |
| 821 | * |
| 822 | * @return None |
| 823 | */ |
| 824 | |
| 825 | void |
| 826 | limIbssPeerDelete(tpAniSirGlobal pMac, tSirMacAddr macAddr) |
| 827 | { |
| 828 | tLimIbssPeerNode *pPrevNode, *pTempNode; |
| 829 | |
| 830 | pTempNode = pPrevNode = pMac->lim.gLimIbssPeerList; |
| 831 | |
| 832 | if (pTempNode == NULL) |
| 833 | return; |
| 834 | |
| 835 | while (pTempNode != NULL) |
| 836 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 837 | if (vos_mem_compare((tANI_U8 *) macAddr, |
| 838 | (tANI_U8 *) &pTempNode->peerMacAddr, |
| 839 | sizeof(tSirMacAddr)) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | { |
| 841 | // Found node to be deleted |
| 842 | if (pMac->lim.gLimIbssPeerList == pTempNode) /** First Node to be deleted*/ |
| 843 | pMac->lim.gLimIbssPeerList = pTempNode->next; |
| 844 | else |
| 845 | pPrevNode->next = pTempNode->next; |
| 846 | |
| 847 | if(pTempNode->beacon) |
| 848 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 849 | vos_mem_free(pTempNode->beacon); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 850 | pTempNode->beacon = NULL; |
| 851 | } |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 852 | vos_mem_free(pTempNode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 853 | pMac->lim.gLimNumIbssPeers--; |
| 854 | return; |
| 855 | } |
| 856 | |
| 857 | pPrevNode = pTempNode; |
| 858 | pTempNode = pTempNode->next; |
| 859 | } |
| 860 | |
| 861 | // Should not be here |
| 862 | PELOGE(limLog(pMac, LOGE, FL("peer not found in the list, addr= "));) |
| 863 | limPrintMacAddr(pMac, macAddr, LOGE); |
| 864 | } /*** end limIbssPeerDelete() ***/ |
| 865 | |
| 866 | #endif |
| 867 | |
| 868 | |
| 869 | /** ------------------------------------------------------------- |
| 870 | \fn limIbssSetProtection |
| 871 | \brief Decides all the protection related information. |
| 872 | \ |
| 873 | \param tpAniSirGlobal pMac |
| 874 | \param tSirMacAddr peerMacAddr |
| 875 | \param tpUpdateBeaconParams pBeaconParams |
| 876 | \return None |
| 877 | -------------------------------------------------------------*/ |
| 878 | static void |
| 879 | limIbssSetProtection(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 880 | { |
| 881 | |
| 882 | if(!pMac->lim.cfgProtection.fromllb) |
| 883 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 884 | PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 885 | return; |
| 886 | } |
| 887 | |
| 888 | if (enable) |
| 889 | { |
| 890 | psessionEntry->gLim11bParams.protectionEnabled = true; |
| 891 | if(false == psessionEntry->beaconParams.llbCoexist/*pMac->lim.llbCoexist*/) |
| 892 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 893 | PELOGE(limLog(pMac, LOGE, FL("=> IBSS: Enable Protection "));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true; |
| 895 | pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED; |
| 896 | } |
| 897 | } |
| 898 | else if (true == psessionEntry->beaconParams.llbCoexist/*pMac->lim.llbCoexist*/) |
| 899 | { |
| 900 | psessionEntry->gLim11bParams.protectionEnabled = false; |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 901 | PELOGE(limLog(pMac, LOGE, FL("===> IBSS: Disable protection "));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 902 | pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false; |
| 903 | pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED; |
| 904 | } |
| 905 | return; |
| 906 | } |
| 907 | |
| 908 | |
| 909 | /** ------------------------------------------------------------- |
| 910 | \fn limIbssUpdateProtectionParams |
| 911 | \brief Decides all the protection related information. |
| 912 | \ |
| 913 | \param tpAniSirGlobal pMac |
| 914 | \param tSirMacAddr peerMacAddr |
| 915 | \param tpUpdateBeaconParams pBeaconParams |
| 916 | \return None |
| 917 | -------------------------------------------------------------*/ |
| 918 | static void |
| 919 | limIbssUpdateProtectionParams(tpAniSirGlobal pMac, |
| 920 | tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType, |
| 921 | tpPESession psessionEntry) |
| 922 | { |
| 923 | tANI_U32 i; |
| 924 | |
| 925 | PELOG1(limLog(pMac,LOG1, FL("A STA is associated:")); |
| 926 | limLog(pMac,LOG1, FL("Addr : ")); |
| 927 | limPrintMacAddr(pMac, peerMacAddr, LOG1);) |
| 928 | |
| 929 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 930 | { |
| 931 | if (pMac->lim.protStaCache[i].active) |
| 932 | { |
| 933 | PELOG1(limLog(pMac, LOG1, FL("Addr: "));) |
| 934 | PELOG1(limPrintMacAddr(pMac, pMac->lim.protStaCache[i].addr, LOG1);) |
| 935 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 936 | if (vos_mem_compare(pMac->lim.protStaCache[i].addr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 937 | peerMacAddr, sizeof(tSirMacAddr))) |
| 938 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 939 | PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | return; |
| 941 | } |
| 942 | } |
| 943 | } |
| 944 | |
| 945 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 946 | { |
| 947 | if (!pMac->lim.protStaCache[i].active) |
| 948 | break; |
| 949 | } |
| 950 | |
| 951 | if (i >= LIM_PROT_STA_CACHE_SIZE) |
| 952 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 953 | PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 954 | return; |
| 955 | } |
| 956 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 957 | vos_mem_copy(pMac->lim.protStaCache[i].addr, |
| 958 | peerMacAddr, |
| 959 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 960 | |
| 961 | pMac->lim.protStaCache[i].protStaCacheType = protStaCacheType; |
| 962 | pMac->lim.protStaCache[i].active = true; |
| 963 | if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType) |
| 964 | { |
| 965 | psessionEntry->gLim11bParams.numSta++; |
| 966 | } |
| 967 | else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType) |
| 968 | { |
| 969 | psessionEntry->gLim11gParams.numSta++; |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | |
| 974 | /** ------------------------------------------------------------- |
| 975 | \fn limIbssDecideProtection |
| 976 | \brief Decides all the protection related information. |
| 977 | \ |
| 978 | \param tpAniSirGlobal pMac |
| 979 | \param tSirMacAddr peerMacAddr |
| 980 | \param tpUpdateBeaconParams pBeaconParams |
| 981 | \return None |
| 982 | -------------------------------------------------------------*/ |
| 983 | static void |
| 984 | limIbssDecideProtection(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 985 | { |
| 986 | tSirRFBand rfBand = SIR_BAND_UNKNOWN; |
| 987 | tANI_U32 phyMode; |
| 988 | tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID; |
| 989 | |
| 990 | pBeaconParams->paramChangeBitmap = 0; |
| 991 | |
| 992 | if(NULL == pStaDs) |
| 993 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 994 | PELOGE(limLog(pMac, LOGE, FL("pStaDs is NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | return; |
| 996 | } |
| 997 | |
| 998 | limGetRfBand(pMac, &rfBand, psessionEntry); |
| 999 | if(SIR_BAND_2_4_GHZ== rfBand) |
| 1000 | { |
| 1001 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1002 | |
| 1003 | //We are 11G or 11n. Check if we need protection from 11b Stations. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1004 | if ((phyMode == WNI_CFG_PHY_MODE_11G) || (psessionEntry->htCapability)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1005 | { |
| 1006 | /* As we found in the past, it is possible that a 11n STA sends |
| 1007 | * Beacon with HT IE but not ERP IE. So the absense of ERP IE |
| 1008 | * in the Beacon is not enough to conclude that STA is 11b. |
| 1009 | */ |
| 1010 | if ((pStaDs->erpEnabled == eHAL_CLEAR) && |
| 1011 | (!pStaDs->mlmStaContext.htCapability)) |
| 1012 | { |
| 1013 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB; |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1014 | PELOGE(limLog(pMac, LOGE, FL("Enable protection from 11B"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1015 | limIbssSetProtection(pMac, true, pBeaconParams,psessionEntry); |
| 1016 | } |
| 1017 | } |
| 1018 | } |
| 1019 | limIbssUpdateProtectionParams(pMac, pStaDs->staAddr, protStaCacheType, psessionEntry); |
| 1020 | return; |
| 1021 | } |
| 1022 | |
| 1023 | |
| 1024 | /** |
| 1025 | * limIbssStaAdd() |
| 1026 | * |
| 1027 | *FUNCTION: |
| 1028 | * This function is called to add an STA context in IBSS role |
| 1029 | * whenever a data frame is received from/for a STA that failed |
| 1030 | * hash lookup at DPH. |
| 1031 | * |
| 1032 | *LOGIC: |
| 1033 | * |
| 1034 | *ASSUMPTIONS: |
| 1035 | * NA |
| 1036 | * |
| 1037 | *NOTE: |
| 1038 | * NA |
| 1039 | * |
| 1040 | * @param pMac Pointer to Global MAC structure |
| 1041 | * @param peerAdddr MAC address of the peer being added |
| 1042 | * @return retCode Indicates success or failure return code |
| 1043 | * @return |
| 1044 | */ |
| 1045 | |
| 1046 | tSirRetStatus |
| 1047 | limIbssStaAdd( |
| 1048 | tpAniSirGlobal pMac, |
| 1049 | void *pBody, |
| 1050 | tpPESession psessionEntry) |
| 1051 | { |
| 1052 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 1053 | tpDphHashNode pStaDs; |
| 1054 | tLimIbssPeerNode *pPeerNode; |
| 1055 | tLimMlmStates prevState; |
| 1056 | tSirMacAddr *pPeerAddr = (tSirMacAddr *) pBody; |
| 1057 | tUpdateBeaconParams beaconParams; |
| 1058 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1059 | vos_mem_set((tANI_U8 *) &beaconParams, sizeof(tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1060 | |
| 1061 | if (pBody == 0) |
| 1062 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1063 | PELOGE(limLog(pMac, LOGE, FL("Invalid IBSS AddSta"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | return eSIR_FAILURE; |
| 1065 | } |
| 1066 | |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1067 | PELOGE(limLog(pMac, LOGE, FL("Rx Add-Ibss-Sta for MAC:"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1068 | limPrintMacAddr(pMac, *pPeerAddr, LOGE); |
| 1069 | |
| 1070 | pPeerNode = ibss_peer_find(pMac, *pPeerAddr); |
Jeff Johnson | 8db48ea | 2013-04-08 10:15:38 -0700 | [diff] [blame] | 1071 | if (NULL != pPeerNode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1072 | { |
Jeff Johnson | 8db48ea | 2013-04-08 10:15:38 -0700 | [diff] [blame] | 1073 | retCode = ibss_dph_entry_add(pMac, *pPeerAddr, &pStaDs, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1074 | if (eSIR_SUCCESS == retCode) |
| 1075 | { |
| 1076 | prevState = pStaDs->mlmStaContext.mlmState; |
| 1077 | pStaDs->erpEnabled = pPeerNode->erpIePresent; |
| 1078 | |
Jeff Johnson | 8db48ea | 2013-04-08 10:15:38 -0700 | [diff] [blame] | 1079 | ibss_sta_info_update(pMac, pStaDs, pPeerNode, psessionEntry); |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1080 | PELOGW(limLog(pMac, LOGW, FL("initiating ADD STA for the IBSS peer."));) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1081 | retCode = limAddSta(pMac, pStaDs, false, psessionEntry); |
Jeff Johnson | 8db48ea | 2013-04-08 10:15:38 -0700 | [diff] [blame] | 1082 | if (retCode != eSIR_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1083 | { |
Jeff Johnson | 8db48ea | 2013-04-08 10:15:38 -0700 | [diff] [blame] | 1084 | PELOGE(limLog(pMac, LOGE, FL("ibss-sta-add failed (reason %x)"), |
| 1085 | retCode);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1086 | limPrintMacAddr(pMac, *pPeerAddr, LOGE); |
Jeff Johnson | 8db48ea | 2013-04-08 10:15:38 -0700 | [diff] [blame] | 1087 | pStaDs->mlmStaContext.mlmState = prevState; |
| 1088 | dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, |
| 1089 | &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1090 | } |
| 1091 | else |
| 1092 | { |
| 1093 | if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1094 | limIbssDecideProtection(pMac, pStaDs, &beaconParams , psessionEntry); |
| 1095 | |
| 1096 | if(beaconParams.paramChangeBitmap) |
| 1097 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1098 | PELOGE(limLog(pMac, LOGE, FL("---> Update Beacon Params "));) |
Sunil Ravi | b96f7b5 | 2013-05-22 21:40:05 -0700 | [diff] [blame] | 1099 | schSetFixedBeaconFields(pMac, psessionEntry); |
| 1100 | beaconParams.bssIdx = psessionEntry->bssIdx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1101 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1102 | } |
| 1103 | } |
| 1104 | } |
| 1105 | else |
| 1106 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1107 | PELOGE(limLog(pMac, LOGE, FL("hashTblAdd failed (reason %x)"), retCode);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1108 | limPrintMacAddr(pMac, *pPeerAddr, LOGE); |
| 1109 | } |
| 1110 | } |
| 1111 | else |
| 1112 | { |
| 1113 | retCode = eSIR_FAILURE; |
| 1114 | } |
| 1115 | |
| 1116 | return retCode; |
| 1117 | } |
| 1118 | |
| 1119 | /* handle the response from HAL for an ADD STA request */ |
| 1120 | tSirRetStatus |
| 1121 | limIbssAddStaRsp( |
| 1122 | tpAniSirGlobal pMac, |
| 1123 | void *msg,tpPESession psessionEntry) |
| 1124 | { |
| 1125 | tpDphHashNode pStaDs; |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1126 | tANI_U16 peerIdx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1127 | tpAddStaParams pAddStaParams = (tpAddStaParams) msg; |
| 1128 | |
| 1129 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 1130 | if (pAddStaParams == NULL) |
| 1131 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1132 | PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP with no body!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1133 | return eSIR_FAILURE; |
| 1134 | } |
| 1135 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1136 | pStaDs = dphLookupHashEntry(pMac, pAddStaParams->staMac, &peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1137 | if (pStaDs == NULL) |
| 1138 | { |
| 1139 | PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP for unknown MAC addr "));) |
| 1140 | limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE); |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1141 | vos_mem_free(pAddStaParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1142 | return eSIR_FAILURE; |
| 1143 | } |
| 1144 | |
| 1145 | if (pAddStaParams->status != eHAL_STATUS_SUCCESS) |
| 1146 | { |
| 1147 | PELOGE(limLog(pMac, LOGE, FL("IBSS: ADD_STA_RSP error (%x) "), pAddStaParams->status);) |
| 1148 | limPrintMacAddr(pMac, pAddStaParams->staMac, LOGE); |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1149 | vos_mem_free(pAddStaParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1150 | return eSIR_FAILURE; |
| 1151 | } |
| 1152 | |
| 1153 | pStaDs->bssId = pAddStaParams->bssIdx; |
| 1154 | pStaDs->staIndex = pAddStaParams->staIdx; |
| 1155 | pStaDs->ucUcastSig = pAddStaParams->ucUcastSig; |
| 1156 | pStaDs->ucBcastSig = pAddStaParams->ucBcastSig; |
| 1157 | pStaDs->valid = 1; |
| 1158 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 1159 | |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1160 | PELOGW(limLog(pMac, LOGW, FL("IBSS: sending IBSS_NEW_PEER msg to SME!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1161 | |
| 1162 | ibss_status_chg_notify(pMac, pAddStaParams->staMac, pStaDs->staIndex, |
| 1163 | pStaDs->ucUcastSig, pStaDs->ucBcastSig, |
| 1164 | eWNI_SME_IBSS_NEW_PEER_IND, |
| 1165 | psessionEntry->smeSessionId); |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1166 | vos_mem_free(pAddStaParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1167 | |
| 1168 | return eSIR_SUCCESS; |
| 1169 | } |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | void limIbssDelBssRspWhenCoalescing(tpAniSirGlobal pMac, void *msg,tpPESession psessionEntry) |
| 1174 | { |
| 1175 | tpDeleteBssParams pDelBss = (tpDeleteBssParams) msg; |
| 1176 | |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1177 | PELOGW(limLog(pMac, LOGW, FL("IBSS: DEL_BSS_RSP Rcvd during coalescing!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1178 | |
| 1179 | if (pDelBss == NULL) |
| 1180 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1181 | PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP(coalesce) with no body!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1182 | goto end; |
| 1183 | } |
| 1184 | |
| 1185 | if (pDelBss->status != eHAL_STATUS_SUCCESS) |
| 1186 | { |
| 1187 | limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP(coalesce) error (%x) Bss %d "), |
| 1188 | pDelBss->status, pDelBss->bssIdx); |
| 1189 | goto end; |
| 1190 | } |
| 1191 | //Delete peer entries. |
| 1192 | limIbssDeleteAllPeers(pMac,psessionEntry); |
| 1193 | |
| 1194 | /* add the new bss */ |
| 1195 | ibss_bss_add(pMac,psessionEntry); |
| 1196 | |
| 1197 | end: |
| 1198 | if(pDelBss != NULL) |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1199 | vos_mem_free(pDelBss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1200 | } |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | void limIbssAddBssRspWhenCoalescing(tpAniSirGlobal pMac, void *msg, tpPESession pSessionEntry) |
| 1205 | { |
| 1206 | tANI_U8 infoLen; |
| 1207 | tSirSmeNewBssInfo newBssInfo; |
| 1208 | |
| 1209 | tpAddBssParams pAddBss = (tpAddBssParams) msg; |
| 1210 | |
| 1211 | tpSirMacMgmtHdr pHdr = (tpSirMacMgmtHdr) pMac->lim.ibssInfo.pHdr; |
| 1212 | tpSchBeaconStruct pBeacon = (tpSchBeaconStruct) pMac->lim.ibssInfo.pBeacon; |
| 1213 | |
| 1214 | if ((pHdr == NULL) || (pBeacon == NULL)) |
| 1215 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1216 | PELOGE(limLog(pMac, LOGE, FL("Unable to handle AddBssRspWhenCoalescing (no cached BSS info)"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1217 | goto end; |
| 1218 | } |
| 1219 | |
| 1220 | // Inform Host of IBSS coalescing |
| 1221 | infoLen = sizeof(tSirMacAddr) + sizeof(tSirMacChanNum) + |
| 1222 | sizeof(tANI_U8) + pBeacon->ssId.length + 1; |
| 1223 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1224 | vos_mem_set((void *) &newBssInfo, sizeof(newBssInfo), 0); |
| 1225 | vos_mem_copy(newBssInfo.bssId, pHdr->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1226 | newBssInfo.channelNumber = (tSirMacChanNum) pAddBss->currentOperChannel; |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1227 | vos_mem_copy((tANI_U8 *) &newBssInfo.ssId, |
| 1228 | (tANI_U8 *) &pBeacon->ssId, pBeacon->ssId.length + 1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1230 | PELOGW(limLog(pMac, LOGW, FL("Sending JOINED_NEW_BSS notification to SME."));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1231 | |
| 1232 | limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_JOINED_NEW_BSS, |
| 1233 | (tANI_U32 *) &newBssInfo, |
| 1234 | infoLen,pSessionEntry->smeSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | { |
| 1236 | //Configure beacon and send beacons to HAL |
| 1237 | limSendBeaconInd(pMac, pSessionEntry); |
| 1238 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 1240 | end: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1241 | ibss_coalesce_free(pMac); |
| 1242 | } |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 | void |
| 1247 | limIbssDelBssRsp( |
| 1248 | tpAniSirGlobal pMac, |
| 1249 | void *msg,tpPESession psessionEntry) |
| 1250 | { |
| 1251 | tSirResultCodes rc = eSIR_SME_SUCCESS; |
| 1252 | tpDeleteBssParams pDelBss = (tpDeleteBssParams) msg; |
| 1253 | tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 1254 | |
| 1255 | |
| 1256 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
| 1257 | if (pDelBss == NULL) |
| 1258 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1259 | PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP with no body!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1260 | rc = eSIR_SME_REFUSED; |
| 1261 | goto end; |
| 1262 | } |
| 1263 | |
| 1264 | if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL) |
| 1265 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1266 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1267 | goto end; |
| 1268 | } |
| 1269 | |
| 1270 | |
| 1271 | /* |
| 1272 | * If delBss was issued as part of IBSS Coalescing, gLimIbssCoalescingHappened flag will be true. |
| 1273 | * BSS has to be added again in this scenario, so this case needs to be handled separately. |
| 1274 | * If delBss was issued as a result of trigger from SME_STOP_BSS Request, then limSme state changes to |
| 1275 | * 'IDLE' and gLimIbssCoalescingHappened flag will be false. In this case STOP BSS RSP has to be sent to SME. |
| 1276 | */ |
| 1277 | if(true == pMac->lim.gLimIbssCoalescingHappened) |
| 1278 | { |
| 1279 | |
| 1280 | limIbssDelBssRspWhenCoalescing(pMac,msg,psessionEntry); |
| 1281 | return; |
| 1282 | } |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | if (pDelBss->status != eHAL_STATUS_SUCCESS) |
| 1287 | { |
| 1288 | PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP error (%x) Bss %d "), |
| 1289 | pDelBss->status, pDelBss->bssIdx);) |
| 1290 | rc = eSIR_SME_STOP_BSS_FAILURE; |
| 1291 | goto end; |
| 1292 | } |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid, |
| 1297 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
| 1298 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1299 | PELOGE(limLog(pMac, LOGE, FL("IBSS: DEL_BSS_RSP setLinkState failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | rc = eSIR_SME_REFUSED; |
| 1301 | goto end; |
| 1302 | } |
| 1303 | |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 1304 | limIbssDelete(pMac,psessionEntry); |
| 1305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1306 | dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable); |
| 1307 | limDeletePreAuthList(pMac); |
| 1308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1309 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 1310 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1311 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1312 | |
| 1313 | psessionEntry->limSystemRole = eLIM_STA_ROLE; |
| 1314 | |
| 1315 | /* Change the short slot operating mode to Default (which is 1 for now) so that when IBSS starts next time with Libra |
| 1316 | * as originator, it picks up the default. This enables us to remove hard coding of short slot = 1 from limApplyConfiguration |
| 1317 | */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1318 | psessionEntry->shortSlotTimeSupported = WNI_CFG_SHORT_SLOT_TIME_STADEF; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1319 | |
| 1320 | end: |
| 1321 | if(pDelBss != NULL) |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1322 | vos_mem_free(pDelBss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | /* Delete PE session once BSS is deleted */ |
| 1324 | if (NULL != psessionEntry) { |
| 1325 | limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc,psessionEntry->smeSessionId,psessionEntry->transactionId); |
| 1326 | peDeleteSession(pMac, psessionEntry); |
| 1327 | psessionEntry = NULL; |
| 1328 | } |
| 1329 | } |
| 1330 | |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1331 | static void |
| 1332 | __limIbssSearchAndDeletePeer(tpAniSirGlobal pMac, |
| 1333 | tpPESession psessionEntry, |
| 1334 | tSirMacAddr macAddr) |
| 1335 | { |
| 1336 | tLimIbssPeerNode *pTempNode, *pPrevNode; |
| 1337 | tLimIbssPeerNode *pTempNextNode = NULL; |
Ravi Joshi | 0fc681b | 2013-09-11 16:46:07 -0700 | [diff] [blame] | 1338 | tpDphHashNode pStaDs=NULL; |
| 1339 | tANI_U16 peerIdx=0; |
| 1340 | tANI_U16 staIndex=0; |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1341 | tANI_U8 ucUcastSig; |
| 1342 | tANI_U8 ucBcastSig; |
| 1343 | |
| 1344 | pPrevNode = pTempNode = pMac->lim.gLimIbssPeerList; |
| 1345 | |
| 1346 | limLog(pMac, LOG1, FL(" PEER ADDR :" MAC_ADDRESS_STR ),MAC_ADDR_ARRAY(macAddr)); |
| 1347 | |
| 1348 | /** Compare Peer */ |
| 1349 | while (NULL != pTempNode) |
| 1350 | { |
| 1351 | pTempNextNode = pTempNode->next; |
| 1352 | |
| 1353 | /* Delete the STA with MAC address */ |
Kiet Lam | 842c3e1 | 2013-11-16 22:40:57 +0530 | [diff] [blame] | 1354 | if (vos_mem_compare( (tANI_U8 *) macAddr, |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1355 | (tANI_U8 *) &pTempNode->peerMacAddr, |
| 1356 | sizeof(tSirMacAddr)) ) |
| 1357 | { |
| 1358 | pStaDs = dphLookupHashEntry(pMac, macAddr, |
| 1359 | &peerIdx, &psessionEntry->dph.dphHashTable); |
| 1360 | if (pStaDs) |
| 1361 | { |
| 1362 | staIndex = pStaDs->staIndex; |
| 1363 | ucUcastSig = pStaDs->ucUcastSig; |
| 1364 | ucBcastSig = pStaDs->ucBcastSig; |
| 1365 | |
| 1366 | (void) limDelSta(pMac, pStaDs, false /*asynchronous*/, psessionEntry); |
| 1367 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, peerIdx, psessionEntry); |
| 1368 | limReleasePeerIdx(pMac, peerIdx, psessionEntry); |
| 1369 | |
| 1370 | /* Send indication to upper layers */ |
| 1371 | ibss_status_chg_notify(pMac, macAddr, staIndex, |
| 1372 | ucUcastSig, ucBcastSig, |
| 1373 | eWNI_SME_IBSS_PEER_DEPARTED_IND, |
| 1374 | psessionEntry->smeSessionId ); |
| 1375 | if (pTempNode == pMac->lim.gLimIbssPeerList) |
| 1376 | { |
| 1377 | pMac->lim.gLimIbssPeerList = pTempNode->next; |
| 1378 | pPrevNode = pMac->lim.gLimIbssPeerList; |
| 1379 | } |
| 1380 | else |
| 1381 | pPrevNode->next = pTempNode->next; |
| 1382 | |
Kiet Lam | 842c3e1 | 2013-11-16 22:40:57 +0530 | [diff] [blame] | 1383 | vos_mem_free(pTempNode); |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1384 | pMac->lim.gLimNumIbssPeers--; |
| 1385 | |
| 1386 | pTempNode = pTempNextNode; |
| 1387 | break; |
| 1388 | } |
| 1389 | } |
| 1390 | pPrevNode = pTempNode; |
| 1391 | pTempNode = pTempNextNode; |
| 1392 | } |
krunal soni | a6c11e1 | 2013-10-17 04:43:42 -0700 | [diff] [blame] | 1393 | /* |
| 1394 | * if it is the last peer walking out, we better |
| 1395 | * we set IBSS state to inactive. |
| 1396 | */ |
| 1397 | if (0 == pMac->lim.gLimNumIbssPeers) |
| 1398 | { |
| 1399 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 1400 | "Last STA from IBSS walked out"); |
| 1401 | psessionEntry->limIbssActive = false; |
| 1402 | } |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1403 | } |
| 1404 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | /** |
| 1406 | * limIbssCoalesce() |
| 1407 | * |
| 1408 | *FUNCTION: |
| 1409 | * This function is called upon receiving Beacon/Probe Response |
| 1410 | * while operating in IBSS mode. |
| 1411 | * |
| 1412 | *LOGIC: |
| 1413 | * |
| 1414 | *ASSUMPTIONS: |
| 1415 | * |
| 1416 | *NOTE: |
| 1417 | * |
| 1418 | * @param pMac - Pointer to Global MAC structure |
| 1419 | * @param pBeacon - Parsed Beacon Frame structure |
| 1420 | * @param pBD - Pointer to received BD |
| 1421 | * |
| 1422 | * @return Status whether to process or ignore received Beacon Frame |
| 1423 | */ |
| 1424 | |
| 1425 | tSirRetStatus |
| 1426 | limIbssCoalesce( |
| 1427 | tpAniSirGlobal pMac, |
| 1428 | tpSirMacMgmtHdr pHdr, |
| 1429 | tpSchBeaconStruct pBeacon, |
| 1430 | tANI_U8 *pIEs, |
| 1431 | tANI_U32 ieLen, |
| 1432 | tANI_U16 fTsfLater, |
| 1433 | tpPESession psessionEntry) |
| 1434 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1435 | tANI_U16 peerIdx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1436 | tSirMacAddr currentBssId; |
| 1437 | tLimIbssPeerNode *pPeerNode; |
| 1438 | tpDphHashNode pStaDs; |
| 1439 | tUpdateBeaconParams beaconParams; |
| 1440 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1441 | vos_mem_set((tANI_U8 *)&beaconParams, sizeof(tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1442 | |
| 1443 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 1444 | |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1445 | limLog(pMac, LOG1, FL("Current BSSID :" MAC_ADDRESS_STR " Received BSSID :" MAC_ADDRESS_STR ), |
| 1446 | MAC_ADDR_ARRAY(currentBssId), MAC_ADDR_ARRAY(pHdr->bssId)); |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1447 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1448 | /* Check for IBSS Coalescing only if Beacon is from different BSS */ |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 1449 | if ( !vos_mem_compare(currentBssId, pHdr->bssId, sizeof( tSirMacAddr )) |
| 1450 | && psessionEntry->isCoalesingInIBSSAllowed) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1451 | { |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1452 | /* |
| 1453 | * If STA entry is already available in the LIM hash table, then it is |
| 1454 | * possible that the peer may have left and rejoined within the heartbeat |
| 1455 | * timeout. In the offloaded case with 32 peers, the HB timeout is whopping |
| 1456 | * 128 seconds. In that case, the FW will not let any frames come in until |
| 1457 | * atleast the last sequence number is received before the peer is left |
| 1458 | * Hence, if the coalescing peer is already there in the peer list and if |
| 1459 | * the BSSID matches then, invoke delSta() to cleanup the entries. We will |
| 1460 | * let the peer coalesce when we receive next beacon from the peer |
| 1461 | */ |
| 1462 | pPeerNode = ibss_peer_find(pMac, pHdr->sa); |
| 1463 | if (NULL != pPeerNode) |
| 1464 | { |
| 1465 | __limIbssSearchAndDeletePeer (pMac, psessionEntry, pHdr->sa); |
| 1466 | PELOGW(limLog(pMac, LOGW, |
| 1467 | FL("** Peer attempting to reconnect before HB timeout, deleted **"));) |
| 1468 | return eSIR_LIM_IGNORE_BEACON; |
| 1469 | } |
| 1470 | |
| 1471 | if (! fTsfLater) // No Coalescing happened. |
| 1472 | { |
| 1473 | PELOGW(limLog(pMac, LOGW, FL("No Coalescing happened"));) |
| 1474 | return eSIR_LIM_IGNORE_BEACON; |
| 1475 | } |
| 1476 | /* |
| 1477 | * IBSS Coalescing happened. |
| 1478 | * save the received beacon, and delete the current BSS. The rest of the |
| 1479 | * processing will be done in the delBss response processing |
| 1480 | */ |
| 1481 | pMac->lim.gLimIbssCoalescingHappened = true; |
| 1482 | PELOGW(limLog(pMac, LOGW, FL("IBSS Coalescing happened"));) |
| 1483 | ibss_coalesce_save(pMac, pHdr, pBeacon); |
| 1484 | limLog(pMac, LOGW, FL("Delete BSSID :" MAC_ADDRESS_STR ), |
| 1485 | MAC_ADDR_ARRAY(currentBssId)); |
| 1486 | ibss_bss_delete(pMac,psessionEntry); |
| 1487 | return eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1488 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 1489 | else |
| 1490 | { |
| 1491 | if (!vos_mem_compare(currentBssId, pHdr->bssId, sizeof( tSirMacAddr ))) |
| 1492 | return eSIR_LIM_IGNORE_BEACON; |
| 1493 | } |
| 1494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1495 | |
| 1496 | // STA in IBSS mode and SSID matches with ours |
| 1497 | pPeerNode = ibss_peer_find(pMac, pHdr->sa); |
| 1498 | if (pPeerNode == NULL) |
| 1499 | { |
| 1500 | /* Peer not in the list - Collect BSS description & add to the list */ |
| 1501 | tANI_U32 frameLen; |
| 1502 | tSirRetStatus retCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1503 | |
krunal soni | 3c28b10 | 2013-10-04 18:38:52 -0700 | [diff] [blame] | 1504 | /* |
| 1505 | * Limit the Max number of IBSS Peers allowed as the max |
| 1506 | * number of STA's allowed |
| 1507 | * pMac->lim.gLimNumIbssPeers will be increamented after exiting |
| 1508 | * this function. so we will add additional 1 to compare against |
| 1509 | * pMac->lim.gLimIbssStaLimit |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1510 | */ |
krunal soni | 3c28b10 | 2013-10-04 18:38:52 -0700 | [diff] [blame] | 1511 | if ((pMac->lim.gLimNumIbssPeers+1) >= pMac->lim.gLimIbssStaLimit) |
Ravi Joshi | 0fc681b | 2013-09-11 16:46:07 -0700 | [diff] [blame] | 1512 | { |
| 1513 | PELOGE(limLog(pMac, LOGE, FL("**** MAX STA LIMIT HAS REACHED ****"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1514 | return eSIR_LIM_MAX_STA_REACHED_ERROR; |
Ravi Joshi | 0fc681b | 2013-09-11 16:46:07 -0700 | [diff] [blame] | 1515 | } |
Ravi Joshi | 0fc681b | 2013-09-11 16:46:07 -0700 | [diff] [blame] | 1516 | PELOGW(limLog(pMac, LOGW, FL("IBSS Peer node does not exist, adding it***"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1517 | frameLen = sizeof(tLimIbssPeerNode) + ieLen - sizeof(tANI_U32); |
| 1518 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1519 | pPeerNode = vos_mem_malloc((tANI_U16)frameLen); |
| 1520 | if (NULL == pPeerNode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1521 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1522 | limLog(pMac, LOGP, FL("alloc fail (%d bytes) storing IBSS peer info"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1523 | frameLen); |
| 1524 | return eSIR_MEM_ALLOC_FAILED; |
| 1525 | } |
| 1526 | |
| 1527 | pPeerNode->beacon = NULL; |
| 1528 | pPeerNode->beaconLen = 0; |
| 1529 | |
| 1530 | ibss_peer_collect(pMac, pBeacon, pHdr, pPeerNode,psessionEntry); |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1531 | pPeerNode->beacon = vos_mem_malloc(ieLen); |
| 1532 | if (NULL == pPeerNode->beacon) |
| 1533 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1534 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store beacon"));) |
| 1535 | } |
| 1536 | else |
| 1537 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1538 | vos_mem_copy(pPeerNode->beacon, pIEs, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1539 | pPeerNode->beaconLen = (tANI_U16)ieLen; |
| 1540 | } |
| 1541 | ibss_peer_add(pMac, pPeerNode); |
| 1542 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1543 | pStaDs = dphLookupHashEntry(pMac, pPeerNode->peerMacAddr, &peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1544 | if (pStaDs != NULL) |
| 1545 | { |
| 1546 | /// DPH node already exists for the peer |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1547 | PELOGW(limLog(pMac, LOGW, FL("DPH Node present for just learned peer"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1548 | PELOG1(limPrintMacAddr(pMac, pPeerNode->peerMacAddr, LOG1);) |
| 1549 | ibss_sta_info_update(pMac, pStaDs, pPeerNode,psessionEntry); |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 1550 | return eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1551 | } |
| 1552 | retCode = limIbssStaAdd(pMac, pPeerNode->peerMacAddr,psessionEntry); |
| 1553 | if (retCode != eSIR_SUCCESS) |
| 1554 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1555 | PELOGE(limLog(pMac, LOGE, FL("lim-ibss-sta-add failed (reason %x)"), retCode);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1556 | limPrintMacAddr(pMac, pPeerNode->peerMacAddr, LOGE); |
| 1557 | return retCode; |
| 1558 | } |
| 1559 | |
| 1560 | // Decide protection mode |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1561 | pStaDs = dphLookupHashEntry(pMac, pPeerNode->peerMacAddr, &peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1562 | if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1563 | limIbssDecideProtection(pMac, pStaDs, &beaconParams, psessionEntry); |
| 1564 | |
| 1565 | if(beaconParams.paramChangeBitmap) |
| 1566 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1567 | PELOGE(limLog(pMac, LOGE, FL("beaconParams.paramChangeBitmap=1 ---> Update Beacon Params "));) |
Sunil Ravi | b96f7b5 | 2013-05-22 21:40:05 -0700 | [diff] [blame] | 1568 | schSetFixedBeaconFields(pMac, psessionEntry); |
| 1569 | beaconParams.bssIdx = psessionEntry->bssIdx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1570 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1571 | } |
| 1572 | } |
| 1573 | else |
| 1574 | ibss_sta_caps_update(pMac, pPeerNode,psessionEntry); |
| 1575 | |
| 1576 | if (psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) |
| 1577 | return eSIR_SUCCESS; |
| 1578 | |
| 1579 | // Received Beacon from same IBSS we're |
| 1580 | // currently part of. Inform Roaming algorithm |
| 1581 | // if not already that IBSS is active. |
| 1582 | if (psessionEntry->limIbssActive == false) |
| 1583 | { |
| 1584 | limResetHBPktCount(psessionEntry); |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1585 | PELOGW(limLog(pMac, LOGW, FL("Partner joined our IBSS, Sending IBSS_ACTIVE Notification to SME"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1586 | psessionEntry->limIbssActive = true; |
| 1587 | limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_IBSS_ACTIVE, NULL, 0, psessionEntry->smeSessionId); |
| 1588 | limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1589 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER)); |
Ravi Joshi | d2ca7c4 | 2013-07-23 08:37:49 -0700 | [diff] [blame] | 1590 | if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1591 | limLog(pMac, LOGP, FL("could not activate Heartbeat timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1592 | } |
| 1593 | |
| 1594 | return eSIR_SUCCESS; |
| 1595 | } /*** end limHandleIBSScoalescing() ***/ |
| 1596 | |
| 1597 | |
| 1598 | void limIbssHeartBeatHandle(tpAniSirGlobal pMac,tpPESession psessionEntry) |
| 1599 | { |
| 1600 | tLimIbssPeerNode *pTempNode, *pPrevNode; |
| 1601 | tLimIbssPeerNode *pTempNextNode = NULL; |
Ravi Joshi | 0fc681b | 2013-09-11 16:46:07 -0700 | [diff] [blame] | 1602 | tANI_U16 peerIdx=0; |
| 1603 | tpDphHashNode pStaDs=0; |
| 1604 | tANI_U32 threshold=0; |
| 1605 | tANI_U16 staIndex=0; |
| 1606 | tANI_U8 ucUcastSig=0; |
| 1607 | tANI_U8 ucBcastSig=0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1608 | |
| 1609 | /** MLM BSS is started and if PE in scanmode then MLM state will be waiting for probe resp. |
| 1610 | * If Heart beat timeout triggers during this corner case then we need to reactivate HeartBeat timer |
| 1611 | */ |
| 1612 | if(psessionEntry->limMlmState != eLIM_MLM_BSS_STARTED_STATE) { |
| 1613 | /****** |
| 1614 | * Note: Use this code once you have converted all |
| 1615 | * limReactivateHeartBeatTimer() calls to |
| 1616 | * limReactivateTimer() calls. |
| 1617 | * |
| 1618 | ******/ |
| 1619 | //limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER, psessionEntry); |
| 1620 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
| 1621 | return; |
| 1622 | } |
| 1623 | /** If LinkMonitor is Disabled */ |
| 1624 | if(!pMac->sys.gSysEnableLinkMonitorMode) |
| 1625 | return; |
| 1626 | |
| 1627 | pPrevNode = pTempNode = pMac->lim.gLimIbssPeerList; |
| 1628 | threshold = (pMac->lim.gLimNumIbssPeers / 4 ) + 1; |
| 1629 | |
| 1630 | /** Monitor the HeartBeat with the Individual PEERS in the IBSS */ |
| 1631 | while (pTempNode != NULL) |
| 1632 | { |
| 1633 | pTempNextNode = pTempNode->next; |
| 1634 | if(pTempNode->beaconHBCount) //There was a beacon for this peer during heart beat. |
| 1635 | { |
| 1636 | pTempNode->beaconHBCount = 0; |
| 1637 | pTempNode->heartbeatFailure = 0; |
| 1638 | } |
| 1639 | else //There wasnt any beacon received during heartbeat timer. |
| 1640 | { |
| 1641 | pTempNode->heartbeatFailure++; |
| 1642 | PELOGE(limLog(pMac, LOGE, FL("Heartbeat fail = %d thres = %d"), pTempNode->heartbeatFailure, pMac->lim.gLimNumIbssPeers);) |
| 1643 | if(pTempNode->heartbeatFailure >= threshold ) |
| 1644 | { |
| 1645 | //Remove this entry from the list. |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1646 | pStaDs = dphLookupHashEntry(pMac, pTempNode->peerMacAddr, &peerIdx, &psessionEntry->dph.dphHashTable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1647 | if (pStaDs) |
| 1648 | { |
| 1649 | staIndex = pStaDs->staIndex; |
| 1650 | ucUcastSig = pStaDs->ucUcastSig; |
| 1651 | ucBcastSig = pStaDs->ucBcastSig; |
| 1652 | |
| 1653 | (void) limDelSta(pMac, pStaDs, false /*asynchronous*/,psessionEntry); |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 1654 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, peerIdx,psessionEntry); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1655 | limReleasePeerIdx(pMac, peerIdx, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1656 | //Send indication. |
| 1657 | ibss_status_chg_notify( pMac, pTempNode->peerMacAddr, staIndex, |
| 1658 | ucUcastSig, ucBcastSig, |
| 1659 | eWNI_SME_IBSS_PEER_DEPARTED_IND, |
| 1660 | psessionEntry->smeSessionId ); |
| 1661 | } |
| 1662 | if(pTempNode == pMac->lim.gLimIbssPeerList) |
| 1663 | { |
| 1664 | pMac->lim.gLimIbssPeerList = pTempNode->next; |
| 1665 | pPrevNode = pMac->lim.gLimIbssPeerList; |
| 1666 | } |
| 1667 | else |
| 1668 | pPrevNode->next = pTempNode->next; |
| 1669 | |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1670 | vos_mem_free(pTempNode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1671 | pMac->lim.gLimNumIbssPeers--; |
| 1672 | |
| 1673 | pTempNode = pTempNextNode; //Since we deleted current node, prevNode remains same. |
| 1674 | continue; |
| 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | pPrevNode = pTempNode; |
| 1679 | pTempNode = pTempNextNode; |
| 1680 | } |
| 1681 | |
| 1682 | /** General IBSS Activity Monitor, check if in IBSS Mode we are received any Beacons */ |
| 1683 | if(pMac->lim.gLimNumIbssPeers) |
| 1684 | { |
| 1685 | if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL) |
| 1686 | pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++; |
| 1687 | else |
| 1688 | pMac->lim.gLimHeartBeatBeaconStats[0]++; |
| 1689 | |
| 1690 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
| 1691 | |
| 1692 | // Reset number of beacons received |
| 1693 | limResetHBPktCount(psessionEntry); |
| 1694 | return; |
| 1695 | } |
| 1696 | else |
| 1697 | { |
| 1698 | |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1699 | PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1700 | pMac->lim.gLimHBfailureCntInLinkEstState++; |
| 1701 | |
| 1702 | if (psessionEntry->limIbssActive == true) |
| 1703 | { |
| 1704 | // We don't receive Beacon frames from any |
| 1705 | // other STA in IBSS. Announce IBSS inactive |
| 1706 | // to Roaming algorithm |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1707 | PELOGW(limLog(pMac, LOGW, FL("Alone in IBSS"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1708 | psessionEntry->limIbssActive = false; |
| 1709 | |
| 1710 | limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_IBSS_INACTIVE, |
| 1711 | NULL, 0, psessionEntry->smeSessionId); |
| 1712 | } |
| 1713 | } |
| 1714 | } |
| 1715 | |
| 1716 | |
| 1717 | /** ------------------------------------------------------------- |
| 1718 | \fn limIbssDecideProtectionOnDelete |
| 1719 | \brief Decides all the protection related information. |
| 1720 | \ |
| 1721 | \param tpAniSirGlobal pMac |
| 1722 | \param tSirMacAddr peerMacAddr |
| 1723 | \param tpUpdateBeaconParams pBeaconParams |
| 1724 | \return None |
| 1725 | -------------------------------------------------------------*/ |
| 1726 | void |
| 1727 | limIbssDecideProtectionOnDelete(tpAniSirGlobal pMac, |
| 1728 | tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry) |
| 1729 | { |
| 1730 | tANI_U32 phyMode; |
| 1731 | tHalBitVal erpEnabled = eHAL_CLEAR; |
| 1732 | tSirRFBand rfBand = SIR_BAND_UNKNOWN; |
| 1733 | tANI_U32 i; |
| 1734 | |
| 1735 | if(NULL == pStaDs) |
| 1736 | return; |
| 1737 | |
| 1738 | limGetRfBand(pMac, &rfBand, psessionEntry); |
| 1739 | if(SIR_BAND_2_4_GHZ == rfBand) |
| 1740 | { |
| 1741 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1742 | erpEnabled = pStaDs->erpEnabled; |
| 1743 | //we are HT or 11G and 11B station is getting deleted. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1744 | if ( ((phyMode == WNI_CFG_PHY_MODE_11G) || psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1745 | && (erpEnabled == eHAL_CLEAR)) |
| 1746 | { |
| 1747 | PELOGE(limLog(pMac, LOGE, FL("(%d) A legacy STA is disassociated. Addr is "), |
| 1748 | psessionEntry->gLim11bParams.numSta); |
| 1749 | limPrintMacAddr(pMac, pStaDs->staAddr, LOGE);) |
| 1750 | if (psessionEntry->gLim11bParams.numSta > 0) |
| 1751 | { |
| 1752 | for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++) |
| 1753 | { |
| 1754 | if (pMac->lim.protStaCache[i].active) |
| 1755 | { |
Bansidhar Gopalachari | 3999e2e | 2013-07-12 10:57:01 +0530 | [diff] [blame] | 1756 | if (vos_mem_compare(pMac->lim.protStaCache[i].addr, |
| 1757 | pStaDs->staAddr, sizeof(tSirMacAddr))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1758 | { |
| 1759 | psessionEntry->gLim11bParams.numSta--; |
| 1760 | pMac->lim.protStaCache[i].active = false; |
| 1761 | break; |
| 1762 | } |
| 1763 | } |
| 1764 | } |
| 1765 | } |
| 1766 | |
| 1767 | if (psessionEntry->gLim11bParams.numSta == 0) |
| 1768 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1769 | PELOGE(limLog(pMac, LOGE, FL("No more 11B STA exists. Disable protection. "));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1770 | limIbssSetProtection(pMac, false, pBeaconParams,psessionEntry); |
| 1771 | } |
| 1772 | } |
| 1773 | } |
| 1774 | } |
Ravi Joshi | d2ca7c4 | 2013-07-23 08:37:49 -0700 | [diff] [blame] | 1775 | |
| 1776 | /** ----------------------------------------------------------------- |
| 1777 | \fn __limIbssPeerInactivityHandler |
| 1778 | \brief Internal function. Deletes FW indicated peer which is inactive |
| 1779 | \ |
| 1780 | \param tpAniSirGlobal pMac |
| 1781 | \param tpPESession psessionEntry |
| 1782 | \param tpSirIbssPeerInactivityInd peerInactivityInd |
| 1783 | \return None |
| 1784 | -----------------------------------------------------------------*/ |
| 1785 | static void |
| 1786 | __limIbssPeerInactivityHandler(tpAniSirGlobal pMac, |
| 1787 | tpPESession psessionEntry, |
| 1788 | tpSirIbssPeerInactivityInd peerInactivityInd) |
| 1789 | { |
Ravi Joshi | d2ca7c4 | 2013-07-23 08:37:49 -0700 | [diff] [blame] | 1790 | if(psessionEntry->limMlmState != eLIM_MLM_BSS_STARTED_STATE) |
| 1791 | { |
| 1792 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
| 1793 | return; |
| 1794 | } |
| 1795 | |
Ravi Joshi | 92404a3 | 2013-08-13 15:40:30 -0700 | [diff] [blame] | 1796 | /* delete the peer for which heartbeat is observed */ |
| 1797 | __limIbssSearchAndDeletePeer (pMac, psessionEntry, peerInactivityInd->peerAddr); |
Ravi Joshi | d2ca7c4 | 2013-07-23 08:37:49 -0700 | [diff] [blame] | 1798 | |
Ravi Joshi | d2ca7c4 | 2013-07-23 08:37:49 -0700 | [diff] [blame] | 1799 | } |
| 1800 | |
Ravi Joshi | d2ca7c4 | 2013-07-23 08:37:49 -0700 | [diff] [blame] | 1801 | /** ------------------------------------------------------------- |
| 1802 | \fn limProcessIbssPeerInactivity |
| 1803 | \brief Peer inactivity message handler |
| 1804 | \ |
| 1805 | \param tpAniSirGlobal pMac |
| 1806 | \param void* buf |
| 1807 | \return None |
| 1808 | -------------------------------------------------------------*/ |
| 1809 | void |
| 1810 | limProcessIbssPeerInactivity(tpAniSirGlobal pMac, void *buf) |
| 1811 | { |
| 1812 | /* |
| 1813 | * --------------- HEARTBEAT OFFLOAD CASE ------------------ |
| 1814 | * This message handler is executed when the firmware identifies |
| 1815 | * inactivity from one or more peer devices. We will come here |
| 1816 | * for every inactive peer device |
| 1817 | */ |
| 1818 | tANI_U8 i; |
| 1819 | |
| 1820 | tSirIbssPeerInactivityInd *peerInactivityInd = |
| 1821 | (tSirIbssPeerInactivityInd *) buf; |
| 1822 | |
| 1823 | /* |
| 1824 | * If IBSS is not started or heartbeat offload is not enabled |
| 1825 | * we should not handle this request |
| 1826 | */ |
| 1827 | if (eLIM_STA_IN_IBSS_ROLE != pMac->lim.gLimSystemRole && |
| 1828 | !IS_IBSS_HEARTBEAT_OFFLOAD_FEATURE_ENABLE) |
| 1829 | { |
| 1830 | return; |
| 1831 | } |
| 1832 | |
| 1833 | /** If LinkMonitor is Disabled */ |
| 1834 | if (!pMac->sys.gSysEnableLinkMonitorMode) |
| 1835 | { |
| 1836 | return; |
| 1837 | } |
| 1838 | |
| 1839 | for (i = 0; i < pMac->lim.maxBssId; i++) |
| 1840 | { |
| 1841 | if (VOS_TRUE == pMac->lim.gpSession[i].valid && |
| 1842 | eSIR_IBSS_MODE == pMac->lim.gpSession[i].bssType) |
| 1843 | { |
| 1844 | __limIbssPeerInactivityHandler(pMac, |
| 1845 | &pMac->lim.gpSession[i], |
| 1846 | peerInactivityInd); |
| 1847 | break; |
| 1848 | } |
| 1849 | } |
| 1850 | } |
| 1851 | |