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