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 | |
| 237 | /* |
| 238 | * session context may or may not be present, when probe request needs to be sent out. |
| 239 | * following cases exist: |
| 240 | * --heartbeat failure: session needed |
| 241 | * --join req: session needed |
| 242 | * --foreground scan: no session |
| 243 | * --background scan: no session |
| 244 | * --schBeaconProcessing: to get EDCA parameters: session needed |
| 245 | * If session context does not exist, some IEs will be populated from CFGs, |
| 246 | * e.g. Supported and Extended rate set IEs |
| 247 | */ |
| 248 | psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId); |
| 249 | |
| 250 | // The scheme here is to fill out a 'tDot11fProbeRequest' structure |
| 251 | // and then hand it off to 'dot11fPackProbeRequest' (for |
| 252 | // serialization). We start by zero-initializing the structure: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 253 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 254 | |
| 255 | // & delegating to assorted helpers: |
| 256 | PopulateDot11fSSID( pMac, pSsid, &pr.SSID ); |
| 257 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 258 | if( nAdditionalIELen && pAdditionalIE ) |
| 259 | { |
| 260 | p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen); |
| 261 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 262 | /* Don't include 11b rate only when device is doing P2P Search */ |
| 263 | if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) && |
| 264 | ( p2pIe != NULL ) && |
| 265 | /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */ |
| 266 | ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) && |
| 267 | pMac->lim.gpLimMlmScanReq->p2pSearch ) || |
| 268 | ( ( psessionEntry != NULL ) && |
| 269 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
| 270 | ) |
| 271 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | { |
| 273 | /* In the below API pass channel number > 14, do that it fills only |
| 274 | * 11a rates in supported rates */ |
| 275 | PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry); |
| 276 | } |
| 277 | else |
| 278 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 279 | PopulateDot11fSuppRates( pMac, nChannelNum, |
| 280 | &pr.SuppRates,psessionEntry); |
| 281 | |
| 282 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 283 | { |
| 284 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 285 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 286 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | |
| 288 | #if defined WLAN_FEATURE_VOWIFI |
| 289 | //Table 7-14 in IEEE Std. 802.11k-2008 says |
| 290 | //DS params "can" be present in RRM is disabled and "is" present if |
| 291 | //RRM is enabled. It should be ok even if we add it into probe req when |
| 292 | //RRM is not enabled. |
| 293 | PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry ); |
| 294 | //Call RRM module to get the tx power for management used. |
| 295 | { |
| 296 | tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry ); |
| 297 | PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 ); |
| 298 | } |
| 299 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 300 | |
| 301 | if (psessionEntry != NULL ) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 302 | psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 303 | //Include HT Capability IE |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 304 | if (psessionEntry->htCapability) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 305 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 306 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 307 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 308 | } else { //psessionEntry == NULL |
| 309 | if (IS_DOT11_MODE_HT(dot11mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 310 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 311 | PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 312 | } |
| 313 | } |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 314 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 315 | /* Get HT40 capability for 2.4GHz band */ |
| 316 | wlan_cfgGetInt(pMac,WNI_CFG_CHANNEL_BONDING_24G,&chanbond24G); |
| 317 | if( (nChannelNum <= SIR_11B_CHANNEL_END) && chanbond24G != TRUE) |
Gopichand Nakkala | 40bc650 | 2012-12-20 16:55:36 -0800 | [diff] [blame] | 318 | { |
| 319 | pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; |
| 320 | pr.HTCaps.shortGI40MHz = 0; |
| 321 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 322 | #ifdef WLAN_FEATURE_11AC |
| 323 | if (psessionEntry != NULL ) { |
| 324 | psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 325 | //Include HT Capability IE |
| 326 | if (psessionEntry->vhtCapability) |
| 327 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 328 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 329 | } |
| 330 | } else { |
| 331 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 332 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 333 | PopulateDot11fVHTCaps( pMac, &pr.VHTCaps ); |
| 334 | } |
| 335 | } |
| 336 | #endif |
| 337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | |
| 339 | // That's it-- now we pack it. First, how much space are we going to |
| 340 | // need? |
| 341 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 342 | if ( DOT11F_FAILED( nStatus ) ) |
| 343 | { |
| 344 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 345 | "or a Probe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 346 | // We'll fall back on the worst case scenario: |
| 347 | nPayload = sizeof( tDot11fProbeRequest ); |
| 348 | } |
| 349 | else if ( DOT11F_WARNED( nStatus ) ) |
| 350 | { |
| 351 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 352 | "the packed size for a Probe Request (" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 353 | "0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen; |
| 357 | |
| 358 | // Ok-- try to allocate some memory: |
| 359 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 360 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 361 | ( void** ) &pPacket ); |
| 362 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 363 | { |
| 364 | 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] | 365 | "be Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 366 | return eSIR_MEM_ALLOC_FAILED; |
| 367 | } |
| 368 | |
| 369 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 370 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 371 | |
| 372 | // Next, we fill out the buffer descriptor: |
| 373 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 374 | SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 375 | if ( eSIR_SUCCESS != nSirStatus ) |
| 376 | { |
| 377 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 378 | "tor for a Probe Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 379 | nSirStatus ); |
| 380 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 381 | ( void* ) pFrame, ( void* ) pPacket ); |
| 382 | return nSirStatus; // allocated! |
| 383 | } |
| 384 | |
| 385 | // That done, pack the Probe Request: |
| 386 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 387 | sizeof( tSirMacMgmtHdr ), |
| 388 | nPayload, &nPayload ); |
| 389 | if ( DOT11F_FAILED( nStatus ) ) |
| 390 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 391 | limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | nStatus ); |
| 393 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 394 | return eSIR_FAILURE; // allocated! |
| 395 | } |
| 396 | else if ( DOT11F_WARNED( nStatus ) ) |
| 397 | { |
| 398 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 399 | "robe Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 400 | } |
| 401 | |
| 402 | // Append any AddIE if present. |
| 403 | if( nAdditionalIELen ) |
| 404 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 405 | vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | pAdditionalIE, nAdditionalIELen ); |
| 407 | nPayload += nAdditionalIELen; |
| 408 | } |
| 409 | |
| 410 | /* If this probe request is sent during P2P Search State, then we need |
| 411 | * to send it at OFDM rate. |
| 412 | */ |
| 413 | if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 414 | || (( pMac->lim.gpLimMlmScanReq != NULL) && |
| 415 | pMac->lim.gpLimMlmScanReq->p2pSearch ) |
Gopichand Nakkala | 6796721 | 2013-02-15 17:31:15 +0530 | [diff] [blame] | 416 | /* For unicast probe req mgmt from Join function |
| 417 | we don't set above variables. So we need to add |
| 418 | one more check whether it is pePersona is P2P_CLIENT or not */ |
| 419 | || ( ( psessionEntry != NULL ) && |
| 420 | ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 421 | ) |
| 422 | { |
| 423 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 424 | } |
| 425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, |
| 427 | HAL_TXRX_FRM_802_11_MGMT, |
| 428 | ANI_TXDIR_TODS, |
| 429 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 430 | limTxComplete, pFrame, txFlag ); |
| 431 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 432 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 433 | limLog( pMac, LOGE, FL("could not send Probe Request frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 434 | //Pkt will be freed up by the callback |
| 435 | return eSIR_FAILURE; |
| 436 | } |
| 437 | |
| 438 | return eSIR_SUCCESS; |
| 439 | } // End limSendProbeReqMgmtFrame. |
| 440 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 441 | tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac, |
| 442 | tANI_U8* addIE, tANI_U16 *addnIELen, |
| 443 | tANI_U8 probeReqP2pIe) |
| 444 | { |
| 445 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 446 | from additional IE */ |
| 447 | if(!probeReqP2pIe) |
| 448 | { |
| 449 | tANI_U8* tempbuf = NULL; |
| 450 | tANI_U16 tempLen = 0; |
| 451 | int left = *addnIELen; |
| 452 | v_U8_t *ptr = addIE; |
| 453 | v_U8_t elem_id, elem_len; |
| 454 | |
| 455 | if(NULL == addIE) |
| 456 | { |
| 457 | PELOGE(limLog(pMac, LOGE, |
| 458 | FL(" NULL addIE pointer"));) |
| 459 | return eSIR_FAILURE; |
| 460 | } |
| 461 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 462 | tempbuf = vos_mem_malloc(left); |
| 463 | if ( NULL == tempbuf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 464 | { |
| 465 | PELOGE(limLog(pMac, LOGE, |
| 466 | FL("Unable to allocate memory to store addn IE"));) |
| 467 | return eSIR_MEM_ALLOC_FAILED; |
| 468 | } |
| 469 | |
| 470 | while(left >= 2) |
| 471 | { |
| 472 | elem_id = ptr[0]; |
| 473 | elem_len = ptr[1]; |
| 474 | left -= 2; |
| 475 | if(elem_len > left) |
| 476 | { |
| 477 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 478 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 479 | elem_id,elem_len,left); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 480 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 481 | return eSIR_FAILURE; |
| 482 | } |
| 483 | if ( !( (SIR_MAC_EID_VENDOR == elem_id) && |
| 484 | (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) ) |
| 485 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 486 | vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | tempLen += (elem_len + 2); |
| 488 | } |
| 489 | left -= elem_len; |
| 490 | ptr += (elem_len + 2); |
| 491 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 492 | vos_mem_copy (addIE, tempbuf, tempLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | *addnIELen = tempLen; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 494 | vos_mem_free(tempbuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 495 | } |
| 496 | return eSIR_SUCCESS; |
| 497 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 498 | |
| 499 | void |
| 500 | limSendProbeRspMgmtFrame(tpAniSirGlobal pMac, |
| 501 | tSirMacAddr peerMacAddr, |
| 502 | tpAniSSID pSsid, |
| 503 | short nStaId, |
| 504 | tANI_U8 nKeepAlive, |
| 505 | tpPESession psessionEntry, |
| 506 | tANI_U8 probeReqP2pIe) |
| 507 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 508 | tDot11fProbeResponse *pFrm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 509 | tSirRetStatus nSirStatus; |
| 510 | tANI_U32 cfg, nPayload, nBytes, nStatus; |
| 511 | tpSirMacMgmtHdr pMacHdr; |
| 512 | tANI_U8 *pFrame; |
| 513 | void *pPacket; |
| 514 | eHalStatus halstatus; |
| 515 | tANI_U32 addnIEPresent; |
| 516 | tANI_U32 addnIE1Len=0; |
| 517 | tANI_U32 addnIE2Len=0; |
| 518 | tANI_U32 addnIE3Len=0; |
| 519 | tANI_U16 totalAddnIeLen = 0; |
| 520 | tANI_U32 wpsApEnable=0, tmp; |
| 521 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 522 | tANI_U8 *addIE = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 523 | tANI_U8 *pP2pIe = NULL; |
| 524 | tANI_U8 noaLen = 0; |
| 525 | tANI_U8 total_noaLen = 0; |
| 526 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 527 | + SIR_P2P_IE_HEADER_LEN]; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 528 | 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] | 529 | |
| 530 | if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests |
| 531 | { |
| 532 | return; // in this case. |
| 533 | } |
| 534 | |
| 535 | if(NULL == psessionEntry) |
| 536 | { |
| 537 | return; |
| 538 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 539 | |
| 540 | pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse)); |
| 541 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 542 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 543 | limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 544 | return; |
| 545 | } |
| 546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 547 | // Fill out 'frm', after which we'll just hand the struct off to |
| 548 | // 'dot11fPackProbeResponse'. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 549 | vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 550 | |
| 551 | // Timestamp to be updated by TFP, below. |
| 552 | |
| 553 | // Beacon Interval: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 554 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 555 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 556 | pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 557 | } |
| 558 | else |
| 559 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 560 | nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg); |
| 561 | if (eSIR_SUCCESS != nSirStatus) |
| 562 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 563 | 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] | 564 | nSirStatus ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 565 | vos_mem_free(pFrm); |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 566 | return; |
| 567 | } |
| 568 | pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg; |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 569 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 570 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 571 | PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry ); |
| 572 | PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 574 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 575 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 576 | PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry); |
| 577 | PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 578 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 579 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 580 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 581 | { |
| 582 | if(psessionEntry->wps_state != SAP_WPS_DISABLED) |
| 583 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 584 | PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | } |
| 586 | } |
| 587 | else |
| 588 | { |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 589 | 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] | 590 | 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] | 591 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 592 | wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 593 | |
Jeff Johnson | 3c3e178 | 2013-02-27 10:48:42 -0800 | [diff] [blame] | 594 | if (wpsApEnable) |
| 595 | { |
| 596 | PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes); |
| 597 | } |
| 598 | |
| 599 | if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN) |
| 600 | { |
| 601 | PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 602 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS; |
| 603 | } |
| 604 | |
| 605 | if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END) |
| 606 | { |
| 607 | DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes); |
| 608 | pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP; |
| 609 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 610 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 612 | PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry); |
| 613 | PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 615 | |
| 616 | if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 617 | PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 618 | |
| 619 | |
| 620 | // N.B. In earlier implementations, the RSN IE would be placed in |
| 621 | // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined. |
| 622 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 623 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 624 | |
| 625 | //Populate HT IEs, when operating in 11n or Taurus modes. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 626 | if ( psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 627 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 628 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 629 | PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 630 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 631 | #ifdef WLAN_FEATURE_11AC |
| 632 | if(psessionEntry->vhtCapability) |
| 633 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 634 | limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 635 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
| 636 | PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 637 | // we do not support multi users yet |
| 638 | //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 639 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 640 | } |
| 641 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 642 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 643 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 644 | if ( psessionEntry->pLimStartBssReq ) |
| 645 | { |
| 646 | PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 647 | &pFrm->WPA ); |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 648 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
| 649 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 650 | } |
| 651 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 652 | PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 653 | |
| 654 | #if defined(FEATURE_WLAN_WAPI) |
| 655 | if( psessionEntry->pLimStartBssReq ) |
| 656 | { |
| 657 | PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 658 | &pFrm->WAPI ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | #endif // defined(FEATURE_WLAN_WAPI) |
| 662 | |
| 663 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 664 | nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 665 | if ( DOT11F_FAILED( nStatus ) ) |
| 666 | { |
| 667 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 668 | "or a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 669 | nStatus ); |
| 670 | // We'll fall back on the worst case scenario: |
| 671 | nPayload = sizeof( tDot11fProbeResponse ); |
| 672 | } |
| 673 | else if ( DOT11F_WARNED( nStatus ) ) |
| 674 | { |
| 675 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 676 | "the packed size for a Probe Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 677 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 678 | } |
| 679 | |
| 680 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 681 | |
| 682 | addnIEPresent = false; |
| 683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 684 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 685 | { |
| 686 | nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) ); |
| 687 | } |
| 688 | //Only use CFG for non-listen mode. This CFG is not working for concurrency |
| 689 | //In listening mode, probe rsp IEs is passed in the message from SME to PE |
| 690 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | { |
| 692 | |
| 693 | if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG, |
| 694 | &addnIEPresent) != eSIR_SUCCESS) |
| 695 | { |
| 696 | 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] | 697 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 698 | return; |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | if (addnIEPresent) |
| 703 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 704 | |
| 705 | addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3); |
| 706 | if ( NULL == addIE ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | { |
| 708 | PELOGE(limLog(pMac, LOGE, |
| 709 | FL("Unable to allocate memory to store addn IE"));) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 710 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 711 | return; |
| 712 | } |
| 713 | |
| 714 | //Probe rsp IE available |
| 715 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 716 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) ) |
| 717 | { |
| 718 | 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] | 719 | vos_mem_free(addIE); |
| 720 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 721 | return; |
| 722 | } |
| 723 | if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len && |
| 724 | (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE) |
| 725 | { |
| 726 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 727 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0], |
| 728 | &addnIE1Len) ) |
| 729 | { |
| 730 | limLog(pMac, LOGP, |
| 731 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 732 | vos_mem_free(addIE); |
| 733 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 734 | return; |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | //Probe rsp IE available |
| 739 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 740 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) ) |
| 741 | { |
| 742 | 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] | 743 | vos_mem_free(addIE); |
| 744 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 745 | return; |
| 746 | } |
| 747 | if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len && |
| 748 | (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE) |
| 749 | { |
| 750 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 751 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len], |
| 752 | &addnIE2Len) ) |
| 753 | { |
| 754 | limLog(pMac, LOGP, |
| 755 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 756 | vos_mem_free(addIE); |
| 757 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 758 | return; |
| 759 | } |
| 760 | } |
| 761 | |
| 762 | //Probe rsp IE available |
| 763 | if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac, |
| 764 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) ) |
| 765 | { |
| 766 | 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] | 767 | vos_mem_free(addIE); |
| 768 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 769 | return; |
| 770 | } |
| 771 | if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len && |
| 772 | (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE) |
| 773 | { |
| 774 | if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac, |
| 775 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 776 | &addIE[addnIE1Len + addnIE2Len], |
| 777 | &addnIE3Len) ) |
| 778 | { |
| 779 | limLog(pMac, LOGP, |
| 780 | FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 781 | vos_mem_free(addIE); |
| 782 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 783 | return; |
| 784 | } |
| 785 | } |
| 786 | totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len; |
| 787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe)) |
| 789 | { |
| 790 | limLog(pMac, LOGP, |
| 791 | FL("Unable to get final Additional IE for Probe Req")); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 792 | vos_mem_free(addIE); |
| 793 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | return; |
| 795 | } |
| 796 | nBytes = nBytes + totalAddnIeLen; |
| 797 | |
| 798 | if (probeReqP2pIe) |
| 799 | { |
| 800 | pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen); |
| 801 | if (pP2pIe != NULL) |
| 802 | { |
| 803 | //get NoA attribute stream P2P IE |
| 804 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 805 | if (noaLen != 0) |
| 806 | { |
| 807 | total_noaLen = limBuildP2pIe(pMac, &noaIe[0], |
| 808 | &noaStream[0], noaLen); |
| 809 | nBytes = nBytes + total_noaLen; |
| 810 | } |
| 811 | } |
| 812 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | } |
| 814 | |
| 815 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 816 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 817 | ( void** ) &pPacket ); |
| 818 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 819 | { |
| 820 | 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] | 821 | "be Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | if ( addIE != NULL ) |
| 823 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 824 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 825 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 826 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 827 | return; |
| 828 | } |
| 829 | |
| 830 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 831 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | |
| 833 | // Next, we fill out the buffer descriptor: |
| 834 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 835 | SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr); |
| 836 | if ( eSIR_SUCCESS != nSirStatus ) |
| 837 | { |
| 838 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 839 | "tor for a Probe Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | nSirStatus ); |
| 841 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 842 | ( void* ) pFrame, ( void* ) pPacket ); |
| 843 | if ( addIE != NULL ) |
| 844 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 845 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 846 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 847 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 848 | return; |
| 849 | } |
| 850 | |
| 851 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 852 | |
| 853 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 854 | |
| 855 | // That done, pack the Probe Response: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 856 | nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 857 | nPayload, &nPayload ); |
| 858 | if ( DOT11F_FAILED( nStatus ) ) |
| 859 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 860 | limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | nStatus ); |
| 862 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 863 | if ( addIE != NULL ) |
| 864 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 865 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 867 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 868 | return; // allocated! |
| 869 | } |
| 870 | else if ( DOT11F_WARNED( nStatus ) ) |
| 871 | { |
| 872 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 873 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 874 | } |
| 875 | |
| 876 | PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") ); |
| 877 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 878 | |
| 879 | pMac->sys.probeRespond++; |
| 880 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 881 | if( pMac->lim.gpLimRemainOnChanReq ) |
| 882 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 883 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 884 | pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) ); |
| 885 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 886 | |
| 887 | if ( addnIEPresent ) |
| 888 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 889 | vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 891 | if (noaLen != 0) |
| 892 | { |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 893 | 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] | 894 | { |
| 895 | limLog(pMac, LOGE, |
Kaushik, Sushant | 96ac9d7 | 2013-12-11 19:28:10 +0530 | [diff] [blame] | 896 | FL("Not able to insert NoA because of length constraint." |
| 897 | "Total Length is :%d"),total_noaLen); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 898 | vos_mem_free(addIE); |
| 899 | vos_mem_free(pFrm); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 900 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 901 | ( void* ) pFrame, ( void* ) pPacket ); |
| 902 | return; |
| 903 | } |
| 904 | else |
| 905 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 906 | vos_mem_copy( &pFrame[nBytes - (total_noaLen)], |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 907 | &noaIe[0], total_noaLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 908 | } |
| 909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 910 | |
| 911 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 912 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 913 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | ) |
| 915 | { |
| 916 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 917 | } |
| 918 | |
| 919 | // Queue Probe Response frame in high priority WQ |
| 920 | halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket, |
| 921 | ( tANI_U16 ) nBytes, |
| 922 | HAL_TXRX_FRM_802_11_MGMT, |
| 923 | ANI_TXDIR_TODS, |
| 924 | 7,//SMAC_SWBD_TX_TID_MGMT_LOW, |
| 925 | limTxComplete, pFrame, txFlag ); |
| 926 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 927 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 928 | limLog( pMac, LOGE, FL("Could not send Probe Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 929 | //Pkt will be freed up by the callback |
| 930 | } |
| 931 | |
| 932 | if ( addIE != NULL ) |
| 933 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 934 | vos_mem_free(addIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 935 | } |
| 936 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 937 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 938 | return; |
| 939 | |
| 940 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 941 | } // End limSendProbeRspMgmtFrame. |
| 942 | |
| 943 | void |
| 944 | limSendAddtsReqActionFrame(tpAniSirGlobal pMac, |
| 945 | tSirMacAddr peerMacAddr, |
| 946 | tSirAddtsReqInfo *pAddTS, |
| 947 | tpPESession psessionEntry) |
| 948 | { |
| 949 | tANI_U16 i; |
| 950 | tANI_U8 *pFrame; |
| 951 | tSirRetStatus nSirStatus; |
| 952 | tDot11fAddTSRequest AddTSReq; |
| 953 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 954 | tANI_U32 nPayload, nBytes, nStatus; |
| 955 | tpSirMacMgmtHdr pMacHdr; |
| 956 | void *pPacket; |
| 957 | #ifdef FEATURE_WLAN_CCX |
| 958 | tANI_U32 phyMode; |
| 959 | #endif |
| 960 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 961 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 962 | |
| 963 | if(NULL == psessionEntry) |
| 964 | { |
| 965 | return; |
| 966 | } |
| 967 | |
| 968 | if ( ! pAddTS->wmeTspecPresent ) |
| 969 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 970 | vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 971 | |
| 972 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 973 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 974 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 975 | if ( pAddTS->lleTspecPresent ) |
| 976 | { |
| 977 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC ); |
| 978 | } |
| 979 | else |
| 980 | { |
| 981 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC ); |
| 982 | } |
| 983 | |
| 984 | if ( pAddTS->lleTspecPresent ) |
| 985 | { |
| 986 | AddTSReq.num_WMMTCLAS = 0; |
| 987 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 988 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 989 | { |
| 990 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 991 | &AddTSReq.TCLAS[i] ); |
| 992 | } |
| 993 | } |
| 994 | else |
| 995 | { |
| 996 | AddTSReq.num_TCLAS = 0; |
| 997 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 998 | for ( i = 0; i < pAddTS->numTclas; ++i) |
| 999 | { |
| 1000 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1001 | &AddTSReq.WMMTCLAS[i] ); |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | if ( pAddTS->tclasProcPresent ) |
| 1006 | { |
| 1007 | if ( pAddTS->lleTspecPresent ) |
| 1008 | { |
| 1009 | AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1010 | AddTSReq.TCLASSPROC.present = 1; |
| 1011 | } |
| 1012 | else |
| 1013 | { |
| 1014 | AddTSReq.WMMTCLASPROC.version = 1; |
| 1015 | AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1016 | AddTSReq.WMMTCLASPROC.present = 1; |
| 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload ); |
| 1021 | if ( DOT11F_FAILED( nStatus ) ) |
| 1022 | { |
| 1023 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1024 | "or an Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | nStatus ); |
| 1026 | // We'll fall back on the worst case scenario: |
| 1027 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1028 | } |
| 1029 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1030 | { |
| 1031 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1032 | "the packed size for an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1033 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | } |
| 1035 | } |
| 1036 | else |
| 1037 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1038 | vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1039 | |
| 1040 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 1041 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 1042 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 1043 | |
| 1044 | // WMM spec 2.2.10 - status code is only filled in for ADDTS response |
| 1045 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 1046 | |
| 1047 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC ); |
| 1048 | #ifdef FEATURE_WLAN_CCX |
| 1049 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 1050 | |
| 1051 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 1052 | { |
| 1053 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 1054 | } |
| 1055 | else |
| 1056 | { |
| 1057 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 1058 | } |
| 1059 | PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.CCXTrafStrmRateSet,sizeof(tANI_U8)); |
| 1060 | #endif |
| 1061 | // fillWmeTspecIE |
| 1062 | |
| 1063 | nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload ); |
| 1064 | if ( DOT11F_FAILED( nStatus ) ) |
| 1065 | { |
| 1066 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1067 | "or a WMM Add TS Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1068 | nStatus ); |
| 1069 | // We'll fall back on the worst case scenario: |
| 1070 | nPayload = sizeof( tDot11fAddTSRequest ); |
| 1071 | } |
| 1072 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1073 | { |
| 1074 | limLog( pMac, LOGW, FL("There were warnings while calculating" |
| 1075 | "the packed size for a WMM Add TS Requ" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1076 | "est (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | } |
| 1078 | } |
| 1079 | |
| 1080 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1081 | |
| 1082 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1083 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1084 | ( void** ) &pPacket ); |
| 1085 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1086 | { |
| 1087 | 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] | 1088 | "d TS Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1089 | return; |
| 1090 | } |
| 1091 | |
| 1092 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1093 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1094 | |
| 1095 | // Next, we fill out the buffer descriptor: |
| 1096 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1097 | SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr); |
| 1098 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1099 | { |
| 1100 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1101 | "tor for an Add TS Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1102 | nSirStatus ); |
| 1103 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1104 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1105 | return; |
| 1106 | } |
| 1107 | |
| 1108 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1109 | |
| 1110 | #if 0 |
| 1111 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1112 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1113 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1114 | { |
| 1115 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1116 | "e sending an Add TS Request.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1117 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1118 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1119 | return; |
| 1120 | } |
| 1121 | #endif //TO SUPPORT BT-AMP |
| 1122 | |
| 1123 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1124 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1125 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1126 | limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1127 | #endif |
| 1128 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1129 | // That done, pack the struct: |
| 1130 | if ( ! pAddTS->wmeTspecPresent ) |
| 1131 | { |
| 1132 | nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq, |
| 1133 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1134 | nPayload, &nPayload ); |
| 1135 | if ( DOT11F_FAILED( nStatus ) ) |
| 1136 | { |
| 1137 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1138 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1139 | nStatus ); |
| 1140 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1141 | return; // allocated! |
| 1142 | } |
| 1143 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1144 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1145 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1146 | "an Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1147 | } |
| 1148 | } |
| 1149 | else |
| 1150 | { |
| 1151 | nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq, |
| 1152 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1153 | nPayload, &nPayload ); |
| 1154 | if ( DOT11F_FAILED( nStatus ) ) |
| 1155 | { |
| 1156 | 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] | 1157 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1158 | nStatus ); |
| 1159 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1160 | return; // allocated! |
| 1161 | } |
| 1162 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1163 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1164 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1165 | "a WMM Add TS Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") ); |
| 1170 | limPrintMacAddr( pMac, peerMacAddr, LOG3 );) |
| 1171 | |
| 1172 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1173 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1174 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1175 | ) |
| 1176 | { |
| 1177 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1178 | } |
| 1179 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1180 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1181 | psessionEntry->peSessionId, |
| 1182 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1183 | // Queue Addts Response frame in high priority WQ |
| 1184 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1185 | HAL_TXRX_FRM_802_11_MGMT, |
| 1186 | ANI_TXDIR_TODS, |
| 1187 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1188 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1189 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1190 | psessionEntry->peSessionId, |
| 1191 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1192 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1193 | { |
| 1194 | limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1195 | " (%X) ***" ), halstatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1196 | //Pkt will be freed up by the callback |
| 1197 | } |
| 1198 | |
| 1199 | } // End limSendAddtsReqActionFrame. |
| 1200 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | |
| 1202 | |
| 1203 | void |
| 1204 | limSendAssocRspMgmtFrame(tpAniSirGlobal pMac, |
| 1205 | tANI_U16 statusCode, |
| 1206 | tANI_U16 aid, |
| 1207 | tSirMacAddr peerMacAddr, |
| 1208 | tANI_U8 subType, |
| 1209 | tpDphHashNode pSta,tpPESession psessionEntry) |
| 1210 | { |
| 1211 | static tDot11fAssocResponse frm; |
| 1212 | tANI_U8 *pFrame, *macAddr; |
| 1213 | tpSirMacMgmtHdr pMacHdr; |
| 1214 | tSirRetStatus nSirStatus; |
| 1215 | tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0; |
| 1216 | tHalBitVal qosMode, wmeMode; |
| 1217 | tANI_U32 nPayload, nBytes, nStatus; |
| 1218 | void *pPacket; |
| 1219 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1220 | tUpdateBeaconParams beaconParams; |
| 1221 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1222 | tANI_U32 addnIEPresent = false; |
| 1223 | tANI_U32 addnIELen=0; |
| 1224 | tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1225 | tpSirAssocReq pAssocReq = NULL; |
| 1226 | |
| 1227 | if(NULL == psessionEntry) |
| 1228 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1229 | limLog( pMac, LOGE, FL("psessionEntry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1230 | return; |
| 1231 | } |
| 1232 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1233 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1234 | |
| 1235 | limGetQosMode(psessionEntry, &qosMode); |
| 1236 | limGetWmeMode(psessionEntry, &wmeMode); |
| 1237 | |
| 1238 | // An Add TS IE is added only if the AP supports it and the requesting |
| 1239 | // STA sent a traffic spec. |
| 1240 | fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0; |
| 1241 | |
| 1242 | PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry ); |
| 1243 | |
| 1244 | frm.Status.status = statusCode; |
| 1245 | |
| 1246 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1247 | |
| 1248 | if ( NULL == pSta ) |
| 1249 | { |
| 1250 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry); |
| 1251 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry ); |
| 1252 | } |
| 1253 | else |
| 1254 | { |
| 1255 | PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates, |
| 1256 | pSta->supportedRates.llbRates, pSta->supportedRates.llaRates ); |
| 1257 | } |
| 1258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1259 | if(psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 1260 | { |
| 1261 | if( pSta != NULL && eSIR_SUCCESS == statusCode ) |
| 1262 | { |
| 1263 | pAssocReq = |
| 1264 | (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1265 | /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */ |
| 1266 | if( pAssocReq != NULL && pAssocReq->addIEPresent ) { |
| 1267 | PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq); |
| 1268 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1269 | } |
| 1270 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1271 | |
| 1272 | if ( NULL != pSta ) |
| 1273 | { |
| 1274 | if ( eHAL_SET == qosMode ) |
| 1275 | { |
| 1276 | if ( pSta->lleEnabled ) |
| 1277 | { |
| 1278 | lleMode = 1; |
| 1279 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ) |
| 1280 | { |
| 1281 | PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry); |
| 1282 | |
| 1283 | // FramesToDo:... |
| 1284 | // if ( fAddTS ) |
| 1285 | // { |
| 1286 | // tANI_U8 *pAf = pBody; |
| 1287 | // *pAf++ = SIR_MAC_QOS_ACTION_EID; |
| 1288 | // tANI_U32 tlen; |
| 1289 | // status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL, |
| 1290 | // &tlen, bufLen - frameLen); |
| 1291 | // } // End if on Add TS. |
| 1292 | } |
| 1293 | } // End if on .11e enabled in 'pSta'. |
| 1294 | } // End if on QOS Mode on. |
| 1295 | |
| 1296 | if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled ) |
| 1297 | { |
| 1298 | if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1299 | { |
| 1300 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1301 | PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1302 | |
| 1303 | if ( pSta->wsmEnabled ) |
| 1304 | { |
| 1305 | PopulateDot11fWMMCaps(&frm.WMMCaps ); |
| 1306 | } |
| 1307 | } |
| 1308 | } |
| 1309 | |
| 1310 | if ( pSta->aniPeer ) |
| 1311 | { |
| 1312 | if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) || |
| 1313 | ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) ) |
| 1314 | { |
| 1315 | edcaInclude = 1; |
| 1316 | } |
| 1317 | |
| 1318 | } // End if on Airgo peer. |
| 1319 | |
| 1320 | if ( pSta->mlmStaContext.htCapability && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1321 | psessionEntry->htCapability ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1322 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1323 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1324 | PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1326 | |
| 1327 | #ifdef WLAN_FEATURE_11AC |
| 1328 | if( pSta->mlmStaContext.vhtCapability && |
| 1329 | psessionEntry->vhtCapability ) |
| 1330 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 1331 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1332 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
| 1333 | PopulateDot11fVHTOperation( pMac, &frm.VHTOperation); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1334 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1335 | } |
| 1336 | #endif |
| 1337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1338 | } // End if on non-NULL 'pSta'. |
| 1339 | |
| 1340 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1341 | vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1343 | if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){ |
| 1344 | if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) |
| 1345 | limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry); |
| 1346 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | |
| 1348 | limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1349 | limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry); |
| 1350 | |
| 1351 | beaconParams.bssIdx = psessionEntry->bssIdx; |
| 1352 | |
| 1353 | //Send message to HAL about beacon parameter change. |
| 1354 | if(beaconParams.paramChangeBitmap) |
| 1355 | { |
| 1356 | schSetFixedBeaconFields(pMac,psessionEntry); |
| 1357 | limSendBeaconParams(pMac, &beaconParams, psessionEntry ); |
| 1358 | } |
| 1359 | |
| 1360 | // Allocate a buffer for this frame: |
| 1361 | nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload ); |
| 1362 | if ( DOT11F_FAILED( nStatus ) ) |
| 1363 | { |
| 1364 | limLog( pMac, LOGE, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1365 | "or an Association Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1366 | nStatus ); |
| 1367 | return; |
| 1368 | } |
| 1369 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1370 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1371 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1372 | "the packed size for an Association Re" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1373 | "sponse (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1374 | } |
| 1375 | |
| 1376 | nBytes = sizeof( tSirMacMgmtHdr ) + nPayload; |
| 1377 | |
| 1378 | if ( pAssocReq != NULL ) |
| 1379 | { |
| 1380 | if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, |
| 1381 | &addnIEPresent) != eSIR_SUCCESS) |
| 1382 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1383 | limLog(pMac, LOGP, FL("Unable to get " |
| 1384 | "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1385 | return; |
| 1386 | } |
| 1387 | |
| 1388 | if (addnIEPresent) |
| 1389 | { |
| 1390 | //Assoc rsp IE available |
| 1391 | if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1392 | &addnIELen) != eSIR_SUCCESS) |
| 1393 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1394 | limLog(pMac, LOGP, FL("Unable to get " |
| 1395 | "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1396 | return; |
| 1397 | } |
| 1398 | |
| 1399 | if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen && |
| 1400 | (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE) |
| 1401 | { |
| 1402 | if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA, |
| 1403 | &addIE[0], &addnIELen) == eSIR_SUCCESS) |
| 1404 | { |
| 1405 | nBytes = nBytes + addnIELen; |
| 1406 | } |
| 1407 | } |
| 1408 | } |
| 1409 | } |
| 1410 | |
| 1411 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1412 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 1413 | ( void** ) &pPacket ); |
| 1414 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1415 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1416 | limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP.")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1417 | return; |
| 1418 | } |
| 1419 | |
| 1420 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1421 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1422 | |
| 1423 | // Next, we fill out the buffer descriptor: |
| 1424 | nSirStatus = limPopulateMacHeader( pMac, |
| 1425 | pFrame, |
| 1426 | SIR_MAC_MGMT_FRAME, |
| 1427 | ( LIM_ASSOC == subType ) ? |
| 1428 | SIR_MAC_MGMT_ASSOC_RSP : |
| 1429 | SIR_MAC_MGMT_REASSOC_RSP, |
| 1430 | peerMacAddr,psessionEntry->selfMacAddr); |
| 1431 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1432 | { |
| 1433 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1434 | "tor for an Association Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1435 | nSirStatus ); |
| 1436 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1437 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1438 | return; |
| 1439 | } |
| 1440 | |
| 1441 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1442 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1443 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1444 | |
| 1445 | nStatus = dot11fPackAssocResponse( pMac, &frm, |
| 1446 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1447 | nPayload, &nPayload ); |
| 1448 | if ( DOT11F_FAILED( nStatus ) ) |
| 1449 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 1450 | limLog( pMac, LOGE, FL("Failed to pack an Association Response" |
| 1451 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1452 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1453 | ( void* ) pFrame, ( void* ) pPacket ); |
| 1454 | return; // allocated! |
| 1455 | } |
| 1456 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1457 | { |
| 1458 | limLog( pMac, LOGW, FL("There were warnings while packing an " |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1459 | "Association Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1460 | } |
| 1461 | |
| 1462 | macAddr = pMacHdr->da; |
| 1463 | |
| 1464 | if (subType == LIM_ASSOC) |
| 1465 | { |
| 1466 | PELOG1(limLog(pMac, LOG1, |
| 1467 | FL("*** Sending Assoc Resp status %d aid %d to "), |
| 1468 | statusCode, aid);) |
| 1469 | } |
| 1470 | else{ |
| 1471 | PELOG1(limLog(pMac, LOG1, |
| 1472 | FL("*** Sending ReAssoc Resp status %d aid %d to "), |
| 1473 | statusCode, aid);) |
| 1474 | } |
| 1475 | PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1476 | |
| 1477 | if ( addnIEPresent ) |
| 1478 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1479 | vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1480 | } |
| 1481 | |
| 1482 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1483 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1484 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1485 | ) |
| 1486 | { |
| 1487 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1488 | } |
| 1489 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1490 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1491 | psessionEntry->peSessionId, |
| 1492 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1493 | /// Queue Association Response frame in high priority WQ |
| 1494 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1495 | HAL_TXRX_FRM_802_11_MGMT, |
| 1496 | ANI_TXDIR_TODS, |
| 1497 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1498 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1499 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1500 | psessionEntry->peSessionId, |
| 1501 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1502 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1503 | { |
| 1504 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1505 | FL("*** Could not Send Re/AssocRsp, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1506 | nSirStatus); |
| 1507 | |
| 1508 | //Pkt will be freed up by the callback |
| 1509 | } |
| 1510 | |
| 1511 | // update the ANI peer station count |
| 1512 | //FIXME_PROTECTION : take care of different type of station |
| 1513 | // counter inside this function. |
| 1514 | limUtilCountStaAdd(pMac, pSta, psessionEntry); |
| 1515 | |
| 1516 | } // End limSendAssocRspMgmtFrame. |
| 1517 | |
| 1518 | |
| 1519 | |
| 1520 | void |
| 1521 | limSendAddtsRspActionFrame(tpAniSirGlobal pMac, |
| 1522 | tSirMacAddr peer, |
| 1523 | tANI_U16 nStatusCode, |
| 1524 | tSirAddtsReqInfo *pAddTS, |
| 1525 | tSirMacScheduleIE *pSchedule, |
| 1526 | tpPESession psessionEntry) |
| 1527 | { |
| 1528 | tANI_U8 *pFrame; |
| 1529 | tpSirMacMgmtHdr pMacHdr; |
| 1530 | tDot11fAddTSResponse AddTSRsp; |
| 1531 | tDot11fWMMAddTSResponse WMMAddTSRsp; |
| 1532 | tSirRetStatus nSirStatus; |
| 1533 | tANI_U32 i, nBytes, nPayload, nStatus; |
| 1534 | void *pPacket; |
| 1535 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1536 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1537 | |
| 1538 | if(NULL == psessionEntry) |
| 1539 | { |
| 1540 | return; |
| 1541 | } |
| 1542 | |
| 1543 | if ( ! pAddTS->wmeTspecPresent ) |
| 1544 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1545 | vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | |
| 1547 | AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1548 | AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1549 | AddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1550 | AddTSRsp.Status.status = nStatusCode; |
| 1551 | |
| 1552 | // The TsDelay information element is only filled in for a specific |
| 1553 | // status code: |
| 1554 | if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode ) |
| 1555 | { |
| 1556 | if ( pAddTS->wsmTspecPresent ) |
| 1557 | { |
| 1558 | AddTSRsp.WMMTSDelay.version = 1; |
| 1559 | AddTSRsp.WMMTSDelay.delay = 10; |
| 1560 | AddTSRsp.WMMTSDelay.present = 1; |
| 1561 | } |
| 1562 | else |
| 1563 | { |
| 1564 | AddTSRsp.TSDelay.delay = 10; |
| 1565 | AddTSRsp.TSDelay.present = 1; |
| 1566 | } |
| 1567 | } |
| 1568 | |
| 1569 | if ( pAddTS->wsmTspecPresent ) |
| 1570 | { |
| 1571 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC ); |
| 1572 | } |
| 1573 | else |
| 1574 | { |
| 1575 | PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC ); |
| 1576 | } |
| 1577 | |
| 1578 | if ( pAddTS->wsmTspecPresent ) |
| 1579 | { |
| 1580 | AddTSRsp.num_WMMTCLAS = 0; |
| 1581 | AddTSRsp.num_TCLAS = pAddTS->numTclas; |
| 1582 | for ( i = 0; i < AddTSRsp.num_TCLAS; ++i) |
| 1583 | { |
| 1584 | PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1585 | &AddTSRsp.TCLAS[i] ); |
| 1586 | } |
| 1587 | } |
| 1588 | else |
| 1589 | { |
| 1590 | AddTSRsp.num_TCLAS = 0; |
| 1591 | AddTSRsp.num_WMMTCLAS = pAddTS->numTclas; |
| 1592 | for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i) |
| 1593 | { |
| 1594 | PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i], |
| 1595 | &AddTSRsp.WMMTCLAS[i] ); |
| 1596 | } |
| 1597 | } |
| 1598 | |
| 1599 | if ( pAddTS->tclasProcPresent ) |
| 1600 | { |
| 1601 | if ( pAddTS->wsmTspecPresent ) |
| 1602 | { |
| 1603 | AddTSRsp.WMMTCLASPROC.version = 1; |
| 1604 | AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc; |
| 1605 | AddTSRsp.WMMTCLASPROC.present = 1; |
| 1606 | } |
| 1607 | else |
| 1608 | { |
| 1609 | AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc; |
| 1610 | AddTSRsp.TCLASSPROC.present = 1; |
| 1611 | } |
| 1612 | } |
| 1613 | |
| 1614 | // schedule element is included only if requested in the tspec and we are |
| 1615 | // using hcca (or both edca and hcca) |
| 1616 | // 11e-D8.0 is inconsistent on whether the schedule element is included |
| 1617 | // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but |
| 1618 | // pg 46, line 17-18 says something else. So just include it and let the |
| 1619 | // sta figure it out |
| 1620 | if ((pSchedule != NULL) && |
| 1621 | ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) || |
| 1622 | (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))) |
| 1623 | { |
| 1624 | if ( pAddTS->wsmTspecPresent ) |
| 1625 | { |
| 1626 | PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule ); |
| 1627 | } |
| 1628 | else |
| 1629 | { |
| 1630 | PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule ); |
| 1631 | } |
| 1632 | } |
| 1633 | |
| 1634 | nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload ); |
| 1635 | if ( DOT11F_FAILED( nStatus ) ) |
| 1636 | { |
| 1637 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1638 | "ze for an Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1639 | nStatus ); |
| 1640 | // We'll fall back on the worst case scenario: |
| 1641 | nPayload = sizeof( tDot11fAddTSResponse ); |
| 1642 | } |
| 1643 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1644 | { |
| 1645 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1646 | "ting the packed size for an Add TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1647 | " Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1648 | } |
| 1649 | } |
| 1650 | else |
| 1651 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1652 | vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1653 | |
| 1654 | WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME; |
| 1655 | WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP; |
| 1656 | WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken; |
| 1657 | WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode; |
| 1658 | |
| 1659 | PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC ); |
| 1660 | |
| 1661 | nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload ); |
| 1662 | if ( DOT11F_FAILED( nStatus ) ) |
| 1663 | { |
| 1664 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1665 | "ze for a WMM Add TS Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1666 | nStatus ); |
| 1667 | // We'll fall back on the worst case scenario: |
| 1668 | nPayload = sizeof( tDot11fWMMAddTSResponse ); |
| 1669 | } |
| 1670 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1671 | { |
| 1672 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1673 | "ting the packed size for a WMM Add" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1674 | "TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1679 | |
| 1680 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1681 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1682 | { |
| 1683 | 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] | 1684 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1685 | return; |
| 1686 | } |
| 1687 | |
| 1688 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1689 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1690 | |
| 1691 | // Next, we fill out the buffer descriptor: |
| 1692 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1693 | SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr); |
| 1694 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1695 | { |
| 1696 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1697 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1698 | nSirStatus ); |
| 1699 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1700 | return; // allocated! |
| 1701 | } |
| 1702 | |
| 1703 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1704 | |
| 1705 | |
| 1706 | #if 0 |
| 1707 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1708 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1709 | { |
| 1710 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1711 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1712 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1713 | return; // allocated! |
| 1714 | } |
| 1715 | #endif //TO SUPPORT BT-AMP |
| 1716 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 1717 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1718 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1719 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1720 | #endif |
| 1721 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | // That done, pack the struct: |
| 1723 | if ( ! pAddTS->wmeTspecPresent ) |
| 1724 | { |
| 1725 | nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp, |
| 1726 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1727 | nPayload, &nPayload ); |
| 1728 | if ( DOT11F_FAILED( nStatus ) ) |
| 1729 | { |
| 1730 | limLog( pMac, LOGE, FL("Failed to pack an Add TS Response " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1731 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1732 | nStatus ); |
| 1733 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1734 | return; |
| 1735 | } |
| 1736 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1737 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1738 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1739 | "an Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1740 | } |
| 1741 | } |
| 1742 | else |
| 1743 | { |
| 1744 | nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp, |
| 1745 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1746 | nPayload, &nPayload ); |
| 1747 | if ( DOT11F_FAILED( nStatus ) ) |
| 1748 | { |
| 1749 | 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] | 1750 | "(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1751 | nStatus ); |
| 1752 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1753 | return; |
| 1754 | } |
| 1755 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1756 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1757 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1758 | "a WMM Add TS Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1759 | } |
| 1760 | } |
| 1761 | |
| 1762 | PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "), |
| 1763 | nStatusCode ); |
| 1764 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 1765 | |
| 1766 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1767 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1768 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1769 | ) |
| 1770 | { |
| 1771 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1772 | } |
| 1773 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1774 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1775 | psessionEntry->peSessionId, |
| 1776 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1777 | // Queue the frame in high priority WQ: |
| 1778 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1779 | HAL_TXRX_FRM_802_11_MGMT, |
| 1780 | ANI_TXDIR_TODS, |
| 1781 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1782 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1783 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1784 | psessionEntry->peSessionId, |
| 1785 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1786 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1787 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1788 | limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1789 | nSirStatus ); |
| 1790 | //Pkt will be freed up by the callback |
| 1791 | } |
| 1792 | |
| 1793 | } // End limSendAddtsRspActionFrame. |
| 1794 | |
| 1795 | void |
| 1796 | limSendDeltsReqActionFrame(tpAniSirGlobal pMac, |
| 1797 | tSirMacAddr peer, |
| 1798 | tANI_U8 wmmTspecPresent, |
| 1799 | tSirMacTSInfo *pTsinfo, |
| 1800 | tSirMacTspecIE *pTspecIe, |
| 1801 | tpPESession psessionEntry) |
| 1802 | { |
| 1803 | tANI_U8 *pFrame; |
| 1804 | tpSirMacMgmtHdr pMacHdr; |
| 1805 | tDot11fDelTS DelTS; |
| 1806 | tDot11fWMMDelTS WMMDelTS; |
| 1807 | tSirRetStatus nSirStatus; |
| 1808 | tANI_U32 nBytes, nPayload, nStatus; |
| 1809 | void *pPacket; |
| 1810 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 1811 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1812 | |
| 1813 | if(NULL == psessionEntry) |
| 1814 | { |
| 1815 | return; |
| 1816 | } |
| 1817 | |
| 1818 | if ( ! wmmTspecPresent ) |
| 1819 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1820 | vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1821 | |
| 1822 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1823 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1824 | PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo ); |
| 1825 | |
| 1826 | nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload ); |
| 1827 | if ( DOT11F_FAILED( nStatus ) ) |
| 1828 | { |
| 1829 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1830 | "ze for a Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1831 | nStatus ); |
| 1832 | // We'll fall back on the worst case scenario: |
| 1833 | nPayload = sizeof( tDot11fDelTS ); |
| 1834 | } |
| 1835 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1836 | { |
| 1837 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 1838 | "ting the packed size for a Del TS" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1839 | " (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1840 | } |
| 1841 | } |
| 1842 | else |
| 1843 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1844 | vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1845 | |
| 1846 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 1847 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1848 | WMMDelTS.DialogToken.token = 0; |
| 1849 | WMMDelTS.StatusCode.statusCode = 0; |
| 1850 | PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC ); |
| 1851 | nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload ); |
| 1852 | if ( DOT11F_FAILED( nStatus ) ) |
| 1853 | { |
| 1854 | limLog( pMac, LOGP, FL("Failed to calculate the packed si" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1855 | "ze for a WMM Del TS (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1856 | nStatus ); |
| 1857 | // We'll fall back on the worst case scenario: |
| 1858 | nPayload = sizeof( tDot11fDelTS ); |
| 1859 | } |
| 1860 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1861 | { |
| 1862 | limLog( pMac, LOGW, FL("There were warnings while calcula" |
| 1863 | "ting the packed size for a WMM De" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1864 | "l TS (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1865 | } |
| 1866 | } |
| 1867 | |
| 1868 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 1869 | |
| 1870 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 1871 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1872 | { |
| 1873 | 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] | 1874 | "d TS Response."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1875 | return; |
| 1876 | } |
| 1877 | |
| 1878 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1879 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1880 | |
| 1881 | // Next, we fill out the buffer descriptor: |
| 1882 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1883 | SIR_MAC_MGMT_ACTION, peer, |
| 1884 | psessionEntry->selfMacAddr); |
| 1885 | if ( eSIR_SUCCESS != nSirStatus ) |
| 1886 | { |
| 1887 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1888 | "tor for an Add TS Response (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1889 | nSirStatus ); |
| 1890 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1891 | return; // allocated! |
| 1892 | } |
| 1893 | |
| 1894 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 1895 | |
| 1896 | #if 0 |
| 1897 | |
| 1898 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 1899 | if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, |
| 1900 | ( tANI_U8* )pMacHdr->bssId, &cfgLen ) ) |
| 1901 | { |
| 1902 | limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1903 | "e sending an Add TS Response.") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1904 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1905 | return; // allocated! |
| 1906 | } |
| 1907 | #endif //TO SUPPORT BT-AMP |
| 1908 | sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId); |
| 1909 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1910 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 1911 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1912 | #endif |
| 1913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1914 | // That done, pack the struct: |
| 1915 | if ( !wmmTspecPresent ) |
| 1916 | { |
| 1917 | nStatus = dot11fPackDelTS( pMac, &DelTS, |
| 1918 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1919 | nPayload, &nPayload ); |
| 1920 | if ( DOT11F_FAILED( nStatus ) ) |
| 1921 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1922 | 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] | 1923 | nStatus ); |
| 1924 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1925 | return; // allocated! |
| 1926 | } |
| 1927 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1928 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1929 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1930 | "a Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1931 | } |
| 1932 | } |
| 1933 | else |
| 1934 | { |
| 1935 | nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS, |
| 1936 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 1937 | nPayload, &nPayload ); |
| 1938 | if ( DOT11F_FAILED( nStatus ) ) |
| 1939 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1940 | 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] | 1941 | nStatus ); |
| 1942 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 1943 | return; // allocated! |
| 1944 | } |
| 1945 | else if ( DOT11F_WARNED( nStatus ) ) |
| 1946 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 1947 | limLog( pMac, LOGW, FL("There were warnings while packing " |
| 1948 | "a WMM Del TS frame (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1949 | } |
| 1950 | } |
| 1951 | |
| 1952 | PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes); |
| 1953 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 1954 | |
| 1955 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 1957 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | ) |
| 1959 | { |
| 1960 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1961 | } |
| 1962 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1963 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 1964 | psessionEntry->peSessionId, |
| 1965 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1966 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 1967 | HAL_TXRX_FRM_802_11_MGMT, |
| 1968 | ANI_TXDIR_TODS, |
| 1969 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 1970 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 1971 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 1972 | psessionEntry->peSessionId, |
| 1973 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1974 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1975 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1976 | limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1977 | nSirStatus ); |
| 1978 | //Pkt will be freed up by the callback |
| 1979 | } |
| 1980 | |
| 1981 | } // End limSendDeltsReqActionFrame. |
| 1982 | |
| 1983 | void |
| 1984 | limSendAssocReqMgmtFrame(tpAniSirGlobal pMac, |
| 1985 | tLimMlmAssocReq *pMlmAssocReq, |
| 1986 | tpPESession psessionEntry) |
| 1987 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 1988 | tDot11fAssocRequest *pFrm; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1989 | tANI_U16 caps; |
| 1990 | tANI_U8 *pFrame; |
| 1991 | tSirRetStatus nSirStatus; |
| 1992 | tLimMlmAssocCnf mlmAssocCnf; |
| 1993 | tANI_U32 nBytes, nPayload, nStatus; |
| 1994 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 1995 | void *pPacket; |
| 1996 | eHalStatus halstatus; |
| 1997 | tANI_U16 nAddIELen; |
| 1998 | tANI_U8 *pAddIE; |
| 1999 | tANI_U8 *wpsIe = NULL; |
| 2000 | #if defined WLAN_FEATURE_VOWIFI |
| 2001 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2002 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2003 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2004 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2005 | |
| 2006 | if(NULL == psessionEntry) |
| 2007 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2008 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2009 | return; |
| 2010 | } |
| 2011 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2012 | /* check this early to avoid unncessary operation */ |
| 2013 | if(NULL == psessionEntry->pLimJoinReq) |
| 2014 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2015 | limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2016 | return; |
| 2017 | } |
| 2018 | nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length; |
| 2019 | pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata; |
| 2020 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2021 | pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest)); |
| 2022 | if ( NULL == pFrm ) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2023 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2024 | limLog(pMac, LOGE, FL("Unable to allocate memory") ); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2025 | return; |
| 2026 | } |
| 2027 | |
| 2028 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2029 | vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2030 | |
| 2031 | caps = pMlmAssocReq->capabilityInfo; |
| 2032 | if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) ) |
| 2033 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2034 | #if defined(FEATURE_WLAN_WAPI) |
| 2035 | /* CR: 262463 : |
| 2036 | According to WAPI standard: |
| 2037 | 7.3.1.4 Capability Information field |
| 2038 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2039 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2040 | Reassociation management frames. */ |
| 2041 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2042 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2043 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2044 | swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2045 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2046 | pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval; |
| 2047 | PopulateDot11fSSID2( pMac, &pFrm->SSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2048 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2049 | &pFrm->SuppRates,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2050 | |
| 2051 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2052 | SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps ); |
| 2053 | |
| 2054 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2055 | LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps ); |
| 2056 | |
| 2057 | // We prefer .11e asociations: |
| 2058 | if ( fQosEnabled ) fWmeEnabled = false; |
| 2059 | |
| 2060 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2061 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps ); |
| 2062 | |
| 2063 | if ( psessionEntry->lim11hEnable && |
| 2064 | psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2065 | { |
| 2066 | #if defined WLAN_FEATURE_VOWIFI |
| 2067 | PowerCapsPopulated = TRUE; |
| 2068 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2069 | PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2070 | #endif |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2071 | PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | |
| 2073 | } |
| 2074 | |
| 2075 | #if defined WLAN_FEATURE_VOWIFI |
| 2076 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2077 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2078 | { |
| 2079 | if (PowerCapsPopulated == FALSE) |
| 2080 | { |
| 2081 | PowerCapsPopulated = TRUE; |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2082 | PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2083 | } |
| 2084 | } |
| 2085 | #endif |
| 2086 | |
| 2087 | if ( fQosEnabled && |
| 2088 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap))) |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2089 | PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2090 | |
| 2091 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2092 | &pFrm->ExtSuppRates, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2093 | |
| 2094 | #if defined WLAN_FEATURE_VOWIFI |
| 2095 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2096 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2097 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2098 | PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2099 | } |
| 2100 | #endif |
| 2101 | // The join request *should* contain zero or one of the WPA and RSN |
| 2102 | // IEs. The payload send along with the request is a |
| 2103 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2104 | |
| 2105 | // typedef struct sSirRSNie |
| 2106 | // { |
| 2107 | // tANI_U16 length; |
| 2108 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2109 | // } tSirRSNie, *tpSirRSNie; |
| 2110 | |
| 2111 | // So, we should be able to make the following two calls harmlessly, |
| 2112 | // since they do nothing if they don't find the given IE in the |
| 2113 | // bytestream with which they're provided. |
| 2114 | |
| 2115 | // The net effect of this will be to faithfully transmit whatever |
| 2116 | // security IE is in the join request. |
| 2117 | |
| 2118 | // *However*, if we're associating for the purpose of WPS |
| 2119 | // enrollment, and we've been configured to indicate that by |
| 2120 | // eliding the WPA or RSN IE, we just skip this: |
| 2121 | if( nAddIELen && pAddIE ) |
| 2122 | { |
| 2123 | wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen); |
| 2124 | } |
| 2125 | if ( NULL == wpsIe ) |
| 2126 | { |
| 2127 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2128 | &pFrm->RSNOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2129 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2130 | &pFrm->WPAOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2131 | #if defined(FEATURE_WLAN_WAPI) |
| 2132 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ), |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2133 | &pFrm->WAPIOpaque ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2134 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2135 | } |
| 2136 | |
| 2137 | // include WME EDCA IE as well |
| 2138 | if ( fWmeEnabled ) |
| 2139 | { |
| 2140 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) ) |
| 2141 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2142 | PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2143 | } |
| 2144 | |
| 2145 | if ( fWsmEnabled && |
| 2146 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap ))) |
| 2147 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2148 | PopulateDot11fWMMCaps( &pFrm->WMMCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | } |
| 2150 | } |
| 2151 | |
| 2152 | //Populate HT IEs, when operating in 11n or Taurus modes AND |
| 2153 | //when AP is also operating in 11n mode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2154 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2155 | pMac->lim.htCapabilityPresentInBeacon) |
| 2156 | { |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2157 | PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2158 | #ifdef DISABLE_GF_FOR_INTEROP |
| 2159 | |
| 2160 | /* |
| 2161 | * To resolve the interop problem with Broadcom AP, |
| 2162 | * where TQ STA could not pass traffic with GF enabled, |
| 2163 | * TQ STA will do Greenfield only with TQ AP, for |
| 2164 | * everybody else it will be turned off. |
| 2165 | */ |
| 2166 | |
| 2167 | if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator)) |
| 2168 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2169 | limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP," |
| 2170 | " Turning off Greenfield")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2171 | pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | } |
| 2173 | #endif |
| 2174 | |
| 2175 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2176 | #ifdef WLAN_FEATURE_11AC |
| 2177 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2178 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2179 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 2180 | limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request")); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2181 | PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2182 | } |
| 2183 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2184 | PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2185 | |
| 2186 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2187 | if (psessionEntry->pLimJoinReq->is11Rconnection) |
| 2188 | { |
| 2189 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2190 | limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2191 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0], |
| 2192 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1], |
| 2193 | (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]); |
| 2194 | #endif |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2195 | PopulateMDIE( pMac, &pFrm->MobilityDomain, |
| 2196 | psessionEntry->pLimJoinReq->bssDescription.mdie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2197 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2198 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2199 | { |
| 2200 | // No 11r IEs dont send any MDIE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2201 | limLog( pMac, LOG1, FL("MDIE not present")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2202 | } |
| 2203 | #endif |
| 2204 | |
| 2205 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2206 | /* For CCX Associations fill the CCX IEs */ |
| 2207 | if (psessionEntry->isCCXconnection && |
| 2208 | psessionEntry->pLimJoinReq->isCCXFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2210 | #ifndef FEATURE_DISABLE_RM |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2211 | PopulateDot11fCCXRadMgmtCap(&pFrm->CCXRadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2212 | #endif |
Sandeep Puligilla | e9ffdf6 | 2013-11-23 18:23:00 +0530 | [diff] [blame] | 2213 | PopulateDot11fCCXVersion(&pFrm->CCXVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2214 | } |
| 2215 | #endif |
| 2216 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2217 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2218 | if ( DOT11F_FAILED( nStatus ) ) |
| 2219 | { |
| 2220 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2221 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2222 | nStatus ); |
| 2223 | // We'll fall back on the worst case scenario: |
| 2224 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2225 | } |
| 2226 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2227 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2228 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2229 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2230 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2231 | } |
| 2232 | |
| 2233 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2234 | |
| 2235 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2236 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2237 | ( void** ) &pPacket ); |
| 2238 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2239 | { |
| 2240 | 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] | 2241 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2242 | |
| 2243 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2244 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2245 | |
| 2246 | |
| 2247 | /* Update PE session id*/ |
| 2248 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2249 | |
| 2250 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2251 | |
| 2252 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2253 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2254 | |
| 2255 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2256 | ( tANI_U32* ) &mlmAssocCnf); |
| 2257 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2258 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2259 | return; |
| 2260 | } |
| 2261 | |
| 2262 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2263 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2264 | |
| 2265 | // Next, we fill out the buffer descriptor: |
| 2266 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2267 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2268 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2269 | { |
| 2270 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2271 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | nSirStatus ); |
| 2273 | 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] | 2274 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2275 | return; |
| 2276 | } |
| 2277 | |
| 2278 | |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2279 | // That done, pack the Assoc Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2280 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2281 | sizeof(tSirMacMgmtHdr), |
| 2282 | nPayload, &nPayload ); |
| 2283 | if ( DOT11F_FAILED( nStatus ) ) |
| 2284 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2285 | 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] | 2286 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2287 | nStatus ); |
| 2288 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2289 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2290 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | return; |
| 2292 | } |
| 2293 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2294 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2295 | limLog( pMac, LOGW, FL("There were warnings while packing a Assoc" |
| 2296 | "Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2297 | } |
| 2298 | |
| 2299 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2300 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2301 | nBytes );) |
| 2302 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2303 | |
| 2304 | if( psessionEntry->assocReq != NULL ) |
| 2305 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2306 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2307 | psessionEntry->assocReq = NULL; |
| 2308 | } |
| 2309 | |
| 2310 | if( nAddIELen ) |
| 2311 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2312 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2313 | pAddIE, |
| 2314 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | nPayload += nAddIELen; |
| 2316 | } |
| 2317 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2318 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2319 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2320 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 2321 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store " |
| 2322 | "assoc request"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2323 | } |
| 2324 | else |
| 2325 | { |
| 2326 | //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] | 2327 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2328 | psessionEntry->assocReqLen = nPayload; |
| 2329 | } |
| 2330 | |
| 2331 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2332 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2333 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2334 | ) |
| 2335 | { |
| 2336 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2337 | } |
| 2338 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2339 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2340 | { |
| 2341 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2342 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2343 | |
| 2344 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 2345 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2346 | psessionEntry->peSessionId, |
| 2347 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2348 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2349 | HAL_TXRX_FRM_802_11_MGMT, |
| 2350 | ANI_TXDIR_TODS, |
| 2351 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2352 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2353 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2354 | psessionEntry->peSessionId, |
| 2355 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2356 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2357 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2358 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2359 | halstatus ); |
| 2360 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2361 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2362 | return; |
| 2363 | } |
| 2364 | |
| 2365 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2366 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 2367 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2368 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2369 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2370 | } // End limSendAssocReqMgmtFrame |
| 2371 | |
| 2372 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2373 | #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] | 2374 | /*------------------------------------------------------------------------------------ |
| 2375 | * |
| 2376 | * Send Reassoc Req with FTIEs. |
| 2377 | * |
| 2378 | *----------------------------------------------------------------------------------- |
| 2379 | */ |
| 2380 | void |
| 2381 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2382 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2383 | { |
| 2384 | static tDot11fReAssocRequest frm; |
| 2385 | tANI_U16 caps; |
| 2386 | tANI_U8 *pFrame; |
| 2387 | tSirRetStatus nSirStatus; |
| 2388 | tANI_U32 nBytes, nPayload, nStatus; |
| 2389 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2390 | void *pPacket; |
| 2391 | eHalStatus halstatus; |
| 2392 | #if defined WLAN_FEATURE_VOWIFI |
| 2393 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2394 | #endif |
| 2395 | tANI_U16 ft_ies_length = 0; |
| 2396 | tANI_U8 *pBody; |
| 2397 | tANI_U16 nAddIELen; |
| 2398 | tANI_U8 *pAddIE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2399 | #if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2400 | tANI_U8 *wpsIe = NULL; |
| 2401 | #endif |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2402 | tANI_U32 txFlag = 0; |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2403 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2404 | |
| 2405 | if (NULL == psessionEntry) |
| 2406 | { |
| 2407 | return; |
| 2408 | } |
| 2409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2410 | /* check this early to avoid unncessary operation */ |
| 2411 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2412 | { |
| 2413 | return; |
| 2414 | } |
| 2415 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2416 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2417 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2418 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2419 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2420 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2421 | |
| 2422 | caps = pMlmReassocReq->capabilityInfo; |
| 2423 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2424 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2425 | #if defined(FEATURE_WLAN_WAPI) |
| 2426 | /* CR: 262463 : |
| 2427 | According to WAPI standard: |
| 2428 | 7.3.1.4 Capability Information field |
| 2429 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2430 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2431 | Reassociation management frames. */ |
| 2432 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2433 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2434 | #endif |
| 2435 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2436 | |
| 2437 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2438 | |
| 2439 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2440 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2441 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2442 | |
| 2443 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2444 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2445 | &frm.SuppRates,psessionEntry); |
| 2446 | |
| 2447 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2448 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2449 | |
| 2450 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2451 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2452 | |
| 2453 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2454 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2455 | |
| 2456 | if ( psessionEntry->lim11hEnable && |
| 2457 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2458 | { |
| 2459 | #if defined WLAN_FEATURE_VOWIFI |
| 2460 | PowerCapsPopulated = TRUE; |
| 2461 | |
| 2462 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2463 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2464 | #endif |
| 2465 | } |
| 2466 | |
| 2467 | #if defined WLAN_FEATURE_VOWIFI |
| 2468 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2469 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2470 | { |
| 2471 | if (PowerCapsPopulated == FALSE) |
| 2472 | { |
| 2473 | PowerCapsPopulated = TRUE; |
| 2474 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2475 | } |
| 2476 | } |
| 2477 | #endif |
| 2478 | |
| 2479 | if ( fQosEnabled && |
| 2480 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2481 | { |
| 2482 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2483 | } |
| 2484 | |
| 2485 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2486 | &frm.ExtSuppRates, psessionEntry ); |
| 2487 | |
| 2488 | #if defined WLAN_FEATURE_VOWIFI |
| 2489 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2490 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2491 | { |
| 2492 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2493 | } |
| 2494 | #endif |
| 2495 | |
| 2496 | // Ideally this should be enabled for 11r also. But 11r does |
| 2497 | // not follow the usual norm of using the Opaque object |
| 2498 | // for rsnie and fties. Instead we just add |
| 2499 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2500 | // This should ideally! be fixed. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2501 | #if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2502 | // |
| 2503 | // The join request *should* contain zero or one of the WPA and RSN |
| 2504 | // IEs. The payload send along with the request is a |
| 2505 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2506 | |
| 2507 | // typedef struct sSirRSNie |
| 2508 | // { |
| 2509 | // tANI_U16 length; |
| 2510 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2511 | // } tSirRSNie, *tpSirRSNie; |
| 2512 | |
| 2513 | // So, we should be able to make the following two calls harmlessly, |
| 2514 | // since they do nothing if they don't find the given IE in the |
| 2515 | // bytestream with which they're provided. |
| 2516 | |
| 2517 | // The net effect of this will be to faithfully transmit whatever |
| 2518 | // security IE is in the join request. |
| 2519 | |
| 2520 | // *However*, if we're associating for the purpose of WPS |
| 2521 | // enrollment, and we've been configured to indicate that by |
| 2522 | // eliding the WPA or RSN IE, we just skip this: |
| 2523 | if (!psessionEntry->is11Rconnection) |
| 2524 | { |
| 2525 | if( nAddIELen && pAddIE ) |
| 2526 | { |
| 2527 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2528 | } |
| 2529 | if ( NULL == wpsIe ) |
| 2530 | { |
| 2531 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2532 | &frm.RSNOpaque ); |
| 2533 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2534 | &frm.WPAOpaque ); |
| 2535 | } |
| 2536 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2537 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2538 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2539 | { |
| 2540 | PopulateDot11fCCXCckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2541 | &frm.CCXCckmOpaque ); |
| 2542 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2543 | #endif //FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2544 | } |
| 2545 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2546 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2547 | // For CCX Associations fill the CCX IEs |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2548 | if (psessionEntry->isCCXconnection && |
| 2549 | psessionEntry->pLimReAssocReq->isCCXFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2550 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2551 | #ifndef FEATURE_DISABLE_RM |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2552 | PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2553 | #endif |
Sandeep Puligilla | e9ffdf6 | 2013-11-23 18:23:00 +0530 | [diff] [blame] | 2554 | PopulateDot11fCCXVersion(&frm.CCXVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2555 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2556 | #endif //FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2557 | #endif //FEATURE_WLAN_CCX || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2558 | |
| 2559 | // include WME EDCA IE as well |
| 2560 | if ( fWmeEnabled ) |
| 2561 | { |
| 2562 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2563 | { |
| 2564 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2565 | } |
| 2566 | |
| 2567 | if ( fWsmEnabled && |
| 2568 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2569 | { |
| 2570 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2571 | } |
| 2572 | #ifdef FEATURE_WLAN_CCX |
| 2573 | if (psessionEntry->isCCXconnection) |
| 2574 | { |
| 2575 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2576 | |
| 2577 | // Populate the TSRS IE if TSPEC is included in the reassoc request |
| 2578 | if (psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs) |
| 2579 | { |
| 2580 | tANI_U32 phyMode; |
| 2581 | tSirMacCCXTSRSIE tsrsIE; |
| 2582 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2583 | |
| 2584 | tsrsIE.tsid = 0; |
| 2585 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2586 | { |
| 2587 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2588 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2589 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2590 | { |
| 2591 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2592 | } |
| 2593 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.CCXTrafStrmRateSet, sizeof(tANI_U8)); |
| 2594 | } |
| 2595 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2596 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2597 | } |
| 2598 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2599 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2600 | pMac->lim.htCapabilityPresentInBeacon) |
| 2601 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2602 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2603 | } |
| 2604 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2605 | #if defined WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2606 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && (0 == pMac->ft.ftSmeContext.reassoc_ft_ies_length) |
| 2607 | #if defined FEATURE_WLAN_CCX |
| 2608 | && !psessionEntry->isCCXconnection |
| 2609 | #endif |
| 2610 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2611 | { |
| 2612 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2613 | } |
| 2614 | #endif |
| 2615 | |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2616 | #ifdef WLAN_FEATURE_11AC |
| 2617 | if ( psessionEntry->vhtCapability && |
| 2618 | psessionEntry->vhtCapabilityPresentInBeacon) |
| 2619 | { |
| 2620 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
| 2621 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2622 | } |
| 2623 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 2624 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 2625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2626 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2627 | if ( DOT11F_FAILED( nStatus ) ) |
| 2628 | { |
| 2629 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2630 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2631 | nStatus ); |
| 2632 | // We'll fall back on the worst case scenario: |
| 2633 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2634 | } |
| 2635 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2636 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2637 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2638 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2639 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2640 | } |
| 2641 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2642 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2643 | |
| 2644 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2645 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2646 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2647 | #endif |
| 2648 | |
| 2649 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2650 | if (psessionEntry->is11Rconnection) |
| 2651 | { |
| 2652 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2653 | } |
| 2654 | #endif |
| 2655 | |
| 2656 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2657 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2658 | ( void** ) &pPacket ); |
| 2659 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2660 | { |
| 2661 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2662 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2663 | 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] | 2664 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2665 | goto end; |
| 2666 | } |
| 2667 | |
| 2668 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2669 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2670 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2671 | #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] | 2672 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2673 | #endif |
| 2674 | // Next, we fill out the buffer descriptor: |
| 2675 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2676 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2677 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2678 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2679 | { |
| 2680 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2681 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2682 | nSirStatus ); |
| 2683 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2684 | goto end; |
| 2685 | } |
| 2686 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2687 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2688 | // That done, pack the ReAssoc Request: |
| 2689 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2690 | sizeof(tSirMacMgmtHdr), |
| 2691 | nPayload, &nPayload ); |
| 2692 | if ( DOT11F_FAILED( nStatus ) ) |
| 2693 | { |
| 2694 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2695 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2696 | nStatus ); |
| 2697 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2698 | goto end; |
| 2699 | } |
| 2700 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2701 | { |
| 2702 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2703 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2704 | } |
| 2705 | |
| 2706 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2707 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2708 | nBytes, nPayload );) |
| 2709 | if( psessionEntry->assocReq != NULL ) |
| 2710 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2711 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2712 | psessionEntry->assocReq = NULL; |
| 2713 | } |
| 2714 | |
| 2715 | if( nAddIELen ) |
| 2716 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2717 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2718 | pAddIE, |
| 2719 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2720 | nPayload += nAddIELen; |
| 2721 | } |
| 2722 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2723 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2724 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2725 | { |
| 2726 | 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] | 2727 | } |
| 2728 | else |
| 2729 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2730 | //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] | 2731 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2732 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2733 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2734 | |
| 2735 | if (psessionEntry->is11Rconnection) |
| 2736 | { |
| 2737 | { |
| 2738 | int i = 0; |
| 2739 | |
| 2740 | pBody = pFrame + nBytes; |
| 2741 | for (i=0; i<ft_ies_length; i++) |
| 2742 | { |
| 2743 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 2744 | pBody++; |
| 2745 | } |
| 2746 | } |
| 2747 | } |
| 2748 | |
| 2749 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2750 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 2751 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2752 | (tANI_U8 *)pFrame, |
| 2753 | (nBytes + ft_ies_length));) |
| 2754 | #endif |
| 2755 | |
| 2756 | |
| 2757 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2758 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2759 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2760 | ) |
| 2761 | { |
| 2762 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2763 | } |
| 2764 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2765 | if( NULL != psessionEntry->assocReq ) |
| 2766 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2767 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2768 | psessionEntry->assocReq = NULL; |
| 2769 | } |
| 2770 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2771 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 2772 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2773 | { |
| 2774 | 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] | 2775 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2776 | } |
| 2777 | else |
| 2778 | { |
| 2779 | //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] | 2780 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 2781 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2782 | psessionEntry->assocReqLen = (ft_ies_length); |
| 2783 | } |
| 2784 | |
| 2785 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2786 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 2787 | psessionEntry->peSessionId, |
| 2788 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2789 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 2790 | HAL_TXRX_FRM_802_11_MGMT, |
| 2791 | ANI_TXDIR_TODS, |
| 2792 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2793 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2794 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 2795 | psessionEntry->peSessionId, |
| 2796 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2797 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2798 | { |
| 2799 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2800 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2801 | nSirStatus ); |
| 2802 | //Pkt will be freed up by the callback |
| 2803 | goto end; |
| 2804 | } |
| 2805 | |
| 2806 | end: |
| 2807 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2808 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2809 | psessionEntry->pLimMlmReassocReq = NULL; |
| 2810 | |
| 2811 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2812 | |
| 2813 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 2814 | tLimMlmReassocReq *pMlmReassocReq, |
| 2815 | tpPESession psessionEntry) |
| 2816 | { |
| 2817 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 2818 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 2819 | if(NULL == pTmpMlmReassocReq) |
| 2820 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2821 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 2822 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 2823 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 2824 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2825 | } |
| 2826 | |
| 2827 | // Prepare and send Reassociation request frame |
| 2828 | // start reassoc timer. |
| 2829 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 2830 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 2831 | 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] | 2832 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 2833 | != TX_SUCCESS) |
| 2834 | { |
| 2835 | // Could not start reassoc failure timer. |
| 2836 | // Log error |
| 2837 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2838 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2839 | // Return Reassoc confirm with |
| 2840 | // Resources Unavailable |
| 2841 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2842 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2843 | goto end; |
| 2844 | } |
| 2845 | |
| 2846 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 2847 | return; |
| 2848 | |
| 2849 | end: |
| 2850 | // Free up buffer allocated for reassocReq |
| 2851 | if (pMlmReassocReq != NULL) |
| 2852 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2853 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2854 | pMlmReassocReq = NULL; |
| 2855 | } |
| 2856 | if (pTmpMlmReassocReq != NULL) |
| 2857 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2858 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2859 | pTmpMlmReassocReq = NULL; |
| 2860 | } |
| 2861 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 2862 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2863 | /* Update PE sessio Id*/ |
| 2864 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 2865 | |
| 2866 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 2867 | } |
| 2868 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2869 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2870 | |
| 2871 | |
| 2872 | void |
| 2873 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2874 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2875 | { |
| 2876 | static tDot11fReAssocRequest frm; |
| 2877 | tANI_U16 caps; |
| 2878 | tANI_U8 *pFrame; |
| 2879 | tSirRetStatus nSirStatus; |
| 2880 | tANI_U32 nBytes, nPayload, nStatus; |
| 2881 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2882 | void *pPacket; |
| 2883 | eHalStatus halstatus; |
| 2884 | tANI_U16 nAddIELen; |
| 2885 | tANI_U8 *pAddIE; |
| 2886 | tANI_U8 *wpsIe = NULL; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 2887 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2888 | #if defined WLAN_FEATURE_VOWIFI |
| 2889 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2890 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 2891 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2892 | |
| 2893 | if(NULL == psessionEntry) |
| 2894 | { |
| 2895 | return; |
| 2896 | } |
| 2897 | |
| 2898 | /* check this early to avoid unncessary operation */ |
| 2899 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2900 | { |
| 2901 | return; |
| 2902 | } |
| 2903 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2904 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 2905 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2906 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2907 | |
| 2908 | caps = pMlmReassocReq->capabilityInfo; |
| 2909 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2910 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2911 | #if defined(FEATURE_WLAN_WAPI) |
| 2912 | /* CR: 262463 : |
| 2913 | According to WAPI standard: |
| 2914 | 7.3.1.4 Capability Information field |
| 2915 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2916 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2917 | Reassociation management frames. */ |
| 2918 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2919 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2920 | #endif |
| 2921 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2922 | |
| 2923 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2924 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2925 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 2926 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2927 | |
| 2928 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2929 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2930 | &frm.SuppRates,psessionEntry); |
| 2931 | |
| 2932 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 2933 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2934 | |
| 2935 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2936 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2937 | |
| 2938 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2939 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2940 | |
| 2941 | |
| 2942 | if ( psessionEntry->lim11hEnable && |
| 2943 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2944 | { |
| 2945 | #if defined WLAN_FEATURE_VOWIFI |
| 2946 | PowerCapsPopulated = TRUE; |
| 2947 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2948 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2949 | #endif |
| 2950 | } |
| 2951 | |
| 2952 | #if defined WLAN_FEATURE_VOWIFI |
| 2953 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2954 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2955 | { |
| 2956 | if (PowerCapsPopulated == FALSE) |
| 2957 | { |
| 2958 | PowerCapsPopulated = TRUE; |
| 2959 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2960 | } |
| 2961 | } |
| 2962 | #endif |
| 2963 | |
| 2964 | if ( fQosEnabled && |
| 2965 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2966 | { |
| 2967 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2968 | } |
| 2969 | |
| 2970 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2971 | &frm.ExtSuppRates, psessionEntry ); |
| 2972 | |
| 2973 | #if defined WLAN_FEATURE_VOWIFI |
| 2974 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2975 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2976 | { |
| 2977 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2978 | } |
| 2979 | #endif |
| 2980 | // The join request *should* contain zero or one of the WPA and RSN |
| 2981 | // IEs. The payload send along with the request is a |
| 2982 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2983 | |
| 2984 | // typedef struct sSirRSNie |
| 2985 | // { |
| 2986 | // tANI_U16 length; |
| 2987 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2988 | // } tSirRSNie, *tpSirRSNie; |
| 2989 | |
| 2990 | // So, we should be able to make the following two calls harmlessly, |
| 2991 | // since they do nothing if they don't find the given IE in the |
| 2992 | // bytestream with which they're provided. |
| 2993 | |
| 2994 | // The net effect of this will be to faithfully transmit whatever |
| 2995 | // security IE is in the join request. |
| 2996 | |
| 2997 | // *However*, if we're associating for the purpose of WPS |
| 2998 | // enrollment, and we've been configured to indicate that by |
| 2999 | // eliding the WPA or RSN IE, we just skip this: |
| 3000 | if( nAddIELen && pAddIE ) |
| 3001 | { |
| 3002 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 3003 | } |
| 3004 | if ( NULL == wpsIe ) |
| 3005 | { |
| 3006 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3007 | &frm.RSNOpaque ); |
| 3008 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3009 | &frm.WPAOpaque ); |
| 3010 | #if defined(FEATURE_WLAN_WAPI) |
| 3011 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 3012 | &frm.WAPIOpaque ); |
| 3013 | #endif // defined(FEATURE_WLAN_WAPI) |
| 3014 | } |
| 3015 | |
| 3016 | // include WME EDCA IE as well |
| 3017 | if ( fWmeEnabled ) |
| 3018 | { |
| 3019 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 3020 | { |
| 3021 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 3022 | } |
| 3023 | |
| 3024 | if ( fWsmEnabled && |
| 3025 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 3026 | { |
| 3027 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 3028 | } |
| 3029 | } |
| 3030 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3031 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3032 | pMac->lim.htCapabilityPresentInBeacon) |
| 3033 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3034 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3035 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3036 | #ifdef WLAN_FEATURE_11AC |
| 3037 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 3038 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3039 | { |
Chet Lanctot | f19c1f6 | 2013-12-13 13:56:21 -0800 | [diff] [blame] | 3040 | limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3041 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3042 | PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3043 | } |
| 3044 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3045 | |
| 3046 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 3047 | if ( DOT11F_FAILED( nStatus ) ) |
| 3048 | { |
| 3049 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3050 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3051 | nStatus ); |
| 3052 | // We'll fall back on the worst case scenario: |
| 3053 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3054 | } |
| 3055 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3056 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3057 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3058 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3059 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3060 | } |
| 3061 | |
| 3062 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3063 | |
| 3064 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3065 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3066 | ( void** ) &pPacket ); |
| 3067 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3068 | { |
| 3069 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3070 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | 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] | 3072 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3073 | goto end; |
| 3074 | } |
| 3075 | |
| 3076 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3077 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3078 | |
| 3079 | // Next, we fill out the buffer descriptor: |
| 3080 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3081 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3082 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3083 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3084 | { |
| 3085 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3086 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3087 | nSirStatus ); |
| 3088 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3089 | goto end; |
| 3090 | } |
| 3091 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3092 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3093 | // That done, pack the Probe Request: |
| 3094 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3095 | sizeof(tSirMacMgmtHdr), |
| 3096 | nPayload, &nPayload ); |
| 3097 | if ( DOT11F_FAILED( nStatus ) ) |
| 3098 | { |
| 3099 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3100 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3101 | nStatus ); |
| 3102 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3103 | goto end; |
| 3104 | } |
| 3105 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3106 | { |
| 3107 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3108 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3109 | } |
| 3110 | |
| 3111 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3112 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3113 | nBytes );) |
| 3114 | |
| 3115 | if( psessionEntry->assocReq != NULL ) |
| 3116 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3117 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3118 | psessionEntry->assocReq = NULL; |
| 3119 | } |
| 3120 | |
| 3121 | if( nAddIELen ) |
| 3122 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3123 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3124 | pAddIE, |
| 3125 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | nPayload += nAddIELen; |
| 3127 | } |
| 3128 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3129 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3130 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3131 | { |
| 3132 | 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] | 3133 | } |
| 3134 | else |
| 3135 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3136 | //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] | 3137 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3138 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3139 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3140 | |
| 3141 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3142 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3143 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3144 | ) |
| 3145 | { |
| 3146 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3147 | } |
| 3148 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3149 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3150 | { |
| 3151 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3152 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3153 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3154 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3155 | psessionEntry->peSessionId, |
| 3156 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3157 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3158 | HAL_TXRX_FRM_802_11_MGMT, |
| 3159 | ANI_TXDIR_TODS, |
| 3160 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3161 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3162 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3163 | psessionEntry->peSessionId, |
| 3164 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3165 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3166 | { |
| 3167 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3168 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3169 | nSirStatus ); |
| 3170 | //Pkt will be freed up by the callback |
| 3171 | goto end; |
| 3172 | } |
| 3173 | |
| 3174 | end: |
| 3175 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3176 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3177 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3178 | |
| 3179 | } // limSendReassocReqMgmtFrame |
| 3180 | |
| 3181 | /** |
| 3182 | * \brief Send an Authentication frame |
| 3183 | * |
| 3184 | * |
| 3185 | * \param pMac Pointer to Global MAC structure |
| 3186 | * |
| 3187 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3188 | * to be sent |
| 3189 | * |
| 3190 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3191 | * frame is destined |
| 3192 | * |
| 3193 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3194 | * Authentication frame3 |
| 3195 | * |
| 3196 | * |
| 3197 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3198 | * is formatted and sent when this function is called. |
| 3199 | * |
| 3200 | * |
| 3201 | */ |
| 3202 | |
| 3203 | void |
| 3204 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3205 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3206 | tSirMacAddr peerMacAddr, |
| 3207 | tANI_U8 wepBit, |
| 3208 | tpPESession psessionEntry |
| 3209 | ) |
| 3210 | { |
| 3211 | tANI_U8 *pFrame, *pBody; |
| 3212 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3213 | tpSirMacMgmtHdr pMacHdr; |
| 3214 | tANI_U16 i; |
| 3215 | void *pPacket; |
| 3216 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3217 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3218 | |
| 3219 | if(NULL == psessionEntry) |
| 3220 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3221 | limLog(pMac, LOGE, FL("Error: psession Entry is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3222 | return; |
| 3223 | } |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3224 | |
| 3225 | limLog(pMac, LOG1, |
| 3226 | FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
| 3227 | pAuthFrameBody->authTransactionSeqNumber, |
| 3228 | pAuthFrameBody->authStatusCode, |
| 3229 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3230 | MAC_ADDR_ARRAY(peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3231 | if (wepBit == LIM_WEP_IN_FC) |
| 3232 | { |
| 3233 | /// Auth frame3 to be sent with encrypted framebody |
| 3234 | /** |
| 3235 | * Allocate buffer for Authenticaton frame of size equal |
| 3236 | * to management frame header length plus 2 bytes each for |
| 3237 | * auth algorithm number, transaction number, status code, |
| 3238 | * 128 bytes for challenge text and 4 bytes each for |
| 3239 | * IV & ICV. |
| 3240 | */ |
| 3241 | |
| 3242 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3243 | |
| 3244 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3245 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3246 | else |
| 3247 | { |
| 3248 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3249 | { |
| 3250 | case SIR_MAC_AUTH_FRAME_1: |
| 3251 | /** |
| 3252 | * Allocate buffer for Authenticaton frame of size |
| 3253 | * equal to management frame header length plus 2 bytes |
| 3254 | * each for auth algorithm number, transaction number |
| 3255 | * and status code. |
| 3256 | */ |
| 3257 | |
| 3258 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3259 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3260 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3261 | |
| 3262 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3263 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3264 | { |
| 3265 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3266 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3267 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3268 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3269 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3270 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3271 | else |
| 3272 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3273 | limLog(pMac, LOG3, FL("Auth frame, Does not contain " |
| 3274 | "FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3275 | frameLen += (2+SIR_MDIE_SIZE); |
| 3276 | } |
| 3277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3278 | #endif |
| 3279 | break; |
| 3280 | |
| 3281 | case SIR_MAC_AUTH_FRAME_2: |
| 3282 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3283 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3284 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3285 | { |
| 3286 | /** |
| 3287 | * Allocate buffer for Authenticaton frame of size |
| 3288 | * equal to management frame header length plus |
| 3289 | * 2 bytes each for auth algorithm number, |
| 3290 | * transaction number and status code. |
| 3291 | */ |
| 3292 | |
| 3293 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3294 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3295 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3296 | } |
| 3297 | else |
| 3298 | { |
| 3299 | // Shared Key algorithm with challenge text |
| 3300 | // to be sent |
| 3301 | /** |
| 3302 | * Allocate buffer for Authenticaton frame of size |
| 3303 | * equal to management frame header length plus |
| 3304 | * 2 bytes each for auth algorithm number, |
| 3305 | * transaction number, status code and 128 bytes |
| 3306 | * for challenge text. |
| 3307 | */ |
| 3308 | |
| 3309 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3310 | sizeof(tSirMacAuthFrame); |
| 3311 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3312 | } |
| 3313 | |
| 3314 | break; |
| 3315 | |
| 3316 | case SIR_MAC_AUTH_FRAME_3: |
| 3317 | /// Auth frame3 to be sent without encrypted framebody |
| 3318 | /** |
| 3319 | * Allocate buffer for Authenticaton frame of size equal |
| 3320 | * to management frame header length plus 2 bytes each |
| 3321 | * for auth algorithm number, transaction number and |
| 3322 | * status code. |
| 3323 | */ |
| 3324 | |
| 3325 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3326 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3327 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3328 | |
| 3329 | break; |
| 3330 | |
| 3331 | case SIR_MAC_AUTH_FRAME_4: |
| 3332 | /** |
| 3333 | * Allocate buffer for Authenticaton frame of size equal |
| 3334 | * to management frame header length plus 2 bytes each |
| 3335 | * for auth algorithm number, transaction number and |
| 3336 | * status code. |
| 3337 | */ |
| 3338 | |
| 3339 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3340 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3341 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3342 | |
| 3343 | break; |
| 3344 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3345 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3346 | |
| 3347 | |
| 3348 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3349 | |
| 3350 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3351 | { |
| 3352 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3353 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3354 | |
| 3355 | return; |
| 3356 | } |
| 3357 | |
| 3358 | for (i = 0; i < frameLen; i++) |
| 3359 | pFrame[i] = 0; |
| 3360 | |
| 3361 | // Prepare BD |
| 3362 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3363 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3364 | { |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3365 | limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for " |
| 3366 | "AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3367 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3368 | return; |
| 3369 | } |
| 3370 | |
| 3371 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3372 | pMacHdr->fc.wep = wepBit; |
| 3373 | |
| 3374 | // Prepare BSSId |
| 3375 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3376 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3377 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3378 | (tANI_U8 *) psessionEntry->bssId, |
| 3379 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | } |
| 3381 | |
| 3382 | /// Prepare Authentication frame body |
| 3383 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3384 | |
| 3385 | if (wepBit == LIM_WEP_IN_FC) |
| 3386 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3387 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3388 | |
| 3389 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3390 | FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3391 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3392 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3393 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3395 | } |
| 3396 | else |
| 3397 | { |
| 3398 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3399 | pBody += sizeof(tANI_U16); |
| 3400 | bodyLen -= sizeof(tANI_U16); |
| 3401 | |
| 3402 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3403 | pBody += sizeof(tANI_U16); |
| 3404 | bodyLen -= sizeof(tANI_U16); |
| 3405 | |
| 3406 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3407 | pBody += sizeof(tANI_U16); |
| 3408 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3409 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3410 | sizeof (pAuthFrameBody->length) + |
| 3411 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3412 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3413 | |
| 3414 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3415 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3416 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3417 | { |
| 3418 | |
| 3419 | { |
| 3420 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3421 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3422 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3423 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srinivas Girigowda | d63eb49 | 2014-02-06 12:21:47 -0800 | [diff] [blame] | 3424 | PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: ")); |
| 3425 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3426 | (tANI_U8 *)pBody, |
| 3427 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3428 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3429 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3430 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3431 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3432 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3433 | } |
| 3434 | } |
| 3435 | else |
| 3436 | { |
| 3437 | /* MDID attr is 54*/ |
| 3438 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3439 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3440 | *pBody = SIR_MDIE_SIZE; |
| 3441 | pBody++; |
| 3442 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3443 | { |
| 3444 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3445 | pBody++; |
| 3446 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3447 | } |
| 3448 | } |
| 3449 | } |
| 3450 | #endif |
| 3451 | |
| 3452 | PELOG1(limLog(pMac, LOG1, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3453 | FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3454 | pAuthFrameBody->authTransactionSeqNumber, |
| 3455 | pAuthFrameBody->authStatusCode, |
Abhishek Singh | 57aebef | 2014-02-03 18:47:44 +0530 | [diff] [blame] | 3456 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 3457 | MAC_ADDR_ARRAY(pMacHdr->da));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3458 | } |
| 3459 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3460 | |
| 3461 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3462 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3463 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3464 | #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] | 3465 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3466 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3467 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3468 | ) |
| 3469 | { |
| 3470 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3471 | } |
| 3472 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3473 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3474 | { |
| 3475 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3476 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3477 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3478 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3479 | psessionEntry->peSessionId, |
| 3480 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3481 | /// Queue Authentication frame in high priority WQ |
| 3482 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3483 | HAL_TXRX_FRM_802_11_MGMT, |
| 3484 | ANI_TXDIR_TODS, |
| 3485 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3486 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3487 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3488 | psessionEntry->peSessionId, |
| 3489 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3490 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3491 | { |
| 3492 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3493 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3494 | halstatus); |
| 3495 | |
| 3496 | //Pkt will be freed up by the callback |
| 3497 | } |
| 3498 | |
| 3499 | return; |
| 3500 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3501 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3502 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3503 | { |
| 3504 | tANI_U16 aid; |
| 3505 | tpDphHashNode pStaDs; |
| 3506 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3507 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3508 | tpPESession psessionEntry; |
| 3509 | |
| 3510 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3511 | if (pMlmDeauthReq) |
| 3512 | { |
| 3513 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3514 | { |
| 3515 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3516 | } |
| 3517 | |
| 3518 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3519 | { |
| 3520 | |
| 3521 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3522 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3523 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3524 | goto end; |
| 3525 | } |
| 3526 | |
| 3527 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3528 | if (pStaDs == NULL) |
| 3529 | { |
| 3530 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3531 | goto end; |
| 3532 | } |
| 3533 | |
| 3534 | |
| 3535 | /// Receive path cleanup with dummy packet |
| 3536 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
| 3537 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3538 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3539 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3540 | } |
| 3541 | return eHAL_STATUS_SUCCESS; |
| 3542 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3543 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3544 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3545 | sizeof(tSirMacAddr)); |
| 3546 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3547 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3548 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3549 | |
| 3550 | // Free up buffer allocated |
| 3551 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3552 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3553 | |
| 3554 | limPostSmeMessage(pMac, |
| 3555 | LIM_MLM_DEAUTH_CNF, |
| 3556 | (tANI_U32 *) &mlmDeauthCnf); |
| 3557 | return eHAL_STATUS_SUCCESS; |
| 3558 | } |
| 3559 | |
| 3560 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3561 | { |
| 3562 | tANI_U16 aid; |
| 3563 | tpDphHashNode pStaDs; |
| 3564 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3565 | tpPESession psessionEntry; |
| 3566 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3567 | |
| 3568 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3569 | if (pMlmDisassocReq) |
| 3570 | { |
| 3571 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3572 | { |
| 3573 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3574 | } |
| 3575 | |
| 3576 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3577 | { |
| 3578 | |
| 3579 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3580 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3581 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3582 | goto end; |
| 3583 | } |
| 3584 | |
| 3585 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3586 | if (pStaDs == NULL) |
| 3587 | { |
| 3588 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3589 | goto end; |
| 3590 | } |
| 3591 | |
| 3592 | /// Receive path cleanup with dummy packet |
| 3593 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3594 | { |
| 3595 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3596 | goto end; |
| 3597 | } |
| 3598 | |
| 3599 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3600 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3601 | ( |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3602 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3603 | (psessionEntry->isCCXconnection ) || |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3604 | #endif |
| 3605 | #ifdef FEATURE_WLAN_LFR |
| 3606 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3607 | #endif |
| 3608 | (psessionEntry->is11Rconnection )) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3609 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3610 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3611 | { |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3612 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3613 | FL("FT Preauth Session (%p,%d) Cleanup"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3614 | psessionEntry, psessionEntry->peSessionId);); |
| 3615 | limFTCleanup(pMac); |
| 3616 | } |
| 3617 | else |
| 3618 | { |
| 3619 | PELOGE(limLog(pMac, LOGE, |
| 3620 | FL("No FT Preauth Session Cleanup in role %d" |
| 3621 | #ifdef FEATURE_WLAN_CCX |
| 3622 | " isCCX %d" |
| 3623 | #endif |
| 3624 | #ifdef FEATURE_WLAN_LFR |
| 3625 | " isLFR %d" |
| 3626 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3627 | " is11r %d reason %d"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3628 | psessionEntry->limSystemRole, |
| 3629 | #ifdef FEATURE_WLAN_CCX |
| 3630 | psessionEntry->isCCXconnection, |
| 3631 | #endif |
| 3632 | #ifdef FEATURE_WLAN_LFR |
| 3633 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3634 | #endif |
| 3635 | psessionEntry->is11Rconnection, |
| 3636 | pMlmDisassocReq->reasonCode);); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3637 | } |
| 3638 | #endif |
| 3639 | |
| 3640 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3641 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3642 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3643 | return eHAL_STATUS_SUCCESS; |
| 3644 | } |
| 3645 | else |
| 3646 | { |
| 3647 | return eHAL_STATUS_SUCCESS; |
| 3648 | } |
| 3649 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3650 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3651 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3652 | sizeof(tSirMacAddr)); |
| 3653 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3654 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3655 | |
| 3656 | /* Update PE session ID*/ |
| 3657 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3658 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3659 | if(pMlmDisassocReq != NULL) |
| 3660 | { |
| 3661 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3662 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3663 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3664 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3665 | |
| 3666 | limPostSmeMessage(pMac, |
| 3667 | LIM_MLM_DISASSOC_CNF, |
| 3668 | (tANI_U32 *) &mlmDisassocCnf); |
| 3669 | return eHAL_STATUS_SUCCESS; |
| 3670 | } |
| 3671 | |
| 3672 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3673 | { |
| 3674 | return limSendDisassocCnf(pMac); |
| 3675 | } |
| 3676 | |
| 3677 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3678 | { |
| 3679 | return limSendDeauthCnf(pMac); |
| 3680 | } |
| 3681 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3682 | /** |
| 3683 | * \brief This function is called to send Disassociate frame. |
| 3684 | * |
| 3685 | * |
| 3686 | * \param pMac Pointer to Global MAC structure |
| 3687 | * |
| 3688 | * \param nReason Indicates the reason that need to be sent in |
| 3689 | * Disassociation frame |
| 3690 | * |
| 3691 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3692 | * sent |
| 3693 | * |
| 3694 | * |
| 3695 | */ |
| 3696 | |
| 3697 | void |
| 3698 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 3699 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3700 | tSirMacAddr peer, |
| 3701 | tpPESession psessionEntry, |
| 3702 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3703 | { |
| 3704 | tDot11fDisassociation frm; |
| 3705 | tANI_U8 *pFrame; |
| 3706 | tSirRetStatus nSirStatus; |
| 3707 | tpSirMacMgmtHdr pMacHdr; |
| 3708 | tANI_U32 nBytes, nPayload, nStatus; |
| 3709 | void *pPacket; |
| 3710 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3711 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3712 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3713 | if(NULL == psessionEntry) |
| 3714 | { |
| 3715 | return; |
| 3716 | } |
| 3717 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3718 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3719 | |
| 3720 | frm.Reason.code = nReason; |
| 3721 | |
| 3722 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 3723 | if ( DOT11F_FAILED( nStatus ) ) |
| 3724 | { |
| 3725 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3726 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3727 | nStatus ); |
| 3728 | // We'll fall back on the worst case scenario: |
| 3729 | nPayload = sizeof( tDot11fDisassociation ); |
| 3730 | } |
| 3731 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3732 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3733 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3734 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3735 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3736 | } |
| 3737 | |
| 3738 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 3739 | |
| 3740 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3741 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3742 | ( void** ) &pPacket ); |
| 3743 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3744 | { |
| 3745 | 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] | 3746 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3747 | return; |
| 3748 | } |
| 3749 | |
| 3750 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3751 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3752 | |
| 3753 | // Next, we fill out the buffer descriptor: |
| 3754 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3755 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 3756 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3757 | { |
| 3758 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3759 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3760 | nSirStatus ); |
| 3761 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3762 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3763 | return; // just allocated... |
| 3764 | } |
| 3765 | |
| 3766 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3767 | |
| 3768 | // Prepare the BSSID |
| 3769 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 3770 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3771 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 3772 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3773 | #endif |
| 3774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3775 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 3776 | sizeof(tSirMacMgmtHdr), |
| 3777 | nPayload, &nPayload ); |
| 3778 | if ( DOT11F_FAILED( nStatus ) ) |
| 3779 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3780 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3781 | nStatus ); |
| 3782 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3783 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3784 | return; // allocated! |
| 3785 | } |
| 3786 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3787 | { |
| 3788 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3789 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3790 | } |
| 3791 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3792 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with " |
| 3793 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 3794 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 3795 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 3796 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3797 | |
| 3798 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3799 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3800 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3801 | ) |
| 3802 | { |
| 3803 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3804 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3805 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3806 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3807 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 3808 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3809 | { |
| 3810 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3811 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3812 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3813 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 3814 | { |
| 3815 | /* This frame will be sent on air by firmware, |
| 3816 | which will ensure that this frame goes out |
| 3817 | even though DEL_STA is sent immediately */ |
| 3818 | /* Without this for DEL_STA command there is |
| 3819 | risk of flushing frame in BTQM queue without |
| 3820 | sending on air */ |
| 3821 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 3822 | } |
| 3823 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3824 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3825 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3826 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3827 | psessionEntry->peSessionId, |
| 3828 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3829 | // Queue Disassociation frame in high priority WQ |
| 3830 | /* get the duration from the request */ |
| 3831 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3832 | HAL_TXRX_FRM_802_11_MGMT, |
| 3833 | ANI_TXDIR_TODS, |
| 3834 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3835 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 3836 | txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3837 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3838 | psessionEntry->peSessionId, |
| 3839 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3840 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3841 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3842 | if (tx_timer_change( |
| 3843 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 3844 | != TX_SUCCESS) |
| 3845 | { |
| 3846 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3847 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3848 | return; |
| 3849 | } |
| 3850 | else if(TX_SUCCESS != tx_timer_activate( |
| 3851 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3852 | { |
| 3853 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3854 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3855 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3856 | return; |
| 3857 | } |
| 3858 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3859 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3860 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3861 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 3862 | psessionEntry->peSessionId, |
| 3863 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3864 | // Queue Disassociation frame in high priority WQ |
| 3865 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3866 | HAL_TXRX_FRM_802_11_MGMT, |
| 3867 | ANI_TXDIR_TODS, |
| 3868 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3869 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 3870 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 3871 | psessionEntry->peSessionId, |
| 3872 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3873 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3874 | { |
| 3875 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3876 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3877 | nSirStatus ); |
| 3878 | //Pkt will be freed up by the callback |
| 3879 | return; |
| 3880 | } |
| 3881 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3882 | } // End limSendDisassocMgmtFrame. |
| 3883 | |
| 3884 | /** |
| 3885 | * \brief This function is called to send a Deauthenticate frame |
| 3886 | * |
| 3887 | * |
| 3888 | * \param pMac Pointer to global MAC structure |
| 3889 | * |
| 3890 | * \param nReason Indicates the reason that need to be sent in the |
| 3891 | * Deauthenticate frame |
| 3892 | * |
| 3893 | * \param peeer address of the STA to which the frame is to be sent |
| 3894 | * |
| 3895 | * |
| 3896 | */ |
| 3897 | |
| 3898 | void |
| 3899 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 3900 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3901 | tSirMacAddr peer, |
| 3902 | tpPESession psessionEntry, |
| 3903 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3904 | { |
| 3905 | tDot11fDeAuth frm; |
| 3906 | tANI_U8 *pFrame; |
| 3907 | tSirRetStatus nSirStatus; |
| 3908 | tpSirMacMgmtHdr pMacHdr; |
| 3909 | tANI_U32 nBytes, nPayload, nStatus; |
| 3910 | void *pPacket; |
| 3911 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3912 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3913 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3914 | #ifdef FEATURE_WLAN_TDLS |
| 3915 | tANI_U16 aid; |
| 3916 | tpDphHashNode pStaDs; |
| 3917 | #endif |
| 3918 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3919 | if(NULL == psessionEntry) |
| 3920 | { |
| 3921 | return; |
| 3922 | } |
| 3923 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3924 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3925 | |
| 3926 | frm.Reason.code = nReason; |
| 3927 | |
| 3928 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 3929 | if ( DOT11F_FAILED( nStatus ) ) |
| 3930 | { |
| 3931 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3932 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3933 | nStatus ); |
| 3934 | // We'll fall back on the worst case scenario: |
| 3935 | nPayload = sizeof( tDot11fDeAuth ); |
| 3936 | } |
| 3937 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3938 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3939 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3940 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3941 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3942 | } |
| 3943 | |
| 3944 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 3945 | |
| 3946 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3947 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3948 | ( void** ) &pPacket ); |
| 3949 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3950 | { |
| 3951 | 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] | 3952 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3953 | return; |
| 3954 | } |
| 3955 | |
| 3956 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3957 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3958 | |
| 3959 | // Next, we fill out the buffer descriptor: |
| 3960 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3961 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 3962 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3963 | { |
| 3964 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3965 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3966 | nSirStatus ); |
| 3967 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3968 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3969 | return; // just allocated... |
| 3970 | } |
| 3971 | |
| 3972 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3973 | |
| 3974 | // Prepare the BSSID |
| 3975 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 3976 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3977 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 3978 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3979 | #endif |
| 3980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3981 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 3982 | sizeof(tSirMacMgmtHdr), |
| 3983 | nPayload, &nPayload ); |
| 3984 | if ( DOT11F_FAILED( nStatus ) ) |
| 3985 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3986 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3987 | nStatus ); |
| 3988 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3989 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3990 | return; |
| 3991 | } |
| 3992 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3993 | { |
| 3994 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3995 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3996 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3997 | limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with " |
| 3998 | "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From " |
| 3999 | MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck, |
| 4000 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 4001 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4002 | |
| 4003 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4004 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4005 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4006 | ) |
| 4007 | { |
| 4008 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4009 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4010 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4011 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4012 | (psessionEntry->pePersona == VOS_P2P_GO_MODE) || |
| 4013 | (psessionEntry->pePersona == VOS_STA_SAP_MODE)) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 4014 | { |
| 4015 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 4016 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 4017 | |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4018 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 4019 | { |
| 4020 | /* This frame will be sent on air by firmware, |
| 4021 | which will ensure that this frame goes out |
| 4022 | even though DEL_STA is sent immediately */ |
| 4023 | /* Without this for DEL_STA command there is |
| 4024 | risk of flushing frame in BTQM queue without |
| 4025 | sending on air */ |
| 4026 | txFlag |= HAL_USE_FW_IN_TX_PATH; |
| 4027 | } |
| 4028 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4029 | #ifdef FEATURE_WLAN_TDLS |
| 4030 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 4031 | #endif |
| 4032 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4033 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4034 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4035 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4036 | psessionEntry->peSessionId, |
| 4037 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4038 | // Queue Disassociation frame in high priority WQ |
| 4039 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4040 | HAL_TXRX_FRM_802_11_MGMT, |
| 4041 | ANI_TXDIR_TODS, |
| 4042 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4043 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4044 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4045 | psessionEntry->peSessionId, |
| 4046 | halstatus)); |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4047 | if (!HAL_STATUS_SUCCESS(halstatus)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4048 | { |
| 4049 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4050 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4051 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 4052 | //Pkt will be freed up by the callback limTxComplete |
| 4053 | |
| 4054 | /*Call limProcessDeauthAckTimeout which will send |
| 4055 | * DeauthCnf for this frame |
| 4056 | */ |
| 4057 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4058 | return; |
| 4059 | } |
| 4060 | |
| 4061 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 4062 | |
| 4063 | if (tx_timer_change( |
| 4064 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 4065 | != TX_SUCCESS) |
| 4066 | { |
| 4067 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4068 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4069 | return; |
| 4070 | } |
| 4071 | else if(TX_SUCCESS != tx_timer_activate( |
| 4072 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 4073 | { |
| 4074 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4075 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4076 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 4077 | return; |
| 4078 | } |
| 4079 | } |
| 4080 | else |
| 4081 | { |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4082 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4083 | psessionEntry->peSessionId, |
| 4084 | pMacHdr->fc.subType)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4085 | #ifdef FEATURE_WLAN_TDLS |
| 4086 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 4087 | { |
| 4088 | // Queue Disassociation frame in high priority WQ |
| 4089 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4090 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4091 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4092 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4093 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 4094 | } |
| 4095 | else |
| 4096 | { |
| 4097 | #endif |
| 4098 | // Queue Disassociation frame in high priority WQ |
| 4099 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4100 | HAL_TXRX_FRM_802_11_MGMT, |
| 4101 | ANI_TXDIR_TODS, |
| 4102 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4103 | limTxComplete, pFrame, txFlag ); |
| 4104 | #ifdef FEATURE_WLAN_TDLS |
| 4105 | } |
| 4106 | #endif |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4107 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4108 | psessionEntry->peSessionId, |
| 4109 | halstatus)); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4110 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4111 | { |
| 4112 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4113 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 4114 | nSirStatus ); |
| 4115 | //Pkt will be freed up by the callback |
| 4116 | return; |
| 4117 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4118 | } |
| 4119 | |
| 4120 | } // End limSendDeauthMgmtFrame. |
| 4121 | |
| 4122 | |
| 4123 | #ifdef ANI_SUPPORT_11H |
| 4124 | /** |
| 4125 | * \brief Send a Measurement Report Action frame |
| 4126 | * |
| 4127 | * |
| 4128 | * \param pMac Pointer to the global MAC structure |
| 4129 | * |
| 4130 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4131 | * |
| 4132 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4133 | * |
| 4134 | * |
| 4135 | */ |
| 4136 | |
| 4137 | tSirRetStatus |
| 4138 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4139 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4140 | tSirMacAddr peer) |
| 4141 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4142 | tDot11fMeasurementReport frm; |
| 4143 | tANI_U8 *pFrame; |
| 4144 | tSirRetStatus nSirStatus; |
| 4145 | tpSirMacMgmtHdr pMacHdr; |
| 4146 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4147 | void *pPacket; |
| 4148 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4149 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4150 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4151 | |
| 4152 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4153 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4154 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4155 | |
| 4156 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4157 | { |
| 4158 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4159 | nSirStatus = |
| 4160 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4161 | &frm.MeasurementReport ); |
| 4162 | break; |
| 4163 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4164 | nSirStatus = |
| 4165 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4166 | &frm.MeasurementReport ); |
| 4167 | break; |
| 4168 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4169 | nSirStatus = |
| 4170 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4171 | &frm.MeasurementReport ); |
| 4172 | break; |
| 4173 | default: |
| 4174 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4175 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4176 | pMeasReqFrame->measReqIE.measType ); |
| 4177 | return eSIR_FAILURE; |
| 4178 | } |
| 4179 | |
| 4180 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4181 | |
| 4182 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4183 | if ( DOT11F_FAILED( nStatus ) ) |
| 4184 | { |
| 4185 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4186 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4187 | nStatus ); |
| 4188 | // We'll fall back on the worst case scenario: |
| 4189 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4190 | } |
| 4191 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4192 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4193 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4194 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4195 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4196 | } |
| 4197 | |
| 4198 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4199 | |
| 4200 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4201 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4202 | { |
| 4203 | 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] | 4204 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4205 | return eSIR_FAILURE; |
| 4206 | } |
| 4207 | |
| 4208 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4209 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4210 | |
| 4211 | // Next, we fill out the buffer descriptor: |
| 4212 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4213 | SIR_MAC_MGMT_ACTION, peer); |
| 4214 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4215 | { |
| 4216 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4217 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4218 | nSirStatus ); |
| 4219 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4220 | return eSIR_FAILURE; // just allocated... |
| 4221 | } |
| 4222 | |
| 4223 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4224 | |
| 4225 | nCfg = 6; |
| 4226 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4227 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4228 | { |
| 4229 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4230 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4231 | nSirStatus ); |
| 4232 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4233 | return eSIR_FAILURE; // just allocated... |
| 4234 | } |
| 4235 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4236 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4237 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4238 | #endif |
| 4239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4240 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4241 | sizeof(tSirMacMgmtHdr), |
| 4242 | nPayload, &nPayload ); |
| 4243 | if ( DOT11F_FAILED( nStatus ) ) |
| 4244 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4245 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4246 | nStatus ); |
| 4247 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4248 | return eSIR_FAILURE; // allocated! |
| 4249 | } |
| 4250 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4251 | { |
| 4252 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4253 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4254 | } |
| 4255 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4256 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4257 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4258 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4259 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4260 | HAL_TXRX_FRM_802_11_MGMT, |
| 4261 | ANI_TXDIR_TODS, |
| 4262 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4263 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4264 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4265 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4266 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4267 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4268 | { |
| 4269 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4270 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4271 | nSirStatus ); |
| 4272 | //Pkt will be freed up by the callback |
| 4273 | return eSIR_FAILURE; // just allocated... |
| 4274 | } |
| 4275 | |
| 4276 | return eSIR_SUCCESS; |
| 4277 | |
| 4278 | } // End limSendMeasReportFrame. |
| 4279 | |
| 4280 | |
| 4281 | /** |
| 4282 | * \brief Send a TPC Request Action frame |
| 4283 | * |
| 4284 | * |
| 4285 | * \param pMac Pointer to the global MAC datastructure |
| 4286 | * |
| 4287 | * \param peer MAC address to which the frame should be sent |
| 4288 | * |
| 4289 | * |
| 4290 | */ |
| 4291 | |
| 4292 | void |
| 4293 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4294 | tSirMacAddr peer) |
| 4295 | { |
| 4296 | tDot11fTPCRequest frm; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4297 | tANI_U8 *pFrame; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4298 | tSirRetStatus nSirStatus; |
| 4299 | tpSirMacMgmtHdr pMacHdr; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4300 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4301 | void *pPacket; |
| 4302 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4303 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4304 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4305 | |
| 4306 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4307 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4308 | frm.DialogToken.token = 1; |
| 4309 | frm.TPCRequest.present = 1; |
| 4310 | |
| 4311 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4312 | if ( DOT11F_FAILED( nStatus ) ) |
| 4313 | { |
| 4314 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4315 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4316 | nStatus ); |
| 4317 | // We'll fall back on the worst case scenario: |
| 4318 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4319 | } |
| 4320 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4321 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4322 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4323 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4324 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4325 | } |
| 4326 | |
| 4327 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4328 | |
| 4329 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4330 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4331 | { |
| 4332 | 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] | 4333 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4334 | return; |
| 4335 | } |
| 4336 | |
| 4337 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4338 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4339 | |
| 4340 | // Next, we fill out the buffer descriptor: |
| 4341 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4342 | SIR_MAC_MGMT_ACTION, peer); |
| 4343 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4344 | { |
| 4345 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4346 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4347 | nSirStatus ); |
| 4348 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4349 | return; // just allocated... |
| 4350 | } |
| 4351 | |
| 4352 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4353 | |
| 4354 | nCfg = 6; |
| 4355 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4356 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4357 | { |
| 4358 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4359 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4360 | nSirStatus ); |
| 4361 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4362 | return; // just allocated... |
| 4363 | } |
| 4364 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4365 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4366 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4367 | #endif |
| 4368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4369 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4370 | sizeof(tSirMacMgmtHdr), |
| 4371 | nPayload, &nPayload ); |
| 4372 | if ( DOT11F_FAILED( nStatus ) ) |
| 4373 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4374 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4375 | nStatus ); |
| 4376 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4377 | return; // allocated! |
| 4378 | } |
| 4379 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4380 | { |
| 4381 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4382 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4383 | } |
| 4384 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4385 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4386 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4387 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4388 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4389 | HAL_TXRX_FRM_802_11_MGMT, |
| 4390 | ANI_TXDIR_TODS, |
| 4391 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4392 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4393 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4394 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4395 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4396 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4397 | { |
| 4398 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4399 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4400 | nSirStatus ); |
| 4401 | //Pkt will be freed up by the callback |
| 4402 | return; |
| 4403 | } |
| 4404 | |
| 4405 | } // End limSendTpcRequestFrame. |
| 4406 | |
| 4407 | |
| 4408 | /** |
| 4409 | * \brief Send a TPC Report Action frame |
| 4410 | * |
| 4411 | * |
| 4412 | * \param pMac Pointer to the global MAC datastructure |
| 4413 | * |
| 4414 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4415 | * |
| 4416 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4417 | * |
| 4418 | * |
| 4419 | */ |
| 4420 | |
| 4421 | tSirRetStatus |
| 4422 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4423 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4424 | tSirMacAddr peer) |
| 4425 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4426 | tDot11fTPCReport frm; |
| 4427 | tANI_U8 *pFrame; |
| 4428 | tSirRetStatus nSirStatus; |
| 4429 | tpSirMacMgmtHdr pMacHdr; |
| 4430 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4431 | void *pPacket; |
| 4432 | eHalStatus halstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4433 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4434 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4435 | |
| 4436 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4437 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4438 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4439 | |
| 4440 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4441 | // "misplaced this function, need to replace: |
| 4442 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4443 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4444 | frm.TPCReport.tx_power = 0; |
| 4445 | frm.TPCReport.link_margin = 0; |
| 4446 | frm.TPCReport.present = 1; |
| 4447 | |
| 4448 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4449 | if ( DOT11F_FAILED( nStatus ) ) |
| 4450 | { |
| 4451 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4452 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4453 | nStatus ); |
| 4454 | // We'll fall back on the worst case scenario: |
| 4455 | nPayload = sizeof( tDot11fTPCReport ); |
| 4456 | } |
| 4457 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4458 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4459 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4460 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4461 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4462 | } |
| 4463 | |
| 4464 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4465 | |
| 4466 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4467 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4468 | { |
| 4469 | 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] | 4470 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4471 | return eSIR_FAILURE; |
| 4472 | } |
| 4473 | |
| 4474 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4475 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | |
| 4477 | // Next, we fill out the buffer descriptor: |
| 4478 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4479 | SIR_MAC_MGMT_ACTION, peer); |
| 4480 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4481 | { |
| 4482 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4483 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4484 | nSirStatus ); |
| 4485 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4486 | return eSIR_FAILURE; // just allocated... |
| 4487 | } |
| 4488 | |
| 4489 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4490 | |
| 4491 | nCfg = 6; |
| 4492 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4493 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4494 | { |
| 4495 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4496 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4497 | nSirStatus ); |
| 4498 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4499 | return eSIR_FAILURE; // just allocated... |
| 4500 | } |
| 4501 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4502 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4503 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4504 | #endif |
| 4505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4506 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4507 | sizeof(tSirMacMgmtHdr), |
| 4508 | nPayload, &nPayload ); |
| 4509 | if ( DOT11F_FAILED( nStatus ) ) |
| 4510 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4511 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4512 | nStatus ); |
| 4513 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4514 | return eSIR_FAILURE; // allocated! |
| 4515 | } |
| 4516 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4517 | { |
| 4518 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4519 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4520 | } |
| 4521 | |
| 4522 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4523 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4524 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4525 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4526 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4527 | HAL_TXRX_FRM_802_11_MGMT, |
| 4528 | ANI_TXDIR_TODS, |
| 4529 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4530 | limTxComplete, pFrame, 0 ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4531 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4532 | ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION), |
| 4533 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4534 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4535 | { |
| 4536 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4537 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4538 | nSirStatus ); |
| 4539 | //Pkt will be freed up by the callback |
| 4540 | return eSIR_FAILURE; // just allocated... |
| 4541 | } |
| 4542 | |
| 4543 | return eSIR_SUCCESS; |
| 4544 | |
| 4545 | } // End limSendTpcReportFrame. |
| 4546 | #endif //ANI_SUPPORT_11H |
| 4547 | |
| 4548 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4549 | /** |
| 4550 | * \brief Send a Channel Switch Announcement |
| 4551 | * |
| 4552 | * |
| 4553 | * \param pMac Pointer to the global MAC datastructure |
| 4554 | * |
| 4555 | * \param peer MAC address to which this frame will be sent |
| 4556 | * |
| 4557 | * \param nMode |
| 4558 | * |
| 4559 | * \param nNewChannel |
| 4560 | * |
| 4561 | * \param nCount |
| 4562 | * |
| 4563 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4564 | * |
| 4565 | * |
| 4566 | */ |
| 4567 | |
| 4568 | tSirRetStatus |
| 4569 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4570 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4571 | tANI_U8 nMode, |
| 4572 | tANI_U8 nNewChannel, |
| 4573 | tANI_U8 nCount, |
| 4574 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4575 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4576 | tDot11fChannelSwitch frm; |
| 4577 | tANI_U8 *pFrame; |
| 4578 | tSirRetStatus nSirStatus; |
| 4579 | tpSirMacMgmtHdr pMacHdr; |
| 4580 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4581 | void *pPacket; |
| 4582 | eHalStatus halstatus; |
| 4583 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4584 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4585 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4586 | |
| 4587 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4588 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4589 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4590 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4591 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4592 | frm.ChanSwitchAnn.present = 1; |
| 4593 | |
| 4594 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4595 | if ( DOT11F_FAILED( nStatus ) ) |
| 4596 | { |
| 4597 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4598 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4599 | nStatus ); |
| 4600 | // We'll fall back on the worst case scenario: |
| 4601 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4602 | } |
| 4603 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4604 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4605 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4606 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4607 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4608 | } |
| 4609 | |
| 4610 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4611 | |
| 4612 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4613 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4614 | { |
| 4615 | 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] | 4616 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4617 | return eSIR_FAILURE; |
| 4618 | } |
| 4619 | |
| 4620 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4621 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4622 | |
| 4623 | // Next, we fill out the buffer descriptor: |
| 4624 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4625 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4626 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4627 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4628 | (tANI_U8 *) psessionEntry->bssId, |
| 4629 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4630 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4631 | { |
| 4632 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4633 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4634 | nSirStatus ); |
| 4635 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4636 | return eSIR_FAILURE; // just allocated... |
| 4637 | } |
| 4638 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4639 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4640 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4641 | |
| 4642 | nCfg = 6; |
| 4643 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4644 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4645 | { |
| 4646 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4647 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4648 | nSirStatus ); |
| 4649 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4650 | return eSIR_FAILURE; // just allocated... |
| 4651 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4652 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4653 | |
| 4654 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4655 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4656 | #endif |
| 4657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4658 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4659 | sizeof(tSirMacMgmtHdr), |
| 4660 | nPayload, &nPayload ); |
| 4661 | if ( DOT11F_FAILED( nStatus ) ) |
| 4662 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4663 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4664 | nStatus ); |
| 4665 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4666 | return eSIR_FAILURE; // allocated! |
| 4667 | } |
| 4668 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4669 | { |
| 4670 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4671 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4672 | } |
| 4673 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4674 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4675 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4676 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4677 | ) |
| 4678 | { |
| 4679 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4680 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4681 | |
| 4682 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4683 | psessionEntry->peSessionId, |
| 4684 | pMacHdr->fc.subType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4685 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4686 | HAL_TXRX_FRM_802_11_MGMT, |
| 4687 | ANI_TXDIR_TODS, |
| 4688 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4689 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4690 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4691 | psessionEntry->peSessionId, |
| 4692 | halstatus)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4693 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4694 | { |
| 4695 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4696 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4697 | nSirStatus ); |
| 4698 | //Pkt will be freed up by the callback |
| 4699 | return eSIR_FAILURE; |
| 4700 | } |
| 4701 | |
| 4702 | return eSIR_SUCCESS; |
| 4703 | |
| 4704 | } // End limSendChannelSwitchMgmtFrame. |
| 4705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4706 | |
| 4707 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4708 | #ifdef WLAN_FEATURE_11AC |
| 4709 | tSirRetStatus |
| 4710 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 4711 | tSirMacAddr peer, |
| 4712 | tANI_U8 nMode, |
| 4713 | tpPESession psessionEntry ) |
| 4714 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4715 | tDot11fOperatingMode frm; |
| 4716 | tANI_U8 *pFrame; |
| 4717 | tSirRetStatus nSirStatus; |
| 4718 | tpSirMacMgmtHdr pMacHdr; |
| 4719 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 4720 | void *pPacket; |
| 4721 | eHalStatus halstatus; |
| 4722 | tANI_U32 txFlag = 0; |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4723 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4724 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4725 | |
| 4726 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 4727 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 4728 | frm.OperatingMode.chanWidth = nMode; |
| 4729 | frm.OperatingMode.rxNSS = 0; |
| 4730 | frm.OperatingMode.rxNSSType = 0; |
| 4731 | |
| 4732 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 4733 | if ( DOT11F_FAILED( nStatus ) ) |
| 4734 | { |
| 4735 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4736 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4737 | nStatus ); |
| 4738 | // We'll fall back on the worst case scenario: |
| 4739 | nPayload = sizeof( tDot11fOperatingMode); |
| 4740 | } |
| 4741 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4742 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4743 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4744 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4745 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4746 | } |
| 4747 | |
| 4748 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4749 | |
| 4750 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4751 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4752 | { |
| 4753 | 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] | 4754 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4755 | return eSIR_FAILURE; |
| 4756 | } |
| 4757 | |
| 4758 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4759 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4760 | |
| 4761 | |
| 4762 | // Next, we fill out the buffer descriptor: |
| 4763 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 4764 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4765 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4766 | } else |
| 4767 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4768 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 4769 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4770 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4771 | (tANI_U8 *) psessionEntry->bssId, |
| 4772 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4773 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4774 | { |
| 4775 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4776 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4777 | nSirStatus ); |
| 4778 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4779 | return eSIR_FAILURE; // just allocated... |
| 4780 | } |
| 4781 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 4782 | sizeof(tSirMacMgmtHdr), |
| 4783 | nPayload, &nPayload ); |
| 4784 | if ( DOT11F_FAILED( nStatus ) ) |
| 4785 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4786 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4787 | nStatus ); |
| 4788 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4789 | return eSIR_FAILURE; // allocated! |
| 4790 | } |
| 4791 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4792 | { |
| 4793 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4794 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4795 | } |
| 4796 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4797 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4798 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4799 | ) |
| 4800 | { |
| 4801 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4802 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4803 | |
| 4804 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4805 | psessionEntry->peSessionId, |
| 4806 | pMacHdr->fc.subType)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4807 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4808 | HAL_TXRX_FRM_802_11_MGMT, |
| 4809 | ANI_TXDIR_TODS, |
| 4810 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4811 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4812 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4813 | psessionEntry->peSessionId, |
| 4814 | halstatus)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4815 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4816 | { |
| 4817 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4818 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4819 | nSirStatus ); |
| 4820 | //Pkt will be freed up by the callback |
| 4821 | return eSIR_FAILURE; |
| 4822 | } |
| 4823 | |
| 4824 | return eSIR_SUCCESS; |
| 4825 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4826 | |
| 4827 | /** |
| 4828 | * \brief Send a VHT Channel Switch Announcement |
| 4829 | * |
| 4830 | * |
| 4831 | * \param pMac Pointer to the global MAC datastructure |
| 4832 | * |
| 4833 | * \param peer MAC address to which this frame will be sent |
| 4834 | * |
| 4835 | * \param nChanWidth |
| 4836 | * |
| 4837 | * \param nNewChannel |
| 4838 | * |
| 4839 | * |
| 4840 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4841 | * |
| 4842 | * |
| 4843 | */ |
| 4844 | |
| 4845 | tSirRetStatus |
| 4846 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4847 | tSirMacAddr peer, |
| 4848 | tANI_U8 nChanWidth, |
| 4849 | tANI_U8 nNewChannel, |
| 4850 | tANI_U8 ncbMode, |
| 4851 | tpPESession psessionEntry ) |
| 4852 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4853 | tDot11fChannelSwitch frm; |
| 4854 | tANI_U8 *pFrame; |
| 4855 | tSirRetStatus nSirStatus; |
| 4856 | tpSirMacMgmtHdr pMacHdr; |
| 4857 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4858 | void *pPacket; |
| 4859 | eHalStatus halstatus; |
| 4860 | tANI_U32 txFlag = 0; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4861 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4862 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4863 | |
| 4864 | |
| 4865 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4866 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4867 | frm.ChanSwitchAnn.switchMode = 1; |
| 4868 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4869 | frm.ChanSwitchAnn.switchCount = 1; |
| 4870 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 4871 | frm.ExtChanSwitchAnn.present = 1; |
| 4872 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 4873 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 4874 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 4875 | frm.ChanSwitchAnn.present = 1; |
| 4876 | frm.WiderBWChanSwitchAnn.present = 1; |
| 4877 | |
| 4878 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4879 | if ( DOT11F_FAILED( nStatus ) ) |
| 4880 | { |
| 4881 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4882 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4883 | nStatus ); |
| 4884 | // We'll fall back on the worst case scenario: |
| 4885 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4886 | } |
| 4887 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4888 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4889 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4890 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4891 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4892 | } |
| 4893 | |
| 4894 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4895 | |
| 4896 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4897 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4898 | { |
| 4899 | 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] | 4900 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4901 | return eSIR_FAILURE; |
| 4902 | } |
| 4903 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4904 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4905 | |
| 4906 | // Next, we fill out the buffer descriptor: |
| 4907 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4908 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4909 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4910 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4911 | (tANI_U8 *) psessionEntry->bssId, |
| 4912 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4913 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4914 | { |
| 4915 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4916 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4917 | nSirStatus ); |
| 4918 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4919 | return eSIR_FAILURE; // just allocated... |
| 4920 | } |
| 4921 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4922 | sizeof(tSirMacMgmtHdr), |
| 4923 | nPayload, &nPayload ); |
| 4924 | if ( DOT11F_FAILED( nStatus ) ) |
| 4925 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4926 | 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] | 4927 | nStatus ); |
| 4928 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4929 | return eSIR_FAILURE; // allocated! |
| 4930 | } |
| 4931 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4932 | { |
| 4933 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4934 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4935 | } |
| 4936 | |
| 4937 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4938 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4939 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4940 | ) |
| 4941 | { |
| 4942 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4943 | } |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4944 | |
| 4945 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 4946 | psessionEntry->peSessionId, |
| 4947 | pMacHdr->fc.subType)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4948 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4949 | HAL_TXRX_FRM_802_11_MGMT, |
| 4950 | ANI_TXDIR_TODS, |
| 4951 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4952 | limTxComplete, pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 4953 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 4954 | psessionEntry->peSessionId, |
| 4955 | halstatus)); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4956 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4957 | { |
| 4958 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4959 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4960 | nSirStatus ); |
| 4961 | //Pkt will be freed up by the callback |
| 4962 | return eSIR_FAILURE; |
| 4963 | } |
| 4964 | |
| 4965 | return eSIR_SUCCESS; |
| 4966 | |
| 4967 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 4968 | |
| 4969 | |
| 4970 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4971 | #endif |
| 4972 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4973 | /** |
| 4974 | * \brief Send an ADDBA Req Action Frame to peer |
| 4975 | * |
| 4976 | * \sa limSendAddBAReq |
| 4977 | * |
| 4978 | * \param pMac The global tpAniSirGlobal object |
| 4979 | * |
| 4980 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 4981 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 4982 | * Frame to the peer |
| 4983 | * |
| 4984 | * \return eSIR_SUCCESS if setup completes successfully |
| 4985 | * eSIR_FAILURE is some problem is encountered |
| 4986 | */ |
| 4987 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4988 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4989 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 4990 | tDot11fAddBAReq frmAddBAReq; |
| 4991 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 4992 | tpSirMacMgmtHdr pMacHdr; |
| 4993 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 4994 | tSirRetStatus statusCode; |
| 4995 | eHalStatus halStatus; |
| 4996 | void *pPacket; |
| 4997 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4998 | |
| 4999 | if(NULL == psessionEntry) |
| 5000 | { |
| 5001 | return eSIR_FAILURE; |
| 5002 | } |
| 5003 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5004 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5005 | |
| 5006 | // Category - 3 (BA) |
| 5007 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5008 | |
| 5009 | // Action - 0 (ADDBA Req) |
| 5010 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 5011 | |
| 5012 | // FIXME - Dialog Token, generalize this... |
| 5013 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 5014 | |
| 5015 | // Fill the ADDBA Parameter Set |
| 5016 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 5017 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 5018 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 5019 | |
| 5020 | // BA timeout |
| 5021 | // 0 - indicates no BA timeout |
| 5022 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 5023 | |
| 5024 | // BA Starting Sequence Number |
| 5025 | // Fragment number will always be zero |
| 5026 | if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) { |
| 5027 | pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5028 | } |
| 5029 | |
| 5030 | frmAddBAReq.BAStartingSequenceControl.ssn = |
| 5031 | pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 5032 | |
| 5033 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 5034 | |
| 5035 | if( DOT11F_FAILED( nStatus )) |
| 5036 | { |
| 5037 | limLog( pMac, LOGW, |
| 5038 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5039 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5040 | nStatus ); |
| 5041 | |
| 5042 | // We'll fall back on the worst case scenario: |
| 5043 | nPayload = sizeof( tDot11fAddBAReq ); |
| 5044 | } |
| 5045 | else if( DOT11F_WARNED( nStatus )) |
| 5046 | { |
| 5047 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5048 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5049 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5050 | nStatus ); |
| 5051 | } |
| 5052 | |
| 5053 | // Add the MGMT header to frame length |
| 5054 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5055 | |
| 5056 | // Need to allocate a buffer for ADDBA AF |
| 5057 | if( eHAL_STATUS_SUCCESS != |
| 5058 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5059 | HAL_TXRX_FRM_802_11_MGMT, |
| 5060 | (tANI_U16) frameLen, |
| 5061 | (void **) &pAddBAReqBuffer, |
| 5062 | (void **) &pPacket ))) |
| 5063 | { |
| 5064 | // Log error |
| 5065 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5066 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5067 | frameLen, |
| 5068 | halStatus ); |
| 5069 | |
| 5070 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5071 | goto returnAfterError; |
| 5072 | } |
| 5073 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5074 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5075 | |
| 5076 | // Copy necessary info to BD |
| 5077 | if( eSIR_SUCCESS != |
| 5078 | (statusCode = limPopulateMacHeader( pMac, |
| 5079 | pAddBAReqBuffer, |
| 5080 | SIR_MAC_MGMT_FRAME, |
| 5081 | SIR_MAC_MGMT_ACTION, |
| 5082 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5083 | goto returnAfterError; |
| 5084 | |
| 5085 | // Update A3 with the BSSID |
| 5086 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 5087 | |
| 5088 | #if 0 |
| 5089 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5090 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5091 | WNI_CFG_BSSID, |
| 5092 | (tANI_U8 *) pMacHdr->bssId, |
| 5093 | &cfgLen )) |
| 5094 | { |
| 5095 | limLog( pMac, LOGP, |
| 5096 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5097 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5098 | |
| 5099 | // FIXME - Need to convert to tSirRetStatus |
| 5100 | statusCode = eSIR_FAILURE; |
| 5101 | goto returnAfterError; |
| 5102 | } |
| 5103 | #endif//TO SUPPORT BT-AMP |
| 5104 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5105 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5106 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5107 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5108 | #endif |
| 5109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | // Now, we're ready to "pack" the frames |
| 5111 | nStatus = dot11fPackAddBAReq( pMac, |
| 5112 | &frmAddBAReq, |
| 5113 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 5114 | nPayload, |
| 5115 | &nPayload ); |
| 5116 | |
| 5117 | if( DOT11F_FAILED( nStatus )) |
| 5118 | { |
| 5119 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5120 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5121 | nStatus ); |
| 5122 | |
| 5123 | // FIXME - Need to convert to tSirRetStatus |
| 5124 | statusCode = eSIR_FAILURE; |
| 5125 | goto returnAfterError; |
| 5126 | } |
| 5127 | else if( DOT11F_WARNED( nStatus )) |
| 5128 | { |
| 5129 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5130 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 5131 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5132 | } |
| 5133 | |
| 5134 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5135 | FL( "Sending an ADDBA REQ to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5136 | limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW ); |
| 5137 | |
| 5138 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5139 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5140 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5141 | ) |
| 5142 | { |
| 5143 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5144 | } |
| 5145 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 5146 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5147 | psessionEntry->peSessionId, |
| 5148 | pMacHdr->fc.subType)); |
| 5149 | halStatus = halTxFrame( pMac, |
| 5150 | pPacket, |
| 5151 | (tANI_U16) frameLen, |
| 5152 | HAL_TXRX_FRM_802_11_MGMT, |
| 5153 | ANI_TXDIR_TODS, |
| 5154 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5155 | limTxComplete, |
| 5156 | pAddBAReqBuffer, txFlag ); |
| 5157 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5158 | psessionEntry->peSessionId, |
| 5159 | halStatus)); |
| 5160 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5161 | { |
| 5162 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5163 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5164 | halStatus ); |
| 5165 | |
| 5166 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 5167 | statusCode = eSIR_FAILURE; |
| 5168 | //Pkt will be freed up by the callback |
| 5169 | return statusCode; |
| 5170 | } |
| 5171 | else |
| 5172 | return eSIR_SUCCESS; |
| 5173 | |
| 5174 | returnAfterError: |
| 5175 | |
| 5176 | // Release buffer, if allocated |
| 5177 | if( NULL != pAddBAReqBuffer ) |
| 5178 | palPktFree( pMac->hHdd, |
| 5179 | HAL_TXRX_FRM_802_11_MGMT, |
| 5180 | (void *) pAddBAReqBuffer, |
| 5181 | (void *) pPacket ); |
| 5182 | |
| 5183 | return statusCode; |
| 5184 | } |
| 5185 | |
| 5186 | /** |
| 5187 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5188 | * |
| 5189 | * \sa limSendAddBARsp |
| 5190 | * |
| 5191 | * \param pMac The global tpAniSirGlobal object |
| 5192 | * |
| 5193 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5194 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5195 | * Frame to the peer |
| 5196 | * |
| 5197 | * \return eSIR_SUCCESS if setup completes successfully |
| 5198 | * eSIR_FAILURE is some problem is encountered |
| 5199 | */ |
| 5200 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5201 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5202 | tpPESession psessionEntry) |
| 5203 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5204 | tDot11fAddBARsp frmAddBARsp; |
| 5205 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5206 | tpSirMacMgmtHdr pMacHdr; |
| 5207 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5208 | tSirRetStatus statusCode; |
| 5209 | eHalStatus halStatus; |
| 5210 | void *pPacket; |
| 5211 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5212 | |
| 5213 | if(NULL == psessionEntry) |
| 5214 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5215 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5216 | return eSIR_FAILURE; |
| 5217 | } |
| 5218 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5219 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5220 | |
| 5221 | // Category - 3 (BA) |
| 5222 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5223 | // Action - 1 (ADDBA Rsp) |
| 5224 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5225 | |
| 5226 | // Should be same as the one we received in the ADDBA Req |
| 5227 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5228 | |
| 5229 | // ADDBA Req status |
| 5230 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5231 | |
| 5232 | // Fill the ADDBA Parameter Set as provided by caller |
| 5233 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5234 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5235 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5236 | |
| 5237 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5238 | { |
| 5239 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5240 | psessionEntry->amsduSupportedInBA; |
| 5241 | } |
| 5242 | else |
| 5243 | { |
| 5244 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5245 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5246 | |
| 5247 | // BA timeout |
| 5248 | // 0 - indicates no BA timeout |
| 5249 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5250 | |
| 5251 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5252 | |
| 5253 | if( DOT11F_FAILED( nStatus )) |
| 5254 | { |
| 5255 | limLog( pMac, LOGW, |
| 5256 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5257 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5258 | nStatus ); |
| 5259 | |
| 5260 | // We'll fall back on the worst case scenario: |
| 5261 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5262 | } |
| 5263 | else if( DOT11F_WARNED( nStatus )) |
| 5264 | { |
| 5265 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5266 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5267 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5268 | nStatus ); |
| 5269 | } |
| 5270 | |
| 5271 | // Need to allocate a buffer for ADDBA AF |
| 5272 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5273 | |
| 5274 | // Allocate shared memory |
| 5275 | if( eHAL_STATUS_SUCCESS != |
| 5276 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5277 | HAL_TXRX_FRM_802_11_MGMT, |
| 5278 | (tANI_U16) frameLen, |
| 5279 | (void **) &pAddBARspBuffer, |
| 5280 | (void **) &pPacket ))) |
| 5281 | { |
| 5282 | // Log error |
| 5283 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5284 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5285 | frameLen, |
| 5286 | halStatus ); |
| 5287 | |
| 5288 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5289 | goto returnAfterError; |
| 5290 | } |
| 5291 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5292 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5293 | |
| 5294 | // Copy necessary info to BD |
| 5295 | if( eSIR_SUCCESS != |
| 5296 | (statusCode = limPopulateMacHeader( pMac, |
| 5297 | pAddBARspBuffer, |
| 5298 | SIR_MAC_MGMT_FRAME, |
| 5299 | SIR_MAC_MGMT_ACTION, |
| 5300 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5301 | goto returnAfterError; |
| 5302 | |
| 5303 | // Update A3 with the BSSID |
| 5304 | |
| 5305 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5306 | |
| 5307 | #if 0 |
| 5308 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5309 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5310 | WNI_CFG_BSSID, |
| 5311 | (tANI_U8 *) pMacHdr->bssId, |
| 5312 | &cfgLen )) |
| 5313 | { |
| 5314 | limLog( pMac, LOGP, |
| 5315 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5316 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5317 | |
| 5318 | // FIXME - Need to convert to tSirRetStatus |
| 5319 | statusCode = eSIR_FAILURE; |
| 5320 | goto returnAfterError; |
| 5321 | } |
| 5322 | #endif // TO SUPPORT BT-AMP |
| 5323 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5324 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5325 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5326 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5327 | #endif |
| 5328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5329 | // Now, we're ready to "pack" the frames |
| 5330 | nStatus = dot11fPackAddBARsp( pMac, |
| 5331 | &frmAddBARsp, |
| 5332 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5333 | nPayload, |
| 5334 | &nPayload ); |
| 5335 | |
| 5336 | if( DOT11F_FAILED( nStatus )) |
| 5337 | { |
| 5338 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5339 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5340 | nStatus ); |
| 5341 | |
| 5342 | // FIXME - Need to convert to tSirRetStatus |
| 5343 | statusCode = eSIR_FAILURE; |
| 5344 | goto returnAfterError; |
| 5345 | } |
| 5346 | else if( DOT11F_WARNED( nStatus )) |
| 5347 | { |
| 5348 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5349 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5350 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5351 | } |
| 5352 | |
| 5353 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5354 | FL( "Sending an ADDBA RSP to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5355 | limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW ); |
| 5356 | |
| 5357 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5358 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5359 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5360 | ) |
| 5361 | { |
| 5362 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5363 | } |
| 5364 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 5365 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5366 | psessionEntry->peSessionId, |
| 5367 | pMacHdr->fc.subType)); |
| 5368 | halStatus = halTxFrame( pMac, |
| 5369 | pPacket, |
| 5370 | (tANI_U16) frameLen, |
| 5371 | HAL_TXRX_FRM_802_11_MGMT, |
| 5372 | ANI_TXDIR_TODS, |
| 5373 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5374 | limTxComplete, |
| 5375 | pAddBARspBuffer, txFlag ); |
| 5376 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5377 | psessionEntry->peSessionId, |
| 5378 | halStatus)); |
| 5379 | if( eHAL_STATUS_SUCCESS != halStatus ) |
| 5380 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5382 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5383 | halStatus ); |
| 5384 | |
| 5385 | // FIXME - HAL error codes are different from PE error |
| 5386 | // codes!! And, this routine is returning tSirRetStatus |
| 5387 | statusCode = eSIR_FAILURE; |
| 5388 | //Pkt will be freed up by the callback |
| 5389 | return statusCode; |
| 5390 | } |
| 5391 | else |
| 5392 | return eSIR_SUCCESS; |
| 5393 | |
| 5394 | returnAfterError: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5395 | // Release buffer, if allocated |
| 5396 | if( NULL != pAddBARspBuffer ) |
| 5397 | palPktFree( pMac->hHdd, |
| 5398 | HAL_TXRX_FRM_802_11_MGMT, |
| 5399 | (void *) pAddBARspBuffer, |
| 5400 | (void *) pPacket ); |
| 5401 | |
| 5402 | return statusCode; |
| 5403 | } |
| 5404 | |
| 5405 | /** |
| 5406 | * \brief Send a DELBA Indication Action Frame to peer |
| 5407 | * |
| 5408 | * \sa limSendDelBAInd |
| 5409 | * |
| 5410 | * \param pMac The global tpAniSirGlobal object |
| 5411 | * |
| 5412 | * \param peerMacAddr MAC Address of peer |
| 5413 | * |
| 5414 | * \param reasonCode Reason for the DELBA notification |
| 5415 | * |
| 5416 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5417 | * This identifies the TID for which the BA session is |
| 5418 | * being deleted. |
| 5419 | * |
| 5420 | * \return eSIR_SUCCESS if setup completes successfully |
| 5421 | * eSIR_FAILURE is some problem is encountered |
| 5422 | */ |
| 5423 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5424 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5425 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5426 | tDot11fDelBAInd frmDelBAInd; |
| 5427 | tANI_U8 *pDelBAIndBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5428 | //tANI_U32 val; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5429 | tpSirMacMgmtHdr pMacHdr; |
| 5430 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5431 | tSirRetStatus statusCode; |
| 5432 | eHalStatus halStatus; |
| 5433 | void *pPacket; |
| 5434 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5435 | |
| 5436 | if(NULL == psessionEntry) |
| 5437 | { |
| 5438 | return eSIR_FAILURE; |
| 5439 | } |
| 5440 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5441 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5442 | |
| 5443 | // Category - 3 (BA) |
| 5444 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5445 | // Action - 2 (DELBA) |
| 5446 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5447 | |
| 5448 | // Fill the DELBA Parameter Set as provided by caller |
| 5449 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5450 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5451 | |
| 5452 | // BA Starting Sequence Number |
| 5453 | // Fragment number will always be zero |
| 5454 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5455 | |
| 5456 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5457 | |
| 5458 | if( DOT11F_FAILED( nStatus )) |
| 5459 | { |
| 5460 | limLog( pMac, LOGW, |
| 5461 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5462 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5463 | nStatus ); |
| 5464 | |
| 5465 | // We'll fall back on the worst case scenario: |
| 5466 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5467 | } |
| 5468 | else if( DOT11F_WARNED( nStatus )) |
| 5469 | { |
| 5470 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5471 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5472 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5473 | nStatus ); |
| 5474 | } |
| 5475 | |
| 5476 | // Add the MGMT header to frame length |
| 5477 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5478 | |
| 5479 | // Allocate shared memory |
| 5480 | if( eHAL_STATUS_SUCCESS != |
| 5481 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5482 | HAL_TXRX_FRM_802_11_MGMT, |
| 5483 | (tANI_U16) frameLen, |
| 5484 | (void **) &pDelBAIndBuffer, |
| 5485 | (void **) &pPacket ))) |
| 5486 | { |
| 5487 | // Log error |
| 5488 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5489 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5490 | frameLen, |
| 5491 | halStatus ); |
| 5492 | |
| 5493 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5494 | goto returnAfterError; |
| 5495 | } |
| 5496 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5497 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5498 | |
| 5499 | // Copy necessary info to BD |
| 5500 | if( eSIR_SUCCESS != |
| 5501 | (statusCode = limPopulateMacHeader( pMac, |
| 5502 | pDelBAIndBuffer, |
| 5503 | SIR_MAC_MGMT_FRAME, |
| 5504 | SIR_MAC_MGMT_ACTION, |
| 5505 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5506 | goto returnAfterError; |
| 5507 | |
| 5508 | // Update A3 with the BSSID |
| 5509 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5510 | |
| 5511 | #if 0 |
| 5512 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5513 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5514 | WNI_CFG_BSSID, |
| 5515 | (tANI_U8 *) pMacHdr->bssId, |
| 5516 | &cfgLen )) |
| 5517 | { |
| 5518 | limLog( pMac, LOGP, |
| 5519 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5520 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5521 | |
| 5522 | // FIXME - Need to convert to tSirRetStatus |
| 5523 | statusCode = eSIR_FAILURE; |
| 5524 | goto returnAfterError; |
| 5525 | } |
| 5526 | #endif //TO SUPPORT BT-AMP |
| 5527 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5528 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5529 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5530 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5531 | #endif |
| 5532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5533 | // Now, we're ready to "pack" the frames |
| 5534 | nStatus = dot11fPackDelBAInd( pMac, |
| 5535 | &frmDelBAInd, |
| 5536 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5537 | nPayload, |
| 5538 | &nPayload ); |
| 5539 | |
| 5540 | if( DOT11F_FAILED( nStatus )) |
| 5541 | { |
| 5542 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5543 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5544 | nStatus ); |
| 5545 | |
| 5546 | // FIXME - Need to convert to tSirRetStatus |
| 5547 | statusCode = eSIR_FAILURE; |
| 5548 | goto returnAfterError; |
| 5549 | } |
| 5550 | else if( DOT11F_WARNED( nStatus )) |
| 5551 | { |
| 5552 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5553 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5554 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5555 | } |
| 5556 | |
| 5557 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5558 | FL( "Sending a DELBA IND to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5559 | limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW ); |
| 5560 | |
| 5561 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5562 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5563 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5564 | ) |
| 5565 | { |
| 5566 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5567 | } |
| 5568 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 5569 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5570 | psessionEntry->peSessionId, |
| 5571 | pMacHdr->fc.subType)); |
| 5572 | halStatus = halTxFrame( pMac, |
| 5573 | pPacket, |
| 5574 | (tANI_U16) frameLen, |
| 5575 | HAL_TXRX_FRM_802_11_MGMT, |
| 5576 | ANI_TXDIR_TODS, |
| 5577 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5578 | limTxComplete, |
| 5579 | pDelBAIndBuffer, txFlag ); |
| 5580 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5581 | psessionEntry->peSessionId, |
| 5582 | halStatus)); |
| 5583 | if( eHAL_STATUS_SUCCESS != halStatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5585 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5586 | statusCode = eSIR_FAILURE; |
| 5587 | //Pkt will be freed up by the callback |
| 5588 | return statusCode; |
| 5589 | } |
| 5590 | else |
| 5591 | return eSIR_SUCCESS; |
| 5592 | |
| 5593 | returnAfterError: |
| 5594 | |
| 5595 | // Release buffer, if allocated |
| 5596 | if( NULL != pDelBAIndBuffer ) |
| 5597 | palPktFree( pMac->hHdd, |
| 5598 | HAL_TXRX_FRM_802_11_MGMT, |
| 5599 | (void *) pDelBAIndBuffer, |
| 5600 | (void *) pPacket ); |
| 5601 | |
| 5602 | return statusCode; |
| 5603 | } |
| 5604 | |
| 5605 | #if defined WLAN_FEATURE_VOWIFI |
| 5606 | |
| 5607 | /** |
| 5608 | * \brief Send a Neighbor Report Request Action frame |
| 5609 | * |
| 5610 | * |
| 5611 | * \param pMac Pointer to the global MAC structure |
| 5612 | * |
| 5613 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5614 | * |
| 5615 | * \param peer mac address of peer station. |
| 5616 | * |
| 5617 | * \param psessionEntry address of session entry. |
| 5618 | * |
| 5619 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5620 | * |
| 5621 | * |
| 5622 | */ |
| 5623 | |
| 5624 | tSirRetStatus |
| 5625 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5626 | tpSirMacNeighborReportReq pNeighborReq, |
| 5627 | tSirMacAddr peer, |
| 5628 | tpPESession psessionEntry |
| 5629 | ) |
| 5630 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5631 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | tDot11fNeighborReportRequest frm; |
| 5633 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5634 | tpSirMacMgmtHdr pMacHdr; |
| 5635 | tANI_U32 nBytes, nPayload, nStatus; |
| 5636 | void *pPacket; |
| 5637 | eHalStatus halstatus; |
| 5638 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5639 | |
| 5640 | if ( psessionEntry == NULL ) |
| 5641 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5642 | 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] | 5643 | return eSIR_FAILURE; |
| 5644 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5645 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5646 | |
| 5647 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5648 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5649 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5650 | |
| 5651 | |
| 5652 | if( pNeighborReq->ssid_present ) |
| 5653 | { |
| 5654 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5655 | } |
| 5656 | |
| 5657 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5658 | if ( DOT11F_FAILED( nStatus ) ) |
| 5659 | { |
| 5660 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5661 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5662 | nStatus ); |
| 5663 | // We'll fall back on the worst case scenario: |
| 5664 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5665 | } |
| 5666 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5667 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5668 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5670 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5671 | } |
| 5672 | |
| 5673 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5674 | |
| 5675 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5676 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5677 | { |
| 5678 | 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] | 5679 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5680 | return eSIR_FAILURE; |
| 5681 | } |
| 5682 | |
| 5683 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5684 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5685 | |
| 5686 | // Copy necessary info to BD |
| 5687 | if( eSIR_SUCCESS != |
| 5688 | (statusCode = limPopulateMacHeader( pMac, |
| 5689 | pFrame, |
| 5690 | SIR_MAC_MGMT_FRAME, |
| 5691 | SIR_MAC_MGMT_ACTION, |
| 5692 | peer, psessionEntry->selfMacAddr))) |
| 5693 | goto returnAfterError; |
| 5694 | |
| 5695 | // Update A3 with the BSSID |
| 5696 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5697 | |
| 5698 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5699 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5700 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5701 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5702 | #endif |
| 5703 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5704 | // Now, we're ready to "pack" the frames |
| 5705 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 5706 | &frm, |
| 5707 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5708 | nPayload, |
| 5709 | &nPayload ); |
| 5710 | |
| 5711 | if( DOT11F_FAILED( nStatus )) |
| 5712 | { |
| 5713 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5714 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5715 | nStatus ); |
| 5716 | |
| 5717 | // FIXME - Need to convert to tSirRetStatus |
| 5718 | statusCode = eSIR_FAILURE; |
| 5719 | goto returnAfterError; |
| 5720 | } |
| 5721 | else if( DOT11F_WARNED( nStatus )) |
| 5722 | { |
| 5723 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5724 | FL( "There were warnings while packing Neighbor Report " |
| 5725 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5726 | } |
| 5727 | |
| 5728 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5729 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5730 | limPrintMacAddr( pMac, peer, LOGW ); |
| 5731 | |
| 5732 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5734 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5735 | ) |
| 5736 | { |
| 5737 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5738 | } |
| 5739 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 5740 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5741 | psessionEntry->peSessionId, |
| 5742 | pMacHdr->fc.subType)); |
| 5743 | halstatus = halTxFrame( pMac, |
| 5744 | pPacket, |
| 5745 | (tANI_U16) nBytes, |
| 5746 | HAL_TXRX_FRM_802_11_MGMT, |
| 5747 | ANI_TXDIR_TODS, |
| 5748 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5749 | limTxComplete, |
| 5750 | pFrame, txFlag ); |
| 5751 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5752 | psessionEntry->peSessionId, |
| 5753 | halstatus)); |
| 5754 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5755 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5756 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5757 | statusCode = eSIR_FAILURE; |
| 5758 | //Pkt will be freed up by the callback |
| 5759 | return statusCode; |
| 5760 | } |
| 5761 | else |
| 5762 | return eSIR_SUCCESS; |
| 5763 | |
| 5764 | returnAfterError: |
| 5765 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5766 | |
| 5767 | return statusCode; |
| 5768 | } // End limSendNeighborReportRequestFrame. |
| 5769 | |
| 5770 | /** |
| 5771 | * \brief Send a Link Report Action frame |
| 5772 | * |
| 5773 | * |
| 5774 | * \param pMac Pointer to the global MAC structure |
| 5775 | * |
| 5776 | * \param pLinkReport Address of a tSirMacLinkReport |
| 5777 | * |
| 5778 | * \param peer mac address of peer station. |
| 5779 | * |
| 5780 | * \param psessionEntry address of session entry. |
| 5781 | * |
| 5782 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5783 | * |
| 5784 | * |
| 5785 | */ |
| 5786 | |
| 5787 | tSirRetStatus |
| 5788 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 5789 | tpSirMacLinkReport pLinkReport, |
| 5790 | tSirMacAddr peer, |
| 5791 | tpPESession psessionEntry |
| 5792 | ) |
| 5793 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5794 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5795 | tDot11fLinkMeasurementReport frm; |
| 5796 | tANI_U8 *pFrame; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5797 | tpSirMacMgmtHdr pMacHdr; |
| 5798 | tANI_U32 nBytes, nPayload, nStatus; |
| 5799 | void *pPacket; |
| 5800 | eHalStatus halstatus; |
| 5801 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5802 | |
| 5803 | |
| 5804 | if ( psessionEntry == NULL ) |
| 5805 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5806 | 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] | 5807 | return eSIR_FAILURE; |
| 5808 | } |
| 5809 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5810 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5811 | |
| 5812 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5813 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 5814 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 5815 | |
| 5816 | |
| 5817 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 5818 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 5819 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 5820 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 5821 | //such case this way than changing the frame parser. |
| 5822 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 5823 | frm.TPCEleLen.TPCLen = 2; |
| 5824 | frm.TxPower.txPower = pLinkReport->txPower; |
| 5825 | frm.LinkMargin.linkMargin = 0; |
| 5826 | |
| 5827 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 5828 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 5829 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 5830 | frm.RSNI.rsni = pLinkReport->rsni; |
| 5831 | |
| 5832 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 5833 | if ( DOT11F_FAILED( nStatus ) ) |
| 5834 | { |
| 5835 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5836 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5837 | nStatus ); |
| 5838 | // We'll fall back on the worst case scenario: |
| 5839 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 5840 | } |
| 5841 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5842 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5843 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5844 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5845 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | } |
| 5847 | |
| 5848 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5849 | |
| 5850 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5851 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5852 | { |
| 5853 | 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] | 5854 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5855 | return eSIR_FAILURE; |
| 5856 | } |
| 5857 | |
| 5858 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5859 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | |
| 5861 | // Copy necessary info to BD |
| 5862 | if( eSIR_SUCCESS != |
| 5863 | (statusCode = limPopulateMacHeader( pMac, |
| 5864 | pFrame, |
| 5865 | SIR_MAC_MGMT_FRAME, |
| 5866 | SIR_MAC_MGMT_ACTION, |
| 5867 | peer, psessionEntry->selfMacAddr))) |
| 5868 | goto returnAfterError; |
| 5869 | |
| 5870 | // Update A3 with the BSSID |
| 5871 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5872 | |
| 5873 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5874 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5875 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5876 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5877 | #endif |
| 5878 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5879 | // Now, we're ready to "pack" the frames |
| 5880 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 5881 | &frm, |
| 5882 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5883 | nPayload, |
| 5884 | &nPayload ); |
| 5885 | |
| 5886 | if( DOT11F_FAILED( nStatus )) |
| 5887 | { |
| 5888 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5889 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5890 | nStatus ); |
| 5891 | |
| 5892 | // FIXME - Need to convert to tSirRetStatus |
| 5893 | statusCode = eSIR_FAILURE; |
| 5894 | goto returnAfterError; |
| 5895 | } |
| 5896 | else if( DOT11F_WARNED( nStatus )) |
| 5897 | { |
| 5898 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5899 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 5900 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5901 | } |
| 5902 | |
| 5903 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5904 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5905 | limPrintMacAddr( pMac, peer, LOGW ); |
| 5906 | |
| 5907 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5908 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5909 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5910 | ) |
| 5911 | { |
| 5912 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5913 | } |
| 5914 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 5915 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 5916 | psessionEntry->peSessionId, |
| 5917 | pMacHdr->fc.subType)); |
| 5918 | halstatus = halTxFrame( pMac, |
| 5919 | pPacket, |
| 5920 | (tANI_U16) nBytes, |
| 5921 | HAL_TXRX_FRM_802_11_MGMT, |
| 5922 | ANI_TXDIR_TODS, |
| 5923 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5924 | limTxComplete, |
| 5925 | pFrame, txFlag ); |
| 5926 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 5927 | psessionEntry->peSessionId, |
| 5928 | halstatus)); |
| 5929 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5931 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5932 | statusCode = eSIR_FAILURE; |
| 5933 | //Pkt will be freed up by the callback |
| 5934 | return statusCode; |
| 5935 | } |
| 5936 | else |
| 5937 | return eSIR_SUCCESS; |
| 5938 | |
| 5939 | returnAfterError: |
| 5940 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5941 | |
| 5942 | return statusCode; |
| 5943 | } // End limSendLinkReportActionFrame. |
| 5944 | |
| 5945 | /** |
| 5946 | * \brief Send a Beacon Report Action frame |
| 5947 | * |
| 5948 | * |
| 5949 | * \param pMac Pointer to the global MAC structure |
| 5950 | * |
| 5951 | * \param dialog_token dialog token to be used in the action frame. |
| 5952 | * |
| 5953 | * \param num_report number of reports in pRRMReport. |
| 5954 | * |
| 5955 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 5956 | * |
| 5957 | * \param peer mac address of peer station. |
| 5958 | * |
| 5959 | * \param psessionEntry address of session entry. |
| 5960 | * |
| 5961 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5962 | * |
| 5963 | * |
| 5964 | */ |
| 5965 | |
| 5966 | tSirRetStatus |
| 5967 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 5968 | tANI_U8 dialog_token, |
| 5969 | tANI_U8 num_report, |
| 5970 | tpSirMacRadioMeasureReport pRRMReport, |
| 5971 | tSirMacAddr peer, |
| 5972 | tpPESession psessionEntry |
| 5973 | ) |
| 5974 | { |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5975 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 5976 | tANI_U8 *pFrame; |
| 5977 | tpSirMacMgmtHdr pMacHdr; |
| 5978 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5979 | void *pPacket; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 5980 | eHalStatus halstatus; |
| 5981 | tANI_U8 i; |
| 5982 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5983 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5984 | tDot11fRadioMeasurementReport *frm = |
| 5985 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 5986 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5987 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5988 | return eSIR_FAILURE; |
| 5989 | } |
| 5990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5991 | if ( psessionEntry == NULL ) |
| 5992 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5993 | 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] | 5994 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5995 | return eSIR_FAILURE; |
| 5996 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5997 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5998 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5999 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 6000 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 6001 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6002 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6003 | 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] | 6004 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6005 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6006 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6007 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 6008 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 6009 | 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] | 6010 | switch( pRRMReport[i].type ) |
| 6011 | { |
| 6012 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6013 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 6014 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6015 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 6016 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6017 | break; |
| 6018 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 6019 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 6020 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6021 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6022 | break; |
| 6023 | } |
| 6024 | } |
| 6025 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6026 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6027 | if ( DOT11F_FAILED( nStatus ) ) |
| 6028 | { |
| 6029 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6030 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6031 | nStatus ); |
| 6032 | // We'll fall back on the worst case scenario: |
| 6033 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6034 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6035 | return eSIR_FAILURE; |
| 6036 | } |
| 6037 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6038 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6039 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6040 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6041 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6042 | } |
| 6043 | |
| 6044 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6045 | |
| 6046 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6047 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6048 | { |
| 6049 | 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] | 6050 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6051 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6052 | return eSIR_FAILURE; |
| 6053 | } |
| 6054 | |
| 6055 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6056 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6057 | |
| 6058 | // Copy necessary info to BD |
| 6059 | if( eSIR_SUCCESS != |
| 6060 | (statusCode = limPopulateMacHeader( pMac, |
| 6061 | pFrame, |
| 6062 | SIR_MAC_MGMT_FRAME, |
| 6063 | SIR_MAC_MGMT_ACTION, |
| 6064 | peer, psessionEntry->selfMacAddr))) |
| 6065 | goto returnAfterError; |
| 6066 | |
| 6067 | // Update A3 with the BSSID |
| 6068 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6069 | |
| 6070 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 6071 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6072 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 6073 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6074 | #endif |
| 6075 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6076 | // Now, we're ready to "pack" the frames |
| 6077 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6078 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6079 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6080 | nPayload, |
| 6081 | &nPayload ); |
| 6082 | |
| 6083 | if( DOT11F_FAILED( nStatus )) |
| 6084 | { |
| 6085 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6086 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6087 | nStatus ); |
| 6088 | |
| 6089 | // FIXME - Need to convert to tSirRetStatus |
| 6090 | statusCode = eSIR_FAILURE; |
| 6091 | goto returnAfterError; |
| 6092 | } |
| 6093 | else if( DOT11F_WARNED( nStatus )) |
| 6094 | { |
| 6095 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6096 | FL( "There were warnings while packing Radio " |
| 6097 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6098 | } |
| 6099 | |
| 6100 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6101 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6102 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6103 | |
| 6104 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6105 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6106 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6107 | ) |
| 6108 | { |
| 6109 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6110 | } |
| 6111 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 6112 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6113 | psessionEntry->peSessionId, |
| 6114 | pMacHdr->fc.subType)); |
| 6115 | halstatus = halTxFrame( pMac, |
| 6116 | pPacket, |
| 6117 | (tANI_U16) nBytes, |
| 6118 | HAL_TXRX_FRM_802_11_MGMT, |
| 6119 | ANI_TXDIR_TODS, |
| 6120 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6121 | limTxComplete, |
| 6122 | pFrame, txFlag ); |
| 6123 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6124 | psessionEntry->peSessionId, |
| 6125 | halstatus)); |
| 6126 | if( eHAL_STATUS_SUCCESS != halstatus ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6127 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 6128 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6129 | statusCode = eSIR_FAILURE; |
| 6130 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6131 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6132 | return statusCode; |
| 6133 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6134 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 6135 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6136 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 6137 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6138 | |
| 6139 | returnAfterError: |
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 | 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] | 6142 | return statusCode; |
| 6143 | } // End limSendBeaconReportActionFrame. |
| 6144 | |
| 6145 | #endif |
| 6146 | |
| 6147 | #ifdef WLAN_FEATURE_11W |
| 6148 | /** |
| 6149 | * \brief Send SA query response action frame to peer |
| 6150 | * |
| 6151 | * \sa limSendSaQueryResponseFrame |
| 6152 | * |
| 6153 | * |
| 6154 | * \param pMac The global tpAniSirGlobal object |
| 6155 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6156 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6157 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6158 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 6159 | * |
| 6160 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6161 | * |
| 6162 | * \return eSIR_SUCCESS if setup completes successfully |
| 6163 | * eSIR_FAILURE is some problem is encountered |
| 6164 | */ |
| 6165 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6166 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6167 | tSirMacAddr peer,tpPESession psessionEntry) |
| 6168 | { |
| 6169 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6170 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6171 | tANI_U8 *pFrame; |
| 6172 | tSirRetStatus nSirStatus; |
| 6173 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6174 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6175 | void *pPacket; |
| 6176 | eHalStatus halstatus; |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 6177 | tANI_U32 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6178 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6179 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6180 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 6181 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6182 | action: 0 --> SA query request action frame |
| 6183 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6184 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 6185 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6186 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6187 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6188 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6189 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 6190 | if ( DOT11F_FAILED( nStatus ) ) |
| 6191 | { |
| 6192 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 6193 | "or a SA Query Response (0x%08x)."), |
| 6194 | nStatus ); |
| 6195 | // We'll fall back on the worst case scenario: |
| 6196 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 6197 | } |
| 6198 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6199 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6200 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6201 | "the packed size for an SA Query Response" |
| 6202 | " (0x%08x)."), nStatus ); |
| 6203 | } |
| 6204 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6205 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6206 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6207 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6208 | { |
| 6209 | 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] | 6210 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6211 | return eSIR_FAILURE; |
| 6212 | } |
| 6213 | |
| 6214 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6215 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6216 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6217 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6218 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6219 | pFrame, |
| 6220 | SIR_MAC_MGMT_FRAME, |
| 6221 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6222 | peer, psessionEntry->selfMacAddr ); |
| 6223 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6224 | goto returnAfterError; |
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 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6227 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6228 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6229 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6230 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6231 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6232 | // in the FC |
| 6233 | if ( psessionEntry->limRmfEnabled ) |
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 | pMacHdr->fc.wep = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6236 | } |
| 6237 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6238 | // Pack 11w SA query response frame |
| 6239 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6240 | &frm, |
| 6241 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6242 | nPayload, |
| 6243 | &nPayload ); |
| 6244 | |
| 6245 | if ( DOT11F_FAILED( nStatus )) |
| 6246 | { |
| 6247 | limLog( pMac, LOGE, |
| 6248 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6249 | nStatus ); |
| 6250 | // FIXME - Need to convert to tSirRetStatus |
| 6251 | nSirStatus = eSIR_FAILURE; |
| 6252 | goto returnAfterError; |
| 6253 | } |
| 6254 | else if ( DOT11F_WARNED( nStatus )) |
| 6255 | { |
| 6256 | limLog( pMac, LOGW, |
| 6257 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6258 | nStatus); |
| 6259 | } |
| 6260 | |
| 6261 | limLog( pMac, LOG1, |
| 6262 | FL( "Sending a SA Query Response to " )); |
| 6263 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6264 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6265 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6266 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6267 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6268 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6269 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6270 | ) |
| 6271 | { |
| 6272 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6273 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6274 | |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 6275 | MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT, |
| 6276 | psessionEntry->peSessionId, |
| 6277 | pMacHdr->fc.subType)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6278 | halstatus = halTxFrame( pMac, |
| 6279 | pPacket, |
| 6280 | (tANI_U16) nBytes, |
| 6281 | HAL_TXRX_FRM_802_11_MGMT, |
| 6282 | ANI_TXDIR_TODS, |
| 6283 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6284 | limTxComplete, |
| 6285 | pFrame, txFlag ); |
Edhar Mahesh Kumar | f956b90 | 2013-12-05 09:35:46 +0530 | [diff] [blame^] | 6286 | MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, |
| 6287 | psessionEntry->peSessionId, |
| 6288 | halstatus)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6289 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6290 | { |
| 6291 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6292 | nSirStatus = eSIR_FAILURE; |
| 6293 | //Pkt will be freed up by the callback |
| 6294 | return nSirStatus; |
| 6295 | } |
| 6296 | else { |
| 6297 | return eSIR_SUCCESS; |
| 6298 | } |
| 6299 | |
| 6300 | returnAfterError: |
| 6301 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6302 | return nSirStatus; |
| 6303 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6304 | #endif |