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