Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 0c1331e | 2013-01-07 22:49:07 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 21 | /* |
| 22 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 41 | |
| 42 | /*=========================================================================== |
| 43 | |
| 44 | limProcessTdls.c |
| 45 | |
| 46 | OVERVIEW: |
| 47 | |
| 48 | DEPENDENCIES: |
| 49 | |
| 50 | Are listed for each API below. |
| 51 | |
Gopichand Nakkala | bd9fa2d | 2013-01-08 13:16:22 -0800 | [diff] [blame] | 52 | |
| 53 | Copyright (c) 2010 QUALCOMM Incorporated. |
| 54 | All Rights Reserved. |
| 55 | Qualcomm Confidential and Proprietary |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 56 | ===========================================================================*/ |
| 57 | |
| 58 | /*=========================================================================== |
| 59 | |
| 60 | EDIT HISTORY FOR FILE |
| 61 | |
| 62 | |
| 63 | This section contains comments describing changes made to the module. |
| 64 | Notice that changes are listed in reverse chronological order. |
| 65 | |
| 66 | |
| 67 | $Header$$DateTime$$Author$ |
| 68 | |
| 69 | |
| 70 | when who what, where, why |
| 71 | ---------- --- -------------------------------------------------------- |
| 72 | 05/05/2010 Ashwani Initial Creation, added TDLS action frame functionality, |
| 73 | TDLS message exchange with SME..etc.. |
| 74 | |
| 75 | ===========================================================================*/ |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * \file limProcessTdls.c |
| 80 | * |
| 81 | * \brief Code for preparing,processing and sending 802.11z action frames |
| 82 | * |
| 83 | */ |
| 84 | |
| 85 | #ifdef FEATURE_WLAN_TDLS |
| 86 | |
| 87 | #include "sirApi.h" |
| 88 | #include "aniGlobal.h" |
| 89 | #include "sirMacProtDef.h" |
| 90 | #include "cfgApi.h" |
| 91 | #include "utilsApi.h" |
| 92 | #include "limTypes.h" |
| 93 | #include "limUtils.h" |
| 94 | #include "limSecurityUtils.h" |
| 95 | #include "dot11f.h" |
| 96 | #include "limStaHashApi.h" |
| 97 | #include "schApi.h" |
| 98 | #include "limSendMessages.h" |
| 99 | #include "utilsParser.h" |
| 100 | #include "limAssocUtils.h" |
| 101 | #include "dphHashTable.h" |
| 102 | #include "wlan_qct_wda.h" |
| 103 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 104 | /* define NO_PAD_TDLS_MIN_8023_SIZE to NOT padding: See CR#447630 |
| 105 | There was IOT issue with cisco 1252 open mode, where it pads |
| 106 | discovery req/teardown frame with some junk value up to min size. |
| 107 | To avoid this issue, we pad QCOM_VENDOR_IE. |
| 108 | If there is other IOT issue because of this bandage, define NO_PAD... |
| 109 | */ |
| 110 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 111 | #define MIN_IEEE_8023_SIZE 46 |
| 112 | #define MIN_VENDOR_SPECIFIC_IE_SIZE 5 |
| 113 | #endif |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 114 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 115 | #define TDLS_DEBUG_LOG_LEVEL VOS_TRACE_LEVEL_ERROR |
| 116 | #else |
| 117 | #define TDLS_DEBUG_LOG_LEVEL VOS_TRACE_LEVEL_INFO |
| 118 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 119 | |
| 120 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 121 | /* forword declarations */ |
| 122 | static tSirRetStatus limTdlsDisAddSta(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
| 123 | tSirTdlsPeerInfo *peerInfo, tpPESession psessionEntry) ; |
| 124 | static eHalStatus limSendSmeTdlsLinkSetupInd(tpAniSirGlobal pMac, |
| 125 | tSirMacAddr peerMac, tANI_U8 status); |
| 126 | static eHalStatus limSendSmeTdlsDelPeerInd(tpAniSirGlobal pMac, |
| 127 | tANI_U8 sessionId, tDphHashNode *pStaDs, tANI_U8 status) ; |
| 128 | static tSirTdlsPeerInfo *limTdlsFindDisPeerByState(tpAniSirGlobal pMac, |
| 129 | tANI_U8 state); |
| 130 | static tANI_U8 limTdlsFindSetupPeerByState(tpAniSirGlobal pMac, tANI_U8 state, |
| 131 | tLimTdlsLinkSetupPeer **setupPeer) ; |
| 132 | static tSirRetStatus limTdlsLinkEstablish(tpAniSirGlobal pMac, tSirMacAddr peer_mac); |
| 133 | |
| 134 | static tSirRetStatus limTdlsLinkTeardown(tpAniSirGlobal pMac, tSirMacAddr peer_mac); |
| 135 | static tpDphHashNode limTdlsDelSta(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
| 136 | tpPESession psessionEntry) ; |
| 137 | |
| 138 | #endif |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 139 | static tSirRetStatus limTdlsSetupAddSta(tpAniSirGlobal pMac, |
| 140 | tSirTdlsAddStaReq *pAddStaReq, |
| 141 | tpPESession psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 142 | void PopulateDot11fLinkIden(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 143 | tDot11fIELinkIdentifier *linkIden, |
| 144 | tSirMacAddr peerMac , tANI_U8 reqType) ; |
| 145 | void PopulateDot11fTdlsExtCapability(tpAniSirGlobal pMac, |
| 146 | tDot11fIEExtCap *extCapability) ; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 147 | |
| 148 | void limLogVHTCap(tpAniSirGlobal pMac, |
| 149 | tDot11fIEVHTCaps *pDot11f); |
| 150 | tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac, |
| 151 | tpSirSupportedRates pRates, |
| 152 | tDot11fIEVHTCaps *pPeerVHTCaps, |
| 153 | tpPESession psessionEntry); |
| 154 | ePhyChanBondState limGetHTCBState(ePhyChanBondState aniCBMode); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 155 | /* |
| 156 | * TDLS data frames will go out/come in as non-qos data. |
| 157 | * so, eth_890d_header will be aligned access.. |
| 158 | */ |
| 159 | static const tANI_U8 eth_890d_header[] = |
| 160 | { |
| 161 | 0xaa, 0xaa, 0x03, 0x00, |
| 162 | 0x00, 0x00, 0x89, 0x0d, |
| 163 | } ; |
| 164 | |
| 165 | /* |
| 166 | * type of links used in TDLS |
| 167 | */ |
| 168 | enum tdlsLinks |
| 169 | { |
| 170 | TDLS_LINK_AP, |
| 171 | TDLS_LINK_DIRECT |
| 172 | } eTdlsLink ; |
| 173 | |
| 174 | /* |
| 175 | * node status in node searching |
| 176 | */ |
| 177 | enum tdlsLinkNodeStatus |
| 178 | { |
| 179 | TDLS_NODE_NOT_FOUND, |
| 180 | TDLS_NODE_FOUND |
| 181 | } eTdlsLinkNodeStatus ; |
| 182 | |
| 183 | |
| 184 | enum tdlsReqType |
| 185 | { |
| 186 | TDLS_INITIATOR, |
| 187 | TDLS_RESPONDER |
| 188 | } eTdlsReqType ; |
| 189 | |
| 190 | typedef enum tdlsLinkSetupStatus |
| 191 | { |
| 192 | TDLS_SETUP_STATUS_SUCCESS = 0, |
| 193 | TDLS_SETUP_STATUS_FAILURE = 37 |
| 194 | }etdlsLinkSetupStatus ; |
| 195 | |
| 196 | /* some local defines */ |
| 197 | #define LINK_IDEN_BSSID_OFFSET (0) |
| 198 | #define PEER_MAC_OFFSET (12) |
| 199 | #define STA_MAC_OFFSET (6) |
| 200 | #define LINK_IDEN_ELE_ID (101) |
| 201 | //#define LINK_IDEN_LENGTH (18) |
| 202 | #define LINK_IDEN_ADDR_OFFSET(x) (&x.LinkIdentifier) |
| 203 | #define PTI_LINK_IDEN_OFFSET (5) |
| 204 | #define PTI_BUF_STATUS_OFFSET (25) |
| 205 | |
| 206 | /* TODO, Move this parameters to configuration */ |
| 207 | #define PEER_PSM_SUPPORT (0) |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame^] | 208 | #define PEER_BUFFER_STA_SUPPORT (0) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 209 | #define CH_SWITCH_SUPPORT (0) |
| 210 | #define TDLS_SUPPORT (1) |
| 211 | #define TDLS_PROHIBITED (0) |
| 212 | #define TDLS_CH_SWITCH_PROHIBITED (1) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 213 | /** @brief Set bit manipulation macro */ |
| 214 | #define SET_BIT(value,mask) ((value) |= (1 << (mask))) |
| 215 | /** @brief Clear bit manipulation macro */ |
| 216 | #define CLEAR_BIT(value,mask) ((value) &= ~(1 << (mask))) |
| 217 | /** @brief Check bit manipulation macro */ |
| 218 | #define CHECK_BIT(value, mask) ((value) & (1 << (mask))) |
| 219 | |
| 220 | #define SET_PEER_AID_BITMAP(peer_bitmap, aid) \ |
| 221 | if ((aid) < (sizeof(tANI_U32) << 3)) \ |
| 222 | SET_BIT(peer_bitmap[0], (aid)); \ |
| 223 | else if ((aid) < (sizeof(tANI_U32) << 4)) \ |
| 224 | SET_BIT(peer_bitmap[1], ((aid) - (sizeof(tANI_U32) << 3))); |
| 225 | |
| 226 | #define CLEAR_PEER_AID_BITMAP(peer_bitmap, aid) \ |
| 227 | if ((aid) < (sizeof(tANI_U32) << 3)) \ |
| 228 | CLEAR_BIT(peer_bitmap[0], (aid)); \ |
| 229 | else if ((aid) < (sizeof(tANI_U32) << 4)) \ |
| 230 | CLEAR_BIT(peer_bitmap[1], ((aid) - (sizeof(tANI_U32) << 3))); |
| 231 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 232 | |
| 233 | #ifdef LIM_DEBUG_TDLS |
| 234 | #define TDLS_CASE_RETURN_STRING(x) case (x): return( ((const tANI_U8*)#x) + 8); /* 8 = remove redundant SIR_MAC_ */ |
| 235 | |
| 236 | #ifdef FEATURE_WLAN_TDLS |
| 237 | #define WNI_CFG_TDLS_DISCOVERY_RSP_WAIT (100) |
| 238 | #define WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT (800) |
| 239 | #define WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT (200) |
| 240 | #endif |
| 241 | |
| 242 | const tANI_U8* limTraceTdlsActionString( tANI_U8 tdlsActionCode ) |
| 243 | { |
| 244 | switch( tdlsActionCode ) |
| 245 | { |
| 246 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_SETUP_REQ); |
| 247 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_SETUP_RSP); |
| 248 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_SETUP_CNF); |
| 249 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_TEARDOWN); |
| 250 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_PEER_TRAFFIC_IND); |
| 251 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_CH_SWITCH_REQ); |
| 252 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_CH_SWITCH_RSP); |
| 253 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_PEER_TRAFFIC_RSP); |
| 254 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_DIS_REQ); |
| 255 | TDLS_CASE_RETURN_STRING(SIR_MAC_TDLS_DIS_RSP); |
| 256 | } |
| 257 | return (const tANI_U8*)"UNKNOWN"; |
| 258 | } |
| 259 | #endif |
| 260 | #if 0 |
| 261 | static void printMacAddr(tSirMacAddr macAddr) |
| 262 | { |
| 263 | int i = 0 ; |
| 264 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, (" Mac Addr: ")); |
| 265 | |
| 266 | for(i = 0 ; i < 6; i++) |
| 267 | { |
| 268 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 269 | (" %02x "), macAddr[i]); |
| 270 | } |
| 271 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("\n")); |
| 272 | return ; |
| 273 | } |
| 274 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 275 | /* |
| 276 | * initialize TDLS setup list and related data structures. |
| 277 | */ |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 278 | void limInitTdlsData(tpAniSirGlobal pMac, tpPESession pSessionEntry) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 279 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 280 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 281 | pMac->lim.gLimTdlsDisResultList = NULL ; |
| 282 | pMac->lim.gLimTdlsDisStaCount = 0 ; |
| 283 | palZeroMemory(pMac->hHdd, &pMac->lim.gLimTdlsDisReq, |
| 284 | sizeof(tSirTdlsDisReq)); |
| 285 | palZeroMemory(pMac->hHdd, &pMac->lim.gLimTdlsLinkSetupInfo, |
| 286 | sizeof(tLimTdlsLinkSetupInfo)); |
| 287 | pMac->lim.gAddStaDisRspWait = 0 ; |
| 288 | |
| 289 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 290 | /* when reassociated, negative behavior will not be kept */ |
| 291 | /* you have to explicitly enable negative behavior per (re)association */ |
| 292 | pMac->lim.gLimTdlsNegativeBehavior = 0; |
| 293 | #endif |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 294 | #endif |
| 295 | limInitPeerIdxpool(pMac, pSessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 296 | |
| 297 | return ; |
| 298 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 299 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 300 | void limTdlsSetNegativeBehavior(tpAniSirGlobal pMac, tANI_U8 value, tANI_BOOLEAN on) |
| 301 | { |
| 302 | if(on) { |
| 303 | if(value == 255) |
| 304 | pMac->lim.gLimTdlsNegativeBehavior = 0XFFFFFFFF; |
| 305 | else |
| 306 | pMac->lim.gLimTdlsNegativeBehavior |= (1 << (value-1)); |
| 307 | } |
| 308 | else { |
| 309 | if(value == 255) |
| 310 | pMac->lim.gLimTdlsNegativeBehavior = 0; |
| 311 | else |
| 312 | pMac->lim.gLimTdlsNegativeBehavior &= ~(1 << (value-1)); |
| 313 | } |
| 314 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,("%d %d -> gLimTdlsNegativeBehavior= 0x%lx\n"), \ |
| 315 | value, on, pMac->lim.gLimTdlsNegativeBehavior)); |
| 316 | } |
| 317 | #endif |
| 318 | #if 0 |
| 319 | /* |
| 320 | * This function is used for creating TDLS public Action frame to |
| 321 | * transmit on Direct link |
| 322 | */ |
| 323 | static void limPreparesActionFrameHdr(tpAniSirGlobal pMac, tANI_U8 *pFrame, |
| 324 | tANI_U8 type, tANI_U8 subType, |
| 325 | tANI_U8 *link_iden ) |
| 326 | { |
| 327 | tpSirMacMgmtHdr pMacHdr ; |
| 328 | tANI_U8 *bssid = link_iden ; |
| 329 | #if 0 |
| 330 | tANI_U8 *staMac = (tANI_U8 *)(bssid + sizeof(tSirMacAddr)) ; |
| 331 | tANI_U8 *peerMac = (tANI_U8 *) (staMac + sizeof(tSirMacAddr)) ; |
| 332 | #else |
| 333 | tANI_U8 *peerMac = (tANI_U8 *) (bssid + sizeof(tSirMacAddr)) ; |
| 334 | tANI_U8 *staMac = (tANI_U8 *)(peerMac + sizeof(tSirMacAddr)) ; |
| 335 | #endif |
| 336 | tANI_U8 toDs = ANI_TXDIR_IBSS ; |
| 337 | |
| 338 | pMacHdr = (tpSirMacMgmtHdr) (pFrame); |
| 339 | |
| 340 | /* |
| 341 | * prepare 802.11 header |
| 342 | */ |
| 343 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 344 | pMacHdr->fc.type = type ; |
| 345 | pMacHdr->fc.subType = subType ; |
| 346 | /* |
| 347 | * TL is not setting up below fields, so we are doing it here |
| 348 | */ |
| 349 | pMacHdr->fc.toDS = toDs ; |
| 350 | pMacHdr->fc.powerMgmt = 0 ; |
| 351 | |
| 352 | |
| 353 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pMacHdr->da, peerMac, |
| 354 | sizeof( tSirMacAddr )); |
| 355 | palCopyMemory( pMac->hHdd, |
| 356 | (tANI_U8 *) pMacHdr->sa, |
| 357 | staMac, sizeof( tSirMacAddr )); |
| 358 | |
| 359 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pMacHdr->bssId, |
| 360 | bssid, sizeof( tSirMacAddr )); |
| 361 | |
| 362 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN, ("Preparing TDLS action frame\n%02x:%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x:%02x\n"), \ |
| 363 | pMacHdr->da[0], pMacHdr->da[1], pMacHdr->da[2], pMacHdr->da[3], pMacHdr->da[4], pMacHdr->da[5], \ |
| 364 | pMacHdr->sa[0], pMacHdr->sa[1], pMacHdr->sa[2], pMacHdr->sa[3], pMacHdr->sa[4], pMacHdr->sa[5], \ |
| 365 | pMacHdr->bssId[0], pMacHdr->bssId[1], pMacHdr->bssId[2], \ |
| 366 | pMacHdr->bssId[3], pMacHdr->bssId[4], pMacHdr->bssId[5])); |
| 367 | |
| 368 | return ; |
| 369 | } |
| 370 | #endif |
| 371 | /* |
| 372 | * prepare TDLS frame header, it includes |
| 373 | * | | | | |
| 374 | * |802.11 header|RFC1042 header|TDLS_PYLOAD_TYPE|PAYLOAD |
| 375 | * | | | | |
| 376 | */ |
| 377 | static tANI_U32 limPrepareTdlsFrameHeader(tpAniSirGlobal pMac, tANI_U8* pFrame, |
| 378 | tDot11fIELinkIdentifier *link_iden, tANI_U8 tdlsLinkType, tANI_U8 reqType, tpPESession psessionEntry ) |
| 379 | { |
| 380 | tpSirMacMgmtHdr pMacHdr ; |
| 381 | tANI_U32 header_offset = 0 ; |
| 382 | tANI_U8 *addr1 = NULL ; |
| 383 | tANI_U8 *addr3 = NULL ; |
| 384 | tANI_U8 toDs = (tdlsLinkType == TDLS_LINK_AP) |
| 385 | ? ANI_TXDIR_TODS :ANI_TXDIR_IBSS ; |
| 386 | tANI_U8 *peerMac = (reqType == TDLS_INITIATOR) |
| 387 | ? link_iden->RespStaAddr : link_iden->InitStaAddr; |
| 388 | tANI_U8 *staMac = (reqType == TDLS_INITIATOR) |
| 389 | ? link_iden->InitStaAddr : link_iden->RespStaAddr; |
| 390 | |
| 391 | pMacHdr = (tpSirMacMgmtHdr) (pFrame); |
| 392 | |
| 393 | /* |
| 394 | * if TDLS frame goes through the AP link, it follows normal address |
| 395 | * pattern, if TDLS frame goes thorugh the direct link, then |
| 396 | * A1--> Peer STA addr, A2-->Self STA address, A3--> BSSID |
| 397 | */ |
| 398 | (tdlsLinkType == TDLS_LINK_AP) ? ((addr1 = (link_iden->bssid)), |
| 399 | (addr3 = (peerMac))) |
| 400 | : ((addr1 = (peerMac)), |
| 401 | (addr3 = (link_iden->bssid))) ; |
| 402 | /* |
| 403 | * prepare 802.11 header |
| 404 | */ |
| 405 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 406 | pMacHdr->fc.type = SIR_MAC_DATA_FRAME ; |
| 407 | pMacHdr->fc.subType = SIR_MAC_DATA_DATA ; |
| 408 | /* |
| 409 | * TL is not setting up below fields, so we are doing it here |
| 410 | */ |
| 411 | pMacHdr->fc.toDS = toDs ; |
| 412 | pMacHdr->fc.powerMgmt = 0 ; |
| 413 | pMacHdr->fc.wep = (psessionEntry->encryptType == eSIR_ED_NONE)? 0 : 1; |
| 414 | |
| 415 | |
| 416 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pMacHdr->da, (tANI_U8 *)addr1, |
| 417 | sizeof( tSirMacAddr )); |
| 418 | palCopyMemory( pMac->hHdd, |
| 419 | (tANI_U8 *) pMacHdr->sa, |
| 420 | (tANI_U8 *) staMac, |
| 421 | sizeof( tSirMacAddr )); |
| 422 | |
| 423 | palCopyMemory( pMac->hHdd, (tANI_U8 *) pMacHdr->bssId, |
| 424 | (tANI_U8 *) (addr3), sizeof( tSirMacAddr )); |
| 425 | |
| 426 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN, ("Preparing TDLS frame header to %s\n%02x:%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x:%02x\n"), \ |
| 427 | (tdlsLinkType == TDLS_LINK_AP) ? "AP" : "TD", \ |
| 428 | pMacHdr->da[0], pMacHdr->da[1], pMacHdr->da[2], pMacHdr->da[3], pMacHdr->da[4], pMacHdr->da[5], \ |
| 429 | pMacHdr->sa[0], pMacHdr->sa[1], pMacHdr->sa[2], pMacHdr->sa[3], pMacHdr->sa[4], pMacHdr->sa[5], \ |
| 430 | pMacHdr->bssId[0], pMacHdr->bssId[1], pMacHdr->bssId[2], \ |
| 431 | pMacHdr->bssId[3], pMacHdr->bssId[4], pMacHdr->bssId[5])); |
| 432 | |
| 433 | //printMacAddr(pMacHdr->bssId) ; |
| 434 | //printMacAddr(pMacHdr->sa) ; |
| 435 | //printMacAddr(pMacHdr->da) ; |
| 436 | |
| 437 | header_offset += sizeof(tSirMacMgmtHdr) ; |
| 438 | /* |
| 439 | * Now form RFC1042 header |
| 440 | */ |
| 441 | palCopyMemory(pMac->hHdd, (tANI_U8 *)(pFrame + header_offset), |
| 442 | (tANI_U8 *)eth_890d_header , sizeof(eth_890d_header)) ; |
| 443 | |
| 444 | header_offset += sizeof(eth_890d_header) ; |
| 445 | |
| 446 | /* add payload type as TDLS */ |
| 447 | *(pFrame + header_offset) = PAYLOAD_TYPE_TDLS ; |
| 448 | |
| 449 | return(header_offset += PAYLOAD_TYPE_TDLS_SIZE) ; |
| 450 | } |
| 451 | |
| 452 | /* |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 453 | * TX Complete for Management frames |
| 454 | */ |
| 455 | eHalStatus limMgmtTXComplete(tpAniSirGlobal pMac, |
| 456 | tANI_U32 txCompleteSuccess) |
| 457 | { |
| 458 | tpPESession psessionEntry = NULL ; |
| 459 | |
| 460 | if (0xff != pMac->lim.mgmtFrameSessionId) |
| 461 | { |
| 462 | psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.mgmtFrameSessionId); |
| 463 | if (NULL == psessionEntry) |
| 464 | { |
| 465 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 466 | ("%s: sessionID %d is not found"), __func__, pMac->lim.mgmtFrameSessionId); |
| 467 | return eHAL_STATUS_FAILURE; |
| 468 | } |
| 469 | limSendSmeMgmtTXCompletion(pMac, psessionEntry, txCompleteSuccess); |
| 470 | pMac->lim.mgmtFrameSessionId = 0xff; |
| 471 | } |
| 472 | return eHAL_STATUS_SUCCESS; |
| 473 | } |
| 474 | |
| 475 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 476 | * This function can be used for bacst or unicast discovery request |
| 477 | * We are not differentiating it here, it will all depnds on peer MAC address, |
| 478 | */ |
| 479 | tSirRetStatus limSendTdlsDisReqFrame(tpAniSirGlobal pMac, tSirMacAddr peer_mac, |
| 480 | tANI_U8 dialog, tpPESession psessionEntry) |
| 481 | { |
| 482 | tDot11fTDLSDisReq tdlsDisReq ; |
| 483 | tANI_U32 status = 0 ; |
| 484 | tANI_U32 nPayload = 0 ; |
| 485 | tANI_U32 size = 0 ; |
| 486 | tANI_U32 nBytes = 0 ; |
| 487 | tANI_U32 header_offset = 0 ; |
| 488 | tANI_U8 *pFrame; |
| 489 | void *pPacket; |
| 490 | eHalStatus halstatus; |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 491 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 492 | tANI_U32 padLen = 0; |
| 493 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 494 | |
| 495 | /* |
| 496 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 497 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 498 | * serialization). We start by zero-initializing the structure: |
| 499 | */ |
| 500 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&tdlsDisReq, |
| 501 | sizeof( tDot11fTDLSDisReq ) ); |
| 502 | |
| 503 | /* |
| 504 | * setup Fixed fields, |
| 505 | */ |
| 506 | tdlsDisReq.Category.category = SIR_MAC_ACTION_TDLS ; |
| 507 | tdlsDisReq.Action.action = SIR_MAC_TDLS_DIS_REQ ; |
| 508 | tdlsDisReq.DialogToken.token = dialog ; |
| 509 | |
| 510 | |
| 511 | size = sizeof(tSirMacAddr) ; |
| 512 | |
| 513 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsDisReq.LinkIdentifier, |
| 514 | peer_mac, TDLS_INITIATOR) ; |
| 515 | |
| 516 | /* |
| 517 | * now we pack it. First, how much space are we going to need? |
| 518 | */ |
| 519 | status = dot11fGetPackedTDLSDisReqSize( pMac, &tdlsDisReq, &nPayload); |
| 520 | if ( DOT11F_FAILED( status ) ) |
| 521 | { |
| 522 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 523 | "or a discovery Request (0x%08x).\n"), status ); |
| 524 | /* We'll fall back on the worst case scenario: */ |
| 525 | nPayload = sizeof( tDot11fTDLSDisReq ); |
| 526 | } |
| 527 | else if ( DOT11F_WARNED( status ) ) |
| 528 | { |
| 529 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 530 | "the packed size for a discovery Request (" |
| 531 | "0x%08x).\n"), status ); |
| 532 | } |
| 533 | |
| 534 | /* |
| 535 | * This frame is going out from PE as data frames with special ethertype |
| 536 | * 89-0d. |
| 537 | * 8 bytes of RFC 1042 header |
| 538 | */ |
| 539 | |
| 540 | |
| 541 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) |
| 542 | + sizeof( eth_890d_header ) |
| 543 | + PAYLOAD_TYPE_TDLS_SIZE ; |
| 544 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 545 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 546 | /* IOT issue with some AP : some AP doesn't like the data packet size < minimum 802.3 frame length (64) |
| 547 | Hence AP itself padding some bytes, which caused teardown packet is dropped at |
| 548 | receiver side. To avoid such IOT issue, we added some extra bytes to meet data frame size >= 64 |
| 549 | */ |
| 550 | if (nPayload + PAYLOAD_TYPE_TDLS_SIZE < MIN_IEEE_8023_SIZE) |
| 551 | { |
| 552 | padLen = MIN_IEEE_8023_SIZE - (nPayload + PAYLOAD_TYPE_TDLS_SIZE ) ; |
| 553 | |
| 554 | /* if padLen is less than minimum vendorSpecific (5), pad up to 5 */ |
| 555 | if (padLen < MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 556 | padLen = MIN_VENDOR_SPECIFIC_IE_SIZE; |
| 557 | |
| 558 | nBytes += padLen; |
| 559 | } |
| 560 | #endif |
| 561 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 562 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 563 | |
| 564 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 565 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 566 | ( void** ) &pPacket ); |
| 567 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 568 | { |
| 569 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS" |
| 570 | "Discovery Request.\n"), nBytes ); |
| 571 | return eSIR_MEM_ALLOC_FAILED; |
| 572 | } |
| 573 | |
| 574 | /* zero out the memory */ |
| 575 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 576 | |
| 577 | /* |
| 578 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 579 | * request frame |
| 580 | */ |
| 581 | |
| 582 | /* fill out the buffer descriptor */ |
| 583 | |
| 584 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 585 | LINK_IDEN_ADDR_OFFSET(tdlsDisReq), TDLS_LINK_AP, TDLS_INITIATOR, psessionEntry) ; |
| 586 | |
| 587 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 588 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_DSCV_REQ) |
| 589 | { |
| 590 | tdlsDisReq.LinkIdentifier.bssid[4] = 0xde; |
| 591 | tdlsDisReq.LinkIdentifier.bssid[5] = 0xad; |
| 592 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 593 | ("TDLS negative running: wrong BSSID %02x:%02x:%02x:%02x:%02x:%02x in TDLS Discovery Req\n"), \ |
| 594 | tdlsDisReq.LinkIdentifier.bssid[0], |
| 595 | tdlsDisReq.LinkIdentifier.bssid[1], |
| 596 | tdlsDisReq.LinkIdentifier.bssid[2], |
| 597 | tdlsDisReq.LinkIdentifier.bssid[3], |
| 598 | tdlsDisReq.LinkIdentifier.bssid[4], |
| 599 | tdlsDisReq.LinkIdentifier.bssid[5]); |
| 600 | } |
| 601 | #endif |
| 602 | status = dot11fPackTDLSDisReq( pMac, &tdlsDisReq, pFrame |
| 603 | + header_offset, nPayload, &nPayload ); |
| 604 | |
| 605 | if ( DOT11F_FAILED( status ) ) |
| 606 | { |
| 607 | limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req \ |
| 608 | (0x%08x).\n"), status ); |
| 609 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 610 | ( void* ) pFrame, ( void* ) pPacket ); |
| 611 | return eSIR_FAILURE; |
| 612 | } |
| 613 | else if ( DOT11F_WARNED( status ) ) |
| 614 | { |
| 615 | limLog( pMac, LOGW, FL("There were warnings while packing TDLS" |
| 616 | "Discovery Request (0x%08x).\n") ); |
| 617 | } |
| 618 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 619 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 620 | if (padLen != 0) |
| 621 | { |
| 622 | /* QCOM VENDOR OUI = { 0x00, 0xA0, 0xC6, type = 0x0000 }; */ |
| 623 | tANI_U8 *padVendorSpecific = pFrame + header_offset + nPayload; |
| 624 | /* make QCOM_VENDOR_OUI, and type = 0x0000, and all the payload to be zero */ |
| 625 | padVendorSpecific[0] = 221; |
| 626 | padVendorSpecific[1] = padLen - 2; |
| 627 | padVendorSpecific[2] = 0x00; |
| 628 | padVendorSpecific[3] = 0xA0; |
| 629 | padVendorSpecific[4] = 0xC6; |
| 630 | |
| 631 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, ("Padding Vendor Specific Ie Len = %d"), |
| 632 | padLen )); |
| 633 | |
| 634 | /* padding zero if more than 5 bytes are required */ |
| 635 | if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 636 | palZeroMemory( pMac->hHdd, pFrame + header_offset + nPayload + MIN_VENDOR_SPECIFIC_IE_SIZE, padLen - MIN_VENDOR_SPECIFIC_IE_SIZE); |
| 637 | } |
| 638 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 639 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 640 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA "), |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 641 | SIR_MAC_TDLS_DIS_REQ, limTraceTdlsActionString(SIR_MAC_TDLS_DIS_REQ) )); |
| 642 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 643 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 644 | HAL_TXRX_FRM_802_11_DATA, |
| 645 | ANI_TXDIR_TODS, |
| 646 | 7, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 647 | limTxComplete, pFrame, |
| 648 | limMgmtTXComplete, |
| 649 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 650 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 651 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 652 | pMac->lim.mgmtFrameSessionId = 0xff; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 653 | limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!\n" )); |
| 654 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 655 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 656 | pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 657 | |
| 658 | return eSIR_SUCCESS; |
| 659 | |
| 660 | } |
| 661 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 662 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 663 | /* |
| 664 | * Once Discovery response is sent successfully (or failure) on air, now send |
| 665 | * response to PE and send del STA to HAL. |
| 666 | */ |
| 667 | eHalStatus limTdlsDisRspTxComplete(tpAniSirGlobal pMac, |
| 668 | tANI_U32 txCompleteSuccess) |
| 669 | { |
| 670 | eHalStatus status = eHAL_STATUS_SUCCESS ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 671 | tpDphHashNode pStaDs = NULL ; |
| 672 | tSirTdlsPeerInfo *peerInfo = 0 ; |
| 673 | |
| 674 | /* find peer by looking into the list by expected state */ |
| 675 | peerInfo = limTdlsFindDisPeerByState(pMac, TDLS_DIS_RSP_SENT_WAIT_STATE) ; |
| 676 | |
| 677 | if(NULL == peerInfo) |
| 678 | { |
| 679 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 680 | ("DisRspTxComplete: No TDLS state machine waits for this event\n")); |
| 681 | VOS_ASSERT(0) ; |
| 682 | return eHAL_STATUS_FAILURE; |
| 683 | } |
| 684 | |
| 685 | peerInfo->tdlsPeerState = TDLS_DIS_RSP_SENT_DONE_STATE ; |
| 686 | |
| 687 | if(peerInfo->delStaNeeded) |
| 688 | { |
| 689 | tpPESession psessionEntry; |
| 690 | |
| 691 | peerInfo->delStaNeeded = false ; |
| 692 | psessionEntry = peFindSessionBySessionId (pMac, peerInfo->sessionId); |
| 693 | |
| 694 | if(NULL == psessionEntry) |
| 695 | { |
| 696 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 697 | ("DisRspTxComplete: sessionID %d is not found\n"), peerInfo->sessionId); |
| 698 | return eHAL_STATUS_FAILURE; |
| 699 | } |
| 700 | /* send del STA to remove context for this TDLS STA */ |
| 701 | pStaDs = limTdlsDelSta(pMac, peerInfo->peerMac, psessionEntry) ; |
| 702 | |
| 703 | /* now send indication to SME-->HDD->TL to remove STA from TL */ |
| 704 | if(pStaDs) |
| 705 | { |
| 706 | limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId, |
| 707 | pStaDs, eSIR_SUCCESS) ; |
| 708 | } |
| 709 | else |
| 710 | { |
| 711 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 712 | ("DisRspTxComplete: staDs not found for %02x:%02x:%02x:%02x:%02x:%02x\n"), |
| 713 | (peerInfo)->peerMac[0], |
| 714 | (peerInfo)->peerMac[1], |
| 715 | (peerInfo)->peerMac[2], |
| 716 | (peerInfo)->peerMac[3], |
| 717 | (peerInfo)->peerMac[4], |
| 718 | (peerInfo)->peerMac[5]) ; |
| 719 | VOS_ASSERT(0) ; |
| 720 | return eHAL_STATUS_FAILURE; |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | if(!txCompleteSuccess) |
| 725 | { |
| 726 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 727 | ("TX complete failure for Dis RSP")); |
| 728 | limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE, |
| 729 | eWNI_SME_TDLS_DISCOVERY_START_IND) ; |
| 730 | status = eHAL_STATUS_FAILURE; |
| 731 | } |
| 732 | else |
| 733 | { |
| 734 | limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS, |
| 735 | eWNI_SME_TDLS_DISCOVERY_START_IND) ; |
| 736 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 737 | ("TX complete Success for Dis RSP")); |
| 738 | status = eHAL_STATUS_SUCCESS ; |
| 739 | } |
| 740 | //pMac->hal.pCBackFnTxComp = NULL ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 741 | return status ; |
| 742 | |
| 743 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 744 | #endif |
| 745 | |
| 746 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 747 | /* |
| 748 | * Once setup CNF is sent successfully (or failure) on air, now send |
| 749 | * response to PE and send del STA to HAL. |
| 750 | */ |
| 751 | eHalStatus limTdlsSetupCnfTxComplete(tpAniSirGlobal pMac, |
| 752 | tANI_U32 txCompleteSuccess) |
| 753 | { |
| 754 | eHalStatus status = eHAL_STATUS_SUCCESS ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 755 | tLimTdlsLinkSetupPeer *peerInfo = 0 ; |
| 756 | /* find peer by looking into the list by expected state */ |
| 757 | limTdlsFindSetupPeerByState(pMac, |
| 758 | TDLS_LINK_SETUP_RSP_WAIT_STATE, &peerInfo) ; |
| 759 | |
| 760 | if(NULL == peerInfo) |
| 761 | { |
| 762 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 763 | ("limTdlsSetupCnfTxComplete: No TDLS state machine waits for this event\n")); |
| 764 | VOS_ASSERT(0) ; |
| 765 | return eHAL_STATUS_FAILURE; |
| 766 | } |
| 767 | |
| 768 | (peerInfo)->tdls_prev_link_state = (peerInfo)->tdls_link_state ; |
| 769 | (peerInfo)->tdls_link_state = TDLS_LINK_SETUP_DONE_STATE ; |
| 770 | |
| 771 | if(!txCompleteSuccess) |
| 772 | { |
| 773 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 774 | ("TX complete Failure for setup CNF")); |
| 775 | limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, (peerInfo)->peerMac, |
| 776 | eWNI_SME_TDLS_LINK_START_RSP) ; |
| 777 | status = eHAL_STATUS_FAILURE; |
| 778 | } |
| 779 | else |
| 780 | { |
| 781 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 782 | ("RSP-->SME peer MAC = %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 783 | (peerInfo)->peerMac[0], |
| 784 | (peerInfo)->peerMac[1], |
| 785 | (peerInfo)->peerMac[2], |
| 786 | (peerInfo)->peerMac[3], |
| 787 | (peerInfo)->peerMac[4], |
| 788 | (peerInfo)->peerMac[5]) ; |
| 789 | |
| 790 | limSendSmeTdlsLinkStartRsp(pMac, eSIR_SUCCESS, (peerInfo)->peerMac, |
| 791 | eWNI_SME_TDLS_LINK_START_RSP) ; |
| 792 | |
| 793 | /* tdls_hklee: prepare PTI template and send it to HAL */ |
| 794 | limTdlsLinkEstablish(pMac, (peerInfo)->peerMac); |
| 795 | |
| 796 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 797 | ("TX complete Success for setup CNF")); |
| 798 | status = eHAL_STATUS_SUCCESS ; |
| 799 | } |
| 800 | //pMac->hal.pCBackFnTxComp = NULL ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 801 | return status ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 802 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 803 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 804 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 805 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 806 | /* |
| 807 | * Tx Complete for Teardown frame |
| 808 | */ |
| 809 | eHalStatus limTdlsTeardownTxComplete(tpAniSirGlobal pMac, |
| 810 | tANI_U32 txCompleteSuccess) |
| 811 | { |
| 812 | eHalStatus status = eHAL_STATUS_SUCCESS ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 813 | tpDphHashNode pStaDs = NULL ; |
| 814 | tLimTdlsLinkSetupPeer *peerInfo = 0 ; |
| 815 | tpPESession psessionEntry = NULL ; |
| 816 | //tANI_U16 msgType = 0 ; |
| 817 | |
| 818 | //tSirMacAddr peerMac = {0} ; |
| 819 | /* find peer by looking into the list by expected state */ |
| 820 | limTdlsFindSetupPeerByState(pMac, |
| 821 | TDLS_LINK_TEARDOWN_START_STATE, &peerInfo) ; |
| 822 | |
| 823 | if(NULL == peerInfo) |
| 824 | { |
| 825 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 826 | ("limTdlsTeardownTxComplete: No TDLS state machine waits for this event\n")); |
| 827 | VOS_ASSERT(0) ; |
| 828 | return eHAL_STATUS_FAILURE; |
| 829 | } |
| 830 | |
| 831 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 832 | ("teardown peer Mac = %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 833 | (peerInfo)->peerMac[0] , |
| 834 | (peerInfo)->peerMac[1] , |
| 835 | (peerInfo)->peerMac[2] , |
| 836 | (peerInfo)->peerMac[3] , |
| 837 | (peerInfo)->peerMac[4] , |
| 838 | (peerInfo)->peerMac[5] ) ; |
| 839 | |
| 840 | |
| 841 | //pMac->hal.pCBackFnTxComp = NULL ; |
| 842 | |
| 843 | psessionEntry = peFindSessionBySessionId(pMac, (peerInfo)->tdls_sessionId); |
| 844 | |
| 845 | if(NULL == psessionEntry) |
| 846 | { |
| 847 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 848 | ("limTdlsTeardownTxComplete: sessionID %d is not found\n"), (peerInfo)->tdls_sessionId); |
| 849 | VOS_ASSERT(0) ; |
| 850 | return eHAL_STATUS_FAILURE; |
| 851 | } |
| 852 | |
| 853 | if(!txCompleteSuccess) |
| 854 | { |
| 855 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 856 | ("TX complete failure for Teardown \n")) ; |
| 857 | |
| 858 | /* |
| 859 | * we should be sending Teradown to AP with status code |
| 860 | * eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE, we are not worried if |
| 861 | * that is delivered or not, any way we removing this peer STA from our |
| 862 | * list |
| 863 | */ |
| 864 | if(NULL != psessionEntry) |
| 865 | { |
| 866 | limSendTdlsTeardownFrame(pMac, (peerInfo)->peerMac, |
| 867 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE, psessionEntry, NULL, 0) ; |
| 868 | } |
| 869 | } |
| 870 | |
| 871 | if(TDLS_LINK_SETUP_WAIT_STATE != (peerInfo)->tdls_prev_link_state) |
| 872 | { |
| 873 | (peerInfo)->tdls_prev_link_state = (peerInfo)->tdls_link_state ; |
| 874 | (peerInfo)->tdls_link_state = TDLS_LINK_TEARDOWN_DONE_STATE ; |
| 875 | /* send del STA to remove context for this TDLS STA */ |
| 876 | if(NULL != psessionEntry) |
| 877 | { |
| 878 | /* tdls_hklee: send message to HAL before it is deleted */ |
| 879 | limTdlsLinkTeardown(pMac, (peerInfo)->peerMac) ; |
| 880 | |
| 881 | pStaDs = limTdlsDelSta(pMac, (peerInfo)->peerMac, psessionEntry) ; |
| 882 | } |
| 883 | |
| 884 | /* now send indication to SME-->HDD->TL to remove STA from TL */ |
| 885 | if(!pStaDs) |
| 886 | { |
| 887 | VOS_ASSERT(0) ; |
| 888 | return eSIR_FAILURE ; |
| 889 | } |
| 890 | limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId, |
| 891 | pStaDs, eSIR_SUCCESS) ; |
| 892 | |
| 893 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 894 | ("TX complete SUCCESS for Teardown\n")) ; |
| 895 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 896 | ("Prev State = %d\n"), (peerInfo)->tdls_prev_link_state) ; |
| 897 | limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (peerInfo)->peerMac, |
| 898 | eWNI_SME_TDLS_TEARDOWN_RSP) ; |
| 899 | /* Delete Peer for Link Peer List */ |
| 900 | limTdlsDelLinkPeer(pMac, (peerInfo)->peerMac) ; |
| 901 | } |
| 902 | else |
| 903 | { |
| 904 | (peerInfo)->tdls_prev_link_state = (peerInfo)->tdls_link_state ; |
| 905 | (peerInfo)->tdls_link_state = TDLS_LINK_TEARDOWN_DONE_STATE ; |
| 906 | limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (peerInfo)->peerMac, |
| 907 | eWNI_SME_TDLS_TEARDOWN_IND) ; |
| 908 | } |
| 909 | |
| 910 | |
| 911 | #if 0 |
| 912 | /* if previous state is link restart, then restart link setup again */ |
| 913 | if(TDLS_LINK_SETUP_RESTART_STATE == (peerInfo)->tdls_prev_link_state) |
| 914 | { |
| 915 | tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ; |
| 916 | limTdlsPrepareSetupReqFrame(pMac, setupInfo, 37, |
| 917 | peerMac, psessionEntry) ; |
| 918 | } |
| 919 | #endif |
| 920 | status = eHAL_STATUS_SUCCESS ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 921 | return status ; |
| 922 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 923 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 924 | |
| 925 | /* |
| 926 | * Send TDLS discovery response frame on direct link. |
| 927 | */ |
| 928 | |
| 929 | static tSirRetStatus limSendTdlsDisRspFrame(tpAniSirGlobal pMac, |
| 930 | tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry) |
| 931 | { |
| 932 | tDot11fTDLSDisRsp tdlsDisRsp ; |
| 933 | tANI_U16 caps = 0 ; |
| 934 | tANI_U32 status = 0 ; |
| 935 | tANI_U32 nPayload = 0 ; |
| 936 | tANI_U32 nBytes = 0 ; |
| 937 | tANI_U8 *pFrame; |
| 938 | void *pPacket; |
| 939 | eHalStatus halstatus; |
| 940 | |
| 941 | /* |
| 942 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 943 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 944 | * serialization). We start by zero-initializing the structure: |
| 945 | */ |
| 946 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&tdlsDisRsp, |
| 947 | sizeof( tDot11fTDLSDisRsp ) ); |
| 948 | |
| 949 | /* |
| 950 | * setup Fixed fields, |
| 951 | */ |
| 952 | tdlsDisRsp.Category.category = SIR_MAC_ACTION_PUBLIC_USAGE; |
| 953 | tdlsDisRsp.Action.action = SIR_MAC_TDLS_DIS_RSP ; |
| 954 | tdlsDisRsp.DialogToken.token = dialog ; |
| 955 | |
| 956 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsDisRsp.LinkIdentifier, |
| 957 | peerMac, TDLS_RESPONDER) ; |
| 958 | |
| 959 | if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) |
| 960 | { |
| 961 | /* |
| 962 | * Could not get Capabilities value |
| 963 | * from CFG. Log error. |
| 964 | */ |
| 965 | limLog(pMac, LOGP, |
| 966 | FL("could not retrieve Capabilities value\n")); |
| 967 | } |
| 968 | swapBitField16(caps, ( tANI_U16* )&tdlsDisRsp.Capabilities ); |
| 969 | |
| 970 | /* populate supported rate IE */ |
| 971 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 972 | &tdlsDisRsp.SuppRates, psessionEntry ); |
| 973 | |
| 974 | /* Populate extended supported rates */ |
| 975 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 976 | &tdlsDisRsp.ExtSuppRates, psessionEntry ); |
| 977 | |
| 978 | /* Populate extended supported rates */ |
| 979 | PopulateDot11fTdlsExtCapability( pMac, &tdlsDisRsp.ExtCap ); |
| 980 | |
| 981 | /* Include HT Capability IE */ |
| 982 | //This does not depend on peer capabilities. If it is supported then it should be included |
| 983 | PopulateDot11fHTCaps( pMac, psessionEntry, &tdlsDisRsp.HTCaps ); |
| 984 | |
| 985 | /* |
| 986 | * now we pack it. First, how much space are we going to need? |
| 987 | */ |
| 988 | status = dot11fGetPackedTDLSDisRspSize( pMac, &tdlsDisRsp, &nPayload); |
| 989 | if ( DOT11F_FAILED( status ) ) |
| 990 | { |
| 991 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 992 | "or a discovery Request (0x%08x).\n"), status ); |
| 993 | /* We'll fall back on the worst case scenario: */ |
| 994 | nPayload = sizeof( tDot11fProbeRequest ); |
| 995 | } |
| 996 | else if ( DOT11F_WARNED( status ) ) |
| 997 | { |
| 998 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 999 | "the packed size for a discovery Request (" |
| 1000 | "0x%08x).\n"), status ); |
| 1001 | } |
| 1002 | |
| 1003 | /* |
| 1004 | * This frame is going out from PE as data frames with special ethertype |
| 1005 | * 89-0d. |
| 1006 | * 8 bytes of RFC 1042 header |
| 1007 | */ |
| 1008 | |
| 1009 | |
| 1010 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) ; |
| 1011 | |
| 1012 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1013 | |
| 1014 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1015 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1016 | ( void** ) &pPacket ); |
| 1017 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1018 | { |
| 1019 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS" |
| 1020 | "Discovery Request.\n"), nBytes ); |
| 1021 | return eSIR_MEM_ALLOC_FAILED; |
| 1022 | } |
| 1023 | |
| 1024 | /* zero out the memory */ |
| 1025 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 1026 | |
| 1027 | /* |
| 1028 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1029 | * response frame |
| 1030 | */ |
| 1031 | |
| 1032 | /* Make public Action Frame */ |
| 1033 | |
| 1034 | #if 0 |
| 1035 | limPreparesActionFrameHdr(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1036 | SIR_MAC_MGMT_ACTION, |
| 1037 | LINK_IDEN_ADDR_OFFSET(tdlsDisRsp)) ; |
| 1038 | #endif |
| 1039 | limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1040 | SIR_MAC_MGMT_ACTION, peerMac, psessionEntry->selfMacAddr); |
| 1041 | |
| 1042 | { |
| 1043 | tpSirMacMgmtHdr pMacHdr; |
| 1044 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1045 | pMacHdr->fc.toDS = ANI_TXDIR_IBSS; |
| 1046 | pMacHdr->fc.powerMgmt = 0 ; |
| 1047 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1048 | } |
| 1049 | |
| 1050 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 1051 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_DSCV_RSP) |
| 1052 | { |
| 1053 | tdlsDisRsp.LinkIdentifier.bssid[4] = 0xde; |
| 1054 | tdlsDisRsp.LinkIdentifier.bssid[5] = 0xad; |
| 1055 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 1056 | ("TDLS negative running: wrong BSSID %02x:%02x:%02x:%02x:%02x:%02x in TDLS Discovery Rsp\n"), \ |
| 1057 | tdlsDisRsp.LinkIdentifier.bssid[0], |
| 1058 | tdlsDisRsp.LinkIdentifier.bssid[1], |
| 1059 | tdlsDisRsp.LinkIdentifier.bssid[2], |
| 1060 | tdlsDisRsp.LinkIdentifier.bssid[3], |
| 1061 | tdlsDisRsp.LinkIdentifier.bssid[4], |
| 1062 | tdlsDisRsp.LinkIdentifier.bssid[5]); |
| 1063 | } |
| 1064 | #endif |
| 1065 | status = dot11fPackTDLSDisRsp( pMac, &tdlsDisRsp, pFrame + |
| 1066 | sizeof( tSirMacMgmtHdr ), |
| 1067 | nPayload, &nPayload ); |
| 1068 | |
| 1069 | if ( DOT11F_FAILED( status ) ) |
| 1070 | { |
| 1071 | limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req \ |
| 1072 | (0x%08x).\n"), status ); |
| 1073 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1074 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1075 | return eSIR_FAILURE; |
| 1076 | } |
| 1077 | else if ( DOT11F_WARNED( status ) ) |
| 1078 | { |
| 1079 | limLog( pMac, LOGW, FL("There were warnings while packing TDLS" |
| 1080 | "Discovery Request (0x%08x).\n") ); |
| 1081 | } |
| 1082 | |
| 1083 | #if 0 |
| 1084 | if(pMac->hal.pCBackFnTxComp == NULL) |
| 1085 | { |
| 1086 | pMac->hal.pCBackFnTxComp = (tpCBackFnTxComp)limTdlsDisRspTxComplete; |
| 1087 | |
| 1088 | if(TX_SUCCESS != tx_timer_activate(&pMac->hal.txCompTimer)) |
| 1089 | { |
| 1090 | status = eHAL_STATUS_FAILURE; |
| 1091 | return status; |
| 1092 | |
| 1093 | } |
| 1094 | } |
| 1095 | #endif |
| 1096 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 1097 | ("transmitting Discovery response on direct link\n")) ; |
| 1098 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 1099 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -DIRECT-> OTA"), |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1100 | SIR_MAC_TDLS_DIS_RSP, limTraceTdlsActionString(SIR_MAC_TDLS_DIS_RSP) )); |
| 1101 | |
| 1102 | |
| 1103 | /* |
| 1104 | * Transmit Discovery response and watch if this is delivered to |
| 1105 | * peer STA. |
| 1106 | */ |
| 1107 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1108 | HAL_TXRX_FRM_802_11_DATA, |
| 1109 | ANI_TXDIR_IBSS, |
| 1110 | 0, |
| 1111 | limTxComplete, pFrame, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1112 | limMgmtTXComplete, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1113 | HAL_USE_SELF_STA_REQUESTED_MASK ); |
| 1114 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1115 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1116 | pMac->lim.mgmtFrameSessionId = 0xff; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1117 | limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!\n" )); |
| 1118 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1119 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1120 | pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1121 | |
| 1122 | return eSIR_SUCCESS; |
| 1123 | |
| 1124 | } |
| 1125 | |
| 1126 | /* |
| 1127 | * TDLS setup Request frame on AP link |
| 1128 | */ |
| 1129 | |
| 1130 | tSirRetStatus limSendTdlsLinkSetupReqFrame(tpAniSirGlobal pMac, |
| 1131 | tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry, |
| 1132 | tANI_U8 *addIe, tANI_U16 addIeLen) |
| 1133 | { |
| 1134 | tDot11fTDLSSetupReq tdlsSetupReq ; |
| 1135 | tANI_U16 caps = 0 ; |
| 1136 | tANI_U32 status = 0 ; |
| 1137 | tANI_U32 nPayload = 0 ; |
| 1138 | tANI_U32 nBytes = 0 ; |
| 1139 | tANI_U32 header_offset = 0 ; |
| 1140 | tANI_U8 *pFrame; |
| 1141 | void *pPacket; |
| 1142 | eHalStatus halstatus; |
| 1143 | |
| 1144 | /* |
| 1145 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1146 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1147 | * serialization). We start by zero-initializing the structure: |
| 1148 | */ |
| 1149 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&tdlsSetupReq, |
| 1150 | sizeof( tDot11fTDLSSetupReq ) ); |
| 1151 | tdlsSetupReq.Category.category = SIR_MAC_ACTION_TDLS ; |
| 1152 | tdlsSetupReq.Action.action = SIR_MAC_TDLS_SETUP_REQ ; |
| 1153 | tdlsSetupReq.DialogToken.token = dialog ; |
| 1154 | |
| 1155 | |
| 1156 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsSetupReq.LinkIdentifier, |
| 1157 | peerMac, TDLS_INITIATOR) ; |
| 1158 | |
| 1159 | if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) |
| 1160 | { |
| 1161 | /* |
| 1162 | * Could not get Capabilities value |
| 1163 | * from CFG. Log error. |
| 1164 | */ |
| 1165 | limLog(pMac, LOGP, |
| 1166 | FL("could not retrieve Capabilities value\n")); |
| 1167 | } |
| 1168 | swapBitField16(caps, ( tANI_U16* )&tdlsSetupReq.Capabilities ); |
| 1169 | |
| 1170 | /* populate supported rate IE */ |
| 1171 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1172 | &tdlsSetupReq.SuppRates, psessionEntry ); |
| 1173 | |
| 1174 | /* Populate extended supported rates */ |
| 1175 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1176 | &tdlsSetupReq.ExtSuppRates, psessionEntry ); |
| 1177 | |
| 1178 | /* Populate extended supported rates */ |
| 1179 | PopulateDot11fTdlsExtCapability( pMac, &tdlsSetupReq.ExtCap ); |
| 1180 | |
| 1181 | /* |
| 1182 | * TODO: we need to see if we have to support conditions where we have |
| 1183 | * EDCA parameter info element is needed a) if we need different QOS |
| 1184 | * parameters for off channel operations or QOS is not supported on |
| 1185 | * AP link and we wanted to QOS on direct link. |
| 1186 | */ |
| 1187 | /* Populate QOS info, needed for Peer U-APSD session */ |
| 1188 | /* TODO: Now hardcoded, because PopulateDot11fQOSCapsStation() depends on AP's capability, and |
| 1189 | TDLS doesn't want to depend on AP's capability */ |
| 1190 | tdlsSetupReq.QOSCapsStation.present = 1; |
| 1191 | tdlsSetupReq.QOSCapsStation.max_sp_length = 0; |
| 1192 | tdlsSetupReq.QOSCapsStation.qack = 0; |
| 1193 | tdlsSetupReq.QOSCapsStation.acbe_uapsd = 0; |
| 1194 | tdlsSetupReq.QOSCapsStation.acbk_uapsd = 0; |
| 1195 | tdlsSetupReq.QOSCapsStation.acvi_uapsd = 0; |
| 1196 | tdlsSetupReq.QOSCapsStation.acvo_uapsd = 0; |
| 1197 | |
| 1198 | |
| 1199 | /* |
| 1200 | * we will always try to init TDLS link with 11n capabilities |
| 1201 | * let TDLS setup response to come, and we will set our caps based |
| 1202 | * of peer caps |
| 1203 | */ |
| 1204 | |
| 1205 | /* Include HT Capability IE */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1206 | PopulateDot11fHTCaps( pMac, NULL, &tdlsSetupReq.HTCaps ); |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1207 | if (psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1208 | { |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1209 | tdlsSetupReq.HTCaps.present = 1; |
| 1210 | tdlsSetupReq.HTCaps.supportedChannelWidthSet = 0; |
| 1211 | } |
| 1212 | else |
| 1213 | { |
| 1214 | if (tdlsSetupReq.HTCaps.present) |
| 1215 | { |
| 1216 | tdlsSetupReq.HTCaps.supportedChannelWidthSet = 1; // pVhtCaps->supportedChannelWidthSet; |
| 1217 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1218 | } |
| 1219 | /* Include VHT Capability IE */ |
| 1220 | PopulateDot11fVHTCaps( pMac, &tdlsSetupReq.VHTCaps ); |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1221 | if (psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1222 | { |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1223 | tdlsSetupReq.VHTCaps.present = 0; |
| 1224 | tdlsSetupReq.VHTCaps.supportedChannelWidthSet = 0; |
| 1225 | tdlsSetupReq.VHTCaps.ldpcCodingCap = 0; |
| 1226 | tdlsSetupReq.VHTCaps.suBeamFormerCap = 0; |
| 1227 | } |
| 1228 | else |
| 1229 | { |
| 1230 | if (tdlsSetupReq.VHTCaps.present) |
| 1231 | { |
| 1232 | tdlsSetupReq.VHTCaps.supportedChannelWidthSet = 1; // pVhtCaps->supportedChannelWidthSet; |
| 1233 | tdlsSetupReq.VHTCaps.ldpcCodingCap = 1; // pVhtCaps->ldpcCodingCap |
| 1234 | tdlsSetupReq.VHTCaps.suBeamFormerCap = 1; // pVhtCaps->suBeamFormerCap |
| 1235 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1236 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1237 | /* |
| 1238 | * now we pack it. First, how much space are we going to need? |
| 1239 | */ |
| 1240 | status = dot11fGetPackedTDLSSetupReqSize( pMac, &tdlsSetupReq, |
| 1241 | &nPayload); |
| 1242 | if ( DOT11F_FAILED( status ) ) |
| 1243 | { |
| 1244 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 1245 | "or a discovery Request (0x%08x).\n"), status ); |
| 1246 | /* We'll fall back on the worst case scenario: */ |
| 1247 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1248 | } |
| 1249 | else if ( DOT11F_WARNED( status ) ) |
| 1250 | { |
| 1251 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1252 | "the packed size for a discovery Request (" |
| 1253 | "0x%08x).\n"), status ); |
| 1254 | } |
| 1255 | |
| 1256 | |
| 1257 | /* |
| 1258 | * This frame is going out from PE as data frames with special ethertype |
| 1259 | * 89-0d. |
| 1260 | * 8 bytes of RFC 1042 header |
| 1261 | */ |
| 1262 | |
| 1263 | |
| 1264 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) |
| 1265 | + sizeof( eth_890d_header ) |
| 1266 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1267 | + addIeLen; |
| 1268 | |
| 1269 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1270 | |
| 1271 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1272 | ( tANI_U16 )nBytes , ( void** ) &pFrame, |
| 1273 | ( void** ) &pPacket ); |
| 1274 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1275 | { |
| 1276 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS" |
| 1277 | "Discovery Request.\n"), nBytes ); |
| 1278 | return eSIR_MEM_ALLOC_FAILED; |
| 1279 | } |
| 1280 | |
| 1281 | /* zero out the memory */ |
| 1282 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 1283 | |
| 1284 | /* |
| 1285 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1286 | * request frame |
| 1287 | */ |
| 1288 | |
| 1289 | /* fill out the buffer descriptor */ |
| 1290 | |
| 1291 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 1292 | LINK_IDEN_ADDR_OFFSET(tdlsSetupReq), TDLS_LINK_AP, TDLS_INITIATOR, psessionEntry) ; |
| 1293 | |
| 1294 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 1295 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_REQ) |
| 1296 | { |
| 1297 | tdlsSetupReq.LinkIdentifier.bssid[4] = 0xde; |
| 1298 | tdlsSetupReq.LinkIdentifier.bssid[5] = 0xad; |
| 1299 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 1300 | ("TDLS negative running: wrong BSSID %02x:%02x:%02x:%02x:%02x:%02x in TDLS Setup Req\n"), \ |
| 1301 | tdlsSetupReq.LinkIdentifier.bssid[0], |
| 1302 | tdlsSetupReq.LinkIdentifier.bssid[1], |
| 1303 | tdlsSetupReq.LinkIdentifier.bssid[2], |
| 1304 | tdlsSetupReq.LinkIdentifier.bssid[3], |
| 1305 | tdlsSetupReq.LinkIdentifier.bssid[4], |
| 1306 | tdlsSetupReq.LinkIdentifier.bssid[5]); |
| 1307 | } |
| 1308 | #endif |
| 1309 | status = dot11fPackTDLSSetupReq( pMac, &tdlsSetupReq, pFrame |
| 1310 | + header_offset, nPayload, &nPayload ); |
| 1311 | |
| 1312 | if ( DOT11F_FAILED( status ) ) |
| 1313 | { |
| 1314 | limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req \ |
| 1315 | (0x%08x).\n"), status ); |
| 1316 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1317 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1318 | return eSIR_FAILURE; |
| 1319 | } |
| 1320 | else if ( DOT11F_WARNED( status ) ) |
| 1321 | { |
| 1322 | limLog( pMac, LOGW, FL("There were warnings while packing TDLS" |
| 1323 | "Discovery Request (0x%08x).\n") ); |
| 1324 | } |
| 1325 | |
| 1326 | //Copy the additional IE. |
| 1327 | //TODO : addIe is added at the end of the frame. This means it doesnt |
| 1328 | //follow the order. This should be ok, but we should consider changing this |
| 1329 | //if there is any IOT issue. |
| 1330 | if( addIeLen != 0 ) |
| 1331 | { |
| 1332 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("Copy Additional Ie Len = %d"), |
| 1333 | addIeLen )); |
| 1334 | palCopyMemory( pMac->hHdd, pFrame + header_offset + nPayload, addIe, addIeLen ); |
| 1335 | } |
| 1336 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 1337 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA"), |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1338 | SIR_MAC_TDLS_SETUP_REQ, limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_REQ) )); |
| 1339 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1340 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1341 | HAL_TXRX_FRM_802_11_DATA, |
| 1342 | ANI_TXDIR_TODS, |
| 1343 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1344 | limTxComplete, pFrame, |
| 1345 | limMgmtTXComplete, |
| 1346 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME ); |
| 1347 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1348 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1349 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1350 | pMac->lim.mgmtFrameSessionId = 0xff; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1351 | limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!\n" )); |
| 1352 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1353 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1354 | pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1355 | |
| 1356 | return eSIR_SUCCESS; |
| 1357 | |
| 1358 | } |
| 1359 | /* |
| 1360 | * Send TDLS Teardown frame on Direct link or AP link, depends on reason code. |
| 1361 | */ |
| 1362 | |
| 1363 | tSirRetStatus limSendTdlsTeardownFrame(tpAniSirGlobal pMac, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1364 | tSirMacAddr peerMac, tANI_U16 reason, tANI_U8 responder, tpPESession psessionEntry, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1365 | tANI_U8 *addIe, tANI_U16 addIeLen) |
| 1366 | { |
| 1367 | tDot11fTDLSTeardown teardown ; |
| 1368 | tANI_U32 status = 0 ; |
| 1369 | tANI_U32 nPayload = 0 ; |
| 1370 | tANI_U32 nBytes = 0 ; |
| 1371 | tANI_U32 header_offset = 0 ; |
| 1372 | tANI_U8 *pFrame; |
| 1373 | void *pPacket; |
| 1374 | eHalStatus halstatus; |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1375 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1376 | tANI_U32 padLen = 0; |
| 1377 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1378 | /* |
| 1379 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1380 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1381 | * serialization). We start by zero-initializing the structure: |
| 1382 | */ |
| 1383 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&teardown, |
| 1384 | sizeof( tDot11fTDLSTeardown ) ); |
| 1385 | teardown.Category.category = SIR_MAC_ACTION_TDLS ; |
| 1386 | teardown.Action.action = SIR_MAC_TDLS_TEARDOWN ; |
| 1387 | teardown.Reason.code = reason ; |
| 1388 | |
| 1389 | PopulateDot11fLinkIden( pMac, psessionEntry, &teardown.LinkIdentifier, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1390 | peerMac, (responder == TRUE) ? TDLS_RESPONDER : TDLS_INITIATOR) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1391 | |
| 1392 | |
| 1393 | /* |
| 1394 | * now we pack it. First, how much space are we going to need? |
| 1395 | */ |
| 1396 | status = dot11fGetPackedTDLSTeardownSize( pMac, &teardown, &nPayload); |
| 1397 | if ( DOT11F_FAILED( status ) ) |
| 1398 | { |
| 1399 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 1400 | "or a discovery Request (0x%08x).\n"), status ); |
| 1401 | /* We'll fall back on the worst case scenario: */ |
| 1402 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1403 | } |
| 1404 | else if ( DOT11F_WARNED( status ) ) |
| 1405 | { |
| 1406 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1407 | "the packed size for a discovery Request (" |
| 1408 | "0x%08x).\n"), status ); |
| 1409 | } |
| 1410 | |
| 1411 | |
| 1412 | /* |
| 1413 | * This frame is going out from PE as data frames with special ethertype |
| 1414 | * 89-0d. |
| 1415 | * 8 bytes of RFC 1042 header |
| 1416 | */ |
| 1417 | |
| 1418 | |
| 1419 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) |
| 1420 | + sizeof( eth_890d_header ) |
| 1421 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1422 | + addIeLen; |
| 1423 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1424 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1425 | /* IOT issue with some AP : some AP doesn't like the data packet size < minimum 802.3 frame length (64) |
| 1426 | Hence AP itself padding some bytes, which caused teardown packet is dropped at |
| 1427 | receiver side. To avoid such IOT issue, we added some extra bytes to meet data frame size >= 64 |
| 1428 | */ |
| 1429 | if (nPayload + PAYLOAD_TYPE_TDLS_SIZE < MIN_IEEE_8023_SIZE) |
| 1430 | { |
| 1431 | padLen = MIN_IEEE_8023_SIZE - (nPayload + PAYLOAD_TYPE_TDLS_SIZE ) ; |
| 1432 | |
| 1433 | /* if padLen is less than minimum vendorSpecific (5), pad up to 5 */ |
| 1434 | if (padLen < MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 1435 | padLen = MIN_VENDOR_SPECIFIC_IE_SIZE; |
| 1436 | |
| 1437 | nBytes += padLen; |
| 1438 | } |
| 1439 | #endif |
| 1440 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1441 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1442 | |
| 1443 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1444 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1445 | ( void** ) &pPacket ); |
| 1446 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1447 | { |
| 1448 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS" |
| 1449 | "Discovery Request.\n"), nBytes ); |
| 1450 | return eSIR_MEM_ALLOC_FAILED; |
| 1451 | } |
| 1452 | |
| 1453 | /* zero out the memory */ |
| 1454 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 1455 | |
| 1456 | /* |
| 1457 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1458 | * request frame |
| 1459 | */ |
| 1460 | |
| 1461 | /* fill out the buffer descriptor */ |
| 1462 | |
| 1463 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 1464 | LINK_IDEN_ADDR_OFFSET(teardown), |
| 1465 | (reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE) |
Gopichand Nakkala | 269032c | 2013-02-07 17:18:15 -0800 | [diff] [blame] | 1466 | ? TDLS_LINK_AP : TDLS_LINK_DIRECT, |
| 1467 | (responder == TRUE) ? TDLS_RESPONDER : TDLS_INITIATOR, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1468 | psessionEntry) ; |
| 1469 | |
| 1470 | status = dot11fPackTDLSTeardown( pMac, &teardown, pFrame |
| 1471 | + header_offset, nPayload, &nPayload ); |
| 1472 | |
| 1473 | if ( DOT11F_FAILED( status ) ) |
| 1474 | { |
| 1475 | limLog( pMac, LOGE, FL("Failed to pack a TDLS Teardown req \ |
| 1476 | (0x%08x).\n"), status ); |
| 1477 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1478 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1479 | return eSIR_FAILURE; |
| 1480 | } |
| 1481 | else if ( DOT11F_WARNED( status ) ) |
| 1482 | { |
| 1483 | limLog( pMac, LOGW, FL("There were warnings while packing TDLS" |
| 1484 | "Teardown Request (0x%08x).\n") ); |
| 1485 | } |
| 1486 | #if 0 |
| 1487 | if(pMac->hal.pCBackFnTxComp == NULL) |
| 1488 | { |
| 1489 | pMac->hal.pCBackFnTxComp = (tpCBackFnTxComp)limTdlsTeardownTxComplete; |
| 1490 | if(TX_SUCCESS != tx_timer_activate(&pMac->hal.txCompTimer)) |
| 1491 | { |
| 1492 | status = eHAL_STATUS_FAILURE; |
| 1493 | return status; |
| 1494 | |
| 1495 | } |
| 1496 | } |
| 1497 | else |
| 1498 | { |
| 1499 | VOS_ASSERT(0) ; |
| 1500 | return status ; |
| 1501 | } |
| 1502 | #endif |
| 1503 | |
| 1504 | if( addIeLen != 0 ) |
| 1505 | { |
| 1506 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("Copy Additional Ie Len = %d"), |
| 1507 | addIeLen )); |
| 1508 | palCopyMemory( pMac->hHdd, pFrame + header_offset + nPayload, addIe, addIeLen ); |
| 1509 | } |
| 1510 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1511 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1512 | if (padLen != 0) |
| 1513 | { |
| 1514 | /* QCOM VENDOR OUI = { 0x00, 0xA0, 0xC6, type = 0x0000 }; */ |
| 1515 | tANI_U8 *padVendorSpecific = pFrame + header_offset + nPayload + addIeLen; |
| 1516 | /* make QCOM_VENDOR_OUI, and type = 0x0000, and all the payload to be zero */ |
| 1517 | padVendorSpecific[0] = 221; |
| 1518 | padVendorSpecific[1] = padLen - 2; |
| 1519 | padVendorSpecific[2] = 0x00; |
| 1520 | padVendorSpecific[3] = 0xA0; |
| 1521 | padVendorSpecific[4] = 0xC6; |
| 1522 | |
| 1523 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, ("Padding Vendor Specific Ie Len = %d"), |
| 1524 | padLen )); |
| 1525 | |
| 1526 | /* padding zero if more than 5 bytes are required */ |
| 1527 | if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 1528 | palZeroMemory( pMac->hHdd, pFrame + header_offset + nPayload + addIeLen + MIN_VENDOR_SPECIFIC_IE_SIZE, padLen - MIN_VENDOR_SPECIFIC_IE_SIZE); |
| 1529 | } |
| 1530 | #endif |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 1531 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -%s-> OTA"), |
| 1532 | SIR_MAC_TDLS_TEARDOWN, limTraceTdlsActionString(SIR_MAC_TDLS_TEARDOWN), |
| 1533 | (reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE) ? "AP": "DIRECT" )); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1534 | |
| 1535 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1536 | HAL_TXRX_FRM_802_11_DATA, |
| 1537 | ANI_TXDIR_TODS, |
| 1538 | 7, |
| 1539 | limTxComplete, pFrame, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1540 | limMgmtTXComplete, |
Gopichand Nakkala | d75b153 | 2013-02-15 13:33:42 -0800 | [diff] [blame] | 1541 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1542 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1543 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1544 | pMac->lim.mgmtFrameSessionId = 0xff; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1545 | limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!\n" )); |
| 1546 | return eSIR_FAILURE; |
| 1547 | |
| 1548 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1549 | pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1550 | return eSIR_SUCCESS; |
| 1551 | |
| 1552 | } |
| 1553 | |
| 1554 | /* |
| 1555 | * Send Setup RSP frame on AP link. |
| 1556 | */ |
| 1557 | static tSirRetStatus limSendTdlsSetupRspFrame(tpAniSirGlobal pMac, |
| 1558 | tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry, |
| 1559 | etdlsLinkSetupStatus setupStatus, tANI_U8 *addIe, tANI_U16 addIeLen ) |
| 1560 | { |
| 1561 | tDot11fTDLSSetupRsp tdlsSetupRsp ; |
| 1562 | tANI_U32 status = 0 ; |
| 1563 | tANI_U16 caps = 0 ; |
| 1564 | tANI_U32 nPayload = 0 ; |
| 1565 | tANI_U32 header_offset = 0 ; |
| 1566 | tANI_U32 nBytes = 0 ; |
| 1567 | tANI_U8 *pFrame; |
| 1568 | void *pPacket; |
| 1569 | eHalStatus halstatus; |
| 1570 | |
| 1571 | /* |
| 1572 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1573 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1574 | * serialization). We start by zero-initializing the structure: |
| 1575 | */ |
| 1576 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&tdlsSetupRsp, |
| 1577 | sizeof( tDot11fTDLSSetupRsp ) ); |
| 1578 | |
| 1579 | /* |
| 1580 | * setup Fixed fields, |
| 1581 | */ |
| 1582 | tdlsSetupRsp.Category.category = SIR_MAC_ACTION_TDLS; |
| 1583 | tdlsSetupRsp.Action.action = SIR_MAC_TDLS_SETUP_RSP ; |
| 1584 | tdlsSetupRsp.DialogToken.token = dialog; |
| 1585 | |
| 1586 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsSetupRsp.LinkIdentifier, |
| 1587 | peerMac, TDLS_RESPONDER) ; |
| 1588 | |
| 1589 | if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) |
| 1590 | { |
| 1591 | /* |
| 1592 | * Could not get Capabilities value |
| 1593 | * from CFG. Log error. |
| 1594 | */ |
| 1595 | limLog(pMac, LOGP, |
| 1596 | FL("could not retrieve Capabilities value\n")); |
| 1597 | } |
| 1598 | swapBitField16(caps, ( tANI_U16* )&tdlsSetupRsp.Capabilities ); |
| 1599 | |
| 1600 | /* ipopulate supported rate IE */ |
| 1601 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1602 | &tdlsSetupRsp.SuppRates, psessionEntry ); |
| 1603 | |
| 1604 | /* Populate extended supported rates */ |
| 1605 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1606 | &tdlsSetupRsp.ExtSuppRates, psessionEntry ); |
| 1607 | |
| 1608 | /* Populate extended supported rates */ |
| 1609 | PopulateDot11fTdlsExtCapability( pMac, &tdlsSetupRsp.ExtCap ); |
| 1610 | |
| 1611 | /* |
| 1612 | * TODO: we need to see if we have to support conditions where we have |
| 1613 | * EDCA parameter info element is needed a) if we need different QOS |
| 1614 | * parameters for off channel operations or QOS is not supported on |
| 1615 | * AP link and we wanted to QOS on direct link. |
| 1616 | */ |
| 1617 | /* Populate QOS info, needed for Peer U-APSD session */ |
| 1618 | /* TODO: Now hardcoded, because PopulateDot11fQOSCapsStation() depends on AP's capability, and |
| 1619 | TDLS doesn't want to depend on AP's capability */ |
| 1620 | tdlsSetupRsp.QOSCapsStation.present = 1; |
| 1621 | tdlsSetupRsp.QOSCapsStation.max_sp_length = 0; |
| 1622 | tdlsSetupRsp.QOSCapsStation.qack = 0; |
| 1623 | tdlsSetupRsp.QOSCapsStation.acbe_uapsd = 1; |
| 1624 | tdlsSetupRsp.QOSCapsStation.acbk_uapsd = 1; |
| 1625 | tdlsSetupRsp.QOSCapsStation.acvi_uapsd = 1; |
| 1626 | tdlsSetupRsp.QOSCapsStation.acvo_uapsd = 1; |
| 1627 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1628 | PopulateDot11fHTCaps( pMac, NULL, &tdlsSetupRsp.HTCaps ); |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1629 | if (psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1630 | { |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1631 | tdlsSetupRsp.HTCaps.present = 1; |
| 1632 | tdlsSetupRsp.HTCaps.supportedChannelWidthSet = 0; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1633 | } |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1634 | else |
| 1635 | { |
| 1636 | if (tdlsSetupRsp.HTCaps.present) |
| 1637 | { |
| 1638 | tdlsSetupRsp.HTCaps.supportedChannelWidthSet = 1; // pVhtCaps->supportedChannelWidthSet; |
| 1639 | } |
| 1640 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1641 | /* Include VHT Capability IE */ |
| 1642 | PopulateDot11fVHTCaps( pMac, &tdlsSetupRsp.VHTCaps ); |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1643 | if (psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1644 | { |
Hoonki Lee | 2dc3941 | 2013-03-12 16:35:22 -0700 | [diff] [blame] | 1645 | tdlsSetupRsp.VHTCaps.present = 0; |
| 1646 | tdlsSetupRsp.VHTCaps.supportedChannelWidthSet = 0; |
| 1647 | tdlsSetupRsp.VHTCaps.ldpcCodingCap = 0; |
| 1648 | tdlsSetupRsp.VHTCaps.suBeamFormerCap = 0; |
| 1649 | } |
| 1650 | else |
| 1651 | { |
| 1652 | if (tdlsSetupRsp.VHTCaps.present) |
| 1653 | { |
| 1654 | tdlsSetupRsp.VHTCaps.supportedChannelWidthSet = 1; // pVhtCaps->supportedChannelWidthSet; |
| 1655 | tdlsSetupRsp.VHTCaps.ldpcCodingCap = 1; // pVhtCaps->ldpcCodingCap |
| 1656 | tdlsSetupRsp.VHTCaps.suBeamFormerCap = 1; // pVhtCaps->suBeamFormerCap |
| 1657 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1658 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1659 | tdlsSetupRsp.Status.status = setupStatus ; |
| 1660 | |
| 1661 | /* |
| 1662 | * now we pack it. First, how much space are we going to need? |
| 1663 | */ |
| 1664 | status = dot11fGetPackedTDLSSetupRspSize( pMac, &tdlsSetupRsp, |
| 1665 | &nPayload); |
| 1666 | if ( DOT11F_FAILED( status ) ) |
| 1667 | { |
| 1668 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 1669 | "or a discovery Request (0x%08x).\n"), status ); |
| 1670 | /* We'll fall back on the worst case scenario: */ |
| 1671 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1672 | } |
| 1673 | else if ( DOT11F_WARNED( status ) ) |
| 1674 | { |
| 1675 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1676 | "the packed size for a discovery Request (" |
| 1677 | "0x%08x).\n"), status ); |
| 1678 | } |
| 1679 | |
| 1680 | /* |
| 1681 | * This frame is going out from PE as data frames with special ethertype |
| 1682 | * 89-0d. |
| 1683 | * 8 bytes of RFC 1042 header |
| 1684 | */ |
| 1685 | |
| 1686 | |
| 1687 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) |
| 1688 | + sizeof( eth_890d_header ) |
| 1689 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1690 | + addIeLen; |
| 1691 | |
| 1692 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1693 | |
| 1694 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1695 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1696 | ( void** ) &pPacket ); |
| 1697 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1698 | { |
| 1699 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS" |
| 1700 | "Discovery Request.\n"), nBytes ); |
| 1701 | return eSIR_MEM_ALLOC_FAILED; |
| 1702 | } |
| 1703 | |
| 1704 | /* zero out the memory */ |
| 1705 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 1706 | |
| 1707 | /* |
| 1708 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1709 | * request frame |
| 1710 | */ |
| 1711 | |
| 1712 | /* fill out the buffer descriptor */ |
| 1713 | |
| 1714 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 1715 | LINK_IDEN_ADDR_OFFSET(tdlsSetupRsp), |
| 1716 | TDLS_LINK_AP, TDLS_RESPONDER, |
| 1717 | psessionEntry) ; |
| 1718 | |
| 1719 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 1720 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_RSP) |
| 1721 | { |
| 1722 | tdlsSetupRsp.LinkIdentifier.bssid[4] = 0xde; |
| 1723 | tdlsSetupRsp.LinkIdentifier.bssid[5] = 0xad; |
| 1724 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 1725 | ("TDLS negative running: wrong BSSID %02x:%02x:%02x:%02x:%02x:%02x in TDLS Setup Rsp\n"), \ |
| 1726 | tdlsSetupRsp.LinkIdentifier.bssid[0], |
| 1727 | tdlsSetupRsp.LinkIdentifier.bssid[1], |
| 1728 | tdlsSetupRsp.LinkIdentifier.bssid[2], |
| 1729 | tdlsSetupRsp.LinkIdentifier.bssid[3], |
| 1730 | tdlsSetupRsp.LinkIdentifier.bssid[4], |
| 1731 | tdlsSetupRsp.LinkIdentifier.bssid[5]); |
| 1732 | } |
| 1733 | #endif |
| 1734 | status = dot11fPackTDLSSetupRsp( pMac, &tdlsSetupRsp, pFrame |
| 1735 | + header_offset, nPayload, &nPayload ); |
| 1736 | |
| 1737 | if ( DOT11F_FAILED( status ) ) |
| 1738 | { |
| 1739 | limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req \ |
| 1740 | (0x%08x).\n"), status ); |
| 1741 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1742 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1743 | return eSIR_FAILURE; |
| 1744 | } |
| 1745 | else if ( DOT11F_WARNED( status ) ) |
| 1746 | { |
| 1747 | limLog( pMac, LOGW, FL("There were warnings while packing TDLS" |
| 1748 | "Discovery Request (0x%08x).\n") ); |
| 1749 | } |
| 1750 | |
| 1751 | //Copy the additional IE. |
| 1752 | //TODO : addIe is added at the end of the frame. This means it doesnt |
| 1753 | //follow the order. This should be ok, but we should consider changing this |
| 1754 | //if there is any IOT issue. |
| 1755 | if( addIeLen != 0 ) |
| 1756 | { |
| 1757 | palCopyMemory( pMac->hHdd, pFrame + header_offset + nPayload, addIe, addIeLen ); |
| 1758 | } |
| 1759 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 1760 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA"), |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1761 | SIR_MAC_TDLS_SETUP_RSP, limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_RSP) )); |
| 1762 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1763 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1764 | HAL_TXRX_FRM_802_11_DATA, |
| 1765 | ANI_TXDIR_TODS, |
| 1766 | //ANI_TXDIR_IBSS, |
| 1767 | 7, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1768 | limTxComplete, pFrame, |
| 1769 | limMgmtTXComplete, |
| 1770 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1771 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1772 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1773 | pMac->lim.mgmtFrameSessionId = 0xff; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1774 | limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!\n" )); |
| 1775 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1776 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1777 | pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1778 | |
| 1779 | return eSIR_SUCCESS; |
| 1780 | |
| 1781 | } |
| 1782 | |
| 1783 | /* |
| 1784 | * Send TDLS setup CNF frame on AP link |
| 1785 | */ |
| 1786 | |
| 1787 | tSirRetStatus limSendTdlsLinkSetupCnfFrame(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
| 1788 | tANI_U8 dialog, tpPESession psessionEntry, tANI_U8* addIe, tANI_U16 addIeLen) |
| 1789 | { |
| 1790 | tDot11fTDLSSetupCnf tdlsSetupCnf ; |
| 1791 | tANI_U32 status = 0 ; |
| 1792 | tANI_U32 nPayload = 0 ; |
| 1793 | tANI_U32 nBytes = 0 ; |
| 1794 | tANI_U32 header_offset = 0 ; |
| 1795 | tANI_U8 *pFrame; |
| 1796 | void *pPacket; |
| 1797 | eHalStatus halstatus; |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 1798 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1799 | tANI_U32 padLen = 0; |
| 1800 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1801 | |
| 1802 | /* |
| 1803 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1804 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1805 | * serialization). We start by zero-initializing the structure: |
| 1806 | */ |
| 1807 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&tdlsSetupCnf, |
| 1808 | sizeof( tDot11fTDLSSetupCnf ) ); |
| 1809 | |
| 1810 | /* |
| 1811 | * setup Fixed fields, |
| 1812 | */ |
| 1813 | tdlsSetupCnf.Category.category = SIR_MAC_ACTION_TDLS; |
| 1814 | tdlsSetupCnf.Action.action = SIR_MAC_TDLS_SETUP_CNF ; |
| 1815 | tdlsSetupCnf.DialogToken.token = dialog ; |
| 1816 | |
| 1817 | #if 1 |
| 1818 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsSetupCnf.LinkIdentifier, |
| 1819 | peerMac, TDLS_INITIATOR) ; |
| 1820 | #else |
| 1821 | palCopyMemory( pMac->hHdd, (tANI_U8 *)&tdlsSetupCnf.LinkIdentifier, |
| 1822 | (tANI_U8 *)&setupRsp->LinkIdentifier, sizeof(tDot11fIELinkIdentifier)) ; |
| 1823 | #endif |
| 1824 | |
| 1825 | /* |
| 1826 | * TODO: we need to see if we have to support conditions where we have |
| 1827 | * EDCA parameter info element is needed a) if we need different QOS |
| 1828 | * parameters for off channel operations or QOS is not supported on |
| 1829 | * AP link and we wanted to QOS on direct link. |
| 1830 | */ |
| 1831 | |
| 1832 | /* Include HT Info IE */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1833 | /* Need to also check the Self Capability ??? TODO Sunil */ |
| 1834 | if ( true == psessionEntry->htCapability) |
| 1835 | { |
| 1836 | PopulateDot11fHTInfo( pMac, &tdlsSetupCnf.HTInfo, psessionEntry ); |
| 1837 | } |
| 1838 | if ( true == psessionEntry->vhtCapability) |
| 1839 | { |
| 1840 | PopulateDot11fVHTOperation( pMac, &tdlsSetupCnf.VHTOperation); |
| 1841 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1842 | |
| 1843 | /* |
| 1844 | * now we pack it. First, how much space are we going to need? |
| 1845 | */ |
| 1846 | status = dot11fGetPackedTDLSSetupCnfSize( pMac, &tdlsSetupCnf, |
| 1847 | &nPayload); |
| 1848 | if ( DOT11F_FAILED( status ) ) |
| 1849 | { |
| 1850 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 1851 | "or a discovery Request (0x%08x).\n"), status ); |
| 1852 | /* We'll fall back on the worst case scenario: */ |
| 1853 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1854 | } |
| 1855 | else if ( DOT11F_WARNED( status ) ) |
| 1856 | { |
| 1857 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1858 | "the packed size for a discovery Request (" |
| 1859 | "0x%08x).\n"), status ); |
| 1860 | } |
| 1861 | |
| 1862 | /* |
| 1863 | * This frame is going out from PE as data frames with special ethertype |
| 1864 | * 89-0d. |
| 1865 | * 8 bytes of RFC 1042 header |
| 1866 | */ |
| 1867 | |
| 1868 | |
| 1869 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) |
| 1870 | + sizeof( eth_890d_header ) |
| 1871 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1872 | + addIeLen; |
| 1873 | |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 1874 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1875 | /* IOT issue with some AP : some AP doesn't like the data packet size < minimum 802.3 frame length (64) |
| 1876 | Hence AP itself padding some bytes, which caused teardown packet is dropped at |
| 1877 | receiver side. To avoid such IOT issue, we added some extra bytes to meet data frame size >= 64 |
| 1878 | */ |
| 1879 | if (nPayload + PAYLOAD_TYPE_TDLS_SIZE < MIN_IEEE_8023_SIZE) |
| 1880 | { |
| 1881 | padLen = MIN_IEEE_8023_SIZE - (nPayload + PAYLOAD_TYPE_TDLS_SIZE ) ; |
| 1882 | |
| 1883 | /* if padLen is less than minimum vendorSpecific (5), pad up to 5 */ |
| 1884 | if (padLen < MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 1885 | padLen = MIN_VENDOR_SPECIFIC_IE_SIZE; |
| 1886 | |
| 1887 | nBytes += padLen; |
| 1888 | } |
| 1889 | #endif |
| 1890 | |
| 1891 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1892 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1893 | |
| 1894 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1895 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1896 | ( void** ) &pPacket ); |
| 1897 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1898 | { |
| 1899 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TDLS" |
| 1900 | "Discovery Request.\n"), nBytes ); |
| 1901 | return eSIR_MEM_ALLOC_FAILED; |
| 1902 | } |
| 1903 | |
| 1904 | /* zero out the memory */ |
| 1905 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 1906 | |
| 1907 | /* |
| 1908 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1909 | * request frame |
| 1910 | */ |
| 1911 | |
| 1912 | /* fill out the buffer descriptor */ |
| 1913 | |
| 1914 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 1915 | LINK_IDEN_ADDR_OFFSET(tdlsSetupCnf), TDLS_LINK_AP, TDLS_INITIATOR, |
| 1916 | psessionEntry) ; |
| 1917 | |
| 1918 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 1919 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_STATUS_37_IN_SETUP_CNF) { |
| 1920 | tdlsSetupCnf.StatusCode.statusCode = 37; |
| 1921 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 1922 | ("TDLS negative running: StatusCode = 37 in TDLS Setup Cnf\n")); |
| 1923 | } |
| 1924 | #endif |
| 1925 | status = dot11fPackTDLSSetupCnf( pMac, &tdlsSetupCnf, pFrame |
| 1926 | + header_offset, nPayload, &nPayload ); |
| 1927 | |
| 1928 | if ( DOT11F_FAILED( status ) ) |
| 1929 | { |
| 1930 | limLog( pMac, LOGE, FL("Failed to pack a TDLS discovery req \ |
| 1931 | (0x%08x).\n"), status ); |
| 1932 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1933 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1934 | return eSIR_FAILURE; |
| 1935 | } |
| 1936 | else if ( DOT11F_WARNED( status ) ) |
| 1937 | { |
| 1938 | limLog( pMac, LOGW, FL("There were warnings while packing TDLS" |
| 1939 | "Discovery Request (0x%08x).\n") ); |
| 1940 | } |
| 1941 | #if 0 |
| 1942 | if(pMac->hal.pCBackFnTxComp == NULL) |
| 1943 | { |
| 1944 | pMac->hal.pCBackFnTxComp = (tpCBackFnTxComp)limTdlsSetupCnfTxComplete; |
| 1945 | if(TX_SUCCESS != tx_timer_activate(&pMac->hal.txCompTimer)) |
| 1946 | { |
| 1947 | status = eHAL_STATUS_FAILURE; |
| 1948 | return status; |
| 1949 | |
| 1950 | } |
| 1951 | } |
| 1952 | else |
| 1953 | { |
| 1954 | VOS_ASSERT(0) ; |
| 1955 | return status ; |
| 1956 | } |
| 1957 | #endif |
| 1958 | //Copy the additional IE. |
| 1959 | //TODO : addIe is added at the end of the frame. This means it doesnt |
| 1960 | //follow the order. This should be ok, but we should consider changing this |
| 1961 | //if there is any IOT issue. |
| 1962 | if( addIeLen != 0 ) |
| 1963 | { |
| 1964 | palCopyMemory( pMac->hHdd, pFrame + header_offset + nPayload, addIe, addIeLen ); |
| 1965 | } |
| 1966 | |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 1967 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1968 | if (padLen != 0) |
| 1969 | { |
| 1970 | /* QCOM VENDOR OUI = { 0x00, 0xA0, 0xC6, type = 0x0000 }; */ |
| 1971 | tANI_U8 *padVendorSpecific = pFrame + header_offset + nPayload + addIeLen; |
| 1972 | /* make QCOM_VENDOR_OUI, and type = 0x0000, and all the payload to be zero */ |
| 1973 | padVendorSpecific[0] = 221; |
| 1974 | padVendorSpecific[1] = padLen - 2; |
| 1975 | padVendorSpecific[2] = 0x00; |
| 1976 | padVendorSpecific[3] = 0xA0; |
| 1977 | padVendorSpecific[4] = 0xC6; |
| 1978 | |
| 1979 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, ("Padding Vendor Specific Ie Len = %d"), |
| 1980 | padLen )); |
| 1981 | |
| 1982 | /* padding zero if more than 5 bytes are required */ |
| 1983 | if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 1984 | palZeroMemory( pMac->hHdd, pFrame + header_offset + nPayload + addIeLen + MIN_VENDOR_SPECIFIC_IE_SIZE, padLen - MIN_VENDOR_SPECIFIC_IE_SIZE); |
| 1985 | } |
| 1986 | #endif |
| 1987 | |
| 1988 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 1989 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, ("[TDLS] action %d (%s) -AP-> OTA"), |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1990 | SIR_MAC_TDLS_SETUP_CNF, limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_CNF) )); |
| 1991 | |
| 1992 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1993 | HAL_TXRX_FRM_802_11_DATA, |
| 1994 | ANI_TXDIR_TODS, |
| 1995 | 7, |
| 1996 | limTxComplete, pFrame, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1997 | limMgmtTXComplete, |
Gopichand Nakkala | d75b153 | 2013-02-15 13:33:42 -0800 | [diff] [blame] | 1998 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1999 | |
| 2000 | |
| 2001 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2002 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2003 | pMac->lim.mgmtFrameSessionId = 0xff; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2004 | limLog( pMac, LOGE, FL("could not send TDLS Dis Request frame!\n" )); |
| 2005 | return eSIR_FAILURE; |
| 2006 | |
| 2007 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2008 | pMac->lim.mgmtFrameSessionId = psessionEntry->peSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2009 | |
| 2010 | return eSIR_SUCCESS; |
| 2011 | } |
| 2012 | |
| 2013 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 2014 | /* |
| 2015 | * Convert HT caps to lim based HT caps |
| 2016 | */ |
| 2017 | static void limTdlsCovertHTCaps(tpAniSirGlobal pMac , |
| 2018 | tSirTdlsPeerInfo *peerInfo, tDot11fIEHTCaps *HTCaps) |
| 2019 | { |
| 2020 | |
| 2021 | /* HT Capability Info */ |
| 2022 | peerInfo->tdlsPeerHtCaps.advCodingCap = HTCaps->advCodingCap ; |
| 2023 | peerInfo->tdlsPeerHtCaps.supportedChannelWidthSet = |
| 2024 | HTCaps->supportedChannelWidthSet ; |
| 2025 | peerInfo->tdlsPeerHtCaps.mimoPowerSave = HTCaps->mimoPowerSave ; |
| 2026 | peerInfo->tdlsPeerHtCaps.greenField = HTCaps->greenField ; |
| 2027 | peerInfo->tdlsPeerHtCaps.shortGI20MHz = HTCaps->shortGI20MHz ; |
| 2028 | peerInfo->tdlsPeerHtCaps.shortGI40MHz = HTCaps->shortGI40MHz ; |
| 2029 | peerInfo->tdlsPeerHtCaps.txSTBC = HTCaps->txSTBC ; |
| 2030 | peerInfo->tdlsPeerHtCaps.rxSTBC = HTCaps->rxSTBC ; |
| 2031 | peerInfo->tdlsPeerHtCaps.delayedBA = HTCaps->delayedBA; |
| 2032 | peerInfo->tdlsPeerHtCaps.maximalAMSDUsize = HTCaps->maximalAMSDUsize ; |
| 2033 | peerInfo->tdlsPeerHtCaps.dsssCckMode40MHz = HTCaps->dsssCckMode40MHz ; |
| 2034 | peerInfo->tdlsPeerHtCaps.psmp = HTCaps->stbcControlFrame ; |
| 2035 | peerInfo->tdlsPeerHtCaps.stbcControlFrame = HTCaps->stbcControlFrame ; |
| 2036 | peerInfo->tdlsPeerHtCaps.lsigTXOPProtection = |
| 2037 | HTCaps->lsigTXOPProtection ; |
| 2038 | |
| 2039 | /* HT Capa parameters */ |
| 2040 | peerInfo->tdlsPeerHtParams.maxRxAMPDUFactor = HTCaps->maxRxAMPDUFactor ; |
| 2041 | peerInfo->tdlsPeerHtParams.mpduDensity = HTCaps->mpduDensity ; |
| 2042 | peerInfo->tdlsPeerHtParams.reserved = HTCaps->reserved1 ; |
| 2043 | |
| 2044 | /* Extended HT caps */ |
| 2045 | peerInfo->tdlsPeerHtExtCaps.pco = HTCaps->pco ; |
| 2046 | peerInfo->tdlsPeerHtExtCaps.transitionTime = HTCaps->transitionTime ; |
| 2047 | peerInfo->tdlsPeerHtExtCaps.mcsFeedback = HTCaps->mcsFeedback ; |
| 2048 | palCopyMemory(pMac->hHdd, peerInfo->supportedMCSSet, |
| 2049 | HTCaps->supportedMCSSet, SIZE_OF_SUPPORTED_MCS_SET) ; |
| 2050 | |
| 2051 | return ; |
| 2052 | } |
| 2053 | |
| 2054 | /* |
| 2055 | * update capability info.. |
| 2056 | */ |
| 2057 | void tdlsUpdateCapInfo(tSirMacCapabilityInfo *capabilityInfo, |
| 2058 | tDot11fFfCapabilities *Capabilities) |
| 2059 | { |
| 2060 | |
| 2061 | capabilityInfo->ess = Capabilities->ess; |
| 2062 | capabilityInfo->ibss = Capabilities->ibss; |
| 2063 | capabilityInfo->cfPollable = Capabilities->cfPollable; |
| 2064 | capabilityInfo->cfPollReq = Capabilities->cfPollReq; |
| 2065 | capabilityInfo->privacy = Capabilities->privacy; |
| 2066 | capabilityInfo->shortPreamble = Capabilities->shortPreamble; |
| 2067 | capabilityInfo->pbcc = Capabilities->pbcc; |
| 2068 | capabilityInfo->channelAgility = Capabilities->channelAgility; |
| 2069 | capabilityInfo->spectrumMgt = Capabilities->spectrumMgt; |
| 2070 | capabilityInfo->qos = Capabilities->qos; |
| 2071 | capabilityInfo->shortSlotTime = Capabilities->shortSlotTime; |
| 2072 | capabilityInfo->apsd = Capabilities->apsd; |
| 2073 | capabilityInfo->rrm = Capabilities->rrm; |
| 2074 | capabilityInfo->dsssOfdm = Capabilities->dsssOfdm; |
| 2075 | capabilityInfo->immediateBA = Capabilities->immediateBA; |
| 2076 | |
| 2077 | return ; |
| 2078 | } |
| 2079 | |
| 2080 | /* |
| 2081 | * update Peer info from the link request frame recieved from Peer.. |
| 2082 | * in list of STA participating in TDLS link setup |
| 2083 | */ |
| 2084 | void limTdlsUpdateLinkReqPeerInfo(tpAniSirGlobal pMac, |
| 2085 | tLimTdlsLinkSetupPeer *setupPeer, |
| 2086 | tDot11fTDLSSetupReq *setupReq) |
| 2087 | { |
| 2088 | |
| 2089 | /* Populate peer info of tdls discovery result */ |
| 2090 | |
| 2091 | tdlsUpdateCapInfo(&setupPeer->capabilityInfo , &setupReq->Capabilities) ; |
| 2092 | |
| 2093 | if(setupReq->SuppRates.present) |
| 2094 | { |
| 2095 | ConvertSuppRates( pMac, &setupPeer->supportedRates, |
| 2096 | &setupReq->SuppRates ); |
| 2097 | } |
| 2098 | |
| 2099 | /* update QOS info, needed for Peer U-APSD session */ |
| 2100 | if(setupReq->QOSCapsStation.present) |
| 2101 | { |
| 2102 | ConvertQOSCapsStation(pMac->hHdd, &setupPeer->qosCaps, |
| 2103 | &setupReq->QOSCapsStation) ; |
| 2104 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,("setupReq->SPLen=%d (be %d %d %d %d vo) more %d qack %d.\n"), \ |
| 2105 | setupReq->QOSCapsStation.max_sp_length, setupReq->QOSCapsStation.acbe_uapsd, \ |
| 2106 | setupReq->QOSCapsStation.acbk_uapsd, setupReq->QOSCapsStation.acvi_uapsd, \ |
| 2107 | setupReq->QOSCapsStation.acvo_uapsd, setupReq->QOSCapsStation.more_data_ack, \ |
| 2108 | setupReq->QOSCapsStation.qack)); |
| 2109 | } |
| 2110 | |
| 2111 | if(setupReq->ExtSuppRates.present) |
| 2112 | { |
| 2113 | setupPeer->ExtRatesPresent = 1; |
| 2114 | ConvertExtSuppRates( pMac, &setupPeer->extendedRates, |
| 2115 | &setupReq->ExtSuppRates ); |
| 2116 | } |
| 2117 | /* update HT caps */ |
| 2118 | if(setupReq->HTCaps.present) |
| 2119 | { |
| 2120 | palCopyMemory(pMac->hHdd, &setupPeer->tdlsPeerHTCaps, |
| 2121 | &setupReq->HTCaps, sizeof(tDot11fIEHTCaps)) ; |
| 2122 | } |
| 2123 | /* Update EXT caps */ |
| 2124 | if(setupReq->ExtCap.present) |
| 2125 | { |
| 2126 | palCopyMemory(pMac->hHdd, &setupPeer->tdlsPeerExtCaps, |
| 2127 | &setupReq->ExtCap, sizeof(tDot11fIEExtCap)) ; |
| 2128 | } |
| 2129 | |
| 2130 | return ; |
| 2131 | } |
| 2132 | |
| 2133 | /* |
| 2134 | * update peer Info recieved with TDLS setup RSP |
| 2135 | */ |
| 2136 | void limTdlsUpdateLinkRspPeerInfo(tpAniSirGlobal pMac, |
| 2137 | tLimTdlsLinkSetupPeer *setupPeer, |
| 2138 | tDot11fTDLSSetupRsp *setupRsp) |
| 2139 | { |
| 2140 | |
| 2141 | /* Populate peer info of tdls discovery result */ |
| 2142 | tdlsUpdateCapInfo(&setupPeer->capabilityInfo , &setupRsp->Capabilities) ; |
| 2143 | |
| 2144 | if(setupRsp->SuppRates.present) |
| 2145 | { |
| 2146 | tDot11fIESuppRates *suppRates = &setupRsp->SuppRates ; |
| 2147 | ConvertSuppRates( pMac, &setupPeer->supportedRates, suppRates); |
| 2148 | } |
| 2149 | |
| 2150 | /* update QOS info, needed for Peer U-APSD session */ |
| 2151 | if(setupRsp->QOSCapsStation.present) |
| 2152 | { |
| 2153 | ConvertQOSCapsStation(pMac->hHdd, &setupPeer->qosCaps, |
| 2154 | &setupRsp->QOSCapsStation) ; |
| 2155 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("setupRsp->SPLen=%d (be %d %d %d %d vo) more %d qack %d.\n"), \ |
| 2156 | setupRsp->QOSCapsStation.max_sp_length, setupRsp->QOSCapsStation.acbe_uapsd, \ |
| 2157 | setupRsp->QOSCapsStation.acbk_uapsd, setupRsp->QOSCapsStation.acvi_uapsd, \ |
| 2158 | setupRsp->QOSCapsStation.acvo_uapsd, setupRsp->QOSCapsStation.more_data_ack, \ |
| 2159 | setupRsp->QOSCapsStation.qack)); |
| 2160 | } |
| 2161 | |
| 2162 | if(setupRsp->ExtSuppRates.present) |
| 2163 | { |
| 2164 | setupPeer->ExtRatesPresent = 1; |
| 2165 | ConvertExtSuppRates( pMac, &setupPeer->extendedRates, |
| 2166 | &setupRsp->ExtSuppRates ); |
| 2167 | } |
| 2168 | /* update HT caps */ |
| 2169 | if(setupRsp->HTCaps.present) |
| 2170 | { |
| 2171 | palCopyMemory(pMac->hHdd, &setupPeer->tdlsPeerHTCaps, |
| 2172 | &setupRsp->HTCaps, sizeof(tDot11fIEHTCaps)) ; |
| 2173 | } |
| 2174 | |
| 2175 | /* update EXT caps */ |
| 2176 | if(setupRsp->ExtCap.present) |
| 2177 | { |
| 2178 | palCopyMemory(pMac->hHdd, &setupPeer->tdlsPeerExtCaps, |
| 2179 | &setupRsp->ExtCap, sizeof(tDot11fIEExtCap)) ; |
| 2180 | } |
| 2181 | |
| 2182 | return ; |
| 2183 | } |
| 2184 | #endif |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2185 | |
| 2186 | /* This Function is similar to PopulateDot11fHTCaps , except that the HT Capabilities |
| 2187 | * are considered from the AddStaReq rather from the cfg.dat as in PopulateDot11fHTCaps |
| 2188 | */ |
| 2189 | static tSirRetStatus limTdlsPopulateDot11fHTCaps(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 2190 | tSirTdlsAddStaReq *pTdlsAddStaReq, tDot11fIEHTCaps *pDot11f) |
| 2191 | { |
| 2192 | tANI_U32 nCfgValue; |
| 2193 | tANI_U8 nCfgValue8; |
| 2194 | tSirMacHTParametersInfo *pHTParametersInfo; |
| 2195 | union { |
| 2196 | tANI_U16 nCfgValue16; |
| 2197 | tSirMacHTCapabilityInfo htCapInfo; |
| 2198 | tSirMacExtendedHTCapabilityInfo extHtCapInfo; |
| 2199 | } uHTCapabilityInfo; |
| 2200 | |
| 2201 | tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo; |
| 2202 | tSirMacASCapabilityInfo *pASCapabilityInfo; |
| 2203 | |
| 2204 | nCfgValue = pTdlsAddStaReq->htCap.capInfo; |
| 2205 | |
| 2206 | uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF; |
| 2207 | |
| 2208 | pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap; |
| 2209 | pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave; |
| 2210 | pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField; |
| 2211 | pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz; |
| 2212 | pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz; |
| 2213 | pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC; |
| 2214 | pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC; |
| 2215 | pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA; |
| 2216 | pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize; |
| 2217 | pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz; |
| 2218 | pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp; |
| 2219 | pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame; |
| 2220 | pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection; |
| 2221 | |
| 2222 | // All sessionized entries will need the check below |
| 2223 | if (psessionEntry == NULL) // Only in case of NO session |
| 2224 | { |
| 2225 | pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet; |
| 2226 | } |
| 2227 | else |
| 2228 | { |
| 2229 | pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet; |
| 2230 | } |
| 2231 | |
| 2232 | /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is |
| 2233 | eHT_CHANNEL_WIDTH_20MHZ */ |
| 2234 | if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) |
| 2235 | { |
| 2236 | pDot11f->shortGI40MHz = 0; |
| 2237 | } |
| 2238 | |
| 2239 | dot11fLog(pMac, LOG2, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d"), |
| 2240 | pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave, pDot11f->greenField, |
| 2241 | pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz); |
| 2242 | |
| 2243 | nCfgValue = pTdlsAddStaReq->htCap.ampduParamsInfo; |
| 2244 | |
| 2245 | nCfgValue8 = ( tANI_U8 ) nCfgValue; |
| 2246 | pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8; |
| 2247 | |
| 2248 | pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor; |
| 2249 | pDot11f->mpduDensity = pHTParametersInfo->mpduDensity; |
| 2250 | pDot11f->reserved1 = pHTParametersInfo->reserved; |
| 2251 | |
| 2252 | dot11fLog( pMac, LOG2, FL( "AMPDU Param: %x" ), nCfgValue); |
| 2253 | |
| 2254 | palCopyMemory(pMac->hHdd, pDot11f->supportedMCSSet, pTdlsAddStaReq->htCap.suppMcsSet, SIZE_OF_SUPPORTED_MCS_SET); |
| 2255 | |
| 2256 | nCfgValue = pTdlsAddStaReq->htCap.extendedHtCapInfo; |
| 2257 | |
| 2258 | uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF; |
| 2259 | |
| 2260 | pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco; |
| 2261 | pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime; |
| 2262 | pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback; |
| 2263 | |
| 2264 | nCfgValue = pTdlsAddStaReq->htCap.txBFCapInfo; |
| 2265 | |
| 2266 | pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue; |
| 2267 | pDot11f->txBF = pTxBFCapabilityInfo->txBF; |
| 2268 | pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding; |
| 2269 | pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding; |
| 2270 | pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF; |
| 2271 | pDot11f->txZLF = pTxBFCapabilityInfo->txZLF; |
| 2272 | pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF; |
| 2273 | pDot11f->calibration = pTxBFCapabilityInfo->calibration; |
| 2274 | pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF; |
| 2275 | pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix; |
| 2276 | pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback; |
| 2277 | pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback; |
| 2278 | pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback; |
| 2279 | pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae; |
| 2280 | pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae; |
| 2281 | pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae; |
| 2282 | |
| 2283 | nCfgValue = pTdlsAddStaReq->htCap.antennaSelectionInfo; |
| 2284 | |
| 2285 | nCfgValue8 = ( tANI_U8 ) nCfgValue; |
| 2286 | |
| 2287 | pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8; |
| 2288 | pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection; |
| 2289 | pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx; |
| 2290 | pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx; |
| 2291 | pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback; |
| 2292 | pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback; |
| 2293 | pDot11f->rxAS = pASCapabilityInfo->rxAS; |
| 2294 | pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs; |
| 2295 | |
| 2296 | pDot11f->present = 1; |
| 2297 | |
| 2298 | return eSIR_SUCCESS; |
| 2299 | |
| 2300 | } |
| 2301 | |
| 2302 | tSirRetStatus |
| 2303 | limTdlsPopulateDot11fVHTCaps(tpAniSirGlobal pMac, |
| 2304 | tSirTdlsAddStaReq *pTdlsAddStaReq, |
| 2305 | tDot11fIEVHTCaps *pDot11f) |
| 2306 | { |
| 2307 | tANI_U32 nCfgValue=0; |
| 2308 | union { |
| 2309 | tANI_U32 nCfgValue32; |
| 2310 | tSirMacVHTCapabilityInfo vhtCapInfo; |
| 2311 | } uVHTCapabilityInfo; |
| 2312 | union { |
| 2313 | tANI_U16 nCfgValue16; |
| 2314 | tSirMacVHTTxSupDataRateInfo vhtTxSupDataRateInfo; |
| 2315 | tSirMacVHTRxSupDataRateInfo vhtRxsupDataRateInfo; |
| 2316 | } uVHTSupDataRateInfo; |
| 2317 | |
| 2318 | pDot11f->present = 1; |
| 2319 | |
| 2320 | nCfgValue = pTdlsAddStaReq->vhtCap.vhtCapInfo; |
| 2321 | uVHTCapabilityInfo.nCfgValue32 = nCfgValue; |
| 2322 | |
| 2323 | pDot11f->maxMPDULen = uVHTCapabilityInfo.vhtCapInfo.maxMPDULen; |
| 2324 | pDot11f->supportedChannelWidthSet = uVHTCapabilityInfo.vhtCapInfo.supportedChannelWidthSet; |
| 2325 | pDot11f->ldpcCodingCap = uVHTCapabilityInfo.vhtCapInfo.ldpcCodingCap; |
| 2326 | pDot11f->shortGI80MHz = uVHTCapabilityInfo.vhtCapInfo.shortGI80MHz; |
| 2327 | pDot11f->shortGI160and80plus80MHz = uVHTCapabilityInfo.vhtCapInfo.shortGI160and80plus80MHz; |
| 2328 | pDot11f->txSTBC = uVHTCapabilityInfo.vhtCapInfo.txSTBC; |
| 2329 | pDot11f->rxSTBC = uVHTCapabilityInfo.vhtCapInfo.rxSTBC; |
| 2330 | pDot11f->suBeamFormerCap = uVHTCapabilityInfo.vhtCapInfo.suBeamFormerCap; |
| 2331 | pDot11f->suBeamformeeCap = uVHTCapabilityInfo.vhtCapInfo.suBeamformeeCap; |
| 2332 | pDot11f->csnofBeamformerAntSup = uVHTCapabilityInfo.vhtCapInfo.csnofBeamformerAntSup; |
| 2333 | pDot11f->numSoundingDim = uVHTCapabilityInfo.vhtCapInfo.numSoundingDim; |
| 2334 | pDot11f->muBeamformerCap = uVHTCapabilityInfo.vhtCapInfo.muBeamformerCap; |
| 2335 | pDot11f->muBeamformeeCap = uVHTCapabilityInfo.vhtCapInfo.muBeamformeeCap; |
| 2336 | pDot11f->vhtTXOPPS = uVHTCapabilityInfo.vhtCapInfo.vhtTXOPPS; |
| 2337 | pDot11f->htcVHTCap = uVHTCapabilityInfo.vhtCapInfo.htcVHTCap; |
| 2338 | pDot11f->maxAMPDULenExp = uVHTCapabilityInfo.vhtCapInfo.maxAMPDULenExp; |
| 2339 | pDot11f->vhtLinkAdaptCap = uVHTCapabilityInfo.vhtCapInfo.vhtLinkAdaptCap; |
| 2340 | pDot11f->rxAntPattern = uVHTCapabilityInfo.vhtCapInfo.rxAntPattern; |
| 2341 | pDot11f->txAntPattern = uVHTCapabilityInfo.vhtCapInfo.txAntPattern; |
| 2342 | pDot11f->reserved1= uVHTCapabilityInfo.vhtCapInfo.reserved1; |
| 2343 | |
| 2344 | pDot11f->rxMCSMap = pTdlsAddStaReq->vhtCap.suppMcs.rxMcsMap; |
| 2345 | |
| 2346 | nCfgValue = pTdlsAddStaReq->vhtCap.suppMcs.rxHighest; |
| 2347 | uVHTSupDataRateInfo.nCfgValue16 = nCfgValue & 0xffff; |
| 2348 | pDot11f->rxHighSupDataRate = uVHTSupDataRateInfo.vhtRxsupDataRateInfo.rxSupDataRate; |
| 2349 | |
| 2350 | pDot11f->txMCSMap = pTdlsAddStaReq->vhtCap.suppMcs.txMcsMap; |
| 2351 | |
| 2352 | nCfgValue = pTdlsAddStaReq->vhtCap.suppMcs.txHighest; |
| 2353 | uVHTSupDataRateInfo.nCfgValue16 = nCfgValue & 0xffff; |
| 2354 | pDot11f->txSupDataRate = uVHTSupDataRateInfo.vhtTxSupDataRateInfo.txSupDataRate; |
| 2355 | |
| 2356 | pDot11f->reserved3= uVHTSupDataRateInfo.vhtTxSupDataRateInfo.reserved; |
| 2357 | |
| 2358 | limLogVHTCap(pMac, pDot11f); |
| 2359 | |
| 2360 | return eSIR_SUCCESS; |
| 2361 | |
| 2362 | } |
| 2363 | |
| 2364 | static tSirRetStatus |
| 2365 | limTdlsPopulateMatchingRateSet(tpAniSirGlobal pMac, |
| 2366 | tpDphHashNode pStaDs, |
| 2367 | tANI_U8 *pSupportedRateSet, |
| 2368 | tANI_U8 supporteRatesLength, |
| 2369 | tANI_U8* pSupportedMCSSet, |
| 2370 | tSirMacPropRateSet *pAniLegRateSet, |
| 2371 | tpPESession psessionEntry, |
| 2372 | tDot11fIEVHTCaps *pVHTCaps) |
| 2373 | |
| 2374 | { |
| 2375 | tSirMacRateSet tempRateSet; |
| 2376 | tANI_U32 i,j,val,min,isArate; |
| 2377 | tSirMacRateSet tempRateSet2; |
| 2378 | tANI_U32 phyMode; |
| 2379 | tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET]; |
| 2380 | isArate=0; |
| 2381 | |
| 2382 | // limGetPhyMode(pMac, &phyMode); |
| 2383 | limGetPhyMode(pMac, &phyMode, NULL); |
| 2384 | |
| 2385 | // get own rate set |
| 2386 | val = WNI_CFG_OPERATIONAL_RATE_SET_LEN; |
| 2387 | if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 2388 | (tANI_U8 *) &tempRateSet.rate, |
| 2389 | &val) != eSIR_SUCCESS) |
| 2390 | { |
| 2391 | /// Could not get rateset from CFG. Log error. |
| 2392 | limLog(pMac, LOGP, FL("could not retrieve rateset\n")); |
| 2393 | } |
| 2394 | tempRateSet.numRates = val; |
| 2395 | |
| 2396 | if (phyMode == WNI_CFG_PHY_MODE_11G) |
| 2397 | { |
| 2398 | |
| 2399 | // get own extended rate set |
| 2400 | val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN; |
| 2401 | if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 2402 | (tANI_U8 *) &tempRateSet2.rate, |
| 2403 | &val) != eSIR_SUCCESS) |
| 2404 | tempRateSet2.numRates = val; |
| 2405 | } |
| 2406 | else |
| 2407 | tempRateSet2.numRates = 0; |
| 2408 | |
| 2409 | if ((tempRateSet.numRates + tempRateSet2.numRates) > 12) |
| 2410 | { |
| 2411 | PELOGE(limLog(pMac, LOGE, FL("more than 12 rates in CFG\n"));) |
| 2412 | goto error; |
| 2413 | } |
| 2414 | |
| 2415 | /** |
| 2416 | * Handling of the rate set IEs is the following: |
| 2417 | * - keep only rates that we support and that the station supports |
| 2418 | * - sort and the rates into the pSta->rate array |
| 2419 | */ |
| 2420 | |
| 2421 | // Copy all rates in tempRateSet, there are 12 rates max |
| 2422 | for (i = 0; i < tempRateSet2.numRates; i++) |
| 2423 | tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i]; |
| 2424 | |
| 2425 | tempRateSet.numRates += tempRateSet2.numRates; |
| 2426 | |
| 2427 | /** |
| 2428 | * Sort rates in tempRateSet (they are likely to be already sorted) |
| 2429 | * put the result in tempRateSet2 |
| 2430 | */ |
| 2431 | tempRateSet2.numRates = 0; |
| 2432 | |
| 2433 | for (i = 0;i < tempRateSet.numRates; i++) |
| 2434 | { |
| 2435 | min = 0; |
| 2436 | val = 0xff; |
| 2437 | |
| 2438 | for(j = 0;j < tempRateSet.numRates; j++) |
| 2439 | if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val) |
| 2440 | { |
| 2441 | val = tempRateSet.rate[j] & 0x7f; |
| 2442 | min = j; |
| 2443 | } |
| 2444 | |
| 2445 | tempRateSet2.rate[tempRateSet2.numRates++] = tempRateSet.rate[min]; |
| 2446 | tempRateSet.rate[min] = 0xff; |
| 2447 | } |
| 2448 | |
| 2449 | /** |
| 2450 | * Copy received rates in tempRateSet, the parser has ensured |
| 2451 | * unicity of the rates so there cannot be more than 12 . Need to Check this |
| 2452 | * TODO Sunil. |
| 2453 | */ |
| 2454 | for (i = 0; i < supporteRatesLength; i++) |
| 2455 | { |
| 2456 | tempRateSet.rate[i] = pSupportedRateSet[i]; |
| 2457 | } |
| 2458 | |
| 2459 | tempRateSet.numRates = supporteRatesLength; |
| 2460 | |
| 2461 | { |
| 2462 | tpSirSupportedRates rates = &pStaDs->supportedRates; |
| 2463 | tANI_U8 aRateIndex = 0; |
| 2464 | tANI_U8 bRateIndex = 0; |
| 2465 | palZeroMemory( pMac->hHdd, (tANI_U8 *) rates, sizeof(tSirSupportedRates)); |
| 2466 | |
| 2467 | for (i = 0;i < tempRateSet2.numRates; i++) |
| 2468 | { |
| 2469 | for (j = 0;j < tempRateSet.numRates; j++) |
| 2470 | { |
| 2471 | if ((tempRateSet2.rate[i] & 0x7F) == |
| 2472 | (tempRateSet.rate[j] & 0x7F)) |
| 2473 | { |
| 2474 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 2475 | if ((bRateIndex > HAL_NUM_11B_RATES) || (aRateIndex > HAL_NUM_11A_RATES)) |
| 2476 | { |
| 2477 | limLog(pMac, LOGE, FL("Invalid number of rates (11b->%d, 11a->%d)\n"), |
| 2478 | bRateIndex, aRateIndex); |
| 2479 | return eSIR_FAILURE; |
| 2480 | } |
| 2481 | #endif |
| 2482 | if (sirIsArate(tempRateSet2.rate[i] & 0x7f)) |
| 2483 | { |
| 2484 | isArate=1; |
| 2485 | rates->llaRates[aRateIndex++] = tempRateSet2.rate[i]; |
| 2486 | } |
| 2487 | else |
| 2488 | rates->llbRates[bRateIndex++] = tempRateSet2.rate[i]; |
| 2489 | break; |
| 2490 | } |
| 2491 | } |
| 2492 | } |
| 2493 | } |
| 2494 | |
| 2495 | |
| 2496 | //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n |
| 2497 | #ifdef FEATURE_WLAN_TDLS |
| 2498 | if (pStaDs->mlmStaContext.htCapability) |
| 2499 | #else |
| 2500 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && |
| 2501 | (pStaDs->mlmStaContext.htCapability)) |
| 2502 | #endif |
| 2503 | { |
| 2504 | val = SIZE_OF_SUPPORTED_MCS_SET; |
| 2505 | if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET, |
| 2506 | mcsSet, |
| 2507 | &val) != eSIR_SUCCESS) |
| 2508 | { |
| 2509 | /// Could not get rateset from CFG. Log error. |
| 2510 | limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet\n")); |
| 2511 | goto error; |
| 2512 | } |
| 2513 | |
| 2514 | for (i=0; i<val; i++) |
| 2515 | pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i]; |
| 2516 | |
| 2517 | PELOG2(limLog(pMac, LOG2, FL("limPopulateMatchingRateSet: MCS Rate Set Bitmap from CFG and DPH :"));) |
| 2518 | for (i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 2519 | { |
| 2520 | PELOG2(limLog(pMac, LOG2,FL("%x %x "), mcsSet[i], pStaDs->supportedRates.supportedMCSSet[i]);) |
| 2521 | } |
| 2522 | } |
| 2523 | |
| 2524 | #ifdef WLAN_FEATURE_11AC |
| 2525 | limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry); |
| 2526 | #endif |
| 2527 | /** |
| 2528 | * Set the erpEnabled bit iff the phy is in G mode and at least |
| 2529 | * one A rate is supported |
| 2530 | */ |
| 2531 | if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate) |
| 2532 | pStaDs->erpEnabled = eHAL_SET; |
| 2533 | |
| 2534 | |
| 2535 | |
| 2536 | return eSIR_SUCCESS; |
| 2537 | |
| 2538 | error: |
| 2539 | |
| 2540 | return eSIR_FAILURE; |
| 2541 | } |
| 2542 | |
| 2543 | static int limTdlsSelectCBMode(tDphHashNode *pStaDs, tpPESession psessionEntry) |
| 2544 | { |
| 2545 | tANI_U8 channel = psessionEntry->currentOperChannel; |
| 2546 | |
| 2547 | if ( pStaDs->mlmStaContext.vhtCapability ) |
| 2548 | { |
| 2549 | if ( channel== 36 || channel == 52 || channel == 100 || |
| 2550 | channel == 116 || channel == 149 ) |
| 2551 | { |
| 2552 | return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1; |
| 2553 | } |
| 2554 | else if ( channel == 40 || channel == 56 || channel == 104 || |
| 2555 | channel == 120 || channel == 153 ) |
| 2556 | { |
| 2557 | return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1; |
| 2558 | } |
| 2559 | else if ( channel == 44 || channel == 60 || channel == 108 || |
| 2560 | channel == 124 || channel == 157 ) |
| 2561 | { |
| 2562 | return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1; |
| 2563 | } |
| 2564 | else if ( channel == 48 || channel == 64 || channel == 112 || |
| 2565 | channel == 128 || channel == 161 ) |
| 2566 | { |
| 2567 | return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1; |
| 2568 | } |
| 2569 | else if ( channel == 165 ) |
| 2570 | { |
| 2571 | return 0; |
| 2572 | } |
| 2573 | } |
| 2574 | else if ( pStaDs->mlmStaContext.htCapability ) |
| 2575 | { |
| 2576 | if ( channel== 40 || channel == 48 || channel == 56 || |
| 2577 | channel == 64 || channel == 104 || channel == 112 || |
| 2578 | channel == 120 || channel == 128 || channel == 136 || |
| 2579 | channel == 144 || channel == 153 || channel == 161 ) |
| 2580 | { |
| 2581 | return 1; |
| 2582 | } |
| 2583 | else if ( channel== 36 || channel == 44 || channel == 52 || |
| 2584 | channel == 60 || channel == 100 || channel == 108 || |
| 2585 | channel == 116 || channel == 124 || channel == 132 || |
| 2586 | channel == 140 || channel == 149 || channel == 157 ) |
| 2587 | { |
| 2588 | return 2; |
| 2589 | } |
| 2590 | else if ( channel == 165 ) |
| 2591 | { |
| 2592 | return 0; |
| 2593 | } |
| 2594 | } |
| 2595 | return 0; |
| 2596 | } |
| 2597 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2598 | /* |
| 2599 | * update HASH node entry info |
| 2600 | */ |
| 2601 | static void limTdlsUpdateHashNodeInfo(tpAniSirGlobal pMac, tDphHashNode *pStaDs, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2602 | tSirTdlsAddStaReq *pTdlsAddStaReq, tpPESession psessionEntry) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2603 | { |
| 2604 | //tDot11fIEHTCaps *htCaps = &setupPeerInfo->tdlsPeerHTCaps ; |
| 2605 | tDot11fIEHTCaps htCap, *htCaps; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2606 | #ifdef WLAN_FEATURE_11AC |
| 2607 | tDot11fIEVHTCaps vhtCap, *pVhtCaps; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2608 | tANI_U8 cbMode; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2609 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2610 | tpDphHashNode pSessStaDs = NULL; |
| 2611 | tANI_U16 aid; |
| 2612 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2613 | if (pTdlsAddStaReq->tdlsAddOper == TDLS_OPER_ADD) |
| 2614 | { |
| 2615 | PopulateDot11fHTCaps(pMac, psessionEntry, &htCap); |
| 2616 | } |
| 2617 | else if (pTdlsAddStaReq->tdlsAddOper == TDLS_OPER_UPDATE) |
| 2618 | { |
| 2619 | limTdlsPopulateDot11fHTCaps(pMac, NULL, pTdlsAddStaReq, &htCap); |
| 2620 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2621 | htCaps = &htCap; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2622 | if (htCaps->present) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2623 | { |
| 2624 | pStaDs->mlmStaContext.htCapability = 1 ; |
| 2625 | pStaDs->htGreenfield = htCaps->greenField ; |
| 2626 | pStaDs->htSupportedChannelWidthSet = htCaps->supportedChannelWidthSet ; |
| 2627 | pStaDs->htMIMOPSState = htCaps->mimoPowerSave ; |
| 2628 | pStaDs->htMaxAmsduLength = htCaps->maximalAMSDUsize; |
| 2629 | pStaDs->htAMpduDensity = htCaps->mpduDensity; |
| 2630 | pStaDs->htDsssCckRate40MHzSupport = htCaps->dsssCckMode40MHz ; |
| 2631 | pStaDs->htShortGI20Mhz = htCaps->shortGI20MHz; |
| 2632 | pStaDs->htShortGI40Mhz = htCaps->shortGI40MHz; |
| 2633 | pStaDs->htMaxRxAMpduFactor = htCaps->maxRxAMPDUFactor; |
| 2634 | limFillRxHighestSupportedRate(pMac, |
| 2635 | &pStaDs->supportedRates.rxHighestDataRate, |
| 2636 | htCaps->supportedMCSSet); |
| 2637 | pStaDs->baPolicyFlag = 0xFF; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2638 | pMac->lim.gLimTdlsLinkMode = TDLS_LINK_MODE_N ; |
| 2639 | } |
| 2640 | else |
| 2641 | { |
| 2642 | pStaDs->mlmStaContext.htCapability = 0 ; |
| 2643 | pMac->lim.gLimTdlsLinkMode = TDLS_LINK_MODE_BG ; |
| 2644 | } |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2645 | #ifdef WLAN_FEATURE_11AC |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2646 | limTdlsPopulateDot11fVHTCaps(pMac, pTdlsAddStaReq, &vhtCap); |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2647 | pVhtCaps = &vhtCap; |
| 2648 | if (pVhtCaps->present) |
| 2649 | { |
| 2650 | pStaDs->mlmStaContext.vhtCapability = 1 ; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2651 | pStaDs->vhtSupportedChannelWidthSet= pVhtCaps->supportedChannelWidthSet; |
| 2652 | pStaDs->vhtLdpcCapable = pVhtCaps->ldpcCodingCap; |
| 2653 | pStaDs->vhtBeamFormerCapable= pVhtCaps->suBeamFormerCap; |
| 2654 | // TODO , is it necessary , Sunil??? |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2655 | pMac->lim.gLimTdlsLinkMode = TDLS_LINK_MODE_AC; |
| 2656 | } |
| 2657 | else |
| 2658 | { |
| 2659 | pStaDs->mlmStaContext.vhtCapability = 0 ; |
| 2660 | } |
| 2661 | #endif |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2662 | /*Calculate the Secondary Coannel Offset */ |
| 2663 | cbMode = limTdlsSelectCBMode(pStaDs, psessionEntry); |
| 2664 | |
| 2665 | pStaDs->htSecondaryChannelOffset = cbMode; |
| 2666 | |
| 2667 | #ifdef WLAN_FEATURE_11AC |
| 2668 | if ( pStaDs->mlmStaContext.vhtCapability ) |
| 2669 | { |
| 2670 | pStaDs->htSecondaryChannelOffset = limGetHTCBState(cbMode); |
| 2671 | } |
| 2672 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2673 | |
| 2674 | pSessStaDs = dphLookupHashEntry(pMac, psessionEntry->bssId, &aid, |
| 2675 | &psessionEntry->dph.dphHashTable) ; |
| 2676 | |
| 2677 | /* Lets enable QOS parameter */ |
| 2678 | pStaDs->qosMode = 1; |
| 2679 | pStaDs->wmeEnabled = 1; |
| 2680 | pStaDs->lleEnabled = 0; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2681 | /* TDLS Dummy AddSTA does not have qosInfo , is it OK ?? |
| 2682 | */ |
| 2683 | pStaDs->qos.capability.qosInfo = (*(tSirMacQosInfoStation *) &pTdlsAddStaReq->uapsd_queues); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2684 | |
| 2685 | /* populate matching rate set */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2686 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2687 | /* TDLS Dummy AddSTA does not have HTCap,VHTCap,Rates info , is it OK ?? |
| 2688 | */ |
| 2689 | limTdlsPopulateMatchingRateSet(pMac, pStaDs, pTdlsAddStaReq->supported_rates, |
| 2690 | pTdlsAddStaReq->supported_rates_length, |
| 2691 | (tANI_U8 *)pTdlsAddStaReq->htCap.suppMcsSet, |
| 2692 | &pStaDs->mlmStaContext.propRateSet, |
| 2693 | psessionEntry, (tDot11fIEVHTCaps *)&pTdlsAddStaReq->vhtCap); |
| 2694 | |
| 2695 | /* TDLS Dummy AddSTA does not have right capability , is it OK ?? |
| 2696 | */ |
| 2697 | pStaDs->mlmStaContext.capabilityInfo = ( *(tSirMacCapabilityInfo *) &pTdlsAddStaReq->capability); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2698 | |
| 2699 | return ; |
| 2700 | } |
| 2701 | |
| 2702 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 2703 | /* |
| 2704 | * find Peer in setup link list. |
| 2705 | */ |
| 2706 | |
| 2707 | tANI_U8 limTdlsFindLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
| 2708 | tLimTdlsLinkSetupPeer **setupPeer) |
| 2709 | { |
| 2710 | tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ; |
| 2711 | tLimTdlsLinkSetupPeer *linkSetupList = setupInfo->tdlsLinkSetupList ; |
| 2712 | tANI_U8 checkNode = TDLS_NODE_NOT_FOUND ; |
| 2713 | |
| 2714 | while (linkSetupList != NULL) |
| 2715 | { |
| 2716 | if (palEqualMemory( pMac->hHdd,(tANI_U8 *) peerMac, |
| 2717 | (tANI_U8 *) linkSetupList->peerMac, |
| 2718 | sizeof(tSirMacAddr)) ) |
| 2719 | { |
| 2720 | checkNode = TDLS_NODE_FOUND ; |
| 2721 | *setupPeer = linkSetupList ; |
| 2722 | break ; |
| 2723 | } |
| 2724 | linkSetupList = linkSetupList->next; |
| 2725 | } |
| 2726 | |
| 2727 | return ((TDLS_NODE_FOUND == checkNode) ? eSIR_SUCCESS : eSIR_FAILURE ) ; |
| 2728 | } |
| 2729 | |
| 2730 | /* |
| 2731 | * find peer in Discovery list. |
| 2732 | * Dicovery list get populated in two instances, a) Recieved responses in reply |
| 2733 | * to discovery request b) If discover request is received from TDLS peer STA |
| 2734 | */ |
| 2735 | tSirTdlsPeerInfo *limTdlsFindDisPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac) |
| 2736 | { |
| 2737 | tLimDisResultList *discoveryList = pMac->lim.gLimTdlsDisResultList ; |
| 2738 | tSirTdlsPeerInfo *peerInfo = NULL ; |
| 2739 | |
| 2740 | while (discoveryList != NULL) |
| 2741 | { |
| 2742 | peerInfo = &discoveryList->tdlsDisPeerInfo ; |
| 2743 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 2744 | ("Peer in discovery list = %02x, %02x, %02x, %02x, %02x, %02x \n"), |
| 2745 | peerInfo->peerMac[0], |
| 2746 | peerInfo->peerMac[1], |
| 2747 | peerInfo->peerMac[2], |
| 2748 | peerInfo->peerMac[3], |
| 2749 | peerInfo->peerMac[4], |
| 2750 | peerInfo->peerMac[5]) ; |
| 2751 | |
| 2752 | if (palEqualMemory( pMac->hHdd,(tANI_U8 *) peerMac, |
| 2753 | (tANI_U8 *) &peerInfo->peerMac, sizeof(tSirMacAddr)) ) |
| 2754 | { |
| 2755 | break ; |
| 2756 | } |
| 2757 | discoveryList = discoveryList->next; |
| 2758 | } |
| 2759 | |
| 2760 | return peerInfo ; |
| 2761 | } |
| 2762 | |
| 2763 | /* |
| 2764 | * find peer in Discovery list by looking into peer state. |
| 2765 | * Dicovery list get populated in two instances, a) Recieved responses in reply |
| 2766 | * to discovery request b) If discover request is received from TDLS peer STA |
| 2767 | */ |
| 2768 | static tSirTdlsPeerInfo *limTdlsFindDisPeerByState(tpAniSirGlobal pMac, |
| 2769 | tANI_U8 state) |
| 2770 | { |
| 2771 | tLimDisResultList *discoveryList = pMac->lim.gLimTdlsDisResultList ; |
| 2772 | tSirTdlsPeerInfo *peerInfo = NULL ; |
| 2773 | |
| 2774 | while (discoveryList != NULL) |
| 2775 | { |
| 2776 | peerInfo = &discoveryList->tdlsDisPeerInfo ; |
| 2777 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 2778 | ("peerInfo Mac = %02x, %02x, %02x, %02x, %02x, %02x "), |
| 2779 | peerInfo->peerMac[0], |
| 2780 | peerInfo->peerMac[1], |
| 2781 | peerInfo->peerMac[2], |
| 2782 | peerInfo->peerMac[3], |
| 2783 | peerInfo->peerMac[4], |
| 2784 | peerInfo->peerMac[5]) ; |
| 2785 | |
| 2786 | if (peerInfo->tdlsPeerState == state) |
| 2787 | { |
| 2788 | break ; |
| 2789 | } |
| 2790 | discoveryList = discoveryList->next; |
| 2791 | } |
| 2792 | |
| 2793 | return peerInfo ; |
| 2794 | } |
| 2795 | |
| 2796 | /* |
| 2797 | * find peer in Setup list by looking into peer state. |
| 2798 | * setup list get populated in two instances, a) Recieved responses in reply |
| 2799 | * to setup request b) If discover request is received from TDLS peer STA |
| 2800 | */ |
| 2801 | static tANI_U8 limTdlsFindSetupPeerByState(tpAniSirGlobal pMac, tANI_U8 state, |
| 2802 | tLimTdlsLinkSetupPeer **setupPeer) |
| 2803 | { |
| 2804 | |
| 2805 | tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ; |
| 2806 | tLimTdlsLinkSetupPeer *linkSetupList = setupInfo->tdlsLinkSetupList ; |
| 2807 | tANI_U8 checkNode = TDLS_NODE_NOT_FOUND ; |
| 2808 | |
| 2809 | while (linkSetupList != NULL) |
| 2810 | { |
| 2811 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 2812 | ("peer state = %02x\n"), (linkSetupList)->tdls_link_state) ; |
| 2813 | if((linkSetupList)->tdls_link_state == state) |
| 2814 | { |
| 2815 | checkNode = TDLS_NODE_FOUND ; |
| 2816 | *setupPeer = linkSetupList ; |
| 2817 | break ; |
| 2818 | } |
| 2819 | linkSetupList = (linkSetupList)->next; |
| 2820 | } |
| 2821 | |
| 2822 | return ((TDLS_NODE_FOUND == checkNode) ? eSIR_SUCCESS: eSIR_FAILURE) ; |
| 2823 | } |
| 2824 | |
| 2825 | |
| 2826 | /* |
| 2827 | * delete Peer from Setup Link |
| 2828 | */ |
| 2829 | void limTdlsDelLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac) |
| 2830 | { |
| 2831 | tLimTdlsLinkSetupInfo *setupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ; |
| 2832 | tLimTdlsLinkSetupPeer **linkSetupList = &setupInfo->tdlsLinkSetupList ; |
| 2833 | tLimTdlsLinkSetupPeer *currentNode = NULL ; |
| 2834 | tLimTdlsLinkSetupPeer *prevNode = NULL ; |
| 2835 | |
| 2836 | for(currentNode = *linkSetupList ; currentNode != NULL ; |
| 2837 | prevNode = currentNode, currentNode = currentNode->next) |
| 2838 | { |
| 2839 | if (palEqualMemory( pMac->hHdd,(tANI_U8 *) peerMac, |
| 2840 | (tANI_U8 *) currentNode->peerMac, |
| 2841 | sizeof(tSirMacAddr)) ) |
| 2842 | { |
| 2843 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 2844 | ("Del Node for Peer = %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 2845 | currentNode->peerMac[0], |
| 2846 | currentNode->peerMac[1], |
| 2847 | currentNode->peerMac[2], |
| 2848 | currentNode->peerMac[3], |
| 2849 | currentNode->peerMac[4], |
| 2850 | currentNode->peerMac[5]) ; |
| 2851 | /* if it's first Node */ |
| 2852 | if(NULL == prevNode) |
| 2853 | { |
| 2854 | *linkSetupList = currentNode->next ; |
| 2855 | } |
| 2856 | else |
| 2857 | { |
| 2858 | prevNode->next = currentNode->next ; |
| 2859 | } |
| 2860 | palFreeMemory(pMac, currentNode) ; |
| 2861 | return ; |
| 2862 | } |
| 2863 | } |
| 2864 | |
| 2865 | return ; |
| 2866 | } |
| 2867 | |
| 2868 | |
| 2869 | |
| 2870 | /* |
| 2871 | * TDLS discovery request frame received from TDLS peer STA.. |
| 2872 | */ |
| 2873 | static tSirRetStatus limProcessTdlsDisReqFrame(tpAniSirGlobal pMac, |
| 2874 | tANI_U8 *pBody, tANI_U32 frmLen ) |
| 2875 | { |
| 2876 | tDot11fTDLSDisReq tdlsDisReq = {{0}} ; |
| 2877 | tANI_U32 status = 0 ; |
| 2878 | tLimDisResultList *tdlsDisResult = NULL ; |
| 2879 | tLimDisResultList **disResultList = &pMac->lim.gLimTdlsDisResultList ; |
| 2880 | tSirMacAddr peerMac = {0} ; |
| 2881 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 2882 | tSirTdlsPeerInfo *peerInfo = NULL ; |
| 2883 | tpPESession psessionEntry = NULL ; |
| 2884 | tANI_U8 sessionId = 0 ; |
| 2885 | |
| 2886 | status = dot11fUnpackTDLSDisReq(pMac, pBody, frmLen, &tdlsDisReq) ; |
| 2887 | |
| 2888 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN, |
| 2889 | ("TDLS dis request dialog = %d\n"), tdlsDisReq.DialogToken.token); |
| 2890 | |
| 2891 | if ( DOT11F_FAILED( status ) ) |
| 2892 | { |
| 2893 | limLog(pMac, LOGE, FL("Failed to parse TDLS discovery Request \ |
| 2894 | frame (0x%08x, %d bytes):\n"),status, frmLen); |
| 2895 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 2896 | return eSIR_FAILURE; |
| 2897 | } |
| 2898 | else if ( DOT11F_WARNED( status ) ) |
| 2899 | { |
| 2900 | limLog( pMac, LOGW, FL("There were warnings while unpacking an\ |
| 2901 | TDLS discovery Request frame (0x%08x," "%d bytes):\n"), |
| 2902 | status, frmLen ); |
| 2903 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 2904 | } |
| 2905 | |
| 2906 | /* |
| 2907 | * find session entry using BSSID in link identifier, not using MAC |
| 2908 | * header beacuse, there is cases in TDLS, there may be BSSID will not |
| 2909 | * be present in header |
| 2910 | */ |
| 2911 | psessionEntry = peFindSessionByBssid(pMac, |
| 2912 | &tdlsDisReq.LinkIdentifier.bssid[0], &sessionId) ; |
| 2913 | if(NULL == psessionEntry) |
| 2914 | { |
| 2915 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \ |
| 2916 | ("no Seesion entry for TDLS session (bssid %02x:%02x:%02x:%02x:%02x:%02x)\n"), \ |
| 2917 | tdlsDisReq.LinkIdentifier.bssid[0], |
| 2918 | tdlsDisReq.LinkIdentifier.bssid[1], |
| 2919 | tdlsDisReq.LinkIdentifier.bssid[2], |
| 2920 | tdlsDisReq.LinkIdentifier.bssid[3], |
| 2921 | tdlsDisReq.LinkIdentifier.bssid[4], |
| 2922 | tdlsDisReq.LinkIdentifier.bssid[5]) ; |
| 2923 | |
| 2924 | //VOS_ASSERT(0) ; |
| 2925 | return eSIR_FAILURE; |
| 2926 | } |
| 2927 | |
| 2928 | /* varify BSSID */ |
| 2929 | status = palEqualMemory(pMac->hHdd, &psessionEntry->bssId[0], |
| 2930 | &tdlsDisReq.LinkIdentifier.bssid[0], sizeof(tSirMacAddr)) ; |
| 2931 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 2932 | ("lim BSSID %02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 2933 | psessionEntry->bssId[0], |
| 2934 | psessionEntry->bssId[1], |
| 2935 | psessionEntry->bssId[2], |
| 2936 | psessionEntry->bssId[3], |
| 2937 | psessionEntry->bssId[4], |
| 2938 | psessionEntry->bssId[5]) ; |
| 2939 | |
| 2940 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 2941 | ("Dis req from BSSID %02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 2942 | tdlsDisReq.LinkIdentifier.bssid[0], |
| 2943 | tdlsDisReq.LinkIdentifier.bssid[1], |
| 2944 | tdlsDisReq.LinkIdentifier.bssid[2], |
| 2945 | tdlsDisReq.LinkIdentifier.bssid[3], |
| 2946 | tdlsDisReq.LinkIdentifier.bssid[4], |
| 2947 | tdlsDisReq.LinkIdentifier.bssid[5] |
| 2948 | ) ; |
| 2949 | if(!status) |
| 2950 | { |
| 2951 | limLog( pMac, LOGE, FL("TDLS discovery request frame from other BSS -> something wrong. Check RXP filter\n")) ; |
| 2952 | |
| 2953 | return eSIR_FAILURE ; |
| 2954 | } |
| 2955 | |
| 2956 | /* |
| 2957 | * check if this is echo of our transmitted discovery request |
| 2958 | * drop it here, TODO: better to drop this in TL. |
| 2959 | */ |
| 2960 | status = palEqualMemory(pMac->hHdd, psessionEntry->selfMacAddr, |
| 2961 | &tdlsDisReq.LinkIdentifier.InitStaAddr[0], |
| 2962 | sizeof(tSirMacAddr)) ; |
| 2963 | if(status) |
| 2964 | { |
| 2965 | limLog( pMac, LOGE, FL("Echo of our TDLS discovery request frame\n")) ; |
| 2966 | return eSIR_FAILURE ; |
| 2967 | } |
| 2968 | |
| 2969 | /* |
| 2970 | * while processing Discovery request from Peer, |
| 2971 | * STA_MAC--> MAC of TDLS discovery initiator |
| 2972 | * STA_PEER_MAC--> MAC of TDLS discovery responder. |
| 2973 | */ |
| 2974 | palCopyMemory(pMac->hHdd, peerMac, |
| 2975 | &tdlsDisReq.LinkIdentifier.InitStaAddr[0], |
| 2976 | sizeof(tSirMacAddr)) ; |
| 2977 | /* TODO, do more validation */ |
| 2978 | |
| 2979 | /* see if discovery is already in progress */ |
| 2980 | peerInfo = limTdlsFindDisPeer(pMac, peerMac) ; |
| 2981 | |
| 2982 | if(NULL == peerInfo) |
| 2983 | { |
| 2984 | /* |
| 2985 | * we are allocating peer info for individual peers found in TDLS |
| 2986 | * discovery, we need to keep adding TDLS peers till we have timed |
| 2987 | * out. We are freeing this memory at the time we are sending this |
| 2988 | * collected peer info to SME. |
| 2989 | */ |
| 2990 | status = palAllocateMemory(pMac->hHdd, (void **)&tdlsDisResult, |
| 2991 | sizeof(tLimDisResultList)) ; |
| 2992 | |
| 2993 | if(status != eHAL_STATUS_SUCCESS) |
| 2994 | { |
| 2995 | limLog(pMac, LOGP, FL("alloc fail for TDLS discovery \ |
| 2996 | reponse info\n")) ; |
| 2997 | return eSIR_FAILURE ; |
| 2998 | } |
| 2999 | |
| 3000 | |
| 3001 | peerInfo = &tdlsDisResult->tdlsDisPeerInfo ; |
| 3002 | peerInfo->tdlsPeerState = TDLS_DIS_REQ_PROCESS_STATE ; |
| 3003 | peerInfo->dialog = tdlsDisReq.DialogToken.token ; |
| 3004 | |
| 3005 | peerInfo->sessionId = psessionEntry->peSessionId; |
| 3006 | |
| 3007 | /* Populate peer info of tdls discovery result */ |
| 3008 | status = palCopyMemory(pMac->hHdd, peerInfo->peerMac, peerMac, |
| 3009 | sizeof(tSirMacAddr)) ; |
| 3010 | |
| 3011 | /* |
| 3012 | * Now, as per D13, there will not be any Supp rates, ext Supp rates |
| 3013 | * info in Discovery request frames, so we are populating this info |
| 3014 | * locally to pass it to ADD STA. |
| 3015 | */ |
| 3016 | do |
| 3017 | { |
| 3018 | tDot11fIESuppRates suppRates = {0} ; |
| 3019 | tDot11fIEExtSuppRates extSuppRates = {0} ; |
| 3020 | tANI_U16 caps = 0 ; |
| 3021 | tDot11fFfCapabilities capsInfo = {0} ; |
| 3022 | tDot11fIEHTCaps HTCaps = {0} ; |
| 3023 | /* populate supported rate IE */ |
| 3024 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3025 | &suppRates, psessionEntry ); |
| 3026 | ConvertSuppRates( pMac, &peerInfo->tdlsPeerSuppRates, |
| 3027 | &suppRates); |
| 3028 | /* Populate extended supported rates */ |
| 3029 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 3030 | &extSuppRates, psessionEntry ); |
| 3031 | |
| 3032 | peerInfo->ExtRatesPresent = 1; |
| 3033 | ConvertExtSuppRates( pMac, &peerInfo->tdlsPeerExtRates, |
| 3034 | &extSuppRates); |
| 3035 | |
| 3036 | if(cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) |
| 3037 | { |
| 3038 | /* |
| 3039 | * Could not get Capabilities value |
| 3040 | * from CFG. Log error. |
| 3041 | */ |
| 3042 | limLog(pMac, LOGP, |
| 3043 | FL("could not retrieve Capabilities value\n")); |
| 3044 | } |
| 3045 | swapBitField16(caps, ( tANI_U16* )&capsInfo ); |
| 3046 | /* update Caps Info */ |
| 3047 | tdlsUpdateCapInfo(&peerInfo->capabilityInfo , &capsInfo) ; |
| 3048 | |
| 3049 | PopulateDot11fHTCaps( pMac, psessionEntry, &HTCaps ); |
| 3050 | limTdlsCovertHTCaps(pMac, peerInfo, &HTCaps) ; |
| 3051 | |
| 3052 | } while (0) ; |
| 3053 | |
| 3054 | /* now add this new found discovery node into tdls discovery list */ |
| 3055 | tdlsDisResult->next = *disResultList ; |
| 3056 | *disResultList = tdlsDisResult ; |
| 3057 | pMac->lim.gLimTdlsDisStaCount++ ; |
| 3058 | |
| 3059 | /* See if for this peer already entry in setup Link */ |
| 3060 | limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ; |
| 3061 | |
| 3062 | /* |
| 3063 | * if there is no entry for this peer in setup list, we need to |
| 3064 | * do add sta for this peer to transmit discovery rsp. |
| 3065 | */ |
| 3066 | if(NULL == setupPeer) |
| 3067 | { |
| 3068 | /* To start with, send add STA request to HAL */ |
| 3069 | pMac->lim.gLimAddStaTdls = true ; |
| 3070 | peerInfo->delStaNeeded = true ; |
| 3071 | |
| 3072 | if(eSIR_FAILURE == limTdlsDisAddSta(pMac, peerMac, |
| 3073 | peerInfo, psessionEntry)) |
| 3074 | { |
| 3075 | VOS_ASSERT(0) ; |
| 3076 | limLog(pMac, LOGE, "Add STA for dis response is failed \n") ; |
| 3077 | return eSIR_FAILURE ; |
| 3078 | } |
| 3079 | } /* use setup link sta ID for discovery rsp */ |
| 3080 | else |
| 3081 | { |
| 3082 | peerInfo->delStaNeeded = false ; |
| 3083 | limSendTdlsDisRspFrame(pMac, peerInfo->peerMac, peerInfo->dialog, psessionEntry) ; |
| 3084 | peerInfo->tdlsPeerState = TDLS_DIS_RSP_SENT_WAIT_STATE ; |
| 3085 | } |
| 3086 | |
| 3087 | } |
| 3088 | else |
| 3089 | { |
| 3090 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3091 | ("discovery procedure in progress for this peer\n")) ; |
| 3092 | } |
| 3093 | |
| 3094 | return eSIR_SUCCESS ; |
| 3095 | } |
| 3096 | |
| 3097 | /* Process TDLS setup Request Frame */ |
| 3098 | |
| 3099 | static tSirRetStatus limProcessTdlsSetupReqFrame(tpAniSirGlobal pMac, |
| 3100 | tANI_U8 *pBody, tANI_U32 frmLen) |
| 3101 | { |
| 3102 | |
| 3103 | tDot11fTDLSSetupReq tdlsSetupReq = {{0}} ; |
| 3104 | tANI_U32 status = 0 ; |
| 3105 | tpPESession psessionEntry = NULL ; |
| 3106 | tANI_U8 sessionId = 0 ; |
| 3107 | tANI_U8 currentState = TDLS_LINK_SETUP_WAIT_STATE ; |
| 3108 | tANI_U8 previousState = TDLS_LINK_IDLE_STATE ; |
| 3109 | /* create node for Link setup */ |
| 3110 | tLimTdlsLinkSetupInfo *linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ; |
| 3111 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 3112 | tLimTdlsLinkSetupPeer *tmpSetupPeer = NULL ; |
| 3113 | |
| 3114 | status = dot11fUnpackTDLSSetupReq(pMac, pBody, frmLen, &tdlsSetupReq) ; |
| 3115 | |
| 3116 | if ( DOT11F_FAILED( status ) ) |
| 3117 | { |
| 3118 | limLog(pMac, LOGE, FL("Failed to parse TDLS discovery Request \ |
| 3119 | frame (0x%08x, %d bytes):\n"),status, frmLen); |
| 3120 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3121 | return eSIR_FAILURE; |
| 3122 | } |
| 3123 | else if ( DOT11F_WARNED( status ) ) |
| 3124 | { |
| 3125 | limLog( pMac, LOGW, FL("There were warnings while unpacking an\ |
| 3126 | TDLS setup Request frame (0x%08x," "%d bytes):\n"), |
| 3127 | status, pBody ); |
| 3128 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3129 | } |
| 3130 | /* |
| 3131 | * find session entry using BSSID in link identifier, not using MAC |
| 3132 | * header beacuse, there is cases in TDLS, there may be BSSID will not |
| 3133 | * be present in header |
| 3134 | */ |
| 3135 | psessionEntry = peFindSessionByBssid(pMac, |
| 3136 | &tdlsSetupReq.LinkIdentifier.bssid[0], &sessionId) ; |
| 3137 | if(NULL == psessionEntry) |
| 3138 | { |
| 3139 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \ |
| 3140 | ("no Seesion entry for TDLS session (bssid %02x:%02x:%02x:%02x:%02x:%02x)\n"), \ |
| 3141 | tdlsSetupReq.LinkIdentifier.bssid[0], |
| 3142 | tdlsSetupReq.LinkIdentifier.bssid[1], |
| 3143 | tdlsSetupReq.LinkIdentifier.bssid[2], |
| 3144 | tdlsSetupReq.LinkIdentifier.bssid[3], |
| 3145 | tdlsSetupReq.LinkIdentifier.bssid[4], |
| 3146 | tdlsSetupReq.LinkIdentifier.bssid[5]) ; |
| 3147 | |
| 3148 | //VOS_ASSERT(0) ; |
| 3149 | return eSIR_FAILURE ; |
| 3150 | } |
| 3151 | /* TODO: we don;t need this check now, varify BSSID */ |
| 3152 | status = palEqualMemory(pMac->hHdd, psessionEntry->bssId, |
| 3153 | &tdlsSetupReq.LinkIdentifier.bssid[0], |
| 3154 | sizeof(tSirMacAddr)) ; |
| 3155 | |
| 3156 | if(!status) |
| 3157 | { |
| 3158 | limLog( pMac, LOGE, FL("TDLS setup request frame from other BSS -> something wrong. Check RXP filter\n")) ; |
| 3159 | |
| 3160 | limSendTdlsSetupRspFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr, tdlsSetupReq.DialogToken.token , psessionEntry, |
| 3161 | TDLS_SETUP_STATUS_FAILURE, NULL, 0 ) ; |
| 3162 | return eSIR_FAILURE ; |
| 3163 | } |
| 3164 | |
| 3165 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 3166 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_RSP_TIMEOUT_TO_SETUP_REQ) |
| 3167 | { |
| 3168 | /* simply ignore this setup request packet */ |
| 3169 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3170 | ("TDLS negative running: ignore TDLS Setup Req packet\n")); |
| 3171 | return eSIR_SUCCESS ; |
| 3172 | } |
| 3173 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_SEND_REQ_TO_SETUP_REQ) |
| 3174 | { |
| 3175 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3176 | ("TDLS negative running: send TDLS Setup Req to peer TDLS Setup Req\n")); |
| 3177 | /* format TDLS discovery request frame and transmit it */ |
| 3178 | limSendTdlsLinkSetupReqFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr, tdlsSetupReq.DialogToken.token, psessionEntry, |
| 3179 | NULL, 0) ; |
| 3180 | } |
| 3181 | #endif |
| 3182 | /* TODO, do more validation */ |
| 3183 | |
| 3184 | if(!limTdlsFindLinkPeer(pMac, |
| 3185 | &tdlsSetupReq.LinkIdentifier.InitStaAddr[0], |
| 3186 | &tmpSetupPeer)) |
| 3187 | { |
| 3188 | tANI_U32 tdlsStateStatus = TDLS_LINK_SETUP_START_STATE ; |
| 3189 | |
| 3190 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3191 | ("Link is already setup with this peer\n" )) ; |
| 3192 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3193 | ("state = %d\n"), tmpSetupPeer->tdls_link_state) ; |
| 3194 | //return eSIR_FAILURE ; |
| 3195 | |
| 3196 | if(tmpSetupPeer == NULL) |
| 3197 | { |
| 3198 | VOS_ASSERT(0) ; |
| 3199 | return eSIR_FAILURE ; |
| 3200 | |
| 3201 | } |
| 3202 | switch(tmpSetupPeer->tdls_link_state) |
| 3203 | { |
| 3204 | |
| 3205 | case TDLS_LINK_SETUP_START_STATE: |
| 3206 | { |
| 3207 | v_SINT_t macCompare = 0 ; |
| 3208 | macCompare= vos_mem_compare2(tmpSetupPeer->peerMac, |
| 3209 | psessionEntry->selfMacAddr, sizeof(tSirMacAddr)) ; |
| 3210 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3211 | ("MAC comparison Rslt = %d\n"), macCompare ) ; |
| 3212 | if(0 > macCompare) |
| 3213 | { |
| 3214 | /* |
| 3215 | * Delete our Setup Request/Peer info and honour Peer |
| 3216 | * Setup Request, go ahead and respond for this |
| 3217 | */ |
| 3218 | /* Deactivate the timer */ |
| 3219 | tx_timer_deactivate(&tmpSetupPeer->gLimTdlsLinkSetupRspTimeoutTimer) ; |
| 3220 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 3221 | if((pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_SEND_REQ_TO_SETUP_REQ) |
| 3222 | != LIM_TDLS_NEGATIVE_SEND_REQ_TO_SETUP_REQ) |
| 3223 | #endif |
| 3224 | limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, |
| 3225 | tmpSetupPeer->peerMac, eWNI_SME_TDLS_LINK_START_RSP); |
| 3226 | |
| 3227 | limTdlsDelLinkPeer(pMac, tmpSetupPeer->peerMac) ; |
| 3228 | tdlsStateStatus = TDLS_LINK_IDLE_STATE ; |
| 3229 | } |
| 3230 | else if(0 < macCompare) |
| 3231 | { |
| 3232 | /* |
| 3233 | * Go ahead with current setup as peer is going to |
| 3234 | * respond for setup request |
| 3235 | */ |
| 3236 | tdlsStateStatus = TDLS_LINK_SETUP_START_STATE ; |
| 3237 | } |
| 3238 | else |
| 3239 | { |
| 3240 | /* same MAC, not possible */ |
| 3241 | VOS_ASSERT(0) ; |
| 3242 | } |
| 3243 | |
| 3244 | break ; |
| 3245 | } |
| 3246 | #if 1 |
| 3247 | case TDLS_LINK_SETUP_DONE_STATE: |
| 3248 | { |
| 3249 | tpDphHashNode pStaDs = NULL ; |
| 3250 | |
| 3251 | previousState = TDLS_LINK_SETUP_WAIT_STATE ; |
| 3252 | currentState = TDLS_LINK_TEARDOWN_START_STATE ; |
| 3253 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3254 | ("link Setup Done state " )) ; |
| 3255 | tmpSetupPeer->tdls_prev_link_state = previousState ; |
| 3256 | tmpSetupPeer->tdls_link_state = currentState ; |
| 3257 | setupPeer = tmpSetupPeer ; |
| 3258 | #if 0 |
| 3259 | /* Send Teardown to this Peer and Initiate new TDLS Setup */ |
| 3260 | limSendTdlsTeardownFrame(pMac, |
| 3261 | &tdlsSetupReq.LinkIdentifier.InitStaAddr[0], |
| 3262 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry) ; |
| 3263 | #else |
| 3264 | |
| 3265 | /* tdls_hklee: send message to HAL before it is deleted, cause */ |
| 3266 | limTdlsLinkTeardown(pMac, (setupPeer)->peerMac) ; |
| 3267 | |
| 3268 | /* send del STA to remove context for this TDLS STA */ |
| 3269 | pStaDs = limTdlsDelSta(pMac, (setupPeer)->peerMac, psessionEntry) ; |
| 3270 | |
| 3271 | /* now send indication to SME-->HDD->TL to remove STA from TL */ |
| 3272 | |
| 3273 | if(pStaDs) |
| 3274 | { |
| 3275 | limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId, |
| 3276 | pStaDs, eSIR_SUCCESS) ; |
| 3277 | |
| 3278 | /* send Teardown Ind to SME */ |
| 3279 | limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (setupPeer)->peerMac, |
| 3280 | eWNI_SME_TDLS_TEARDOWN_IND) ; |
| 3281 | /* remove node from setup list */ |
| 3282 | limTdlsDelLinkPeer(pMac, (setupPeer)->peerMac) ; |
| 3283 | } |
| 3284 | #endif |
| 3285 | //setupPeer->tdls_prev_link_state = TDLS_LINK_SETUP_RESTART_STATE; |
| 3286 | tdlsStateStatus = TDLS_LINK_IDLE_STATE ; |
| 3287 | break ; |
| 3288 | |
| 3289 | } |
| 3290 | default: |
| 3291 | { |
| 3292 | VOS_ASSERT(0) ; |
| 3293 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3294 | ("link Setup is Recieved in unknown state\n" )) ; |
| 3295 | break ; |
| 3296 | } |
| 3297 | #endif |
| 3298 | } |
| 3299 | if(tdlsStateStatus == TDLS_LINK_SETUP_START_STATE) |
| 3300 | return eSIR_FAILURE ; |
| 3301 | } |
| 3302 | |
| 3303 | if(currentState != TDLS_LINK_TEARDOWN_START_STATE) |
| 3304 | { |
| 3305 | /* |
| 3306 | * Now we are sure to send discovery response frame to TDLS discovery |
| 3307 | * initiator, we don't care, if this request is unicast ro broadcast, |
| 3308 | * we simply, send discovery response frame on direct link. |
| 3309 | */ |
| 3310 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 3311 | (void **) &setupPeer, sizeof( tLimTdlsLinkSetupPeer ))) |
| 3312 | { |
| 3313 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3314 | ( "Unable to allocate memory during ADD_STA\n" )); |
| 3315 | return eSIR_MEM_ALLOC_FAILED; |
| 3316 | } |
| 3317 | |
| 3318 | setupPeer->dialog = tdlsSetupReq.DialogToken.token ; |
| 3319 | //setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ; |
| 3320 | //setupPeer->tdls_link_state = TDLS_LINK_SETUP_WAIT_STATE ; |
| 3321 | setupPeer->tdls_prev_link_state = previousState ; |
| 3322 | setupPeer->tdls_link_state = currentState ; |
| 3323 | /* TDLS_sessionize: remember sessionId for future */ |
| 3324 | setupPeer->tdls_sessionId = psessionEntry->peSessionId; |
| 3325 | setupPeer->tdls_bIsResponder = 0; |
| 3326 | |
| 3327 | palCopyMemory(pMac->hHdd, setupPeer->peerMac, |
| 3328 | &tdlsSetupReq.LinkIdentifier.InitStaAddr[0], |
| 3329 | sizeof(tSirMacAddr)) ; |
| 3330 | |
| 3331 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3332 | ("Setup REQ MAC = %02x,%02x, %02x, %02x, %02x, %02x\n"), |
| 3333 | setupPeer->peerMac[0], |
| 3334 | setupPeer->peerMac[1], |
| 3335 | setupPeer->peerMac[2], |
| 3336 | setupPeer->peerMac[3], |
| 3337 | setupPeer->peerMac[4], |
| 3338 | setupPeer->peerMac[5] ) ; |
| 3339 | |
| 3340 | limTdlsUpdateLinkReqPeerInfo(pMac, setupPeer, &tdlsSetupReq) ; |
| 3341 | pMac->lim.gLimAddStaTdls = true ; |
| 3342 | |
| 3343 | /* To start with, send add STA request to HAL */ |
| 3344 | if(eSIR_FAILURE == limTdlsSetupAddSta(pMac, setupPeer->peerMac, |
| 3345 | setupPeer, psessionEntry)) |
| 3346 | { |
| 3347 | VOS_ASSERT(0) ; |
| 3348 | palFreeMemory(pMac->hHdd, (void **) &setupPeer) ; |
| 3349 | return eSIR_FAILURE ; |
| 3350 | } |
| 3351 | |
| 3352 | limSendTdlsSetupRspFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr, |
| 3353 | tdlsSetupReq.DialogToken.token , psessionEntry, |
| 3354 | TDLS_SETUP_STATUS_SUCCESS, NULL, 0) ; |
| 3355 | |
| 3356 | limStartTdlsTimer(pMac, psessionEntry->peSessionId, |
| 3357 | &setupPeer->gLimTdlsLinkSetupCnfTimeoutTimer, |
| 3358 | (tANI_U32)setupPeer->peerMac, |
| 3359 | WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT, |
| 3360 | SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT) ; |
| 3361 | |
| 3362 | /* update setup peer list */ |
| 3363 | setupPeer->next = linkSetupInfo->tdlsLinkSetupList ; |
| 3364 | linkSetupInfo->tdlsLinkSetupList = setupPeer ; |
| 3365 | } |
| 3366 | else |
| 3367 | { |
| 3368 | setupPeer->dialog = tdlsSetupReq.DialogToken.token ; |
| 3369 | //setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ; |
| 3370 | //setupPeer->tdls_link_state = TDLS_LINK_SETUP_WAIT_STATE ; |
| 3371 | setupPeer->tdls_prev_link_state = previousState ; |
| 3372 | setupPeer->tdls_link_state = currentState ; |
| 3373 | /* TDLS_sessionize: remember sessionId for future */ |
| 3374 | setupPeer->tdls_sessionId = psessionEntry->peSessionId; |
| 3375 | setupPeer->tdls_bIsResponder = 0; |
| 3376 | |
| 3377 | palCopyMemory(pMac->hHdd, setupPeer->peerMac, |
| 3378 | &tdlsSetupReq.LinkIdentifier.InitStaAddr[0], |
| 3379 | sizeof(tSirMacAddr)) ; |
| 3380 | |
| 3381 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3382 | ("Setup REQ MAC = %02x,%02x, %02x, %02x, %02x, %02x\n"), |
| 3383 | setupPeer->peerMac[0], |
| 3384 | setupPeer->peerMac[1], |
| 3385 | setupPeer->peerMac[2], |
| 3386 | setupPeer->peerMac[3], |
| 3387 | setupPeer->peerMac[4], |
| 3388 | setupPeer->peerMac[5] ) ; |
| 3389 | |
| 3390 | limTdlsUpdateLinkReqPeerInfo(pMac, setupPeer, &tdlsSetupReq) ; |
| 3391 | limSendTdlsSetupRspFrame(pMac, tdlsSetupReq.LinkIdentifier.InitStaAddr, |
| 3392 | tdlsSetupReq.DialogToken.token , psessionEntry, |
| 3393 | TDLS_SETUP_STATUS_SUCCESS, NULL, 0) ; |
| 3394 | |
| 3395 | limStartTdlsTimer(pMac, psessionEntry->peSessionId, |
| 3396 | &setupPeer->gLimTdlsLinkSetupCnfTimeoutTimer, |
| 3397 | (tANI_U32)setupPeer->peerMac, |
| 3398 | WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT, |
| 3399 | SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT) ; |
| 3400 | } |
| 3401 | |
| 3402 | |
| 3403 | return eSIR_SUCCESS ; |
| 3404 | |
| 3405 | } |
| 3406 | |
| 3407 | /* |
| 3408 | * TDLS discovery request frame received from TDLS peer STA.. |
| 3409 | */ |
| 3410 | static tSirRetStatus limProcessTdlsSetupRspFrame(tpAniSirGlobal pMac, |
| 3411 | tANI_U8 *pBody, tANI_U32 frmLen ) |
| 3412 | { |
| 3413 | tDot11fTDLSSetupRsp tdlsSetupRsp = {{0}} ; |
| 3414 | tANI_U32 status = 0 ; |
| 3415 | tSirMacAddr peerMac = {0} ; |
| 3416 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 3417 | tpPESession psessionEntry = NULL ; |
| 3418 | tANI_U8 sessionId = 0 ; |
| 3419 | |
| 3420 | status = dot11fUnpackTDLSSetupRsp(pMac, pBody, frmLen, &tdlsSetupRsp) ; |
| 3421 | |
| 3422 | if ( DOT11F_FAILED( status ) ) |
| 3423 | { |
| 3424 | limLog(pMac, LOGE, FL("Failed to parse TDLS discovery Request \ |
| 3425 | frame (0x%08x, %d bytes):\n"),status, frmLen); |
| 3426 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3427 | return eSIR_FAILURE; |
| 3428 | } |
| 3429 | else if ( DOT11F_WARNED( status ) ) |
| 3430 | { |
| 3431 | limLog( pMac, LOGW, FL("There were warnings while unpacking an\ |
| 3432 | TDLS discovery Request frame (0x%08x," "%d bytes):\n"), |
| 3433 | status, frmLen ); |
| 3434 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3435 | } |
| 3436 | |
| 3437 | /* |
| 3438 | * find session entry using BSSID in link identifier, not using MAC |
| 3439 | * header beacuse, there is cases in TDLS, there may be BSSID will not |
| 3440 | * be present in header |
| 3441 | */ |
| 3442 | psessionEntry = peFindSessionByBssid(pMac, |
| 3443 | &tdlsSetupRsp.LinkIdentifier.bssid[0], &sessionId) ; |
| 3444 | if(NULL == psessionEntry) |
| 3445 | { |
| 3446 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \ |
| 3447 | ("no Seesion entry for TDLS session (bssid %02x:%02x:%02x:%02x:%02x:%02x)\n"), \ |
| 3448 | tdlsSetupRsp.LinkIdentifier.bssid[0], |
| 3449 | tdlsSetupRsp.LinkIdentifier.bssid[1], |
| 3450 | tdlsSetupRsp.LinkIdentifier.bssid[2], |
| 3451 | tdlsSetupRsp.LinkIdentifier.bssid[3], |
| 3452 | tdlsSetupRsp.LinkIdentifier.bssid[4], |
| 3453 | tdlsSetupRsp.LinkIdentifier.bssid[5]) ; |
| 3454 | |
| 3455 | //VOS_ASSERT(0) ; |
| 3456 | return eSIR_FAILURE; |
| 3457 | } |
| 3458 | |
| 3459 | /* varify BSSID */ |
| 3460 | status = palEqualMemory(pMac->hHdd, psessionEntry->bssId, |
| 3461 | &tdlsSetupRsp.LinkIdentifier.bssid[0], |
| 3462 | sizeof(tSirMacAddr)) ; |
| 3463 | |
| 3464 | if(!status) |
| 3465 | { |
| 3466 | limLog( pMac, LOGE, FL("TDLS discovery request frame from other BSS -> something wrong. Check RXP filter\n")) ; |
| 3467 | |
| 3468 | VOS_ASSERT(0) ; |
| 3469 | return eSIR_FAILURE ; |
| 3470 | } |
| 3471 | palCopyMemory(pMac->hHdd, peerMac, |
| 3472 | &tdlsSetupRsp.LinkIdentifier.RespStaAddr[0], |
| 3473 | sizeof(tSirMacAddr)) ; |
| 3474 | |
| 3475 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3476 | ("TDLS setup RSP peer = %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 3477 | peerMac[0], |
| 3478 | peerMac[1], |
| 3479 | peerMac[2], |
| 3480 | peerMac[3], |
| 3481 | peerMac[4], |
| 3482 | peerMac[5]) ; |
| 3483 | limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ; |
| 3484 | |
| 3485 | if(NULL == setupPeer) |
| 3486 | { |
| 3487 | limLog( pMac, LOGE, FL(" unknown setup Response frame \ |
| 3488 | other BSS\n")) ; |
| 3489 | return eSIR_FAILURE ; |
| 3490 | } |
| 3491 | |
| 3492 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3493 | ("deactivating Setup RSP timer\n")) ; |
| 3494 | |
| 3495 | /* Deactivate the timer */ |
| 3496 | tx_timer_deactivate(&(setupPeer)->gLimTdlsLinkSetupRspTimeoutTimer) ; |
| 3497 | |
| 3498 | /* |
| 3499 | * TDLS Setup RSP is recieved with Failure, Delete this STA entry |
| 3500 | * don't respond with TDLS CNF frame. |
| 3501 | */ |
| 3502 | if(TDLS_SETUP_STATUS_SUCCESS != tdlsSetupRsp.Status.status) |
| 3503 | { |
| 3504 | limTdlsDelLinkPeer(pMac, (setupPeer)->peerMac) ; |
| 3505 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3506 | ("setup RSP with Failure Code\n")) ; |
| 3507 | return eSIR_FAILURE ; |
| 3508 | } |
| 3509 | |
| 3510 | /* update Link Info */ |
| 3511 | limTdlsUpdateLinkRspPeerInfo(pMac, setupPeer, &tdlsSetupRsp) ; |
| 3512 | |
| 3513 | /* TODO, do more validation */ |
| 3514 | |
| 3515 | |
| 3516 | /* |
| 3517 | * Now we are sure to send link setup CNF frame to TDLS link setup |
| 3518 | * reponded, now we will create dph hash entry and send add STA to HAL |
| 3519 | */ |
| 3520 | |
| 3521 | pMac->lim.gLimAddStaTdls = true ; |
| 3522 | if(eSIR_FAILURE == limTdlsSetupAddSta(pMac, peerMac, |
| 3523 | setupPeer, psessionEntry)) |
| 3524 | { |
| 3525 | /* through error */ |
| 3526 | VOS_ASSERT(0) ; |
| 3527 | return eSIR_FAILURE ; |
| 3528 | } |
| 3529 | /* TDLS_HKLEE_FIXME: now we add some delay for AddSta_Rsp comes */ |
| 3530 | |
| 3531 | |
| 3532 | /* send TDLS confim frame to TDLS Peer STA */ |
| 3533 | limSendTdlsLinkSetupCnfFrame(pMac, peerMac, tdlsSetupRsp.DialogToken.token, psessionEntry, NULL, 0) ; |
| 3534 | |
| 3535 | /* |
| 3536 | * set the tdls_link_state to TDLS_LINK_SETUP_RSP_WAIT_STATE, and |
| 3537 | * wait for Setup CNF transmission on air, once we receive tx complete |
| 3538 | * message, we will change the peer state and send message to SME |
| 3539 | * callback.. |
| 3540 | */ |
| 3541 | (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ; |
| 3542 | (setupPeer)->tdls_link_state = TDLS_LINK_SETUP_RSP_WAIT_STATE ; |
| 3543 | |
| 3544 | return eSIR_SUCCESS ; |
| 3545 | } |
| 3546 | /* |
| 3547 | * TDLS setup CNF frame processing .. |
| 3548 | */ |
| 3549 | |
| 3550 | static tSirRetStatus limProcessTdlsSetupCnfFrame(tpAniSirGlobal pMac, |
| 3551 | tANI_U8 *pBody, tANI_U32 frmLen) |
| 3552 | { |
| 3553 | tDot11fTDLSSetupCnf tdlsSetupCnf = {{0}} ; |
| 3554 | tANI_U32 status = 0 ; |
| 3555 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 3556 | tpPESession psessionEntry = NULL ; |
| 3557 | tANI_U8 sessionId = 0 ; |
| 3558 | |
| 3559 | status = dot11fUnpackTDLSSetupCnf(pMac, pBody, frmLen, &tdlsSetupCnf) ; |
| 3560 | |
| 3561 | if ( DOT11F_FAILED( status ) ) |
| 3562 | { |
| 3563 | limLog(pMac, LOGE, FL("Failed to parse an TDLS discovery Response \ |
| 3564 | frame (0x%08x, %d bytes):\n"),status, frmLen); |
| 3565 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3566 | return eSIR_FAILURE; |
| 3567 | } |
| 3568 | else if ( DOT11F_WARNED( status ) ) |
| 3569 | { |
| 3570 | limLog( pMac, LOGW, FL("There were warnings while unpacking an\ |
| 3571 | TDLS discovery Response frame (0x%08x," "%d bytes):\n"), |
| 3572 | status, frmLen ); |
| 3573 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3574 | } |
| 3575 | /* |
| 3576 | * find session entry using BSSID in link identifier, not using MAC |
| 3577 | * header beacuse, there is cases in TDLS, there may be BSSID will not |
| 3578 | * be present in header |
| 3579 | */ |
| 3580 | psessionEntry = peFindSessionByBssid(pMac, |
| 3581 | &tdlsSetupCnf.LinkIdentifier.bssid[0], &sessionId) ; |
| 3582 | if(NULL == psessionEntry) |
| 3583 | { |
| 3584 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \ |
| 3585 | ("no Seesion entry for TDLS session (bssid %02x:%02x:%02x:%02x:%02x:%02x)\n"), \ |
| 3586 | tdlsSetupCnf.LinkIdentifier.bssid[0], |
| 3587 | tdlsSetupCnf.LinkIdentifier.bssid[1], |
| 3588 | tdlsSetupCnf.LinkIdentifier.bssid[2], |
| 3589 | tdlsSetupCnf.LinkIdentifier.bssid[3], |
| 3590 | tdlsSetupCnf.LinkIdentifier.bssid[4], |
| 3591 | tdlsSetupCnf.LinkIdentifier.bssid[5]) ; |
| 3592 | |
| 3593 | //VOS_ASSERT(0) ; |
| 3594 | return eSIR_FAILURE; |
| 3595 | } |
| 3596 | |
| 3597 | /* varify BSSID */ |
| 3598 | status = palEqualMemory(pMac->hHdd, psessionEntry->bssId, |
| 3599 | &tdlsSetupCnf.LinkIdentifier.bssid[0], |
| 3600 | sizeof(tSirMacAddr)) ; |
| 3601 | |
| 3602 | if(!status) |
| 3603 | { |
| 3604 | limLog( pMac, LOGE, FL("TDLS setup CNF frame other BSS -> something wrong. Check RXP filter\n")) ; |
| 3605 | |
| 3606 | VOS_ASSERT(0) ; |
| 3607 | return eSIR_FAILURE ; |
| 3608 | } |
| 3609 | /* TODO, do more validation */ |
| 3610 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3611 | ("setup Cnf peer MAc = %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 3612 | tdlsSetupCnf.LinkIdentifier.InitStaAddr[0], |
| 3613 | tdlsSetupCnf.LinkIdentifier.InitStaAddr[1], |
| 3614 | tdlsSetupCnf.LinkIdentifier.InitStaAddr[2], |
| 3615 | tdlsSetupCnf.LinkIdentifier.InitStaAddr[3], |
| 3616 | tdlsSetupCnf.LinkIdentifier.InitStaAddr[4], |
| 3617 | tdlsSetupCnf.LinkIdentifier.InitStaAddr[5] |
| 3618 | ) ; |
| 3619 | |
| 3620 | limTdlsFindLinkPeer(pMac, |
| 3621 | &tdlsSetupCnf.LinkIdentifier.InitStaAddr[0], |
| 3622 | &setupPeer) ; |
| 3623 | |
| 3624 | if(NULL == setupPeer) |
| 3625 | { |
| 3626 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3627 | (" unknown setup CNF frame\n")) ; |
| 3628 | VOS_ASSERT(0) ; |
| 3629 | return eSIR_FAILURE ; |
| 3630 | } |
| 3631 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3632 | ("setup CNF peer MAC = %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 3633 | (setupPeer)->peerMac[0], |
| 3634 | (setupPeer)->peerMac[1], |
| 3635 | (setupPeer)->peerMac[2], |
| 3636 | (setupPeer)->peerMac[3], |
| 3637 | (setupPeer)->peerMac[4], |
| 3638 | (setupPeer)->peerMac[5]) ; |
| 3639 | /*T match dialog token, before proceeding further */ |
| 3640 | if((setupPeer)->dialog != tdlsSetupCnf.DialogToken.token) |
| 3641 | { |
| 3642 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3643 | ("setup CNF frame not matching with setup RSP\n")) ; |
| 3644 | VOS_ASSERT(0) ; |
| 3645 | return eSIR_FAILURE ; |
| 3646 | } |
| 3647 | |
| 3648 | /* |
| 3649 | * Now we are sure that, this set CNF is for us, now stop |
| 3650 | * the running timer.. |
| 3651 | */ |
| 3652 | tx_timer_deactivate(&(setupPeer)->gLimTdlsLinkSetupCnfTimeoutTimer) ; |
| 3653 | |
| 3654 | /* change TDLS peer State */ |
| 3655 | (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ; |
| 3656 | (setupPeer)->tdls_link_state = TDLS_LINK_SETUP_DONE_STATE ; |
| 3657 | |
| 3658 | /* send indication to SME that, new link is setup */ |
| 3659 | limSendSmeTdlsLinkSetupInd(pMac, (setupPeer)->peerMac, eSIR_SUCCESS) ; |
| 3660 | |
| 3661 | /* tdls_hklee: prepare PTI template and send it to HAL */ |
| 3662 | limTdlsLinkEstablish(pMac, (setupPeer)->peerMac); |
| 3663 | |
| 3664 | return eSIR_SUCCESS ; |
| 3665 | |
| 3666 | } |
| 3667 | |
| 3668 | /* |
| 3669 | * TDLS discovery response frame processing .. |
| 3670 | */ |
| 3671 | |
| 3672 | static tSirRetStatus limProcessTdlsDisRspFrame(tpAniSirGlobal pMac, |
| 3673 | tANI_U8 *pBody, tANI_U32 frmLen, |
| 3674 | tANI_S8 rssi, tpPESession psessionEntry) |
| 3675 | { |
| 3676 | tDot11fTDLSDisRsp tdlsDisRsp = {{0}} ; |
| 3677 | tANI_U32 status = 0 ; |
| 3678 | tLimDisResultList *tdlsDisResult = NULL ; |
| 3679 | tLimDisResultList **disResultList = &pMac->lim.gLimTdlsDisResultList ; |
| 3680 | tSirTdlsDisReq *prevDisReq = &pMac->lim.gLimTdlsDisReq ; |
| 3681 | |
| 3682 | status = dot11fUnpackTDLSDisRsp(pMac, pBody, frmLen, &tdlsDisRsp) ; |
| 3683 | |
| 3684 | if ( DOT11F_FAILED( status ) ) |
| 3685 | { |
| 3686 | limLog(pMac, LOGE, FL("Failed to parse an TDLS discovery Response \ |
| 3687 | frame (0x%08x, %d bytes):\n"),status, frmLen); |
| 3688 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3689 | return eSIR_FAILURE; |
| 3690 | } |
| 3691 | else if ( DOT11F_WARNED( status ) ) |
| 3692 | { |
| 3693 | limLog( pMac, LOGW, FL("There were warnings while unpacking an\ |
| 3694 | TDLS discovery Response frame (0x%08x," "%d bytes):\n"), |
| 3695 | status, frmLen ); |
| 3696 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);) |
| 3697 | } |
| 3698 | /*TODO: match dialog token, before proceeding further */ |
| 3699 | |
| 3700 | /* varify BSSID */ |
| 3701 | status = palEqualMemory(pMac->hHdd, psessionEntry->bssId, |
| 3702 | &tdlsDisRsp.LinkIdentifier.bssid[0], |
| 3703 | sizeof(tSirMacAddr)) ; |
| 3704 | |
| 3705 | if(!status) |
| 3706 | { |
| 3707 | limLog( pMac, LOGW, FL(" TDLS discovery Response frame other BSS\n")) ; |
| 3708 | return eSIR_FAILURE ; |
| 3709 | } |
| 3710 | /* TODO, do more validation */ |
| 3711 | |
| 3712 | if(tdlsDisRsp.DialogToken.token != prevDisReq->dialog) |
| 3713 | { |
| 3714 | limLog( pMac, LOGW, FL(" wrong TDLS discovery Response frame\n")) ; |
| 3715 | return eSIR_FAILURE ; |
| 3716 | } |
| 3717 | |
| 3718 | pMac->lim.gLimTdlsDisStaCount++ ; |
| 3719 | |
| 3720 | /* |
| 3721 | * we are allocating peer info for individual peers found in TDLS |
| 3722 | * discovery, we need to keep adding TDLS peers till we have timed |
| 3723 | * out. We are freeing this memory at the time we are sending this |
| 3724 | * collected peer info to SME. |
| 3725 | */ |
| 3726 | status = palAllocateMemory(pMac->hHdd, (void **)&tdlsDisResult, |
| 3727 | sizeof(tLimDisResultList)) ; |
| 3728 | |
| 3729 | if(status != eHAL_STATUS_SUCCESS) |
| 3730 | { |
| 3731 | limLog(pMac, LOGP, FL("alloc fail for TDLS discovery reponse info\n")) ; |
| 3732 | return eSIR_FAILURE ; |
| 3733 | } |
| 3734 | |
| 3735 | do |
| 3736 | { |
| 3737 | tSirTdlsPeerInfo *peerInfo = &tdlsDisResult->tdlsDisPeerInfo ; |
| 3738 | |
| 3739 | /* Populate peer info of tdls discovery result */ |
| 3740 | peerInfo->sessionId = psessionEntry->peSessionId; |
| 3741 | /* |
| 3742 | * When we receive DIS RSP from peer MAC, |
| 3743 | * STA_MAC_OFFSET will carry peer MAC address and PEER MAC OFFSET |
| 3744 | * will carry our MAC. |
| 3745 | */ |
| 3746 | status = palCopyMemory(pMac->hHdd, peerInfo->peerMac, |
| 3747 | &tdlsDisRsp.LinkIdentifier.RespStaAddr[0], |
| 3748 | sizeof(tSirMacAddr)) ; |
| 3749 | |
| 3750 | /* update RSSI for this TDLS peer STA */ |
| 3751 | peerInfo->tdlsPeerRssi = rssi ; |
| 3752 | |
| 3753 | /* update Caps Info */ |
| 3754 | tdlsUpdateCapInfo(&peerInfo->capabilityInfo , |
| 3755 | &tdlsDisRsp.Capabilities) ; |
| 3756 | |
| 3757 | /* update Supp rates */ |
| 3758 | if(tdlsDisRsp.SuppRates.present) |
| 3759 | { |
| 3760 | ConvertSuppRates( pMac, &peerInfo->tdlsPeerSuppRates, |
| 3761 | &tdlsDisRsp.SuppRates ); |
| 3762 | } |
| 3763 | |
| 3764 | /* update EXT supp rates */ |
| 3765 | if(tdlsDisRsp.ExtSuppRates.present) |
| 3766 | { |
| 3767 | peerInfo->ExtRatesPresent = 1; |
| 3768 | ConvertExtSuppRates( pMac, &peerInfo->tdlsPeerExtRates, |
| 3769 | &tdlsDisRsp.ExtSuppRates ); |
| 3770 | } |
| 3771 | /* update HT caps */ |
| 3772 | if (tdlsDisRsp.HTCaps.present) |
| 3773 | { |
| 3774 | palCopyMemory( pMac, &peerInfo->tdlsPeerHtCaps, &tdlsDisRsp.HTCaps, |
| 3775 | sizeof( tDot11fIEHTCaps ) ); |
| 3776 | } |
| 3777 | /* update EXT caps */ |
| 3778 | if (tdlsDisRsp.ExtCap.present) |
| 3779 | { |
| 3780 | //palCopyMemory( pMac, &peerInfo->tdlsPeerExtenCaps, |
| 3781 | // &tdlsDisRsp.ExtCap, |
| 3782 | // sizeof( tDot11fIEExtCap ) ); |
| 3783 | } |
| 3784 | } while(0) ; |
| 3785 | |
| 3786 | /* now add this new found discovery node into tdls discovery list */ |
| 3787 | tdlsDisResult->next = *disResultList ; |
| 3788 | *disResultList = tdlsDisResult ; |
| 3789 | |
| 3790 | return eSIR_SUCCESS ; |
| 3791 | } |
| 3792 | |
| 3793 | /* |
| 3794 | * Process TDLS Teardown request frame from TDLS peer STA |
| 3795 | */ |
| 3796 | static tSirRetStatus limProcessTdlsTeardownFrame(tpAniSirGlobal pMac, |
| 3797 | tANI_U8 *pBody, tANI_U32 frmLen ) |
| 3798 | { |
| 3799 | tDot11fTDLSTeardown tdlsTeardown = {{0}} ; |
| 3800 | tANI_U32 status = 0 ; |
| 3801 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 3802 | tpPESession psessionEntry = NULL ; |
| 3803 | tANI_U8 sessionId = 0 ; |
| 3804 | |
| 3805 | status = dot11fUnpackTDLSTeardown(pMac, pBody, frmLen, &tdlsTeardown) ; |
| 3806 | |
| 3807 | if ( DOT11F_FAILED( status ) ) |
| 3808 | { |
| 3809 | limLog(pMac, LOGE, FL("Failed to parse an TDLS discovery Response \ |
| 3810 | frame (0x%08x, %d bytes):\n"),status, frmLen); |
| 3811 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3812 | return eSIR_FAILURE; |
| 3813 | } |
| 3814 | else if ( DOT11F_WARNED( status ) ) |
| 3815 | { |
| 3816 | limLog( pMac, LOGW, FL("There were warnings while unpacking an\ |
| 3817 | TDLS discovery Response frame (0x%08x," "%d bytes):\n"), |
| 3818 | status, frmLen ); |
| 3819 | PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pBody, frmLen);) |
| 3820 | } |
| 3821 | |
| 3822 | /* |
| 3823 | * find session entry using BSSID in link identifier, not using MAC |
| 3824 | * header beacuse, there is cases in TDLS, there may be BSSID will not |
| 3825 | * be present in header |
| 3826 | */ |
| 3827 | psessionEntry = peFindSessionByBssid(pMac, |
| 3828 | &tdlsTeardown.LinkIdentifier.bssid[0], &sessionId) ; |
| 3829 | if(NULL == psessionEntry) |
| 3830 | { |
| 3831 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \ |
| 3832 | ("no Seesion entry for TDLS session (bssid %02x:%02x:%02x:%02x:%02x:%02x)\n"), \ |
| 3833 | tdlsTeardown.LinkIdentifier.bssid[0], |
| 3834 | tdlsTeardown.LinkIdentifier.bssid[1], |
| 3835 | tdlsTeardown.LinkIdentifier.bssid[2], |
| 3836 | tdlsTeardown.LinkIdentifier.bssid[3], |
| 3837 | tdlsTeardown.LinkIdentifier.bssid[4], |
| 3838 | tdlsTeardown.LinkIdentifier.bssid[5]) ; |
| 3839 | |
| 3840 | //VOS_ASSERT(0) ; |
| 3841 | return eSIR_FAILURE; |
| 3842 | } |
| 3843 | |
| 3844 | /* varify BSSID */ |
| 3845 | status = palEqualMemory(pMac->hHdd, psessionEntry->bssId, |
| 3846 | &tdlsTeardown.LinkIdentifier.bssid[0], |
| 3847 | sizeof(tSirMacAddr)) ; |
| 3848 | |
| 3849 | |
| 3850 | if(!status) |
| 3851 | { |
| 3852 | limLog( pMac, LOGE, FL("Teardown from other BSS -> something wrong. Check RXP filter\n")) ; |
| 3853 | VOS_ASSERT(0) ; |
| 3854 | return eSIR_FAILURE ; |
| 3855 | } |
| 3856 | |
| 3857 | limTdlsFindLinkPeer(pMac, |
| 3858 | &tdlsTeardown.LinkIdentifier.InitStaAddr[0], |
| 3859 | &setupPeer) ; |
| 3860 | |
| 3861 | if(NULL == setupPeer) |
| 3862 | { |
| 3863 | //ignore |
| 3864 | //VOS_ASSERT(0) ; |
| 3865 | limLog( pMac, LOGE, FL("Teardown from unknown peer. --> ignored\n") ); |
| 3866 | |
| 3867 | return eSIR_FAILURE ; |
| 3868 | } |
| 3869 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3870 | ("teardown for peer %02x,%02x,%02x,%02x,%02x,%02x\n"), |
| 3871 | (setupPeer)->peerMac[0], |
| 3872 | (setupPeer)->peerMac[1], |
| 3873 | (setupPeer)->peerMac[2], |
| 3874 | (setupPeer)->peerMac[3], |
| 3875 | (setupPeer)->peerMac[4], |
| 3876 | (setupPeer)->peerMac[5]) ; |
| 3877 | |
| 3878 | switch(tdlsTeardown.Reason.code) |
| 3879 | { |
| 3880 | case eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON: |
| 3881 | { |
| 3882 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3883 | ("teardown with unspecified reason\n")) ; |
| 3884 | break ; |
| 3885 | } |
| 3886 | case eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE: |
| 3887 | { |
| 3888 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3889 | (" Teardown from AP, TDLS peer unreachable\n")) ; |
| 3890 | break ; |
| 3891 | } |
| 3892 | default: |
| 3893 | { |
| 3894 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3895 | (" unknown teardown\n")) ; |
| 3896 | break ; |
| 3897 | } |
| 3898 | } |
| 3899 | |
| 3900 | /* change TDLS peer State */ |
| 3901 | (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ; |
| 3902 | (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ; |
| 3903 | |
| 3904 | do |
| 3905 | { |
| 3906 | tpDphHashNode pStaDs = NULL ; |
| 3907 | |
| 3908 | /* tdls_hklee: send message to HAL before it is deleted, cause */ |
| 3909 | limTdlsLinkTeardown(pMac, (setupPeer)->peerMac) ; |
| 3910 | |
| 3911 | /* send del STA to remove context for this TDLS STA */ |
| 3912 | pStaDs = limTdlsDelSta(pMac, (setupPeer)->peerMac, psessionEntry) ; |
| 3913 | |
| 3914 | /* now send indication to SME-->HDD->TL to remove STA from TL */ |
| 3915 | |
| 3916 | if(pStaDs) |
| 3917 | { |
| 3918 | limSendSmeTdlsDelPeerInd(pMac, psessionEntry->smeSessionId, |
| 3919 | pStaDs, eSIR_SUCCESS) ; |
| 3920 | |
| 3921 | /* send Teardown Ind to SME */ |
| 3922 | limSendSmeTdlsTeardownRsp(pMac, eSIR_SUCCESS, (setupPeer)->peerMac, |
| 3923 | eWNI_SME_TDLS_TEARDOWN_IND) ; |
| 3924 | /* remove node from setup list */ |
| 3925 | limTdlsDelLinkPeer(pMac, (setupPeer)->peerMac) ; |
| 3926 | } |
| 3927 | |
| 3928 | }while(0) ; |
| 3929 | |
| 3930 | return status ; |
| 3931 | } |
| 3932 | |
| 3933 | /* |
| 3934 | * Common processing of TDLS action frames recieved |
| 3935 | */ |
| 3936 | void limProcessTdlsFrame(tpAniSirGlobal pMac, tANI_U32 *pBd) |
| 3937 | { |
| 3938 | tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd); |
| 3939 | tANI_U8 pOffset = ((0 == WDA_GET_RX_FT_DONE(pBd)) |
| 3940 | ? (( sizeof( eth_890d_header ))) :(0)) ; |
| 3941 | |
| 3942 | tANI_U8 category = (pBody + pOffset + PAYLOAD_TYPE_TDLS_SIZE)[0] ; |
| 3943 | tANI_U8 action = (pBody + pOffset + PAYLOAD_TYPE_TDLS_SIZE)[1] ; |
| 3944 | tANI_U32 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd) ; |
| 3945 | tANI_U8 *tdlsFrameBody = (pBody + pOffset + PAYLOAD_TYPE_TDLS_SIZE) ; |
| 3946 | //tANI_S8 rssi = (tANI_S8)SIR_MAC_BD_TO_RSSI_DB(pBd); |
| 3947 | |
| 3948 | if(category != SIR_MAC_ACTION_TDLS) |
| 3949 | { |
| 3950 | limLog( pMac, LOGE, FL("Invalid TDLS action frame=(%d). Ignored\n"), category ); |
| 3951 | return ; |
| 3952 | } |
| 3953 | |
| 3954 | frameLen -= (pOffset + PAYLOAD_TYPE_TDLS_SIZE) ; |
| 3955 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("Received TDLS action %d (%s)"), \ |
| 3956 | action, limTraceTdlsActionString(action) )); |
| 3957 | |
| 3958 | switch(action) |
| 3959 | { |
| 3960 | |
| 3961 | case SIR_MAC_TDLS_SETUP_REQ: |
| 3962 | { |
| 3963 | limProcessTdlsSetupReqFrame(pMac, tdlsFrameBody, frameLen) ; |
| 3964 | break ; |
| 3965 | } |
| 3966 | case SIR_MAC_TDLS_SETUP_RSP: |
| 3967 | { |
| 3968 | limProcessTdlsSetupRspFrame(pMac, tdlsFrameBody, frameLen) ; |
| 3969 | break ; |
| 3970 | } |
| 3971 | case SIR_MAC_TDLS_SETUP_CNF: |
| 3972 | { |
| 3973 | limProcessTdlsSetupCnfFrame(pMac, tdlsFrameBody, frameLen) ; |
| 3974 | break ; |
| 3975 | } |
| 3976 | case SIR_MAC_TDLS_TEARDOWN: |
| 3977 | { |
| 3978 | limProcessTdlsTeardownFrame(pMac, tdlsFrameBody, frameLen) ; |
| 3979 | break ; |
| 3980 | } |
| 3981 | case SIR_MAC_TDLS_DIS_REQ: |
| 3982 | { |
| 3983 | limProcessTdlsDisReqFrame(pMac, tdlsFrameBody, frameLen) ; |
| 3984 | break ; |
| 3985 | } |
| 3986 | case SIR_MAC_TDLS_PEER_TRAFFIC_IND: |
| 3987 | case SIR_MAC_TDLS_CH_SWITCH_REQ: |
| 3988 | case SIR_MAC_TDLS_CH_SWITCH_RSP: |
| 3989 | case SIR_MAC_TDLS_PEER_TRAFFIC_RSP: |
| 3990 | default: |
| 3991 | { |
| 3992 | break ; |
| 3993 | } |
| 3994 | } |
| 3995 | |
| 3996 | return ; |
| 3997 | } |
| 3998 | |
| 3999 | /* |
| 4000 | * ADD sta for dis response fame sent on direct link |
| 4001 | */ |
| 4002 | static tSirRetStatus limTdlsDisAddSta(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
| 4003 | tSirTdlsPeerInfo *peerInfo, tpPESession psessionEntry) |
| 4004 | { |
| 4005 | tpDphHashNode pStaDs = NULL ; |
| 4006 | tSirRetStatus status = eSIR_SUCCESS ; |
| 4007 | tANI_U16 aid = 0 ; |
| 4008 | |
| 4009 | if(NULL == peerInfo) |
| 4010 | { |
| 4011 | VOS_ASSERT(0) ; |
| 4012 | return status ; |
| 4013 | |
| 4014 | } |
| 4015 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4016 | ("ADD STA peer MAC: %02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 4017 | peerMac[0], |
| 4018 | peerMac[1], |
| 4019 | peerMac[2], |
| 4020 | peerMac[3], |
| 4021 | peerMac[4], |
| 4022 | peerMac[5]) ; |
| 4023 | |
| 4024 | |
| 4025 | if(NULL != dphLookupHashEntry(pMac, peerMac, |
| 4026 | &aid, &psessionEntry->dph.dphHashTable)) |
| 4027 | { |
| 4028 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4029 | (" there is hash entry for this client\n")) ; |
| 4030 | status = eSIR_FAILURE ; |
| 4031 | VOS_ASSERT(0) ; |
| 4032 | return status ; |
| 4033 | } |
| 4034 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 4035 | aid = limAssignPeerIdx(pMac, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4036 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4037 | /* Set the aid in peerAIDBitmap as it has been assigned to TDLS peer */ |
| 4038 | SET_PEER_AID_BITMAP(psessionEntry->peerAIDBitmap, aid); |
| 4039 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4040 | pStaDs = dphGetHashEntry(pMac, aid, &psessionEntry->dph.dphHashTable); |
| 4041 | |
| 4042 | if (pStaDs) |
| 4043 | { |
| 4044 | (void) limDelSta(pMac, pStaDs, false /*asynchronous*/, psessionEntry); |
| 4045 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, aid, psessionEntry); |
| 4046 | } |
| 4047 | pStaDs = dphAddHashEntry(pMac, peerMac, aid, |
| 4048 | &psessionEntry->dph.dphHashTable) ; |
| 4049 | |
| 4050 | if(NULL == pStaDs) |
| 4051 | { |
| 4052 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4053 | (" add hash entry failed\n")) ; |
| 4054 | status = eSIR_FAILURE ; |
| 4055 | VOS_ASSERT(0) ; |
| 4056 | return status; |
| 4057 | } |
| 4058 | if(eSIR_SUCCESS == status) |
| 4059 | { |
| 4060 | #ifdef TDLS_RATE_DEBUG |
| 4061 | tSirMacRateSet *suppRates = &peerInfo->tdlsPeerSuppRates ; |
| 4062 | tSirMacRateSet *extRates = &peerInfo->tdlsPeerExtRates ; |
| 4063 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4064 | ("pSta DS [%p] \n"), pStaDs) ; |
| 4065 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4066 | ("peerInfo->tdlsPeerSuppRates = [%p]\n"), |
| 4067 | (tANI_U8 *)&peerInfo->tdlsPeerSuppRates) ; |
| 4068 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4069 | ("peerInfo->tdlsPeerExtRates = [%p]\n"), |
| 4070 | (tANI_U8 *)&peerInfo->tdlsPeerExtRates) ; |
| 4071 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4072 | ("peerInfo->tdlsPeerPropRates = [%p]\n"), |
| 4073 | (tANI_U8 *)&pStaDs->mlmStaContext.propRateSet) ; |
| 4074 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4075 | ("peerInfo->mcs = [%p]\n"), |
| 4076 | (tANI_U8 *)peerInfo->supportedMCSSet) ; |
| 4077 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4078 | ("num of supp rates = %02x\n"), suppRates->numRates) ; |
| 4079 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4080 | ("num of ext rates = %01x\n"), extRates->numRates) ; |
| 4081 | #endif |
| 4082 | |
| 4083 | /* Populate matching rate set */ |
| 4084 | #ifdef WLAN_FEATURE_11AC |
| 4085 | if(eSIR_FAILURE == limPopulateMatchingRateSet(pMac, pStaDs, |
| 4086 | &peerInfo->tdlsPeerSuppRates, |
| 4087 | &peerInfo->tdlsPeerExtRates, |
| 4088 | peerInfo->supportedMCSSet, |
| 4089 | &pStaDs->mlmStaContext.propRateSet, |
| 4090 | psessionEntry, NULL)) |
| 4091 | #else |
| 4092 | if(eSIR_FAILURE == limPopulateMatchingRateSet(pMac, pStaDs, |
| 4093 | &peerInfo->tdlsPeerSuppRates, |
| 4094 | &peerInfo->tdlsPeerExtRates, |
| 4095 | peerInfo->supportedMCSSet, |
| 4096 | &pStaDs->mlmStaContext.propRateSet, |
| 4097 | psessionEntry)) |
| 4098 | #endif |
| 4099 | { |
| 4100 | VOS_ASSERT(0) ; |
| 4101 | } |
| 4102 | |
| 4103 | |
| 4104 | pStaDs->mlmStaContext.capabilityInfo = peerInfo->capabilityInfo; |
| 4105 | palCopyMemory(pMac->hHdd, pStaDs->staAddr, peerMac, |
| 4106 | sizeof(tSirMacAddr)) ; |
| 4107 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4108 | ("Add STA for Peer: %02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 4109 | pStaDs->staAddr[0], |
| 4110 | pStaDs->staAddr[1], |
| 4111 | pStaDs->staAddr[2], |
| 4112 | pStaDs->staAddr[3], |
| 4113 | pStaDs->staAddr[4], |
| 4114 | pStaDs->staAddr[5]) ; |
| 4115 | |
| 4116 | |
| 4117 | pStaDs->staType = STA_ENTRY_TDLS_PEER ; |
| 4118 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4119 | status = limAddSta(pMac, pStaDs, false, psessionEntry); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4120 | |
| 4121 | if(eSIR_SUCCESS != status) |
| 4122 | { |
| 4123 | /* should not fail */ |
| 4124 | VOS_ASSERT(0) ; |
| 4125 | } |
| 4126 | } |
| 4127 | |
| 4128 | return status ; |
| 4129 | } |
| 4130 | #endif |
| 4131 | /* |
| 4132 | * Add STA for TDLS setup procedure |
| 4133 | */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4134 | static tSirRetStatus limTdlsSetupAddSta(tpAniSirGlobal pMac, |
| 4135 | tSirTdlsAddStaReq *pAddStaReq, |
| 4136 | tpPESession psessionEntry) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4137 | { |
| 4138 | tpDphHashNode pStaDs = NULL ; |
| 4139 | tSirRetStatus status = eSIR_SUCCESS ; |
| 4140 | tANI_U16 aid = 0 ; |
| 4141 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4142 | pStaDs = dphLookupHashEntry(pMac, pAddStaReq->peerMac, &aid, |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4143 | &psessionEntry->dph.dphHashTable); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4144 | if(NULL == pStaDs) |
| 4145 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4146 | aid = limAssignPeerIdx(pMac, psessionEntry) ; |
| 4147 | |
| 4148 | if( !aid ) |
| 4149 | { |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4150 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4151 | ("%s: No more free AID for peer " MAC_ADDRESS_STR), |
| 4152 | __func__, MAC_ADDR_ARRAY(pAddStaReq->peerMac)) ; |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4153 | return eSIR_FAILURE; |
| 4154 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4155 | |
| 4156 | /* Set the aid in peerAIDBitmap as it has been assigned to TDLS peer */ |
| 4157 | SET_PEER_AID_BITMAP(psessionEntry->peerAIDBitmap, aid); |
| 4158 | |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4159 | VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4160 | ("limTdlsSetupAddSta: Aid = %d, for peer =" MAC_ADDRESS_STR), |
| 4161 | aid, MAC_ADDR_ARRAY(pAddStaReq->peerMac)); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4162 | pStaDs = dphGetHashEntry(pMac, aid, &psessionEntry->dph.dphHashTable); |
| 4163 | |
| 4164 | if (pStaDs) |
| 4165 | { |
| 4166 | (void) limDelSta(pMac, pStaDs, false /*asynchronous*/, psessionEntry); |
| 4167 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, aid, psessionEntry); |
| 4168 | } |
| 4169 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4170 | pStaDs = dphAddHashEntry(pMac, pAddStaReq->peerMac, aid, |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4171 | &psessionEntry->dph.dphHashTable) ; |
| 4172 | |
| 4173 | if(NULL == pStaDs) |
| 4174 | { |
| 4175 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4176 | (" add hash entry failed\n")) ; |
| 4177 | status = eSIR_FAILURE ; |
| 4178 | VOS_ASSERT(0) ; |
| 4179 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4180 | } |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4181 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4182 | limTdlsUpdateHashNodeInfo(pMac, pStaDs, pAddStaReq, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4183 | |
| 4184 | pStaDs->staType = STA_ENTRY_TDLS_PEER ; |
| 4185 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4186 | status = limAddSta(pMac, pStaDs, (pAddStaReq->tdlsAddOper == TDLS_OPER_UPDATE) ? true: false, psessionEntry); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4187 | |
| 4188 | if(eSIR_SUCCESS != status) |
| 4189 | { |
| 4190 | /* should not fail */ |
| 4191 | VOS_ASSERT(0) ; |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 4192 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4193 | return status ; |
| 4194 | } |
| 4195 | |
| 4196 | /* |
| 4197 | * Del STA, after Link is teardown or discovery response sent on direct link |
| 4198 | */ |
| 4199 | static tpDphHashNode limTdlsDelSta(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
| 4200 | tpPESession psessionEntry) |
| 4201 | { |
| 4202 | tSirRetStatus status = eSIR_SUCCESS ; |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 4203 | tANI_U16 peerIdx = 0 ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4204 | tpDphHashNode pStaDs = NULL ; |
| 4205 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 4206 | pStaDs = dphLookupHashEntry(pMac, peerMac, &peerIdx, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4207 | &psessionEntry->dph.dphHashTable) ; |
| 4208 | |
| 4209 | if(pStaDs) |
| 4210 | { |
| 4211 | |
| 4212 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4213 | ("DEL STA peer MAC: %02x, %02x, %02x, %02x, %02x, %02x \n"), |
| 4214 | pStaDs->staAddr[0], |
| 4215 | pStaDs->staAddr[1], |
| 4216 | pStaDs->staAddr[2], |
| 4217 | pStaDs->staAddr[3], |
| 4218 | pStaDs->staAddr[4], |
| 4219 | pStaDs->staAddr[5] |
| 4220 | ) ; |
| 4221 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 4222 | VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, |
| 4223 | ("limTdlsDelSta: STA type = %x, sta idx = %x\n"),pStaDs->staType, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4224 | pStaDs->staIndex) ; |
| 4225 | |
| 4226 | status = limDelSta(pMac, pStaDs, false, psessionEntry) ; |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 4227 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4228 | if(eSIR_SUCCESS == status) |
| 4229 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 4230 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, peerIdx, psessionEntry) ; |
| 4231 | limReleasePeerIdx(pMac, peerIdx, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4232 | } |
| 4233 | else |
| 4234 | { |
| 4235 | VOS_ASSERT(0) ; |
| 4236 | } |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 4237 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4238 | } |
| 4239 | |
| 4240 | return pStaDs ; |
| 4241 | } |
| 4242 | |
| 4243 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 4244 | /* |
| 4245 | * Prepare link establish message for HAL, construct PTI template. |
| 4246 | * |
| 4247 | */ |
| 4248 | static tSirRetStatus limTdlsLinkEstablish(tpAniSirGlobal pMac, tSirMacAddr peerMac) |
| 4249 | { |
| 4250 | tANI_U8 pFrame[64] ; |
| 4251 | tDot11fTDLSPeerTrafficInd tdlsPtiTemplate ; |
| 4252 | tANI_U32 status = 0 ; |
| 4253 | tANI_U32 nPayload = 0 ; |
| 4254 | tANI_U32 nBytes = 0 ; |
| 4255 | tANI_U32 header_offset = 0 ; |
| 4256 | tANI_U16 aid = 0 ; |
| 4257 | tDphHashNode *pStaDs = NULL ; |
| 4258 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 4259 | tpPESession psessionEntry = NULL ; |
| 4260 | |
| 4261 | |
| 4262 | limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ; |
| 4263 | if(NULL == setupPeer) { |
| 4264 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4265 | ("limTdlsLinkEstablish: cannot find peer mac in tdls linksetup list: %02X %02X %02X %02X %02X %02X\n"), \ |
| 4266 | peerMac[0], peerMac[1], peerMac[2], \ |
| 4267 | peerMac[3], peerMac[4], peerMac[5]); |
| 4268 | return eSIR_FAILURE; |
| 4269 | } |
| 4270 | |
| 4271 | psessionEntry = peFindSessionBySessionId(pMac, |
| 4272 | setupPeer->tdls_sessionId) ; |
| 4273 | |
| 4274 | if(NULL == psessionEntry) |
| 4275 | { |
| 4276 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4277 | ("limTdlsLinkEstablish: sessionID %d is not found\n"), setupPeer->tdls_sessionId); |
| 4278 | VOS_ASSERT(0) ; |
| 4279 | return eHAL_STATUS_FAILURE; |
| 4280 | } |
| 4281 | |
| 4282 | /* */ |
| 4283 | pStaDs = dphLookupHashEntry(pMac, peerMac, &aid, &psessionEntry->dph.dphHashTable) ; |
| 4284 | if(pStaDs == NULL) { |
| 4285 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4286 | ("limTdlsLinkEstablish: cannot find peer mac in hash table: %02X %02X %02X %02X %02X %02X\n"), \ |
| 4287 | peerMac[0], peerMac[1], peerMac[2], \ |
| 4288 | peerMac[3], peerMac[4], peerMac[5]); |
| 4289 | return eSIR_FAILURE; |
| 4290 | } |
| 4291 | |
| 4292 | palZeroMemory( pMac->hHdd, ( tANI_U8* )&tdlsPtiTemplate, |
| 4293 | sizeof( tDot11fTDLSPeerTrafficInd ) ); |
| 4294 | |
| 4295 | /* |
| 4296 | * setup Fixed fields, |
| 4297 | */ |
| 4298 | tdlsPtiTemplate.Category.category = SIR_MAC_ACTION_TDLS; |
| 4299 | tdlsPtiTemplate.Action.action = SIR_MAC_TDLS_PEER_TRAFFIC_IND; |
| 4300 | tdlsPtiTemplate.DialogToken.token = 0 ; /* filled by firmware at the time of transmission */ |
| 4301 | #if 1 |
| 4302 | /* CHECK_PTI_LINK_IDENTIFIER_INITIATOR_ADDRESS: initator address should be TDLS link setup's initiator address, |
| 4303 | then below code makes such an way */ |
| 4304 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsPtiTemplate.LinkIdentifier, |
| 4305 | peerMac, !setupPeer->tdls_bIsResponder) ; |
| 4306 | #else |
| 4307 | /* below code will make PTI's linkIdentifier's initiator address be selfAddr */ |
| 4308 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsPtiTemplate.LinkIdentifier, |
| 4309 | peerMac, TDLS_INITIATOR) ; |
| 4310 | #endif |
| 4311 | |
| 4312 | /* PUBufferStatus will be filled by firmware at the time of transmission */ |
| 4313 | tdlsPtiTemplate.PUBufferStatus.present = 1; |
| 4314 | |
| 4315 | /* TODO: get ExtendedCapabilities IE */ |
| 4316 | |
| 4317 | /* |
| 4318 | * now we pack it. First, how much space are we going to need? |
| 4319 | */ |
| 4320 | status = dot11fGetPackedTDLSPeerTrafficIndSize ( pMac, &tdlsPtiTemplate, &nPayload); |
| 4321 | if ( DOT11F_FAILED( status ) ) |
| 4322 | { |
| 4323 | limLog( pMac, LOGP, FL("Failed to calculate the packed size for a PTI template (0x%08x).\n"), status ); |
| 4324 | /* We'll fall back on the worst case scenario: */ |
| 4325 | nPayload = sizeof( tdlsPtiTemplate ); |
| 4326 | } |
| 4327 | else if ( DOT11F_WARNED( status ) ) |
| 4328 | { |
| 4329 | limLog( pMac, LOGW, FL("There were warnings while calculating the packed size for a PTI template (0x%08x).\n"), status ); |
| 4330 | } |
| 4331 | |
| 4332 | /* |
| 4333 | * This frame is going out from PE as data frames with special ethertype |
| 4334 | * 89-0d. |
| 4335 | * 8 bytes of RFC 1042 header |
| 4336 | */ |
| 4337 | |
| 4338 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) |
| 4339 | + sizeof( eth_890d_header ) |
| 4340 | + PAYLOAD_TYPE_TDLS_SIZE ; |
| 4341 | |
| 4342 | if(nBytes > 64) { |
| 4343 | limLog( pMac, LOGE, FL("required memory for PTI frame is %ld, but reserved only 64.\n"), nBytes); |
| 4344 | nBytes = 64; |
| 4345 | } |
| 4346 | /* zero out the memory */ |
| 4347 | palZeroMemory( pMac->hHdd, pFrame, sizeof(pFrame) ); |
| 4348 | |
| 4349 | /* fill out the buffer descriptor */ |
| 4350 | |
| 4351 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 4352 | LINK_IDEN_ADDR_OFFSET(tdlsPtiTemplate), TDLS_LINK_AP, !setupPeer->tdls_bIsResponder, psessionEntry) ; |
| 4353 | |
| 4354 | status = dot11fPackTDLSPeerTrafficInd ( pMac, &tdlsPtiTemplate, pFrame |
| 4355 | + header_offset, nPayload, &nPayload ); |
| 4356 | |
| 4357 | if ( DOT11F_FAILED( status ) ) |
| 4358 | { |
| 4359 | limLog( pMac, LOGE, FL("Failed to pack a PTI template \ |
| 4360 | (0x%08x).\n"), status ); |
| 4361 | return eSIR_FAILURE; |
| 4362 | } |
| 4363 | else if ( DOT11F_WARNED( status ) ) |
| 4364 | { |
| 4365 | limLog( pMac, LOGW, FL("There were warnings while packing TDLS" |
| 4366 | "Peer Traffic Indication (0x%08x).\n") ); |
| 4367 | } |
| 4368 | |
| 4369 | LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("bIsResponder=%d, header_offset=%ld, linkIdenOffset=%d, ptiBufStatusOffset=%d \n"), \ |
| 4370 | setupPeer->tdls_bIsResponder, header_offset, PTI_LINK_IDEN_OFFSET, PTI_BUF_STATUS_OFFSET)); |
| 4371 | |
| 4372 | limSendTdlsLinkEstablish(pMac, setupPeer->tdls_bIsResponder, |
| 4373 | header_offset+PTI_LINK_IDEN_OFFSET, header_offset+PTI_BUF_STATUS_OFFSET, |
| 4374 | nBytes, pFrame, (tANI_U8 *)&setupPeer->tdlsPeerExtCaps); |
| 4375 | |
| 4376 | return eSIR_SUCCESS; |
| 4377 | } |
| 4378 | |
| 4379 | /* |
| 4380 | * Prepare link teardown message for HAL from peer_mac |
| 4381 | * |
| 4382 | */ |
| 4383 | static tSirRetStatus limTdlsLinkTeardown(tpAniSirGlobal pMac, tSirMacAddr peerMac) |
| 4384 | { |
| 4385 | tDphHashNode *pStaDs = NULL ; |
| 4386 | tANI_U16 aid = 0 ; |
| 4387 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 4388 | tpPESession psessionEntry = NULL ; |
| 4389 | |
| 4390 | |
| 4391 | limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ; |
| 4392 | if(NULL == setupPeer) { |
| 4393 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4394 | ("limTdlsLinkTeardown: cannot find peer mac in tdls linksetup list: %02X %02X %02X %02X %02X %02X\n"), \ |
| 4395 | peerMac[0], peerMac[1], peerMac[2], \ |
| 4396 | peerMac[3], peerMac[4], peerMac[5]); |
| 4397 | return eSIR_FAILURE; |
| 4398 | } |
| 4399 | |
| 4400 | psessionEntry = peFindSessionBySessionId(pMac, |
| 4401 | setupPeer->tdls_sessionId) ; |
| 4402 | |
| 4403 | if(NULL == psessionEntry) |
| 4404 | { |
| 4405 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4406 | ("limTdlsLinkTeardown: sessionID %d is not found\n"), setupPeer->tdls_sessionId); |
| 4407 | VOS_ASSERT(0) ; |
| 4408 | return eHAL_STATUS_FAILURE; |
| 4409 | } |
| 4410 | |
| 4411 | |
| 4412 | /* */ |
| 4413 | pStaDs = dphLookupHashEntry(pMac, peerMac, &aid, &psessionEntry->dph.dphHashTable); |
| 4414 | |
| 4415 | if(pStaDs == NULL) { |
| 4416 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4417 | ("limTdlsLinkTeardown: cannot find peer mac in hash table: %02X %02X %02X %02X %02X %02X\n"), \ |
| 4418 | peerMac[0], peerMac[1], peerMac[2], \ |
| 4419 | peerMac[3], peerMac[4], peerMac[5]); |
| 4420 | return eSIR_FAILURE; |
| 4421 | } |
| 4422 | |
| 4423 | limSendTdlsLinkTeardown(pMac, pStaDs->staIndex); |
| 4424 | |
| 4425 | return eSIR_SUCCESS; |
| 4426 | } |
| 4427 | |
| 4428 | /* |
| 4429 | * Prepare Discovery RSP message for SME, collect peerINfo for all the |
| 4430 | * peers discovered and delete/clean discovery lists in PE. |
| 4431 | */ |
| 4432 | |
| 4433 | static tSirTdlsDisRsp *tdlsPrepareTdlsDisRsp(tpAniSirGlobal pMac, |
| 4434 | tSirTdlsDisRsp *disRsp, tANI_U8 disStaCount) |
| 4435 | { |
| 4436 | tANI_U32 disMsgRspSize = sizeof(tSirTdlsDisRsp); |
| 4437 | tANI_U8 status = eHAL_STATUS_SUCCESS ; |
| 4438 | |
| 4439 | /* |
| 4440 | * allocate memory for tdls discovery response, allocated memory should |
| 4441 | * be alloc_mem = tdlsStaCount * sizeof(peerinfo) |
| 4442 | * + siezeof tSirTdlsDisRsp. |
| 4443 | */ |
| 4444 | disMsgRspSize += (disStaCount * sizeof(tSirTdlsPeerInfo)); |
| 4445 | |
| 4446 | /* now allocate memory */ |
| 4447 | status = palAllocateMemory( pMac->hHdd, (void **)&disRsp, disMsgRspSize ) ; |
| 4448 | |
| 4449 | if(eHAL_STATUS_FAILURE == status) |
| 4450 | { |
| 4451 | limLog(pMac, LOGP, FL("palAllocateMemory failed for DIS RSP")); |
| 4452 | return NULL ; |
| 4453 | } |
| 4454 | |
| 4455 | if(disStaCount) |
| 4456 | { |
| 4457 | tLimDisResultList *tdlsDisRspList = pMac->lim.gLimTdlsDisResultList ; |
| 4458 | tSirTdlsPeerInfo *peerInfo = &disRsp->tdlsDisPeerInfo[0] ; |
| 4459 | |
| 4460 | tLimDisResultList *currentNode = tdlsDisRspList ; |
| 4461 | while(tdlsDisRspList != NULL) |
| 4462 | { |
| 4463 | |
| 4464 | palCopyMemory( pMac->hHdd, (tANI_U8 *)peerInfo, |
| 4465 | (tANI_U8 *) &tdlsDisRspList->tdlsDisPeerInfo, |
| 4466 | sizeof(tSirTdlsPeerInfo)); |
| 4467 | |
| 4468 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 4469 | ("Msg Sent to PE, peer MAC: %02x, %02x, %02x, %02x, %02x, %02x\n"), |
| 4470 | peerInfo->peerMac[0] , |
| 4471 | peerInfo->peerMac[1] , |
| 4472 | peerInfo->peerMac[2] , |
| 4473 | peerInfo->peerMac[3] , |
| 4474 | peerInfo->peerMac[4] , |
| 4475 | peerInfo->peerMac[5]) ; |
| 4476 | disStaCount-- ; |
| 4477 | peerInfo++ ; |
| 4478 | currentNode = tdlsDisRspList ; |
| 4479 | tdlsDisRspList = tdlsDisRspList->next ; |
| 4480 | palFreeMemory(pMac->hHdd, currentNode) ; |
| 4481 | /* boundary condition check, may be fatal */ |
| 4482 | if(((!disStaCount) && (tdlsDisRspList)) |
| 4483 | || ((!tdlsDisRspList) && disStaCount)) |
| 4484 | { |
| 4485 | limLog(pMac, LOG1, FL("mismatch in dis sta count and\ |
| 4486 | and number of nodes in list\n")) ; |
| 4487 | VOS_ASSERT(0) ; |
| 4488 | return NULL ; |
| 4489 | } |
| 4490 | } /* end of while */ |
| 4491 | |
| 4492 | /* All discovery STA processed */ |
| 4493 | pMac->lim.gLimTdlsDisResultList = NULL ; |
| 4494 | |
| 4495 | } /* end of if dis STA count */ |
| 4496 | |
| 4497 | return (disRsp) ; |
| 4498 | } |
| 4499 | |
| 4500 | /* Send Teardown response back to PE */ |
| 4501 | |
| 4502 | void limSendSmeTdlsTeardownRsp(tpAniSirGlobal pMac, tSirResultCodes statusCode, |
| 4503 | tSirMacAddr peerMac, tANI_U16 msgType) |
| 4504 | { |
| 4505 | tSirMsgQ mmhMsg = {0} ; |
| 4506 | tSirTdlsTeardownRsp *teardownRspMsg = NULL ; |
| 4507 | tANI_U8 status = eHAL_STATUS_SUCCESS ; |
| 4508 | |
| 4509 | mmhMsg.type = msgType ; |
| 4510 | |
| 4511 | status = palAllocateMemory( pMac->hHdd, (void **)&teardownRspMsg, |
| 4512 | sizeof(tSirTdlsTeardownRsp)) ; |
| 4513 | |
| 4514 | if(eHAL_STATUS_SUCCESS != status) |
| 4515 | { |
| 4516 | VOS_ASSERT(0) ; |
| 4517 | } |
| 4518 | palCopyMemory( pMac->hHdd, teardownRspMsg->peerMac, (tANI_U8 *)peerMac, |
| 4519 | sizeof(tSirMacAddr)) ; |
| 4520 | teardownRspMsg->statusCode = statusCode ; |
| 4521 | mmhMsg.bodyptr = teardownRspMsg ; |
| 4522 | mmhMsg.bodyval = 0; |
| 4523 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 4524 | |
| 4525 | return ; |
| 4526 | |
| 4527 | } |
| 4528 | |
| 4529 | /* |
| 4530 | * Send Link start RSP back to SME after link is setup or failed |
| 4531 | */ |
| 4532 | void limSendSmeTdlsLinkStartRsp(tpAniSirGlobal pMac, |
| 4533 | tSirResultCodes statusCode, |
| 4534 | tSirMacAddr peerMac, |
| 4535 | tANI_U16 msgType) |
| 4536 | { |
| 4537 | tSirMsgQ mmhMsg = {0} ; |
| 4538 | tSirTdlsLinksetupRsp *setupRspMsg = NULL ; |
| 4539 | tANI_U8 status = eHAL_STATUS_SUCCESS ; |
| 4540 | |
| 4541 | mmhMsg.type = msgType ; |
| 4542 | |
| 4543 | status = palAllocateMemory( pMac->hHdd, (void **)&setupRspMsg, |
| 4544 | sizeof(tSirTdlsLinksetupRsp)) ; |
| 4545 | |
| 4546 | if(eHAL_STATUS_SUCCESS != status) |
| 4547 | { |
| 4548 | VOS_ASSERT(0) ; |
| 4549 | } |
| 4550 | |
| 4551 | palCopyMemory( pMac->hHdd, setupRspMsg->peerMac, (tANI_U8 *)peerMac, |
| 4552 | sizeof(tSirMacAddr)) ; |
| 4553 | setupRspMsg->statusCode = statusCode ; |
| 4554 | mmhMsg.bodyptr = setupRspMsg ; |
| 4555 | mmhMsg.bodyval = 0; |
| 4556 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 4557 | |
| 4558 | return ; |
| 4559 | } |
| 4560 | |
| 4561 | /* |
| 4562 | * Send TDLS discovery RSP back to SME |
| 4563 | */ |
| 4564 | void limSendSmeTdlsDisRsp(tpAniSirGlobal pMac, tSirResultCodes statusCode, |
| 4565 | tANI_U16 msgType) |
| 4566 | { |
| 4567 | tSirMsgQ mmhMsg = {0} ; |
| 4568 | tSirTdlsDisRsp *tdlsDisRsp = NULL ; |
| 4569 | |
| 4570 | mmhMsg.type = msgType ; |
| 4571 | |
| 4572 | if(eSIR_SME_SUCCESS == statusCode) |
| 4573 | { |
| 4574 | tANI_U8 tdlsStaCount = pMac->lim.gLimTdlsDisStaCount ; |
| 4575 | |
| 4576 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4577 | ("no of TDLS STA discovered: %d\n"), tdlsStaCount) ; |
| 4578 | tdlsDisRsp = tdlsPrepareTdlsDisRsp(pMac, tdlsDisRsp, tdlsStaCount) ; |
| 4579 | |
| 4580 | if(tdlsDisRsp) |
| 4581 | { |
| 4582 | tdlsDisRsp->numDisSta = tdlsStaCount ; |
| 4583 | } |
| 4584 | else |
| 4585 | { |
| 4586 | limLog(pMac, LOGP, FL("fatal failure for TDLS DIS RSP\n")); |
| 4587 | VOS_ASSERT(0) ; |
| 4588 | return ; |
| 4589 | } |
| 4590 | /* all Discovery STA is processed */ |
| 4591 | pMac->lim.gLimTdlsDisStaCount = 0 ; |
| 4592 | } |
| 4593 | else |
| 4594 | { |
| 4595 | tdlsDisRsp = tdlsPrepareTdlsDisRsp(pMac, tdlsDisRsp, 0) ; |
| 4596 | } |
| 4597 | |
| 4598 | tdlsDisRsp->statusCode = statusCode ; |
| 4599 | mmhMsg.bodyptr = tdlsDisRsp ; |
| 4600 | mmhMsg.bodyval = 0; |
| 4601 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 4602 | |
| 4603 | return ; |
| 4604 | } |
| 4605 | |
| 4606 | /* |
| 4607 | * Once Link is setup with PEER, send Add STA ind to SME |
| 4608 | */ |
| 4609 | static eHalStatus limSendSmeTdlsAddPeerInd(tpAniSirGlobal pMac, |
| 4610 | tANI_U8 sessionId, tDphHashNode *pStaDs, tANI_U8 status) |
| 4611 | { |
| 4612 | tSirMsgQ mmhMsg = {0} ; |
| 4613 | tSirTdlsPeerInd *peerInd = NULL ; |
| 4614 | mmhMsg.type = eWNI_SME_ADD_TDLS_PEER_IND ; |
| 4615 | if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,(void * *) &peerInd, |
| 4616 | (sizeof(tSirTdlsPeerInd)))) |
| 4617 | { |
| 4618 | PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));) |
| 4619 | return eSIR_FAILURE; |
| 4620 | } |
| 4621 | |
| 4622 | palCopyMemory( pMac->hHdd, peerInd->peerMac, |
| 4623 | (tANI_U8 *) pStaDs->staAddr, sizeof(tSirMacAddr)); |
| 4624 | peerInd->sessionId = sessionId; |
| 4625 | peerInd->staId = pStaDs->staIndex ; |
| 4626 | peerInd->ucastSig = pStaDs->ucUcastSig ; |
| 4627 | peerInd->bcastSig = pStaDs->ucBcastSig ; |
| 4628 | peerInd->length = sizeof(tSmeIbssPeerInd) ; |
| 4629 | |
| 4630 | mmhMsg.bodyptr = peerInd ; |
| 4631 | mmhMsg.bodyval = 0; |
| 4632 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 4633 | |
| 4634 | return eSIR_SUCCESS ; |
| 4635 | |
| 4636 | } |
| 4637 | |
| 4638 | /* |
| 4639 | * Once link is teardown, send Del Peer Ind to SME |
| 4640 | */ |
| 4641 | static eHalStatus limSendSmeTdlsDelPeerInd(tpAniSirGlobal pMac, |
| 4642 | tANI_U8 sessionId, tDphHashNode *pStaDs, tANI_U8 status) |
| 4643 | { |
| 4644 | tSirMsgQ mmhMsg = {0} ; |
| 4645 | tSirTdlsPeerInd *peerInd = NULL ; |
| 4646 | mmhMsg.type = eWNI_SME_DELETE_TDLS_PEER_IND ; |
| 4647 | if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,(void * *) &peerInd, |
| 4648 | (sizeof(tSirTdlsPeerInd)))) |
| 4649 | { |
| 4650 | PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));) |
| 4651 | return eSIR_FAILURE; |
| 4652 | } |
| 4653 | |
| 4654 | palCopyMemory( pMac->hHdd, peerInd->peerMac, |
| 4655 | (tANI_U8 *) pStaDs->staAddr, sizeof(tSirMacAddr)); |
| 4656 | peerInd->sessionId = sessionId; |
| 4657 | peerInd->staId = pStaDs->staIndex ; |
| 4658 | peerInd->ucastSig = pStaDs->ucUcastSig ; |
| 4659 | peerInd->bcastSig = pStaDs->ucBcastSig ; |
| 4660 | peerInd->length = sizeof(tSmeIbssPeerInd) ; |
| 4661 | |
| 4662 | mmhMsg.bodyptr = peerInd ; |
| 4663 | |
| 4664 | //peerInd->statusCode = status ; |
| 4665 | mmhMsg.bodyval = 0; |
| 4666 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 4667 | return eSIR_SUCCESS ; |
| 4668 | |
| 4669 | } |
| 4670 | |
| 4671 | /* |
| 4672 | * Send Link setup Ind to SME, This is the case where, link setup is |
| 4673 | * initiated by peer STA |
| 4674 | */ |
| 4675 | static eHalStatus limSendSmeTdlsLinkSetupInd(tpAniSirGlobal pMac, |
| 4676 | tSirMacAddr peerMac, tANI_U8 status) |
| 4677 | { |
| 4678 | tSirMsgQ mmhMsg = {0} ; |
| 4679 | tSirTdlsLinkSetupInd *setupInd = NULL ; |
| 4680 | |
| 4681 | mmhMsg.type = eWNI_SME_TDLS_LINK_START_IND ; |
| 4682 | if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,(void * *) &setupInd, |
| 4683 | (sizeof(tSirTdlsLinkSetupInd)))) |
| 4684 | { |
| 4685 | PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));) |
| 4686 | return eSIR_FAILURE; |
| 4687 | } |
| 4688 | |
| 4689 | palCopyMemory( pMac->hHdd, setupInd->peerMac, |
| 4690 | (tANI_U8 *) peerMac, sizeof(tSirMacAddr)); |
| 4691 | setupInd->length = sizeof(tSirTdlsLinkSetupInd); |
| 4692 | setupInd->statusCode = status ; |
| 4693 | mmhMsg.bodyptr = setupInd ; |
| 4694 | mmhMsg.bodyval = 0; |
| 4695 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 4696 | |
| 4697 | return eSIR_SUCCESS ; |
| 4698 | |
| 4699 | } |
| 4700 | |
| 4701 | /* |
| 4702 | * Setup RSP timer handler |
| 4703 | */ |
| 4704 | void limTdlsLinkSetupRspTimerHandler(void *pMacGlobal, tANI_U32 timerId) |
| 4705 | { |
| 4706 | |
| 4707 | tANI_U32 statusCode; |
| 4708 | tSirMsgQ msg; |
| 4709 | tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal; |
| 4710 | |
| 4711 | /* Prepare and post message to LIM Message Queue */ |
| 4712 | |
| 4713 | msg.type = SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT; |
| 4714 | msg.bodyptr = NULL ; |
| 4715 | msg.bodyval = timerId ; |
| 4716 | |
| 4717 | if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS) |
| 4718 | limLog(pMac, LOGE, |
| 4719 | FL("posting message %X to LIM failed, reason=%d\n"), |
| 4720 | msg.type, statusCode); |
| 4721 | return ; |
| 4722 | } |
| 4723 | |
| 4724 | /* |
| 4725 | * Link setup CNF timer |
| 4726 | */ |
| 4727 | void limTdlsLinkSetupCnfTimerHandler(void *pMacGlobal, tANI_U32 timerId) |
| 4728 | { |
| 4729 | |
| 4730 | tANI_U32 statusCode; |
| 4731 | tSirMsgQ msg; |
| 4732 | tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal; |
| 4733 | |
| 4734 | // Prepare and post message to LIM Message Queue |
| 4735 | |
| 4736 | msg.type = SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT; |
| 4737 | msg.bodyptr = NULL ; |
| 4738 | msg.bodyval = timerId ; |
| 4739 | |
| 4740 | if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS) |
| 4741 | limLog(pMac, LOGE, |
| 4742 | FL("posting message %X to LIM failed, reason=%d\n"), |
| 4743 | msg.type, statusCode); |
| 4744 | return ; |
| 4745 | } |
| 4746 | |
| 4747 | /* |
| 4748 | * start TDLS timer |
| 4749 | */ |
| 4750 | void limStartTdlsTimer(tpAniSirGlobal pMac, tANI_U8 sessionId, TX_TIMER *timer, |
| 4751 | tANI_U32 timerId, tANI_U16 timerType, tANI_U32 timerMsg) |
| 4752 | { |
| 4753 | tANI_U32 cfgValue = (timerMsg == SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) |
| 4754 | ? WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT |
| 4755 | : WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT ; |
| 4756 | |
| 4757 | void *timerFunc = (timerMsg == SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) |
| 4758 | ? (limTdlsLinkSetupRspTimerHandler) |
| 4759 | : limTdlsLinkSetupCnfTimerHandler ; |
| 4760 | |
| 4761 | /* TODO: Read timer vals from CFG */ |
| 4762 | |
| 4763 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 4764 | /* |
| 4765 | * create TDLS discovery response wait timer and activate it |
| 4766 | */ |
| 4767 | if (tx_timer_create(timer, "TDLS link setup timers", timerFunc, |
| 4768 | timerId, cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) |
| 4769 | { |
| 4770 | limLog(pMac, LOGP, |
| 4771 | FL("could not create TDLS discovery response wait timer\n")); |
| 4772 | return; |
| 4773 | } |
| 4774 | |
| 4775 | //assign appropriate sessionId to the timer object |
| 4776 | timer->sessionId = sessionId; |
| 4777 | |
| 4778 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, |
| 4779 | eLIM_TDLS_DISCOVERY_RSP_WAIT)); |
| 4780 | if (tx_timer_activate(timer) != TX_SUCCESS) |
| 4781 | { |
| 4782 | limLog(pMac, LOGP, FL("TDLS link setup timer activation failed!\n")); |
| 4783 | return ; |
| 4784 | } |
| 4785 | |
| 4786 | return ; |
| 4787 | |
| 4788 | } |
| 4789 | #endif |
| 4790 | |
| 4791 | /* |
| 4792 | * Once Link is setup with PEER, send Add STA ind to SME |
| 4793 | */ |
| 4794 | static eHalStatus limSendSmeTdlsAddStaRsp(tpAniSirGlobal pMac, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4795 | tANI_U8 sessionId, tSirMacAddr peerMac, tANI_U8 updateSta, |
| 4796 | tDphHashNode *pStaDs, tANI_U8 status) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4797 | { |
| 4798 | tSirMsgQ mmhMsg = {0} ; |
| 4799 | tSirTdlsAddStaRsp *addStaRsp = NULL ; |
| 4800 | mmhMsg.type = eWNI_SME_TDLS_ADD_STA_RSP ; |
| 4801 | if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,(void * *) &addStaRsp, |
| 4802 | (sizeof(tSirTdlsAddStaRsp)))) |
| 4803 | { |
| 4804 | PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));) |
| 4805 | return eSIR_FAILURE; |
| 4806 | } |
| 4807 | |
| 4808 | addStaRsp->sessionId = sessionId; |
| 4809 | addStaRsp->statusCode = status; |
| 4810 | if( pStaDs ) |
| 4811 | { |
| 4812 | addStaRsp->staId = pStaDs->staIndex ; |
| 4813 | addStaRsp->ucastSig = pStaDs->ucUcastSig ; |
| 4814 | addStaRsp->bcastSig = pStaDs->ucBcastSig ; |
| 4815 | } |
| 4816 | if( peerMac ) |
| 4817 | { |
| 4818 | palCopyMemory( pMac->hHdd, addStaRsp->peerMac, |
| 4819 | (tANI_U8 *) peerMac, sizeof(tSirMacAddr)); |
| 4820 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4821 | if (updateSta) |
| 4822 | addStaRsp->tdlsAddOper = TDLS_OPER_UPDATE; |
| 4823 | else |
| 4824 | addStaRsp->tdlsAddOper = TDLS_OPER_ADD; |
| 4825 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4826 | addStaRsp->length = sizeof(tSirTdlsAddStaRsp) ; |
| 4827 | addStaRsp->messageType = eWNI_SME_TDLS_ADD_STA_RSP ; |
| 4828 | |
| 4829 | mmhMsg.bodyptr = addStaRsp; |
| 4830 | mmhMsg.bodyval = 0; |
| 4831 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 4832 | |
| 4833 | return eSIR_SUCCESS ; |
| 4834 | |
| 4835 | } |
| 4836 | /* |
| 4837 | * STA RSP received from HAL |
| 4838 | */ |
| 4839 | eHalStatus limProcessTdlsAddStaRsp(tpAniSirGlobal pMac, void *msg, |
| 4840 | tpPESession psessionEntry) |
| 4841 | { |
| 4842 | tAddStaParams *pAddStaParams = (tAddStaParams *) msg ; |
| 4843 | tANI_U8 status = eSIR_SUCCESS ; |
| 4844 | tDphHashNode *pStaDs = NULL ; |
| 4845 | tANI_U16 aid = 0 ; |
| 4846 | |
| 4847 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 4848 | VOS_TRACE(VOS_MODULE_ID_PE, TDLS_DEBUG_LOG_LEVEL, |
| 4849 | ("limTdlsAddStaRsp: staIdx=%d, staMac=%02x:%02x:%02x:%02x:%02x:%02x"), pAddStaParams->staIdx, \ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4850 | pAddStaParams->staMac[0], |
| 4851 | pAddStaParams->staMac[1], |
| 4852 | pAddStaParams->staMac[2], |
| 4853 | pAddStaParams->staMac[3], |
| 4854 | pAddStaParams->staMac[4], |
| 4855 | pAddStaParams->staMac[5] ) ; |
| 4856 | |
| 4857 | if (pAddStaParams->status != eHAL_STATUS_SUCCESS) |
| 4858 | { |
| 4859 | VOS_ASSERT(0) ; |
| 4860 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4861 | ("Add sta failed \n")) ; |
| 4862 | status = eSIR_FAILURE; |
| 4863 | goto add_sta_error; |
| 4864 | } |
| 4865 | |
| 4866 | pStaDs = dphLookupHashEntry(pMac, pAddStaParams->staMac, &aid, |
| 4867 | &psessionEntry->dph.dphHashTable); |
| 4868 | if(NULL == pStaDs) |
| 4869 | { |
| 4870 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4871 | ("pStaDs is NULL \n")) ; |
| 4872 | status = eSIR_FAILURE; |
| 4873 | goto add_sta_error; |
| 4874 | } |
| 4875 | |
| 4876 | pStaDs->bssId = pAddStaParams->bssIdx; |
| 4877 | pStaDs->staIndex = pAddStaParams->staIdx; |
| 4878 | pStaDs->ucUcastSig = pAddStaParams->ucUcastSig; |
| 4879 | pStaDs->ucBcastSig = pAddStaParams->ucBcastSig; |
| 4880 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 4881 | pStaDs->valid = 1 ; |
| 4882 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 4883 | status = limSendSmeTdlsAddPeerInd(pMac, psessionEntry->smeSessionId, |
| 4884 | pStaDs, eSIR_SUCCESS ) ; |
| 4885 | if(eSIR_FAILURE == status) |
| 4886 | { |
| 4887 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 4888 | ("Peer IND msg to SME failed\n")) ; |
| 4889 | palFreeMemory( pMac->hHdd, (void *) pAddStaParams ); |
| 4890 | return eSIR_FAILURE ; |
| 4891 | } |
| 4892 | |
| 4893 | /* |
| 4894 | * Now, there is two things a) ADD STA RSP for ADD STA request sent |
| 4895 | * after recieving discovery request from Peer. |
| 4896 | * now we have to send discovery response, if there is any pending |
| 4897 | * discovery equest.. |
| 4898 | */ |
| 4899 | do |
| 4900 | { |
| 4901 | tSirTdlsPeerInfo *peerInfo = limTdlsFindDisPeer(pMac, |
| 4902 | pAddStaParams->staMac) ; |
| 4903 | |
| 4904 | |
| 4905 | if(peerInfo) |
| 4906 | { |
| 4907 | /* |
| 4908 | * send TDLS discovery response frame on direct link, state machine |
| 4909 | * is rolling.., once discovery response is get Acked, we will |
| 4910 | * send response to SME based on TxComplete callback results |
| 4911 | */ |
| 4912 | limSendTdlsDisRspFrame(pMac, peerInfo->peerMac, peerInfo->dialog, psessionEntry) ; |
| 4913 | peerInfo->tdlsPeerState = TDLS_DIS_RSP_SENT_WAIT_STATE ; |
| 4914 | } |
| 4915 | } while(0) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4916 | #endif |
| 4917 | add_sta_error: |
| 4918 | status = limSendSmeTdlsAddStaRsp(pMac, psessionEntry->smeSessionId, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 4919 | pAddStaParams->staMac, pAddStaParams->updateSta, pStaDs, status) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 4920 | palFreeMemory( pMac->hHdd, (void *) pAddStaParams ); |
| 4921 | return status ; |
| 4922 | } |
| 4923 | |
| 4924 | /* |
| 4925 | * FUNCTION: Populate Link Identifier element IE |
| 4926 | * |
| 4927 | */ |
| 4928 | |
| 4929 | |
| 4930 | void PopulateDot11fLinkIden(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 4931 | tDot11fIELinkIdentifier *linkIden, |
| 4932 | tSirMacAddr peerMac, tANI_U8 reqType) |
| 4933 | { |
| 4934 | //tANI_U32 size = sizeof(tSirMacAddr) ; |
| 4935 | tANI_U8 *initStaAddr = NULL ; |
| 4936 | tANI_U8 *respStaAddr = NULL ; |
| 4937 | |
| 4938 | (reqType == TDLS_INITIATOR) ? ((initStaAddr = linkIden->InitStaAddr), |
| 4939 | (respStaAddr = linkIden->RespStaAddr)) |
| 4940 | : ((respStaAddr = linkIden->InitStaAddr ), |
| 4941 | (initStaAddr = linkIden->RespStaAddr)) ; |
| 4942 | palCopyMemory( pMac->hHdd, (tANI_U8 *)linkIden->bssid, |
| 4943 | (tANI_U8 *) psessionEntry->bssId, sizeof(tSirMacAddr)) ; |
| 4944 | |
| 4945 | palCopyMemory( pMac->hHdd, (tANI_U8 *)initStaAddr, |
| 4946 | psessionEntry->selfMacAddr, sizeof(tSirMacAddr)) ; |
| 4947 | |
| 4948 | palCopyMemory( pMac->hHdd, (tANI_U8 *)respStaAddr, (tANI_U8 *) peerMac, |
| 4949 | sizeof( tSirMacAddr )); |
| 4950 | |
| 4951 | linkIden->present = 1 ; |
| 4952 | return ; |
| 4953 | |
| 4954 | } |
| 4955 | |
| 4956 | void PopulateDot11fTdlsExtCapability(tpAniSirGlobal pMac, |
| 4957 | tDot11fIEExtCap *extCapability) |
| 4958 | { |
| 4959 | extCapability->TDLSPeerPSMSupp = PEER_PSM_SUPPORT ; |
| 4960 | extCapability->TDLSPeerUAPSDBufferSTA = PEER_BUFFER_STA_SUPPORT ; |
| 4961 | extCapability->TDLSChannelSwitching = CH_SWITCH_SUPPORT ; |
| 4962 | extCapability->TDLSSupport = TDLS_SUPPORT ; |
| 4963 | extCapability->TDLSProhibited = TDLS_PROHIBITED ; |
| 4964 | extCapability->TDLSChanSwitProhibited = TDLS_CH_SWITCH_PROHIBITED ; |
| 4965 | extCapability->present = 1 ; |
| 4966 | return ; |
| 4967 | } |
| 4968 | |
| 4969 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 4970 | /* |
| 4971 | * Public Action frame common processing |
| 4972 | * This Function will be moved/merged to appropriate place |
| 4973 | * once other public action frames (particularly 802.11k) |
| 4974 | * is in place |
| 4975 | */ |
| 4976 | void limProcessTdlsPublicActionFrame(tpAniSirGlobal pMac, tANI_U32 *pBd, |
| 4977 | tpPESession psessionEntry) |
| 4978 | { |
| 4979 | tANI_U32 frameLen = WDA_GET_RX_PAYLOAD_LEN(pBd) ; |
| 4980 | tANI_U8 *pBody = WDA_GET_RX_MPDU_DATA(pBd) ; |
| 4981 | tANI_S8 rssi = (tANI_S8)WDA_GET_RX_RSSI_DB(pBd) ; |
| 4982 | |
| 4983 | limProcessTdlsDisRspFrame(pMac, pBody, frameLen, rssi, psessionEntry) ; |
| 4984 | return ; |
| 4985 | } |
| 4986 | |
| 4987 | eHalStatus limTdlsPrepareSetupReqFrame(tpAniSirGlobal pMac, |
| 4988 | tLimTdlsLinkSetupInfo *linkSetupInfo, |
| 4989 | tANI_U8 dialog, tSirMacAddr peerMac, |
| 4990 | tpPESession psessionEntry) |
| 4991 | { |
| 4992 | tLimTdlsLinkSetupPeer *setupPeer = NULL ; |
| 4993 | |
| 4994 | /* |
| 4995 | * we allocate the TDLS setup Peer Memory here, we will free'd this |
| 4996 | * memory after teardown, if the link is successfully setup or |
| 4997 | * free this memory if any timeout is happen in link setup procedure |
| 4998 | */ |
| 4999 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, |
| 5000 | (void **) &setupPeer, sizeof( tLimTdlsLinkSetupPeer ))) |
| 5001 | { |
| 5002 | limLog( pMac, LOGP, |
| 5003 | FL( "Unable to allocate memory during ADD_STA\n" )); |
| 5004 | VOS_ASSERT(0) ; |
| 5005 | return eSIR_MEM_ALLOC_FAILED; |
| 5006 | } |
| 5007 | setupPeer->dialog = dialog ; |
| 5008 | setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ; |
| 5009 | setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ; |
| 5010 | |
| 5011 | /* TDLS_sessionize: remember sessionId for future */ |
| 5012 | setupPeer->tdls_sessionId = psessionEntry->peSessionId; |
| 5013 | setupPeer->tdls_bIsResponder = 1; |
| 5014 | |
| 5015 | /* |
| 5016 | * we only populate peer MAC, so it can assit us to find the |
| 5017 | * TDLS peer after response/or after response timeout |
| 5018 | */ |
| 5019 | palCopyMemory(pMac->hHdd, setupPeer->peerMac, peerMac, |
| 5020 | sizeof(tSirMacAddr)) ; |
| 5021 | /* format TDLS discovery request frame and transmit it */ |
| 5022 | limSendTdlsLinkSetupReqFrame(pMac, peerMac, dialog, psessionEntry, NULL, 0) ; |
| 5023 | |
| 5024 | limStartTdlsTimer(pMac, psessionEntry->peSessionId, |
| 5025 | &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer, |
| 5026 | (tANI_U32)setupPeer->peerMac, |
| 5027 | WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT, |
| 5028 | SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ; |
| 5029 | /* update setup peer list */ |
| 5030 | setupPeer->next = linkSetupInfo->tdlsLinkSetupList ; |
| 5031 | linkSetupInfo->tdlsLinkSetupList = setupPeer ; |
| 5032 | |
| 5033 | /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to |
| 5034 | * SME later when TDLS setup cnf TX complete is successful. --> see |
| 5035 | * limTdlsSetupCnfTxComplete() |
| 5036 | */ |
| 5037 | return eSIR_SUCCESS ; |
| 5038 | } |
| 5039 | #endif |
| 5040 | |
| 5041 | /* |
| 5042 | * Process Send Mgmt Request from SME and transmit to AP. |
| 5043 | */ |
| 5044 | tSirRetStatus limProcessSmeTdlsMgmtSendReq(tpAniSirGlobal pMac, |
| 5045 | tANI_U32 *pMsgBuf) |
| 5046 | { |
| 5047 | /* get all discovery request parameters */ |
| 5048 | tSirTdlsSendMgmtReq *pSendMgmtReq = (tSirTdlsSendMgmtReq*) pMsgBuf ; |
| 5049 | tpPESession psessionEntry; |
| 5050 | tANI_U8 sessionId; |
| 5051 | tSirResultCodes resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 5052 | |
| 5053 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 5054 | ("Send Mgmt Recieved\n")) ; |
| 5055 | |
| 5056 | if((psessionEntry = peFindSessionByBssid(pMac, pSendMgmtReq->bssid, &sessionId)) |
| 5057 | == NULL) |
| 5058 | { |
| 5059 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 5060 | "PE Session does not exist for given sme sessionId %d\n", |
| 5061 | pSendMgmtReq->sessionId); |
| 5062 | goto lim_tdls_send_mgmt_error; |
| 5063 | } |
| 5064 | |
| 5065 | /* check if we are in proper state to work as TDLS client */ |
| 5066 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 5067 | { |
| 5068 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 5069 | "send mgmt received in wrong system Role %d\n", |
| 5070 | psessionEntry->limSystemRole); |
| 5071 | goto lim_tdls_send_mgmt_error; |
| 5072 | } |
| 5073 | |
| 5074 | /* |
| 5075 | * if we are still good, go ahead and check if we are in proper state to |
| 5076 | * do TDLS discovery req/rsp/....frames. |
| 5077 | */ |
| 5078 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 5079 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 5080 | { |
| 5081 | |
| 5082 | limLog(pMac, LOGE, "send mgmt received in invalid LIMsme \ |
| 5083 | state (%d)\n", psessionEntry->limSmeState); |
| 5084 | goto lim_tdls_send_mgmt_error; |
| 5085 | } |
| 5086 | |
| 5087 | switch( pSendMgmtReq->reqType ) |
| 5088 | { |
| 5089 | case SIR_MAC_TDLS_DIS_REQ: |
| 5090 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 5091 | "Transmit Discovery Request Frame\n") ; |
| 5092 | /* format TDLS discovery request frame and transmit it */ |
| 5093 | limSendTdlsDisReqFrame(pMac, pSendMgmtReq->peerMac, pSendMgmtReq->dialog, |
| 5094 | psessionEntry) ; |
| 5095 | resultCode = eSIR_SME_SUCCESS; |
| 5096 | break; |
| 5097 | case SIR_MAC_TDLS_DIS_RSP: |
| 5098 | { |
| 5099 | //Send a response mgmt action frame |
| 5100 | limSendTdlsDisRspFrame(pMac, pSendMgmtReq->peerMac, |
| 5101 | pSendMgmtReq->dialog, psessionEntry) ; |
| 5102 | resultCode = eSIR_SME_SUCCESS; |
| 5103 | } |
| 5104 | break; |
| 5105 | case SIR_MAC_TDLS_SETUP_REQ: |
| 5106 | { |
| 5107 | limSendTdlsLinkSetupReqFrame(pMac, |
| 5108 | pSendMgmtReq->peerMac, pSendMgmtReq->dialog, psessionEntry, |
| 5109 | &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 5110 | resultCode = eSIR_SME_SUCCESS; |
| 5111 | } |
| 5112 | break; |
| 5113 | case SIR_MAC_TDLS_SETUP_RSP: |
| 5114 | { |
| 5115 | limSendTdlsSetupRspFrame(pMac, |
| 5116 | pSendMgmtReq->peerMac, pSendMgmtReq->dialog, psessionEntry, pSendMgmtReq->statusCode, |
| 5117 | &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 5118 | resultCode = eSIR_SME_SUCCESS; |
| 5119 | } |
| 5120 | break; |
| 5121 | case SIR_MAC_TDLS_SETUP_CNF: |
| 5122 | { |
| 5123 | limSendTdlsLinkSetupCnfFrame(pMac, pSendMgmtReq->peerMac, pSendMgmtReq->dialog, |
| 5124 | psessionEntry, &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 5125 | resultCode = eSIR_SME_SUCCESS; |
| 5126 | } |
| 5127 | break; |
| 5128 | case SIR_MAC_TDLS_TEARDOWN: |
| 5129 | { |
| 5130 | limSendTdlsTeardownFrame(pMac, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 5131 | pSendMgmtReq->peerMac, pSendMgmtReq->statusCode, pSendMgmtReq->responder, psessionEntry, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5132 | &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 5133 | resultCode = eSIR_SME_SUCCESS; |
| 5134 | } |
| 5135 | break; |
| 5136 | case SIR_MAC_TDLS_PEER_TRAFFIC_IND: |
| 5137 | { |
| 5138 | } |
| 5139 | break; |
| 5140 | case SIR_MAC_TDLS_CH_SWITCH_REQ: |
| 5141 | { |
| 5142 | } |
| 5143 | break; |
| 5144 | case SIR_MAC_TDLS_CH_SWITCH_RSP: |
| 5145 | { |
| 5146 | } |
| 5147 | break; |
| 5148 | case SIR_MAC_TDLS_PEER_TRAFFIC_RSP: |
| 5149 | { |
| 5150 | } |
| 5151 | break; |
| 5152 | default: |
| 5153 | break; |
| 5154 | } |
| 5155 | |
| 5156 | lim_tdls_send_mgmt_error: |
| 5157 | |
| 5158 | limSendSmeRsp( pMac, eWNI_SME_TDLS_SEND_MGMT_RSP, |
| 5159 | resultCode, pSendMgmtReq->sessionId, pSendMgmtReq->transactionId); |
| 5160 | |
| 5161 | return eSIR_SUCCESS; |
| 5162 | } |
| 5163 | |
| 5164 | /* |
| 5165 | * Once link is teardown, send Del Peer Ind to SME |
| 5166 | */ |
| 5167 | static eHalStatus limSendSmeTdlsDelStaRsp(tpAniSirGlobal pMac, |
| 5168 | tANI_U8 sessionId, tSirMacAddr peerMac, tDphHashNode *pStaDs, |
| 5169 | tANI_U8 status) |
| 5170 | { |
| 5171 | tSirMsgQ mmhMsg = {0} ; |
| 5172 | tSirTdlsDelStaRsp *pDelSta = NULL ; |
| 5173 | mmhMsg.type = eWNI_SME_TDLS_DEL_STA_RSP ; |
| 5174 | if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,(void * *) &pDelSta, |
| 5175 | (sizeof(tSirTdlsDelStaRsp)))) |
| 5176 | { |
| 5177 | PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));) |
| 5178 | return eSIR_FAILURE; |
| 5179 | } |
| 5180 | |
| 5181 | pDelSta->sessionId = sessionId; |
| 5182 | pDelSta->statusCode = status ; |
| 5183 | if( pStaDs ) |
| 5184 | { |
| 5185 | pDelSta->staId = pStaDs->staIndex ; |
| 5186 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5187 | else |
| 5188 | pDelSta->staId = HAL_STA_INVALID_IDX; |
| 5189 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5190 | if( peerMac ) |
| 5191 | { |
| 5192 | palCopyMemory(pMac->hHdd, pDelSta->peerMac, peerMac, sizeof(tSirMacAddr)); |
| 5193 | } |
| 5194 | |
| 5195 | pDelSta->length = sizeof(tSirTdlsDelStaRsp) ; |
| 5196 | pDelSta->messageType = eWNI_SME_TDLS_DEL_STA_RSP ; |
| 5197 | |
| 5198 | mmhMsg.bodyptr = pDelSta; |
| 5199 | |
| 5200 | mmhMsg.bodyval = 0; |
| 5201 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 5202 | return eSIR_SUCCESS ; |
| 5203 | |
| 5204 | } |
| 5205 | |
| 5206 | /* |
| 5207 | * Process Send Mgmt Request from SME and transmit to AP. |
| 5208 | */ |
| 5209 | tSirRetStatus limProcessSmeTdlsAddStaReq(tpAniSirGlobal pMac, |
| 5210 | tANI_U32 *pMsgBuf) |
| 5211 | { |
| 5212 | /* get all discovery request parameters */ |
| 5213 | tSirTdlsAddStaReq *pAddStaReq = (tSirTdlsAddStaReq*) pMsgBuf ; |
| 5214 | tpPESession psessionEntry; |
| 5215 | tANI_U8 sessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5216 | |
| 5217 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 5218 | ("Send Mgmt Recieved\n")) ; |
| 5219 | |
| 5220 | if((psessionEntry = peFindSessionByBssid(pMac, pAddStaReq->bssid, &sessionId)) |
| 5221 | == NULL) |
| 5222 | { |
| 5223 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 5224 | "PE Session does not exist for given sme sessionId %d\n", |
| 5225 | pAddStaReq->sessionId); |
| 5226 | goto lim_tdls_add_sta_error; |
| 5227 | } |
| 5228 | |
| 5229 | /* check if we are in proper state to work as TDLS client */ |
| 5230 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 5231 | { |
| 5232 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 5233 | "send mgmt received in wrong system Role %d\n", |
| 5234 | psessionEntry->limSystemRole); |
| 5235 | goto lim_tdls_add_sta_error; |
| 5236 | } |
| 5237 | |
| 5238 | /* |
| 5239 | * if we are still good, go ahead and check if we are in proper state to |
| 5240 | * do TDLS discovery req/rsp/....frames. |
| 5241 | */ |
| 5242 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 5243 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 5244 | { |
| 5245 | |
| 5246 | limLog(pMac, LOGE, "send mgmt received in invalid LIMsme \ |
| 5247 | state (%d)\n", psessionEntry->limSmeState); |
| 5248 | goto lim_tdls_add_sta_error; |
| 5249 | } |
| 5250 | |
| 5251 | pMac->lim.gLimAddStaTdls = true ; |
| 5252 | |
| 5253 | /* To start with, send add STA request to HAL */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5254 | if (eSIR_FAILURE == limTdlsSetupAddSta(pMac, pAddStaReq, psessionEntry)) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5255 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 5256 | limLog(pMac, LOGE, "%s: Add TDLS Station request failed \n", __func__); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5257 | goto lim_tdls_add_sta_error; |
| 5258 | } |
| 5259 | return eSIR_SUCCESS; |
| 5260 | lim_tdls_add_sta_error: |
| 5261 | limSendSmeTdlsAddStaRsp(pMac, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 5262 | pAddStaReq->sessionId, pAddStaReq->peerMac, |
| 5263 | (pAddStaReq->tdlsAddOper == TDLS_OPER_UPDATE), NULL, eSIR_FAILURE ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5264 | |
| 5265 | return eSIR_SUCCESS; |
| 5266 | } |
| 5267 | /* |
| 5268 | * Process Del Sta Request from SME . |
| 5269 | */ |
| 5270 | tSirRetStatus limProcessSmeTdlsDelStaReq(tpAniSirGlobal pMac, |
| 5271 | tANI_U32 *pMsgBuf) |
| 5272 | { |
| 5273 | /* get all discovery request parameters */ |
| 5274 | tSirTdlsDelStaReq *pDelStaReq = (tSirTdlsDelStaReq*) pMsgBuf ; |
| 5275 | tpPESession psessionEntry; |
| 5276 | tANI_U8 sessionId; |
| 5277 | tpDphHashNode pStaDs = NULL ; |
| 5278 | |
| 5279 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 5280 | ("Send Mgmt Recieved\n")) ; |
| 5281 | |
| 5282 | if((psessionEntry = peFindSessionByBssid(pMac, pDelStaReq->bssid, &sessionId)) |
| 5283 | == NULL) |
| 5284 | { |
| 5285 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 5286 | "PE Session does not exist for given sme sessionId %d\n", |
| 5287 | pDelStaReq->sessionId); |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 5288 | limSendSmeTdlsDelStaRsp(pMac, pDelStaReq->sessionId, pDelStaReq->peerMac, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5289 | NULL, eSIR_FAILURE) ; |
| 5290 | return eSIR_FAILURE; |
| 5291 | } |
| 5292 | |
| 5293 | /* check if we are in proper state to work as TDLS client */ |
| 5294 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 5295 | { |
| 5296 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 5297 | "Del sta received in wrong system Role %d\n", |
| 5298 | psessionEntry->limSystemRole); |
| 5299 | goto lim_tdls_del_sta_error; |
| 5300 | } |
| 5301 | |
| 5302 | /* |
| 5303 | * if we are still good, go ahead and check if we are in proper state to |
| 5304 | * do TDLS discovery req/rsp/....frames. |
| 5305 | */ |
| 5306 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 5307 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 5308 | { |
| 5309 | |
| 5310 | limLog(pMac, LOGE, "Del Sta received in invalid LIMsme \ |
| 5311 | state (%d)\n", psessionEntry->limSmeState); |
| 5312 | goto lim_tdls_del_sta_error; |
| 5313 | } |
| 5314 | |
| 5315 | pStaDs = limTdlsDelSta(pMac, pDelStaReq->peerMac, psessionEntry) ; |
| 5316 | |
| 5317 | /* now send indication to SME-->HDD->TL to remove STA from TL */ |
| 5318 | |
| 5319 | if(pStaDs) |
| 5320 | { |
| 5321 | limSendSmeTdlsDelStaRsp(pMac, psessionEntry->smeSessionId, pDelStaReq->peerMac, |
| 5322 | pStaDs, eSIR_SUCCESS) ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5323 | limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ; |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 5324 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5325 | /* Clear the aid in peerAIDBitmap as this aid is now in freepool */ |
| 5326 | CLEAR_PEER_AID_BITMAP(psessionEntry->peerAIDBitmap, pStaDs->assocId); |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 5327 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ; |
| 5328 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5329 | return eSIR_SUCCESS; |
| 5330 | |
| 5331 | } |
| 5332 | |
| 5333 | lim_tdls_del_sta_error: |
| 5334 | limSendSmeTdlsDelStaRsp(pMac, psessionEntry->smeSessionId, pDelStaReq->peerMac, |
| 5335 | NULL, eSIR_FAILURE) ; |
| 5336 | |
| 5337 | return eSIR_SUCCESS; |
| 5338 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 5339 | |
| 5340 | /* Delete all the TDLS peer connected before leaving the BSS */ |
| 5341 | tSirRetStatus limDeleteTDLSPeers(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 5342 | { |
| 5343 | tpDphHashNode pStaDs = NULL ; |
| 5344 | int i, aid; |
| 5345 | |
| 5346 | if (NULL == psessionEntry) |
| 5347 | { |
| 5348 | PELOGE(limLog(pMac, LOGE, FL("NULL psessionEntry"));) |
| 5349 | return eSIR_FAILURE; |
| 5350 | } |
| 5351 | |
| 5352 | /* Check all the set bit in peerAIDBitmap and delete the peer (with that aid) entry |
| 5353 | from the hash table and add the aid in free pool */ |
| 5354 | for (i = 0; i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32); i++) |
| 5355 | { |
| 5356 | for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) |
| 5357 | { |
| 5358 | if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) |
| 5359 | { |
| 5360 | pStaDs = dphGetHashEntry(pMac, (aid + i*(sizeof(tANI_U32) << 3)), &psessionEntry->dph.dphHashTable); |
| 5361 | |
| 5362 | if (NULL != pStaDs) |
| 5363 | { |
| 5364 | PELOGE(limLog(pMac, LOGE, FL("Deleting %02x:%02x:%02x:%02x:%02x:%02x"), |
| 5365 | pStaDs->staAddr[0], pStaDs->staAddr[1], pStaDs->staAddr[2], |
| 5366 | pStaDs->staAddr[3], pStaDs->staAddr[4], pStaDs->staAddr[5]);) |
| 5367 | |
| 5368 | limSendDeauthMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
| 5369 | pStaDs->staAddr, psessionEntry, FALSE); |
| 5370 | dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, &psessionEntry->dph.dphHashTable); |
| 5371 | } |
| 5372 | limReleasePeerIdx(pMac, (aid + i*(sizeof(tANI_U32) << 3)), psessionEntry) ; |
| 5373 | CLEAR_BIT(psessionEntry->peerAIDBitmap[i], aid); |
| 5374 | } |
| 5375 | } |
| 5376 | } |
| 5377 | limSendSmeTDLSDeleteAllPeerInd(pMac, psessionEntry); |
| 5378 | |
| 5379 | return eSIR_SUCCESS; |
| 5380 | } |
| 5381 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 5382 | #endif |