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