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