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