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