Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | /** |
| 42 | * \file limSendManagementFrames.c |
| 43 | * |
| 44 | * \brief Code for preparing and sending 802.11 Management frames |
| 45 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 46 | * |
| 47 | */ |
| 48 | |
| 49 | #include "sirApi.h" |
| 50 | #include "aniGlobal.h" |
| 51 | #include "sirMacProtDef.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 52 | #include "cfgApi.h" |
| 53 | #include "utilsApi.h" |
| 54 | #include "limTypes.h" |
| 55 | #include "limUtils.h" |
| 56 | #include "limSecurityUtils.h" |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 57 | #include "limPropExtsUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | #include "dot11f.h" |
| 59 | #include "limStaHashApi.h" |
| 60 | #include "schApi.h" |
| 61 | #include "limSendMessages.h" |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 62 | #include "limAssocUtils.h" |
| 63 | #include "limFT.h" |
| 64 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | #if defined WLAN_FEATURE_VOWIFI |
| 66 | #include "rrmApi.h" |
| 67 | #endif |
| 68 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 69 | #include "wlan_qct_wda.h" |
| 70 | #ifdef WLAN_FEATURE_11W |
| 71 | #include "dot11fdefs.h" |
| 72 | #endif |
| 73 | |
| 74 | |
| 75 | //////////////////////////////////////////////////////////////////////// |
| 76 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * |
| 80 | * \brief This function is called by various LIM modules to prepare the |
| 81 | * 802.11 frame MAC header |
| 82 | * |
| 83 | * |
| 84 | * \param pMac Pointer to Global MAC structure |
| 85 | * |
| 86 | * \param pBD Pointer to the frame buffer that needs to be populate |
| 87 | * |
| 88 | * \param type Type of the frame |
| 89 | * |
| 90 | * \param subType Subtype of the frame |
| 91 | * |
| 92 | * \return eHalStatus |
| 93 | * |
| 94 | * |
| 95 | * The pFrameBuf argument points to the beginning of the frame buffer to |
| 96 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 97 | * will be the MGMT frame payload The payload itself is populated by the |
| 98 | * caller API |
| 99 | * |
| 100 | * |
| 101 | */ |
| 102 | |
| 103 | tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac, |
| 104 | tANI_U8* pBD, |
| 105 | tANI_U8 type, |
| 106 | tANI_U8 subType, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 107 | tSirMacAddr peerAddr, tSirMacAddr selfMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | { |
| 109 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 110 | tpSirMacMgmtHdr pMacHdr; |
| 111 | |
| 112 | /// Prepare MAC management header |
| 113 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 114 | |
| 115 | // Prepare FC |
| 116 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 117 | pMacHdr->fc.type = type; |
| 118 | pMacHdr->fc.subType = subType; |
| 119 | |
| 120 | // Prepare Address 1 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 121 | vos_mem_copy( (tANI_U8 *) pMacHdr->da, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | (tANI_U8 *) peerAddr, |
| 123 | sizeof( tSirMacAddr )); |
| 124 | |
| 125 | // Prepare Address 2 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 126 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 127 | |
| 128 | // Prepare Address 3 |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 129 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 130 | (tANI_U8 *) peerAddr, |
| 131 | sizeof( tSirMacAddr )); |
| 132 | return statusCode; |
| 133 | } /*** end limPopulateMacHeader() ***/ |
| 134 | |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 135 | #ifdef WLAN_FEATURE_11W |
| 136 | /** |
| 137 | * |
| 138 | * \brief This function is called by various LIM modules to correctly set |
| 139 | * the Protected bit in the Frame Control Field of the 802.11 frame MAC header |
| 140 | * |
| 141 | * |
| 142 | * \param pMac Pointer to Global MAC structure |
| 143 | * |
| 144 | * \param psessionEntry Pointer to session corresponding to the connection |
| 145 | * |
| 146 | * \param peer Peer address of the STA to which the frame is to be sent |
| 147 | * |
| 148 | * \param pMacHdr Pointer to the frame MAC header |
| 149 | * |
| 150 | * \return nothing |
| 151 | * |
| 152 | * |
| 153 | */ |
| 154 | void |
| 155 | limSetProtectedBit(tpAniSirGlobal pMac, |
| 156 | tpPESession psessionEntry, |
| 157 | tSirMacAddr peer, |
| 158 | tpSirMacMgmtHdr pMacHdr) |
| 159 | { |
| 160 | tANI_U16 aid; |
| 161 | tpDphHashNode pStaDs; |
| 162 | |
| 163 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || |
| 164 | (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 165 | { |
| 166 | |
| 167 | pStaDs = dphLookupHashEntry( pMac, peer, &aid, &psessionEntry->dph.dphHashTable ); |
| 168 | if( pStaDs != NULL ) |
| 169 | if( pStaDs->rmfEnabled ) |
| 170 | pMacHdr->fc.wep = 1; |
| 171 | } |
| 172 | else if ( psessionEntry->limRmfEnabled ) |
| 173 | pMacHdr->fc.wep = 1; |
| 174 | } /*** end limSetProtectedBit() ***/ |
| 175 | #endif |
| 176 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | /** |
| 178 | * \brief limSendProbeReqMgmtFrame |
| 179 | * |
| 180 | * |
| 181 | * \param pMac Pointer to Global MAC structure |
| 182 | * |
| 183 | * \param pSsid SSID to be sent in Probe Request frame |
| 184 | * |
| 185 | * \param bssid BSSID to be sent in Probe Request frame |
| 186 | * |
| 187 | * \param nProbeDelay probe delay to be used before sending Probe Request |
| 188 | * frame |
| 189 | * |
| 190 | * \param nChannelNum Channel # on which the Probe Request is going out |
| 191 | * |
| 192 | * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame |
| 193 | * |
| 194 | * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame |
| 195 | * |
| 196 | * This function is called by various LIM modules to send Probe Request frame |
| 197 | * during active scan/learn phase. |
| 198 | * Probe request is sent out in the following scenarios: |
| 199 | * --heartbeat failure: session needed |
| 200 | * --join req: session needed |
| 201 | * --foreground scan: no session |
| 202 | * --background scan: no session |
| 203 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 204 | * |
| 205 | * |
| 206 | */ |
| 207 | tSirRetStatus |
| 208 | limSendProbeReqMgmtFrame(tpAniSirGlobal pMac, |
| 209 | tSirMacSSid *pSsid, |
| 210 | tSirMacAddr bssid, |
| 211 | tANI_U8 nChannelNum, |
| 212 | tSirMacAddr SelfMacAddr, |
| 213 | tANI_U32 dot11mode, |
| 214 | tANI_U32 nAdditionalIELen, |
| 215 | tANI_U8 *pAdditionalIE) |
| 216 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 217 | tDot11fProbeRequest pr; |
| 218 | tANI_U32 nStatus, nBytes, nPayload; |
| 219 | tSirRetStatus nSirStatus; |
| 220 | tANI_U8 *pFrame; |
| 221 | void *pPacket; |
| 222 | eHalStatus halstatus; |
| 223 | tpPESession psessionEntry; |
| 224 | tANI_U8 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 225 | tANI_U8 *p2pIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 226 | tANI_U32 txFlag = 0; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 227 | tANI_U32 chanbond24G = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 228 | |
| 229 | #ifndef GEN4_SCAN |
| 230 | return eSIR_FAILURE; |
| 231 | #endif |
| 232 | |
| 233 | #if defined ( ANI_DVT_DEBUG ) |
| 234 | return eSIR_FAILURE; |
| 235 | #endif |
| 236 | |
Abhishek Singh | 4beed42 | 2014-02-03 16:47:17 +0530 | [diff] [blame^] | 237 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 238 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 239 | * is false and dot11mode is 11ac set it to 11n. |
| 240 | */ |
| 241 | if ( nChannelNum <= SIR_11B_CHANNEL_END && |
| 242 | ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) && |
| 243 | ( WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 244 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) ) |
| 245 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 246 | /* |
| 247 | * session context may or may not be present, when probe request needs to be sent out. |
| 248 | * following cases exist: |
| 249 | * --heartbeat failure: session needed |
| 250 | * --join req: session needed |
| 251 | * --foreground scan: no session |
| 252 | * --background scan: no session |
| 253 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 254 | * If session context does not exist, some IEs will be populated from CFGs, |
| 255 | * e.g. Supported and Extended rate set IEs |
| 256 | */ |
| 257 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 258 | |
| 259 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 260 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 261 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 262 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | |
| 264 | // & delegating to assorted helpers: |
| 265 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 266 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 267 | if( nAdditionalIELen && pAdditionalIE ) |
| 268 | { |
| 269 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 270 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 271 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 272 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 273 | ( p2pIe != NULL ) && |
| 274 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 275 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 276 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 277 | ( ( psessionEntry != NULL ) && |
| 278 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 279 | ) |
| 280 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 281 | { |
| 282 | /* In the below API pass channel number > 14, do that it fills only |
| 283 | * 11a rates in supported rates */ |
| 284 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 285 | } |
| 286 | else |
| 287 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 289 | &pr.SuppRates,psessionEntry); |
| 290 | |
| 291 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 292 | { |
| 293 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 294 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 295 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | |
| 297 | #if defined WLAN_FEATURE_VOWIFI |
| 298 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 299 | //DS params "can" be present in RRM is disabled and "is" present if |
| 300 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 301 | //RRM is not enabled. |
| 302 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 303 | //Call RRM module to get the tx power for management used. |
| 304 | { |
| 305 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 306 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 307 | } |
| 308 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 309 | |
| 310 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 311 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 312 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 313 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 314 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 315 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 317 | } else { //psessionEntry == NULL |
| 318 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 319 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 320 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 321 | } |
| 322 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 323 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 324 | /* Get HT40 capability for 2.4GHz band */ |
| 325 | wlan_cfgGetInt(pMac,WNI_CFG_CHANNEL_BONDING_24G,&chanbond24G); |
| 326 | if( (nChannelNum <= SIR_11B_CHANNEL_END) && chanbond24G != TRUE) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 327 | { |
| 328 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 329 | pr.HTCaps.shortGI40MHz = 0; |
| 330 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 331 | #ifdef WLAN_FEATURE_11AC |
| 332 | if (psessionEntry != NULL ) { |
| 333 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 334 | //Include HT Capability IE |
| 335 | if (psessionEntry->vhtCapability) |
| 336 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 337 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 338 | } |
| 339 | } else { |
| 340 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 341 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 342 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 343 | } |
| 344 | } |
| 345 | #endif |
| 346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 347 | |
| 348 | // That's it-- now we pack it. First, how much space are we going to |
| 349 | // need? |
| 350 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 351 | if ( DOT11F_FAILED( nStatus ) ) |
| 352 | { |
| 353 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 354 | "or a Probe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | // We'll fall back on the worst case scenario: |
| 356 | nPayload = sizeof( tDot11fProbeRequest ); |
| 357 | } |
| 358 | else if ( DOT11F_WARNED( nStatus ) ) |
| 359 | { |
| 360 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 361 | "the packed size for a Probe Request (" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 362 | "0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen; |
| 366 | |
| 367 | // Ok-- try to allocate some memory: |
| 368 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 369 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 370 | ( void** ) &pPacket ); |
| 371 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 372 | { |
| 373 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 374 | "be Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 375 | return eSIR_MEM_ALLOC_FAILED; |
| 376 | } |
| 377 | |
| 378 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 379 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | |
| 381 | // Next, we fill out the buffer descriptor: |
| 382 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 383 | SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 384 | if ( eSIR_SUCCESS != nSirStatus ) |
| 385 | { |
| 386 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 387 | "tor for a Probe Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | nSirStatus ); |
| 389 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 390 | ( void* ) pFrame, ( void* ) pPacket ); |
| 391 | return nSirStatus; // allocated! |
| 392 | } |
| 393 | |
| 394 | // That done, pack the Probe Request: |
| 395 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 396 | sizeof( tSirMacMgmtHdr ), |
| 397 | nPayload, &nPayload ); |
| 398 | if ( DOT11F_FAILED( nStatus ) ) |
| 399 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 400 | limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | nStatus ); |
| 402 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 403 | return eSIR_FAILURE; // allocated! |
| 404 | } |
| 405 | else if ( DOT11F_WARNED( nStatus ) ) |
| 406 | { |
| 407 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 408 | "robe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 409 | } |
| 410 | |
| 411 | // Append any AddIE if present. |
| 412 | if( nAdditionalIELen ) |
| 413 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 414 | vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 415 | pAdditionalIE, nAdditionalIELen ); |
| 416 | nPayload += nAdditionalIELen; |
| 417 | } |
| 418 | |
| 419 | /* If this probe request is sent during P2P Search State, then we need |
| 420 | * to send it at OFDM rate. |
| 421 | */ |
| 422 | if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 423 | || (( pMac->lim.gpLimMlmScanReq != NULL) && |
| 424 | pMac->lim.gpLimMlmScanReq->p2pSearch ) |
Gopichand Nakkala | 6796721 | 2013-02-15 17:31:15 +0530 | [diff] [blame] | 425 | /* For unicast probe req mgmt from Join function |
| 426 | we don't set above variables. So we need to add |
| 427 | one more check whether it is pePersona is P2P_CLIENT or not */ |
| 428 | || ( ( psessionEntry != NULL ) && |
| 429 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 430 | ) |
| 431 | { |
| 432 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 433 | } |
| 434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 435 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 436 | HAL_TXRX_FRM_802_11_MGMT, |
| 437 | ANI_TXDIR_TODS, |
| 438 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 439 | limTxComplete, pFrame, txFlag ); |
| 440 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 441 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 442 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 443 | //Pkt will be freed up by the callback |
| 444 | return eSIR_FAILURE; |
| 445 | } |
| 446 | |
| 447 | return eSIR_SUCCESS; |
| 448 | } // End limSendProbeReqMgmtFrame. |
| 449 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 450 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 451 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 452 | tANI_U8 probeReqP2pIe) |
| 453 | { |
| 454 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 455 | from additional IE */ |
| 456 | if(!probeReqP2pIe) |
| 457 | { |
| 458 | tANI_U8* tempbuf = NULL; |
| 459 | tANI_U16 tempLen = 0; |
| 460 | int left = *addnIELen; |
| 461 | v_U8_t *ptr = addIE; |
| 462 | v_U8_t elem_id, elem_len; |
| 463 | |
| 464 | if(NULL == addIE) |
| 465 | { |
| 466 | PELOGE(limLog(pMac, LOGE, |
| 467 | FL(" NULL addIE pointer"));) |
| 468 | return eSIR_FAILURE; |
| 469 | } |
| 470 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 471 | tempbuf = vos_mem_malloc(left); |
| 472 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 473 | { |
| 474 | PELOGE(limLog(pMac, LOGE, |
| 475 | FL("Unable to allocate memory to store addn IE"));) |
| 476 | return eSIR_MEM_ALLOC_FAILED; |
| 477 | } |
| 478 | |
| 479 | while(left >= 2) |
| 480 | { |
| 481 | elem_id = ptr[0]; |
| 482 | elem_len = ptr[1]; |
| 483 | left -= 2; |
| 484 | if(elem_len > left) |
| 485 | { |
| 486 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 487 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 489 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | return eSIR_FAILURE; |
| 491 | } |
| 492 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 493 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 494 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 495 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 496 | tempLen += (elem_len + 2); |
| 497 | } |
| 498 | left -= elem_len; |
| 499 | ptr += (elem_len + 2); |
| 500 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 501 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 503 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 504 | } |
| 505 | return eSIR_SUCCESS; |
| 506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 507 | |
| 508 | void |
| 509 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 510 | tSirMacAddr peerMacAddr, |
| 511 | tpAniSSID pSsid, |
| 512 | short nStaId, |
| 513 | tANI_U8 nKeepAlive, |
| 514 | tpPESession psessionEntry, |
| 515 | tANI_U8 probeReqP2pIe) |
| 516 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 517 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 518 | tSirRetStatus nSirStatus; |
| 519 | tANI_U32 cfg, nPayload, nBytes, nStatus; |
| 520 | tpSirMacMgmtHdr pMacHdr; |
| 521 | tANI_U8 *pFrame; |
| 522 | void *pPacket; |
| 523 | eHalStatus halstatus; |
| 524 | tANI_U32 addnIEPresent; |
| 525 | tANI_U32 addnIE1Len=0; |
| 526 | tANI_U32 addnIE2Len=0; |
| 527 | tANI_U32 addnIE3Len=0; |
| 528 | tANI_U16 totalAddnIeLen = 0; |
| 529 | tANI_U32 wpsApEnable=0, tmp; |
| 530 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 531 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 532 | tANI_U8 *pP2pIe = NULL; |
| 533 | tANI_U8 noaLen = 0; |
| 534 | tANI_U8 total_noaLen = 0; |
| 535 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 536 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 537 | tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 538 | |
| 539 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 540 | { |
| 541 | return; // in this case. |
| 542 | } |
| 543 | |
| 544 | if(NULL == psessionEntry) |
| 545 | { |
| 546 | return; |
| 547 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 548 | |
| 549 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 550 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 551 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 552 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 553 | return; |
| 554 | } |
| 555 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 556 | // Fill out 'frm', after which we'll just hand the struct off to |
| 557 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 558 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 559 | |
| 560 | // Timestamp to be updated by TFP, below. |
| 561 | |
| 562 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 563 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 564 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 565 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | } |
| 567 | else |
| 568 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 569 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 570 | if (eSIR_SUCCESS != nSirStatus) |
| 571 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 572 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BEACON_INTERVAL from CFG (%d)."), |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 573 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 574 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 575 | return; |
| 576 | } |
| 577 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 579 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 580 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 581 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 582 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 583 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 584 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 585 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 586 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 587 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 590 | { |
| 591 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 592 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 593 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 594 | } |
| 595 | } |
| 596 | else |
| 597 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 598 | if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 599 | limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_ENABLE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 601 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 602 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 603 | if (wpsApEnable) |
| 604 | { |
| 605 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 606 | } |
| 607 | |
| 608 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 609 | { |
| 610 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 611 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 612 | } |
| 613 | |
| 614 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 615 | { |
| 616 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 617 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 618 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 619 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 620 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 621 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 622 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 623 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 624 | |
| 625 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 626 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 627 | |
| 628 | |
| 629 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 630 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 631 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 632 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 633 | |
| 634 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 635 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 636 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 637 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 638 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 639 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 640 | #ifdef WLAN_FEATURE_11AC |
| 641 | if(psessionEntry->vhtCapability) |
| 642 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 643 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 644 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
| 645 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 646 | // we do not support multi users yet |
| 647 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 648 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 649 | } |
| 650 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 651 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 652 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 653 | if ( psessionEntry->pLimStartBssReq ) |
| 654 | { |
| 655 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 656 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 657 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 658 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | } |
| 660 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 661 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 662 | |
| 663 | #if defined(FEATURE_WLAN_WAPI) |
| 664 | if( psessionEntry->pLimStartBssReq ) |
| 665 | { |
| 666 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 667 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 668 | } |
| 669 | |
| 670 | #endif // defined(FEATURE_WLAN_WAPI) |
| 671 | |
| 672 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 673 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 674 | if ( DOT11F_FAILED( nStatus ) ) |
| 675 | { |
| 676 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 677 | "or a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 678 | nStatus ); |
| 679 | // We'll fall back on the worst case scenario: |
| 680 | nPayload = sizeof( tDot11fProbeResponse ); |
| 681 | } |
| 682 | else if ( DOT11F_WARNED( nStatus ) ) |
| 683 | { |
| 684 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 685 | "the packed size for a Probe Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 686 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 690 | |
| 691 | addnIEPresent = false; |
| 692 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 693 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 694 | { |
| 695 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 696 | } |
| 697 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 698 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 699 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 700 | { |
| 701 | |
| 702 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 703 | &addnIEPresent) != eSIR_SUCCESS) |
| 704 | { |
| 705 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 706 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | return; |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | if (addnIEPresent) |
| 712 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 713 | |
| 714 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 715 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 716 | { |
| 717 | PELOGE(limLog(pMac, LOGE, |
| 718 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 719 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 720 | return; |
| 721 | } |
| 722 | |
| 723 | //Probe rsp IE available |
| 724 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 725 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 726 | { |
| 727 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 728 | vos_mem_free(addIE); |
| 729 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 730 | return; |
| 731 | } |
| 732 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 733 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 734 | { |
| 735 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 736 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 737 | &addnIE1Len) ) |
| 738 | { |
| 739 | limLog(pMac, LOGP, |
| 740 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 741 | vos_mem_free(addIE); |
| 742 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 743 | return; |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | //Probe rsp IE available |
| 748 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 749 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 750 | { |
| 751 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 752 | vos_mem_free(addIE); |
| 753 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 754 | return; |
| 755 | } |
| 756 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 757 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 758 | { |
| 759 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 760 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 761 | &addnIE2Len) ) |
| 762 | { |
| 763 | limLog(pMac, LOGP, |
| 764 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 765 | vos_mem_free(addIE); |
| 766 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 767 | return; |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | //Probe rsp IE available |
| 772 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 773 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 774 | { |
| 775 | limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 776 | vos_mem_free(addIE); |
| 777 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 778 | return; |
| 779 | } |
| 780 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 781 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 782 | { |
| 783 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 784 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 785 | &addIE[addnIE1Len + addnIE2Len], |
| 786 | &addnIE3Len) ) |
| 787 | { |
| 788 | limLog(pMac, LOGP, |
| 789 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 790 | vos_mem_free(addIE); |
| 791 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 792 | return; |
| 793 | } |
| 794 | } |
| 795 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 796 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 798 | { |
| 799 | limLog(pMac, LOGP, |
| 800 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 801 | vos_mem_free(addIE); |
| 802 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 803 | return; |
| 804 | } |
| 805 | nBytes = nBytes + totalAddnIeLen; |
| 806 | |
| 807 | if (probeReqP2pIe) |
| 808 | { |
| 809 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 810 | if (pP2pIe != NULL) |
| 811 | { |
| 812 | //get NoA attribute stream P2P IE |
| 813 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 814 | if (noaLen != 0) |
| 815 | { |
| 816 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 817 | &noaStream[0], noaLen); |
| 818 | nBytes = nBytes + total_noaLen; |
| 819 | } |
| 820 | } |
| 821 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | } |
| 823 | |
| 824 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 825 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 826 | ( void** ) &pPacket ); |
| 827 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 828 | { |
| 829 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 830 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 831 | if ( addIE != NULL ) |
| 832 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 833 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 835 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 836 | return; |
| 837 | } |
| 838 | |
| 839 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 840 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 841 | |
| 842 | // Next, we fill out the buffer descriptor: |
| 843 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 844 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 845 | if ( eSIR_SUCCESS != nSirStatus ) |
| 846 | { |
| 847 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 848 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 849 | nSirStatus ); |
| 850 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 851 | ( void* ) pFrame, ( void* ) pPacket ); |
| 852 | if ( addIE != NULL ) |
| 853 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 854 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 855 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 856 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 857 | return; |
| 858 | } |
| 859 | |
| 860 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 861 | |
| 862 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 863 | |
| 864 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 865 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | nPayload, &nPayload ); |
| 867 | if ( DOT11F_FAILED( nStatus ) ) |
| 868 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 869 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 870 | nStatus ); |
| 871 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 872 | if ( addIE != NULL ) |
| 873 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 874 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 875 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 876 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 877 | return; // allocated! |
| 878 | } |
| 879 | else if ( DOT11F_WARNED( nStatus ) ) |
| 880 | { |
| 881 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 882 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 883 | } |
| 884 | |
| 885 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 886 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 887 | |
| 888 | pMac->sys.probeRespond++; |
| 889 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 890 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 891 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 892 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 893 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 895 | |
| 896 | if ( addnIEPresent ) |
| 897 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 898 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 899 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 900 | if (noaLen != 0) |
| 901 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 902 | if (total_noaLen > (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 903 | { |
| 904 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 905 | FL("Not able to insert NoA because of length constraint." |
| 906 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 907 | vos_mem_free(addIE); |
| 908 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 909 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 910 | ( void* ) pFrame, ( void* ) pPacket ); |
| 911 | return; |
| 912 | } |
| 913 | else |
| 914 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 915 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 916 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 917 | } |
| 918 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 919 | |
| 920 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 921 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 922 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | ) |
| 924 | { |
| 925 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 926 | } |
| 927 | |
| 928 | // Queue Probe Response frame in high priority WQ |
| 929 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 930 | ( tANI_U16 ) nBytes, |
| 931 | HAL_TXRX_FRM_802_11_MGMT, |
| 932 | ANI_TXDIR_TODS, |
| 933 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 934 | limTxComplete, pFrame, txFlag ); |
| 935 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 936 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 937 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 938 | //Pkt will be freed up by the callback |
| 939 | } |
| 940 | |
| 941 | if ( addIE != NULL ) |
| 942 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 943 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 944 | } |
| 945 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 946 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 947 | return; |
| 948 | |
| 949 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 950 | } // End limSendProbeRspMgmtFrame. |
| 951 | |
| 952 | void |
| 953 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 954 | tSirMacAddr peerMacAddr, |
| 955 | tSirAddtsReqInfo *pAddTS, |
| 956 | tpPESession psessionEntry) |
| 957 | { |
| 958 | tANI_U16 i; |
| 959 | tANI_U8 *pFrame; |
| 960 | tSirRetStatus nSirStatus; |
| 961 | tDot11fAddTSRequest AddTSReq; |
| 962 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 963 | tANI_U32 nPayload, nBytes, nStatus; |
| 964 | tpSirMacMgmtHdr pMacHdr; |
| 965 | void *pPacket; |
| 966 | #ifdef FEATURE_WLAN_CCX |
| 967 | tANI_U32 phyMode; |
| 968 | #endif |
| 969 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 970 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 971 | |
| 972 | if(NULL == psessionEntry) |
| 973 | { |
| 974 | return; |
| 975 | } |
| 976 | |
| 977 | if ( ! pAddTS->wmeTspecPresent ) |
| 978 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 979 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | |
| 981 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 982 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 983 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 984 | if ( pAddTS->lleTspecPresent ) |
| 985 | { |
| 986 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 987 | } |
| 988 | else |
| 989 | { |
| 990 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 991 | } |
| 992 | |
| 993 | if ( pAddTS->lleTspecPresent ) |
| 994 | { |
| 995 | AddTSReq.num_WMMTCLAS = 0; |
| 996 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 997 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 998 | { |
| 999 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1000 | &AddTSReq.TCLAS[i] ); |
| 1001 | } |
| 1002 | } |
| 1003 | else |
| 1004 | { |
| 1005 | AddTSReq.num_TCLAS = 0; |
| 1006 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 1007 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 1008 | { |
| 1009 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1010 | &AddTSReq.WMMTCLAS[i] ); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | if ( pAddTS->tclasProcPresent ) |
| 1015 | { |
| 1016 | if ( pAddTS->lleTspecPresent ) |
| 1017 | { |
| 1018 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1019 | AddTSReq.TCLASSPROC.present = 1; |
| 1020 | } |
| 1021 | else |
| 1022 | { |
| 1023 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1024 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1025 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1030 | if ( DOT11F_FAILED( nStatus ) ) |
| 1031 | { |
| 1032 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1033 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | nStatus ); |
| 1035 | // We'll fall back on the worst case scenario: |
| 1036 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1037 | } |
| 1038 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1039 | { |
| 1040 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1041 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1042 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1043 | } |
| 1044 | } |
| 1045 | else |
| 1046 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1047 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1048 | |
| 1049 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1050 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1051 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1052 | |
| 1053 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1054 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1055 | |
| 1056 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
| 1057 | #ifdef FEATURE_WLAN_CCX |
| 1058 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1059 | |
| 1060 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1061 | { |
| 1062 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1063 | } |
| 1064 | else |
| 1065 | { |
| 1066 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1067 | } |
| 1068 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.CCXTrafStrmRateSet,sizeof(tANI_U8)); |
| 1069 | #endif |
| 1070 | // fillWmeTspecIE |
| 1071 | |
| 1072 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1073 | if ( DOT11F_FAILED( nStatus ) ) |
| 1074 | { |
| 1075 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1076 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | nStatus ); |
| 1078 | // We'll fall back on the worst case scenario: |
| 1079 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1080 | } |
| 1081 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1082 | { |
| 1083 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1084 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1085 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1086 | } |
| 1087 | } |
| 1088 | |
| 1089 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1090 | |
| 1091 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1092 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1093 | ( void** ) &pPacket ); |
| 1094 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1095 | { |
| 1096 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1097 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1098 | return; |
| 1099 | } |
| 1100 | |
| 1101 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1102 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1103 | |
| 1104 | // Next, we fill out the buffer descriptor: |
| 1105 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1106 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1107 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1108 | { |
| 1109 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1110 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1111 | nSirStatus ); |
| 1112 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1113 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1114 | return; |
| 1115 | } |
| 1116 | |
| 1117 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1118 | |
| 1119 | #if 0 |
| 1120 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1121 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1122 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1123 | { |
| 1124 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1125 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1127 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1128 | return; |
| 1129 | } |
| 1130 | #endif //TO SUPPORT BT-AMP |
| 1131 | |
| 1132 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1133 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1134 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1135 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1136 | #endif |
| 1137 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1138 | // That done, pack the struct: |
| 1139 | if ( ! pAddTS->wmeTspecPresent ) |
| 1140 | { |
| 1141 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1142 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1143 | nPayload, &nPayload ); |
| 1144 | if ( DOT11F_FAILED( nStatus ) ) |
| 1145 | { |
| 1146 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1147 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | nStatus ); |
| 1149 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1150 | return; // allocated! |
| 1151 | } |
| 1152 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1153 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1154 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1155 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1156 | } |
| 1157 | } |
| 1158 | else |
| 1159 | { |
| 1160 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1161 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1162 | nPayload, &nPayload ); |
| 1163 | if ( DOT11F_FAILED( nStatus ) ) |
| 1164 | { |
| 1165 | limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1166 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1167 | nStatus ); |
| 1168 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1169 | return; // allocated! |
| 1170 | } |
| 1171 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1172 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1173 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1174 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1175 | } |
| 1176 | } |
| 1177 | |
| 1178 | PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") ); |
| 1179 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1180 | |
| 1181 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1182 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1183 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1184 | ) |
| 1185 | { |
| 1186 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1187 | } |
| 1188 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1189 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1190 | psessionEntry->peSessionId, |
| 1191 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1192 | // Queue Addts Response frame in high priority WQ |
| 1193 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1194 | HAL_TXRX_FRM_802_11_MGMT, |
| 1195 | ANI_TXDIR_TODS, |
| 1196 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1197 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1198 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1199 | psessionEntry->peSessionId, |
| 1200 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1202 | { |
| 1203 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1204 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1205 | //Pkt will be freed up by the callback |
| 1206 | } |
| 1207 | |
| 1208 | } // End limSendAddtsReqActionFrame. |
| 1209 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1210 | |
| 1211 | |
| 1212 | void |
| 1213 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1214 | tANI_U16 statusCode, |
| 1215 | tANI_U16 aid, |
| 1216 | tSirMacAddr peerMacAddr, |
| 1217 | tANI_U8 subType, |
| 1218 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1219 | { |
| 1220 | static tDot11fAssocResponse frm; |
| 1221 | tANI_U8 *pFrame, *macAddr; |
| 1222 | tpSirMacMgmtHdr pMacHdr; |
| 1223 | tSirRetStatus nSirStatus; |
| 1224 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1225 | tHalBitVal qosMode, wmeMode; |
| 1226 | tANI_U32 nPayload, nBytes, nStatus; |
| 1227 | void *pPacket; |
| 1228 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1229 | tUpdateBeaconParams beaconParams; |
| 1230 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1231 | tANI_U32 addnIEPresent = false; |
| 1232 | tANI_U32 addnIELen=0; |
| 1233 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1234 | tpSirAssocReq pAssocReq = NULL; |
| 1235 | |
| 1236 | if(NULL == psessionEntry) |
| 1237 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1238 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | return; |
| 1240 | } |
| 1241 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1242 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1243 | |
| 1244 | limGetQosMode(psessionEntry, &qosMode); |
| 1245 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1246 | |
| 1247 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1248 | // STA sent a traffic spec. |
| 1249 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1250 | |
| 1251 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1252 | |
| 1253 | frm.Status.status = statusCode; |
| 1254 | |
| 1255 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1256 | |
| 1257 | if ( NULL == pSta ) |
| 1258 | { |
| 1259 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1260 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1261 | } |
| 1262 | else |
| 1263 | { |
| 1264 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1265 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1266 | } |
| 1267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1268 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1269 | { |
| 1270 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1271 | { |
| 1272 | pAssocReq = |
| 1273 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1274 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1275 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1276 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1278 | } |
| 1279 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | |
| 1281 | if ( NULL != pSta ) |
| 1282 | { |
| 1283 | if ( eHAL_SET == qosMode ) |
| 1284 | { |
| 1285 | if ( pSta->lleEnabled ) |
| 1286 | { |
| 1287 | lleMode = 1; |
| 1288 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1289 | { |
| 1290 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1291 | |
| 1292 | // FramesToDo:... |
| 1293 | // if ( fAddTS ) |
| 1294 | // { |
| 1295 | // tANI_U8 *pAf = pBody; |
| 1296 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1297 | // tANI_U32 tlen; |
| 1298 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1299 | // &tlen, bufLen - frameLen); |
| 1300 | // } // End if on Add TS. |
| 1301 | } |
| 1302 | } // End if on .11e enabled in 'pSta'. |
| 1303 | } // End if on QOS Mode on. |
| 1304 | |
| 1305 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1306 | { |
| 1307 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1308 | { |
| 1309 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1310 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1311 | |
| 1312 | if ( pSta->wsmEnabled ) |
| 1313 | { |
| 1314 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1315 | } |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | if ( pSta->aniPeer ) |
| 1320 | { |
| 1321 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1322 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1323 | { |
| 1324 | edcaInclude = 1; |
| 1325 | } |
| 1326 | |
| 1327 | } // End if on Airgo peer. |
| 1328 | |
| 1329 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1330 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1331 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1332 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1333 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1334 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1335 | |
| 1336 | #ifdef WLAN_FEATURE_11AC |
| 1337 | if( pSta->mlmStaContext.vhtCapability && |
| 1338 | psessionEntry->vhtCapability ) |
| 1339 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1340 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1341 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
| 1342 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1343 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1344 | } |
| 1345 | #endif |
| 1346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | } // End if on non-NULL 'pSta'. |
| 1348 | |
| 1349 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1350 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1352 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1353 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1354 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1355 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1356 | |
| 1357 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1358 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1359 | |
| 1360 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1361 | |
| 1362 | //Send message to HAL about beacon parameter change. |
| 1363 | if(beaconParams.paramChangeBitmap) |
| 1364 | { |
| 1365 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1366 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1367 | } |
| 1368 | |
| 1369 | // Allocate a buffer for this frame: |
| 1370 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1371 | if ( DOT11F_FAILED( nStatus ) ) |
| 1372 | { |
| 1373 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1374 | "or an Association Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1375 | nStatus ); |
| 1376 | return; |
| 1377 | } |
| 1378 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1379 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1380 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1381 | "the packed size for an Association Re" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1382 | "sponse (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1383 | } |
| 1384 | |
| 1385 | nBytes = sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1386 | |
| 1387 | if ( pAssocReq != NULL ) |
| 1388 | { |
| 1389 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1390 | &addnIEPresent) != eSIR_SUCCESS) |
| 1391 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1392 | limLog(pMac, LOGP, FL("Unable to get " |
| 1393 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1394 | return; |
| 1395 | } |
| 1396 | |
| 1397 | if (addnIEPresent) |
| 1398 | { |
| 1399 | //Assoc rsp IE available |
| 1400 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1401 | &addnIELen) != eSIR_SUCCESS) |
| 1402 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1403 | limLog(pMac, LOGP, FL("Unable to get " |
| 1404 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | return; |
| 1406 | } |
| 1407 | |
| 1408 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1409 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1410 | { |
| 1411 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1412 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1413 | { |
| 1414 | nBytes = nBytes + addnIELen; |
| 1415 | } |
| 1416 | } |
| 1417 | } |
| 1418 | } |
| 1419 | |
| 1420 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1421 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1422 | ( void** ) &pPacket ); |
| 1423 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1424 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1425 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1426 | return; |
| 1427 | } |
| 1428 | |
| 1429 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1430 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1431 | |
| 1432 | // Next, we fill out the buffer descriptor: |
| 1433 | nSirStatus = limPopulateMacHeader( pMac, |
| 1434 | pFrame, |
| 1435 | SIR_MAC_MGMT_FRAME, |
| 1436 | ( LIM_ASSOC == subType ) ? |
| 1437 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1438 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1439 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1440 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1441 | { |
| 1442 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1443 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1444 | nSirStatus ); |
| 1445 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1446 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1447 | return; |
| 1448 | } |
| 1449 | |
| 1450 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1452 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1453 | |
| 1454 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1455 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1456 | nPayload, &nPayload ); |
| 1457 | if ( DOT11F_FAILED( nStatus ) ) |
| 1458 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1459 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1460 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1461 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1462 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1463 | return; // allocated! |
| 1464 | } |
| 1465 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1466 | { |
| 1467 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1468 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1469 | } |
| 1470 | |
| 1471 | macAddr = pMacHdr->da; |
| 1472 | |
| 1473 | if (subType == LIM_ASSOC) |
| 1474 | { |
| 1475 | PELOG1(limLog(pMac, LOG1, |
| 1476 | FL("*** Sending Assoc Resp status %d aid %d to "), |
| 1477 | statusCode, aid);) |
| 1478 | } |
| 1479 | else{ |
| 1480 | PELOG1(limLog(pMac, LOG1, |
| 1481 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
| 1482 | statusCode, aid);) |
| 1483 | } |
| 1484 | PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1485 | |
| 1486 | if ( addnIEPresent ) |
| 1487 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1488 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1489 | } |
| 1490 | |
| 1491 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1492 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1493 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1494 | ) |
| 1495 | { |
| 1496 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1497 | } |
| 1498 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1499 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1500 | psessionEntry->peSessionId, |
| 1501 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1502 | /// Queue Association Response frame in high priority WQ |
| 1503 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1504 | HAL_TXRX_FRM_802_11_MGMT, |
| 1505 | ANI_TXDIR_TODS, |
| 1506 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1507 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1508 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1509 | psessionEntry->peSessionId, |
| 1510 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1511 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1512 | { |
| 1513 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1514 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1515 | nSirStatus); |
| 1516 | |
| 1517 | //Pkt will be freed up by the callback |
| 1518 | } |
| 1519 | |
| 1520 | // update the ANI peer station count |
| 1521 | //FIXME_PROTECTION : take care of different type of station |
| 1522 | // counter inside this function. |
| 1523 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1524 | |
| 1525 | } // End limSendAssocRspMgmtFrame. |
| 1526 | |
| 1527 | |
| 1528 | |
| 1529 | void |
| 1530 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1531 | tSirMacAddr peer, |
| 1532 | tANI_U16 nStatusCode, |
| 1533 | tSirAddtsReqInfo *pAddTS, |
| 1534 | tSirMacScheduleIE *pSchedule, |
| 1535 | tpPESession psessionEntry) |
| 1536 | { |
| 1537 | tANI_U8 *pFrame; |
| 1538 | tpSirMacMgmtHdr pMacHdr; |
| 1539 | tDot11fAddTSResponse AddTSRsp; |
| 1540 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1541 | tSirRetStatus nSirStatus; |
| 1542 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1543 | void *pPacket; |
| 1544 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1545 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | |
| 1547 | if(NULL == psessionEntry) |
| 1548 | { |
| 1549 | return; |
| 1550 | } |
| 1551 | |
| 1552 | if ( ! pAddTS->wmeTspecPresent ) |
| 1553 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1554 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1555 | |
| 1556 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1557 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1558 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1559 | AddTSRsp.Status.status = nStatusCode; |
| 1560 | |
| 1561 | // The TsDelay information element is only filled in for a specific |
| 1562 | // status code: |
| 1563 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1564 | { |
| 1565 | if ( pAddTS->wsmTspecPresent ) |
| 1566 | { |
| 1567 | AddTSRsp.WMMTSDelay.version = 1; |
| 1568 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1569 | AddTSRsp.WMMTSDelay.present = 1; |
| 1570 | } |
| 1571 | else |
| 1572 | { |
| 1573 | AddTSRsp.TSDelay.delay = 10; |
| 1574 | AddTSRsp.TSDelay.present = 1; |
| 1575 | } |
| 1576 | } |
| 1577 | |
| 1578 | if ( pAddTS->wsmTspecPresent ) |
| 1579 | { |
| 1580 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1581 | } |
| 1582 | else |
| 1583 | { |
| 1584 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1585 | } |
| 1586 | |
| 1587 | if ( pAddTS->wsmTspecPresent ) |
| 1588 | { |
| 1589 | AddTSRsp.num_WMMTCLAS = 0; |
| 1590 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1591 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1592 | { |
| 1593 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1594 | &AddTSRsp.TCLAS[i] ); |
| 1595 | } |
| 1596 | } |
| 1597 | else |
| 1598 | { |
| 1599 | AddTSRsp.num_TCLAS = 0; |
| 1600 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1601 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1602 | { |
| 1603 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1604 | &AddTSRsp.WMMTCLAS[i] ); |
| 1605 | } |
| 1606 | } |
| 1607 | |
| 1608 | if ( pAddTS->tclasProcPresent ) |
| 1609 | { |
| 1610 | if ( pAddTS->wsmTspecPresent ) |
| 1611 | { |
| 1612 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1613 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1614 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1615 | } |
| 1616 | else |
| 1617 | { |
| 1618 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1619 | AddTSRsp.TCLASSPROC.present = 1; |
| 1620 | } |
| 1621 | } |
| 1622 | |
| 1623 | // schedule element is included only if requested in the tspec and we are |
| 1624 | // using hcca (or both edca and hcca) |
| 1625 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1626 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1627 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1628 | // sta figure it out |
| 1629 | if ((pSchedule != NULL) && |
| 1630 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1631 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1632 | { |
| 1633 | if ( pAddTS->wsmTspecPresent ) |
| 1634 | { |
| 1635 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1636 | } |
| 1637 | else |
| 1638 | { |
| 1639 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1640 | } |
| 1641 | } |
| 1642 | |
| 1643 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1644 | if ( DOT11F_FAILED( nStatus ) ) |
| 1645 | { |
| 1646 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1647 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1648 | nStatus ); |
| 1649 | // We'll fall back on the worst case scenario: |
| 1650 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1651 | } |
| 1652 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1653 | { |
| 1654 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1655 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1656 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1657 | } |
| 1658 | } |
| 1659 | else |
| 1660 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1661 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1662 | |
| 1663 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1664 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1665 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1666 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1667 | |
| 1668 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1669 | |
| 1670 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1671 | if ( DOT11F_FAILED( nStatus ) ) |
| 1672 | { |
| 1673 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1674 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1675 | nStatus ); |
| 1676 | // We'll fall back on the worst case scenario: |
| 1677 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1678 | } |
| 1679 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1680 | { |
| 1681 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1682 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1683 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1684 | } |
| 1685 | } |
| 1686 | |
| 1687 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1688 | |
| 1689 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1690 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1691 | { |
| 1692 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1693 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1694 | return; |
| 1695 | } |
| 1696 | |
| 1697 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1698 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1699 | |
| 1700 | // Next, we fill out the buffer descriptor: |
| 1701 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1702 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1703 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1704 | { |
| 1705 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1706 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1707 | nSirStatus ); |
| 1708 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1709 | return; // allocated! |
| 1710 | } |
| 1711 | |
| 1712 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1713 | |
| 1714 | |
| 1715 | #if 0 |
| 1716 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1717 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1718 | { |
| 1719 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1720 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1721 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1722 | return; // allocated! |
| 1723 | } |
| 1724 | #endif //TO SUPPORT BT-AMP |
| 1725 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1726 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1727 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1728 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1729 | #endif |
| 1730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1731 | // That done, pack the struct: |
| 1732 | if ( ! pAddTS->wmeTspecPresent ) |
| 1733 | { |
| 1734 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1735 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1736 | nPayload, &nPayload ); |
| 1737 | if ( DOT11F_FAILED( nStatus ) ) |
| 1738 | { |
| 1739 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1740 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1741 | nStatus ); |
| 1742 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1743 | return; |
| 1744 | } |
| 1745 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1746 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1747 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1748 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1749 | } |
| 1750 | } |
| 1751 | else |
| 1752 | { |
| 1753 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1754 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1755 | nPayload, &nPayload ); |
| 1756 | if ( DOT11F_FAILED( nStatus ) ) |
| 1757 | { |
| 1758 | limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1759 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1760 | nStatus ); |
| 1761 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1762 | return; |
| 1763 | } |
| 1764 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1765 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1766 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1767 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1768 | } |
| 1769 | } |
| 1770 | |
| 1771 | PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
| 1772 | nStatusCode ); |
| 1773 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 1774 | |
| 1775 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1776 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1777 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1778 | ) |
| 1779 | { |
| 1780 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1781 | } |
| 1782 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1783 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1784 | psessionEntry->peSessionId, |
| 1785 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1786 | // Queue the frame in high priority WQ: |
| 1787 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1788 | HAL_TXRX_FRM_802_11_MGMT, |
| 1789 | ANI_TXDIR_TODS, |
| 1790 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1791 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1792 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1793 | psessionEntry->peSessionId, |
| 1794 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1795 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1796 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1797 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1798 | nSirStatus ); |
| 1799 | //Pkt will be freed up by the callback |
| 1800 | } |
| 1801 | |
| 1802 | } // End limSendAddtsRspActionFrame. |
| 1803 | |
| 1804 | void |
| 1805 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 1806 | tSirMacAddr peer, |
| 1807 | tANI_U8 wmmTspecPresent, |
| 1808 | tSirMacTSInfo *pTsinfo, |
| 1809 | tSirMacTspecIE *pTspecIe, |
| 1810 | tpPESession psessionEntry) |
| 1811 | { |
| 1812 | tANI_U8 *pFrame; |
| 1813 | tpSirMacMgmtHdr pMacHdr; |
| 1814 | tDot11fDelTS DelTS; |
| 1815 | tDot11fWMMDelTS WMMDelTS; |
| 1816 | tSirRetStatus nSirStatus; |
| 1817 | tANI_U32 nBytes, nPayload, nStatus; |
| 1818 | void *pPacket; |
| 1819 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1820 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1821 | |
| 1822 | if(NULL == psessionEntry) |
| 1823 | { |
| 1824 | return; |
| 1825 | } |
| 1826 | |
| 1827 | if ( ! wmmTspecPresent ) |
| 1828 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1829 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1830 | |
| 1831 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1832 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1833 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 1834 | |
| 1835 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 1836 | if ( DOT11F_FAILED( nStatus ) ) |
| 1837 | { |
| 1838 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1839 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1840 | nStatus ); |
| 1841 | // We'll fall back on the worst case scenario: |
| 1842 | nPayload = sizeof( tDot11fDelTS ); |
| 1843 | } |
| 1844 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1845 | { |
| 1846 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 1847 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1848 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1849 | } |
| 1850 | } |
| 1851 | else |
| 1852 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1853 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1854 | |
| 1855 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 1856 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1857 | WMMDelTS.DialogToken.token = 0; |
| 1858 | WMMDelTS.StatusCode.statusCode = 0; |
| 1859 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 1860 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 1861 | if ( DOT11F_FAILED( nStatus ) ) |
| 1862 | { |
| 1863 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1864 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1865 | nStatus ); |
| 1866 | // We'll fall back on the worst case scenario: |
| 1867 | nPayload = sizeof( tDot11fDelTS ); |
| 1868 | } |
| 1869 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1870 | { |
| 1871 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 1872 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1873 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1874 | } |
| 1875 | } |
| 1876 | |
| 1877 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1878 | |
| 1879 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1880 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1881 | { |
| 1882 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1883 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1884 | return; |
| 1885 | } |
| 1886 | |
| 1887 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1888 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1889 | |
| 1890 | // Next, we fill out the buffer descriptor: |
| 1891 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1892 | SIR_MAC_MGMT_ACTION, peer, |
| 1893 | psessionEntry->selfMacAddr); |
| 1894 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1895 | { |
| 1896 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1897 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1898 | nSirStatus ); |
| 1899 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1900 | return; // allocated! |
| 1901 | } |
| 1902 | |
| 1903 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1904 | |
| 1905 | #if 0 |
| 1906 | |
| 1907 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1908 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1909 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1910 | { |
| 1911 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1912 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1913 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1914 | return; // allocated! |
| 1915 | } |
| 1916 | #endif //TO SUPPORT BT-AMP |
| 1917 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 1918 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1919 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1920 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1921 | #endif |
| 1922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | // That done, pack the struct: |
| 1924 | if ( !wmmTspecPresent ) |
| 1925 | { |
| 1926 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 1927 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1928 | nPayload, &nPayload ); |
| 1929 | if ( DOT11F_FAILED( nStatus ) ) |
| 1930 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1931 | limLog( pMac, LOGE, FL("Failed to pack a Del TS frame (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1932 | nStatus ); |
| 1933 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1934 | return; // allocated! |
| 1935 | } |
| 1936 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1937 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1938 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1939 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1940 | } |
| 1941 | } |
| 1942 | else |
| 1943 | { |
| 1944 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 1945 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1946 | nPayload, &nPayload ); |
| 1947 | if ( DOT11F_FAILED( nStatus ) ) |
| 1948 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1949 | limLog( pMac, LOGE, FL("Failed to pack a WMM Del TS frame (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1950 | nStatus ); |
| 1951 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1952 | return; // allocated! |
| 1953 | } |
| 1954 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1955 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1956 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1957 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | } |
| 1959 | } |
| 1960 | |
| 1961 | PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 1962 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1963 | |
| 1964 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1966 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1967 | ) |
| 1968 | { |
| 1969 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1970 | } |
| 1971 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1972 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1973 | psessionEntry->peSessionId, |
| 1974 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1975 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1976 | HAL_TXRX_FRM_802_11_MGMT, |
| 1977 | ANI_TXDIR_TODS, |
| 1978 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1979 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 1980 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1981 | psessionEntry->peSessionId, |
| 1982 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1983 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1984 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1985 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1986 | nSirStatus ); |
| 1987 | //Pkt will be freed up by the callback |
| 1988 | } |
| 1989 | |
| 1990 | } // End limSendDeltsReqActionFrame. |
| 1991 | |
| 1992 | void |
| 1993 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 1994 | tLimMlmAssocReq *pMlmAssocReq, |
| 1995 | tpPESession psessionEntry) |
| 1996 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1997 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1998 | tANI_U16 caps; |
| 1999 | tANI_U8 *pFrame; |
| 2000 | tSirRetStatus nSirStatus; |
| 2001 | tLimMlmAssocCnf mlmAssocCnf; |
| 2002 | tANI_U32 nBytes, nPayload, nStatus; |
| 2003 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2004 | void *pPacket; |
| 2005 | eHalStatus halstatus; |
| 2006 | tANI_U16 nAddIELen; |
| 2007 | tANI_U8 *pAddIE; |
| 2008 | tANI_U8 *wpsIe = NULL; |
| 2009 | #if defined WLAN_FEATURE_VOWIFI |
| 2010 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2011 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2012 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2013 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2014 | |
| 2015 | if(NULL == psessionEntry) |
| 2016 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2017 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2018 | return; |
| 2019 | } |
| 2020 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | /* check this early to avoid unncessary operation */ |
| 2022 | if(NULL == psessionEntry->pLimJoinReq) |
| 2023 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2024 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2025 | return; |
| 2026 | } |
| 2027 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2028 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2029 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2030 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2031 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2032 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2033 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2034 | return; |
| 2035 | } |
| 2036 | |
| 2037 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2038 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2039 | |
| 2040 | caps = pMlmAssocReq->capabilityInfo; |
| 2041 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2042 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2043 | #if defined(FEATURE_WLAN_WAPI) |
| 2044 | /* CR: 262463 : |
| 2045 | According to WAPI standard: |
| 2046 | 7.3.1.4 Capability Information field |
| 2047 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2048 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2049 | Reassociation management frames. */ |
| 2050 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2051 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2052 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2053 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2054 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2055 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2056 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2057 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2058 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2059 | |
| 2060 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2061 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2062 | |
| 2063 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2064 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2065 | |
| 2066 | // We prefer .11e asociations: |
| 2067 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2068 | |
| 2069 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2070 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2071 | |
| 2072 | if ( psessionEntry->lim11hEnable && |
| 2073 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2074 | { |
| 2075 | #if defined WLAN_FEATURE_VOWIFI |
| 2076 | PowerCapsPopulated = TRUE; |
| 2077 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2078 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2079 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2080 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | |
| 2082 | } |
| 2083 | |
| 2084 | #if defined WLAN_FEATURE_VOWIFI |
| 2085 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2086 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2087 | { |
| 2088 | if (PowerCapsPopulated == FALSE) |
| 2089 | { |
| 2090 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2091 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2092 | } |
| 2093 | } |
| 2094 | #endif |
| 2095 | |
| 2096 | if ( fQosEnabled && |
| 2097 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2098 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | |
| 2100 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2101 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2102 | |
| 2103 | #if defined WLAN_FEATURE_VOWIFI |
| 2104 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2105 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2106 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2107 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2108 | } |
| 2109 | #endif |
| 2110 | // The join request *should* contain zero or one of the WPA and RSN |
| 2111 | // IEs. The payload send along with the request is a |
| 2112 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2113 | |
| 2114 | // typedef struct sSirRSNie |
| 2115 | // { |
| 2116 | // tANI_U16 length; |
| 2117 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2118 | // } tSirRSNie, *tpSirRSNie; |
| 2119 | |
| 2120 | // So, we should be able to make the following two calls harmlessly, |
| 2121 | // since they do nothing if they don't find the given IE in the |
| 2122 | // bytestream with which they're provided. |
| 2123 | |
| 2124 | // The net effect of this will be to faithfully transmit whatever |
| 2125 | // security IE is in the join request. |
| 2126 | |
| 2127 | // *However*, if we're associating for the purpose of WPS |
| 2128 | // enrollment, and we've been configured to indicate that by |
| 2129 | // eliding the WPA or RSN IE, we just skip this: |
| 2130 | if( nAddIELen && pAddIE ) |
| 2131 | { |
| 2132 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2133 | } |
| 2134 | if ( NULL == wpsIe ) |
| 2135 | { |
| 2136 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2137 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2138 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2139 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | #if defined(FEATURE_WLAN_WAPI) |
| 2141 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2142 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2143 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2144 | } |
| 2145 | |
| 2146 | // include WME EDCA IE as well |
| 2147 | if ( fWmeEnabled ) |
| 2148 | { |
| 2149 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2150 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2151 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2152 | } |
| 2153 | |
| 2154 | if ( fWsmEnabled && |
| 2155 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2156 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2157 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2158 | } |
| 2159 | } |
| 2160 | |
| 2161 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2162 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2163 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2164 | pMac->lim.htCapabilityPresentInBeacon) |
| 2165 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2166 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2167 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2168 | |
| 2169 | /* |
| 2170 | * To resolve the interop problem with Broadcom AP, |
| 2171 | * where TQ STA could not pass traffic with GF enabled, |
| 2172 | * TQ STA will do Greenfield only with TQ AP, for |
| 2173 | * everybody else it will be turned off. |
| 2174 | */ |
| 2175 | |
| 2176 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2177 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2178 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2179 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2180 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2181 | } |
| 2182 | #endif |
| 2183 | |
| 2184 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2185 | #ifdef WLAN_FEATURE_11AC |
| 2186 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2187 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2188 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2189 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2190 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2191 | } |
| 2192 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2193 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2194 | |
| 2195 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2196 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2197 | { |
| 2198 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2199 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2200 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2201 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2202 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2203 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2204 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2205 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2206 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2207 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2208 | { |
| 2209 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2210 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2211 | } |
| 2212 | #endif |
| 2213 | |
| 2214 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2215 | /* For CCX Associations fill the CCX IEs */ |
| 2216 | if (psessionEntry->isCCXconnection && |
| 2217 | psessionEntry->pLimJoinReq->isCCXFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2218 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2219 | #ifndef FEATURE_DISABLE_RM |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2220 | PopulateDot11fCCXRadMgmtCap(&pFrm->CCXRadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2221 | #endif |
Sandeep Puligilla | e9ffdf6 | 2013-11-23 18:23:00 +0530 | [diff] [blame] | 2222 | PopulateDot11fCCXVersion(&pFrm->CCXVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2223 | } |
| 2224 | #endif |
| 2225 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2226 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2227 | if ( DOT11F_FAILED( nStatus ) ) |
| 2228 | { |
| 2229 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2230 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2231 | nStatus ); |
| 2232 | // We'll fall back on the worst case scenario: |
| 2233 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2234 | } |
| 2235 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2236 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2237 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2238 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2239 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2240 | } |
| 2241 | |
| 2242 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2243 | |
| 2244 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2245 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2246 | ( void** ) &pPacket ); |
| 2247 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2248 | { |
| 2249 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2250 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | |
| 2252 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2253 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2254 | |
| 2255 | |
| 2256 | /* Update PE session id*/ |
| 2257 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2258 | |
| 2259 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2260 | |
| 2261 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2262 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2263 | |
| 2264 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2265 | ( tANI_U32* ) &mlmAssocCnf); |
| 2266 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2267 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2268 | return; |
| 2269 | } |
| 2270 | |
| 2271 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2272 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2273 | |
| 2274 | // Next, we fill out the buffer descriptor: |
| 2275 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2276 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2277 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2278 | { |
| 2279 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2280 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2281 | nSirStatus ); |
| 2282 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2283 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2284 | return; |
| 2285 | } |
| 2286 | |
| 2287 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2288 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2289 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2290 | sizeof(tSirMacMgmtHdr), |
| 2291 | nPayload, &nPayload ); |
| 2292 | if ( DOT11F_FAILED( nStatus ) ) |
| 2293 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2294 | limLog( pMac, LOGE, FL("Failed to pack a Assoc Request (0x%0" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2295 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2296 | nStatus ); |
| 2297 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2298 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2299 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2300 | return; |
| 2301 | } |
| 2302 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2303 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2304 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2305 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2306 | } |
| 2307 | |
| 2308 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2309 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2310 | nBytes );) |
| 2311 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2312 | |
| 2313 | if( psessionEntry->assocReq != NULL ) |
| 2314 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2315 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2316 | psessionEntry->assocReq = NULL; |
| 2317 | } |
| 2318 | |
| 2319 | if( nAddIELen ) |
| 2320 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2321 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2322 | pAddIE, |
| 2323 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2324 | nPayload += nAddIELen; |
| 2325 | } |
| 2326 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2327 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2328 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2329 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2330 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2331 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2332 | } |
| 2333 | else |
| 2334 | { |
| 2335 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2336 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2337 | psessionEntry->assocReqLen = nPayload; |
| 2338 | } |
| 2339 | |
| 2340 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2341 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2342 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2343 | ) |
| 2344 | { |
| 2345 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2346 | } |
| 2347 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2348 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2349 | { |
| 2350 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2351 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2352 | |
| 2353 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2354 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2355 | psessionEntry->peSessionId, |
| 2356 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2357 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2358 | HAL_TXRX_FRM_802_11_MGMT, |
| 2359 | ANI_TXDIR_TODS, |
| 2360 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2361 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2362 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2363 | psessionEntry->peSessionId, |
| 2364 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2365 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2366 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2367 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2368 | halstatus ); |
| 2369 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2370 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | return; |
| 2372 | } |
| 2373 | |
| 2374 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2375 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2376 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2377 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2378 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2379 | } // End limSendAssocReqMgmtFrame |
| 2380 | |
| 2381 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2382 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2383 | /*------------------------------------------------------------------------------------ |
| 2384 | * |
| 2385 | * Send Reassoc Req with FTIEs. |
| 2386 | * |
| 2387 | *----------------------------------------------------------------------------------- |
| 2388 | */ |
| 2389 | void |
| 2390 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2391 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2392 | { |
| 2393 | static tDot11fReAssocRequest frm; |
| 2394 | tANI_U16 caps; |
| 2395 | tANI_U8 *pFrame; |
| 2396 | tSirRetStatus nSirStatus; |
| 2397 | tANI_U32 nBytes, nPayload, nStatus; |
| 2398 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2399 | void *pPacket; |
| 2400 | eHalStatus halstatus; |
| 2401 | #if defined WLAN_FEATURE_VOWIFI |
| 2402 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2403 | #endif |
| 2404 | tANI_U16 ft_ies_length = 0; |
| 2405 | tANI_U8 *pBody; |
| 2406 | tANI_U16 nAddIELen; |
| 2407 | tANI_U8 *pAddIE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2408 | #if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2409 | tANI_U8 *wpsIe = NULL; |
| 2410 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2411 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2412 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2413 | |
| 2414 | if (NULL == psessionEntry) |
| 2415 | { |
| 2416 | return; |
| 2417 | } |
| 2418 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2419 | /* check this early to avoid unncessary operation */ |
| 2420 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2421 | { |
| 2422 | return; |
| 2423 | } |
| 2424 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2425 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2426 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2427 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2428 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2429 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2430 | |
| 2431 | caps = pMlmReassocReq->capabilityInfo; |
| 2432 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2433 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2434 | #if defined(FEATURE_WLAN_WAPI) |
| 2435 | /* CR: 262463 : |
| 2436 | According to WAPI standard: |
| 2437 | 7.3.1.4 Capability Information field |
| 2438 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2439 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2440 | Reassociation management frames. */ |
| 2441 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2442 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2443 | #endif |
| 2444 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2445 | |
| 2446 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2447 | |
| 2448 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2449 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2450 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2451 | |
| 2452 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2453 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2454 | &frm.SuppRates,psessionEntry); |
| 2455 | |
| 2456 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2457 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2458 | |
| 2459 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2460 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2461 | |
| 2462 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2463 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2464 | |
| 2465 | if ( psessionEntry->lim11hEnable && |
| 2466 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2467 | { |
| 2468 | #if defined WLAN_FEATURE_VOWIFI |
| 2469 | PowerCapsPopulated = TRUE; |
| 2470 | |
| 2471 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2472 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2473 | #endif |
| 2474 | } |
| 2475 | |
| 2476 | #if defined WLAN_FEATURE_VOWIFI |
| 2477 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2478 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2479 | { |
| 2480 | if (PowerCapsPopulated == FALSE) |
| 2481 | { |
| 2482 | PowerCapsPopulated = TRUE; |
| 2483 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2484 | } |
| 2485 | } |
| 2486 | #endif |
| 2487 | |
| 2488 | if ( fQosEnabled && |
| 2489 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2490 | { |
| 2491 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2492 | } |
| 2493 | |
| 2494 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2495 | &frm.ExtSuppRates, psessionEntry ); |
| 2496 | |
| 2497 | #if defined WLAN_FEATURE_VOWIFI |
| 2498 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2499 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2500 | { |
| 2501 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2502 | } |
| 2503 | #endif |
| 2504 | |
| 2505 | // Ideally this should be enabled for 11r also. But 11r does |
| 2506 | // not follow the usual norm of using the Opaque object |
| 2507 | // for rsnie and fties. Instead we just add |
| 2508 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2509 | // This should ideally! be fixed. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2510 | #if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2511 | // |
| 2512 | // The join request *should* contain zero or one of the WPA and RSN |
| 2513 | // IEs. The payload send along with the request is a |
| 2514 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2515 | |
| 2516 | // typedef struct sSirRSNie |
| 2517 | // { |
| 2518 | // tANI_U16 length; |
| 2519 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2520 | // } tSirRSNie, *tpSirRSNie; |
| 2521 | |
| 2522 | // So, we should be able to make the following two calls harmlessly, |
| 2523 | // since they do nothing if they don't find the given IE in the |
| 2524 | // bytestream with which they're provided. |
| 2525 | |
| 2526 | // The net effect of this will be to faithfully transmit whatever |
| 2527 | // security IE is in the join request. |
| 2528 | |
| 2529 | // *However*, if we're associating for the purpose of WPS |
| 2530 | // enrollment, and we've been configured to indicate that by |
| 2531 | // eliding the WPA or RSN IE, we just skip this: |
| 2532 | if (!psessionEntry->is11Rconnection) |
| 2533 | { |
| 2534 | if( nAddIELen && pAddIE ) |
| 2535 | { |
| 2536 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2537 | } |
| 2538 | if ( NULL == wpsIe ) |
| 2539 | { |
| 2540 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2541 | &frm.RSNOpaque ); |
| 2542 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2543 | &frm.WPAOpaque ); |
| 2544 | } |
| 2545 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2546 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2547 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2548 | { |
| 2549 | PopulateDot11fCCXCckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2550 | &frm.CCXCckmOpaque ); |
| 2551 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2552 | #endif //FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2553 | } |
| 2554 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2555 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2556 | // For CCX Associations fill the CCX IEs |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2557 | if (psessionEntry->isCCXconnection && |
| 2558 | psessionEntry->pLimReAssocReq->isCCXFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2559 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2560 | #ifndef FEATURE_DISABLE_RM |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2561 | PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2562 | #endif |
Sandeep Puligilla | e9ffdf6 | 2013-11-23 18:23:00 +0530 | [diff] [blame] | 2563 | PopulateDot11fCCXVersion(&frm.CCXVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2564 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2565 | #endif //FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2566 | #endif //FEATURE_WLAN_CCX || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2567 | |
| 2568 | // include WME EDCA IE as well |
| 2569 | if ( fWmeEnabled ) |
| 2570 | { |
| 2571 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2572 | { |
| 2573 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2574 | } |
| 2575 | |
| 2576 | if ( fWsmEnabled && |
| 2577 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2578 | { |
| 2579 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2580 | } |
| 2581 | #ifdef FEATURE_WLAN_CCX |
| 2582 | if (psessionEntry->isCCXconnection) |
| 2583 | { |
| 2584 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2585 | |
| 2586 | // Populate the TSRS IE if TSPEC is included in the reassoc request |
| 2587 | if (psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs) |
| 2588 | { |
| 2589 | tANI_U32 phyMode; |
| 2590 | tSirMacCCXTSRSIE tsrsIE; |
| 2591 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2592 | |
| 2593 | tsrsIE.tsid = 0; |
| 2594 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2595 | { |
| 2596 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2597 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2598 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2599 | { |
| 2600 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2601 | } |
| 2602 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.CCXTrafStrmRateSet, sizeof(tANI_U8)); |
| 2603 | } |
| 2604 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2605 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2606 | } |
| 2607 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2608 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2609 | pMac->lim.htCapabilityPresentInBeacon) |
| 2610 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2611 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2612 | } |
| 2613 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2614 | #if defined WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2615 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && (0 == pMac->ft.ftSmeContext.reassoc_ft_ies_length) |
| 2616 | #if defined FEATURE_WLAN_CCX |
| 2617 | && !psessionEntry->isCCXconnection |
| 2618 | #endif |
| 2619 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2620 | { |
| 2621 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2622 | } |
| 2623 | #endif |
| 2624 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2625 | #ifdef WLAN_FEATURE_11AC |
| 2626 | if ( psessionEntry->vhtCapability && |
| 2627 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2628 | { |
| 2629 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
| 2630 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2631 | } |
| 2632 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2633 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2635 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2636 | if ( DOT11F_FAILED( nStatus ) ) |
| 2637 | { |
| 2638 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2639 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2640 | nStatus ); |
| 2641 | // We'll fall back on the worst case scenario: |
| 2642 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2643 | } |
| 2644 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2645 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2646 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2647 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2648 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2649 | } |
| 2650 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2651 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2652 | |
| 2653 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2654 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2656 | #endif |
| 2657 | |
| 2658 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2659 | if (psessionEntry->is11Rconnection) |
| 2660 | { |
| 2661 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2662 | } |
| 2663 | #endif |
| 2664 | |
| 2665 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2666 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2667 | ( void** ) &pPacket ); |
| 2668 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2669 | { |
| 2670 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2671 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2672 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2673 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2674 | goto end; |
| 2675 | } |
| 2676 | |
| 2677 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2678 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2679 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2680 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2681 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2682 | #endif |
| 2683 | // Next, we fill out the buffer descriptor: |
| 2684 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2685 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2686 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2687 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2688 | { |
| 2689 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2690 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2691 | nSirStatus ); |
| 2692 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2693 | goto end; |
| 2694 | } |
| 2695 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2696 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2697 | // That done, pack the ReAssoc Request: |
| 2698 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2699 | sizeof(tSirMacMgmtHdr), |
| 2700 | nPayload, &nPayload ); |
| 2701 | if ( DOT11F_FAILED( nStatus ) ) |
| 2702 | { |
| 2703 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2704 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2705 | nStatus ); |
| 2706 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2707 | goto end; |
| 2708 | } |
| 2709 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2710 | { |
| 2711 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2712 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2713 | } |
| 2714 | |
| 2715 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2716 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2717 | nBytes, nPayload );) |
| 2718 | if( psessionEntry->assocReq != NULL ) |
| 2719 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2720 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2721 | psessionEntry->assocReq = NULL; |
| 2722 | } |
| 2723 | |
| 2724 | if( nAddIELen ) |
| 2725 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2726 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2727 | pAddIE, |
| 2728 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2729 | nPayload += nAddIELen; |
| 2730 | } |
| 2731 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2732 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2733 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2734 | { |
| 2735 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2736 | } |
| 2737 | else |
| 2738 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2739 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2740 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2741 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2742 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2743 | |
| 2744 | if (psessionEntry->is11Rconnection) |
| 2745 | { |
| 2746 | { |
| 2747 | int i = 0; |
| 2748 | |
| 2749 | pBody = pFrame + nBytes; |
| 2750 | for (i=0; i<ft_ies_length; i++) |
| 2751 | { |
| 2752 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 2753 | pBody++; |
| 2754 | } |
| 2755 | } |
| 2756 | } |
| 2757 | |
| 2758 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2759 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 2760 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2761 | (tANI_U8 *)pFrame, |
| 2762 | (nBytes + ft_ies_length));) |
| 2763 | #endif |
| 2764 | |
| 2765 | |
| 2766 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2767 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2768 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2769 | ) |
| 2770 | { |
| 2771 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2772 | } |
| 2773 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2774 | if( NULL != psessionEntry->assocReq ) |
| 2775 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2776 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2777 | psessionEntry->assocReq = NULL; |
| 2778 | } |
| 2779 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2780 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 2781 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2782 | { |
| 2783 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2784 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2785 | } |
| 2786 | else |
| 2787 | { |
| 2788 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2789 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 2790 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2791 | psessionEntry->assocReqLen = (ft_ies_length); |
| 2792 | } |
| 2793 | |
| 2794 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2795 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2796 | psessionEntry->peSessionId, |
| 2797 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2798 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 2799 | HAL_TXRX_FRM_802_11_MGMT, |
| 2800 | ANI_TXDIR_TODS, |
| 2801 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2802 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2803 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2804 | psessionEntry->peSessionId, |
| 2805 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2806 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2807 | { |
| 2808 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2809 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2810 | nSirStatus ); |
| 2811 | //Pkt will be freed up by the callback |
| 2812 | goto end; |
| 2813 | } |
| 2814 | |
| 2815 | end: |
| 2816 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2817 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2818 | psessionEntry->pLimMlmReassocReq = NULL; |
| 2819 | |
| 2820 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2821 | |
| 2822 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 2823 | tLimMlmReassocReq *pMlmReassocReq, |
| 2824 | tpPESession psessionEntry) |
| 2825 | { |
| 2826 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 2827 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 2828 | if(NULL == pTmpMlmReassocReq) |
| 2829 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2830 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 2831 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 2832 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 2833 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2834 | } |
| 2835 | |
| 2836 | // Prepare and send Reassociation request frame |
| 2837 | // start reassoc timer. |
| 2838 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 2839 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 2840 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2841 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 2842 | != TX_SUCCESS) |
| 2843 | { |
| 2844 | // Could not start reassoc failure timer. |
| 2845 | // Log error |
| 2846 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2847 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2848 | // Return Reassoc confirm with |
| 2849 | // Resources Unavailable |
| 2850 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2851 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2852 | goto end; |
| 2853 | } |
| 2854 | |
| 2855 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 2856 | return; |
| 2857 | |
| 2858 | end: |
| 2859 | // Free up buffer allocated for reassocReq |
| 2860 | if (pMlmReassocReq != NULL) |
| 2861 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2862 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2863 | pMlmReassocReq = NULL; |
| 2864 | } |
| 2865 | if (pTmpMlmReassocReq != NULL) |
| 2866 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2867 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2868 | pTmpMlmReassocReq = NULL; |
| 2869 | } |
| 2870 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 2871 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2872 | /* Update PE sessio Id*/ |
| 2873 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 2874 | |
| 2875 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 2876 | } |
| 2877 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2878 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2879 | |
| 2880 | |
| 2881 | void |
| 2882 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2883 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2884 | { |
| 2885 | static tDot11fReAssocRequest frm; |
| 2886 | tANI_U16 caps; |
| 2887 | tANI_U8 *pFrame; |
| 2888 | tSirRetStatus nSirStatus; |
| 2889 | tANI_U32 nBytes, nPayload, nStatus; |
| 2890 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2891 | void *pPacket; |
| 2892 | eHalStatus halstatus; |
| 2893 | tANI_U16 nAddIELen; |
| 2894 | tANI_U8 *pAddIE; |
| 2895 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2896 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2897 | #if defined WLAN_FEATURE_VOWIFI |
| 2898 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2899 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 2900 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2901 | |
| 2902 | if(NULL == psessionEntry) |
| 2903 | { |
| 2904 | return; |
| 2905 | } |
| 2906 | |
| 2907 | /* check this early to avoid unncessary operation */ |
| 2908 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2909 | { |
| 2910 | return; |
| 2911 | } |
| 2912 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2913 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 2914 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2915 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2916 | |
| 2917 | caps = pMlmReassocReq->capabilityInfo; |
| 2918 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2919 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2920 | #if defined(FEATURE_WLAN_WAPI) |
| 2921 | /* CR: 262463 : |
| 2922 | According to WAPI standard: |
| 2923 | 7.3.1.4 Capability Information field |
| 2924 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2925 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2926 | Reassociation management frames. */ |
| 2927 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2928 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2929 | #endif |
| 2930 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2931 | |
| 2932 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2933 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2934 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 2935 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2936 | |
| 2937 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2938 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2939 | &frm.SuppRates,psessionEntry); |
| 2940 | |
| 2941 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 2942 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2943 | |
| 2944 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2945 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2946 | |
| 2947 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2948 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2949 | |
| 2950 | |
| 2951 | if ( psessionEntry->lim11hEnable && |
| 2952 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2953 | { |
| 2954 | #if defined WLAN_FEATURE_VOWIFI |
| 2955 | PowerCapsPopulated = TRUE; |
| 2956 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2957 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2958 | #endif |
| 2959 | } |
| 2960 | |
| 2961 | #if defined WLAN_FEATURE_VOWIFI |
| 2962 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2963 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2964 | { |
| 2965 | if (PowerCapsPopulated == FALSE) |
| 2966 | { |
| 2967 | PowerCapsPopulated = TRUE; |
| 2968 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2969 | } |
| 2970 | } |
| 2971 | #endif |
| 2972 | |
| 2973 | if ( fQosEnabled && |
| 2974 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2975 | { |
| 2976 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2977 | } |
| 2978 | |
| 2979 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2980 | &frm.ExtSuppRates, psessionEntry ); |
| 2981 | |
| 2982 | #if defined WLAN_FEATURE_VOWIFI |
| 2983 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2984 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2985 | { |
| 2986 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2987 | } |
| 2988 | #endif |
| 2989 | // The join request *should* contain zero or one of the WPA and RSN |
| 2990 | // IEs. The payload send along with the request is a |
| 2991 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2992 | |
| 2993 | // typedef struct sSirRSNie |
| 2994 | // { |
| 2995 | // tANI_U16 length; |
| 2996 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2997 | // } tSirRSNie, *tpSirRSNie; |
| 2998 | |
| 2999 | // So, we should be able to make the following two calls harmlessly, |
| 3000 | // since they do nothing if they don't find the given IE in the |
| 3001 | // bytestream with which they're provided. |
| 3002 | |
| 3003 | // The net effect of this will be to faithfully transmit whatever |
| 3004 | // security IE is in the join request. |
| 3005 | |
| 3006 | // *However*, if we're associating for the purpose of WPS |
| 3007 | // enrollment, and we've been configured to indicate that by |
| 3008 | // eliding the WPA or RSN IE, we just skip this: |
| 3009 | if( nAddIELen && pAddIE ) |
| 3010 | { |
| 3011 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3012 | } |
| 3013 | if ( NULL == wpsIe ) |
| 3014 | { |
| 3015 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3016 | &frm.RSNOpaque ); |
| 3017 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3018 | &frm.WPAOpaque ); |
| 3019 | #if defined(FEATURE_WLAN_WAPI) |
| 3020 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3021 | &frm.WAPIOpaque ); |
| 3022 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3023 | } |
| 3024 | |
| 3025 | // include WME EDCA IE as well |
| 3026 | if ( fWmeEnabled ) |
| 3027 | { |
| 3028 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3029 | { |
| 3030 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3031 | } |
| 3032 | |
| 3033 | if ( fWsmEnabled && |
| 3034 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3035 | { |
| 3036 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3037 | } |
| 3038 | } |
| 3039 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3040 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3041 | pMac->lim.htCapabilityPresentInBeacon) |
| 3042 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3043 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3044 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3045 | #ifdef WLAN_FEATURE_11AC |
| 3046 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3047 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3048 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3049 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3050 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3051 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3052 | } |
| 3053 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3054 | |
| 3055 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3056 | if ( DOT11F_FAILED( nStatus ) ) |
| 3057 | { |
| 3058 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3059 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3060 | nStatus ); |
| 3061 | // We'll fall back on the worst case scenario: |
| 3062 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3063 | } |
| 3064 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3065 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3066 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3067 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3068 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3069 | } |
| 3070 | |
| 3071 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3072 | |
| 3073 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3074 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3075 | ( void** ) &pPacket ); |
| 3076 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3077 | { |
| 3078 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3079 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3080 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3081 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3082 | goto end; |
| 3083 | } |
| 3084 | |
| 3085 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3086 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3087 | |
| 3088 | // Next, we fill out the buffer descriptor: |
| 3089 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3090 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3091 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3092 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3093 | { |
| 3094 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3095 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3096 | nSirStatus ); |
| 3097 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3098 | goto end; |
| 3099 | } |
| 3100 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3101 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3102 | // That done, pack the Probe Request: |
| 3103 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3104 | sizeof(tSirMacMgmtHdr), |
| 3105 | nPayload, &nPayload ); |
| 3106 | if ( DOT11F_FAILED( nStatus ) ) |
| 3107 | { |
| 3108 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3109 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3110 | nStatus ); |
| 3111 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3112 | goto end; |
| 3113 | } |
| 3114 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3115 | { |
| 3116 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3117 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3118 | } |
| 3119 | |
| 3120 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3121 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3122 | nBytes );) |
| 3123 | |
| 3124 | if( psessionEntry->assocReq != NULL ) |
| 3125 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3126 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3127 | psessionEntry->assocReq = NULL; |
| 3128 | } |
| 3129 | |
| 3130 | if( nAddIELen ) |
| 3131 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3132 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3133 | pAddIE, |
| 3134 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3135 | nPayload += nAddIELen; |
| 3136 | } |
| 3137 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3138 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3139 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3140 | { |
| 3141 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3142 | } |
| 3143 | else |
| 3144 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3145 | //Store the Assoc request. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3146 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3147 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | |
| 3150 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3151 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3152 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3153 | ) |
| 3154 | { |
| 3155 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3156 | } |
| 3157 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3158 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3159 | { |
| 3160 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3161 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3162 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3163 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3164 | psessionEntry->peSessionId, |
| 3165 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3166 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3167 | HAL_TXRX_FRM_802_11_MGMT, |
| 3168 | ANI_TXDIR_TODS, |
| 3169 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3170 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3171 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3172 | psessionEntry->peSessionId, |
| 3173 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3174 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3175 | { |
| 3176 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3177 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3178 | nSirStatus ); |
| 3179 | //Pkt will be freed up by the callback |
| 3180 | goto end; |
| 3181 | } |
| 3182 | |
| 3183 | end: |
| 3184 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3185 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3186 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3187 | |
| 3188 | } // limSendReassocReqMgmtFrame |
| 3189 | |
| 3190 | /** |
| 3191 | * \brief Send an Authentication frame |
| 3192 | * |
| 3193 | * |
| 3194 | * \param pMac Pointer to Global MAC structure |
| 3195 | * |
| 3196 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3197 | * to be sent |
| 3198 | * |
| 3199 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3200 | * frame is destined |
| 3201 | * |
| 3202 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3203 | * Authentication frame3 |
| 3204 | * |
| 3205 | * |
| 3206 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3207 | * is formatted and sent when this function is called. |
| 3208 | * |
| 3209 | * |
| 3210 | */ |
| 3211 | |
| 3212 | void |
| 3213 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3214 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3215 | tSirMacAddr peerMacAddr, |
| 3216 | tANI_U8 wepBit, |
| 3217 | tpPESession psessionEntry |
| 3218 | ) |
| 3219 | { |
| 3220 | tANI_U8 *pFrame, *pBody; |
| 3221 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3222 | tpSirMacMgmtHdr pMacHdr; |
| 3223 | tANI_U16 i; |
| 3224 | void *pPacket; |
| 3225 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3226 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3227 | |
| 3228 | if(NULL == psessionEntry) |
| 3229 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3230 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3231 | return; |
| 3232 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3233 | |
| 3234 | limLog(pMac, LOG1, |
| 3235 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3236 | pAuthFrameBody->authTransactionSeqNumber, |
| 3237 | pAuthFrameBody->authStatusCode, |
| 3238 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3239 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3240 | if (wepBit == LIM_WEP_IN_FC) |
| 3241 | { |
| 3242 | /// Auth frame3 to be sent with encrypted framebody |
| 3243 | /** |
| 3244 | * Allocate buffer for Authenticaton frame of size equal |
| 3245 | * to management frame header length plus 2 bytes each for |
| 3246 | * auth algorithm number, transaction number, status code, |
| 3247 | * 128 bytes for challenge text and 4 bytes each for |
| 3248 | * IV & ICV. |
| 3249 | */ |
| 3250 | |
| 3251 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3252 | |
| 3253 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3254 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3255 | else |
| 3256 | { |
| 3257 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3258 | { |
| 3259 | case SIR_MAC_AUTH_FRAME_1: |
| 3260 | /** |
| 3261 | * Allocate buffer for Authenticaton frame of size |
| 3262 | * equal to management frame header length plus 2 bytes |
| 3263 | * each for auth algorithm number, transaction number |
| 3264 | * and status code. |
| 3265 | */ |
| 3266 | |
| 3267 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3268 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3269 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3270 | |
| 3271 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3272 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3273 | { |
| 3274 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3275 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3276 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3277 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3278 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3279 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3280 | else |
| 3281 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3282 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3283 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3284 | frameLen += (2+SIR_MDIE_SIZE); |
| 3285 | } |
| 3286 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3287 | #endif |
| 3288 | break; |
| 3289 | |
| 3290 | case SIR_MAC_AUTH_FRAME_2: |
| 3291 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3292 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3293 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3294 | { |
| 3295 | /** |
| 3296 | * Allocate buffer for Authenticaton frame of size |
| 3297 | * equal to management frame header length plus |
| 3298 | * 2 bytes each for auth algorithm number, |
| 3299 | * transaction number and status code. |
| 3300 | */ |
| 3301 | |
| 3302 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3303 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3304 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3305 | } |
| 3306 | else |
| 3307 | { |
| 3308 | // Shared Key algorithm with challenge text |
| 3309 | // to be sent |
| 3310 | /** |
| 3311 | * Allocate buffer for Authenticaton frame of size |
| 3312 | * equal to management frame header length plus |
| 3313 | * 2 bytes each for auth algorithm number, |
| 3314 | * transaction number, status code and 128 bytes |
| 3315 | * for challenge text. |
| 3316 | */ |
| 3317 | |
| 3318 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3319 | sizeof(tSirMacAuthFrame); |
| 3320 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3321 | } |
| 3322 | |
| 3323 | break; |
| 3324 | |
| 3325 | case SIR_MAC_AUTH_FRAME_3: |
| 3326 | /// Auth frame3 to be sent without encrypted framebody |
| 3327 | /** |
| 3328 | * Allocate buffer for Authenticaton frame of size equal |
| 3329 | * to management frame header length plus 2 bytes each |
| 3330 | * for auth algorithm number, transaction number and |
| 3331 | * status code. |
| 3332 | */ |
| 3333 | |
| 3334 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3335 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3336 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3337 | |
| 3338 | break; |
| 3339 | |
| 3340 | case SIR_MAC_AUTH_FRAME_4: |
| 3341 | /** |
| 3342 | * Allocate buffer for Authenticaton frame of size equal |
| 3343 | * to management frame header length plus 2 bytes each |
| 3344 | * for auth algorithm number, transaction number and |
| 3345 | * status code. |
| 3346 | */ |
| 3347 | |
| 3348 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3349 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3350 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3351 | |
| 3352 | break; |
| 3353 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3354 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3355 | |
| 3356 | |
| 3357 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3358 | |
| 3359 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3360 | { |
| 3361 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3362 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3363 | |
| 3364 | return; |
| 3365 | } |
| 3366 | |
| 3367 | for (i = 0; i < frameLen; i++) |
| 3368 | pFrame[i] = 0; |
| 3369 | |
| 3370 | // Prepare BD |
| 3371 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3372 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3373 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3374 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3375 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3376 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3377 | return; |
| 3378 | } |
| 3379 | |
| 3380 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3381 | pMacHdr->fc.wep = wepBit; |
| 3382 | |
| 3383 | // Prepare BSSId |
| 3384 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3385 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3386 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3387 | (tANI_U8 *) psessionEntry->bssId, |
| 3388 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3389 | } |
| 3390 | |
| 3391 | /// Prepare Authentication frame body |
| 3392 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3393 | |
| 3394 | if (wepBit == LIM_WEP_IN_FC) |
| 3395 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3396 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3397 | |
| 3398 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3399 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3400 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3401 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3402 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3403 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3404 | } |
| 3405 | else |
| 3406 | { |
| 3407 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3408 | pBody += sizeof(tANI_U16); |
| 3409 | bodyLen -= sizeof(tANI_U16); |
| 3410 | |
| 3411 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3412 | pBody += sizeof(tANI_U16); |
| 3413 | bodyLen -= sizeof(tANI_U16); |
| 3414 | |
| 3415 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3416 | pBody += sizeof(tANI_U16); |
| 3417 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3418 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3419 | sizeof (pAuthFrameBody->length) + |
| 3420 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3421 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3422 | |
| 3423 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3424 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3425 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3426 | { |
| 3427 | |
| 3428 | { |
| 3429 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3430 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3431 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3432 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3433 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3434 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3435 | (tANI_U8 *)pBody, |
| 3436 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3438 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3439 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3440 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3441 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3442 | } |
| 3443 | } |
| 3444 | else |
| 3445 | { |
| 3446 | /* MDID attr is 54*/ |
| 3447 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3448 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3449 | *pBody = SIR_MDIE_SIZE; |
| 3450 | pBody++; |
| 3451 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3452 | { |
| 3453 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3454 | pBody++; |
| 3455 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3456 | } |
| 3457 | } |
| 3458 | } |
| 3459 | #endif |
| 3460 | |
| 3461 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3462 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3463 | pAuthFrameBody->authTransactionSeqNumber, |
| 3464 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3465 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3466 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3467 | } |
| 3468 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3469 | |
| 3470 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3471 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3472 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3473 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3474 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3475 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3476 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3477 | ) |
| 3478 | { |
| 3479 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3480 | } |
| 3481 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3482 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3483 | { |
| 3484 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3485 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3486 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3487 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3488 | psessionEntry->peSessionId, |
| 3489 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3490 | /// Queue Authentication frame in high priority WQ |
| 3491 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3492 | HAL_TXRX_FRM_802_11_MGMT, |
| 3493 | ANI_TXDIR_TODS, |
| 3494 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3495 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3496 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3497 | psessionEntry->peSessionId, |
| 3498 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3499 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3500 | { |
| 3501 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3502 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3503 | halstatus); |
| 3504 | |
| 3505 | //Pkt will be freed up by the callback |
| 3506 | } |
| 3507 | |
| 3508 | return; |
| 3509 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3510 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3511 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3512 | { |
| 3513 | tANI_U16 aid; |
| 3514 | tpDphHashNode pStaDs; |
| 3515 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3516 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3517 | tpPESession psessionEntry; |
| 3518 | |
| 3519 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3520 | if (pMlmDeauthReq) |
| 3521 | { |
| 3522 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3523 | { |
| 3524 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3525 | } |
| 3526 | |
| 3527 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3528 | { |
| 3529 | |
| 3530 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3531 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3532 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3533 | goto end; |
| 3534 | } |
| 3535 | |
| 3536 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3537 | if (pStaDs == NULL) |
| 3538 | { |
| 3539 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3540 | goto end; |
| 3541 | } |
| 3542 | |
| 3543 | |
| 3544 | /// Receive path cleanup with dummy packet |
| 3545 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
| 3546 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3547 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3548 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3549 | } |
| 3550 | return eHAL_STATUS_SUCCESS; |
| 3551 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3552 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3553 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3554 | sizeof(tSirMacAddr)); |
| 3555 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3556 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3557 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3558 | |
| 3559 | // Free up buffer allocated |
| 3560 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3561 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3562 | |
| 3563 | limPostSmeMessage(pMac, |
| 3564 | LIM_MLM_DEAUTH_CNF, |
| 3565 | (tANI_U32 *) &mlmDeauthCnf); |
| 3566 | return eHAL_STATUS_SUCCESS; |
| 3567 | } |
| 3568 | |
| 3569 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3570 | { |
| 3571 | tANI_U16 aid; |
| 3572 | tpDphHashNode pStaDs; |
| 3573 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3574 | tpPESession psessionEntry; |
| 3575 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3576 | |
| 3577 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3578 | if (pMlmDisassocReq) |
| 3579 | { |
| 3580 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3581 | { |
| 3582 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3583 | } |
| 3584 | |
| 3585 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3586 | { |
| 3587 | |
| 3588 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3589 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3590 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3591 | goto end; |
| 3592 | } |
| 3593 | |
| 3594 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3595 | if (pStaDs == NULL) |
| 3596 | { |
| 3597 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3598 | goto end; |
| 3599 | } |
| 3600 | |
| 3601 | /// Receive path cleanup with dummy packet |
| 3602 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3603 | { |
| 3604 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3605 | goto end; |
| 3606 | } |
| 3607 | |
| 3608 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3609 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3610 | ( |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3611 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3612 | (psessionEntry->isCCXconnection ) || |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3613 | #endif |
| 3614 | #ifdef FEATURE_WLAN_LFR |
| 3615 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3616 | #endif |
| 3617 | (psessionEntry->is11Rconnection )) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3618 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3619 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3620 | { |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3621 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3622 | FL("FT Preauth Session (%p,%d) Cleanup"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3623 | psessionEntry, psessionEntry->peSessionId);); |
| 3624 | limFTCleanup(pMac); |
| 3625 | } |
| 3626 | else |
| 3627 | { |
| 3628 | PELOGE(limLog(pMac, LOGE, |
| 3629 | FL("No FT Preauth Session Cleanup in role %d" |
| 3630 | #ifdef FEATURE_WLAN_CCX |
| 3631 | " isCCX %d" |
| 3632 | #endif |
| 3633 | #ifdef FEATURE_WLAN_LFR |
| 3634 | " isLFR %d" |
| 3635 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3636 | " is11r %d reason %d"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3637 | psessionEntry->limSystemRole, |
| 3638 | #ifdef FEATURE_WLAN_CCX |
| 3639 | psessionEntry->isCCXconnection, |
| 3640 | #endif |
| 3641 | #ifdef FEATURE_WLAN_LFR |
| 3642 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3643 | #endif |
| 3644 | psessionEntry->is11Rconnection, |
| 3645 | pMlmDisassocReq->reasonCode);); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3646 | } |
| 3647 | #endif |
| 3648 | |
| 3649 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3650 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3651 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3652 | return eHAL_STATUS_SUCCESS; |
| 3653 | } |
| 3654 | else |
| 3655 | { |
| 3656 | return eHAL_STATUS_SUCCESS; |
| 3657 | } |
| 3658 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3659 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3660 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3661 | sizeof(tSirMacAddr)); |
| 3662 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3663 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3664 | |
| 3665 | /* Update PE session ID*/ |
| 3666 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3667 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3668 | if(pMlmDisassocReq != NULL) |
| 3669 | { |
| 3670 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3671 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3672 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3673 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3674 | |
| 3675 | limPostSmeMessage(pMac, |
| 3676 | LIM_MLM_DISASSOC_CNF, |
| 3677 | (tANI_U32 *) &mlmDisassocCnf); |
| 3678 | return eHAL_STATUS_SUCCESS; |
| 3679 | } |
| 3680 | |
| 3681 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3682 | { |
| 3683 | return limSendDisassocCnf(pMac); |
| 3684 | } |
| 3685 | |
| 3686 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3687 | { |
| 3688 | return limSendDeauthCnf(pMac); |
| 3689 | } |
| 3690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3691 | /** |
| 3692 | * \brief This function is called to send Disassociate frame. |
| 3693 | * |
| 3694 | * |
| 3695 | * \param pMac Pointer to Global MAC structure |
| 3696 | * |
| 3697 | * \param nReason Indicates the reason that need to be sent in |
| 3698 | * Disassociation frame |
| 3699 | * |
| 3700 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3701 | * sent |
| 3702 | * |
| 3703 | * |
| 3704 | */ |
| 3705 | |
| 3706 | void |
| 3707 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 3708 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3709 | tSirMacAddr peer, |
| 3710 | tpPESession psessionEntry, |
| 3711 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3712 | { |
| 3713 | tDot11fDisassociation frm; |
| 3714 | tANI_U8 *pFrame; |
| 3715 | tSirRetStatus nSirStatus; |
| 3716 | tpSirMacMgmtHdr pMacHdr; |
| 3717 | tANI_U32 nBytes, nPayload, nStatus; |
| 3718 | void *pPacket; |
| 3719 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3720 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3721 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3722 | if(NULL == psessionEntry) |
| 3723 | { |
| 3724 | return; |
| 3725 | } |
| 3726 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3727 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3728 | |
| 3729 | frm.Reason.code = nReason; |
| 3730 | |
| 3731 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 3732 | if ( DOT11F_FAILED( nStatus ) ) |
| 3733 | { |
| 3734 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3735 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3736 | nStatus ); |
| 3737 | // We'll fall back on the worst case scenario: |
| 3738 | nPayload = sizeof( tDot11fDisassociation ); |
| 3739 | } |
| 3740 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3741 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3742 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3743 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3744 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3745 | } |
| 3746 | |
| 3747 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 3748 | |
| 3749 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3750 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3751 | ( void** ) &pPacket ); |
| 3752 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3753 | { |
| 3754 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Dis" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3755 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3756 | return; |
| 3757 | } |
| 3758 | |
| 3759 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3760 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3761 | |
| 3762 | // Next, we fill out the buffer descriptor: |
| 3763 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3764 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 3765 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3766 | { |
| 3767 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3768 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3769 | nSirStatus ); |
| 3770 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3771 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3772 | return; // just allocated... |
| 3773 | } |
| 3774 | |
| 3775 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3776 | |
| 3777 | // Prepare the BSSID |
| 3778 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 3779 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3780 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 3781 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3782 | #endif |
| 3783 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3784 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 3785 | sizeof(tSirMacMgmtHdr), |
| 3786 | nPayload, &nPayload ); |
| 3787 | if ( DOT11F_FAILED( nStatus ) ) |
| 3788 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3789 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3790 | nStatus ); |
| 3791 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3792 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3793 | return; // allocated! |
| 3794 | } |
| 3795 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3796 | { |
| 3797 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3798 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3799 | } |
| 3800 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3801 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 3802 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 3803 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 3804 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 3805 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3806 | |
| 3807 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3808 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3809 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3810 | ) |
| 3811 | { |
| 3812 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3813 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3814 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3815 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3816 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 3817 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3818 | { |
| 3819 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3820 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3821 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3822 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 3823 | { |
| 3824 | /* This frame will be sent on air by firmware, |
| 3825 | which will ensure that this frame goes out |
| 3826 | even though DEL_STA is sent immediately */ |
| 3827 | /* Without this for DEL_STA command there is |
| 3828 | risk of flushing frame in BTQM queue without |
| 3829 | sending on air */ |
| 3830 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3831 | } |
| 3832 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3833 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3834 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3835 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3836 | psessionEntry->peSessionId, |
| 3837 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3838 | // Queue Disassociation frame in high priority WQ |
| 3839 | /* get the duration from the request */ |
| 3840 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3841 | HAL_TXRX_FRM_802_11_MGMT, |
| 3842 | ANI_TXDIR_TODS, |
| 3843 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3844 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 3845 | txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3846 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3847 | psessionEntry->peSessionId, |
| 3848 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3849 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3850 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3851 | if (tx_timer_change( |
| 3852 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 3853 | != TX_SUCCESS) |
| 3854 | { |
| 3855 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3856 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3857 | return; |
| 3858 | } |
| 3859 | else if(TX_SUCCESS != tx_timer_activate( |
| 3860 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3861 | { |
| 3862 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3863 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3864 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3865 | return; |
| 3866 | } |
| 3867 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3868 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3869 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3870 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3871 | psessionEntry->peSessionId, |
| 3872 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3873 | // Queue Disassociation frame in high priority WQ |
| 3874 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3875 | HAL_TXRX_FRM_802_11_MGMT, |
| 3876 | ANI_TXDIR_TODS, |
| 3877 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3878 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 3879 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3880 | psessionEntry->peSessionId, |
| 3881 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3882 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3883 | { |
| 3884 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3885 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3886 | nSirStatus ); |
| 3887 | //Pkt will be freed up by the callback |
| 3888 | return; |
| 3889 | } |
| 3890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3891 | } // End limSendDisassocMgmtFrame. |
| 3892 | |
| 3893 | /** |
| 3894 | * \brief This function is called to send a Deauthenticate frame |
| 3895 | * |
| 3896 | * |
| 3897 | * \param pMac Pointer to global MAC structure |
| 3898 | * |
| 3899 | * \param nReason Indicates the reason that need to be sent in the |
| 3900 | * Deauthenticate frame |
| 3901 | * |
| 3902 | * \param peeer address of the STA to which the frame is to be sent |
| 3903 | * |
| 3904 | * |
| 3905 | */ |
| 3906 | |
| 3907 | void |
| 3908 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 3909 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3910 | tSirMacAddr peer, |
| 3911 | tpPESession psessionEntry, |
| 3912 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3913 | { |
| 3914 | tDot11fDeAuth frm; |
| 3915 | tANI_U8 *pFrame; |
| 3916 | tSirRetStatus nSirStatus; |
| 3917 | tpSirMacMgmtHdr pMacHdr; |
| 3918 | tANI_U32 nBytes, nPayload, nStatus; |
| 3919 | void *pPacket; |
| 3920 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3921 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3922 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3923 | #ifdef FEATURE_WLAN_TDLS |
| 3924 | tANI_U16 aid; |
| 3925 | tpDphHashNode pStaDs; |
| 3926 | #endif |
| 3927 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3928 | if(NULL == psessionEntry) |
| 3929 | { |
| 3930 | return; |
| 3931 | } |
| 3932 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3933 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3934 | |
| 3935 | frm.Reason.code = nReason; |
| 3936 | |
| 3937 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 3938 | if ( DOT11F_FAILED( nStatus ) ) |
| 3939 | { |
| 3940 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3941 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3942 | nStatus ); |
| 3943 | // We'll fall back on the worst case scenario: |
| 3944 | nPayload = sizeof( tDot11fDeAuth ); |
| 3945 | } |
| 3946 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3947 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3948 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3949 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3950 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3951 | } |
| 3952 | |
| 3953 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 3954 | |
| 3955 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3956 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3957 | ( void** ) &pPacket ); |
| 3958 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3959 | { |
| 3960 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3961 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3962 | return; |
| 3963 | } |
| 3964 | |
| 3965 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3966 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3967 | |
| 3968 | // Next, we fill out the buffer descriptor: |
| 3969 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3970 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 3971 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3972 | { |
| 3973 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3974 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3975 | nSirStatus ); |
| 3976 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3977 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3978 | return; // just allocated... |
| 3979 | } |
| 3980 | |
| 3981 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3982 | |
| 3983 | // Prepare the BSSID |
| 3984 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 3985 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3986 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 3987 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3988 | #endif |
| 3989 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3990 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 3991 | sizeof(tSirMacMgmtHdr), |
| 3992 | nPayload, &nPayload ); |
| 3993 | if ( DOT11F_FAILED( nStatus ) ) |
| 3994 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3995 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3996 | nStatus ); |
| 3997 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3998 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3999 | return; |
| 4000 | } |
| 4001 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4002 | { |
| 4003 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4004 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4005 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4006 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 4007 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 4008 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4009 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4010 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4011 | |
| 4012 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4013 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4014 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4015 | ) |
| 4016 | { |
| 4017 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4018 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4019 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4020 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4021 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4022 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4023 | { |
| 4024 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4025 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4026 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4027 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4028 | { |
| 4029 | /* This frame will be sent on air by firmware, |
| 4030 | which will ensure that this frame goes out |
| 4031 | even though DEL_STA is sent immediately */ |
| 4032 | /* Without this for DEL_STA command there is |
| 4033 | risk of flushing frame in BTQM queue without |
| 4034 | sending on air */ |
| 4035 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4036 | } |
| 4037 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4038 | #ifdef FEATURE_WLAN_TDLS |
| 4039 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4040 | #endif |
| 4041 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4042 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4043 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4044 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4045 | psessionEntry->peSessionId, |
| 4046 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4047 | // Queue Disassociation frame in high priority WQ |
| 4048 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4049 | HAL_TXRX_FRM_802_11_MGMT, |
| 4050 | ANI_TXDIR_TODS, |
| 4051 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4052 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4053 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4054 | psessionEntry->peSessionId, |
| 4055 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4056 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4057 | { |
| 4058 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4059 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4060 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4061 | //Pkt will be freed up by the callback limTxComplete |
| 4062 | |
| 4063 | /*Call limProcessDeauthAckTimeout which will send |
| 4064 | * DeauthCnf for this frame |
| 4065 | */ |
| 4066 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4067 | return; |
| 4068 | } |
| 4069 | |
| 4070 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4071 | |
| 4072 | if (tx_timer_change( |
| 4073 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4074 | != TX_SUCCESS) |
| 4075 | { |
| 4076 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4077 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4078 | return; |
| 4079 | } |
| 4080 | else if(TX_SUCCESS != tx_timer_activate( |
| 4081 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4082 | { |
| 4083 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4084 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4085 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4086 | return; |
| 4087 | } |
| 4088 | } |
| 4089 | else |
| 4090 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4091 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4092 | psessionEntry->peSessionId, |
| 4093 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4094 | #ifdef FEATURE_WLAN_TDLS |
| 4095 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4096 | { |
| 4097 | // Queue Disassociation frame in high priority WQ |
| 4098 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4099 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4100 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4101 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4102 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4103 | } |
| 4104 | else |
| 4105 | { |
| 4106 | #endif |
| 4107 | // Queue Disassociation frame in high priority WQ |
| 4108 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4109 | HAL_TXRX_FRM_802_11_MGMT, |
| 4110 | ANI_TXDIR_TODS, |
| 4111 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4112 | limTxComplete, pFrame, txFlag ); |
| 4113 | #ifdef FEATURE_WLAN_TDLS |
| 4114 | } |
| 4115 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4116 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4117 | psessionEntry->peSessionId, |
| 4118 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4119 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4120 | { |
| 4121 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4122 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4123 | nSirStatus ); |
| 4124 | //Pkt will be freed up by the callback |
| 4125 | return; |
| 4126 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4127 | } |
| 4128 | |
| 4129 | } // End limSendDeauthMgmtFrame. |
| 4130 | |
| 4131 | |
| 4132 | #ifdef ANI_SUPPORT_11H |
| 4133 | /** |
| 4134 | * \brief Send a Measurement Report Action frame |
| 4135 | * |
| 4136 | * |
| 4137 | * \param pMac Pointer to the global MAC structure |
| 4138 | * |
| 4139 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4140 | * |
| 4141 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4142 | * |
| 4143 | * |
| 4144 | */ |
| 4145 | |
| 4146 | tSirRetStatus |
| 4147 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4148 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4149 | tSirMacAddr peer) |
| 4150 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4151 | tDot11fMeasurementReport frm; |
| 4152 | tANI_U8 *pFrame; |
| 4153 | tSirRetStatus nSirStatus; |
| 4154 | tpSirMacMgmtHdr pMacHdr; |
| 4155 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4156 | void *pPacket; |
| 4157 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4158 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4159 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4160 | |
| 4161 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4162 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4163 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4164 | |
| 4165 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4166 | { |
| 4167 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4168 | nSirStatus = |
| 4169 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4170 | &frm.MeasurementReport ); |
| 4171 | break; |
| 4172 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4173 | nSirStatus = |
| 4174 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4175 | &frm.MeasurementReport ); |
| 4176 | break; |
| 4177 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4178 | nSirStatus = |
| 4179 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4180 | &frm.MeasurementReport ); |
| 4181 | break; |
| 4182 | default: |
| 4183 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4184 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4185 | pMeasReqFrame->measReqIE.measType ); |
| 4186 | return eSIR_FAILURE; |
| 4187 | } |
| 4188 | |
| 4189 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4190 | |
| 4191 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4192 | if ( DOT11F_FAILED( nStatus ) ) |
| 4193 | { |
| 4194 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4195 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4196 | nStatus ); |
| 4197 | // We'll fall back on the worst case scenario: |
| 4198 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4199 | } |
| 4200 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4201 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4202 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4203 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4204 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4205 | } |
| 4206 | |
| 4207 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4208 | |
| 4209 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4210 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4211 | { |
| 4212 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4213 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4214 | return eSIR_FAILURE; |
| 4215 | } |
| 4216 | |
| 4217 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4218 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4219 | |
| 4220 | // Next, we fill out the buffer descriptor: |
| 4221 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4222 | SIR_MAC_MGMT_ACTION, peer); |
| 4223 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4224 | { |
| 4225 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4226 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4227 | nSirStatus ); |
| 4228 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4229 | return eSIR_FAILURE; // just allocated... |
| 4230 | } |
| 4231 | |
| 4232 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4233 | |
| 4234 | nCfg = 6; |
| 4235 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4236 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4237 | { |
| 4238 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4239 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4240 | nSirStatus ); |
| 4241 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4242 | return eSIR_FAILURE; // just allocated... |
| 4243 | } |
| 4244 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4245 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4246 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4247 | #endif |
| 4248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4249 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4250 | sizeof(tSirMacMgmtHdr), |
| 4251 | nPayload, &nPayload ); |
| 4252 | if ( DOT11F_FAILED( nStatus ) ) |
| 4253 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4254 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4255 | nStatus ); |
| 4256 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4257 | return eSIR_FAILURE; // allocated! |
| 4258 | } |
| 4259 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4260 | { |
| 4261 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4262 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4263 | } |
| 4264 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4265 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4266 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4267 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4268 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4269 | HAL_TXRX_FRM_802_11_MGMT, |
| 4270 | ANI_TXDIR_TODS, |
| 4271 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4272 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4273 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4274 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4275 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4276 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4277 | { |
| 4278 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4279 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4280 | nSirStatus ); |
| 4281 | //Pkt will be freed up by the callback |
| 4282 | return eSIR_FAILURE; // just allocated... |
| 4283 | } |
| 4284 | |
| 4285 | return eSIR_SUCCESS; |
| 4286 | |
| 4287 | } // End limSendMeasReportFrame. |
| 4288 | |
| 4289 | |
| 4290 | /** |
| 4291 | * \brief Send a TPC Request Action frame |
| 4292 | * |
| 4293 | * |
| 4294 | * \param pMac Pointer to the global MAC datastructure |
| 4295 | * |
| 4296 | * \param peer MAC address to which the frame should be sent |
| 4297 | * |
| 4298 | * |
| 4299 | */ |
| 4300 | |
| 4301 | void |
| 4302 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4303 | tSirMacAddr peer) |
| 4304 | { |
| 4305 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4306 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4307 | tSirRetStatus nSirStatus; |
| 4308 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4309 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4310 | void *pPacket; |
| 4311 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4312 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4313 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4314 | |
| 4315 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4316 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4317 | frm.DialogToken.token = 1; |
| 4318 | frm.TPCRequest.present = 1; |
| 4319 | |
| 4320 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4321 | if ( DOT11F_FAILED( nStatus ) ) |
| 4322 | { |
| 4323 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4324 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4325 | nStatus ); |
| 4326 | // We'll fall back on the worst case scenario: |
| 4327 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4328 | } |
| 4329 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4330 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4331 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4332 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4333 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4334 | } |
| 4335 | |
| 4336 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4337 | |
| 4338 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4339 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4340 | { |
| 4341 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4342 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4343 | return; |
| 4344 | } |
| 4345 | |
| 4346 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4347 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4348 | |
| 4349 | // Next, we fill out the buffer descriptor: |
| 4350 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4351 | SIR_MAC_MGMT_ACTION, peer); |
| 4352 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4353 | { |
| 4354 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4355 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4356 | nSirStatus ); |
| 4357 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4358 | return; // just allocated... |
| 4359 | } |
| 4360 | |
| 4361 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4362 | |
| 4363 | nCfg = 6; |
| 4364 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4365 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4366 | { |
| 4367 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4368 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4369 | nSirStatus ); |
| 4370 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4371 | return; // just allocated... |
| 4372 | } |
| 4373 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4374 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4375 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4376 | #endif |
| 4377 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4378 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4379 | sizeof(tSirMacMgmtHdr), |
| 4380 | nPayload, &nPayload ); |
| 4381 | if ( DOT11F_FAILED( nStatus ) ) |
| 4382 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4383 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4384 | nStatus ); |
| 4385 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4386 | return; // allocated! |
| 4387 | } |
| 4388 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4389 | { |
| 4390 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4391 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4392 | } |
| 4393 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4394 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4395 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4396 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4397 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4398 | HAL_TXRX_FRM_802_11_MGMT, |
| 4399 | ANI_TXDIR_TODS, |
| 4400 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4401 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4402 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4403 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4404 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4405 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4406 | { |
| 4407 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4408 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4409 | nSirStatus ); |
| 4410 | //Pkt will be freed up by the callback |
| 4411 | return; |
| 4412 | } |
| 4413 | |
| 4414 | } // End limSendTpcRequestFrame. |
| 4415 | |
| 4416 | |
| 4417 | /** |
| 4418 | * \brief Send a TPC Report Action frame |
| 4419 | * |
| 4420 | * |
| 4421 | * \param pMac Pointer to the global MAC datastructure |
| 4422 | * |
| 4423 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4424 | * |
| 4425 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4426 | * |
| 4427 | * |
| 4428 | */ |
| 4429 | |
| 4430 | tSirRetStatus |
| 4431 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4432 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4433 | tSirMacAddr peer) |
| 4434 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4435 | tDot11fTPCReport frm; |
| 4436 | tANI_U8 *pFrame; |
| 4437 | tSirRetStatus nSirStatus; |
| 4438 | tpSirMacMgmtHdr pMacHdr; |
| 4439 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4440 | void *pPacket; |
| 4441 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4442 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4443 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4444 | |
| 4445 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4446 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4447 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4448 | |
| 4449 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4450 | // "misplaced this function, need to replace: |
| 4451 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4452 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4453 | frm.TPCReport.tx_power = 0; |
| 4454 | frm.TPCReport.link_margin = 0; |
| 4455 | frm.TPCReport.present = 1; |
| 4456 | |
| 4457 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4458 | if ( DOT11F_FAILED( nStatus ) ) |
| 4459 | { |
| 4460 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4461 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4462 | nStatus ); |
| 4463 | // We'll fall back on the worst case scenario: |
| 4464 | nPayload = sizeof( tDot11fTPCReport ); |
| 4465 | } |
| 4466 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4467 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4468 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4469 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4470 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4471 | } |
| 4472 | |
| 4473 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4474 | |
| 4475 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4476 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4477 | { |
| 4478 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4479 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | return eSIR_FAILURE; |
| 4481 | } |
| 4482 | |
| 4483 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4484 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4485 | |
| 4486 | // Next, we fill out the buffer descriptor: |
| 4487 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4488 | SIR_MAC_MGMT_ACTION, peer); |
| 4489 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4490 | { |
| 4491 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4492 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4493 | nSirStatus ); |
| 4494 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4495 | return eSIR_FAILURE; // just allocated... |
| 4496 | } |
| 4497 | |
| 4498 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4499 | |
| 4500 | nCfg = 6; |
| 4501 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4502 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4503 | { |
| 4504 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4505 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4506 | nSirStatus ); |
| 4507 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4508 | return eSIR_FAILURE; // just allocated... |
| 4509 | } |
| 4510 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4511 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4512 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4513 | #endif |
| 4514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4515 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4516 | sizeof(tSirMacMgmtHdr), |
| 4517 | nPayload, &nPayload ); |
| 4518 | if ( DOT11F_FAILED( nStatus ) ) |
| 4519 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4520 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4521 | nStatus ); |
| 4522 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4523 | return eSIR_FAILURE; // allocated! |
| 4524 | } |
| 4525 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4526 | { |
| 4527 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4528 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4529 | } |
| 4530 | |
| 4531 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4532 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4533 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4534 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4535 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4536 | HAL_TXRX_FRM_802_11_MGMT, |
| 4537 | ANI_TXDIR_TODS, |
| 4538 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4539 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4540 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4541 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4542 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4543 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4544 | { |
| 4545 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4546 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4547 | nSirStatus ); |
| 4548 | //Pkt will be freed up by the callback |
| 4549 | return eSIR_FAILURE; // just allocated... |
| 4550 | } |
| 4551 | |
| 4552 | return eSIR_SUCCESS; |
| 4553 | |
| 4554 | } // End limSendTpcReportFrame. |
| 4555 | #endif //ANI_SUPPORT_11H |
| 4556 | |
| 4557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4558 | /** |
| 4559 | * \brief Send a Channel Switch Announcement |
| 4560 | * |
| 4561 | * |
| 4562 | * \param pMac Pointer to the global MAC datastructure |
| 4563 | * |
| 4564 | * \param peer MAC address to which this frame will be sent |
| 4565 | * |
| 4566 | * \param nMode |
| 4567 | * |
| 4568 | * \param nNewChannel |
| 4569 | * |
| 4570 | * \param nCount |
| 4571 | * |
| 4572 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4573 | * |
| 4574 | * |
| 4575 | */ |
| 4576 | |
| 4577 | tSirRetStatus |
| 4578 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4579 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4580 | tANI_U8 nMode, |
| 4581 | tANI_U8 nNewChannel, |
| 4582 | tANI_U8 nCount, |
| 4583 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4584 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4585 | tDot11fChannelSwitch frm; |
| 4586 | tANI_U8 *pFrame; |
| 4587 | tSirRetStatus nSirStatus; |
| 4588 | tpSirMacMgmtHdr pMacHdr; |
| 4589 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4590 | void *pPacket; |
| 4591 | eHalStatus halstatus; |
| 4592 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4593 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4594 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4595 | |
| 4596 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4597 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4598 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4599 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4600 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4601 | frm.ChanSwitchAnn.present = 1; |
| 4602 | |
| 4603 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4604 | if ( DOT11F_FAILED( nStatus ) ) |
| 4605 | { |
| 4606 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4607 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4608 | nStatus ); |
| 4609 | // We'll fall back on the worst case scenario: |
| 4610 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4611 | } |
| 4612 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4613 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4614 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4615 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4616 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4617 | } |
| 4618 | |
| 4619 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4620 | |
| 4621 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4622 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4623 | { |
| 4624 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4625 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4626 | return eSIR_FAILURE; |
| 4627 | } |
| 4628 | |
| 4629 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4630 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4631 | |
| 4632 | // Next, we fill out the buffer descriptor: |
| 4633 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4634 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4635 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4636 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4637 | (tANI_U8 *) psessionEntry->bssId, |
| 4638 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4639 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4640 | { |
| 4641 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4642 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | nSirStatus ); |
| 4644 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4645 | return eSIR_FAILURE; // just allocated... |
| 4646 | } |
| 4647 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4648 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4649 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4650 | |
| 4651 | nCfg = 6; |
| 4652 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4653 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4654 | { |
| 4655 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4656 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4657 | nSirStatus ); |
| 4658 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4659 | return eSIR_FAILURE; // just allocated... |
| 4660 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4661 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4662 | |
| 4663 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4664 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4665 | #endif |
| 4666 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4667 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4668 | sizeof(tSirMacMgmtHdr), |
| 4669 | nPayload, &nPayload ); |
| 4670 | if ( DOT11F_FAILED( nStatus ) ) |
| 4671 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4672 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4673 | nStatus ); |
| 4674 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4675 | return eSIR_FAILURE; // allocated! |
| 4676 | } |
| 4677 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4678 | { |
| 4679 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4680 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4681 | } |
| 4682 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4683 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4684 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4685 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4686 | ) |
| 4687 | { |
| 4688 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4689 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4690 | |
| 4691 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4692 | psessionEntry->peSessionId, |
| 4693 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4694 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4695 | HAL_TXRX_FRM_802_11_MGMT, |
| 4696 | ANI_TXDIR_TODS, |
| 4697 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4698 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4699 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4700 | psessionEntry->peSessionId, |
| 4701 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4702 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4703 | { |
| 4704 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4705 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4706 | nSirStatus ); |
| 4707 | //Pkt will be freed up by the callback |
| 4708 | return eSIR_FAILURE; |
| 4709 | } |
| 4710 | |
| 4711 | return eSIR_SUCCESS; |
| 4712 | |
| 4713 | } // End limSendChannelSwitchMgmtFrame. |
| 4714 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4715 | |
| 4716 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4717 | #ifdef WLAN_FEATURE_11AC |
| 4718 | tSirRetStatus |
| 4719 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 4720 | tSirMacAddr peer, |
| 4721 | tANI_U8 nMode, |
| 4722 | tpPESession psessionEntry ) |
| 4723 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4724 | tDot11fOperatingMode frm; |
| 4725 | tANI_U8 *pFrame; |
| 4726 | tSirRetStatus nSirStatus; |
| 4727 | tpSirMacMgmtHdr pMacHdr; |
| 4728 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 4729 | void *pPacket; |
| 4730 | eHalStatus halstatus; |
| 4731 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4732 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4733 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4734 | |
| 4735 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 4736 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 4737 | frm.OperatingMode.chanWidth = nMode; |
| 4738 | frm.OperatingMode.rxNSS = 0; |
| 4739 | frm.OperatingMode.rxNSSType = 0; |
| 4740 | |
| 4741 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 4742 | if ( DOT11F_FAILED( nStatus ) ) |
| 4743 | { |
| 4744 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4745 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4746 | nStatus ); |
| 4747 | // We'll fall back on the worst case scenario: |
| 4748 | nPayload = sizeof( tDot11fOperatingMode); |
| 4749 | } |
| 4750 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4751 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4752 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4753 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4754 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4755 | } |
| 4756 | |
| 4757 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4758 | |
| 4759 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4760 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4761 | { |
| 4762 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Operating Mode" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4763 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4764 | return eSIR_FAILURE; |
| 4765 | } |
| 4766 | |
| 4767 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4768 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4769 | |
| 4770 | |
| 4771 | // Next, we fill out the buffer descriptor: |
| 4772 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 4773 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4774 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4775 | } else |
| 4776 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4777 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 4778 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4779 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4780 | (tANI_U8 *) psessionEntry->bssId, |
| 4781 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4782 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4783 | { |
| 4784 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4785 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4786 | nSirStatus ); |
| 4787 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4788 | return eSIR_FAILURE; // just allocated... |
| 4789 | } |
| 4790 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 4791 | sizeof(tSirMacMgmtHdr), |
| 4792 | nPayload, &nPayload ); |
| 4793 | if ( DOT11F_FAILED( nStatus ) ) |
| 4794 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4795 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4796 | nStatus ); |
| 4797 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4798 | return eSIR_FAILURE; // allocated! |
| 4799 | } |
| 4800 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4801 | { |
| 4802 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4803 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4804 | } |
| 4805 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4806 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4807 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4808 | ) |
| 4809 | { |
| 4810 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4811 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4812 | |
| 4813 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4814 | psessionEntry->peSessionId, |
| 4815 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4816 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4817 | HAL_TXRX_FRM_802_11_MGMT, |
| 4818 | ANI_TXDIR_TODS, |
| 4819 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4820 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4821 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4822 | psessionEntry->peSessionId, |
| 4823 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4824 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4825 | { |
| 4826 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4827 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4828 | nSirStatus ); |
| 4829 | //Pkt will be freed up by the callback |
| 4830 | return eSIR_FAILURE; |
| 4831 | } |
| 4832 | |
| 4833 | return eSIR_SUCCESS; |
| 4834 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4835 | |
| 4836 | /** |
| 4837 | * \brief Send a VHT Channel Switch Announcement |
| 4838 | * |
| 4839 | * |
| 4840 | * \param pMac Pointer to the global MAC datastructure |
| 4841 | * |
| 4842 | * \param peer MAC address to which this frame will be sent |
| 4843 | * |
| 4844 | * \param nChanWidth |
| 4845 | * |
| 4846 | * \param nNewChannel |
| 4847 | * |
| 4848 | * |
| 4849 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4850 | * |
| 4851 | * |
| 4852 | */ |
| 4853 | |
| 4854 | tSirRetStatus |
| 4855 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4856 | tSirMacAddr peer, |
| 4857 | tANI_U8 nChanWidth, |
| 4858 | tANI_U8 nNewChannel, |
| 4859 | tANI_U8 ncbMode, |
| 4860 | tpPESession psessionEntry ) |
| 4861 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4862 | tDot11fChannelSwitch frm; |
| 4863 | tANI_U8 *pFrame; |
| 4864 | tSirRetStatus nSirStatus; |
| 4865 | tpSirMacMgmtHdr pMacHdr; |
| 4866 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4867 | void *pPacket; |
| 4868 | eHalStatus halstatus; |
| 4869 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4870 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4871 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4872 | |
| 4873 | |
| 4874 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4875 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4876 | frm.ChanSwitchAnn.switchMode = 1; |
| 4877 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4878 | frm.ChanSwitchAnn.switchCount = 1; |
| 4879 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 4880 | frm.ExtChanSwitchAnn.present = 1; |
| 4881 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 4882 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 4883 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 4884 | frm.ChanSwitchAnn.present = 1; |
| 4885 | frm.WiderBWChanSwitchAnn.present = 1; |
| 4886 | |
| 4887 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4888 | if ( DOT11F_FAILED( nStatus ) ) |
| 4889 | { |
| 4890 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4891 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4892 | nStatus ); |
| 4893 | // We'll fall back on the worst case scenario: |
| 4894 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4895 | } |
| 4896 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4897 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4898 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4899 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4900 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4901 | } |
| 4902 | |
| 4903 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4904 | |
| 4905 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4906 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4907 | { |
| 4908 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4909 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4910 | return eSIR_FAILURE; |
| 4911 | } |
| 4912 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4913 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4914 | |
| 4915 | // Next, we fill out the buffer descriptor: |
| 4916 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4917 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4918 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4919 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4920 | (tANI_U8 *) psessionEntry->bssId, |
| 4921 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4922 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4923 | { |
| 4924 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4925 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4926 | nSirStatus ); |
| 4927 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4928 | return eSIR_FAILURE; // just allocated... |
| 4929 | } |
| 4930 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4931 | sizeof(tSirMacMgmtHdr), |
| 4932 | nPayload, &nPayload ); |
| 4933 | if ( DOT11F_FAILED( nStatus ) ) |
| 4934 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4935 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4936 | nStatus ); |
| 4937 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4938 | return eSIR_FAILURE; // allocated! |
| 4939 | } |
| 4940 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4941 | { |
| 4942 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4943 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4944 | } |
| 4945 | |
| 4946 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4947 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4948 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4949 | ) |
| 4950 | { |
| 4951 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4952 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4953 | |
| 4954 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4955 | psessionEntry->peSessionId, |
| 4956 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4957 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4958 | HAL_TXRX_FRM_802_11_MGMT, |
| 4959 | ANI_TXDIR_TODS, |
| 4960 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4961 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 4962 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4963 | psessionEntry->peSessionId, |
| 4964 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4965 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4966 | { |
| 4967 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4968 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4969 | nSirStatus ); |
| 4970 | //Pkt will be freed up by the callback |
| 4971 | return eSIR_FAILURE; |
| 4972 | } |
| 4973 | |
| 4974 | return eSIR_SUCCESS; |
| 4975 | |
| 4976 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 4977 | |
| 4978 | |
| 4979 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4980 | #endif |
| 4981 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4982 | /** |
| 4983 | * \brief Send an ADDBA Req Action Frame to peer |
| 4984 | * |
| 4985 | * \sa limSendAddBAReq |
| 4986 | * |
| 4987 | * \param pMac The global tpAniSirGlobal object |
| 4988 | * |
| 4989 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 4990 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 4991 | * Frame to the peer |
| 4992 | * |
| 4993 | * \return eSIR_SUCCESS if setup completes successfully |
| 4994 | * eSIR_FAILURE is some problem is encountered |
| 4995 | */ |
| 4996 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4997 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4998 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4999 | tDot11fAddBAReq frmAddBAReq; |
| 5000 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 5001 | tpSirMacMgmtHdr pMacHdr; |
| 5002 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5003 | tSirRetStatus statusCode; |
| 5004 | eHalStatus halStatus; |
| 5005 | void *pPacket; |
| 5006 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5007 | |
| 5008 | if(NULL == psessionEntry) |
| 5009 | { |
| 5010 | return eSIR_FAILURE; |
| 5011 | } |
| 5012 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5013 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5014 | |
| 5015 | // Category - 3 (BA) |
| 5016 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5017 | |
| 5018 | // Action - 0 (ADDBA Req) |
| 5019 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5020 | |
| 5021 | // FIXME - Dialog Token, generalize this... |
| 5022 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5023 | |
| 5024 | // Fill the ADDBA Parameter Set |
| 5025 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5026 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5027 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5028 | |
| 5029 | // BA timeout |
| 5030 | // 0 - indicates no BA timeout |
| 5031 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5032 | |
| 5033 | // BA Starting Sequence Number |
| 5034 | // Fragment number will always be zero |
| 5035 | if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) { |
| 5036 | pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5037 | } |
| 5038 | |
| 5039 | frmAddBAReq.BAStartingSequenceControl.ssn = |
| 5040 | pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5041 | |
| 5042 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5043 | |
| 5044 | if( DOT11F_FAILED( nStatus )) |
| 5045 | { |
| 5046 | limLog( pMac, LOGW, |
| 5047 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5048 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5049 | nStatus ); |
| 5050 | |
| 5051 | // We'll fall back on the worst case scenario: |
| 5052 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5053 | } |
| 5054 | else if( DOT11F_WARNED( nStatus )) |
| 5055 | { |
| 5056 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5057 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5058 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5059 | nStatus ); |
| 5060 | } |
| 5061 | |
| 5062 | // Add the MGMT header to frame length |
| 5063 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5064 | |
| 5065 | // Need to allocate a buffer for ADDBA AF |
| 5066 | if( eHAL_STATUS_SUCCESS != |
| 5067 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5068 | HAL_TXRX_FRM_802_11_MGMT, |
| 5069 | (tANI_U16) frameLen, |
| 5070 | (void **) &pAddBAReqBuffer, |
| 5071 | (void **) &pPacket ))) |
| 5072 | { |
| 5073 | // Log error |
| 5074 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5075 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5076 | frameLen, |
| 5077 | halStatus ); |
| 5078 | |
| 5079 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5080 | goto returnAfterError; |
| 5081 | } |
| 5082 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5083 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5084 | |
| 5085 | // Copy necessary info to BD |
| 5086 | if( eSIR_SUCCESS != |
| 5087 | (statusCode = limPopulateMacHeader( pMac, |
| 5088 | pAddBAReqBuffer, |
| 5089 | SIR_MAC_MGMT_FRAME, |
| 5090 | SIR_MAC_MGMT_ACTION, |
| 5091 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5092 | goto returnAfterError; |
| 5093 | |
| 5094 | // Update A3 with the BSSID |
| 5095 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5096 | |
| 5097 | #if 0 |
| 5098 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5099 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5100 | WNI_CFG_BSSID, |
| 5101 | (tANI_U8 *) pMacHdr->bssId, |
| 5102 | &cfgLen )) |
| 5103 | { |
| 5104 | limLog( pMac, LOGP, |
| 5105 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5106 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5107 | |
| 5108 | // FIXME - Need to convert to tSirRetStatus |
| 5109 | statusCode = eSIR_FAILURE; |
| 5110 | goto returnAfterError; |
| 5111 | } |
| 5112 | #endif//TO SUPPORT BT-AMP |
| 5113 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5114 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5115 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5116 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5117 | #endif |
| 5118 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5119 | // Now, we're ready to "pack" the frames |
| 5120 | nStatus = dot11fPackAddBAReq( pMac, |
| 5121 | &frmAddBAReq, |
| 5122 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5123 | nPayload, |
| 5124 | &nPayload ); |
| 5125 | |
| 5126 | if( DOT11F_FAILED( nStatus )) |
| 5127 | { |
| 5128 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5129 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5130 | nStatus ); |
| 5131 | |
| 5132 | // FIXME - Need to convert to tSirRetStatus |
| 5133 | statusCode = eSIR_FAILURE; |
| 5134 | goto returnAfterError; |
| 5135 | } |
| 5136 | else if( DOT11F_WARNED( nStatus )) |
| 5137 | { |
| 5138 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5139 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5140 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5141 | } |
| 5142 | |
| 5143 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5144 | FL( "Sending an ADDBA REQ to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5145 | limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW ); |
| 5146 | |
| 5147 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5148 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5149 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5150 | ) |
| 5151 | { |
| 5152 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5153 | } |
| 5154 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5155 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5156 | psessionEntry->peSessionId, |
| 5157 | pMacHdr->fc.subType)); |
| 5158 | halStatus = halTxFrame( pMac, |
| 5159 | pPacket, |
| 5160 | (tANI_U16) frameLen, |
| 5161 | HAL_TXRX_FRM_802_11_MGMT, |
| 5162 | ANI_TXDIR_TODS, |
| 5163 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5164 | limTxComplete, |
| 5165 | pAddBAReqBuffer, txFlag ); |
| 5166 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5167 | psessionEntry->peSessionId, |
| 5168 | halStatus)); |
| 5169 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5170 | { |
| 5171 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5172 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5173 | halStatus ); |
| 5174 | |
| 5175 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5176 | statusCode = eSIR_FAILURE; |
| 5177 | //Pkt will be freed up by the callback |
| 5178 | return statusCode; |
| 5179 | } |
| 5180 | else |
| 5181 | return eSIR_SUCCESS; |
| 5182 | |
| 5183 | returnAfterError: |
| 5184 | |
| 5185 | // Release buffer, if allocated |
| 5186 | if( NULL != pAddBAReqBuffer ) |
| 5187 | palPktFree( pMac->hHdd, |
| 5188 | HAL_TXRX_FRM_802_11_MGMT, |
| 5189 | (void *) pAddBAReqBuffer, |
| 5190 | (void *) pPacket ); |
| 5191 | |
| 5192 | return statusCode; |
| 5193 | } |
| 5194 | |
| 5195 | /** |
| 5196 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5197 | * |
| 5198 | * \sa limSendAddBARsp |
| 5199 | * |
| 5200 | * \param pMac The global tpAniSirGlobal object |
| 5201 | * |
| 5202 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5203 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5204 | * Frame to the peer |
| 5205 | * |
| 5206 | * \return eSIR_SUCCESS if setup completes successfully |
| 5207 | * eSIR_FAILURE is some problem is encountered |
| 5208 | */ |
| 5209 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5210 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5211 | tpPESession psessionEntry) |
| 5212 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5213 | tDot11fAddBARsp frmAddBARsp; |
| 5214 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5215 | tpSirMacMgmtHdr pMacHdr; |
| 5216 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5217 | tSirRetStatus statusCode; |
| 5218 | eHalStatus halStatus; |
| 5219 | void *pPacket; |
| 5220 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5221 | |
| 5222 | if(NULL == psessionEntry) |
| 5223 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5224 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5225 | return eSIR_FAILURE; |
| 5226 | } |
| 5227 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5228 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5229 | |
| 5230 | // Category - 3 (BA) |
| 5231 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5232 | // Action - 1 (ADDBA Rsp) |
| 5233 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5234 | |
| 5235 | // Should be same as the one we received in the ADDBA Req |
| 5236 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5237 | |
| 5238 | // ADDBA Req status |
| 5239 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5240 | |
| 5241 | // Fill the ADDBA Parameter Set as provided by caller |
| 5242 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5243 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5244 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5245 | |
| 5246 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5247 | { |
| 5248 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5249 | psessionEntry->amsduSupportedInBA; |
| 5250 | } |
| 5251 | else |
| 5252 | { |
| 5253 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5254 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5255 | |
| 5256 | // BA timeout |
| 5257 | // 0 - indicates no BA timeout |
| 5258 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5259 | |
| 5260 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5261 | |
| 5262 | if( DOT11F_FAILED( nStatus )) |
| 5263 | { |
| 5264 | limLog( pMac, LOGW, |
| 5265 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5266 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5267 | nStatus ); |
| 5268 | |
| 5269 | // We'll fall back on the worst case scenario: |
| 5270 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5271 | } |
| 5272 | else if( DOT11F_WARNED( nStatus )) |
| 5273 | { |
| 5274 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5275 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5276 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5277 | nStatus ); |
| 5278 | } |
| 5279 | |
| 5280 | // Need to allocate a buffer for ADDBA AF |
| 5281 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5282 | |
| 5283 | // Allocate shared memory |
| 5284 | if( eHAL_STATUS_SUCCESS != |
| 5285 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5286 | HAL_TXRX_FRM_802_11_MGMT, |
| 5287 | (tANI_U16) frameLen, |
| 5288 | (void **) &pAddBARspBuffer, |
| 5289 | (void **) &pPacket ))) |
| 5290 | { |
| 5291 | // Log error |
| 5292 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5293 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5294 | frameLen, |
| 5295 | halStatus ); |
| 5296 | |
| 5297 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5298 | goto returnAfterError; |
| 5299 | } |
| 5300 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5301 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5302 | |
| 5303 | // Copy necessary info to BD |
| 5304 | if( eSIR_SUCCESS != |
| 5305 | (statusCode = limPopulateMacHeader( pMac, |
| 5306 | pAddBARspBuffer, |
| 5307 | SIR_MAC_MGMT_FRAME, |
| 5308 | SIR_MAC_MGMT_ACTION, |
| 5309 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5310 | goto returnAfterError; |
| 5311 | |
| 5312 | // Update A3 with the BSSID |
| 5313 | |
| 5314 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5315 | |
| 5316 | #if 0 |
| 5317 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5318 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5319 | WNI_CFG_BSSID, |
| 5320 | (tANI_U8 *) pMacHdr->bssId, |
| 5321 | &cfgLen )) |
| 5322 | { |
| 5323 | limLog( pMac, LOGP, |
| 5324 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5325 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5326 | |
| 5327 | // FIXME - Need to convert to tSirRetStatus |
| 5328 | statusCode = eSIR_FAILURE; |
| 5329 | goto returnAfterError; |
| 5330 | } |
| 5331 | #endif // TO SUPPORT BT-AMP |
| 5332 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5333 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5334 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5335 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5336 | #endif |
| 5337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5338 | // Now, we're ready to "pack" the frames |
| 5339 | nStatus = dot11fPackAddBARsp( pMac, |
| 5340 | &frmAddBARsp, |
| 5341 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5342 | nPayload, |
| 5343 | &nPayload ); |
| 5344 | |
| 5345 | if( DOT11F_FAILED( nStatus )) |
| 5346 | { |
| 5347 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5348 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5349 | nStatus ); |
| 5350 | |
| 5351 | // FIXME - Need to convert to tSirRetStatus |
| 5352 | statusCode = eSIR_FAILURE; |
| 5353 | goto returnAfterError; |
| 5354 | } |
| 5355 | else if( DOT11F_WARNED( nStatus )) |
| 5356 | { |
| 5357 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5358 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5359 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5360 | } |
| 5361 | |
| 5362 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5363 | FL( "Sending an ADDBA RSP to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5364 | limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW ); |
| 5365 | |
| 5366 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5367 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5368 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5369 | ) |
| 5370 | { |
| 5371 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5372 | } |
| 5373 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5374 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5375 | psessionEntry->peSessionId, |
| 5376 | pMacHdr->fc.subType)); |
| 5377 | halStatus = halTxFrame( pMac, |
| 5378 | pPacket, |
| 5379 | (tANI_U16) frameLen, |
| 5380 | HAL_TXRX_FRM_802_11_MGMT, |
| 5381 | ANI_TXDIR_TODS, |
| 5382 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5383 | limTxComplete, |
| 5384 | pAddBARspBuffer, txFlag ); |
| 5385 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5386 | psessionEntry->peSessionId, |
| 5387 | halStatus)); |
| 5388 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5389 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5390 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5391 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5392 | halStatus ); |
| 5393 | |
| 5394 | // FIXME - HAL error codes are different from PE error |
| 5395 | // codes!! And, this routine is returning tSirRetStatus |
| 5396 | statusCode = eSIR_FAILURE; |
| 5397 | //Pkt will be freed up by the callback |
| 5398 | return statusCode; |
| 5399 | } |
| 5400 | else |
| 5401 | return eSIR_SUCCESS; |
| 5402 | |
| 5403 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5404 | // Release buffer, if allocated |
| 5405 | if( NULL != pAddBARspBuffer ) |
| 5406 | palPktFree( pMac->hHdd, |
| 5407 | HAL_TXRX_FRM_802_11_MGMT, |
| 5408 | (void *) pAddBARspBuffer, |
| 5409 | (void *) pPacket ); |
| 5410 | |
| 5411 | return statusCode; |
| 5412 | } |
| 5413 | |
| 5414 | /** |
| 5415 | * \brief Send a DELBA Indication Action Frame to peer |
| 5416 | * |
| 5417 | * \sa limSendDelBAInd |
| 5418 | * |
| 5419 | * \param pMac The global tpAniSirGlobal object |
| 5420 | * |
| 5421 | * \param peerMacAddr MAC Address of peer |
| 5422 | * |
| 5423 | * \param reasonCode Reason for the DELBA notification |
| 5424 | * |
| 5425 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5426 | * This identifies the TID for which the BA session is |
| 5427 | * being deleted. |
| 5428 | * |
| 5429 | * \return eSIR_SUCCESS if setup completes successfully |
| 5430 | * eSIR_FAILURE is some problem is encountered |
| 5431 | */ |
| 5432 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5433 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5434 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5435 | tDot11fDelBAInd frmDelBAInd; |
| 5436 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5437 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5438 | tpSirMacMgmtHdr pMacHdr; |
| 5439 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5440 | tSirRetStatus statusCode; |
| 5441 | eHalStatus halStatus; |
| 5442 | void *pPacket; |
| 5443 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5444 | |
| 5445 | if(NULL == psessionEntry) |
| 5446 | { |
| 5447 | return eSIR_FAILURE; |
| 5448 | } |
| 5449 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5450 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5451 | |
| 5452 | // Category - 3 (BA) |
| 5453 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5454 | // Action - 2 (DELBA) |
| 5455 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5456 | |
| 5457 | // Fill the DELBA Parameter Set as provided by caller |
| 5458 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5459 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5460 | |
| 5461 | // BA Starting Sequence Number |
| 5462 | // Fragment number will always be zero |
| 5463 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5464 | |
| 5465 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5466 | |
| 5467 | if( DOT11F_FAILED( nStatus )) |
| 5468 | { |
| 5469 | limLog( pMac, LOGW, |
| 5470 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5471 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5472 | nStatus ); |
| 5473 | |
| 5474 | // We'll fall back on the worst case scenario: |
| 5475 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5476 | } |
| 5477 | else if( DOT11F_WARNED( nStatus )) |
| 5478 | { |
| 5479 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5480 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5481 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5482 | nStatus ); |
| 5483 | } |
| 5484 | |
| 5485 | // Add the MGMT header to frame length |
| 5486 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5487 | |
| 5488 | // Allocate shared memory |
| 5489 | if( eHAL_STATUS_SUCCESS != |
| 5490 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5491 | HAL_TXRX_FRM_802_11_MGMT, |
| 5492 | (tANI_U16) frameLen, |
| 5493 | (void **) &pDelBAIndBuffer, |
| 5494 | (void **) &pPacket ))) |
| 5495 | { |
| 5496 | // Log error |
| 5497 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5498 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5499 | frameLen, |
| 5500 | halStatus ); |
| 5501 | |
| 5502 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5503 | goto returnAfterError; |
| 5504 | } |
| 5505 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5506 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | |
| 5508 | // Copy necessary info to BD |
| 5509 | if( eSIR_SUCCESS != |
| 5510 | (statusCode = limPopulateMacHeader( pMac, |
| 5511 | pDelBAIndBuffer, |
| 5512 | SIR_MAC_MGMT_FRAME, |
| 5513 | SIR_MAC_MGMT_ACTION, |
| 5514 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5515 | goto returnAfterError; |
| 5516 | |
| 5517 | // Update A3 with the BSSID |
| 5518 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5519 | |
| 5520 | #if 0 |
| 5521 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5522 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5523 | WNI_CFG_BSSID, |
| 5524 | (tANI_U8 *) pMacHdr->bssId, |
| 5525 | &cfgLen )) |
| 5526 | { |
| 5527 | limLog( pMac, LOGP, |
| 5528 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5529 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5530 | |
| 5531 | // FIXME - Need to convert to tSirRetStatus |
| 5532 | statusCode = eSIR_FAILURE; |
| 5533 | goto returnAfterError; |
| 5534 | } |
| 5535 | #endif //TO SUPPORT BT-AMP |
| 5536 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5537 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5538 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5539 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5540 | #endif |
| 5541 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5542 | // Now, we're ready to "pack" the frames |
| 5543 | nStatus = dot11fPackDelBAInd( pMac, |
| 5544 | &frmDelBAInd, |
| 5545 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5546 | nPayload, |
| 5547 | &nPayload ); |
| 5548 | |
| 5549 | if( DOT11F_FAILED( nStatus )) |
| 5550 | { |
| 5551 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5552 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5553 | nStatus ); |
| 5554 | |
| 5555 | // FIXME - Need to convert to tSirRetStatus |
| 5556 | statusCode = eSIR_FAILURE; |
| 5557 | goto returnAfterError; |
| 5558 | } |
| 5559 | else if( DOT11F_WARNED( nStatus )) |
| 5560 | { |
| 5561 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5562 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5563 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5564 | } |
| 5565 | |
| 5566 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5567 | FL( "Sending a DELBA IND to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5568 | limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW ); |
| 5569 | |
| 5570 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5571 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5572 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5573 | ) |
| 5574 | { |
| 5575 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5576 | } |
| 5577 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5578 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5579 | psessionEntry->peSessionId, |
| 5580 | pMacHdr->fc.subType)); |
| 5581 | halStatus = halTxFrame( pMac, |
| 5582 | pPacket, |
| 5583 | (tANI_U16) frameLen, |
| 5584 | HAL_TXRX_FRM_802_11_MGMT, |
| 5585 | ANI_TXDIR_TODS, |
| 5586 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5587 | limTxComplete, |
| 5588 | pDelBAIndBuffer, txFlag ); |
| 5589 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5590 | psessionEntry->peSessionId, |
| 5591 | halStatus)); |
| 5592 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5593 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5594 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5595 | statusCode = eSIR_FAILURE; |
| 5596 | //Pkt will be freed up by the callback |
| 5597 | return statusCode; |
| 5598 | } |
| 5599 | else |
| 5600 | return eSIR_SUCCESS; |
| 5601 | |
| 5602 | returnAfterError: |
| 5603 | |
| 5604 | // Release buffer, if allocated |
| 5605 | if( NULL != pDelBAIndBuffer ) |
| 5606 | palPktFree( pMac->hHdd, |
| 5607 | HAL_TXRX_FRM_802_11_MGMT, |
| 5608 | (void *) pDelBAIndBuffer, |
| 5609 | (void *) pPacket ); |
| 5610 | |
| 5611 | return statusCode; |
| 5612 | } |
| 5613 | |
| 5614 | #if defined WLAN_FEATURE_VOWIFI |
| 5615 | |
| 5616 | /** |
| 5617 | * \brief Send a Neighbor Report Request Action frame |
| 5618 | * |
| 5619 | * |
| 5620 | * \param pMac Pointer to the global MAC structure |
| 5621 | * |
| 5622 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5623 | * |
| 5624 | * \param peer mac address of peer station. |
| 5625 | * |
| 5626 | * \param psessionEntry address of session entry. |
| 5627 | * |
| 5628 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5629 | * |
| 5630 | * |
| 5631 | */ |
| 5632 | |
| 5633 | tSirRetStatus |
| 5634 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5635 | tpSirMacNeighborReportReq pNeighborReq, |
| 5636 | tSirMacAddr peer, |
| 5637 | tpPESession psessionEntry |
| 5638 | ) |
| 5639 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5640 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5641 | tDot11fNeighborReportRequest frm; |
| 5642 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5643 | tpSirMacMgmtHdr pMacHdr; |
| 5644 | tANI_U32 nBytes, nPayload, nStatus; |
| 5645 | void *pPacket; |
| 5646 | eHalStatus halstatus; |
| 5647 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5648 | |
| 5649 | if ( psessionEntry == NULL ) |
| 5650 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5651 | limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Neighbor Report request action frame") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5652 | return eSIR_FAILURE; |
| 5653 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5654 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5655 | |
| 5656 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5657 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5658 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5659 | |
| 5660 | |
| 5661 | if( pNeighborReq->ssid_present ) |
| 5662 | { |
| 5663 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5664 | } |
| 5665 | |
| 5666 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5667 | if ( DOT11F_FAILED( nStatus ) ) |
| 5668 | { |
| 5669 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5670 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5671 | nStatus ); |
| 5672 | // We'll fall back on the worst case scenario: |
| 5673 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5674 | } |
| 5675 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5676 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5677 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5678 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5679 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5680 | } |
| 5681 | |
| 5682 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5683 | |
| 5684 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5685 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5686 | { |
| 5687 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Neighbor " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5688 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5689 | return eSIR_FAILURE; |
| 5690 | } |
| 5691 | |
| 5692 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5693 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5694 | |
| 5695 | // Copy necessary info to BD |
| 5696 | if( eSIR_SUCCESS != |
| 5697 | (statusCode = limPopulateMacHeader( pMac, |
| 5698 | pFrame, |
| 5699 | SIR_MAC_MGMT_FRAME, |
| 5700 | SIR_MAC_MGMT_ACTION, |
| 5701 | peer, psessionEntry->selfMacAddr))) |
| 5702 | goto returnAfterError; |
| 5703 | |
| 5704 | // Update A3 with the BSSID |
| 5705 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5706 | |
| 5707 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5708 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5709 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5710 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5711 | #endif |
| 5712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5713 | // Now, we're ready to "pack" the frames |
| 5714 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 5715 | &frm, |
| 5716 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5717 | nPayload, |
| 5718 | &nPayload ); |
| 5719 | |
| 5720 | if( DOT11F_FAILED( nStatus )) |
| 5721 | { |
| 5722 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5723 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | nStatus ); |
| 5725 | |
| 5726 | // FIXME - Need to convert to tSirRetStatus |
| 5727 | statusCode = eSIR_FAILURE; |
| 5728 | goto returnAfterError; |
| 5729 | } |
| 5730 | else if( DOT11F_WARNED( nStatus )) |
| 5731 | { |
| 5732 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5733 | FL( "There were warnings while packing Neighbor Report " |
| 5734 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5735 | } |
| 5736 | |
| 5737 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5738 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5739 | limPrintMacAddr( pMac, peer, LOGW ); |
| 5740 | |
| 5741 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5742 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5743 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5744 | ) |
| 5745 | { |
| 5746 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5747 | } |
| 5748 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5749 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5750 | psessionEntry->peSessionId, |
| 5751 | pMacHdr->fc.subType)); |
| 5752 | halstatus = halTxFrame( pMac, |
| 5753 | pPacket, |
| 5754 | (tANI_U16) nBytes, |
| 5755 | HAL_TXRX_FRM_802_11_MGMT, |
| 5756 | ANI_TXDIR_TODS, |
| 5757 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5758 | limTxComplete, |
| 5759 | pFrame, txFlag ); |
| 5760 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5761 | psessionEntry->peSessionId, |
| 5762 | halstatus)); |
| 5763 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5765 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5766 | statusCode = eSIR_FAILURE; |
| 5767 | //Pkt will be freed up by the callback |
| 5768 | return statusCode; |
| 5769 | } |
| 5770 | else |
| 5771 | return eSIR_SUCCESS; |
| 5772 | |
| 5773 | returnAfterError: |
| 5774 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5775 | |
| 5776 | return statusCode; |
| 5777 | } // End limSendNeighborReportRequestFrame. |
| 5778 | |
| 5779 | /** |
| 5780 | * \brief Send a Link Report Action frame |
| 5781 | * |
| 5782 | * |
| 5783 | * \param pMac Pointer to the global MAC structure |
| 5784 | * |
| 5785 | * \param pLinkReport Address of a tSirMacLinkReport |
| 5786 | * |
| 5787 | * \param peer mac address of peer station. |
| 5788 | * |
| 5789 | * \param psessionEntry address of session entry. |
| 5790 | * |
| 5791 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5792 | * |
| 5793 | * |
| 5794 | */ |
| 5795 | |
| 5796 | tSirRetStatus |
| 5797 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 5798 | tpSirMacLinkReport pLinkReport, |
| 5799 | tSirMacAddr peer, |
| 5800 | tpPESession psessionEntry |
| 5801 | ) |
| 5802 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5803 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5804 | tDot11fLinkMeasurementReport frm; |
| 5805 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5806 | tpSirMacMgmtHdr pMacHdr; |
| 5807 | tANI_U32 nBytes, nPayload, nStatus; |
| 5808 | void *pPacket; |
| 5809 | eHalStatus halstatus; |
| 5810 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5811 | |
| 5812 | |
| 5813 | if ( psessionEntry == NULL ) |
| 5814 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5815 | limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Link Report action frame") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5816 | return eSIR_FAILURE; |
| 5817 | } |
| 5818 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5819 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5820 | |
| 5821 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5822 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 5823 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 5824 | |
| 5825 | |
| 5826 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 5827 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 5828 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 5829 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 5830 | //such case this way than changing the frame parser. |
| 5831 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 5832 | frm.TPCEleLen.TPCLen = 2; |
| 5833 | frm.TxPower.txPower = pLinkReport->txPower; |
| 5834 | frm.LinkMargin.linkMargin = 0; |
| 5835 | |
| 5836 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 5837 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 5838 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 5839 | frm.RSNI.rsni = pLinkReport->rsni; |
| 5840 | |
| 5841 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 5842 | if ( DOT11F_FAILED( nStatus ) ) |
| 5843 | { |
| 5844 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5845 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | nStatus ); |
| 5847 | // We'll fall back on the worst case scenario: |
| 5848 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 5849 | } |
| 5850 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5851 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5852 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5853 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5854 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5855 | } |
| 5856 | |
| 5857 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5858 | |
| 5859 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5860 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5861 | { |
| 5862 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Link " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5863 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5864 | return eSIR_FAILURE; |
| 5865 | } |
| 5866 | |
| 5867 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5868 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5869 | |
| 5870 | // Copy necessary info to BD |
| 5871 | if( eSIR_SUCCESS != |
| 5872 | (statusCode = limPopulateMacHeader( pMac, |
| 5873 | pFrame, |
| 5874 | SIR_MAC_MGMT_FRAME, |
| 5875 | SIR_MAC_MGMT_ACTION, |
| 5876 | peer, psessionEntry->selfMacAddr))) |
| 5877 | goto returnAfterError; |
| 5878 | |
| 5879 | // Update A3 with the BSSID |
| 5880 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5881 | |
| 5882 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5883 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5884 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5885 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5886 | #endif |
| 5887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5888 | // Now, we're ready to "pack" the frames |
| 5889 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 5890 | &frm, |
| 5891 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5892 | nPayload, |
| 5893 | &nPayload ); |
| 5894 | |
| 5895 | if( DOT11F_FAILED( nStatus )) |
| 5896 | { |
| 5897 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5898 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5899 | nStatus ); |
| 5900 | |
| 5901 | // FIXME - Need to convert to tSirRetStatus |
| 5902 | statusCode = eSIR_FAILURE; |
| 5903 | goto returnAfterError; |
| 5904 | } |
| 5905 | else if( DOT11F_WARNED( nStatus )) |
| 5906 | { |
| 5907 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5908 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 5909 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5910 | } |
| 5911 | |
| 5912 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5913 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5914 | limPrintMacAddr( pMac, peer, LOGW ); |
| 5915 | |
| 5916 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5917 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5918 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5919 | ) |
| 5920 | { |
| 5921 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5922 | } |
| 5923 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 5924 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5925 | psessionEntry->peSessionId, |
| 5926 | pMacHdr->fc.subType)); |
| 5927 | halstatus = halTxFrame( pMac, |
| 5928 | pPacket, |
| 5929 | (tANI_U16) nBytes, |
| 5930 | HAL_TXRX_FRM_802_11_MGMT, |
| 5931 | ANI_TXDIR_TODS, |
| 5932 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5933 | limTxComplete, |
| 5934 | pFrame, txFlag ); |
| 5935 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5936 | psessionEntry->peSessionId, |
| 5937 | halstatus)); |
| 5938 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5939 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5940 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5941 | statusCode = eSIR_FAILURE; |
| 5942 | //Pkt will be freed up by the callback |
| 5943 | return statusCode; |
| 5944 | } |
| 5945 | else |
| 5946 | return eSIR_SUCCESS; |
| 5947 | |
| 5948 | returnAfterError: |
| 5949 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5950 | |
| 5951 | return statusCode; |
| 5952 | } // End limSendLinkReportActionFrame. |
| 5953 | |
| 5954 | /** |
| 5955 | * \brief Send a Beacon Report Action frame |
| 5956 | * |
| 5957 | * |
| 5958 | * \param pMac Pointer to the global MAC structure |
| 5959 | * |
| 5960 | * \param dialog_token dialog token to be used in the action frame. |
| 5961 | * |
| 5962 | * \param num_report number of reports in pRRMReport. |
| 5963 | * |
| 5964 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 5965 | * |
| 5966 | * \param peer mac address of peer station. |
| 5967 | * |
| 5968 | * \param psessionEntry address of session entry. |
| 5969 | * |
| 5970 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5971 | * |
| 5972 | * |
| 5973 | */ |
| 5974 | |
| 5975 | tSirRetStatus |
| 5976 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 5977 | tANI_U8 dialog_token, |
| 5978 | tANI_U8 num_report, |
| 5979 | tpSirMacRadioMeasureReport pRRMReport, |
| 5980 | tSirMacAddr peer, |
| 5981 | tpPESession psessionEntry |
| 5982 | ) |
| 5983 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5984 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 5985 | tANI_U8 *pFrame; |
| 5986 | tpSirMacMgmtHdr pMacHdr; |
| 5987 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5989 | eHalStatus halstatus; |
| 5990 | tANI_U8 i; |
| 5991 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5992 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5993 | tDot11fRadioMeasurementReport *frm = |
| 5994 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 5995 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5996 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5997 | return eSIR_FAILURE; |
| 5998 | } |
| 5999 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6000 | if ( psessionEntry == NULL ) |
| 6001 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6002 | limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6003 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6004 | return eSIR_FAILURE; |
| 6005 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6006 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6007 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6008 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6009 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6010 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6011 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6012 | frm->num_MeasurementReport = (num_report > RADIO_REPORTS_MAX_IN_A_FRAME ) ? RADIO_REPORTS_MAX_IN_A_FRAME : num_report; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6013 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6014 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6015 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6016 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6017 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6018 | frm->MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6019 | switch( pRRMReport[i].type ) |
| 6020 | { |
| 6021 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6022 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6023 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6024 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6025 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6026 | break; |
| 6027 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6028 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6029 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6030 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6031 | break; |
| 6032 | } |
| 6033 | } |
| 6034 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6035 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6036 | if ( DOT11F_FAILED( nStatus ) ) |
| 6037 | { |
| 6038 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6039 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6040 | nStatus ); |
| 6041 | // We'll fall back on the worst case scenario: |
| 6042 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6043 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6044 | return eSIR_FAILURE; |
| 6045 | } |
| 6046 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6047 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6048 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6049 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6050 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6051 | } |
| 6052 | |
| 6053 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6054 | |
| 6055 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6056 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6057 | { |
| 6058 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6059 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6060 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6061 | return eSIR_FAILURE; |
| 6062 | } |
| 6063 | |
| 6064 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6065 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6066 | |
| 6067 | // Copy necessary info to BD |
| 6068 | if( eSIR_SUCCESS != |
| 6069 | (statusCode = limPopulateMacHeader( pMac, |
| 6070 | pFrame, |
| 6071 | SIR_MAC_MGMT_FRAME, |
| 6072 | SIR_MAC_MGMT_ACTION, |
| 6073 | peer, psessionEntry->selfMacAddr))) |
| 6074 | goto returnAfterError; |
| 6075 | |
| 6076 | // Update A3 with the BSSID |
| 6077 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6078 | |
| 6079 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6080 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6081 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6082 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6083 | #endif |
| 6084 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6085 | // Now, we're ready to "pack" the frames |
| 6086 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6087 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6088 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6089 | nPayload, |
| 6090 | &nPayload ); |
| 6091 | |
| 6092 | if( DOT11F_FAILED( nStatus )) |
| 6093 | { |
| 6094 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6095 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6096 | nStatus ); |
| 6097 | |
| 6098 | // FIXME - Need to convert to tSirRetStatus |
| 6099 | statusCode = eSIR_FAILURE; |
| 6100 | goto returnAfterError; |
| 6101 | } |
| 6102 | else if( DOT11F_WARNED( nStatus )) |
| 6103 | { |
| 6104 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6105 | FL( "There were warnings while packing Radio " |
| 6106 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6107 | } |
| 6108 | |
| 6109 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6110 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6111 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6112 | |
| 6113 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6114 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6115 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6116 | ) |
| 6117 | { |
| 6118 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6119 | } |
| 6120 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6121 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6122 | psessionEntry->peSessionId, |
| 6123 | pMacHdr->fc.subType)); |
| 6124 | halstatus = halTxFrame( pMac, |
| 6125 | pPacket, |
| 6126 | (tANI_U16) nBytes, |
| 6127 | HAL_TXRX_FRM_802_11_MGMT, |
| 6128 | ANI_TXDIR_TODS, |
| 6129 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6130 | limTxComplete, |
| 6131 | pFrame, txFlag ); |
| 6132 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6133 | psessionEntry->peSessionId, |
| 6134 | halstatus)); |
| 6135 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6136 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6137 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6138 | statusCode = eSIR_FAILURE; |
| 6139 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6140 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6141 | return statusCode; |
| 6142 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6143 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6144 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6145 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6147 | |
| 6148 | returnAfterError: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6149 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6150 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6151 | return statusCode; |
| 6152 | } // End limSendBeaconReportActionFrame. |
| 6153 | |
| 6154 | #endif |
| 6155 | |
| 6156 | #ifdef WLAN_FEATURE_11W |
| 6157 | /** |
| 6158 | * \brief Send SA query response action frame to peer |
| 6159 | * |
| 6160 | * \sa limSendSaQueryResponseFrame |
| 6161 | * |
| 6162 | * |
| 6163 | * \param pMac The global tpAniSirGlobal object |
| 6164 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6165 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6166 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6167 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6168 | * |
| 6169 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6170 | * |
| 6171 | * \return eSIR_SUCCESS if setup completes successfully |
| 6172 | * eSIR_FAILURE is some problem is encountered |
| 6173 | */ |
| 6174 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6175 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6176 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6177 | { |
| 6178 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6179 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6180 | tANI_U8 *pFrame; |
| 6181 | tSirRetStatus nSirStatus; |
| 6182 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6183 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6184 | void *pPacket; |
| 6185 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6186 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6187 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6188 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6189 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6190 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6191 | action: 0 --> SA query request action frame |
| 6192 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6193 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6194 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6195 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6196 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6197 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6198 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6199 | if ( DOT11F_FAILED( nStatus ) ) |
| 6200 | { |
| 6201 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6202 | "or a SA Query Response (0x%08x)."), |
| 6203 | nStatus ); |
| 6204 | // We'll fall back on the worst case scenario: |
| 6205 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6206 | } |
| 6207 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6208 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6209 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6210 | "the packed size for an SA Query Response" |
| 6211 | " (0x%08x)."), nStatus ); |
| 6212 | } |
| 6213 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6214 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6215 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6216 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6217 | { |
| 6218 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA query response" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6219 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6220 | return eSIR_FAILURE; |
| 6221 | } |
| 6222 | |
| 6223 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6224 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6225 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6226 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6227 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6228 | pFrame, |
| 6229 | SIR_MAC_MGMT_FRAME, |
| 6230 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6231 | peer, psessionEntry->selfMacAddr ); |
| 6232 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6233 | goto returnAfterError; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6234 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6235 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6236 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6237 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6238 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6239 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6240 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6241 | // in the FC |
| 6242 | if ( psessionEntry->limRmfEnabled ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6243 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6244 | pMacHdr->fc.wep = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6245 | } |
| 6246 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6247 | // Pack 11w SA query response frame |
| 6248 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6249 | &frm, |
| 6250 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6251 | nPayload, |
| 6252 | &nPayload ); |
| 6253 | |
| 6254 | if ( DOT11F_FAILED( nStatus )) |
| 6255 | { |
| 6256 | limLog( pMac, LOGE, |
| 6257 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6258 | nStatus ); |
| 6259 | // FIXME - Need to convert to tSirRetStatus |
| 6260 | nSirStatus = eSIR_FAILURE; |
| 6261 | goto returnAfterError; |
| 6262 | } |
| 6263 | else if ( DOT11F_WARNED( nStatus )) |
| 6264 | { |
| 6265 | limLog( pMac, LOGW, |
| 6266 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6267 | nStatus); |
| 6268 | } |
| 6269 | |
| 6270 | limLog( pMac, LOG1, |
| 6271 | FL( "Sending a SA Query Response to " )); |
| 6272 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6273 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6274 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6275 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6276 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6277 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6278 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6279 | ) |
| 6280 | { |
| 6281 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6282 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6283 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6284 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6285 | psessionEntry->peSessionId, |
| 6286 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6287 | halstatus = halTxFrame( pMac, |
| 6288 | pPacket, |
| 6289 | (tANI_U16) nBytes, |
| 6290 | HAL_TXRX_FRM_802_11_MGMT, |
| 6291 | ANI_TXDIR_TODS, |
| 6292 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6293 | limTxComplete, |
| 6294 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame] | 6295 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6296 | psessionEntry->peSessionId, |
| 6297 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6298 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6299 | { |
| 6300 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6301 | nSirStatus = eSIR_FAILURE; |
| 6302 | //Pkt will be freed up by the callback |
| 6303 | return nSirStatus; |
| 6304 | } |
| 6305 | else { |
| 6306 | return eSIR_SUCCESS; |
| 6307 | } |
| 6308 | |
| 6309 | returnAfterError: |
| 6310 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6311 | return nSirStatus; |
| 6312 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6313 | #endif |