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