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