Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1 | /* |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 28 | /*=========================================================================== |
| 29 | |
| 30 | limProcessTdls.c |
| 31 | |
| 32 | OVERVIEW: |
| 33 | |
| 34 | DEPENDENCIES: |
| 35 | |
| 36 | Are listed for each API below. |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 37 | ===========================================================================*/ |
| 38 | |
| 39 | /*=========================================================================== |
| 40 | |
| 41 | EDIT HISTORY FOR FILE |
| 42 | |
| 43 | |
| 44 | This section contains comments describing changes made to the module. |
| 45 | Notice that changes are listed in reverse chronological order. |
| 46 | |
| 47 | |
| 48 | $Header$$DateTime$$Author$ |
| 49 | |
| 50 | |
| 51 | when who what, where, why |
| 52 | ---------- --- -------------------------------------------------------- |
| 53 | 05/05/2010 Ashwani Initial Creation, added TDLS action frame functionality, |
| 54 | TDLS message exchange with SME..etc.. |
| 55 | |
| 56 | ===========================================================================*/ |
| 57 | |
| 58 | |
| 59 | /** |
| 60 | * \file limProcessTdls.c |
| 61 | * |
| 62 | * \brief Code for preparing,processing and sending 802.11z action frames |
| 63 | * |
| 64 | */ |
| 65 | |
| 66 | #ifdef FEATURE_WLAN_TDLS |
| 67 | |
| 68 | #include "sirApi.h" |
| 69 | #include "aniGlobal.h" |
| 70 | #include "sirMacProtDef.h" |
| 71 | #include "cfgApi.h" |
| 72 | #include "utilsApi.h" |
| 73 | #include "limTypes.h" |
| 74 | #include "limUtils.h" |
| 75 | #include "limSecurityUtils.h" |
| 76 | #include "dot11f.h" |
| 77 | #include "limStaHashApi.h" |
| 78 | #include "schApi.h" |
| 79 | #include "limSendMessages.h" |
| 80 | #include "utilsParser.h" |
| 81 | #include "limAssocUtils.h" |
| 82 | #include "dphHashTable.h" |
| 83 | #include "wlan_qct_wda.h" |
| 84 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 85 | /* define NO_PAD_TDLS_MIN_8023_SIZE to NOT padding: See CR#447630 |
| 86 | There was IOT issue with cisco 1252 open mode, where it pads |
| 87 | discovery req/teardown frame with some junk value up to min size. |
| 88 | To avoid this issue, we pad QCOM_VENDOR_IE. |
| 89 | If there is other IOT issue because of this bandage, define NO_PAD... |
| 90 | */ |
| 91 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 92 | #define MIN_IEEE_8023_SIZE 46 |
| 93 | #define MIN_VENDOR_SPECIFIC_IE_SIZE 5 |
| 94 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 95 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 96 | static tSirRetStatus limTdlsSetupAddSta(tpAniSirGlobal pMac, |
| 97 | tSirTdlsAddStaReq *pAddStaReq, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 98 | tpPESession psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 99 | void PopulateDot11fLinkIden(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 100 | tDot11fIELinkIdentifier *linkIden, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 101 | tSirMacAddr peerMac, tANI_U8 reqType) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 102 | void PopulateDot11fTdlsExtCapability(tpAniSirGlobal pMac, |
| 103 | tDot11fIEExtCap *extCapability) ; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 104 | |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 105 | void PopulateDot11fTdlsOffchannelParams(tpAniSirGlobal pMac, |
| 106 | tpPESession psessionEntry, |
| 107 | tDot11fIESuppChannels *suppChannels, |
| 108 | tDot11fIESuppOperatingClasses *suppOperClasses); |
| 109 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 110 | void limLogVHTCap(tpAniSirGlobal pMac, |
| 111 | tDot11fIEVHTCaps *pDot11f); |
| 112 | tSirRetStatus limPopulateVhtMcsSet(tpAniSirGlobal pMac, |
| 113 | tpSirSupportedRates pRates, |
| 114 | tDot11fIEVHTCaps *pPeerVHTCaps, |
| 115 | tpPESession psessionEntry); |
| 116 | ePhyChanBondState limGetHTCBState(ePhyChanBondState aniCBMode); |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 117 | /*only 31 op classes are available, 1 entry for current op class*/ |
| 118 | static tDot11fIESuppOperatingClasses op_classes = {0}; |
| 119 | |
| 120 | op_class_map_t global_op_class[] = { |
| 121 | {81, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, |
| 122 | {82, 25, BW20, {14}}, |
| 123 | {83, 40, BW40PLUS, {1, 2, 3, 4, 5, 6, 7, 8, 9}}, |
| 124 | {84, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11, 12, 13}}, |
| 125 | {115, 20, BW20, {36, 40, 44, 48}}, |
| 126 | {116, 40, BW40PLUS, {36, 44}}, |
| 127 | {117, 40, BW40MINUS, {40, 48}}, |
| 128 | {118, 20, BW20, {52, 56, 60, 64}}, |
| 129 | {119, 40, BW40PLUS, {52, 60}}, |
| 130 | {120, 40, BW40MINUS, {56, 64}}, |
| 131 | {121, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, |
| 132 | {122, 40, BW40PLUS, {100, 108, 116, 124, 132}}, |
| 133 | {123, 40, BW40MINUS, {104, 112, 120, 128, 136}}, |
| 134 | {125, 20, BW20, {149, 153, 157, 161, 165, 169}}, |
| 135 | {126, 40, BW40PLUS, {149, 157}}, |
| 136 | {127, 40, BW40MINUS, {153, 161}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 137 | {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, |
| 138 | 116, 120, 124, 128, 132, 136, 140, 144, |
| 139 | 149, 153, 157, 161}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 140 | {0, 0, 0, {0}}, |
| 141 | |
| 142 | };/*end global_op_class*/ |
| 143 | |
| 144 | op_class_map_t us_op_class[] = { |
| 145 | {1, 20, BW20, {36, 40, 44, 48}}, |
| 146 | {2, 20, BW20, {52, 56, 60, 64}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 147 | {4, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 148 | {5, 20, BW20, {149, 153, 157, 161, 165}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 149 | {12, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 150 | {22, 40, BW40PLUS, {36, 44}}, |
| 151 | {23, 40, BW40PLUS, {52, 60}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 152 | {24, 40, BW40PLUS, {100, 108, 116, 124, 132, 140}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 153 | {26, 40, BW40PLUS, {149, 157}}, |
| 154 | {27, 40, BW40MINUS, {40, 48}}, |
| 155 | {28, 40, BW40MINUS, {56, 64}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 156 | {29, 40, BW40MINUS, {104, 112, 120, 128, 136, 144}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 157 | {31, 40, BW40MINUS, {153, 161}}, |
| 158 | {32, 40, BW40PLUS, {1, 2, 3, 4, 5, 6, 7}}, |
| 159 | {33, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 160 | {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, |
| 161 | 116, 120, 124, 128, 132, 136, 140, 144, |
| 162 | 149, 153, 157, 161}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 163 | {0, 0, 0, {0}}, |
| 164 | };/*end us_op_class*/ |
| 165 | |
| 166 | op_class_map_t euro_op_class[] = { |
| 167 | {1, 20, BW20, {36, 40, 44, 48}}, |
| 168 | {2, 20, BW20, {52, 56, 60, 64}}, |
| 169 | {3, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, |
| 170 | {4, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, |
| 171 | {5, 40, BW40PLUS, {36, 44}}, |
| 172 | {6, 40, BW40PLUS, {52, 60}}, |
| 173 | {7, 40, BW40PLUS, {100, 108, 116, 124, 132}}, |
| 174 | {8, 40, BW40MINUS, {40, 48}}, |
| 175 | {9, 40, BW40MINUS, {56, 64}}, |
| 176 | {10, 40, BW40MINUS, {104, 112, 120, 128, 136}}, |
| 177 | {11, 40, BW40PLUS, {1, 2, 3, 4, 5, 6, 7, 8, 9}}, |
| 178 | {12, 40, BW40MINUS, {5, 6, 7, 8, 9, 10, 11, 12, 13}}, |
| 179 | {17, 20, BW20, {149, 153, 157, 161, 165, 169}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 180 | {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, |
| 181 | 116, 120, 124, 128}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 182 | {0, 0, 0, {0}}, |
| 183 | };/*end euro_op_class*/ |
| 184 | |
| 185 | op_class_map_t japan_op_class[] = { |
| 186 | {1, 20, BW20, {36, 40, 44, 48}}, |
| 187 | {30, 25, BW20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, |
| 188 | {31, 25, BW20, {14}}, |
| 189 | {32, 20, BW20, {52, 56, 60, 64}}, |
| 190 | {34, 20, BW20, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}, |
| 191 | {36, 40, BW40PLUS, {36, 44}}, |
| 192 | {37, 40, BW40PLUS, {52, 60}}, |
| 193 | {39, 40, BW40PLUS, {100, 108, 116, 124, 132}}, |
| 194 | {41, 40, BW40MINUS, {40, 48}}, |
| 195 | {42, 40, BW40MINUS, {56, 64}}, |
| 196 | {44, 40, BW40MINUS, {104, 112, 120, 128, 136}}, |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 197 | {128, 80, BW80, {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, |
| 198 | 116, 120, 124, 128}}, |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 199 | {0, 0, 0, {0}}, |
| 200 | };/*end japan_op_class*/ |
| 201 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 202 | /* |
| 203 | * TDLS data frames will go out/come in as non-qos data. |
| 204 | * so, eth_890d_header will be aligned access.. |
| 205 | */ |
| 206 | static const tANI_U8 eth_890d_header[] = |
| 207 | { |
| 208 | 0xaa, 0xaa, 0x03, 0x00, |
| 209 | 0x00, 0x00, 0x89, 0x0d, |
| 210 | } ; |
| 211 | |
Pradeep Reddy POTTETI | 8f736ad | 2015-04-23 15:20:16 +0530 | [diff] [blame] | 212 | /* store tdls self supported channels |
| 213 | * which are non passive */ |
| 214 | #define LIM_TDLS_MAX_NON_DFS_CHANNELS 50 |
| 215 | static tANI_U8 tdlsSelfNumChans = 0; |
| 216 | static tANI_U8 tdlsSelfSupportedChannels[LIM_TDLS_MAX_NON_DFS_CHANNELS] = {0}; |
| 217 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 218 | /* |
| 219 | * type of links used in TDLS |
| 220 | */ |
| 221 | enum tdlsLinks |
| 222 | { |
| 223 | TDLS_LINK_AP, |
| 224 | TDLS_LINK_DIRECT |
| 225 | } eTdlsLink ; |
| 226 | |
| 227 | /* |
| 228 | * node status in node searching |
| 229 | */ |
| 230 | enum tdlsLinkNodeStatus |
| 231 | { |
| 232 | TDLS_NODE_NOT_FOUND, |
| 233 | TDLS_NODE_FOUND |
| 234 | } eTdlsLinkNodeStatus ; |
| 235 | |
| 236 | |
| 237 | enum tdlsReqType |
| 238 | { |
| 239 | TDLS_INITIATOR, |
| 240 | TDLS_RESPONDER |
| 241 | } eTdlsReqType ; |
| 242 | |
| 243 | typedef enum tdlsLinkSetupStatus |
| 244 | { |
| 245 | TDLS_SETUP_STATUS_SUCCESS = 0, |
| 246 | TDLS_SETUP_STATUS_FAILURE = 37 |
| 247 | }etdlsLinkSetupStatus ; |
| 248 | |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 249 | /* These maps to Kernel TDLS peer capability |
| 250 | * flags and should get changed as and when necessary |
| 251 | */ |
| 252 | enum tdls_peer_capability { |
| 253 | TDLS_PEER_HT_CAP = 0, |
| 254 | TDLS_PEER_VHT_CAP = 1, |
| 255 | TDLS_PEER_WMM_CAP = 2 |
| 256 | } eTdlsPeerCapability; |
| 257 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 258 | /* some local defines */ |
| 259 | #define LINK_IDEN_BSSID_OFFSET (0) |
| 260 | #define PEER_MAC_OFFSET (12) |
| 261 | #define STA_MAC_OFFSET (6) |
| 262 | #define LINK_IDEN_ELE_ID (101) |
| 263 | //#define LINK_IDEN_LENGTH (18) |
| 264 | #define LINK_IDEN_ADDR_OFFSET(x) (&x.LinkIdentifier) |
| 265 | #define PTI_LINK_IDEN_OFFSET (5) |
| 266 | #define PTI_BUF_STATUS_OFFSET (25) |
| 267 | |
| 268 | /* TODO, Move this parameters to configuration */ |
| 269 | #define PEER_PSM_SUPPORT (0) |
Hoonki Lee | 93e67ff | 2013-03-19 15:49:25 -0700 | [diff] [blame] | 270 | #define PEER_BUFFER_STA_SUPPORT (0) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 271 | #define CH_SWITCH_SUPPORT (0) |
| 272 | #define TDLS_SUPPORT (1) |
| 273 | #define TDLS_PROHIBITED (0) |
| 274 | #define TDLS_CH_SWITCH_PROHIBITED (1) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 275 | /** @brief Set bit manipulation macro */ |
| 276 | #define SET_BIT(value,mask) ((value) |= (1 << (mask))) |
| 277 | /** @brief Clear bit manipulation macro */ |
| 278 | #define CLEAR_BIT(value,mask) ((value) &= ~(1 << (mask))) |
| 279 | /** @brief Check bit manipulation macro */ |
| 280 | #define CHECK_BIT(value, mask) ((value) & (1 << (mask))) |
| 281 | |
| 282 | #define SET_PEER_AID_BITMAP(peer_bitmap, aid) \ |
| 283 | if ((aid) < (sizeof(tANI_U32) << 3)) \ |
| 284 | SET_BIT(peer_bitmap[0], (aid)); \ |
| 285 | else if ((aid) < (sizeof(tANI_U32) << 4)) \ |
| 286 | SET_BIT(peer_bitmap[1], ((aid) - (sizeof(tANI_U32) << 3))); |
| 287 | |
| 288 | #define CLEAR_PEER_AID_BITMAP(peer_bitmap, aid) \ |
| 289 | if ((aid) < (sizeof(tANI_U32) << 3)) \ |
| 290 | CLEAR_BIT(peer_bitmap[0], (aid)); \ |
| 291 | else if ((aid) < (sizeof(tANI_U32) << 4)) \ |
| 292 | CLEAR_BIT(peer_bitmap[1], ((aid) - (sizeof(tANI_U32) << 3))); |
| 293 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 294 | |
| 295 | #ifdef LIM_DEBUG_TDLS |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 296 | |
| 297 | #ifdef FEATURE_WLAN_TDLS |
| 298 | #define WNI_CFG_TDLS_DISCOVERY_RSP_WAIT (100) |
| 299 | #define WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT (800) |
| 300 | #define WNI_CFG_TDLS_LINK_SETUP_CNF_TIMEOUT (200) |
| 301 | #endif |
| 302 | |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 303 | #define IS_QOS_ENABLED(psessionEntry) ((((psessionEntry)->limQosEnabled) && \ |
| 304 | SIR_MAC_GET_QOS((psessionEntry)->limCurrentBssCaps)) || \ |
| 305 | (((psessionEntry)->limWmeEnabled ) && \ |
| 306 | LIM_BSS_CAPS_GET(WME, (psessionEntry)->limCurrentBssQosCaps))) |
| 307 | |
| 308 | #define TID_AC_VI 4 |
| 309 | #define TID_AC_BK 1 |
| 310 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 311 | const tANI_U8* limTraceTdlsActionString( tANI_U8 tdlsActionCode ) |
| 312 | { |
| 313 | switch( tdlsActionCode ) |
| 314 | { |
Daram Sudha | 1f7e0e9 | 2013-12-17 07:52:31 +0530 | [diff] [blame] | 315 | CASE_RETURN_STRING(SIR_MAC_TDLS_SETUP_REQ); |
| 316 | CASE_RETURN_STRING(SIR_MAC_TDLS_SETUP_RSP); |
| 317 | CASE_RETURN_STRING(SIR_MAC_TDLS_SETUP_CNF); |
| 318 | CASE_RETURN_STRING(SIR_MAC_TDLS_TEARDOWN); |
| 319 | CASE_RETURN_STRING(SIR_MAC_TDLS_PEER_TRAFFIC_IND); |
| 320 | CASE_RETURN_STRING(SIR_MAC_TDLS_CH_SWITCH_REQ); |
| 321 | CASE_RETURN_STRING(SIR_MAC_TDLS_CH_SWITCH_RSP); |
| 322 | CASE_RETURN_STRING(SIR_MAC_TDLS_PEER_TRAFFIC_RSP); |
| 323 | CASE_RETURN_STRING(SIR_MAC_TDLS_DIS_REQ); |
| 324 | CASE_RETURN_STRING(SIR_MAC_TDLS_DIS_RSP); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 325 | } |
| 326 | return (const tANI_U8*)"UNKNOWN"; |
| 327 | } |
| 328 | #endif |
| 329 | #if 0 |
| 330 | static void printMacAddr(tSirMacAddr macAddr) |
| 331 | { |
| 332 | int i = 0 ; |
| 333 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, (" Mac Addr: ")); |
| 334 | |
| 335 | for(i = 0 ; i < 6; i++) |
| 336 | { |
| 337 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 338 | (" %02x "), macAddr[i]); |
| 339 | } |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 340 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, ("")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 341 | return ; |
| 342 | } |
| 343 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 344 | /* |
| 345 | * initialize TDLS setup list and related data structures. |
| 346 | */ |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 347 | void limInitTdlsData(tpAniSirGlobal pMac, tpPESession pSessionEntry) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 348 | { |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 349 | limInitPeerIdxpool(pMac, pSessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 350 | |
| 351 | return ; |
| 352 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 353 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 354 | void limTdlsSetNegativeBehavior(tpAniSirGlobal pMac, tANI_U8 value, tANI_BOOLEAN on) |
| 355 | { |
| 356 | if(on) { |
| 357 | if(value == 255) |
| 358 | pMac->lim.gLimTdlsNegativeBehavior = 0XFFFFFFFF; |
| 359 | else |
| 360 | pMac->lim.gLimTdlsNegativeBehavior |= (1 << (value-1)); |
| 361 | } |
| 362 | else { |
| 363 | if(value == 255) |
| 364 | pMac->lim.gLimTdlsNegativeBehavior = 0; |
| 365 | else |
| 366 | pMac->lim.gLimTdlsNegativeBehavior &= ~(1 << (value-1)); |
| 367 | } |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 368 | 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] | 369 | value, on, pMac->lim.gLimTdlsNegativeBehavior)); |
| 370 | } |
| 371 | #endif |
| 372 | #if 0 |
| 373 | /* |
| 374 | * This function is used for creating TDLS public Action frame to |
| 375 | * transmit on Direct link |
| 376 | */ |
| 377 | static void limPreparesActionFrameHdr(tpAniSirGlobal pMac, tANI_U8 *pFrame, |
| 378 | tANI_U8 type, tANI_U8 subType, |
| 379 | tANI_U8 *link_iden ) |
| 380 | { |
| 381 | tpSirMacMgmtHdr pMacHdr ; |
| 382 | tANI_U8 *bssid = link_iden ; |
| 383 | #if 0 |
| 384 | tANI_U8 *staMac = (tANI_U8 *)(bssid + sizeof(tSirMacAddr)) ; |
| 385 | tANI_U8 *peerMac = (tANI_U8 *) (staMac + sizeof(tSirMacAddr)) ; |
| 386 | #else |
| 387 | tANI_U8 *peerMac = (tANI_U8 *) (bssid + sizeof(tSirMacAddr)) ; |
| 388 | tANI_U8 *staMac = (tANI_U8 *)(peerMac + sizeof(tSirMacAddr)) ; |
| 389 | #endif |
| 390 | tANI_U8 toDs = ANI_TXDIR_IBSS ; |
| 391 | |
| 392 | pMacHdr = (tpSirMacMgmtHdr) (pFrame); |
| 393 | |
| 394 | /* |
| 395 | * prepare 802.11 header |
| 396 | */ |
| 397 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 398 | pMacHdr->fc.type = type ; |
| 399 | pMacHdr->fc.subType = subType ; |
| 400 | /* |
| 401 | * TL is not setting up below fields, so we are doing it here |
| 402 | */ |
| 403 | pMacHdr->fc.toDS = toDs ; |
| 404 | pMacHdr->fc.powerMgmt = 0 ; |
| 405 | |
| 406 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 407 | vos_mem_copy( (tANI_U8 *) pMacHdr->da, peerMac, sizeof( tSirMacAddr )); |
| 408 | vos_mem_copy( (tANI_U8 *) pMacHdr->sa, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 409 | staMac, sizeof( tSirMacAddr )); |
| 410 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 411 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 412 | bssid, sizeof( tSirMacAddr )); |
| 413 | |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 414 | 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"), |
| 415 | pMacHdr->da[0], pMacHdr->da[1], pMacHdr->da[2], pMacHdr->da[3], pMacHdr->da[4], pMacHdr->da[5], |
| 416 | pMacHdr->sa[0], pMacHdr->sa[1], pMacHdr->sa[2], pMacHdr->sa[3], pMacHdr->sa[4], pMacHdr->sa[5], |
| 417 | pMacHdr->bssId[0], pMacHdr->bssId[1], pMacHdr->bssId[2], |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 418 | pMacHdr->bssId[3], pMacHdr->bssId[4], pMacHdr->bssId[5])); |
| 419 | |
| 420 | return ; |
| 421 | } |
| 422 | #endif |
| 423 | /* |
| 424 | * prepare TDLS frame header, it includes |
| 425 | * | | | | |
| 426 | * |802.11 header|RFC1042 header|TDLS_PYLOAD_TYPE|PAYLOAD |
| 427 | * | | | | |
| 428 | */ |
| 429 | static tANI_U32 limPrepareTdlsFrameHeader(tpAniSirGlobal pMac, tANI_U8* pFrame, |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 430 | tDot11fIELinkIdentifier *link_iden, tANI_U8 tdlsLinkType, tANI_U8 reqType, |
| 431 | tANI_U8 tid, tpPESession psessionEntry) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 432 | { |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 433 | tpSirMacDataHdr3a pMacHdr ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 434 | tANI_U32 header_offset = 0 ; |
| 435 | tANI_U8 *addr1 = NULL ; |
| 436 | tANI_U8 *addr3 = NULL ; |
Pradeep Reddy POTTETI | 7408431 | 2015-08-04 18:26:30 +0530 | [diff] [blame] | 437 | tpDphHashNode pStaDs = NULL; |
| 438 | tANI_U16 aid = 0; |
| 439 | tANI_U8 qosMode = 0; |
| 440 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 441 | tANI_U8 toDs = (tdlsLinkType == TDLS_LINK_AP) |
| 442 | ? ANI_TXDIR_TODS :ANI_TXDIR_IBSS ; |
| 443 | tANI_U8 *peerMac = (reqType == TDLS_INITIATOR) |
| 444 | ? link_iden->RespStaAddr : link_iden->InitStaAddr; |
| 445 | tANI_U8 *staMac = (reqType == TDLS_INITIATOR) |
| 446 | ? link_iden->InitStaAddr : link_iden->RespStaAddr; |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 447 | pMacHdr = (tpSirMacDataHdr3a) (pFrame); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 448 | |
| 449 | /* |
| 450 | * if TDLS frame goes through the AP link, it follows normal address |
| 451 | * pattern, if TDLS frame goes thorugh the direct link, then |
| 452 | * A1--> Peer STA addr, A2-->Self STA address, A3--> BSSID |
| 453 | */ |
| 454 | (tdlsLinkType == TDLS_LINK_AP) ? ((addr1 = (link_iden->bssid)), |
| 455 | (addr3 = (peerMac))) |
| 456 | : ((addr1 = (peerMac)), |
| 457 | (addr3 = (link_iden->bssid))) ; |
| 458 | /* |
| 459 | * prepare 802.11 header |
| 460 | */ |
| 461 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 462 | pMacHdr->fc.type = SIR_MAC_DATA_FRAME ; |
Pradeep Reddy POTTETI | 7408431 | 2015-08-04 18:26:30 +0530 | [diff] [blame] | 463 | |
| 464 | pStaDs = dphLookupHashEntry(pMac, peerMac, &aid, |
| 465 | &psessionEntry->dph.dphHashTable); |
| 466 | if (pStaDs) |
| 467 | { |
| 468 | qosMode = pStaDs->qosMode; |
| 469 | } |
| 470 | |
| 471 | pMacHdr->fc.subType = ((IS_QOS_ENABLED(psessionEntry) && |
| 472 | (tdlsLinkType == TDLS_LINK_AP)) || |
| 473 | ((tdlsLinkType == TDLS_LINK_DIRECT) && qosMode)) |
| 474 | ? SIR_MAC_DATA_QOS_DATA : SIR_MAC_DATA_DATA; |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 475 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 476 | /* |
| 477 | * TL is not setting up below fields, so we are doing it here |
| 478 | */ |
| 479 | pMacHdr->fc.toDS = toDs ; |
| 480 | pMacHdr->fc.powerMgmt = 0 ; |
| 481 | pMacHdr->fc.wep = (psessionEntry->encryptType == eSIR_ED_NONE)? 0 : 1; |
| 482 | |
| 483 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 484 | vos_mem_copy( (tANI_U8 *) pMacHdr->addr1, |
| 485 | (tANI_U8 *)addr1, |
| 486 | sizeof( tSirMacAddr )); |
| 487 | vos_mem_copy( (tANI_U8 *) pMacHdr->addr2, |
| 488 | (tANI_U8 *) staMac, |
| 489 | sizeof( tSirMacAddr )); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 490 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 491 | vos_mem_copy( (tANI_U8 *) pMacHdr->addr3, |
| 492 | (tANI_U8 *) (addr3), |
| 493 | sizeof( tSirMacAddr )); |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 494 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 495 | limLog(pMac, LOG1, |
| 496 | FL("Preparing TDLS frame header to %s A1:"MAC_ADDRESS_STR", A2:"MAC_ADDRESS_STR", A3:"MAC_ADDRESS_STR), |
| 497 | (tdlsLinkType == TDLS_LINK_AP) ? "AP" : "DIRECT", |
| 498 | MAC_ADDR_ARRAY(pMacHdr->addr1), |
| 499 | MAC_ADDR_ARRAY(pMacHdr->addr2), |
| 500 | MAC_ADDR_ARRAY(pMacHdr->addr3)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 501 | |
| 502 | //printMacAddr(pMacHdr->bssId) ; |
| 503 | //printMacAddr(pMacHdr->sa) ; |
| 504 | //printMacAddr(pMacHdr->da) ; |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 505 | |
Pradeep Reddy POTTETI | 7408431 | 2015-08-04 18:26:30 +0530 | [diff] [blame] | 506 | if (((tdlsLinkType == TDLS_LINK_AP) && (IS_QOS_ENABLED(psessionEntry))) || |
| 507 | ((tdlsLinkType == TDLS_LINK_DIRECT) && qosMode)) |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 508 | { |
| 509 | pMacHdr->qosControl.tid = tid; |
| 510 | header_offset += sizeof(tSirMacDataHdr3a); |
| 511 | } |
| 512 | else |
| 513 | header_offset += sizeof(tSirMacMgmtHdr); |
| 514 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 515 | /* |
| 516 | * Now form RFC1042 header |
| 517 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 518 | vos_mem_copy((tANI_U8 *)(pFrame + header_offset), |
| 519 | (tANI_U8 *)eth_890d_header, sizeof(eth_890d_header)) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 520 | |
| 521 | header_offset += sizeof(eth_890d_header) ; |
| 522 | |
| 523 | /* add payload type as TDLS */ |
| 524 | *(pFrame + header_offset) = PAYLOAD_TYPE_TDLS ; |
| 525 | |
| 526 | return(header_offset += PAYLOAD_TYPE_TDLS_SIZE) ; |
| 527 | } |
| 528 | |
| 529 | /* |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 530 | * TX Complete for Management frames |
| 531 | */ |
| 532 | eHalStatus limMgmtTXComplete(tpAniSirGlobal pMac, |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 533 | void *pData) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 534 | { |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 535 | tANI_U32 txCompleteSuccess = 0; |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 536 | tpSirTxBdStatus pTxBdStatus = NULL; |
Ganesh Kondabattini | 358fc9b | 2015-03-11 16:14:25 +0530 | [diff] [blame] | 537 | |
| 538 | if (!pData) |
| 539 | { |
| 540 | limLog(pMac, LOGE, FL("pData is NULL")); |
| 541 | return eHAL_STATUS_SUCCESS; |
| 542 | } |
| 543 | |
Ganesh Kondabattini | b18b329 | 2015-03-16 16:59:26 +0530 | [diff] [blame] | 544 | if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION)) |
| 545 | { |
| 546 | pTxBdStatus = (tpSirTxBdStatus) pData; |
| 547 | txCompleteSuccess = pTxBdStatus->txCompleteStatus; |
| 548 | limLog(pMac, LOG1, FL("txCompleteSuccess %u, token %u"), |
| 549 | txCompleteSuccess, pTxBdStatus->txBdToken); |
| 550 | } |
| 551 | else |
| 552 | { |
| 553 | txCompleteSuccess = *((tANI_U32*) pData); |
| 554 | limLog(pMac, LOG1, FL("txCompleteSuccess %u"), txCompleteSuccess); |
| 555 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 556 | |
| 557 | if (0xff != pMac->lim.mgmtFrameSessionId) |
| 558 | { |
Ganesh Kondabattini | ff98702 | 2015-08-11 19:43:44 +0530 | [diff] [blame] | 559 | limSendSmeMgmtTXCompletion(pMac, pMac->lim.mgmtFrameSessionId, |
| 560 | txCompleteSuccess); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 561 | pMac->lim.mgmtFrameSessionId = 0xff; |
| 562 | } |
| 563 | return eHAL_STATUS_SUCCESS; |
| 564 | } |
| 565 | |
| 566 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 567 | * This function can be used for bacst or unicast discovery request |
| 568 | * We are not differentiating it here, it will all depnds on peer MAC address, |
| 569 | */ |
| 570 | tSirRetStatus limSendTdlsDisReqFrame(tpAniSirGlobal pMac, tSirMacAddr peer_mac, |
| 571 | tANI_U8 dialog, tpPESession psessionEntry) |
| 572 | { |
| 573 | tDot11fTDLSDisReq tdlsDisReq ; |
| 574 | tANI_U32 status = 0 ; |
| 575 | tANI_U32 nPayload = 0 ; |
| 576 | tANI_U32 size = 0 ; |
| 577 | tANI_U32 nBytes = 0 ; |
| 578 | tANI_U32 header_offset = 0 ; |
| 579 | tANI_U8 *pFrame; |
| 580 | void *pPacket; |
| 581 | eHalStatus halstatus; |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 582 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 583 | tANI_U32 padLen = 0; |
| 584 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 585 | |
| 586 | /* |
| 587 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 588 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 589 | * serialization). We start by zero-initializing the structure: |
| 590 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 591 | vos_mem_set( (tANI_U8*)&tdlsDisReq, |
| 592 | sizeof( tDot11fTDLSDisReq ), 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 593 | |
| 594 | /* |
| 595 | * setup Fixed fields, |
| 596 | */ |
| 597 | tdlsDisReq.Category.category = SIR_MAC_ACTION_TDLS ; |
| 598 | tdlsDisReq.Action.action = SIR_MAC_TDLS_DIS_REQ ; |
| 599 | tdlsDisReq.DialogToken.token = dialog ; |
| 600 | |
| 601 | |
| 602 | size = sizeof(tSirMacAddr) ; |
| 603 | |
| 604 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsDisReq.LinkIdentifier, |
| 605 | peer_mac, TDLS_INITIATOR) ; |
| 606 | |
| 607 | /* |
| 608 | * now we pack it. First, how much space are we going to need? |
| 609 | */ |
| 610 | status = dot11fGetPackedTDLSDisReqSize( pMac, &tdlsDisReq, &nPayload); |
| 611 | if ( DOT11F_FAILED( status ) ) |
| 612 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 613 | limLog(pMac, LOGE, |
| 614 | FL("Failed to calculate the packed size for a discovery Request (0x%08x)."), |
| 615 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 616 | /* We'll fall back on the worst case scenario: */ |
| 617 | nPayload = sizeof( tDot11fTDLSDisReq ); |
| 618 | } |
| 619 | else if ( DOT11F_WARNED( status ) ) |
| 620 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 621 | limLog(pMac, LOGW, |
| 622 | FL("There were warnings while calculating the packed size for a discovery Request (0x%08x)."), |
| 623 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 624 | } |
| 625 | |
| 626 | /* |
| 627 | * This frame is going out from PE as data frames with special ethertype |
| 628 | * 89-0d. |
| 629 | * 8 bytes of RFC 1042 header |
| 630 | */ |
| 631 | |
| 632 | |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 633 | nBytes = nPayload + ((IS_QOS_ENABLED(psessionEntry)) |
| 634 | ? sizeof(tSirMacDataHdr3a) : sizeof(tSirMacMgmtHdr)) |
| 635 | + sizeof( eth_890d_header ) |
| 636 | + PAYLOAD_TYPE_TDLS_SIZE ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 637 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 638 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 639 | /* IOT issue with some AP : some AP doesn't like the data packet size < minimum 802.3 frame length (64) |
| 640 | Hence AP itself padding some bytes, which caused teardown packet is dropped at |
| 641 | receiver side. To avoid such IOT issue, we added some extra bytes to meet data frame size >= 64 |
| 642 | */ |
| 643 | if (nPayload + PAYLOAD_TYPE_TDLS_SIZE < MIN_IEEE_8023_SIZE) |
| 644 | { |
| 645 | padLen = MIN_IEEE_8023_SIZE - (nPayload + PAYLOAD_TYPE_TDLS_SIZE ) ; |
| 646 | |
| 647 | /* if padLen is less than minimum vendorSpecific (5), pad up to 5 */ |
| 648 | if (padLen < MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 649 | padLen = MIN_VENDOR_SPECIFIC_IE_SIZE; |
| 650 | |
| 651 | nBytes += padLen; |
| 652 | } |
| 653 | #endif |
| 654 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 655 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 656 | |
| 657 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 658 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 659 | ( void** ) &pPacket ); |
| 660 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 661 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 662 | limLog(pMac, LOGE, |
| 663 | FL("Failed to allocate %d bytes for a TDLS Discovery Request."), |
| 664 | nBytes); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 665 | return eSIR_MEM_ALLOC_FAILED; |
| 666 | } |
| 667 | |
| 668 | /* zero out the memory */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 669 | vos_mem_set( pFrame, nBytes, 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 670 | |
| 671 | /* |
| 672 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 673 | * request frame |
| 674 | */ |
| 675 | |
| 676 | /* fill out the buffer descriptor */ |
| 677 | |
| 678 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 679 | 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] | 680 | |
| 681 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 682 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_DSCV_REQ) |
| 683 | { |
| 684 | tdlsDisReq.LinkIdentifier.bssid[4] = 0xde; |
| 685 | tdlsDisReq.LinkIdentifier.bssid[5] = 0xad; |
| 686 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 687 | ("TDLS negative running: wrong BSSID " MAC_ADDRESS_STR " in TDLS Discovery Req"), |
| 688 | MAC_ADDR_ARRAY(tdlsDisReq.LinkIdentifier.bssid)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 689 | } |
| 690 | #endif |
| 691 | status = dot11fPackTDLSDisReq( pMac, &tdlsDisReq, pFrame |
| 692 | + header_offset, nPayload, &nPayload ); |
| 693 | |
| 694 | if ( DOT11F_FAILED( status ) ) |
| 695 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 696 | limLog(pMac, LOGE, FL("Failed to pack a TDLS discovery req (0x%08x)."), |
| 697 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 698 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 699 | ( void* ) pFrame, ( void* ) pPacket ); |
| 700 | return eSIR_FAILURE; |
| 701 | } |
| 702 | else if ( DOT11F_WARNED( status ) ) |
| 703 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 704 | limLog(pMac, LOGW, FL("There were warnings while packing TDLS Discovery Request (0x%08x)."), |
| 705 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 706 | } |
| 707 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 708 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 709 | if (padLen != 0) |
| 710 | { |
| 711 | /* QCOM VENDOR OUI = { 0x00, 0xA0, 0xC6, type = 0x0000 }; */ |
| 712 | tANI_U8 *padVendorSpecific = pFrame + header_offset + nPayload; |
| 713 | /* make QCOM_VENDOR_OUI, and type = 0x0000, and all the payload to be zero */ |
| 714 | padVendorSpecific[0] = 221; |
| 715 | padVendorSpecific[1] = padLen - 2; |
| 716 | padVendorSpecific[2] = 0x00; |
| 717 | padVendorSpecific[3] = 0xA0; |
| 718 | padVendorSpecific[4] = 0xC6; |
| 719 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 720 | limLog(pMac, LOG1, FL("Padding Vendor Specific Ie Len = %d"), padLen); |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 721 | |
| 722 | /* padding zero if more than 5 bytes are required */ |
| 723 | if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 724 | vos_mem_set( pFrame + header_offset + nPayload + MIN_VENDOR_SPECIFIC_IE_SIZE, |
| 725 | padLen - MIN_VENDOR_SPECIFIC_IE_SIZE, 0); |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 726 | } |
| 727 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 728 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 729 | limLog(pMac, LOG1, |
| 730 | FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR), |
| 731 | SIR_MAC_TDLS_DIS_REQ, |
| 732 | limTraceTdlsActionString(SIR_MAC_TDLS_DIS_REQ), |
| 733 | MAC_ADDR_ARRAY(peer_mac)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 734 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 735 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 736 | HAL_TXRX_FRM_802_11_DATA, |
| 737 | ANI_TXDIR_TODS, |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 738 | TID_AC_VI, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 739 | limTxComplete, pFrame, |
| 740 | limMgmtTXComplete, |
Masti, Narayanraddi | a12cce8 | 2016-02-02 14:10:01 +0530 | [diff] [blame^] | 741 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME | |
| 742 | HAL_USE_PEER_STA_REQUESTED_MASK, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 743 | pMac->lim.txBdToken++); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 744 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 745 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 746 | pMac->lim.mgmtFrameSessionId = 0xff; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 747 | limLog(pMac, LOGE, FL("could not send TDLS Discovery Request frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 748 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 749 | } |
Ganesh Kondabattini | ff98702 | 2015-08-11 19:43:44 +0530 | [diff] [blame] | 750 | pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 751 | |
| 752 | return eSIR_SUCCESS; |
| 753 | |
| 754 | } |
| 755 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 756 | /* |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 757 | * This static function is consistent with any kind of TDLS management |
| 758 | * frames we are sending. Currently it is being used by limSendTdlsDisRspFrame, |
| 759 | * limSendTdlsLinkSetupReqFrame and limSendTdlsSetupRspFrame |
| 760 | */ |
| 761 | static void PopulateDot11fTdlsHtVhtCap(tpAniSirGlobal pMac, uint32 selfDot11Mode, |
| 762 | tDot11fIEHTCaps *htCap, tDot11fIEVHTCaps *vhtCap, |
| 763 | tpPESession psessionEntry) |
| 764 | { |
| 765 | if (IS_DOT11_MODE_HT(selfDot11Mode)) |
| 766 | { |
| 767 | /* Include HT Capability IE */ |
| 768 | PopulateDot11fHTCaps( pMac, NULL, htCap ); |
Ganesh Kondabattini | b554d29 | 2015-02-11 14:37:25 +0530 | [diff] [blame] | 769 | /* Advertize ht capability and max supported channel |
| 770 | * bandwidth when populating HT IE in TDLS Setup Request/ |
| 771 | * Setup Response/Setup Confirmation frames. |
| 772 | * 11.21.6.2 Setting up a 40 MHz direct link: A 40 MHz off-channel |
| 773 | * direct link may be started if both TDLS peer STAs indicated |
| 774 | * 40 MHz support in the Supported Channel Width Set field of the |
| 775 | * HT Capabilities element (which is included in the TDLS Setup Request |
| 776 | * frame and the TDLS Setup Response frame). Switching to a 40 MHz |
| 777 | * off-channel direct link is achieved by including the following |
| 778 | * information in the TDLS Channel Switch Request |
| 779 | * 11.21.1 General: The channel width of the TDLS direct link on the |
| 780 | * base channel shall not exceed the channel width of the BSS to which |
| 781 | * the TDLS peer STAs are associated.*/ |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 782 | htCap->present = 1; |
Ganesh Kondabattini | b554d29 | 2015-02-11 14:37:25 +0530 | [diff] [blame] | 783 | htCap->supportedChannelWidthSet = 1; // hardcode it to max |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 784 | } |
| 785 | else |
| 786 | { |
| 787 | htCap->present = 0; |
| 788 | } |
Ganesh Kondabattini | b554d29 | 2015-02-11 14:37:25 +0530 | [diff] [blame] | 789 | limLog(pMac, LOG1, FL("HT present = %hu, Chan Width = %hu"), |
| 790 | htCap->present, htCap->supportedChannelWidthSet); |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 791 | #ifdef WLAN_FEATURE_11AC |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 792 | if (IS_DOT11_MODE_VHT(selfDot11Mode) && |
| 793 | IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 794 | { |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 795 | /* Include VHT Capability IE */ |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 796 | PopulateDot11fVHTCaps( pMac, vhtCap, |
| 797 | psessionEntry->currentOperChannel, eSIR_FALSE ); |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 798 | } |
| 799 | else |
| 800 | { |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 801 | vhtCap->present = 0; |
| 802 | } |
Ganesh Kondabattini | b554d29 | 2015-02-11 14:37:25 +0530 | [diff] [blame] | 803 | limLog(pMac, LOG1, FL("VHT present = %hu"), |
| 804 | vhtCap->present); |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 805 | #endif |
| 806 | } |
| 807 | |
| 808 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 809 | * Send TDLS discovery response frame on direct link. |
| 810 | */ |
| 811 | |
Mahesh A Saptasagar | 9be00d7 | 2014-08-28 16:04:43 +0530 | [diff] [blame] | 812 | static tSirRetStatus limSendTdlsDisRspFrame(tpAniSirGlobal pMac, |
| 813 | tSirMacAddr peerMac, tANI_U8 dialog, |
| 814 | tpPESession psessionEntry, tANI_U8 *addIe, |
| 815 | tANI_U16 addIeLen) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 816 | { |
| 817 | tDot11fTDLSDisRsp tdlsDisRsp ; |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 818 | tANI_U16 caps = 0 ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 819 | tANI_U32 status = 0 ; |
| 820 | tANI_U32 nPayload = 0 ; |
| 821 | tANI_U32 nBytes = 0 ; |
| 822 | tANI_U8 *pFrame; |
| 823 | void *pPacket; |
| 824 | eHalStatus halstatus; |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 825 | uint32 selfDot11Mode; |
| 826 | // Placeholder to support different channel bonding mode of TDLS than AP. |
| 827 | // Today, WNI_CFG_CHANNEL_BONDING_MODE will be overwritten when connecting to AP |
| 828 | // To support this feature, we need to introduce WNI_CFG_TDLS_CHANNEL_BONDING_MODE |
| 829 | // As of now, we hardcoded to max channel bonding of dot11Mode (i.e HT80 for 11ac/HT40 for 11n) |
| 830 | // uint32 tdlsChannelBondingMode; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 831 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 832 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 833 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 834 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 835 | * serialization). We start by zero-initializing the structure: |
| 836 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 837 | vos_mem_set( ( tANI_U8* )&tdlsDisRsp, |
| 838 | sizeof( tDot11fTDLSDisRsp ), 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 839 | |
| 840 | /* |
| 841 | * setup Fixed fields, |
| 842 | */ |
| 843 | tdlsDisRsp.Category.category = SIR_MAC_ACTION_PUBLIC_USAGE; |
| 844 | tdlsDisRsp.Action.action = SIR_MAC_TDLS_DIS_RSP ; |
| 845 | tdlsDisRsp.DialogToken.token = dialog ; |
| 846 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 847 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsDisRsp.LinkIdentifier, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 848 | peerMac, TDLS_RESPONDER) ; |
| 849 | |
| 850 | if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) |
| 851 | { |
| 852 | /* |
| 853 | * Could not get Capabilities value |
| 854 | * from CFG. Log error. |
| 855 | */ |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 856 | limLog(pMac, LOGP, FL("could not retrieve Capabilities value")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 857 | } |
| 858 | swapBitField16(caps, ( tANI_U16* )&tdlsDisRsp.Capabilities ); |
| 859 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 860 | /* populate supported rate and ext supported rate IE */ |
| 861 | if (eSIR_FAILURE == PopulateDot11fRatesTdls(pMac, &tdlsDisRsp.SuppRates, |
Masti, Narayanraddi | cc203f6 | 2015-12-24 14:41:29 +0530 | [diff] [blame] | 862 | &tdlsDisRsp.ExtSuppRates, |
| 863 | psessionEntry->currentOperChannel)) |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 864 | limLog(pMac, LOGE, FL("could not populate supported data rates")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 865 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 866 | /* Populate extended capability IE */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 867 | PopulateDot11fTdlsExtCapability( pMac, &tdlsDisRsp.ExtCap ); |
| 868 | |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 869 | wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfDot11Mode); |
| 870 | |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 871 | /* Populate HT/VHT Capabilities */ |
| 872 | PopulateDot11fTdlsHtVhtCap( pMac, selfDot11Mode, &tdlsDisRsp.HTCaps, |
| 873 | &tdlsDisRsp.VHTCaps, psessionEntry ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 874 | |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 875 | if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled ) |
| 876 | PopulateDot11fTdlsOffchannelParams( pMac, psessionEntry, |
| 877 | &tdlsDisRsp.SuppChannels, |
| 878 | &tdlsDisRsp.SuppOperatingClasses); |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 879 | |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 880 | if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE) |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 881 | { |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 882 | if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled && |
| 883 | ( pMac->roam.configParam.bandCapability != eCSR_BAND_24) ) |
| 884 | { |
| 885 | tdlsDisRsp.HT2040BSSCoexistence.present = 1; |
| 886 | tdlsDisRsp.HT2040BSSCoexistence.infoRequest = 1; |
| 887 | } |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 888 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 889 | /* |
| 890 | * now we pack it. First, how much space are we going to need? |
| 891 | */ |
| 892 | status = dot11fGetPackedTDLSDisRspSize( pMac, &tdlsDisRsp, &nPayload); |
| 893 | if ( DOT11F_FAILED( status ) ) |
| 894 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 895 | limLog(pMac, LOGE, |
| 896 | FL("Failed to calculate the packed size for a Discovery Response (0x%08x)."), |
| 897 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 898 | /* We'll fall back on the worst case scenario: */ |
| 899 | nPayload = sizeof( tDot11fProbeRequest ); |
| 900 | } |
| 901 | else if ( DOT11F_WARNED( status ) ) |
| 902 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 903 | limLog(pMac, LOGW, |
| 904 | FL("There were warnings while calculating the packed size for a Discovery Response (0x%08x)."), |
| 905 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 906 | } |
| 907 | |
| 908 | /* |
| 909 | * This frame is going out from PE as data frames with special ethertype |
| 910 | * 89-0d. |
| 911 | * 8 bytes of RFC 1042 header |
| 912 | */ |
| 913 | |
| 914 | |
Mahesh A Saptasagar | 53e9c1f | 2014-09-23 17:55:48 +0530 | [diff] [blame] | 915 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + addIeLen; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 916 | |
| 917 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 918 | |
| 919 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 920 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 921 | ( void** ) &pPacket ); |
| 922 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 923 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 924 | limLog(pMac, LOGE, |
| 925 | FL("Failed to allocate %d bytes for a TDLS Discovery Response."), |
| 926 | nBytes); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 927 | return eSIR_MEM_ALLOC_FAILED; |
| 928 | } |
| 929 | |
| 930 | /* zero out the memory */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 931 | vos_mem_set( pFrame, nBytes, 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 932 | |
| 933 | /* |
| 934 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 935 | * response frame |
| 936 | */ |
| 937 | |
| 938 | /* Make public Action Frame */ |
| 939 | |
| 940 | #if 0 |
| 941 | limPreparesActionFrameHdr(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 942 | SIR_MAC_MGMT_ACTION, |
| 943 | LINK_IDEN_ADDR_OFFSET(tdlsDisRsp)) ; |
| 944 | #endif |
| 945 | limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 946 | SIR_MAC_MGMT_ACTION, peerMac, psessionEntry->selfMacAddr); |
| 947 | |
| 948 | { |
| 949 | tpSirMacMgmtHdr pMacHdr; |
| 950 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 951 | pMacHdr->fc.toDS = ANI_TXDIR_IBSS; |
| 952 | pMacHdr->fc.powerMgmt = 0 ; |
| 953 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 954 | } |
| 955 | |
| 956 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 957 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_DSCV_RSP) |
| 958 | { |
| 959 | tdlsDisRsp.LinkIdentifier.bssid[4] = 0xde; |
| 960 | tdlsDisRsp.LinkIdentifier.bssid[5] = 0xad; |
| 961 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 962 | ("TDLS negative running: wrong BSSID " MAC_ADDRESS_STR " in TDLS Discovery Rsp"), |
| 963 | MAC_ADDR_ARRAY(tdlsDisRsp.LinkIdentifier.bssid)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 964 | } |
| 965 | #endif |
| 966 | status = dot11fPackTDLSDisRsp( pMac, &tdlsDisRsp, pFrame + |
| 967 | sizeof( tSirMacMgmtHdr ), |
| 968 | nPayload, &nPayload ); |
| 969 | |
| 970 | if ( DOT11F_FAILED( status ) ) |
| 971 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 972 | limLog( pMac, LOGE, |
| 973 | FL("Failed to pack a TDLS Discovery Response (0x%08x)."), |
| 974 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 975 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 976 | ( void* ) pFrame, ( void* ) pPacket ); |
| 977 | return eSIR_FAILURE; |
| 978 | } |
| 979 | else if ( DOT11F_WARNED( status ) ) |
| 980 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 981 | limLog( pMac, LOGW, |
| 982 | FL("There were warnings while packing TDLS Discovery Request (0x%08x)."), |
| 983 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 984 | } |
| 985 | |
| 986 | #if 0 |
| 987 | if(pMac->hal.pCBackFnTxComp == NULL) |
| 988 | { |
| 989 | pMac->hal.pCBackFnTxComp = (tpCBackFnTxComp)limTdlsDisRspTxComplete; |
| 990 | |
| 991 | if(TX_SUCCESS != tx_timer_activate(&pMac->hal.txCompTimer)) |
| 992 | { |
| 993 | status = eHAL_STATUS_FAILURE; |
| 994 | return status; |
| 995 | |
| 996 | } |
| 997 | } |
| 998 | #endif |
Mahesh A Saptasagar | 53e9c1f | 2014-09-23 17:55:48 +0530 | [diff] [blame] | 999 | if (0 != addIeLen) |
| 1000 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1001 | limLog(pMac, LOG1, FL("Copy Additional Ie Len = %d"), addIeLen); |
Mahesh A Saptasagar | 53e9c1f | 2014-09-23 17:55:48 +0530 | [diff] [blame] | 1002 | vos_mem_copy(pFrame + sizeof(tSirMacMgmtHdr) + nPayload, addIe, |
| 1003 | addIeLen); |
| 1004 | } |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1005 | limLog(pMac, LOG1, |
| 1006 | FL("[TDLS] action %d (%s) -DIRECT-> OTA peer="MAC_ADDRESS_STR), |
| 1007 | SIR_MAC_TDLS_DIS_RSP, |
| 1008 | limTraceTdlsActionString(SIR_MAC_TDLS_DIS_RSP), |
| 1009 | MAC_ADDR_ARRAY(peerMac)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1010 | |
| 1011 | /* |
| 1012 | * Transmit Discovery response and watch if this is delivered to |
| 1013 | * peer STA. |
| 1014 | */ |
| 1015 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1016 | HAL_TXRX_FRM_802_11_DATA, |
| 1017 | ANI_TXDIR_IBSS, |
| 1018 | 0, |
| 1019 | limTxComplete, pFrame, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1020 | limMgmtTXComplete, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 1021 | HAL_USE_SELF_STA_REQUESTED_MASK, |
| 1022 | pMac->lim.txBdToken++); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1023 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1024 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1025 | pMac->lim.mgmtFrameSessionId = 0xff; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1026 | limLog(pMac, LOGE, FL("could not send TDLS Discovery Response frame!")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1027 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1028 | } |
Ganesh Kondabattini | ff98702 | 2015-08-11 19:43:44 +0530 | [diff] [blame] | 1029 | pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1030 | |
| 1031 | return eSIR_SUCCESS; |
| 1032 | |
| 1033 | } |
| 1034 | |
| 1035 | /* |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 1036 | * This static function is currently used by limSendTdlsLinkSetupReqFrame and |
| 1037 | * limSendTdlsSetupRspFrame to populate the AID if device is 11ac capable. |
| 1038 | */ |
| 1039 | static void PopulateDotfTdlsVhtAID(tpAniSirGlobal pMac, uint32 selfDot11Mode, |
| 1040 | tSirMacAddr peerMac, tDot11fIEAID *Aid, |
| 1041 | tpPESession psessionEntry) |
| 1042 | { |
| 1043 | if (((psessionEntry->currentOperChannel <= SIR_11B_CHANNEL_END) && |
| 1044 | pMac->roam.configParam.enableVhtFor24GHz) || |
| 1045 | (psessionEntry->currentOperChannel >= SIR_11B_CHANNEL_END)) |
| 1046 | { |
| 1047 | if (IS_DOT11_MODE_VHT(selfDot11Mode) && |
| 1048 | IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 1049 | { |
| 1050 | |
| 1051 | tANI_U16 aid; |
| 1052 | tpDphHashNode pStaDs; |
| 1053 | |
| 1054 | pStaDs = dphLookupHashEntry(pMac, peerMac, &aid, &psessionEntry->dph.dphHashTable); |
| 1055 | if (NULL != pStaDs) |
| 1056 | { |
| 1057 | Aid->present = 1; |
| 1058 | Aid->assocId = aid | LIM_AID_MASK; // set bit 14 and 15 1's |
| 1059 | } |
| 1060 | else |
| 1061 | { |
| 1062 | Aid->present = 0; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1063 | limLog(pMac, LOGE, FL("pStaDs is NULL for " MAC_ADDRESS_STR), |
| 1064 | MAC_ADDR_ARRAY(peerMac)); |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 1065 | } |
| 1066 | } |
| 1067 | } |
| 1068 | else |
| 1069 | { |
| 1070 | Aid->present = 0; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1071 | limLog(pMac, LOGW, FL("Vht not enable from ini for 2.4GHz.")); |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1076 | * TDLS setup Request frame on AP link |
| 1077 | */ |
| 1078 | |
| 1079 | tSirRetStatus limSendTdlsLinkSetupReqFrame(tpAniSirGlobal pMac, |
| 1080 | tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry, |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1081 | tANI_U8 *addIe, tANI_U16 addIeLen) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1082 | { |
| 1083 | tDot11fTDLSSetupReq tdlsSetupReq ; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1084 | tANI_U16 caps = 0 ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1085 | tANI_U32 status = 0 ; |
| 1086 | tANI_U32 nPayload = 0 ; |
| 1087 | tANI_U32 nBytes = 0 ; |
| 1088 | tANI_U32 header_offset = 0 ; |
| 1089 | tANI_U8 *pFrame; |
| 1090 | void *pPacket; |
| 1091 | eHalStatus halstatus; |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1092 | uint32 selfDot11Mode; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 1093 | tpSirMacCapabilityInfo pCapInfo; |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1094 | // Placeholder to support different channel bonding mode of TDLS than AP. |
| 1095 | // Today, WNI_CFG_CHANNEL_BONDING_MODE will be overwritten when connecting to AP |
| 1096 | // To support this feature, we need to introduce WNI_CFG_TDLS_CHANNEL_BONDING_MODE |
| 1097 | // As of now, we hardcoded to max channel bonding of dot11Mode (i.e HT80 for 11ac/HT40 for 11n) |
| 1098 | // uint32 tdlsChannelBondingMode; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1099 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1100 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1101 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1102 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1103 | * serialization). We start by zero-initializing the structure: |
| 1104 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1105 | vos_mem_set(( tANI_U8* )&tdlsSetupReq, sizeof( tDot11fTDLSSetupReq ), 0); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1106 | tdlsSetupReq.Category.category = SIR_MAC_ACTION_TDLS ; |
| 1107 | tdlsSetupReq.Action.action = SIR_MAC_TDLS_SETUP_REQ ; |
| 1108 | tdlsSetupReq.DialogToken.token = dialog ; |
| 1109 | |
| 1110 | |
| 1111 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsSetupReq.LinkIdentifier, |
| 1112 | peerMac, TDLS_INITIATOR) ; |
| 1113 | |
| 1114 | if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) |
| 1115 | { |
| 1116 | /* |
| 1117 | * Could not get Capabilities value |
| 1118 | * from CFG. Log error. |
| 1119 | */ |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1120 | limLog(pMac, LOGE, FL("could not retrieve Capabilities value")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1121 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 1122 | |
| 1123 | pCapInfo = (tpSirMacCapabilityInfo) ∩︀ |
| 1124 | /* Export QOS capability */ |
| 1125 | pCapInfo->qos = 1; |
| 1126 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1127 | swapBitField16(caps, ( tANI_U16* )&tdlsSetupReq.Capabilities ); |
| 1128 | |
Masti, Narayanraddi | cc203f6 | 2015-12-24 14:41:29 +0530 | [diff] [blame] | 1129 | limLog(pMac, LOG1, FL("Sending operating channel %d and dotl11mode %d\n"), |
| 1130 | psessionEntry->currentOperChannel, |
| 1131 | psessionEntry->dot11mode); |
| 1132 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 1133 | /* populate supported rate and ext supported rate IE */ |
| 1134 | PopulateDot11fRatesTdls(pMac, &tdlsSetupReq.SuppRates, |
Masti, Narayanraddi | cc203f6 | 2015-12-24 14:41:29 +0530 | [diff] [blame] | 1135 | &tdlsSetupReq.ExtSuppRates, |
| 1136 | psessionEntry->currentOperChannel); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1137 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 1138 | /* Populate extended capability IE */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1139 | PopulateDot11fTdlsExtCapability( pMac, &tdlsSetupReq.ExtCap ); |
| 1140 | |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1141 | if ( 1 == pMac->lim.gLimTDLSWmmMode ) |
| 1142 | { |
Pradeep Reddy POTTETI | f0f5fca | 2015-02-28 13:22:35 +0530 | [diff] [blame] | 1143 | tANI_U32 val = 0; |
| 1144 | |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1145 | /* include WMM IE */ |
Pradeep Reddy POTTETI | f0f5fca | 2015-02-28 13:22:35 +0530 | [diff] [blame] | 1146 | tdlsSetupReq.WMMInfoStation.version = SIR_MAC_OUI_VERSION_1; |
| 1147 | tdlsSetupReq.WMMInfoStation.acvo_uapsd = |
| 1148 | (pMac->lim.gLimTDLSUapsdMask & 0x01); |
| 1149 | tdlsSetupReq.WMMInfoStation.acvi_uapsd = |
| 1150 | ((pMac->lim.gLimTDLSUapsdMask & 0x02) >> 1); |
| 1151 | tdlsSetupReq.WMMInfoStation.acbk_uapsd = |
| 1152 | ((pMac->lim.gLimTDLSUapsdMask & 0x04) >> 2); |
| 1153 | tdlsSetupReq.WMMInfoStation.acbe_uapsd = |
| 1154 | ((pMac->lim.gLimTDLSUapsdMask & 0x08) >> 3); |
| 1155 | |
| 1156 | if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) |
Sushant Kaushik | 8778797 | 2015-09-11 16:05:00 +0530 | [diff] [blame] | 1157 | limLog(pMac, LOGE, FL("could not retrieve Max SP Length")); |
Pradeep Reddy POTTETI | f0f5fca | 2015-02-28 13:22:35 +0530 | [diff] [blame] | 1158 | |
| 1159 | tdlsSetupReq.WMMInfoStation.max_sp_length = (tANI_U8)val; |
| 1160 | tdlsSetupReq.WMMInfoStation.present = 1; |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1161 | } |
| 1162 | else |
| 1163 | { |
| 1164 | /* |
| 1165 | * TODO: we need to see if we have to support conditions where we have |
| 1166 | * EDCA parameter info element is needed a) if we need different QOS |
| 1167 | * parameters for off channel operations or QOS is not supported on |
| 1168 | * AP link and we wanted to QOS on direct link. |
| 1169 | */ |
| 1170 | /* Populate QOS info, needed for Peer U-APSD session */ |
| 1171 | /* TODO: Now hardcoded, because PopulateDot11fQOSCapsStation() depends on AP's capability, and |
| 1172 | TDLS doesn't want to depend on AP's capability */ |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1173 | limLog(pMac, LOG1, FL("populate QOS IE in Setup Request Frame")); |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1174 | tdlsSetupReq.QOSCapsStation.present = 1; |
| 1175 | tdlsSetupReq.QOSCapsStation.max_sp_length = 0; |
| 1176 | tdlsSetupReq.QOSCapsStation.qack = 0; |
| 1177 | tdlsSetupReq.QOSCapsStation.acbe_uapsd = ((pMac->lim.gLimTDLSUapsdMask & 0x08) >> 3); |
| 1178 | tdlsSetupReq.QOSCapsStation.acbk_uapsd = ((pMac->lim.gLimTDLSUapsdMask & 0x04) >> 2); |
| 1179 | tdlsSetupReq.QOSCapsStation.acvi_uapsd = ((pMac->lim.gLimTDLSUapsdMask & 0x02) >> 1); |
| 1180 | tdlsSetupReq.QOSCapsStation.acvo_uapsd = (pMac->lim.gLimTDLSUapsdMask & 0x01); |
| 1181 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1182 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1183 | /* |
| 1184 | * we will always try to init TDLS link with 11n capabilities |
| 1185 | * let TDLS setup response to come, and we will set our caps based |
| 1186 | * of peer caps |
| 1187 | */ |
| 1188 | |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1189 | wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfDot11Mode); |
| 1190 | |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 1191 | /* Populate HT/VHT Capabilities */ |
| 1192 | PopulateDot11fTdlsHtVhtCap( pMac, selfDot11Mode, &tdlsSetupReq.HTCaps, |
| 1193 | &tdlsSetupReq.VHTCaps, psessionEntry ); |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1194 | |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 1195 | /* Populate AID */ |
| 1196 | PopulateDotfTdlsVhtAID( pMac, selfDot11Mode, peerMac, |
| 1197 | &tdlsSetupReq.AID, psessionEntry ); |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1198 | |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 1199 | if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled ) |
| 1200 | PopulateDot11fTdlsOffchannelParams( pMac, psessionEntry, |
| 1201 | &tdlsSetupReq.SuppChannels, |
| 1202 | &tdlsSetupReq.SuppOperatingClasses); |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 1203 | |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 1204 | if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE) |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 1205 | { |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 1206 | if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled && |
| 1207 | ( pMac->roam.configParam.bandCapability != eCSR_BAND_24)) |
| 1208 | { |
| 1209 | tdlsSetupReq.HT2040BSSCoexistence.present = 1; |
| 1210 | tdlsSetupReq.HT2040BSSCoexistence.infoRequest = 1; |
| 1211 | } |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 1212 | } |
| 1213 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1214 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1215 | * now we pack it. First, how much space are we going to need? |
| 1216 | */ |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1217 | status = dot11fGetPackedTDLSSetupReqSize( pMac, &tdlsSetupReq, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1218 | &nPayload); |
| 1219 | if ( DOT11F_FAILED( status ) ) |
| 1220 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1221 | limLog(pMac, LOGE, |
| 1222 | FL("Failed to calculate the packed size for a Setup Request (0x%08x)."), |
| 1223 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1224 | /* We'll fall back on the worst case scenario: */ |
| 1225 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1226 | } |
| 1227 | else if ( DOT11F_WARNED( status ) ) |
| 1228 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1229 | limLog(pMac, LOGW, |
| 1230 | FL("There were warnings while calculating the packed size for a Setup Request (0x%08x)."), |
| 1231 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1232 | } |
| 1233 | |
| 1234 | |
| 1235 | /* |
| 1236 | * This frame is going out from PE as data frames with special ethertype |
| 1237 | * 89-0d. |
| 1238 | * 8 bytes of RFC 1042 header |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1239 | */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1240 | |
| 1241 | |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 1242 | nBytes = nPayload + ((IS_QOS_ENABLED(psessionEntry)) |
| 1243 | ? sizeof(tSirMacDataHdr3a) : sizeof(tSirMacMgmtHdr)) |
| 1244 | + sizeof( eth_890d_header ) |
| 1245 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1246 | + addIeLen; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1247 | |
| 1248 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1249 | |
| 1250 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1251 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1252 | ( void** ) &pPacket ); |
| 1253 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1254 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1255 | limLog(pMac, LOGE, |
| 1256 | FL("Failed to allocate %d bytes for a TDLS Setup Request."), |
| 1257 | nBytes); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1258 | return eSIR_MEM_ALLOC_FAILED; |
| 1259 | } |
| 1260 | |
| 1261 | /* zero out the memory */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1262 | vos_mem_set( pFrame, nBytes, 0); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1263 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1264 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1265 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1266 | * request frame |
| 1267 | */ |
| 1268 | |
| 1269 | /* fill out the buffer descriptor */ |
| 1270 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1271 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
Pradeep Reddy POTTETI | 6f2c9bb | 2015-07-16 14:57:36 +0530 | [diff] [blame] | 1272 | LINK_IDEN_ADDR_OFFSET(tdlsSetupReq), |
| 1273 | TDLS_LINK_AP, TDLS_INITIATOR, |
| 1274 | TID_AC_VI, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1275 | |
| 1276 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 1277 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_REQ) |
| 1278 | { |
| 1279 | tdlsSetupReq.LinkIdentifier.bssid[4] = 0xde; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1280 | tdlsSetupReq.LinkIdentifier.bssid[5] = 0xad; |
| 1281 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1282 | ("TDLS negative running: wrong BSSID " MAC_ADDRESS_STR " in TDLS Setup Req"), |
| 1283 | MAC_ADDR_ARRAY(tdlsSetupReq.LinkIdentifier.bssid)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1284 | } |
| 1285 | #endif |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1286 | limLog( pMac, LOGW, FL("SupportedChnlWidth %x rxMCSMap %x rxMCSMap %x txSupDataRate %x"), |
| 1287 | tdlsSetupReq.VHTCaps.supportedChannelWidthSet, |
| 1288 | tdlsSetupReq.VHTCaps.rxMCSMap, |
| 1289 | tdlsSetupReq.VHTCaps.txMCSMap, |
| 1290 | tdlsSetupReq.VHTCaps.txSupDataRate); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 1291 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1292 | status = dot11fPackTDLSSetupReq( pMac, &tdlsSetupReq, pFrame |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1293 | + header_offset, nPayload, &nPayload ); |
| 1294 | |
| 1295 | if ( DOT11F_FAILED( status ) ) |
| 1296 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1297 | limLog(pMac, LOGE, |
| 1298 | FL("Failed to pack a TDLS Setup Request (0x%08x)."), |
| 1299 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1300 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1301 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1302 | return eSIR_FAILURE; |
| 1303 | } |
| 1304 | else if ( DOT11F_WARNED( status ) ) |
| 1305 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1306 | limLog(pMac, LOGW, |
| 1307 | FL("There were warnings while packing TDLS Setup Request (0x%08x)."), |
| 1308 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1309 | } |
| 1310 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1311 | //Copy the additional IE. |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1312 | //TODO : addIe is added at the end of the frame. This means it doesnt |
| 1313 | //follow the order. This should be ok, but we should consider changing this |
| 1314 | //if there is any IOT issue. |
| 1315 | if( addIeLen != 0 ) |
| 1316 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1317 | limLog(pMac, LOG1, FL("Copy Additional Ie Len = %d"), |
| 1318 | addIeLen); |
| 1319 | vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1320 | } |
| 1321 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1322 | limLog(pMac, LOG1, FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR), |
| 1323 | SIR_MAC_TDLS_SETUP_REQ, |
| 1324 | limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_REQ), |
| 1325 | MAC_ADDR_ARRAY(peerMac)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1326 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1327 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1328 | HAL_TXRX_FRM_802_11_DATA, |
| 1329 | ANI_TXDIR_TODS, |
Pradeep Reddy POTTETI | 0171006 | 2015-06-29 13:35:53 +0530 | [diff] [blame] | 1330 | TID_AC_VI, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1331 | limTxComplete, pFrame, |
| 1332 | limMgmtTXComplete, |
Masti, Narayanraddi | a12cce8 | 2016-02-02 14:10:01 +0530 | [diff] [blame^] | 1333 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME | |
| 1334 | HAL_USE_PEER_STA_REQUESTED_MASK, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 1335 | pMac->lim.txBdToken++); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1336 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1337 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1338 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1339 | pMac->lim.mgmtFrameSessionId = 0xff; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1340 | limLog(pMac, LOGE, FL("could not send TDLS Setup Request frame!")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1341 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1342 | } |
Ganesh Kondabattini | ff98702 | 2015-08-11 19:43:44 +0530 | [diff] [blame] | 1343 | pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1344 | |
| 1345 | return eSIR_SUCCESS; |
| 1346 | |
| 1347 | } |
| 1348 | /* |
| 1349 | * Send TDLS Teardown frame on Direct link or AP link, depends on reason code. |
| 1350 | */ |
| 1351 | |
| 1352 | tSirRetStatus limSendTdlsTeardownFrame(tpAniSirGlobal pMac, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1353 | tSirMacAddr peerMac, tANI_U16 reason, tANI_U8 responder, tpPESession psessionEntry, |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1354 | tANI_U8 *addIe, tANI_U16 addIeLen) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1355 | { |
| 1356 | tDot11fTDLSTeardown teardown ; |
| 1357 | tANI_U32 status = 0 ; |
| 1358 | tANI_U32 nPayload = 0 ; |
| 1359 | tANI_U32 nBytes = 0 ; |
| 1360 | tANI_U32 header_offset = 0 ; |
| 1361 | tANI_U8 *pFrame; |
| 1362 | void *pPacket; |
| 1363 | eHalStatus halstatus; |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1364 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1365 | tANI_U32 padLen = 0; |
| 1366 | #endif |
Pradeep Reddy POTTETI | 7408431 | 2015-08-04 18:26:30 +0530 | [diff] [blame] | 1367 | tpDphHashNode pStaDs = NULL; |
| 1368 | tANI_U16 aid = 0; |
| 1369 | tANI_U8 qosMode = 0; |
| 1370 | tANI_U8 tdlsLinkType = 0; |
| 1371 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1372 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1373 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1374 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1375 | * serialization). We start by zero-initializing the structure: |
| 1376 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1377 | vos_mem_set( ( tANI_U8* )&teardown, sizeof( tDot11fTDLSTeardown ), 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1378 | teardown.Category.category = SIR_MAC_ACTION_TDLS ; |
| 1379 | teardown.Action.action = SIR_MAC_TDLS_TEARDOWN ; |
| 1380 | teardown.Reason.code = reason ; |
| 1381 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1382 | PopulateDot11fLinkIden( pMac, psessionEntry, &teardown.LinkIdentifier, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 1383 | peerMac, (responder == TRUE) ? TDLS_RESPONDER : TDLS_INITIATOR) ; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1384 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1385 | * now we pack it. First, how much space are we going to need? |
| 1386 | */ |
| 1387 | status = dot11fGetPackedTDLSTeardownSize( pMac, &teardown, &nPayload); |
| 1388 | if ( DOT11F_FAILED( status ) ) |
| 1389 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1390 | limLog(pMac, LOGE, |
| 1391 | FL("Failed to calculate the packed size for Teardown frame (0x%08x)."), |
| 1392 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1393 | /* We'll fall back on the worst case scenario: */ |
| 1394 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1395 | } |
| 1396 | else if ( DOT11F_WARNED( status ) ) |
| 1397 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1398 | limLog(pMac, LOGW, |
| 1399 | FL("There were warnings while calculating the packed size for Teardown frame (0x%08x)."), |
| 1400 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1401 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1402 | /* |
| 1403 | * This frame is going out from PE as data frames with special ethertype |
| 1404 | * 89-0d. |
| 1405 | * 8 bytes of RFC 1042 header |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1406 | */ |
Pradeep Reddy POTTETI | 7408431 | 2015-08-04 18:26:30 +0530 | [diff] [blame] | 1407 | pStaDs = dphLookupHashEntry(pMac, peerMac, &aid, |
| 1408 | &psessionEntry->dph.dphHashTable); |
| 1409 | if (pStaDs) |
| 1410 | { |
| 1411 | qosMode = pStaDs->qosMode; |
| 1412 | } |
| 1413 | tdlsLinkType = (reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE) |
| 1414 | ? TDLS_LINK_AP : TDLS_LINK_DIRECT; |
| 1415 | nBytes = nPayload + (((IS_QOS_ENABLED(psessionEntry) && |
| 1416 | (tdlsLinkType == TDLS_LINK_AP)) || |
| 1417 | ((tdlsLinkType == TDLS_LINK_DIRECT) && qosMode)) |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 1418 | ? sizeof(tSirMacDataHdr3a) : sizeof(tSirMacMgmtHdr)) |
| 1419 | + sizeof( eth_890d_header ) |
| 1420 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1421 | + addIeLen; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1422 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1423 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1424 | /* IOT issue with some AP : some AP doesn't like the data packet size < minimum 802.3 frame length (64) |
| 1425 | Hence AP itself padding some bytes, which caused teardown packet is dropped at |
| 1426 | receiver side. To avoid such IOT issue, we added some extra bytes to meet data frame size >= 64 |
| 1427 | */ |
| 1428 | if (nPayload + PAYLOAD_TYPE_TDLS_SIZE < MIN_IEEE_8023_SIZE) |
| 1429 | { |
| 1430 | padLen = MIN_IEEE_8023_SIZE - (nPayload + PAYLOAD_TYPE_TDLS_SIZE ) ; |
| 1431 | |
| 1432 | /* if padLen is less than minimum vendorSpecific (5), pad up to 5 */ |
| 1433 | if (padLen < MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 1434 | padLen = MIN_VENDOR_SPECIFIC_IE_SIZE; |
| 1435 | |
| 1436 | nBytes += padLen; |
| 1437 | } |
| 1438 | #endif |
| 1439 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1440 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1441 | |
| 1442 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1443 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1444 | ( void** ) &pPacket ); |
| 1445 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1446 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1447 | limLog(pMac, LOGE, |
| 1448 | FL("Failed to allocate %d bytes for a TDLS Teardown Frame."), |
| 1449 | nBytes); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1450 | return eSIR_MEM_ALLOC_FAILED; |
| 1451 | } |
| 1452 | |
| 1453 | /* zero out the memory */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1454 | vos_mem_set( pFrame, nBytes, 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1455 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1456 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1457 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1458 | * request frame |
| 1459 | */ |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1460 | limLog(pMac, LOGE, FL("Reason of TDLS Teardown: %d"), reason); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1461 | /* fill out the buffer descriptor */ |
| 1462 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1463 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 1464 | LINK_IDEN_ADDR_OFFSET(teardown), |
| 1465 | (reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE) |
Gopichand Nakkala | 269032c | 2013-02-07 17:18:15 -0800 | [diff] [blame] | 1466 | ? TDLS_LINK_AP : TDLS_LINK_DIRECT, |
| 1467 | (responder == TRUE) ? TDLS_RESPONDER : TDLS_INITIATOR, |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 1468 | TID_AC_VI, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1469 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1470 | status = dot11fPackTDLSTeardown( pMac, &teardown, pFrame |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1471 | + header_offset, nPayload, &nPayload ); |
| 1472 | |
| 1473 | if ( DOT11F_FAILED( status ) ) |
| 1474 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1475 | limLog( pMac, LOGE, FL("Failed to pack a TDLS Teardown req (0x%08x)."), |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1476 | status); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1477 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1478 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1479 | return eSIR_FAILURE; |
| 1480 | } |
| 1481 | else if ( DOT11F_WARNED( status ) ) |
| 1482 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1483 | limLog(pMac, LOGW, FL("There were warnings while packing TDLS Teardown frame (0x%08x)."), |
| 1484 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1485 | } |
| 1486 | #if 0 |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1487 | if(pMac->hal.pCBackFnTxComp == NULL) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1488 | { |
| 1489 | pMac->hal.pCBackFnTxComp = (tpCBackFnTxComp)limTdlsTeardownTxComplete; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1490 | if(TX_SUCCESS != tx_timer_activate(&pMac->hal.txCompTimer)) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1491 | { |
| 1492 | status = eHAL_STATUS_FAILURE; |
| 1493 | return status; |
| 1494 | |
| 1495 | } |
| 1496 | } |
| 1497 | else |
| 1498 | { |
| 1499 | VOS_ASSERT(0) ; |
| 1500 | return status ; |
| 1501 | } |
| 1502 | #endif |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1503 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1504 | if( addIeLen != 0 ) |
| 1505 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1506 | limLog(pMac, LOG1, FL("Copy Additional Ie Len = %d"), addIeLen); |
| 1507 | vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1508 | } |
| 1509 | |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1510 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1511 | if (padLen != 0) |
| 1512 | { |
| 1513 | /* QCOM VENDOR OUI = { 0x00, 0xA0, 0xC6, type = 0x0000 }; */ |
| 1514 | tANI_U8 *padVendorSpecific = pFrame + header_offset + nPayload + addIeLen; |
| 1515 | /* make QCOM_VENDOR_OUI, and type = 0x0000, and all the payload to be zero */ |
| 1516 | padVendorSpecific[0] = 221; |
| 1517 | padVendorSpecific[1] = padLen - 2; |
| 1518 | padVendorSpecific[2] = 0x00; |
| 1519 | padVendorSpecific[3] = 0xA0; |
| 1520 | padVendorSpecific[4] = 0xC6; |
| 1521 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1522 | limLog(pMac, LOG1, FL("Padding Vendor Specific Ie Len = %d"), padLen); |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1523 | |
| 1524 | /* padding zero if more than 5 bytes are required */ |
| 1525 | if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1526 | vos_mem_set( pFrame + header_offset + nPayload + addIeLen + MIN_VENDOR_SPECIFIC_IE_SIZE, |
| 1527 | padLen - MIN_VENDOR_SPECIFIC_IE_SIZE, 0); |
Hoonki Lee | 6c6822a | 2013-02-06 14:10:46 -0800 | [diff] [blame] | 1528 | } |
| 1529 | #endif |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1530 | limLog(pMac, LOG1, FL("[TDLS] action %d (%s) -%s-> OTA peer="MAC_ADDRESS_STR), |
| 1531 | SIR_MAC_TDLS_TEARDOWN, |
| 1532 | limTraceTdlsActionString(SIR_MAC_TDLS_TEARDOWN), |
| 1533 | ((reason == eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE) ? |
| 1534 | "AP": "DIRECT"), |
| 1535 | MAC_ADDR_ARRAY(peerMac)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1536 | |
| 1537 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1538 | HAL_TXRX_FRM_802_11_DATA, |
| 1539 | ANI_TXDIR_TODS, |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 1540 | TID_AC_VI, |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 1541 | limTxComplete, pFrame, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1542 | limMgmtTXComplete, |
Masti, Narayanraddi | a12cce8 | 2016-02-02 14:10:01 +0530 | [diff] [blame^] | 1543 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME | |
| 1544 | HAL_USE_PEER_STA_REQUESTED_MASK, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 1545 | pMac->lim.txBdToken++); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1546 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1547 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1548 | pMac->lim.mgmtFrameSessionId = 0xff; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1549 | limLog(pMac, LOGE, FL("could not send TDLS Teardown frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1550 | return eSIR_FAILURE; |
| 1551 | |
| 1552 | } |
Ganesh Kondabattini | ff98702 | 2015-08-11 19:43:44 +0530 | [diff] [blame] | 1553 | pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1554 | return eSIR_SUCCESS; |
| 1555 | |
| 1556 | } |
| 1557 | |
| 1558 | /* |
| 1559 | * Send Setup RSP frame on AP link. |
| 1560 | */ |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 1561 | static tSirRetStatus limSendTdlsSetupRspFrame(tpAniSirGlobal pMac, |
| 1562 | tSirMacAddr peerMac, tANI_U8 dialog, tpPESession psessionEntry, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1563 | etdlsLinkSetupStatus setupStatus, tANI_U8 *addIe, tANI_U16 addIeLen ) |
| 1564 | { |
| 1565 | tDot11fTDLSSetupRsp tdlsSetupRsp ; |
| 1566 | tANI_U32 status = 0 ; |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 1567 | tANI_U16 caps = 0 ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1568 | tANI_U32 nPayload = 0 ; |
| 1569 | tANI_U32 header_offset = 0 ; |
| 1570 | tANI_U32 nBytes = 0 ; |
| 1571 | tANI_U8 *pFrame; |
| 1572 | void *pPacket; |
| 1573 | eHalStatus halstatus; |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1574 | uint32 selfDot11Mode; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 1575 | tpSirMacCapabilityInfo pCapInfo; |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1576 | // Placeholder to support different channel bonding mode of TDLS than AP. |
| 1577 | // Today, WNI_CFG_CHANNEL_BONDING_MODE will be overwritten when connecting to AP |
| 1578 | // To support this feature, we need to introduce WNI_CFG_TDLS_CHANNEL_BONDING_MODE |
| 1579 | // As of now, we hardcoded to max channel bonding of dot11Mode (i.e HT80 for 11ac/HT40 for 11n) |
| 1580 | // uint32 tdlsChannelBondingMode; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1581 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 1582 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1583 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1584 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1585 | * serialization). We start by zero-initializing the structure: |
| 1586 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1587 | vos_mem_set( ( tANI_U8* )&tdlsSetupRsp, sizeof( tDot11fTDLSSetupRsp ),0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1588 | |
| 1589 | /* |
| 1590 | * setup Fixed fields, |
| 1591 | */ |
| 1592 | tdlsSetupRsp.Category.category = SIR_MAC_ACTION_TDLS; |
| 1593 | tdlsSetupRsp.Action.action = SIR_MAC_TDLS_SETUP_RSP ; |
| 1594 | tdlsSetupRsp.DialogToken.token = dialog; |
| 1595 | |
| 1596 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsSetupRsp.LinkIdentifier, |
| 1597 | peerMac, TDLS_RESPONDER) ; |
| 1598 | |
| 1599 | if (cfgGetCapabilityInfo(pMac, &caps, psessionEntry) != eSIR_SUCCESS) |
| 1600 | { |
| 1601 | /* |
| 1602 | * Could not get Capabilities value |
| 1603 | * from CFG. Log error. |
| 1604 | */ |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1605 | limLog(pMac, LOGE, FL("could not retrieve Capabilities value")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1606 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 1607 | |
| 1608 | pCapInfo = (tpSirMacCapabilityInfo) ∩︀ |
| 1609 | /* Export QoS capability */ |
| 1610 | pCapInfo->qos = 1; |
| 1611 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1612 | swapBitField16(caps, ( tANI_U16* )&tdlsSetupRsp.Capabilities ); |
| 1613 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 1614 | /* populate supported rate and ext supported rate IE */ |
| 1615 | PopulateDot11fRatesTdls(pMac, &tdlsSetupRsp.SuppRates, |
Masti, Narayanraddi | cc203f6 | 2015-12-24 14:41:29 +0530 | [diff] [blame] | 1616 | &tdlsSetupRsp.ExtSuppRates, |
| 1617 | psessionEntry->currentOperChannel); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1618 | |
Masti, Narayanraddi | 4b359dd | 2015-02-03 15:49:29 +0530 | [diff] [blame] | 1619 | /* Populate extended capability IE */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1620 | PopulateDot11fTdlsExtCapability( pMac, &tdlsSetupRsp.ExtCap ); |
| 1621 | |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1622 | if ( 1 == pMac->lim.gLimTDLSWmmMode ) |
| 1623 | { |
Pradeep Reddy POTTETI | f0f5fca | 2015-02-28 13:22:35 +0530 | [diff] [blame] | 1624 | tANI_U32 val = 0; |
| 1625 | |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1626 | /* include WMM IE */ |
Pradeep Reddy POTTETI | f0f5fca | 2015-02-28 13:22:35 +0530 | [diff] [blame] | 1627 | tdlsSetupRsp.WMMInfoStation.version = SIR_MAC_OUI_VERSION_1; |
| 1628 | tdlsSetupRsp.WMMInfoStation.acvo_uapsd = |
| 1629 | (pMac->lim.gLimTDLSUapsdMask & 0x01); |
| 1630 | tdlsSetupRsp.WMMInfoStation.acvi_uapsd = |
| 1631 | ((pMac->lim.gLimTDLSUapsdMask & 0x02) >> 1); |
| 1632 | tdlsSetupRsp.WMMInfoStation.acbk_uapsd = |
| 1633 | ((pMac->lim.gLimTDLSUapsdMask & 0x04) >> 2); |
| 1634 | tdlsSetupRsp.WMMInfoStation.acbe_uapsd = |
| 1635 | ((pMac->lim.gLimTDLSUapsdMask & 0x08) >> 3); |
| 1636 | |
| 1637 | if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS) |
Sushant Kaushik | 8778797 | 2015-09-11 16:05:00 +0530 | [diff] [blame] | 1638 | limLog(pMac, LOGE, FL("could not retrieve Max SP Length")); |
Pradeep Reddy POTTETI | f0f5fca | 2015-02-28 13:22:35 +0530 | [diff] [blame] | 1639 | |
| 1640 | tdlsSetupRsp.WMMInfoStation.max_sp_length = (tANI_U8)val; |
| 1641 | tdlsSetupRsp.WMMInfoStation.present = 1; |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1642 | } |
| 1643 | else |
| 1644 | { |
| 1645 | /* |
| 1646 | * TODO: we need to see if we have to support conditions where we have |
| 1647 | * EDCA parameter info element is needed a) if we need different QOS |
| 1648 | * parameters for off channel operations or QOS is not supported on |
| 1649 | * AP link and we wanted to QOS on direct link. |
| 1650 | */ |
| 1651 | /* Populate QOS info, needed for Peer U-APSD session */ |
| 1652 | /* TODO: Now hardcoded, because PopulateDot11fQOSCapsStation() depends on AP's capability, and |
| 1653 | TDLS doesn't want to depend on AP's capability */ |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1654 | limLog(pMac, LOG1, FL("populate QOS IE in Setup Response frame")); |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1655 | tdlsSetupRsp.QOSCapsStation.present = 1; |
| 1656 | tdlsSetupRsp.QOSCapsStation.max_sp_length = 0; |
| 1657 | tdlsSetupRsp.QOSCapsStation.qack = 0; |
| 1658 | tdlsSetupRsp.QOSCapsStation.acbe_uapsd = ((pMac->lim.gLimTDLSUapsdMask & 0x08) >> 3); |
| 1659 | tdlsSetupRsp.QOSCapsStation.acbk_uapsd = ((pMac->lim.gLimTDLSUapsdMask & 0x04) >> 2); |
| 1660 | tdlsSetupRsp.QOSCapsStation.acvi_uapsd = ((pMac->lim.gLimTDLSUapsdMask & 0x02) >> 1); |
| 1661 | tdlsSetupRsp.QOSCapsStation.acvo_uapsd = (pMac->lim.gLimTDLSUapsdMask & 0x01); |
| 1662 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1663 | |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1664 | wlan_cfgGetInt(pMac,WNI_CFG_DOT11_MODE,&selfDot11Mode); |
| 1665 | |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 1666 | /* Populate HT/VHT Capabilities */ |
| 1667 | PopulateDot11fTdlsHtVhtCap( pMac, selfDot11Mode, &tdlsSetupRsp.HTCaps, |
| 1668 | &tdlsSetupRsp.VHTCaps, psessionEntry ); |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1669 | |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 1670 | /* Populate AID */ |
| 1671 | PopulateDotfTdlsVhtAID( pMac, selfDot11Mode, peerMac, |
| 1672 | &tdlsSetupRsp.AID, psessionEntry ); |
Hoonki Lee | 4ef946b | 2013-04-25 18:40:20 -0700 | [diff] [blame] | 1673 | |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 1674 | if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled ) |
| 1675 | PopulateDot11fTdlsOffchannelParams( pMac, psessionEntry, |
| 1676 | &tdlsSetupRsp.SuppChannels, |
| 1677 | &tdlsSetupRsp.SuppOperatingClasses); |
| 1678 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1679 | tdlsSetupRsp.Status.status = setupStatus ; |
| 1680 | |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 1681 | if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE) |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 1682 | { |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 1683 | if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled && |
| 1684 | ( pMac->roam.configParam.bandCapability != eCSR_BAND_24)) |
| 1685 | { |
| 1686 | tdlsSetupRsp.HT2040BSSCoexistence.present = 1; |
| 1687 | tdlsSetupRsp.HT2040BSSCoexistence.infoRequest = 1; |
| 1688 | } |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 1689 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1690 | /* |
| 1691 | * now we pack it. First, how much space are we going to need? |
| 1692 | */ |
| 1693 | status = dot11fGetPackedTDLSSetupRspSize( pMac, &tdlsSetupRsp, |
| 1694 | &nPayload); |
| 1695 | if ( DOT11F_FAILED( status ) ) |
| 1696 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1697 | limLog(pMac, LOGE, |
| 1698 | FL("Failed to calculate the packed size for a Setup Response (0x%08x)."), |
| 1699 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1700 | /* We'll fall back on the worst case scenario: */ |
| 1701 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1702 | } |
| 1703 | else if ( DOT11F_WARNED( status ) ) |
| 1704 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1705 | limLog(pMac, LOGW, |
| 1706 | FL("There were warnings while calculating the packed size for Setup Response (0x%08x)."), |
| 1707 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1708 | } |
| 1709 | |
| 1710 | /* |
| 1711 | * This frame is going out from PE as data frames with special ethertype |
| 1712 | * 89-0d. |
| 1713 | * 8 bytes of RFC 1042 header |
| 1714 | */ |
| 1715 | |
| 1716 | |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 1717 | nBytes = nPayload + ((IS_QOS_ENABLED(psessionEntry)) |
| 1718 | ? sizeof(tSirMacDataHdr3a) : sizeof(tSirMacMgmtHdr)) |
| 1719 | + sizeof( eth_890d_header ) |
| 1720 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1721 | + addIeLen; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1722 | |
| 1723 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1724 | |
| 1725 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1726 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1727 | ( void** ) &pPacket ); |
| 1728 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1729 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1730 | limLog(pMac, LOGE, |
| 1731 | FL("Failed to allocate %d bytes for a TDLS Setup Response."), |
| 1732 | nBytes); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1733 | return eSIR_MEM_ALLOC_FAILED; |
| 1734 | } |
| 1735 | |
| 1736 | /* zero out the memory */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1737 | vos_mem_set( pFrame, nBytes, 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1738 | |
| 1739 | /* |
| 1740 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1741 | * request frame |
| 1742 | */ |
| 1743 | |
| 1744 | /* fill out the buffer descriptor */ |
| 1745 | |
| 1746 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 1747 | LINK_IDEN_ADDR_OFFSET(tdlsSetupRsp), |
| 1748 | TDLS_LINK_AP, TDLS_RESPONDER, |
Pradeep Reddy POTTETI | 6f2c9bb | 2015-07-16 14:57:36 +0530 | [diff] [blame] | 1749 | TID_AC_VI, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1750 | |
| 1751 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 1752 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_WRONG_BSSID_IN_SETUP_RSP) |
| 1753 | { |
| 1754 | tdlsSetupRsp.LinkIdentifier.bssid[4] = 0xde; |
| 1755 | tdlsSetupRsp.LinkIdentifier.bssid[5] = 0xad; |
| 1756 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 1757 | ("TDLS negative running: wrong BSSID " MAC_ADDRESS_STR " in TDLS Setup Rsp"), |
| 1758 | MAC_ADDR_ARRAY(tdlsSetupRsp.LinkIdentifier.bssid)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1759 | } |
| 1760 | #endif |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1761 | limLog(pMac, LOG1, |
| 1762 | FL("SupportedChnlWidth %x rxMCSMap %x rxMCSMap %x txSupDataRate %x"), |
| 1763 | tdlsSetupRsp.VHTCaps.supportedChannelWidthSet, |
| 1764 | tdlsSetupRsp.VHTCaps.rxMCSMap, |
| 1765 | tdlsSetupRsp.VHTCaps.txMCSMap, |
| 1766 | tdlsSetupRsp.VHTCaps.txSupDataRate); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1767 | status = dot11fPackTDLSSetupRsp( pMac, &tdlsSetupRsp, pFrame |
| 1768 | + header_offset, nPayload, &nPayload ); |
| 1769 | |
| 1770 | if ( DOT11F_FAILED( status ) ) |
| 1771 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1772 | limLog(pMac, LOGE, FL("Failed to pack a TDLS Setup Response (0x%08x)."), |
| 1773 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1774 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1775 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1776 | return eSIR_FAILURE; |
| 1777 | } |
| 1778 | else if ( DOT11F_WARNED( status ) ) |
| 1779 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1780 | limLog(pMac, LOGW, |
| 1781 | FL("There were warnings while packing TDLS Setup Response (0x%08x)."), |
| 1782 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1783 | } |
| 1784 | |
| 1785 | //Copy the additional IE. |
| 1786 | //TODO : addIe is added at the end of the frame. This means it doesnt |
| 1787 | //follow the order. This should be ok, but we should consider changing this |
| 1788 | //if there is any IOT issue. |
| 1789 | if( addIeLen != 0 ) |
| 1790 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1791 | vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1792 | } |
| 1793 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1794 | limLog(pMac, LOG1, |
| 1795 | FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR), |
| 1796 | SIR_MAC_TDLS_SETUP_RSP, |
| 1797 | limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_RSP), |
| 1798 | MAC_ADDR_ARRAY(peerMac)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1799 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1800 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1801 | HAL_TXRX_FRM_802_11_DATA, |
| 1802 | ANI_TXDIR_TODS, |
| 1803 | //ANI_TXDIR_IBSS, |
Pradeep Reddy POTTETI | 0171006 | 2015-06-29 13:35:53 +0530 | [diff] [blame] | 1804 | TID_AC_VI, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1805 | limTxComplete, pFrame, |
| 1806 | limMgmtTXComplete, |
Masti, Narayanraddi | a12cce8 | 2016-02-02 14:10:01 +0530 | [diff] [blame^] | 1807 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME | |
| 1808 | HAL_USE_PEER_STA_REQUESTED_MASK, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 1809 | pMac->lim.txBdToken++); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1810 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1811 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1812 | pMac->lim.mgmtFrameSessionId = 0xff; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1813 | limLog(pMac, LOGE, FL("could not send TDLS Setup Response")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1814 | return eSIR_FAILURE; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1815 | } |
Ganesh Kondabattini | ff98702 | 2015-08-11 19:43:44 +0530 | [diff] [blame] | 1816 | pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1817 | |
| 1818 | return eSIR_SUCCESS; |
| 1819 | |
| 1820 | } |
| 1821 | |
| 1822 | /* |
| 1823 | * Send TDLS setup CNF frame on AP link |
| 1824 | */ |
| 1825 | |
| 1826 | tSirRetStatus limSendTdlsLinkSetupCnfFrame(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 1827 | tANI_U8 dialog, tANI_U32 peerCapability, tpPESession psessionEntry, tANI_U8* addIe, tANI_U16 addIeLen) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1828 | { |
| 1829 | tDot11fTDLSSetupCnf tdlsSetupCnf ; |
| 1830 | tANI_U32 status = 0 ; |
| 1831 | tANI_U32 nPayload = 0 ; |
| 1832 | tANI_U32 nBytes = 0 ; |
| 1833 | tANI_U32 header_offset = 0 ; |
| 1834 | tANI_U8 *pFrame; |
| 1835 | void *pPacket; |
| 1836 | eHalStatus halstatus; |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 1837 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1838 | tANI_U32 padLen = 0; |
| 1839 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1840 | |
| 1841 | /* |
| 1842 | * The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 1843 | * and then hand it off to 'dot11fPackProbeRequest' (for |
| 1844 | * serialization). We start by zero-initializing the structure: |
| 1845 | */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1846 | vos_mem_set( ( tANI_U8* )&tdlsSetupCnf, sizeof( tDot11fTDLSSetupCnf ), 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1847 | |
| 1848 | /* |
| 1849 | * setup Fixed fields, |
| 1850 | */ |
| 1851 | tdlsSetupCnf.Category.category = SIR_MAC_ACTION_TDLS; |
| 1852 | tdlsSetupCnf.Action.action = SIR_MAC_TDLS_SETUP_CNF ; |
| 1853 | tdlsSetupCnf.DialogToken.token = dialog ; |
| 1854 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1855 | PopulateDot11fLinkIden( pMac, psessionEntry, &tdlsSetupCnf.LinkIdentifier, |
| 1856 | peerMac, TDLS_INITIATOR) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1857 | |
| 1858 | /* |
| 1859 | * TODO: we need to see if we have to support conditions where we have |
| 1860 | * EDCA parameter info element is needed a) if we need different QOS |
| 1861 | * parameters for off channel operations or QOS is not supported on |
| 1862 | * AP link and we wanted to QOS on direct link. |
| 1863 | */ |
| 1864 | |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1865 | /* Check self and peer WMM capable */ |
| 1866 | if ((1 == pMac->lim.gLimTDLSWmmMode) && (CHECK_BIT(peerCapability, TDLS_PEER_WMM_CAP))) |
| 1867 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1868 | limLog(pMac, LOG1, FL("populate WMM praram in Setup Confirm")); |
Pradeep Reddy POTTETI | a9c80d5 | 2014-05-09 18:05:29 +0530 | [diff] [blame] | 1869 | PopulateDot11fWMMParams(pMac, &tdlsSetupCnf.WMMParams, psessionEntry); |
| 1870 | } |
| 1871 | |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 1872 | /* Check peer is VHT capable*/ |
| 1873 | if (CHECK_BIT(peerCapability, TDLS_PEER_VHT_CAP)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1874 | { |
Abhishek Singh | 33f76ea | 2015-06-04 12:27:30 +0530 | [diff] [blame] | 1875 | PopulateDot11fVHTOperation( pMac, &tdlsSetupCnf.VHTOperation, |
| 1876 | psessionEntry->currentOperChannel); |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 1877 | PopulateDot11fHTInfo( pMac, &tdlsSetupCnf.HTInfo, psessionEntry ); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1878 | } |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 1879 | else if (CHECK_BIT(peerCapability, TDLS_PEER_HT_CAP)) /* Check peer is HT capable */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1880 | { |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 1881 | PopulateDot11fHTInfo( pMac, &tdlsSetupCnf.HTInfo, psessionEntry ); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 1882 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1883 | |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 1884 | if (TRUE == pMac->lim.EnableTdls2040BSSCoexIE) |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 1885 | { |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 1886 | if ( 1 == pMac->lim.gLimTDLSOffChannelEnabled && |
| 1887 | ( pMac->roam.configParam.bandCapability != eCSR_BAND_24)) |
| 1888 | { |
| 1889 | tdlsSetupCnf.HT2040BSSCoexistence.present = 1; |
| 1890 | tdlsSetupCnf.HT2040BSSCoexistence.infoRequest = 1; |
| 1891 | } |
Agarwal Ashish | b4891ef | 2014-11-10 20:08:36 +0530 | [diff] [blame] | 1892 | } |
| 1893 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1894 | /* |
| 1895 | * now we pack it. First, how much space are we going to need? |
| 1896 | */ |
| 1897 | status = dot11fGetPackedTDLSSetupCnfSize( pMac, &tdlsSetupCnf, |
| 1898 | &nPayload); |
| 1899 | if ( DOT11F_FAILED( status ) ) |
| 1900 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1901 | limLog(pMac, LOGE, |
| 1902 | FL("Failed to calculate the packed size for Setup Confirm (0x%08x)."), |
| 1903 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1904 | /* We'll fall back on the worst case scenario: */ |
| 1905 | nPayload = sizeof( tDot11fProbeRequest ); |
| 1906 | } |
| 1907 | else if ( DOT11F_WARNED( status ) ) |
| 1908 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1909 | limLog(pMac, LOGW, |
| 1910 | FL("There were warnings while calculating the packed size for Setup Confirm (0x%08x)."), |
| 1911 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1912 | } |
| 1913 | |
| 1914 | /* |
| 1915 | * This frame is going out from PE as data frames with special ethertype |
| 1916 | * 89-0d. |
| 1917 | * 8 bytes of RFC 1042 header |
| 1918 | */ |
| 1919 | |
| 1920 | |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 1921 | nBytes = nPayload + ((IS_QOS_ENABLED(psessionEntry)) |
| 1922 | ? sizeof(tSirMacDataHdr3a) : sizeof(tSirMacMgmtHdr)) |
| 1923 | + sizeof( eth_890d_header ) |
| 1924 | + PAYLOAD_TYPE_TDLS_SIZE |
| 1925 | + addIeLen; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1926 | |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 1927 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 1928 | /* IOT issue with some AP : some AP doesn't like the data packet size < minimum 802.3 frame length (64) |
| 1929 | Hence AP itself padding some bytes, which caused teardown packet is dropped at |
| 1930 | receiver side. To avoid such IOT issue, we added some extra bytes to meet data frame size >= 64 |
| 1931 | */ |
| 1932 | if (nPayload + PAYLOAD_TYPE_TDLS_SIZE < MIN_IEEE_8023_SIZE) |
| 1933 | { |
| 1934 | padLen = MIN_IEEE_8023_SIZE - (nPayload + PAYLOAD_TYPE_TDLS_SIZE ) ; |
| 1935 | |
| 1936 | /* if padLen is less than minimum vendorSpecific (5), pad up to 5 */ |
| 1937 | if (padLen < MIN_VENDOR_SPECIFIC_IE_SIZE) |
| 1938 | padLen = MIN_VENDOR_SPECIFIC_IE_SIZE; |
| 1939 | |
| 1940 | nBytes += padLen; |
| 1941 | } |
| 1942 | #endif |
| 1943 | |
| 1944 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1945 | /* Ok-- try to allocate memory from MGMT PKT pool */ |
| 1946 | |
| 1947 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1948 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1949 | ( void** ) &pPacket ); |
| 1950 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1951 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1952 | limLog(pMac, LOGE, |
| 1953 | FL("Failed to allocate %d bytes for a TDLS Setup Confirm."), |
| 1954 | nBytes); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1955 | return eSIR_MEM_ALLOC_FAILED; |
| 1956 | } |
| 1957 | |
| 1958 | /* zero out the memory */ |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 1959 | vos_mem_set( pFrame, nBytes, 0 ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1960 | |
| 1961 | /* |
| 1962 | * IE formation, memory allocation is completed, Now form TDLS discovery |
| 1963 | * request frame |
| 1964 | */ |
| 1965 | |
| 1966 | /* fill out the buffer descriptor */ |
| 1967 | |
| 1968 | header_offset = limPrepareTdlsFrameHeader(pMac, pFrame, |
| 1969 | LINK_IDEN_ADDR_OFFSET(tdlsSetupCnf), TDLS_LINK_AP, TDLS_INITIATOR, |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 1970 | TID_AC_VI, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1971 | |
| 1972 | #ifdef FEATURE_WLAN_TDLS_NEGATIVE |
| 1973 | if(pMac->lim.gLimTdlsNegativeBehavior & LIM_TDLS_NEGATIVE_STATUS_37_IN_SETUP_CNF) { |
| 1974 | tdlsSetupCnf.StatusCode.statusCode = 37; |
| 1975 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1976 | ("TDLS negative running: StatusCode = 37 in TDLS Setup Cnf")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1977 | } |
| 1978 | #endif |
| 1979 | status = dot11fPackTDLSSetupCnf( pMac, &tdlsSetupCnf, pFrame |
| 1980 | + header_offset, nPayload, &nPayload ); |
| 1981 | |
| 1982 | if ( DOT11F_FAILED( status ) ) |
| 1983 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1984 | limLog(pMac, LOGE, |
| 1985 | FL("Failed to pack a TDLS Setup Confirm (0x%08x)."), |
| 1986 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1987 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1988 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1989 | return eSIR_FAILURE; |
| 1990 | } |
| 1991 | else if ( DOT11F_WARNED( status ) ) |
| 1992 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 1993 | limLog(pMac, LOGW, |
| 1994 | FL("There were warnings while packing TDLS Setup Confirm (0x%08x)."), |
| 1995 | status); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 1996 | } |
| 1997 | #if 0 |
| 1998 | if(pMac->hal.pCBackFnTxComp == NULL) |
| 1999 | { |
| 2000 | pMac->hal.pCBackFnTxComp = (tpCBackFnTxComp)limTdlsSetupCnfTxComplete; |
| 2001 | if(TX_SUCCESS != tx_timer_activate(&pMac->hal.txCompTimer)) |
| 2002 | { |
| 2003 | status = eHAL_STATUS_FAILURE; |
| 2004 | return status; |
| 2005 | |
| 2006 | } |
| 2007 | } |
| 2008 | else |
| 2009 | { |
| 2010 | VOS_ASSERT(0) ; |
| 2011 | return status ; |
| 2012 | } |
| 2013 | #endif |
| 2014 | //Copy the additional IE. |
| 2015 | //TODO : addIe is added at the end of the frame. This means it doesnt |
| 2016 | //follow the order. This should be ok, but we should consider changing this |
| 2017 | //if there is any IOT issue. |
| 2018 | if( addIeLen != 0 ) |
| 2019 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2020 | vos_mem_copy( pFrame + header_offset + nPayload, addIe, addIeLen ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2021 | } |
| 2022 | |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 2023 | #ifndef NO_PAD_TDLS_MIN_8023_SIZE |
| 2024 | if (padLen != 0) |
| 2025 | { |
| 2026 | /* QCOM VENDOR OUI = { 0x00, 0xA0, 0xC6, type = 0x0000 }; */ |
| 2027 | tANI_U8 *padVendorSpecific = pFrame + header_offset + nPayload + addIeLen; |
| 2028 | /* make QCOM_VENDOR_OUI, and type = 0x0000, and all the payload to be zero */ |
| 2029 | padVendorSpecific[0] = 221; |
| 2030 | padVendorSpecific[1] = padLen - 2; |
| 2031 | padVendorSpecific[2] = 0x00; |
| 2032 | padVendorSpecific[3] = 0xA0; |
| 2033 | padVendorSpecific[4] = 0xC6; |
| 2034 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2035 | limLog(pMac, LOG1, FL("Padding Vendor Specific Ie Len = %d"), padLen); |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 2036 | |
| 2037 | /* padding zero if more than 5 bytes are required */ |
| 2038 | if (padLen > MIN_VENDOR_SPECIFIC_IE_SIZE) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2039 | vos_mem_set( pFrame + header_offset + nPayload + addIeLen + MIN_VENDOR_SPECIFIC_IE_SIZE, |
| 2040 | padLen - MIN_VENDOR_SPECIFIC_IE_SIZE, 0); |
Hoonki Lee | 426f030 | 2013-02-08 17:35:38 -0800 | [diff] [blame] | 2041 | } |
| 2042 | #endif |
| 2043 | |
| 2044 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2045 | limLog(pMac, LOG1, |
| 2046 | FL("[TDLS] action %d (%s) -AP-> OTA peer="MAC_ADDRESS_STR), |
| 2047 | SIR_MAC_TDLS_SETUP_CNF, |
| 2048 | limTraceTdlsActionString(SIR_MAC_TDLS_SETUP_CNF), |
| 2049 | MAC_ADDR_ARRAY(peerMac)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2050 | |
| 2051 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 2052 | HAL_TXRX_FRM_802_11_DATA, |
| 2053 | ANI_TXDIR_TODS, |
Gopichand Nakkala | 0f3eb5c | 2013-05-07 16:48:38 +0530 | [diff] [blame] | 2054 | TID_AC_VI, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2055 | limTxComplete, pFrame, |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2056 | limMgmtTXComplete, |
Masti, Narayanraddi | a12cce8 | 2016-02-02 14:10:01 +0530 | [diff] [blame^] | 2057 | HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME | |
| 2058 | HAL_USE_PEER_STA_REQUESTED_MASK, |
Ganesh Kondabattini | 10e6735 | 2015-03-16 17:41:57 +0530 | [diff] [blame] | 2059 | pMac->lim.txBdToken++); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2060 | |
| 2061 | |
| 2062 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2063 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 2064 | pMac->lim.mgmtFrameSessionId = 0xff; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2065 | limLog(pMac, LOGE, FL("could not send TDLS Setup Confirm frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2066 | return eSIR_FAILURE; |
| 2067 | |
| 2068 | } |
Ganesh Kondabattini | ff98702 | 2015-08-11 19:43:44 +0530 | [diff] [blame] | 2069 | pMac->lim.mgmtFrameSessionId = psessionEntry->smeSessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2070 | |
| 2071 | return eSIR_SUCCESS; |
| 2072 | } |
| 2073 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2074 | /* This Function is similar to PopulateDot11fHTCaps, except that the HT Capabilities |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2075 | * are considered from the AddStaReq rather from the cfg.dat as in PopulateDot11fHTCaps |
| 2076 | */ |
| 2077 | static tSirRetStatus limTdlsPopulateDot11fHTCaps(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 2078 | tSirTdlsAddStaReq *pTdlsAddStaReq, tDot11fIEHTCaps *pDot11f) |
| 2079 | { |
| 2080 | tANI_U32 nCfgValue; |
| 2081 | tANI_U8 nCfgValue8; |
| 2082 | tSirMacHTParametersInfo *pHTParametersInfo; |
| 2083 | union { |
| 2084 | tANI_U16 nCfgValue16; |
| 2085 | tSirMacHTCapabilityInfo htCapInfo; |
| 2086 | tSirMacExtendedHTCapabilityInfo extHtCapInfo; |
| 2087 | } uHTCapabilityInfo; |
| 2088 | |
| 2089 | tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo; |
| 2090 | tSirMacASCapabilityInfo *pASCapabilityInfo; |
| 2091 | |
| 2092 | nCfgValue = pTdlsAddStaReq->htCap.capInfo; |
| 2093 | |
| 2094 | uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF; |
| 2095 | |
| 2096 | pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap; |
| 2097 | pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave; |
| 2098 | pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField; |
| 2099 | pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz; |
| 2100 | pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz; |
| 2101 | pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC; |
| 2102 | pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC; |
| 2103 | pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA; |
| 2104 | pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize; |
| 2105 | pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz; |
| 2106 | pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp; |
| 2107 | pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame; |
| 2108 | pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection; |
| 2109 | |
| 2110 | // All sessionized entries will need the check below |
| 2111 | if (psessionEntry == NULL) // Only in case of NO session |
| 2112 | { |
| 2113 | pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet; |
| 2114 | } |
| 2115 | else |
| 2116 | { |
| 2117 | pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet; |
| 2118 | } |
| 2119 | |
| 2120 | /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is |
| 2121 | eHT_CHANNEL_WIDTH_20MHZ */ |
| 2122 | if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) |
| 2123 | { |
| 2124 | pDot11f->shortGI40MHz = 0; |
| 2125 | } |
| 2126 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2127 | limLog(pMac, LOG1, |
| 2128 | FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d"), |
| 2129 | pDot11f->supportedChannelWidthSet, |
| 2130 | pDot11f->mimoPowerSave, |
| 2131 | pDot11f->greenField, |
| 2132 | pDot11f->shortGI20MHz, |
| 2133 | pDot11f->shortGI40MHz, |
| 2134 | pDot11f->dsssCckMode40MHz); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2135 | |
| 2136 | nCfgValue = pTdlsAddStaReq->htCap.ampduParamsInfo; |
| 2137 | |
| 2138 | nCfgValue8 = ( tANI_U8 ) nCfgValue; |
| 2139 | pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8; |
| 2140 | |
| 2141 | pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor; |
| 2142 | pDot11f->mpduDensity = pHTParametersInfo->mpduDensity; |
| 2143 | pDot11f->reserved1 = pHTParametersInfo->reserved; |
| 2144 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2145 | limLog(pMac, LOG1, FL("AMPDU Param: %x"), nCfgValue); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2146 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2147 | vos_mem_copy( pDot11f->supportedMCSSet, pTdlsAddStaReq->htCap.suppMcsSet, |
| 2148 | SIZE_OF_SUPPORTED_MCS_SET); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2149 | |
| 2150 | nCfgValue = pTdlsAddStaReq->htCap.extendedHtCapInfo; |
| 2151 | |
| 2152 | uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF; |
| 2153 | |
| 2154 | pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco; |
| 2155 | pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime; |
| 2156 | pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback; |
| 2157 | |
| 2158 | nCfgValue = pTdlsAddStaReq->htCap.txBFCapInfo; |
| 2159 | |
| 2160 | pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue; |
| 2161 | pDot11f->txBF = pTxBFCapabilityInfo->txBF; |
| 2162 | pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding; |
| 2163 | pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding; |
| 2164 | pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF; |
| 2165 | pDot11f->txZLF = pTxBFCapabilityInfo->txZLF; |
| 2166 | pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF; |
| 2167 | pDot11f->calibration = pTxBFCapabilityInfo->calibration; |
| 2168 | pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF; |
| 2169 | pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix; |
| 2170 | pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback; |
| 2171 | pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback; |
| 2172 | pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback; |
| 2173 | pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae; |
| 2174 | pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae; |
| 2175 | pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae; |
| 2176 | |
| 2177 | nCfgValue = pTdlsAddStaReq->htCap.antennaSelectionInfo; |
| 2178 | |
| 2179 | nCfgValue8 = ( tANI_U8 ) nCfgValue; |
| 2180 | |
| 2181 | pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8; |
| 2182 | pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection; |
| 2183 | pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx; |
| 2184 | pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx; |
| 2185 | pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback; |
| 2186 | pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback; |
| 2187 | pDot11f->rxAS = pASCapabilityInfo->rxAS; |
| 2188 | pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs; |
| 2189 | |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 2190 | pDot11f->present = pTdlsAddStaReq->htcap_present; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2191 | |
| 2192 | return eSIR_SUCCESS; |
| 2193 | |
| 2194 | } |
| 2195 | |
| 2196 | tSirRetStatus |
| 2197 | limTdlsPopulateDot11fVHTCaps(tpAniSirGlobal pMac, |
| 2198 | tSirTdlsAddStaReq *pTdlsAddStaReq, |
| 2199 | tDot11fIEVHTCaps *pDot11f) |
| 2200 | { |
| 2201 | tANI_U32 nCfgValue=0; |
| 2202 | union { |
| 2203 | tANI_U32 nCfgValue32; |
| 2204 | tSirMacVHTCapabilityInfo vhtCapInfo; |
| 2205 | } uVHTCapabilityInfo; |
| 2206 | union { |
| 2207 | tANI_U16 nCfgValue16; |
| 2208 | tSirMacVHTTxSupDataRateInfo vhtTxSupDataRateInfo; |
| 2209 | tSirMacVHTRxSupDataRateInfo vhtRxsupDataRateInfo; |
| 2210 | } uVHTSupDataRateInfo; |
| 2211 | |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 2212 | pDot11f->present = pTdlsAddStaReq->vhtcap_present; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2213 | |
| 2214 | nCfgValue = pTdlsAddStaReq->vhtCap.vhtCapInfo; |
| 2215 | uVHTCapabilityInfo.nCfgValue32 = nCfgValue; |
| 2216 | |
| 2217 | pDot11f->maxMPDULen = uVHTCapabilityInfo.vhtCapInfo.maxMPDULen; |
| 2218 | pDot11f->supportedChannelWidthSet = uVHTCapabilityInfo.vhtCapInfo.supportedChannelWidthSet; |
| 2219 | pDot11f->ldpcCodingCap = uVHTCapabilityInfo.vhtCapInfo.ldpcCodingCap; |
| 2220 | pDot11f->shortGI80MHz = uVHTCapabilityInfo.vhtCapInfo.shortGI80MHz; |
| 2221 | pDot11f->shortGI160and80plus80MHz = uVHTCapabilityInfo.vhtCapInfo.shortGI160and80plus80MHz; |
| 2222 | pDot11f->txSTBC = uVHTCapabilityInfo.vhtCapInfo.txSTBC; |
| 2223 | pDot11f->rxSTBC = uVHTCapabilityInfo.vhtCapInfo.rxSTBC; |
| 2224 | pDot11f->suBeamFormerCap = uVHTCapabilityInfo.vhtCapInfo.suBeamFormerCap; |
| 2225 | pDot11f->suBeamformeeCap = uVHTCapabilityInfo.vhtCapInfo.suBeamformeeCap; |
| 2226 | pDot11f->csnofBeamformerAntSup = uVHTCapabilityInfo.vhtCapInfo.csnofBeamformerAntSup; |
| 2227 | pDot11f->numSoundingDim = uVHTCapabilityInfo.vhtCapInfo.numSoundingDim; |
| 2228 | pDot11f->muBeamformerCap = uVHTCapabilityInfo.vhtCapInfo.muBeamformerCap; |
| 2229 | pDot11f->muBeamformeeCap = uVHTCapabilityInfo.vhtCapInfo.muBeamformeeCap; |
| 2230 | pDot11f->vhtTXOPPS = uVHTCapabilityInfo.vhtCapInfo.vhtTXOPPS; |
| 2231 | pDot11f->htcVHTCap = uVHTCapabilityInfo.vhtCapInfo.htcVHTCap; |
| 2232 | pDot11f->maxAMPDULenExp = uVHTCapabilityInfo.vhtCapInfo.maxAMPDULenExp; |
| 2233 | pDot11f->vhtLinkAdaptCap = uVHTCapabilityInfo.vhtCapInfo.vhtLinkAdaptCap; |
| 2234 | pDot11f->rxAntPattern = uVHTCapabilityInfo.vhtCapInfo.rxAntPattern; |
| 2235 | pDot11f->txAntPattern = uVHTCapabilityInfo.vhtCapInfo.txAntPattern; |
| 2236 | pDot11f->reserved1= uVHTCapabilityInfo.vhtCapInfo.reserved1; |
| 2237 | |
| 2238 | pDot11f->rxMCSMap = pTdlsAddStaReq->vhtCap.suppMcs.rxMcsMap; |
| 2239 | |
| 2240 | nCfgValue = pTdlsAddStaReq->vhtCap.suppMcs.rxHighest; |
| 2241 | uVHTSupDataRateInfo.nCfgValue16 = nCfgValue & 0xffff; |
| 2242 | pDot11f->rxHighSupDataRate = uVHTSupDataRateInfo.vhtRxsupDataRateInfo.rxSupDataRate; |
| 2243 | |
| 2244 | pDot11f->txMCSMap = pTdlsAddStaReq->vhtCap.suppMcs.txMcsMap; |
| 2245 | |
| 2246 | nCfgValue = pTdlsAddStaReq->vhtCap.suppMcs.txHighest; |
| 2247 | uVHTSupDataRateInfo.nCfgValue16 = nCfgValue & 0xffff; |
| 2248 | pDot11f->txSupDataRate = uVHTSupDataRateInfo.vhtTxSupDataRateInfo.txSupDataRate; |
| 2249 | |
| 2250 | pDot11f->reserved3= uVHTSupDataRateInfo.vhtTxSupDataRateInfo.reserved; |
| 2251 | |
| 2252 | limLogVHTCap(pMac, pDot11f); |
| 2253 | |
| 2254 | return eSIR_SUCCESS; |
| 2255 | |
| 2256 | } |
| 2257 | |
| 2258 | static tSirRetStatus |
| 2259 | limTdlsPopulateMatchingRateSet(tpAniSirGlobal pMac, |
| 2260 | tpDphHashNode pStaDs, |
| 2261 | tANI_U8 *pSupportedRateSet, |
| 2262 | tANI_U8 supporteRatesLength, |
| 2263 | tANI_U8* pSupportedMCSSet, |
| 2264 | tSirMacPropRateSet *pAniLegRateSet, |
| 2265 | tpPESession psessionEntry, |
| 2266 | tDot11fIEVHTCaps *pVHTCaps) |
| 2267 | |
| 2268 | { |
| 2269 | tSirMacRateSet tempRateSet; |
| 2270 | tANI_U32 i,j,val,min,isArate; |
| 2271 | tSirMacRateSet tempRateSet2; |
| 2272 | tANI_U32 phyMode; |
| 2273 | tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET]; |
| 2274 | isArate=0; |
Leela Venkata Kiran Kumar Reddy Chirala | c7a1215 | 2014-02-03 11:20:14 -0800 | [diff] [blame] | 2275 | tempRateSet2.numRates = 0; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2276 | |
| 2277 | // limGetPhyMode(pMac, &phyMode); |
| 2278 | limGetPhyMode(pMac, &phyMode, NULL); |
| 2279 | |
| 2280 | // get own rate set |
| 2281 | val = WNI_CFG_OPERATIONAL_RATE_SET_LEN; |
| 2282 | if (wlan_cfgGetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2283 | (tANI_U8 *) &tempRateSet.rate, |
| 2284 | &val) != eSIR_SUCCESS) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2285 | { |
| 2286 | /// Could not get rateset from CFG. Log error. |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2287 | limLog(pMac, LOGE, FL("could not retrieve rateset")); |
Praveen Kumar Sirisilla | 8bdfac4 | 2013-10-10 17:20:48 -0700 | [diff] [blame] | 2288 | val = 0; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2289 | } |
| 2290 | tempRateSet.numRates = val; |
| 2291 | |
| 2292 | if (phyMode == WNI_CFG_PHY_MODE_11G) |
| 2293 | { |
| 2294 | |
| 2295 | // get own extended rate set |
| 2296 | val = WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN; |
| 2297 | if (wlan_cfgGetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2298 | (tANI_U8 *) &tempRateSet2.rate, |
| 2299 | &val) != eSIR_SUCCESS) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2300 | tempRateSet2.numRates = val; |
| 2301 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2302 | |
| 2303 | if ((tempRateSet.numRates + tempRateSet2.numRates) > 12) |
| 2304 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2305 | limLog(pMac, LOGE, FL("more than 12 rates in CFG")); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2306 | goto error; |
| 2307 | } |
| 2308 | |
| 2309 | /** |
| 2310 | * Handling of the rate set IEs is the following: |
| 2311 | * - keep only rates that we support and that the station supports |
| 2312 | * - sort and the rates into the pSta->rate array |
| 2313 | */ |
| 2314 | |
| 2315 | // Copy all rates in tempRateSet, there are 12 rates max |
| 2316 | for (i = 0; i < tempRateSet2.numRates; i++) |
| 2317 | tempRateSet.rate[i + tempRateSet.numRates] = tempRateSet2.rate[i]; |
| 2318 | |
| 2319 | tempRateSet.numRates += tempRateSet2.numRates; |
| 2320 | |
| 2321 | /** |
| 2322 | * Sort rates in tempRateSet (they are likely to be already sorted) |
| 2323 | * put the result in tempRateSet2 |
| 2324 | */ |
| 2325 | tempRateSet2.numRates = 0; |
| 2326 | |
| 2327 | for (i = 0;i < tempRateSet.numRates; i++) |
| 2328 | { |
| 2329 | min = 0; |
| 2330 | val = 0xff; |
| 2331 | |
| 2332 | for(j = 0;j < tempRateSet.numRates; j++) |
| 2333 | if ((tANI_U32) (tempRateSet.rate[j] & 0x7f) < val) |
| 2334 | { |
| 2335 | val = tempRateSet.rate[j] & 0x7f; |
| 2336 | min = j; |
| 2337 | } |
| 2338 | |
| 2339 | tempRateSet2.rate[tempRateSet2.numRates++] = tempRateSet.rate[min]; |
| 2340 | tempRateSet.rate[min] = 0xff; |
| 2341 | } |
| 2342 | |
| 2343 | /** |
| 2344 | * Copy received rates in tempRateSet, the parser has ensured |
| 2345 | * unicity of the rates so there cannot be more than 12 . Need to Check this |
| 2346 | * TODO Sunil. |
| 2347 | */ |
Kaushik, Sushant | 92e6f87 | 2014-05-03 16:35:57 +0530 | [diff] [blame] | 2348 | if (supporteRatesLength > SIR_MAC_RATESET_EID_MAX) |
| 2349 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2350 | limLog(pMac, LOGW, |
| 2351 | FL("Supported rates length %d more than the Max limit, reset to Max"), |
| 2352 | supporteRatesLength); |
Kaushik, Sushant | 92e6f87 | 2014-05-03 16:35:57 +0530 | [diff] [blame] | 2353 | supporteRatesLength = SIR_MAC_RATESET_EID_MAX; |
| 2354 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2355 | for (i = 0; i < supporteRatesLength; i++) |
| 2356 | { |
| 2357 | tempRateSet.rate[i] = pSupportedRateSet[i]; |
| 2358 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2359 | tempRateSet.numRates = supporteRatesLength; |
| 2360 | |
| 2361 | { |
| 2362 | tpSirSupportedRates rates = &pStaDs->supportedRates; |
| 2363 | tANI_U8 aRateIndex = 0; |
| 2364 | tANI_U8 bRateIndex = 0; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2365 | vos_mem_set( (tANI_U8 *) rates, sizeof(tSirSupportedRates), 0); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2366 | |
| 2367 | for (i = 0;i < tempRateSet2.numRates; i++) |
| 2368 | { |
| 2369 | for (j = 0;j < tempRateSet.numRates; j++) |
| 2370 | { |
| 2371 | if ((tempRateSet2.rate[i] & 0x7F) == |
Deepthi Gowri | 3016371 | 2015-06-01 15:44:24 +0530 | [diff] [blame] | 2372 | (tempRateSet.rate[j] & 0x7F)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2373 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2374 | if (sirIsArate(tempRateSet2.rate[i] & 0x7f)) |
| 2375 | { |
| 2376 | isArate=1; |
Deepthi Gowri | 3016371 | 2015-06-01 15:44:24 +0530 | [diff] [blame] | 2377 | if (aRateIndex < SIR_NUM_11A_RATES) |
| 2378 | rates->llaRates[aRateIndex++] = |
| 2379 | tempRateSet2.rate[i]; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2380 | } |
| 2381 | else |
Deepthi Gowri | 3016371 | 2015-06-01 15:44:24 +0530 | [diff] [blame] | 2382 | { |
| 2383 | if (bRateIndex < SIR_NUM_11B_RATES) |
| 2384 | rates->llbRates[bRateIndex++] = |
| 2385 | tempRateSet2.rate[i]; |
| 2386 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2387 | break; |
| 2388 | } |
| 2389 | } |
| 2390 | } |
| 2391 | } |
| 2392 | |
| 2393 | |
| 2394 | //compute the matching MCS rate set, if peer is 11n capable and self mode is 11n |
| 2395 | #ifdef FEATURE_WLAN_TDLS |
| 2396 | if (pStaDs->mlmStaContext.htCapability) |
| 2397 | #else |
| 2398 | if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && |
| 2399 | (pStaDs->mlmStaContext.htCapability)) |
| 2400 | #endif |
| 2401 | { |
| 2402 | val = SIZE_OF_SUPPORTED_MCS_SET; |
| 2403 | if (wlan_cfgGetStr(pMac, WNI_CFG_SUPPORTED_MCS_SET, |
| 2404 | mcsSet, |
| 2405 | &val) != eSIR_SUCCESS) |
| 2406 | { |
| 2407 | /// Could not get rateset from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2408 | limLog(pMac, LOGP, FL("could not retrieve supportedMCSSet")); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2409 | goto error; |
| 2410 | } |
| 2411 | |
| 2412 | for (i=0; i<val; i++) |
| 2413 | pStaDs->supportedRates.supportedMCSSet[i] = mcsSet[i] & pSupportedMCSSet[i]; |
| 2414 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2415 | limLog(pMac, LOG1, FL("MCS Rate Set Bitmap from CFG and DPH:")); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2416 | for (i=0; i<SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 2417 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2418 | limLog(pMac, LOG1, FL("%x %x"), |
| 2419 | mcsSet[i], |
| 2420 | pStaDs->supportedRates.supportedMCSSet[i]); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2421 | } |
| 2422 | } |
| 2423 | |
| 2424 | #ifdef WLAN_FEATURE_11AC |
| 2425 | limPopulateVhtMcsSet(pMac, &pStaDs->supportedRates, pVHTCaps, psessionEntry); |
| 2426 | #endif |
| 2427 | /** |
| 2428 | * Set the erpEnabled bit iff the phy is in G mode and at least |
| 2429 | * one A rate is supported |
| 2430 | */ |
| 2431 | if ((phyMode == WNI_CFG_PHY_MODE_11G) && isArate) |
| 2432 | pStaDs->erpEnabled = eHAL_SET; |
| 2433 | |
| 2434 | |
| 2435 | |
| 2436 | return eSIR_SUCCESS; |
| 2437 | |
| 2438 | error: |
| 2439 | |
| 2440 | return eSIR_FAILURE; |
| 2441 | } |
| 2442 | |
| 2443 | static int limTdlsSelectCBMode(tDphHashNode *pStaDs, tpPESession psessionEntry) |
| 2444 | { |
| 2445 | tANI_U8 channel = psessionEntry->currentOperChannel; |
| 2446 | |
| 2447 | if ( pStaDs->mlmStaContext.vhtCapability ) |
| 2448 | { |
| 2449 | if ( channel== 36 || channel == 52 || channel == 100 || |
| 2450 | channel == 116 || channel == 149 ) |
| 2451 | { |
| 2452 | return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1; |
| 2453 | } |
| 2454 | else if ( channel == 40 || channel == 56 || channel == 104 || |
| 2455 | channel == 120 || channel == 153 ) |
| 2456 | { |
| 2457 | return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1; |
| 2458 | } |
| 2459 | else if ( channel == 44 || channel == 60 || channel == 108 || |
| 2460 | channel == 124 || channel == 157 ) |
| 2461 | { |
| 2462 | return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1; |
| 2463 | } |
| 2464 | else if ( channel == 48 || channel == 64 || channel == 112 || |
| 2465 | channel == 128 || channel == 161 ) |
| 2466 | { |
| 2467 | return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1; |
| 2468 | } |
| 2469 | else if ( channel == 165 ) |
| 2470 | { |
| 2471 | return 0; |
| 2472 | } |
| 2473 | } |
| 2474 | else if ( pStaDs->mlmStaContext.htCapability ) |
| 2475 | { |
| 2476 | if ( channel== 40 || channel == 48 || channel == 56 || |
| 2477 | channel == 64 || channel == 104 || channel == 112 || |
| 2478 | channel == 120 || channel == 128 || channel == 136 || |
| 2479 | channel == 144 || channel == 153 || channel == 161 ) |
| 2480 | { |
| 2481 | return 1; |
| 2482 | } |
| 2483 | else if ( channel== 36 || channel == 44 || channel == 52 || |
| 2484 | channel == 60 || channel == 100 || channel == 108 || |
| 2485 | channel == 116 || channel == 124 || channel == 132 || |
| 2486 | channel == 140 || channel == 149 || channel == 157 ) |
| 2487 | { |
| 2488 | return 2; |
| 2489 | } |
| 2490 | else if ( channel == 165 ) |
| 2491 | { |
| 2492 | return 0; |
| 2493 | } |
| 2494 | } |
| 2495 | return 0; |
| 2496 | } |
| 2497 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2498 | /* |
| 2499 | * update HASH node entry info |
| 2500 | */ |
| 2501 | static void limTdlsUpdateHashNodeInfo(tpAniSirGlobal pMac, tDphHashNode *pStaDs, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2502 | tSirTdlsAddStaReq *pTdlsAddStaReq, tpPESession psessionEntry) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2503 | { |
| 2504 | //tDot11fIEHTCaps *htCaps = &setupPeerInfo->tdlsPeerHTCaps ; |
| 2505 | tDot11fIEHTCaps htCap, *htCaps; |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 2506 | tDot11fIEVHTCaps *pVhtCaps = NULL; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2507 | #ifdef WLAN_FEATURE_11AC |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 2508 | tDot11fIEVHTCaps vhtCap; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2509 | tANI_U8 cbMode; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2510 | #endif |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2511 | tpDphHashNode pSessStaDs = NULL; |
| 2512 | tANI_U16 aid; |
| 2513 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2514 | if (pTdlsAddStaReq->tdlsAddOper == TDLS_OPER_ADD) |
| 2515 | { |
| 2516 | PopulateDot11fHTCaps(pMac, psessionEntry, &htCap); |
| 2517 | } |
| 2518 | else if (pTdlsAddStaReq->tdlsAddOper == TDLS_OPER_UPDATE) |
| 2519 | { |
| 2520 | limTdlsPopulateDot11fHTCaps(pMac, NULL, pTdlsAddStaReq, &htCap); |
| 2521 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2522 | htCaps = &htCap; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2523 | if (htCaps->present) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2524 | { |
| 2525 | pStaDs->mlmStaContext.htCapability = 1 ; |
| 2526 | pStaDs->htGreenfield = htCaps->greenField ; |
Ganesh Kondabattini | daebdff | 2015-02-25 17:45:06 +0530 | [diff] [blame] | 2527 | /* pStaDs->htSupportedChannelWidthSet should have the base channel |
| 2528 | * capability. The htSupportedChannelWidthSet of the TDLS link on |
| 2529 | * base channel should be less than or equal to channel width of |
| 2530 | * STA-AP link. So take this setting from the psessionEntry. |
| 2531 | */ |
| 2532 | pStaDs->htSupportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2533 | pStaDs->htMIMOPSState = htCaps->mimoPowerSave ; |
| 2534 | pStaDs->htMaxAmsduLength = htCaps->maximalAMSDUsize; |
| 2535 | pStaDs->htAMpduDensity = htCaps->mpduDensity; |
| 2536 | pStaDs->htDsssCckRate40MHzSupport = htCaps->dsssCckMode40MHz ; |
| 2537 | pStaDs->htShortGI20Mhz = htCaps->shortGI20MHz; |
| 2538 | pStaDs->htShortGI40Mhz = htCaps->shortGI40MHz; |
| 2539 | pStaDs->htMaxRxAMpduFactor = htCaps->maxRxAMPDUFactor; |
| 2540 | limFillRxHighestSupportedRate(pMac, |
| 2541 | &pStaDs->supportedRates.rxHighestDataRate, |
| 2542 | htCaps->supportedMCSSet); |
| 2543 | pStaDs->baPolicyFlag = 0xFF; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2544 | pMac->lim.gLimTdlsLinkMode = TDLS_LINK_MODE_N ; |
| 2545 | } |
| 2546 | else |
| 2547 | { |
| 2548 | pStaDs->mlmStaContext.htCapability = 0 ; |
| 2549 | pMac->lim.gLimTdlsLinkMode = TDLS_LINK_MODE_BG ; |
| 2550 | } |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2551 | #ifdef WLAN_FEATURE_11AC |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2552 | limTdlsPopulateDot11fVHTCaps(pMac, pTdlsAddStaReq, &vhtCap); |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2553 | pVhtCaps = &vhtCap; |
| 2554 | if (pVhtCaps->present) |
| 2555 | { |
| 2556 | pStaDs->mlmStaContext.vhtCapability = 1 ; |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 2557 | |
Masti, Narayanraddi | 6b70f2c | 2015-12-24 14:55:44 +0530 | [diff] [blame] | 2558 | pStaDs->vhtSupportedChannelWidthSet = |
| 2559 | psessionEntry->vhtTxChannelWidthSet; |
| 2560 | |
| 2561 | limLog(pMac, LOG1, FL("Vht supported channel width is set to = %d"), |
| 2562 | pStaDs->vhtSupportedChannelWidthSet); |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 2563 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2564 | pStaDs->vhtLdpcCapable = pVhtCaps->ldpcCodingCap; |
| 2565 | pStaDs->vhtBeamFormerCapable= pVhtCaps->suBeamFormerCap; |
| 2566 | // TODO , is it necessary , Sunil??? |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2567 | pMac->lim.gLimTdlsLinkMode = TDLS_LINK_MODE_AC; |
| 2568 | } |
| 2569 | else |
| 2570 | { |
| 2571 | pStaDs->mlmStaContext.vhtCapability = 0 ; |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 2572 | pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ; |
Hoonki Lee | 99e5378 | 2013-02-12 18:07:03 -0800 | [diff] [blame] | 2573 | } |
| 2574 | #endif |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2575 | /*Calculate the Secondary Coannel Offset */ |
| 2576 | cbMode = limTdlsSelectCBMode(pStaDs, psessionEntry); |
| 2577 | |
| 2578 | pStaDs->htSecondaryChannelOffset = cbMode; |
| 2579 | |
| 2580 | #ifdef WLAN_FEATURE_11AC |
| 2581 | if ( pStaDs->mlmStaContext.vhtCapability ) |
| 2582 | { |
| 2583 | pStaDs->htSecondaryChannelOffset = limGetHTCBState(cbMode); |
| 2584 | } |
| 2585 | #endif |
Deepthi Gowri | 22f61da | 2015-05-25 17:14:45 +0530 | [diff] [blame] | 2586 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2587 | pSessStaDs = dphLookupHashEntry(pMac, psessionEntry->bssId, &aid, |
| 2588 | &psessionEntry->dph.dphHashTable) ; |
| 2589 | |
| 2590 | /* Lets enable QOS parameter */ |
Pradeep Reddy POTTETI | 7408431 | 2015-08-04 18:26:30 +0530 | [diff] [blame] | 2591 | pStaDs->qosMode = (pTdlsAddStaReq->capability & CAPABILITIES_QOS_OFFSET) || |
| 2592 | pTdlsAddStaReq->htcap_present; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2593 | pStaDs->wmeEnabled = 1; |
| 2594 | pStaDs->lleEnabled = 0; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2595 | /* TDLS Dummy AddSTA does not have qosInfo , is it OK ?? |
| 2596 | */ |
| 2597 | pStaDs->qos.capability.qosInfo = (*(tSirMacQosInfoStation *) &pTdlsAddStaReq->uapsd_queues); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2598 | |
| 2599 | /* populate matching rate set */ |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2600 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2601 | /* TDLS Dummy AddSTA does not have HTCap,VHTCap,Rates info , is it OK ?? |
| 2602 | */ |
| 2603 | limTdlsPopulateMatchingRateSet(pMac, pStaDs, pTdlsAddStaReq->supported_rates, |
| 2604 | pTdlsAddStaReq->supported_rates_length, |
| 2605 | (tANI_U8 *)pTdlsAddStaReq->htCap.suppMcsSet, |
| 2606 | &pStaDs->mlmStaContext.propRateSet, |
Kiet Lam | 770920c | 2013-10-21 12:49:30 +0530 | [diff] [blame] | 2607 | psessionEntry, pVhtCaps); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2608 | |
| 2609 | /* TDLS Dummy AddSTA does not have right capability , is it OK ?? |
| 2610 | */ |
| 2611 | pStaDs->mlmStaContext.capabilityInfo = ( *(tSirMacCapabilityInfo *) &pTdlsAddStaReq->capability); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2612 | |
| 2613 | return ; |
| 2614 | } |
| 2615 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2616 | /* |
Deepthi Gowri | 22f61da | 2015-05-25 17:14:45 +0530 | [diff] [blame] | 2617 | * Add STA for TDLS setup procedure |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2618 | */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2619 | static tSirRetStatus limTdlsSetupAddSta(tpAniSirGlobal pMac, |
| 2620 | tSirTdlsAddStaReq *pAddStaReq, |
| 2621 | tpPESession psessionEntry) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2622 | { |
| 2623 | tpDphHashNode pStaDs = NULL ; |
| 2624 | tSirRetStatus status = eSIR_SUCCESS ; |
| 2625 | tANI_U16 aid = 0 ; |
| 2626 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2627 | pStaDs = dphLookupHashEntry(pMac, pAddStaReq->peerMac, &aid, |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2628 | &psessionEntry->dph.dphHashTable); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2629 | if(NULL == pStaDs) |
| 2630 | { |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2631 | aid = limAssignPeerIdx(pMac, psessionEntry) ; |
| 2632 | |
| 2633 | if( !aid ) |
| 2634 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2635 | limLog(pMac, LOGE, FL("No more free AID for peer " MAC_ADDRESS_STR), |
| 2636 | MAC_ADDR_ARRAY(pAddStaReq->peerMac)); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2637 | return eSIR_FAILURE; |
| 2638 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 2639 | |
| 2640 | /* Set the aid in peerAIDBitmap as it has been assigned to TDLS peer */ |
| 2641 | SET_PEER_AID_BITMAP(psessionEntry->peerAIDBitmap, aid); |
| 2642 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2643 | limLog(pMac, LOG1, FL("Aid = %d, for peer =" MAC_ADDRESS_STR), |
| 2644 | aid, MAC_ADDR_ARRAY(pAddStaReq->peerMac)); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2645 | pStaDs = dphGetHashEntry(pMac, aid, &psessionEntry->dph.dphHashTable); |
| 2646 | |
| 2647 | if (pStaDs) |
| 2648 | { |
| 2649 | (void) limDelSta(pMac, pStaDs, false /*asynchronous*/, psessionEntry); |
| 2650 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, aid, psessionEntry); |
| 2651 | } |
| 2652 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2653 | pStaDs = dphAddHashEntry(pMac, pAddStaReq->peerMac, aid, |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2654 | &psessionEntry->dph.dphHashTable) ; |
| 2655 | |
| 2656 | if(NULL == pStaDs) |
| 2657 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2658 | limLog(pMac, LOGE, FL("add hash entry failed")); |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2659 | VOS_ASSERT(0) ; |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 2660 | return eSIR_FAILURE; |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2661 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2662 | } |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2663 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2664 | limTdlsUpdateHashNodeInfo(pMac, pStaDs, pAddStaReq, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2665 | |
| 2666 | pStaDs->staType = STA_ENTRY_TDLS_PEER ; |
| 2667 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2668 | status = limAddSta(pMac, pStaDs, (pAddStaReq->tdlsAddOper == TDLS_OPER_UPDATE) ? true: false, psessionEntry); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2669 | |
| 2670 | if(eSIR_SUCCESS != status) |
| 2671 | { |
| 2672 | /* should not fail */ |
| 2673 | VOS_ASSERT(0) ; |
Lee Hoonki | f987a0b | 2013-01-29 02:07:07 -0800 | [diff] [blame] | 2674 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2675 | return status ; |
| 2676 | } |
| 2677 | |
| 2678 | /* |
| 2679 | * Del STA, after Link is teardown or discovery response sent on direct link |
| 2680 | */ |
| 2681 | static tpDphHashNode limTdlsDelSta(tpAniSirGlobal pMac, tSirMacAddr peerMac, |
| 2682 | tpPESession psessionEntry) |
| 2683 | { |
| 2684 | tSirRetStatus status = eSIR_SUCCESS ; |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 2685 | tANI_U16 peerIdx = 0 ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2686 | tpDphHashNode pStaDs = NULL ; |
| 2687 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 2688 | pStaDs = dphLookupHashEntry(pMac, peerMac, &peerIdx, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2689 | &psessionEntry->dph.dphHashTable) ; |
| 2690 | |
| 2691 | if(pStaDs) |
| 2692 | { |
| 2693 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2694 | limLog(pMac, LOG1, FL("DEL STA peer MAC: "MAC_ADDRESS_STR), |
| 2695 | MAC_ADDR_ARRAY(pStaDs->staAddr)); |
| 2696 | limLog(pMac, LOG1, FL("STA type = %x, sta idx = %x"), |
| 2697 | pStaDs->staType, |
| 2698 | pStaDs->staIndex); |
Edhar, Mahesh Kumar | c9e9f62 | 2014-12-11 15:40:29 +0530 | [diff] [blame] | 2699 | limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS, |
Ganesh Kondabattini | 6efefb2 | 2015-01-20 12:17:42 +0530 | [diff] [blame] | 2700 | eSIR_MAC_PEER_TIMEDOUT_REASON); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2701 | status = limDelSta(pMac, pStaDs, false, psessionEntry) ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2702 | } |
| 2703 | |
| 2704 | return pStaDs ; |
| 2705 | } |
| 2706 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2707 | /* |
| 2708 | * Once Link is setup with PEER, send Add STA ind to SME |
| 2709 | */ |
| 2710 | static eHalStatus limSendSmeTdlsAddStaRsp(tpAniSirGlobal pMac, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2711 | tANI_U8 sessionId, tSirMacAddr peerMac, tANI_U8 updateSta, |
| 2712 | tDphHashNode *pStaDs, tANI_U8 status) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2713 | { |
| 2714 | tSirMsgQ mmhMsg = {0} ; |
| 2715 | tSirTdlsAddStaRsp *addStaRsp = NULL ; |
| 2716 | mmhMsg.type = eWNI_SME_TDLS_ADD_STA_RSP ; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2717 | |
| 2718 | addStaRsp = vos_mem_malloc(sizeof(tSirTdlsAddStaRsp)); |
| 2719 | if ( NULL == addStaRsp ) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2720 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2721 | limLog(pMac, LOGE, FL("Failed to allocate memory")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2722 | return eSIR_FAILURE; |
| 2723 | } |
| 2724 | |
| 2725 | addStaRsp->sessionId = sessionId; |
| 2726 | addStaRsp->statusCode = status; |
| 2727 | if( pStaDs ) |
| 2728 | { |
| 2729 | addStaRsp->staId = pStaDs->staIndex ; |
| 2730 | addStaRsp->ucastSig = pStaDs->ucUcastSig ; |
| 2731 | addStaRsp->bcastSig = pStaDs->ucBcastSig ; |
| 2732 | } |
| 2733 | if( peerMac ) |
| 2734 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2735 | vos_mem_copy( addStaRsp->peerMac, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2736 | (tANI_U8 *) peerMac, sizeof(tSirMacAddr)); |
| 2737 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2738 | if (updateSta) |
| 2739 | addStaRsp->tdlsAddOper = TDLS_OPER_UPDATE; |
| 2740 | else |
| 2741 | addStaRsp->tdlsAddOper = TDLS_OPER_ADD; |
| 2742 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2743 | addStaRsp->length = sizeof(tSirTdlsAddStaRsp) ; |
| 2744 | addStaRsp->messageType = eWNI_SME_TDLS_ADD_STA_RSP ; |
| 2745 | |
| 2746 | mmhMsg.bodyptr = addStaRsp; |
| 2747 | mmhMsg.bodyval = 0; |
| 2748 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 2749 | |
| 2750 | return eSIR_SUCCESS ; |
| 2751 | |
| 2752 | } |
| 2753 | /* |
| 2754 | * STA RSP received from HAL |
| 2755 | */ |
| 2756 | eHalStatus limProcessTdlsAddStaRsp(tpAniSirGlobal pMac, void *msg, |
| 2757 | tpPESession psessionEntry) |
| 2758 | { |
| 2759 | tAddStaParams *pAddStaParams = (tAddStaParams *) msg ; |
| 2760 | tANI_U8 status = eSIR_SUCCESS ; |
| 2761 | tDphHashNode *pStaDs = NULL ; |
| 2762 | tANI_U16 aid = 0 ; |
| 2763 | |
| 2764 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2765 | limLog(pMac, LOG1, FL("staIdx=%d, staMac="MAC_ADDRESS_STR), |
| 2766 | pAddStaParams->staIdx, |
| 2767 | MAC_ADDR_ARRAY(pAddStaParams->staMac)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2768 | |
| 2769 | if (pAddStaParams->status != eHAL_STATUS_SUCCESS) |
| 2770 | { |
| 2771 | VOS_ASSERT(0) ; |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2772 | limLog(pMac, LOGE, FL("Add sta failed ")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2773 | status = eSIR_FAILURE; |
| 2774 | goto add_sta_error; |
| 2775 | } |
| 2776 | |
| 2777 | pStaDs = dphLookupHashEntry(pMac, pAddStaParams->staMac, &aid, |
| 2778 | &psessionEntry->dph.dphHashTable); |
| 2779 | if(NULL == pStaDs) |
| 2780 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2781 | limLog(pMac, LOGE, FL("pStaDs is NULL ")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2782 | status = eSIR_FAILURE; |
| 2783 | goto add_sta_error; |
| 2784 | } |
| 2785 | |
| 2786 | pStaDs->bssId = pAddStaParams->bssIdx; |
| 2787 | pStaDs->staIndex = pAddStaParams->staIdx; |
| 2788 | pStaDs->ucUcastSig = pAddStaParams->ucUcastSig; |
| 2789 | pStaDs->ucBcastSig = pAddStaParams->ucBcastSig; |
| 2790 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; |
| 2791 | pStaDs->valid = 1 ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2792 | add_sta_error: |
| 2793 | status = limSendSmeTdlsAddStaRsp(pMac, psessionEntry->smeSessionId, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2794 | pAddStaParams->staMac, pAddStaParams->updateSta, pStaDs, status) ; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2795 | vos_mem_free( pAddStaParams ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2796 | return status ; |
| 2797 | } |
| 2798 | |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2799 | void PopulateDot11fTdlsOffchannelParams(tpAniSirGlobal pMac, |
| 2800 | tpPESession psessionEntry, |
| 2801 | tDot11fIESuppChannels *suppChannels, |
| 2802 | tDot11fIESuppOperatingClasses *suppOperClasses) |
| 2803 | { |
| 2804 | tANI_U32 numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2805 | tANI_U8 validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
Pradeep Reddy POTTETI | 1571b4f | 2015-02-18 15:34:26 +0530 | [diff] [blame] | 2806 | tANI_U8 i, j; |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 2807 | tANI_U8 op_class; |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2808 | if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 2809 | validChan, &numChans) != eSIR_SUCCESS) |
| 2810 | { |
| 2811 | /** |
| 2812 | * Could not get Valid channel list from CFG. |
| 2813 | * Log error. |
| 2814 | */ |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2815 | limLog(pMac, LOGE, FL("could not retrieve valid channel list")); |
Sushant Kaushik | 5b4c821 | 2015-02-20 14:54:25 +0530 | [diff] [blame] | 2816 | return; |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2817 | } |
| 2818 | suppChannels->num_bands = (tANI_U8) numChans; |
| 2819 | |
Masti, Narayanraddi | 2f5dd65 | 2015-03-03 22:00:44 +0530 | [diff] [blame] | 2820 | for ( i = 0U, j = 0U; i < suppChannels->num_bands && |
| 2821 | j < LIM_MAX_BANDS; i++) |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2822 | { |
Pradeep Reddy POTTETI | 1571b4f | 2015-02-18 15:34:26 +0530 | [diff] [blame] | 2823 | /* don't populate dfs channels in supported channels ie */ |
Pradeep Reddy POTTETI | f066fe3 | 2015-04-23 11:59:33 +0530 | [diff] [blame] | 2824 | if (!(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(validChan[i]))) { |
Pradeep Reddy POTTETI | 1571b4f | 2015-02-18 15:34:26 +0530 | [diff] [blame] | 2825 | suppChannels->bands[j][0] = validChan[i]; |
| 2826 | suppChannels->bands[j][1] = 1; |
Pradeep Reddy POTTETI | 8f736ad | 2015-04-23 15:20:16 +0530 | [diff] [blame] | 2827 | /* store tdls self supported channels */ |
| 2828 | tdlsSelfSupportedChannels[j] = validChan[i]; |
Pradeep Reddy POTTETI | 1571b4f | 2015-02-18 15:34:26 +0530 | [diff] [blame] | 2829 | j++; |
| 2830 | } |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2831 | } |
Pradeep Reddy POTTETI | 1571b4f | 2015-02-18 15:34:26 +0530 | [diff] [blame] | 2832 | /* update the channel list with new length */ |
| 2833 | suppChannels->num_bands = j; |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2834 | suppChannels->present = 1 ; |
Pradeep Reddy POTTETI | 8f736ad | 2015-04-23 15:20:16 +0530 | [diff] [blame] | 2835 | /* store tdls self supported channels new length */ |
| 2836 | tdlsSelfNumChans = j; |
| 2837 | |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 2838 | /*Get present operating class based on current operating channel*/ |
| 2839 | op_class = limGetOPClassFromChannel( |
| 2840 | pMac->scan.countryCodeCurrent, |
| 2841 | psessionEntry->currentOperChannel, |
| 2842 | psessionEntry->htSecondaryChannelOffset); |
| 2843 | if (op_class == 0) |
| 2844 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2845 | limLog(pMac, LOGE, |
| 2846 | FL("Present Operating class is wrong, countryCodeCurrent: %s, currentOperChannel: %d, htSecondaryChannelOffset: %d"), |
| 2847 | pMac->scan.countryCodeCurrent, |
| 2848 | psessionEntry->currentOperChannel, |
| 2849 | psessionEntry->htSecondaryChannelOffset); |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 2850 | } |
| 2851 | else |
| 2852 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2853 | limLog(pMac, LOG1, |
| 2854 | FL("Present Operating channel=%d offset=%d class=%d"), |
| 2855 | psessionEntry->currentOperChannel, |
| 2856 | psessionEntry->htSecondaryChannelOffset, |
| 2857 | op_class); |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 2858 | } |
| 2859 | suppOperClasses->present = 1; |
| 2860 | suppOperClasses->classes[0] = op_class; |
| 2861 | /*Fill operating classes from static array*/ |
| 2862 | suppOperClasses->num_classes = op_classes.num_classes; |
| 2863 | for ( i = 0U; i < suppOperClasses->num_classes; i++) |
| 2864 | { |
| 2865 | suppOperClasses->classes[i+1] = op_classes.classes[i]; |
| 2866 | |
| 2867 | } |
| 2868 | /*increment for present operating class*/ |
| 2869 | suppOperClasses->num_classes++; |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2870 | return ; |
| 2871 | } |
| 2872 | |
| 2873 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2874 | /* |
| 2875 | * FUNCTION: Populate Link Identifier element IE |
| 2876 | * |
| 2877 | */ |
| 2878 | |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 2879 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2880 | void PopulateDot11fLinkIden(tpAniSirGlobal pMac, tpPESession psessionEntry, |
| 2881 | tDot11fIELinkIdentifier *linkIden, |
| 2882 | tSirMacAddr peerMac, tANI_U8 reqType) |
| 2883 | { |
| 2884 | //tANI_U32 size = sizeof(tSirMacAddr) ; |
| 2885 | tANI_U8 *initStaAddr = NULL ; |
| 2886 | tANI_U8 *respStaAddr = NULL ; |
| 2887 | |
| 2888 | (reqType == TDLS_INITIATOR) ? ((initStaAddr = linkIden->InitStaAddr), |
| 2889 | (respStaAddr = linkIden->RespStaAddr)) |
| 2890 | : ((respStaAddr = linkIden->InitStaAddr ), |
| 2891 | (initStaAddr = linkIden->RespStaAddr)) ; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2892 | vos_mem_copy( (tANI_U8 *)linkIden->bssid, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2893 | (tANI_U8 *) psessionEntry->bssId, sizeof(tSirMacAddr)) ; |
| 2894 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2895 | vos_mem_copy( (tANI_U8 *)initStaAddr, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2896 | psessionEntry->selfMacAddr, sizeof(tSirMacAddr)) ; |
| 2897 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 2898 | vos_mem_copy( (tANI_U8 *)respStaAddr, (tANI_U8 *) peerMac, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2899 | sizeof( tSirMacAddr )); |
| 2900 | |
| 2901 | linkIden->present = 1 ; |
| 2902 | return ; |
| 2903 | |
| 2904 | } |
| 2905 | |
| 2906 | void PopulateDot11fTdlsExtCapability(tpAniSirGlobal pMac, |
| 2907 | tDot11fIEExtCap *extCapability) |
| 2908 | { |
| 2909 | extCapability->TDLSPeerPSMSupp = PEER_PSM_SUPPORT ; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 2910 | extCapability->TDLSPeerUAPSDBufferSTA = pMac->lim.gLimTDLSBufStaEnabled; |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 2911 | extCapability->TDLSChannelSwitching = pMac->lim.gLimTDLSOffChannelEnabled ; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2912 | extCapability->TDLSSupport = TDLS_SUPPORT ; |
| 2913 | extCapability->TDLSProhibited = TDLS_PROHIBITED ; |
| 2914 | extCapability->TDLSChanSwitProhibited = TDLS_CH_SWITCH_PROHIBITED ; |
| 2915 | extCapability->present = 1 ; |
| 2916 | return ; |
| 2917 | } |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2918 | |
| 2919 | /* |
| 2920 | * Process Send Mgmt Request from SME and transmit to AP. |
| 2921 | */ |
| 2922 | tSirRetStatus limProcessSmeTdlsMgmtSendReq(tpAniSirGlobal pMac, |
| 2923 | tANI_U32 *pMsgBuf) |
| 2924 | { |
| 2925 | /* get all discovery request parameters */ |
| 2926 | tSirTdlsSendMgmtReq *pSendMgmtReq = (tSirTdlsSendMgmtReq*) pMsgBuf ; |
| 2927 | tpPESession psessionEntry; |
| 2928 | tANI_U8 sessionId; |
| 2929 | tSirResultCodes resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2930 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2931 | limLog(pMac, LOG1, FL("Send Mgmt Recieved")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2932 | |
| 2933 | if((psessionEntry = peFindSessionByBssid(pMac, pSendMgmtReq->bssid, &sessionId)) |
| 2934 | == NULL) |
| 2935 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2936 | limLog(pMac, LOGE, |
| 2937 | FL("PE Session does not exist for given sme sessionId %d"), |
| 2938 | pSendMgmtReq->sessionId); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2939 | goto lim_tdls_send_mgmt_error; |
| 2940 | } |
| 2941 | |
| 2942 | /* check if we are in proper state to work as TDLS client */ |
| 2943 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 2944 | { |
| 2945 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2946 | "send mgmt received in wrong system Role %d", |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2947 | psessionEntry->limSystemRole); |
| 2948 | goto lim_tdls_send_mgmt_error; |
| 2949 | } |
| 2950 | |
| 2951 | /* |
| 2952 | * if we are still good, go ahead and check if we are in proper state to |
| 2953 | * do TDLS discovery req/rsp/....frames. |
| 2954 | */ |
| 2955 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 2956 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 2957 | { |
| 2958 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2959 | limLog(pMac, LOGE, FL("send mgmt received in invalid LIMsme state (%d)"), |
| 2960 | psessionEntry->limSmeState); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2961 | goto lim_tdls_send_mgmt_error; |
| 2962 | } |
Abhishek Singh | 888420b | 2016-01-06 12:28:03 +0530 | [diff] [blame] | 2963 | vos_tdls_tx_rx_mgmt_event(SIR_MAC_ACTION_TDLS, |
| 2964 | SIR_MAC_ACTION_TX, SIR_MAC_MGMT_ACTION, |
| 2965 | pSendMgmtReq->reqType, pSendMgmtReq->peerMac); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2966 | |
| 2967 | switch( pSendMgmtReq->reqType ) |
| 2968 | { |
| 2969 | case SIR_MAC_TDLS_DIS_REQ: |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2970 | limLog(pMac, LOG1, FL("Transmit Discovery Request Frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2971 | /* format TDLS discovery request frame and transmit it */ |
| 2972 | limSendTdlsDisReqFrame(pMac, pSendMgmtReq->peerMac, pSendMgmtReq->dialog, |
| 2973 | psessionEntry) ; |
| 2974 | resultCode = eSIR_SME_SUCCESS; |
| 2975 | break; |
| 2976 | case SIR_MAC_TDLS_DIS_RSP: |
| 2977 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2978 | limLog(pMac, LOG1, FL("Transmit Discovery Response Frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2979 | //Send a response mgmt action frame |
| 2980 | limSendTdlsDisRspFrame(pMac, pSendMgmtReq->peerMac, |
Mahesh A Saptasagar | 9be00d7 | 2014-08-28 16:04:43 +0530 | [diff] [blame] | 2981 | pSendMgmtReq->dialog, psessionEntry, |
| 2982 | &pSendMgmtReq->addIe[0], |
| 2983 | (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2984 | resultCode = eSIR_SME_SUCCESS; |
| 2985 | } |
| 2986 | break; |
| 2987 | case SIR_MAC_TDLS_SETUP_REQ: |
| 2988 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2989 | limLog(pMac, LOG1, FL("Transmit Setup Request Frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2990 | limSendTdlsLinkSetupReqFrame(pMac, |
| 2991 | pSendMgmtReq->peerMac, pSendMgmtReq->dialog, psessionEntry, |
| 2992 | &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 2993 | resultCode = eSIR_SME_SUCCESS; |
| 2994 | } |
| 2995 | break; |
| 2996 | case SIR_MAC_TDLS_SETUP_RSP: |
| 2997 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 2998 | limLog(pMac, LOG1, FL("Transmit Setup Response Frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 2999 | limSendTdlsSetupRspFrame(pMac, |
| 3000 | pSendMgmtReq->peerMac, pSendMgmtReq->dialog, psessionEntry, pSendMgmtReq->statusCode, |
| 3001 | &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 3002 | resultCode = eSIR_SME_SUCCESS; |
| 3003 | } |
| 3004 | break; |
| 3005 | case SIR_MAC_TDLS_SETUP_CNF: |
| 3006 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3007 | limLog(pMac, LOG1, FL("Transmit Setup Confirm Frame")); |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 3008 | limSendTdlsLinkSetupCnfFrame(pMac, pSendMgmtReq->peerMac, pSendMgmtReq->dialog, pSendMgmtReq->peerCapability, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3009 | psessionEntry, &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 3010 | resultCode = eSIR_SME_SUCCESS; |
| 3011 | } |
| 3012 | break; |
| 3013 | case SIR_MAC_TDLS_TEARDOWN: |
| 3014 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3015 | limLog(pMac, LOG1, FL("Transmit Teardown Frame")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3016 | limSendTdlsTeardownFrame(pMac, |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 3017 | pSendMgmtReq->peerMac, pSendMgmtReq->statusCode, pSendMgmtReq->responder, psessionEntry, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3018 | &pSendMgmtReq->addIe[0], (pSendMgmtReq->length - sizeof(tSirTdlsSendMgmtReq))); |
| 3019 | resultCode = eSIR_SME_SUCCESS; |
| 3020 | } |
| 3021 | break; |
| 3022 | case SIR_MAC_TDLS_PEER_TRAFFIC_IND: |
| 3023 | { |
| 3024 | } |
| 3025 | break; |
| 3026 | case SIR_MAC_TDLS_CH_SWITCH_REQ: |
| 3027 | { |
| 3028 | } |
| 3029 | break; |
| 3030 | case SIR_MAC_TDLS_CH_SWITCH_RSP: |
| 3031 | { |
| 3032 | } |
| 3033 | break; |
| 3034 | case SIR_MAC_TDLS_PEER_TRAFFIC_RSP: |
| 3035 | { |
| 3036 | } |
| 3037 | break; |
| 3038 | default: |
| 3039 | break; |
| 3040 | } |
| 3041 | |
| 3042 | lim_tdls_send_mgmt_error: |
| 3043 | |
| 3044 | limSendSmeRsp( pMac, eWNI_SME_TDLS_SEND_MGMT_RSP, |
| 3045 | resultCode, pSendMgmtReq->sessionId, pSendMgmtReq->transactionId); |
| 3046 | |
| 3047 | return eSIR_SUCCESS; |
| 3048 | } |
| 3049 | |
| 3050 | /* |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3051 | * Send Response to Link Establish Request to SME |
| 3052 | */ |
| 3053 | void limSendSmeTdlsLinkEstablishReqRsp(tpAniSirGlobal pMac, |
| 3054 | tANI_U8 sessionId, tSirMacAddr peerMac, tDphHashNode *pStaDs, |
| 3055 | tANI_U8 status) |
| 3056 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3057 | tSirMsgQ mmhMsg = {0} ; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3058 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3059 | tSirTdlsLinkEstablishReqRsp *pTdlsLinkEstablishReqRsp = NULL ; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3060 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3061 | pTdlsLinkEstablishReqRsp = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishReqRsp)); |
| 3062 | if ( NULL == pTdlsLinkEstablishReqRsp ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3063 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3064 | limLog(pMac, LOGE, FL("Failed to allocate memory")); |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3065 | return ; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3066 | } |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3067 | |
| 3068 | vos_mem_zero(pTdlsLinkEstablishReqRsp, sizeof(tSirTdlsLinkEstablishReqRsp)); |
| 3069 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3070 | pTdlsLinkEstablishReqRsp->statusCode = status ; |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3071 | if (pStaDs && peerMac) |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3072 | { |
| 3073 | vos_mem_copy(pTdlsLinkEstablishReqRsp->peerMac, peerMac, sizeof(tSirMacAddr)); |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3074 | pTdlsLinkEstablishReqRsp->sta_idx = pStaDs->staIndex; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3075 | } |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3076 | |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3077 | pTdlsLinkEstablishReqRsp->sessionId = sessionId; |
Masti, Narayanraddi | f10fd79 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 3078 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3079 | mmhMsg.type = eWNI_SME_TDLS_LINK_ESTABLISH_RSP ; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3080 | mmhMsg.bodyptr = pTdlsLinkEstablishReqRsp; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3081 | mmhMsg.bodyval = 0; |
| 3082 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 3083 | return ; |
| 3084 | |
| 3085 | |
| 3086 | } |
| 3087 | |
| 3088 | /* |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3089 | * Send Response to Chan Switch Request to SME |
| 3090 | */ |
| 3091 | void limSendSmeTdlsChanSwitchReqRsp(tpAniSirGlobal pMac, |
| 3092 | tANI_U8 sessionId, tSirMacAddr peerMac, tDphHashNode *pStaDs, |
| 3093 | tANI_U8 status) |
| 3094 | { |
| 3095 | tSirMsgQ mmhMsg = {0} ; |
| 3096 | |
| 3097 | tSirTdlsChanSwitchReqRsp *pTdlsChanSwitchReqRsp = NULL ; |
| 3098 | |
| 3099 | pTdlsChanSwitchReqRsp = vos_mem_malloc(sizeof(tSirTdlsChanSwitchReqRsp)); |
| 3100 | if ( NULL == pTdlsChanSwitchReqRsp ) |
| 3101 | { |
| 3102 | PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));) |
| 3103 | return ; |
| 3104 | } |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3105 | |
| 3106 | vos_mem_zero(pTdlsChanSwitchReqRsp, sizeof(tSirTdlsChanSwitchReqRsp)); |
| 3107 | |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3108 | pTdlsChanSwitchReqRsp->statusCode = status ; |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3109 | if (pStaDs && peerMac ) |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3110 | { |
| 3111 | vos_mem_copy(pTdlsChanSwitchReqRsp->peerMac, peerMac, sizeof(tSirMacAddr)); |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3112 | pTdlsChanSwitchReqRsp->sta_idx = pStaDs->staIndex;; |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3113 | } |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3114 | |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3115 | pTdlsChanSwitchReqRsp->sessionId = sessionId; |
Masti, Narayanraddi | 36c6762 | 2016-01-06 16:07:34 +0530 | [diff] [blame] | 3116 | |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3117 | mmhMsg.type = eWNI_SME_TDLS_CHANNEL_SWITCH_RSP ; |
| 3118 | mmhMsg.bodyptr = pTdlsChanSwitchReqRsp; |
| 3119 | mmhMsg.bodyval = 0; |
| 3120 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 3121 | return ; |
| 3122 | |
| 3123 | |
| 3124 | } |
| 3125 | /* |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3126 | * Once link is teardown, send Del Peer Ind to SME |
| 3127 | */ |
| 3128 | static eHalStatus limSendSmeTdlsDelStaRsp(tpAniSirGlobal pMac, |
| 3129 | tANI_U8 sessionId, tSirMacAddr peerMac, tDphHashNode *pStaDs, |
| 3130 | tANI_U8 status) |
| 3131 | { |
| 3132 | tSirMsgQ mmhMsg = {0} ; |
| 3133 | tSirTdlsDelStaRsp *pDelSta = NULL ; |
| 3134 | mmhMsg.type = eWNI_SME_TDLS_DEL_STA_RSP ; |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3135 | |
| 3136 | pDelSta = vos_mem_malloc(sizeof(tSirTdlsDelStaRsp)); |
| 3137 | if ( NULL == pDelSta ) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3138 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3139 | limLog(pMac, LOGE, FL("Failed to allocate memory")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3140 | return eSIR_FAILURE; |
| 3141 | } |
| 3142 | |
| 3143 | pDelSta->sessionId = sessionId; |
| 3144 | pDelSta->statusCode = status ; |
| 3145 | if( pStaDs ) |
| 3146 | { |
| 3147 | pDelSta->staId = pStaDs->staIndex ; |
| 3148 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3149 | else |
| 3150 | pDelSta->staId = HAL_STA_INVALID_IDX; |
| 3151 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3152 | if( peerMac ) |
| 3153 | { |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3154 | vos_mem_copy(pDelSta->peerMac, peerMac, sizeof(tSirMacAddr)); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3155 | } |
| 3156 | |
| 3157 | pDelSta->length = sizeof(tSirTdlsDelStaRsp) ; |
| 3158 | pDelSta->messageType = eWNI_SME_TDLS_DEL_STA_RSP ; |
| 3159 | |
| 3160 | mmhMsg.bodyptr = pDelSta; |
| 3161 | |
| 3162 | mmhMsg.bodyval = 0; |
| 3163 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 3164 | return eSIR_SUCCESS ; |
| 3165 | |
| 3166 | } |
| 3167 | |
| 3168 | /* |
| 3169 | * Process Send Mgmt Request from SME and transmit to AP. |
| 3170 | */ |
| 3171 | tSirRetStatus limProcessSmeTdlsAddStaReq(tpAniSirGlobal pMac, |
| 3172 | tANI_U32 *pMsgBuf) |
| 3173 | { |
| 3174 | /* get all discovery request parameters */ |
| 3175 | tSirTdlsAddStaReq *pAddStaReq = (tSirTdlsAddStaReq*) pMsgBuf ; |
| 3176 | tpPESession psessionEntry; |
| 3177 | tANI_U8 sessionId; |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3178 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3179 | limLog(pMac, LOG1, FL("TDLS Add STA Request Recieved")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3180 | |
| 3181 | if((psessionEntry = peFindSessionByBssid(pMac, pAddStaReq->bssid, &sessionId)) |
| 3182 | == NULL) |
| 3183 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3184 | limLog(pMac, LOGE, |
| 3185 | FL("PE Session does not exist for given sme sessionId %d"), |
| 3186 | pAddStaReq->sessionId); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3187 | goto lim_tdls_add_sta_error; |
| 3188 | } |
| 3189 | |
| 3190 | /* check if we are in proper state to work as TDLS client */ |
| 3191 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 3192 | { |
| 3193 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3194 | "send mgmt received in wrong system Role %d", |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3195 | psessionEntry->limSystemRole); |
| 3196 | goto lim_tdls_add_sta_error; |
| 3197 | } |
| 3198 | |
| 3199 | /* |
| 3200 | * if we are still good, go ahead and check if we are in proper state to |
| 3201 | * do TDLS discovery req/rsp/....frames. |
| 3202 | */ |
| 3203 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 3204 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 3205 | { |
| 3206 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3207 | limLog(pMac, LOGE, |
| 3208 | FL("Add STA received in invalid LIMsme state (%d)"), |
| 3209 | psessionEntry->limSmeState); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3210 | goto lim_tdls_add_sta_error; |
| 3211 | } |
| 3212 | |
| 3213 | pMac->lim.gLimAddStaTdls = true ; |
| 3214 | |
| 3215 | /* To start with, send add STA request to HAL */ |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3216 | if (eSIR_FAILURE == limTdlsSetupAddSta(pMac, pAddStaReq, psessionEntry)) |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3217 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3218 | limLog(pMac, LOGE, FL("Add TDLS Station request failed")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3219 | goto lim_tdls_add_sta_error; |
| 3220 | } |
| 3221 | return eSIR_SUCCESS; |
| 3222 | lim_tdls_add_sta_error: |
| 3223 | limSendSmeTdlsAddStaRsp(pMac, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 3224 | pAddStaReq->sessionId, pAddStaReq->peerMac, |
| 3225 | (pAddStaReq->tdlsAddOper == TDLS_OPER_UPDATE), NULL, eSIR_FAILURE ); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3226 | |
| 3227 | return eSIR_SUCCESS; |
| 3228 | } |
| 3229 | /* |
| 3230 | * Process Del Sta Request from SME . |
| 3231 | */ |
| 3232 | tSirRetStatus limProcessSmeTdlsDelStaReq(tpAniSirGlobal pMac, |
| 3233 | tANI_U32 *pMsgBuf) |
| 3234 | { |
| 3235 | /* get all discovery request parameters */ |
| 3236 | tSirTdlsDelStaReq *pDelStaReq = (tSirTdlsDelStaReq*) pMsgBuf ; |
| 3237 | tpPESession psessionEntry; |
| 3238 | tANI_U8 sessionId; |
| 3239 | tpDphHashNode pStaDs = NULL ; |
| 3240 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3241 | limLog(pMac, LOG1, FL("TDLS Delete STA Request Recieved")); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3242 | |
| 3243 | if((psessionEntry = peFindSessionByBssid(pMac, pDelStaReq->bssid, &sessionId)) |
| 3244 | == NULL) |
| 3245 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3246 | limLog(pMac, LOGE, |
| 3247 | FL("PE Session does not exist for given sme sessionId %d"), |
| 3248 | pDelStaReq->sessionId); |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 3249 | limSendSmeTdlsDelStaRsp(pMac, pDelStaReq->sessionId, pDelStaReq->peerMac, |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3250 | NULL, eSIR_FAILURE) ; |
| 3251 | return eSIR_FAILURE; |
| 3252 | } |
| 3253 | |
| 3254 | /* check if we are in proper state to work as TDLS client */ |
| 3255 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 3256 | { |
| 3257 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3258 | "Del sta received in wrong system Role %d", |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3259 | psessionEntry->limSystemRole); |
| 3260 | goto lim_tdls_del_sta_error; |
| 3261 | } |
| 3262 | |
| 3263 | /* |
| 3264 | * if we are still good, go ahead and check if we are in proper state to |
| 3265 | * do TDLS discovery req/rsp/....frames. |
| 3266 | */ |
| 3267 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 3268 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 3269 | { |
| 3270 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3271 | limLog(pMac, LOGE, FL("Del Sta received in invalid LIMsme state (%d)"), |
| 3272 | psessionEntry->limSmeState); |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3273 | goto lim_tdls_del_sta_error; |
| 3274 | } |
| 3275 | |
| 3276 | pStaDs = limTdlsDelSta(pMac, pDelStaReq->peerMac, psessionEntry) ; |
| 3277 | |
| 3278 | /* now send indication to SME-->HDD->TL to remove STA from TL */ |
| 3279 | |
| 3280 | if(pStaDs) |
| 3281 | { |
| 3282 | limSendSmeTdlsDelStaRsp(pMac, psessionEntry->smeSessionId, pDelStaReq->peerMac, |
| 3283 | pStaDs, eSIR_SUCCESS) ; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3284 | limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ; |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 3285 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3286 | /* Clear the aid in peerAIDBitmap as this aid is now in freepool */ |
| 3287 | CLEAR_PEER_AID_BITMAP(psessionEntry->peerAIDBitmap, pStaDs->assocId); |
Hoonki Lee | f63df0d | 2013-01-16 19:29:14 -0800 | [diff] [blame] | 3288 | limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ; |
| 3289 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3290 | return eSIR_SUCCESS; |
| 3291 | |
| 3292 | } |
| 3293 | |
| 3294 | lim_tdls_del_sta_error: |
| 3295 | limSendSmeTdlsDelStaRsp(pMac, psessionEntry->smeSessionId, pDelStaReq->peerMac, |
| 3296 | NULL, eSIR_FAILURE) ; |
| 3297 | |
| 3298 | return eSIR_SUCCESS; |
| 3299 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3300 | |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 3301 | /* Intersects the two input arrays and outputs an array */ |
| 3302 | /* For now the array length of tANI_U8 suffices */ |
| 3303 | static void limTdlsGetIntersection(tANI_U8 *input_array1,tANI_U8 input1_length, |
| 3304 | tANI_U8 *input_array2,tANI_U8 input2_length, |
| 3305 | tANI_U8 *output_array,tANI_U8 *output_length) |
| 3306 | { |
| 3307 | tANI_U8 i,j,k=0,flag=0; |
Pradeep Reddy POTTETI | 7e6de8d | 2014-07-18 17:24:19 +0530 | [diff] [blame] | 3308 | |
| 3309 | if (input1_length > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 3310 | { |
| 3311 | input1_length = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 3312 | } |
| 3313 | |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 3314 | for(i=0;i<input1_length;i++) |
| 3315 | { |
| 3316 | flag=0; |
| 3317 | for(j=0;j<input2_length;j++) |
| 3318 | { |
| 3319 | if(input_array1[i]==input_array2[j]) |
| 3320 | { |
| 3321 | flag=1; |
| 3322 | break; |
| 3323 | } |
| 3324 | } |
| 3325 | if(flag==1) |
| 3326 | { |
| 3327 | output_array[k]=input_array1[i]; |
| 3328 | k++; |
| 3329 | } |
| 3330 | } |
| 3331 | *output_length = k; |
| 3332 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3333 | /* |
| 3334 | * Process Link Establishment Request from SME . |
| 3335 | */ |
| 3336 | tSirRetStatus limProcesSmeTdlsLinkEstablishReq(tpAniSirGlobal pMac, |
| 3337 | tANI_U32 *pMsgBuf) |
| 3338 | { |
| 3339 | /* get all discovery request parameters */ |
| 3340 | tSirTdlsLinkEstablishReq *pTdlsLinkEstablishReq = (tSirTdlsLinkEstablishReq*) pMsgBuf ; |
| 3341 | tpPESession psessionEntry; |
| 3342 | tANI_U8 sessionId; |
| 3343 | tpTdlsLinkEstablishParams pMsgTdlsLinkEstablishReq; |
| 3344 | tSirMsgQ msg; |
| 3345 | tANI_U16 peerIdx = 0 ; |
| 3346 | tpDphHashNode pStaDs = NULL ; |
| 3347 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3348 | limLog(pMac, LOG1, FL("Link Establish Request Recieved")) ; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3349 | |
| 3350 | if((psessionEntry = peFindSessionByBssid(pMac, pTdlsLinkEstablishReq->bssid, &sessionId)) |
| 3351 | == NULL) |
| 3352 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3353 | limLog(pMac, LOGE, |
| 3354 | FL("PE Session does not exist for given sme sessionId %d"), |
| 3355 | pTdlsLinkEstablishReq->sessionId); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3356 | limSendSmeTdlsLinkEstablishReqRsp(pMac, pTdlsLinkEstablishReq->sessionId, pTdlsLinkEstablishReq->peerMac, |
| 3357 | NULL, eSIR_FAILURE) ; |
| 3358 | return eSIR_FAILURE; |
| 3359 | } |
| 3360 | |
| 3361 | /* check if we are in proper state to work as TDLS client */ |
| 3362 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 3363 | { |
| 3364 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3365 | "TDLS Link Establish Request received in wrong system Role %d", |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3366 | psessionEntry->limSystemRole); |
| 3367 | goto lim_tdls_link_establish_error; |
| 3368 | } |
| 3369 | |
| 3370 | /* |
| 3371 | * if we are still good, go ahead and check if we are in proper state to |
| 3372 | * do TDLS discovery req/rsp/....frames. |
| 3373 | */ |
| 3374 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 3375 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 3376 | { |
| 3377 | |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3378 | limLog(pMac, LOGE, |
| 3379 | FL("TDLS Link Establish Request received in invalid LIMsme state (%d)"), |
| 3380 | psessionEntry->limSmeState); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3381 | goto lim_tdls_link_establish_error; |
| 3382 | } |
| 3383 | /*TODO Sunil , TDLSPeer Entry has the STA ID , Use it */ |
| 3384 | pStaDs = dphLookupHashEntry(pMac, pTdlsLinkEstablishReq->peerMac, &peerIdx, |
| 3385 | &psessionEntry->dph.dphHashTable) ; |
| 3386 | if ( NULL == pStaDs ) |
| 3387 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3388 | limLog(pMac, LOGE, FL( "pStaDs is NULL")); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3389 | goto lim_tdls_link_establish_error; |
| 3390 | |
| 3391 | } |
Madan Mohan Koyyalamudi | 9e8ce1f | 2013-07-11 10:40:43 +0530 | [diff] [blame] | 3392 | pMsgTdlsLinkEstablishReq = vos_mem_malloc(sizeof( tTdlsLinkEstablishParams )); |
| 3393 | if ( NULL == pMsgTdlsLinkEstablishReq ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3394 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3395 | limLog(pMac, LOGE, |
| 3396 | FL("Unable to allocate memory TDLS Link Establish Request")); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3397 | return eSIR_MEM_ALLOC_FAILED; |
| 3398 | } |
| 3399 | |
Girish Gowli | cf76274 | 2014-07-02 13:54:09 +0530 | [diff] [blame] | 3400 | vos_mem_set( (tANI_U8 *)pMsgTdlsLinkEstablishReq, sizeof(tTdlsLinkEstablishParams), 0); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3401 | |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 3402 | pMsgTdlsLinkEstablishReq->staIdx = pStaDs->staIndex; |
| 3403 | pMsgTdlsLinkEstablishReq->isResponder = pTdlsLinkEstablishReq->isResponder; |
| 3404 | pMsgTdlsLinkEstablishReq->uapsdQueues = pTdlsLinkEstablishReq->uapsdQueues; |
| 3405 | pMsgTdlsLinkEstablishReq->maxSp = pTdlsLinkEstablishReq->maxSp; |
| 3406 | pMsgTdlsLinkEstablishReq->isBufsta = pTdlsLinkEstablishReq->isBufSta; |
Ganesh Kondabattini | ebf56a1 | 2015-02-19 16:22:42 +0530 | [diff] [blame] | 3407 | |
Atul Mittal | bceb4a1 | 2014-11-27 18:50:19 +0530 | [diff] [blame] | 3408 | if (psessionEntry->tdlsChanSwitProhibited) |
| 3409 | { |
Ganesh Kondabattini | ebf56a1 | 2015-02-19 16:22:42 +0530 | [diff] [blame] | 3410 | /* If channel switch is prohibited by AP then dut can either |
| 3411 | * send a switch channel request with failure status or it can |
| 3412 | * ignore the request without sending the response. |
| 3413 | * isOffChannelSupported = 0 disables the TDLS off-channel and |
| 3414 | * if off-channel support is disabled then FW ignores switch |
| 3415 | * channel request sent by TDLS peer */ |
| 3416 | pMsgTdlsLinkEstablishReq->isOffChannelSupported = 0; |
Atul Mittal | bceb4a1 | 2014-11-27 18:50:19 +0530 | [diff] [blame] | 3417 | limLog(pMac, LOG1, FL("Channel Switch Prohibited by AP")); |
| 3418 | } |
| 3419 | else |
| 3420 | { |
Ganesh Kondabattini | ebf56a1 | 2015-02-19 16:22:42 +0530 | [diff] [blame] | 3421 | pMsgTdlsLinkEstablishReq->isOffChannelSupported = |
| 3422 | pTdlsLinkEstablishReq->isOffChannelSupported; |
Atul Mittal | bceb4a1 | 2014-11-27 18:50:19 +0530 | [diff] [blame] | 3423 | } |
Ganesh Kondabattini | ebf56a1 | 2015-02-19 16:22:42 +0530 | [diff] [blame] | 3424 | |
Pradeep Reddy POTTETI | 7e6de8d | 2014-07-18 17:24:19 +0530 | [diff] [blame] | 3425 | if ((pTdlsLinkEstablishReq->supportedChannelsLen > 0) && |
| 3426 | (pTdlsLinkEstablishReq->supportedChannelsLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 3427 | { |
Pradeep Reddy POTTETI | 8f736ad | 2015-04-23 15:20:16 +0530 | [diff] [blame] | 3428 | /* check self supported channels and pass them to FW */ |
| 3429 | if ((tdlsSelfNumChans > 0) && |
| 3430 | (tdlsSelfNumChans < LIM_TDLS_MAX_NON_DFS_CHANNELS)) |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 3431 | { |
Pradeep Reddy POTTETI | 8f736ad | 2015-04-23 15:20:16 +0530 | [diff] [blame] | 3432 | limTdlsGetIntersection(tdlsSelfSupportedChannels, tdlsSelfNumChans, |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 3433 | pTdlsLinkEstablishReq->supportedChannels, |
| 3434 | pTdlsLinkEstablishReq->supportedChannelsLen, |
| 3435 | pMsgTdlsLinkEstablishReq->validChannels, |
| 3436 | &pMsgTdlsLinkEstablishReq->validChannelsLen); |
Pradeep Reddy POTTETI | 8f736ad | 2015-04-23 15:20:16 +0530 | [diff] [blame] | 3437 | } |
Naresh Jayaram | bc62ba4 | 2014-02-12 21:39:14 +0530 | [diff] [blame] | 3438 | } |
| 3439 | vos_mem_copy(pMsgTdlsLinkEstablishReq->validOperClasses, |
| 3440 | pTdlsLinkEstablishReq->supportedOperClasses, pTdlsLinkEstablishReq->supportedOperClassesLen); |
| 3441 | pMsgTdlsLinkEstablishReq->validOperClassesLen = |
| 3442 | pTdlsLinkEstablishReq->supportedOperClassesLen; |
| 3443 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3444 | msg.type = WDA_SET_TDLS_LINK_ESTABLISH_REQ; |
| 3445 | msg.reserved = 0; |
| 3446 | msg.bodyptr = pMsgTdlsLinkEstablishReq; |
| 3447 | msg.bodyval = 0; |
| 3448 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 3449 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3450 | limLog(pMac, LOGE, FL("halPostMsgApi failed")); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 3451 | goto lim_tdls_link_establish_error; |
| 3452 | } |
| 3453 | return eSIR_SUCCESS; |
| 3454 | lim_tdls_link_establish_error: |
| 3455 | limSendSmeTdlsLinkEstablishReqRsp(pMac, psessionEntry->smeSessionId, pTdlsLinkEstablishReq->peerMac, |
| 3456 | NULL, eSIR_FAILURE) ; |
| 3457 | |
| 3458 | return eSIR_SUCCESS; |
| 3459 | } |
| 3460 | |
| 3461 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3462 | /* Delete all the TDLS peer connected before leaving the BSS */ |
| 3463 | tSirRetStatus limDeleteTDLSPeers(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 3464 | { |
| 3465 | tpDphHashNode pStaDs = NULL ; |
| 3466 | int i, aid; |
| 3467 | |
| 3468 | if (NULL == psessionEntry) |
| 3469 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3470 | limLog(pMac, LOGE, FL("NULL psessionEntry")); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3471 | return eSIR_FAILURE; |
| 3472 | } |
| 3473 | |
| 3474 | /* Check all the set bit in peerAIDBitmap and delete the peer (with that aid) entry |
| 3475 | from the hash table and add the aid in free pool */ |
| 3476 | for (i = 0; i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32); i++) |
| 3477 | { |
| 3478 | for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) |
| 3479 | { |
| 3480 | if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) |
| 3481 | { |
| 3482 | pStaDs = dphGetHashEntry(pMac, (aid + i*(sizeof(tANI_U32) << 3)), &psessionEntry->dph.dphHashTable); |
| 3483 | |
| 3484 | if (NULL != pStaDs) |
| 3485 | { |
Sachin Ahuja | b3a1a15 | 2014-11-11 22:14:10 +0530 | [diff] [blame] | 3486 | limLog(pMac, LOGE, FL("Deleting "MAC_ADDRESS_STR), |
| 3487 | MAC_ADDR_ARRAY(pStaDs->staAddr)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3488 | |
| 3489 | limSendDeauthMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
| 3490 | pStaDs->staAddr, psessionEntry, FALSE); |
| 3491 | dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, &psessionEntry->dph.dphHashTable); |
| 3492 | } |
| 3493 | limReleasePeerIdx(pMac, (aid + i*(sizeof(tANI_U32) << 3)), psessionEntry) ; |
| 3494 | CLEAR_BIT(psessionEntry->peerAIDBitmap[i], aid); |
| 3495 | } |
| 3496 | } |
| 3497 | } |
| 3498 | limSendSmeTDLSDeleteAllPeerInd(pMac, psessionEntry); |
| 3499 | |
| 3500 | return eSIR_SUCCESS; |
| 3501 | } |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 3502 | |
| 3503 | |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 3504 | tANI_U8 limGetOffChMaxBwOffsetFromChannel(tANI_U8 *country, |
| 3505 | tANI_U8 channel, |
| 3506 | tANI_U8 peerVHTCapability) |
| 3507 | { |
| 3508 | op_class_map_t *class = NULL; |
| 3509 | tANI_U16 i = 0; |
| 3510 | offset_t offset = BW20, max_allowed = BW80; |
| 3511 | |
| 3512 | if ((TRUE == peerVHTCapability) && |
| 3513 | IS_FEATURE_SUPPORTED_BY_FW(DOT11AC) && |
| 3514 | IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC)) |
| 3515 | max_allowed = BW80; |
| 3516 | else |
| 3517 | max_allowed = BW40MINUS; |
| 3518 | |
| 3519 | if (VOS_TRUE == vos_mem_compare(country,"US", 2)) { |
| 3520 | |
| 3521 | class = us_op_class; |
| 3522 | |
| 3523 | } else if (VOS_TRUE == vos_mem_compare(country,"EU", 2)) { |
| 3524 | |
| 3525 | class = euro_op_class; |
| 3526 | |
| 3527 | } else if (VOS_TRUE == vos_mem_compare(country,"JP", 2)) { |
| 3528 | |
| 3529 | class = japan_op_class; |
| 3530 | |
| 3531 | } else { |
| 3532 | |
| 3533 | class = global_op_class; |
| 3534 | |
| 3535 | } |
| 3536 | |
| 3537 | while (class->op_class) |
| 3538 | { |
| 3539 | for (i=0; (i < 25 && class->channels[i]); i++) |
| 3540 | { |
| 3541 | if (channel == class->channels[i] && class->offset <= max_allowed) |
| 3542 | offset = class->offset; |
| 3543 | } |
| 3544 | class++; |
| 3545 | } |
| 3546 | |
| 3547 | return offset; |
| 3548 | } |
| 3549 | |
| 3550 | |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 3551 | tANI_U8 limGetOPClassFromChannel(tANI_U8 *country, |
| 3552 | tANI_U8 channel, |
| 3553 | tANI_U8 offset) |
| 3554 | { |
| 3555 | op_class_map_t *class = NULL; |
| 3556 | tANI_U16 i = 0; |
| 3557 | |
| 3558 | if (VOS_TRUE == vos_mem_compare(country,"US", 2)) { |
| 3559 | |
| 3560 | class = us_op_class; |
| 3561 | |
| 3562 | } else if (VOS_TRUE == vos_mem_compare(country,"EU", 2)) { |
| 3563 | |
| 3564 | class = euro_op_class; |
| 3565 | |
| 3566 | } else if (VOS_TRUE == vos_mem_compare(country,"JP", 2)) { |
| 3567 | |
| 3568 | class = japan_op_class; |
| 3569 | |
| 3570 | } else { |
| 3571 | |
| 3572 | class = global_op_class; |
| 3573 | |
| 3574 | } |
| 3575 | |
| 3576 | while (class->op_class) |
| 3577 | { |
| 3578 | if ((offset == class->offset) || (offset == BWALL)) |
| 3579 | { |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 3580 | for (i=0; (i < 25 && class->channels[i]); i++) |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 3581 | { |
| 3582 | if (channel == class->channels[i]) |
| 3583 | return class->op_class; |
| 3584 | } |
| 3585 | } |
| 3586 | class++; |
| 3587 | } |
| 3588 | return 0; |
| 3589 | } |
| 3590 | |
| 3591 | tANI_BOOLEAN CheckAndAddOP(tANI_U8 class) |
| 3592 | { |
| 3593 | tANI_U8 i; |
| 3594 | |
| 3595 | for (i=0; i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); i++) |
| 3596 | { |
| 3597 | /*0 is an invalid class. If class is already present ignore*/ |
| 3598 | if (class == op_classes.classes[i]) |
| 3599 | return FALSE; |
| 3600 | if(op_classes.classes[i] == 0) |
| 3601 | { |
| 3602 | return TRUE; |
| 3603 | } |
| 3604 | } |
| 3605 | //limLog(pMac, LOGE, FL("No space left for class = %d"), class); |
| 3606 | return FALSE; |
| 3607 | } |
| 3608 | |
| 3609 | void limInitOperatingClasses( tHalHandle hHal ) |
| 3610 | { |
| 3611 | |
| 3612 | tANI_U8 Index = 0; |
| 3613 | tANI_U8 class = 0; |
| 3614 | tANI_U8 i = 0; |
| 3615 | tANI_U8 j = 0; |
| 3616 | tANI_U8 swap = 0; |
| 3617 | tANI_U8 numChannels = 0; |
| 3618 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3619 | limLog(pMac, LOG1, FL("Current Country = %c%c"), |
| 3620 | pMac->scan.countryCodeCurrent[0], |
| 3621 | pMac->scan.countryCodeCurrent[1]); |
| 3622 | |
| 3623 | vos_mem_set(op_classes.classes, sizeof(op_classes.classes), 0); |
| 3624 | numChannels = pMac->scan.baseChannels.numChannels; |
| 3625 | limLog(pMac, LOG1, "Num of base ch =%d", numChannels); |
| 3626 | for ( Index = 0; |
| 3627 | Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); |
| 3628 | Index++) |
| 3629 | { |
| 3630 | class = limGetOPClassFromChannel( |
| 3631 | pMac->scan.countryCodeCurrent, |
| 3632 | pMac->scan.baseChannels.channelList[ Index ], |
| 3633 | BWALL); |
| 3634 | limLog(pMac, LOG4, "ch=%d <=> %d=class", |
| 3635 | pMac->scan.baseChannels.channelList[ Index ], |
| 3636 | class); |
| 3637 | if (CheckAndAddOP(class)) |
| 3638 | { |
| 3639 | op_classes.classes[i]= class; |
| 3640 | i++; |
| 3641 | } |
| 3642 | } |
| 3643 | |
| 3644 | numChannels = pMac->scan.base20MHzChannels.numChannels; |
| 3645 | limLog(pMac, LOG1, "Num of 20MHz ch =%d", numChannels); |
| 3646 | for ( Index = 0; |
| 3647 | Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); |
| 3648 | Index++) |
| 3649 | { |
| 3650 | class = limGetOPClassFromChannel( |
| 3651 | pMac->scan.countryCodeCurrent, |
| 3652 | pMac->scan.base20MHzChannels.channelList[ Index ], |
| 3653 | BWALL); |
| 3654 | limLog(pMac, LOG4, "ch=%d <=> %d=class", |
| 3655 | pMac->scan.base20MHzChannels.channelList[ Index ], |
| 3656 | class); |
| 3657 | if (CheckAndAddOP(class)) |
| 3658 | { |
| 3659 | op_classes.classes[i]= class; |
| 3660 | i++; |
| 3661 | } |
| 3662 | } |
| 3663 | |
| 3664 | numChannels = pMac->scan.base40MHzChannels.numChannels; |
| 3665 | limLog(pMac, LOG1, "Num of 40MHz ch =%d", numChannels); |
| 3666 | for ( Index = 0; |
| 3667 | Index < numChannels && i < (SIR_MAC_MAX_SUPP_OPER_CLASSES - 1); |
| 3668 | Index++) |
| 3669 | { |
| 3670 | class = limGetOPClassFromChannel( |
| 3671 | pMac->scan.countryCodeCurrent, |
| 3672 | pMac->scan.base40MHzChannels.channelList[ Index ], |
| 3673 | BWALL); |
| 3674 | limLog(pMac, LOG4, "ch=%d <=> %d=class", |
| 3675 | pMac->scan.base40MHzChannels.channelList[ Index ], |
| 3676 | class); |
| 3677 | if (CheckAndAddOP(class)) |
| 3678 | { |
| 3679 | op_classes.classes[i]= class; |
| 3680 | i++; |
| 3681 | } |
| 3682 | } |
| 3683 | |
| 3684 | op_classes.num_classes = i; |
| 3685 | limLog(pMac, LOG1, "Total number of Unique supported classes =%d", |
| 3686 | op_classes.num_classes); |
| 3687 | /*as per spec the operating classes should be in ascending order*/ |
| 3688 | /*Bubble sort is fine as we don't have many classes*/ |
| 3689 | for (i = 0 ; i < ( op_classes.num_classes - 1 ); i++) |
| 3690 | { |
| 3691 | for (j = 0 ; j < op_classes.num_classes - i - 1; j++) |
| 3692 | { |
| 3693 | /* For decreasing order use < */ |
| 3694 | if (op_classes.classes[j] > op_classes.classes[j+1]) |
| 3695 | { |
| 3696 | swap = op_classes.classes[j]; |
| 3697 | op_classes.classes[j] = op_classes.classes[j+1]; |
| 3698 | op_classes.classes[j+1] = swap; |
| 3699 | } |
| 3700 | } |
| 3701 | } |
| 3702 | for (i=0; i < op_classes.num_classes; i++) |
| 3703 | { |
| 3704 | |
| 3705 | limLog(pMac, LOG1, "supported op_class[%d]=%d", i, |
| 3706 | op_classes.classes[i]); |
| 3707 | |
| 3708 | } |
| 3709 | } |
| 3710 | |
Kiran V | 1ccee93 | 2012-12-12 14:49:46 -0800 | [diff] [blame] | 3711 | #endif |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3712 | // tdlsoffchan |
| 3713 | /* |
| 3714 | * Process Channel Switch from SME. |
| 3715 | */ |
| 3716 | tSirRetStatus limProcesSmeTdlsChanSwitchReq(tpAniSirGlobal pMac, |
| 3717 | tANI_U32 *pMsgBuf) |
| 3718 | { |
| 3719 | /* get all discovery request parameters */ |
| 3720 | tSirTdlsChanSwitch *pTdlsChanSwitch = (tSirTdlsChanSwitch*) pMsgBuf ; |
| 3721 | tpPESession psessionEntry; |
| 3722 | tANI_U8 sessionId; |
| 3723 | tpTdlsChanSwitchParams pMsgTdlsChanSwitch; |
| 3724 | tSirMsgQ msg; |
| 3725 | tANI_U16 peerIdx = 0; |
| 3726 | tpDphHashNode pStaDs = NULL; |
| 3727 | |
| 3728 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3729 | ("TDLS Channel Switch Recieved on peer:" MAC_ADDRESS_STR), |
| 3730 | MAC_ADDR_ARRAY(pTdlsChanSwitch->peerMac)); |
| 3731 | |
| 3732 | psessionEntry = peFindSessionByBssid(pMac, |
| 3733 | pTdlsChanSwitch->bssid, |
| 3734 | &sessionId); |
| 3735 | if (psessionEntry == NULL) |
| 3736 | { |
| 3737 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3738 | "PE Session does not exist for given sme sessionId %d", |
| 3739 | pTdlsChanSwitch->sessionId); |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3740 | limSendSmeTdlsChanSwitchReqRsp(pMac, pTdlsChanSwitch->sessionId, |
| 3741 | pTdlsChanSwitch->peerMac, |
| 3742 | NULL, eSIR_FAILURE) ; |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3743 | return eSIR_FAILURE; |
| 3744 | } |
| 3745 | |
| 3746 | /* check if we are in proper state to work as TDLS client */ |
| 3747 | if (psessionEntry->limSystemRole != eLIM_STA_ROLE) |
| 3748 | { |
| 3749 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3750 | "TDLS Channel Switch received in wrong system Role %d", |
| 3751 | psessionEntry->limSystemRole); |
| 3752 | goto lim_tdls_chan_switch_error; |
| 3753 | } |
| 3754 | |
| 3755 | /* |
| 3756 | * if we are still good, go ahead and check if we are in proper state to |
| 3757 | * do TDLS discovery req/rsp/....frames. |
| 3758 | */ |
| 3759 | if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) && |
| 3760 | (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)) |
| 3761 | { |
| 3762 | |
| 3763 | limLog(pMac, LOGE, "TDLS Channel Switch received in invalid LIMsme state (%d)", |
| 3764 | psessionEntry->limSmeState); |
| 3765 | goto lim_tdls_chan_switch_error; |
| 3766 | } |
| 3767 | |
| 3768 | pStaDs = dphLookupHashEntry(pMac, pTdlsChanSwitch->peerMac, &peerIdx, |
| 3769 | &psessionEntry->dph.dphHashTable) ; |
| 3770 | if ( NULL == pStaDs ) |
| 3771 | { |
| 3772 | limLog( pMac, LOGE, FL( "pStaDs is NULL" )); |
| 3773 | goto lim_tdls_chan_switch_error; |
| 3774 | |
| 3775 | } |
| 3776 | pMsgTdlsChanSwitch = vos_mem_malloc(sizeof( tTdlsChanSwitchParams )); |
| 3777 | if ( NULL == pMsgTdlsChanSwitch ) |
| 3778 | { |
| 3779 | limLog( pMac, LOGE, |
| 3780 | FL( "Unable to allocate memory TDLS Channel Switch" )); |
| 3781 | return eSIR_MEM_ALLOC_FAILED; |
| 3782 | } |
| 3783 | |
| 3784 | vos_mem_set( (tANI_U8 *)pMsgTdlsChanSwitch, sizeof(tpTdlsChanSwitchParams), 0); |
| 3785 | |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 3786 | /* if channel bw offset is not set, |
| 3787 | send maximum supported offset in the band */ |
| 3788 | if (pTdlsChanSwitch->tdlsOffChBwOffset == 0) |
| 3789 | { |
| 3790 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3791 | ("Set TDLS channel Bw Offset")); |
| 3792 | |
| 3793 | if ((pTdlsChanSwitch->tdlsOffCh >= 1) && |
| 3794 | (pTdlsChanSwitch->tdlsOffCh <= 14)) |
| 3795 | { |
| 3796 | pTdlsChanSwitch->tdlsOffChBwOffset = BW20; |
| 3797 | } |
| 3798 | else if ((pTdlsChanSwitch->tdlsOffCh >= 36) && |
| 3799 | (pTdlsChanSwitch->tdlsOffCh <= 169)) |
| 3800 | { |
| 3801 | pTdlsChanSwitch->tdlsOffChBwOffset = |
| 3802 | limGetOffChMaxBwOffsetFromChannel( |
| 3803 | pMac->scan.countryCodeCurrent, |
| 3804 | pTdlsChanSwitch->tdlsOffCh, |
| 3805 | pStaDs->mlmStaContext.vhtCapability); |
| 3806 | } |
| 3807 | } |
| 3808 | else |
| 3809 | { |
| 3810 | /* Channel Bandwidth Offset is set through iwpriv ioctl */ |
| 3811 | (pTdlsChanSwitch->tdlsOffChBwOffset)--; |
| 3812 | } |
| 3813 | |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3814 | pMsgTdlsChanSwitch->staIdx = pStaDs->staIndex; |
| 3815 | pMsgTdlsChanSwitch->tdlsOffCh = pTdlsChanSwitch->tdlsOffCh; |
| 3816 | pMsgTdlsChanSwitch->tdlsOffChBwOffset = pTdlsChanSwitch->tdlsOffChBwOffset; |
| 3817 | pMsgTdlsChanSwitch->tdlsSwMode = pTdlsChanSwitch->tdlsSwMode; |
| 3818 | pMsgTdlsChanSwitch->operClass = limGetOPClassFromChannel( |
| 3819 | pMac->scan.countryCodeCurrent, |
| 3820 | pTdlsChanSwitch->tdlsOffCh, |
| 3821 | pTdlsChanSwitch->tdlsOffChBwOffset); |
Pradeep Reddy POTTETI | e8bd41a | 2015-01-29 14:52:43 +0530 | [diff] [blame] | 3822 | |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3823 | if(pMsgTdlsChanSwitch->operClass == 0) |
| 3824 | { |
| 3825 | |
| 3826 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, |
| 3827 | "Invalid Operating class 0 !!!"); |
Kaushik, Sushant | 651a534 | 2014-10-31 18:31:45 +0530 | [diff] [blame] | 3828 | vos_mem_free(pMsgTdlsChanSwitch); |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3829 | goto lim_tdls_chan_switch_error; |
| 3830 | } |
| 3831 | else |
| 3832 | { |
| 3833 | |
| 3834 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
Ganesh Kondabattini | b554d29 | 2015-02-11 14:37:25 +0530 | [diff] [blame] | 3835 | "%s: TDLS Channel Switch params: staIdx %d class %d ch %d bw %d" |
| 3836 | " mode %d country code %c%c", |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3837 | __func__, |
| 3838 | pMsgTdlsChanSwitch->staIdx, |
| 3839 | pMsgTdlsChanSwitch->operClass, |
| 3840 | pMsgTdlsChanSwitch->tdlsOffCh, |
| 3841 | pMsgTdlsChanSwitch->tdlsOffChBwOffset, |
Ganesh Kondabattini | b554d29 | 2015-02-11 14:37:25 +0530 | [diff] [blame] | 3842 | pMsgTdlsChanSwitch->tdlsSwMode, |
| 3843 | pMac->scan.countryCodeCurrent[0], |
| 3844 | pMac->scan.countryCodeCurrent[1]); |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3845 | } |
| 3846 | |
| 3847 | msg.type = WDA_SET_TDLS_CHAN_SWITCH_REQ; |
| 3848 | msg.reserved = 0; |
| 3849 | msg.bodyptr = pMsgTdlsChanSwitch; |
| 3850 | msg.bodyval = 0; |
| 3851 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 3852 | { |
| 3853 | limLog(pMac, LOGE, FL("halPostMsgApi failed\n")); |
Kaushik, Sushant | 651a534 | 2014-10-31 18:31:45 +0530 | [diff] [blame] | 3854 | vos_mem_free(pMsgTdlsChanSwitch); |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3855 | goto lim_tdls_chan_switch_error; |
| 3856 | } |
| 3857 | |
| 3858 | return eSIR_SUCCESS; |
| 3859 | |
| 3860 | lim_tdls_chan_switch_error: |
Atul Mittal | 60bd429 | 2014-08-14 12:19:27 +0530 | [diff] [blame] | 3861 | limSendSmeTdlsChanSwitchReqRsp(pMac, pTdlsChanSwitch->sessionId, |
| 3862 | pTdlsChanSwitch->peerMac, |
| 3863 | NULL, eSIR_FAILURE); |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 3864 | return eSIR_FAILURE; |
| 3865 | } |
| 3866 | |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 3867 | /* |
| 3868 | * Set 20_40 BSS Coex IE in TDLS frames. |
| 3869 | */ |
| 3870 | tSirRetStatus limProcessSmeSetTdls2040BSSCoexReq(tpAniSirGlobal pMac, |
| 3871 | tANI_U32 *pMsgBuf) |
| 3872 | { |
| 3873 | tAniSetTdls2040BSSCoex *pmsg = NULL; |
| 3874 | pmsg = (tAniSetTdls2040BSSCoex*) pMsgBuf ; |
| 3875 | |
| 3876 | if (NULL != pmsg) { |
| 3877 | pMac->lim.EnableTdls2040BSSCoexIE = pmsg->SetTdls2040BSSCoex; |
| 3878 | } |
| 3879 | VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, |
| 3880 | "%s: 20_40 BSS Coex IE in TDLS frames " |
| 3881 | "pMac->lim.EnableTdls2040BSSCoexIE %d ", __func__, |
| 3882 | pMac->lim.EnableTdls2040BSSCoexIE); |
| 3883 | |
| 3884 | return eSIR_SUCCESS; |
| 3885 | } |
| 3886 | |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 3887 | tSirRetStatus limProcessSmeDelAllTdlsPeers(tpAniSirGlobal pMac, |
| 3888 | tANI_U32 *pMsgBuf) |
| 3889 | { |
| 3890 | tSirDelAllTdlsPeers *pMsg = NULL; |
| 3891 | tpDphHashNode pStaDs = NULL ; |
| 3892 | tpPESession psessionEntry = NULL; |
| 3893 | uint8_t sessionId; |
| 3894 | int i, aid; |
| 3895 | pMsg = (tSirDelAllTdlsPeers*) pMsgBuf ; |
| 3896 | |
| 3897 | if (pMsg == NULL) { |
| 3898 | limLog(pMac, LOGE, FL("NULL pMsg")); |
| 3899 | return eSIR_FAILURE; |
| 3900 | } |
| 3901 | |
| 3902 | psessionEntry = peFindSessionByBssid(pMac, pMsg->bssid, &sessionId); |
| 3903 | if (NULL == psessionEntry) |
| 3904 | { |
| 3905 | limLog(pMac, LOGE, FL("NULL psessionEntry")); |
| 3906 | return eSIR_FAILURE; |
| 3907 | } |
| 3908 | |
| 3909 | /* Check all the set bit in peerAIDBitmap and delete the |
| 3910 | * peer (with that aid) entry from the hash table and add |
| 3911 | * the aid in free pool |
| 3912 | */ |
| 3913 | for (i = 0; i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32); i++) |
| 3914 | { |
| 3915 | for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) |
| 3916 | { |
| 3917 | if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) |
| 3918 | { |
| 3919 | pStaDs = dphGetHashEntry(pMac, |
| 3920 | (aid + i*(sizeof(tANI_U32) << 3)), |
| 3921 | &psessionEntry->dph.dphHashTable); |
| 3922 | if (NULL != pStaDs) |
| 3923 | { |
| 3924 | limLog(pMac, LOGE, FL("Deleting "MAC_ADDRESS_STR), |
| 3925 | MAC_ADDR_ARRAY(pStaDs->staAddr)); |
| 3926 | |
| 3927 | limSendDeauthMgmtFrame(pMac, |
| 3928 | eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
| 3929 | pStaDs->staAddr, psessionEntry, |
| 3930 | FALSE); |
Masti, Narayanraddi | 471e938 | 2015-07-23 18:51:29 +0530 | [diff] [blame] | 3931 | |
| 3932 | limTdlsDelSta(pMac, pStaDs->staAddr, psessionEntry); |
| 3933 | |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 3934 | dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, |
| 3935 | &psessionEntry->dph.dphHashTable); |
| 3936 | } |
| 3937 | limReleasePeerIdx(pMac, (aid + i*(sizeof(tANI_U32) << 3)), |
| 3938 | psessionEntry) ; |
| 3939 | CLEAR_BIT(psessionEntry->peerAIDBitmap[i], aid); |
| 3940 | } |
| 3941 | } |
| 3942 | } |
| 3943 | |
| 3944 | return eSIR_SUCCESS; |
| 3945 | } |