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