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 | /* For CCX Associations fill the CCX IEs */ |
| 2181 | if (psessionEntry->isCCXconnection && |
| 2182 | psessionEntry->pLimJoinReq->isCCXFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2183 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2184 | #ifndef FEATURE_DISABLE_RM |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2185 | PopulateDot11fCCXRadMgmtCap(&pFrm->CCXRadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2186 | #endif |
Sandeep Puligilla | e9ffdf6 | 2013-11-23 18:23:00 +0530 | [diff] [blame] | 2187 | PopulateDot11fCCXVersion(&pFrm->CCXVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2188 | } |
| 2189 | #endif |
| 2190 | |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2191 | nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2192 | if ( DOT11F_FAILED( nStatus ) ) |
| 2193 | { |
| 2194 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2195 | "or an Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2196 | nStatus ); |
| 2197 | // We'll fall back on the worst case scenario: |
| 2198 | nPayload = sizeof( tDot11fAssocRequest ); |
| 2199 | } |
| 2200 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2201 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2202 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2203 | "the packed size for an Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2204 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2205 | } |
| 2206 | |
| 2207 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 2208 | |
| 2209 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2210 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 2211 | ( void** ) &pPacket ); |
| 2212 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2213 | { |
| 2214 | limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2215 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2216 | |
| 2217 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2218 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2219 | |
| 2220 | |
| 2221 | /* Update PE session id*/ |
| 2222 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 2223 | |
| 2224 | mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2225 | |
| 2226 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2227 | ( void* ) pFrame, ( void* ) pPacket ); |
| 2228 | |
| 2229 | limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF, |
| 2230 | ( tANI_U32* ) &mlmAssocCnf); |
| 2231 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2232 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2233 | return; |
| 2234 | } |
| 2235 | |
| 2236 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2237 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2238 | |
| 2239 | // Next, we fill out the buffer descriptor: |
| 2240 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2241 | SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr); |
| 2242 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2243 | { |
| 2244 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2245 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2246 | nSirStatus ); |
| 2247 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2248 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2249 | return; |
| 2250 | } |
| 2251 | |
| 2252 | |
| 2253 | // That done, pack the Probe Request: |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2254 | nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame + |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2255 | sizeof(tSirMacMgmtHdr), |
| 2256 | nPayload, &nPayload ); |
| 2257 | if ( DOT11F_FAILED( nStatus ) ) |
| 2258 | { |
| 2259 | 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] | 2260 | "8x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | nStatus ); |
| 2262 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2263 | ( void* ) pFrame, ( void* ) pPacket ); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2264 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2265 | return; |
| 2266 | } |
| 2267 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2268 | { |
| 2269 | limLog( pMac, LOGW, FL("There were warnings while packing a P" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2270 | "robe Response (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2271 | } |
| 2272 | |
| 2273 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2274 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2275 | nBytes );) |
| 2276 | // limPrintMacAddr( pMac, bssid, LOG1 ); |
| 2277 | |
| 2278 | if( psessionEntry->assocReq != NULL ) |
| 2279 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2280 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2281 | psessionEntry->assocReq = NULL; |
| 2282 | } |
| 2283 | |
| 2284 | if( nAddIELen ) |
| 2285 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2286 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2287 | pAddIE, |
| 2288 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2289 | nPayload += nAddIELen; |
| 2290 | } |
| 2291 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2292 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2293 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2294 | { |
| 2295 | PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));) |
| 2296 | } |
| 2297 | else |
| 2298 | { |
| 2299 | //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] | 2300 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2301 | psessionEntry->assocReqLen = nPayload; |
| 2302 | } |
| 2303 | |
| 2304 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2305 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2306 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2307 | ) |
| 2308 | { |
| 2309 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2310 | } |
| 2311 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 2312 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 2313 | { |
| 2314 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2315 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 2316 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2317 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 2318 | HAL_TXRX_FRM_802_11_MGMT, |
| 2319 | ANI_TXDIR_TODS, |
| 2320 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2321 | limTxComplete, pFrame, txFlag ); |
| 2322 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2323 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2324 | limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2325 | halstatus ); |
| 2326 | //Pkt will be freed up by the callback |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2327 | vos_mem_free(pFrm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2328 | return; |
| 2329 | } |
| 2330 | |
| 2331 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2332 | vos_mem_free(pMlmAssocReq); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame^] | 2333 | pMlmAssocReq = NULL; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2334 | vos_mem_free(pFrm); |
Madan Mohan Koyyalamudi | 1903276 | 2012-10-21 12:42:11 -0700 | [diff] [blame] | 2335 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2336 | } // End limSendAssocReqMgmtFrame |
| 2337 | |
| 2338 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2339 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2340 | /*------------------------------------------------------------------------------------ |
| 2341 | * |
| 2342 | * Send Reassoc Req with FTIEs. |
| 2343 | * |
| 2344 | *----------------------------------------------------------------------------------- |
| 2345 | */ |
| 2346 | void |
| 2347 | limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac, |
| 2348 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2349 | { |
| 2350 | static tDot11fReAssocRequest frm; |
| 2351 | tANI_U16 caps; |
| 2352 | tANI_U8 *pFrame; |
| 2353 | tSirRetStatus nSirStatus; |
| 2354 | tANI_U32 nBytes, nPayload, nStatus; |
| 2355 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2356 | void *pPacket; |
| 2357 | eHalStatus halstatus; |
| 2358 | #if defined WLAN_FEATURE_VOWIFI |
| 2359 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2360 | #endif |
| 2361 | tANI_U16 ft_ies_length = 0; |
| 2362 | tANI_U8 *pBody; |
| 2363 | tANI_U16 nAddIELen; |
| 2364 | tANI_U8 *pAddIE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2365 | #if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2366 | tANI_U8 *wpsIe = NULL; |
| 2367 | #endif |
| 2368 | tANI_U8 txFlag = 0; |
| 2369 | |
| 2370 | if (NULL == psessionEntry) |
| 2371 | { |
| 2372 | return; |
| 2373 | } |
| 2374 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2375 | /* check this early to avoid unncessary operation */ |
| 2376 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2377 | { |
| 2378 | return; |
| 2379 | } |
| 2380 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2381 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2382 | limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in " |
| 2383 | "state (%d)."), psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2384 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2385 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2386 | |
| 2387 | caps = pMlmReassocReq->capabilityInfo; |
| 2388 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2389 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2390 | #if defined(FEATURE_WLAN_WAPI) |
| 2391 | /* CR: 262463 : |
| 2392 | According to WAPI standard: |
| 2393 | 7.3.1.4 Capability Information field |
| 2394 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2395 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2396 | Reassociation management frames. */ |
| 2397 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2398 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2399 | #endif |
| 2400 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2401 | |
| 2402 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2403 | |
| 2404 | // Get the old bssid of the older AP. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2405 | vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2406 | pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6); |
| 2407 | |
| 2408 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2409 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2410 | &frm.SuppRates,psessionEntry); |
| 2411 | |
| 2412 | fQosEnabled = ( psessionEntry->limQosEnabled) && |
| 2413 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2414 | |
| 2415 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2416 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2417 | |
| 2418 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2419 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2420 | |
| 2421 | if ( psessionEntry->lim11hEnable && |
| 2422 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2423 | { |
| 2424 | #if defined WLAN_FEATURE_VOWIFI |
| 2425 | PowerCapsPopulated = TRUE; |
| 2426 | |
| 2427 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2428 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2429 | #endif |
| 2430 | } |
| 2431 | |
| 2432 | #if defined WLAN_FEATURE_VOWIFI |
| 2433 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2434 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2435 | { |
| 2436 | if (PowerCapsPopulated == FALSE) |
| 2437 | { |
| 2438 | PowerCapsPopulated = TRUE; |
| 2439 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2440 | } |
| 2441 | } |
| 2442 | #endif |
| 2443 | |
| 2444 | if ( fQosEnabled && |
| 2445 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2446 | { |
| 2447 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2448 | } |
| 2449 | |
| 2450 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2451 | &frm.ExtSuppRates, psessionEntry ); |
| 2452 | |
| 2453 | #if defined WLAN_FEATURE_VOWIFI |
| 2454 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2455 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2456 | { |
| 2457 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2458 | } |
| 2459 | #endif |
| 2460 | |
| 2461 | // Ideally this should be enabled for 11r also. But 11r does |
| 2462 | // not follow the usual norm of using the Opaque object |
| 2463 | // for rsnie and fties. Instead we just add |
| 2464 | // the rsnie and fties at the end of the pack routine for 11r. |
| 2465 | // This should ideally! be fixed. |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2466 | #if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | // |
| 2468 | // The join request *should* contain zero or one of the WPA and RSN |
| 2469 | // IEs. The payload send along with the request is a |
| 2470 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2471 | |
| 2472 | // typedef struct sSirRSNie |
| 2473 | // { |
| 2474 | // tANI_U16 length; |
| 2475 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2476 | // } tSirRSNie, *tpSirRSNie; |
| 2477 | |
| 2478 | // So, we should be able to make the following two calls harmlessly, |
| 2479 | // since they do nothing if they don't find the given IE in the |
| 2480 | // bytestream with which they're provided. |
| 2481 | |
| 2482 | // The net effect of this will be to faithfully transmit whatever |
| 2483 | // security IE is in the join request. |
| 2484 | |
| 2485 | // *However*, if we're associating for the purpose of WPS |
| 2486 | // enrollment, and we've been configured to indicate that by |
| 2487 | // eliding the WPA or RSN IE, we just skip this: |
| 2488 | if (!psessionEntry->is11Rconnection) |
| 2489 | { |
| 2490 | if( nAddIELen && pAddIE ) |
| 2491 | { |
| 2492 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2493 | } |
| 2494 | if ( NULL == wpsIe ) |
| 2495 | { |
| 2496 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2497 | &frm.RSNOpaque ); |
| 2498 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2499 | &frm.WPAOpaque ); |
| 2500 | } |
| 2501 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2502 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2503 | if (psessionEntry->pLimReAssocReq->cckmIE.length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2504 | { |
| 2505 | PopulateDot11fCCXCckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ), |
| 2506 | &frm.CCXCckmOpaque ); |
| 2507 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2508 | #endif //FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2509 | } |
| 2510 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2511 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | // For CCX Associations fill the CCX IEs |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2513 | if (psessionEntry->isCCXconnection && |
| 2514 | psessionEntry->pLimReAssocReq->isCCXFeatureIniEnabled) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2515 | { |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2516 | #ifndef FEATURE_DISABLE_RM |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2517 | PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap); |
Varun Reddy Yeturu | 30779b4 | 2013-04-09 09:57:16 -0700 | [diff] [blame] | 2518 | #endif |
Sandeep Puligilla | e9ffdf6 | 2013-11-23 18:23:00 +0530 | [diff] [blame] | 2519 | PopulateDot11fCCXVersion(&frm.CCXVersion); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2520 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2521 | #endif //FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2522 | #endif //FEATURE_WLAN_CCX || FEATURE_WLAN_LFR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2523 | |
| 2524 | // include WME EDCA IE as well |
| 2525 | if ( fWmeEnabled ) |
| 2526 | { |
| 2527 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2528 | { |
| 2529 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2530 | } |
| 2531 | |
| 2532 | if ( fWsmEnabled && |
| 2533 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2534 | { |
| 2535 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2536 | } |
| 2537 | #ifdef FEATURE_WLAN_CCX |
| 2538 | if (psessionEntry->isCCXconnection) |
| 2539 | { |
| 2540 | PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry); |
| 2541 | |
| 2542 | // Populate the TSRS IE if TSPEC is included in the reassoc request |
| 2543 | if (psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs) |
| 2544 | { |
| 2545 | tANI_U32 phyMode; |
| 2546 | tSirMacCCXTSRSIE tsrsIE; |
| 2547 | limGetPhyMode(pMac, &phyMode, psessionEntry); |
| 2548 | |
| 2549 | tsrsIE.tsid = 0; |
| 2550 | if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A) |
| 2551 | { |
| 2552 | tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 2553 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2554 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2555 | { |
| 2556 | tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 2557 | } |
| 2558 | PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.CCXTrafStrmRateSet, sizeof(tANI_U8)); |
| 2559 | } |
| 2560 | } |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 2561 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2562 | } |
| 2563 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2564 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2565 | pMac->lim.htCapabilityPresentInBeacon) |
| 2566 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2567 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2568 | } |
| 2569 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2570 | #if defined WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 0ac5506 | 2013-04-08 14:43:07 +0530 | [diff] [blame] | 2571 | if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && (0 == pMac->ft.ftSmeContext.reassoc_ft_ies_length) |
| 2572 | #if defined FEATURE_WLAN_CCX |
| 2573 | && !psessionEntry->isCCXconnection |
| 2574 | #endif |
| 2575 | ) |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2576 | { |
| 2577 | PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie); |
| 2578 | } |
| 2579 | #endif |
| 2580 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2581 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2582 | if ( DOT11F_FAILED( nStatus ) ) |
| 2583 | { |
| 2584 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2585 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2586 | nStatus ); |
| 2587 | // We'll fall back on the worst case scenario: |
| 2588 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 2589 | } |
| 2590 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2591 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2592 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2593 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2594 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2595 | } |
| 2596 | |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 2597 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2598 | |
| 2599 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 2600 | limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2601 | pMac->ft.ftSmeContext.reassoc_ft_ies_length); |
| 2602 | #endif |
| 2603 | |
| 2604 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 2605 | if (psessionEntry->is11Rconnection) |
| 2606 | { |
| 2607 | ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length; |
| 2608 | } |
| 2609 | #endif |
| 2610 | |
| 2611 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 2612 | ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame, |
| 2613 | ( void** ) &pPacket ); |
| 2614 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2615 | { |
| 2616 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2617 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2618 | 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] | 2619 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2620 | goto end; |
| 2621 | } |
| 2622 | |
| 2623 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2624 | vos_mem_set( pFrame, nBytes + ft_ies_length, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2625 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2626 | #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] | 2627 | limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2628 | #endif |
| 2629 | // Next, we fill out the buffer descriptor: |
| 2630 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2631 | SIR_MAC_MGMT_REASSOC_REQ, |
| 2632 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 2633 | if ( eSIR_SUCCESS != nSirStatus ) |
| 2634 | { |
| 2635 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2636 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2637 | nSirStatus ); |
| 2638 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2639 | goto end; |
| 2640 | } |
| 2641 | |
| 2642 | |
| 2643 | // That done, pack the ReAssoc Request: |
| 2644 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 2645 | sizeof(tSirMacMgmtHdr), |
| 2646 | nPayload, &nPayload ); |
| 2647 | if ( DOT11F_FAILED( nStatus ) ) |
| 2648 | { |
| 2649 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2650 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2651 | nStatus ); |
| 2652 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 2653 | goto end; |
| 2654 | } |
| 2655 | else if ( DOT11F_WARNED( nStatus ) ) |
| 2656 | { |
| 2657 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 2658 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2659 | } |
| 2660 | |
| 2661 | PELOG3(limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2662 | FL("*** Sending Re-Association Request length %d %d to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2663 | nBytes, nPayload );) |
| 2664 | if( psessionEntry->assocReq != NULL ) |
| 2665 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2666 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2667 | psessionEntry->assocReq = NULL; |
| 2668 | } |
| 2669 | |
| 2670 | if( nAddIELen ) |
| 2671 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2672 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 2673 | pAddIE, |
| 2674 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2675 | nPayload += nAddIELen; |
| 2676 | } |
| 2677 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2678 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 2679 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2680 | { |
| 2681 | 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] | 2682 | } |
| 2683 | else |
| 2684 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2685 | //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] | 2686 | vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2687 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2688 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2689 | |
| 2690 | if (psessionEntry->is11Rconnection) |
| 2691 | { |
| 2692 | { |
| 2693 | int i = 0; |
| 2694 | |
| 2695 | pBody = pFrame + nBytes; |
| 2696 | for (i=0; i<ft_ies_length; i++) |
| 2697 | { |
| 2698 | *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i]; |
| 2699 | pBody++; |
| 2700 | } |
| 2701 | } |
| 2702 | } |
| 2703 | |
| 2704 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 2705 | PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: ")); |
| 2706 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2707 | (tANI_U8 *)pFrame, |
| 2708 | (nBytes + ft_ies_length));) |
| 2709 | #endif |
| 2710 | |
| 2711 | |
| 2712 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2713 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 2714 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2715 | ) |
| 2716 | { |
| 2717 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2718 | } |
| 2719 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2720 | if( NULL != psessionEntry->assocReq ) |
| 2721 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2722 | vos_mem_free(psessionEntry->assocReq); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2723 | psessionEntry->assocReq = NULL; |
| 2724 | } |
| 2725 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2726 | psessionEntry->assocReq = vos_mem_malloc(ft_ies_length); |
| 2727 | if ( NULL == psessionEntry->assocReq ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2728 | { |
| 2729 | 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] | 2730 | psessionEntry->assocReqLen = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2731 | } |
| 2732 | else |
| 2733 | { |
| 2734 | //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] | 2735 | vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies, |
| 2736 | (ft_ies_length)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 2737 | psessionEntry->assocReqLen = (ft_ies_length); |
| 2738 | } |
| 2739 | |
| 2740 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2741 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length), |
| 2742 | HAL_TXRX_FRM_802_11_MGMT, |
| 2743 | ANI_TXDIR_TODS, |
| 2744 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 2745 | limTxComplete, pFrame, txFlag ); |
| 2746 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 2747 | { |
| 2748 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2749 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2750 | nSirStatus ); |
| 2751 | //Pkt will be freed up by the callback |
| 2752 | goto end; |
| 2753 | } |
| 2754 | |
| 2755 | end: |
| 2756 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2757 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2758 | psessionEntry->pLimMlmReassocReq = NULL; |
| 2759 | |
| 2760 | } |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2761 | |
| 2762 | void limSendRetryReassocReqFrame(tpAniSirGlobal pMac, |
| 2763 | tLimMlmReassocReq *pMlmReassocReq, |
| 2764 | tpPESession psessionEntry) |
| 2765 | { |
| 2766 | tLimMlmReassocCnf mlmReassocCnf; // keep sme |
| 2767 | tLimMlmReassocReq *pTmpMlmReassocReq = NULL; |
| 2768 | if(NULL == pTmpMlmReassocReq) |
| 2769 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2770 | pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq)); |
| 2771 | if ( NULL == pTmpMlmReassocReq ) goto end; |
| 2772 | vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0); |
| 2773 | vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq)); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2774 | } |
| 2775 | |
| 2776 | // Prepare and send Reassociation request frame |
| 2777 | // start reassoc timer. |
| 2778 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId; |
| 2779 | // Start reassociation failure timer |
Leela V Kiran Kumar Reddy Chirala | c3b9d38 | 2013-01-31 20:49:53 -0800 | [diff] [blame] | 2780 | 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] | 2781 | if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer) |
| 2782 | != TX_SUCCESS) |
| 2783 | { |
| 2784 | // Could not start reassoc failure timer. |
| 2785 | // Log error |
| 2786 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2787 | FL("could not start Reassociation failure timer")); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2788 | // Return Reassoc confirm with |
| 2789 | // Resources Unavailable |
| 2790 | mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2791 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2792 | goto end; |
| 2793 | } |
| 2794 | |
| 2795 | limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry); |
| 2796 | return; |
| 2797 | |
| 2798 | end: |
| 2799 | // Free up buffer allocated for reassocReq |
| 2800 | if (pMlmReassocReq != NULL) |
| 2801 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2802 | vos_mem_free(pMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2803 | pMlmReassocReq = NULL; |
| 2804 | } |
| 2805 | if (pTmpMlmReassocReq != NULL) |
| 2806 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2807 | vos_mem_free(pTmpMlmReassocReq); |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2808 | pTmpMlmReassocReq = NULL; |
| 2809 | } |
| 2810 | mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; |
| 2811 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2812 | /* Update PE sessio Id*/ |
| 2813 | mlmReassocCnf.sessionId = psessionEntry->peSessionId; |
| 2814 | |
| 2815 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 2816 | } |
| 2817 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2818 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2819 | |
| 2820 | |
| 2821 | void |
| 2822 | limSendReassocReqMgmtFrame(tpAniSirGlobal pMac, |
| 2823 | tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry) |
| 2824 | { |
| 2825 | static tDot11fReAssocRequest frm; |
| 2826 | tANI_U16 caps; |
| 2827 | tANI_U8 *pFrame; |
| 2828 | tSirRetStatus nSirStatus; |
| 2829 | tANI_U32 nBytes, nPayload, nStatus; |
| 2830 | tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled; |
| 2831 | void *pPacket; |
| 2832 | eHalStatus halstatus; |
| 2833 | tANI_U16 nAddIELen; |
| 2834 | tANI_U8 *pAddIE; |
| 2835 | tANI_U8 *wpsIe = NULL; |
| 2836 | tANI_U8 txFlag = 0; |
| 2837 | #if defined WLAN_FEATURE_VOWIFI |
| 2838 | tANI_U8 PowerCapsPopulated = FALSE; |
| 2839 | #endif |
| 2840 | |
| 2841 | if(NULL == psessionEntry) |
| 2842 | { |
| 2843 | return; |
| 2844 | } |
| 2845 | |
| 2846 | /* check this early to avoid unncessary operation */ |
| 2847 | if(NULL == psessionEntry->pLimReAssocReq) |
| 2848 | { |
| 2849 | return; |
| 2850 | } |
| 2851 | nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length; |
| 2852 | pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata; |
| 2853 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2854 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2855 | |
| 2856 | caps = pMlmReassocReq->capabilityInfo; |
| 2857 | if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap)) |
| 2858 | ((tSirMacCapabilityInfo *) &caps)->qos = 0; |
| 2859 | #if defined(FEATURE_WLAN_WAPI) |
| 2860 | /* CR: 262463 : |
| 2861 | According to WAPI standard: |
| 2862 | 7.3.1.4 Capability Information field |
| 2863 | In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted |
| 2864 | Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and |
| 2865 | Reassociation management frames. */ |
| 2866 | if ( psessionEntry->encryptType == eSIR_ED_WPI) |
| 2867 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 2868 | #endif |
| 2869 | swapBitField16(caps, ( tANI_U16* )&frm.Capabilities ); |
| 2870 | |
| 2871 | frm.ListenInterval.interval = pMlmReassocReq->listenInterval; |
| 2872 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 2873 | vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac, |
| 2874 | ( tANI_U8* )psessionEntry->bssId, 6 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2875 | |
| 2876 | PopulateDot11fSSID2( pMac, &frm.SSID ); |
| 2877 | PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2878 | &frm.SuppRates,psessionEntry); |
| 2879 | |
| 2880 | fQosEnabled = ( psessionEntry->limQosEnabled ) && |
| 2881 | SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps ); |
| 2882 | |
| 2883 | fWmeEnabled = ( psessionEntry->limWmeEnabled ) && |
| 2884 | LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps ); |
| 2885 | |
| 2886 | fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled && |
| 2887 | LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps ); |
| 2888 | |
| 2889 | |
| 2890 | if ( psessionEntry->lim11hEnable && |
| 2891 | psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE ) |
| 2892 | { |
| 2893 | #if defined WLAN_FEATURE_VOWIFI |
| 2894 | PowerCapsPopulated = TRUE; |
| 2895 | PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry); |
| 2896 | PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry); |
| 2897 | #endif |
| 2898 | } |
| 2899 | |
| 2900 | #if defined WLAN_FEATURE_VOWIFI |
| 2901 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2902 | SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) ) |
| 2903 | { |
| 2904 | if (PowerCapsPopulated == FALSE) |
| 2905 | { |
| 2906 | PowerCapsPopulated = TRUE; |
| 2907 | PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry); |
| 2908 | } |
| 2909 | } |
| 2910 | #endif |
| 2911 | |
| 2912 | if ( fQosEnabled && |
| 2913 | ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) )) |
| 2914 | { |
| 2915 | PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation ); |
| 2916 | } |
| 2917 | |
| 2918 | PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 2919 | &frm.ExtSuppRates, psessionEntry ); |
| 2920 | |
| 2921 | #if defined WLAN_FEATURE_VOWIFI |
| 2922 | if( pMac->rrm.rrmPEContext.rrmEnable && |
| 2923 | SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) ) |
| 2924 | { |
| 2925 | PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry ); |
| 2926 | } |
| 2927 | #endif |
| 2928 | // The join request *should* contain zero or one of the WPA and RSN |
| 2929 | // IEs. The payload send along with the request is a |
| 2930 | // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 2931 | |
| 2932 | // typedef struct sSirRSNie |
| 2933 | // { |
| 2934 | // tANI_U16 length; |
| 2935 | // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 2936 | // } tSirRSNie, *tpSirRSNie; |
| 2937 | |
| 2938 | // So, we should be able to make the following two calls harmlessly, |
| 2939 | // since they do nothing if they don't find the given IE in the |
| 2940 | // bytestream with which they're provided. |
| 2941 | |
| 2942 | // The net effect of this will be to faithfully transmit whatever |
| 2943 | // security IE is in the join request. |
| 2944 | |
| 2945 | // *However*, if we're associating for the purpose of WPS |
| 2946 | // enrollment, and we've been configured to indicate that by |
| 2947 | // eliding the WPA or RSN IE, we just skip this: |
| 2948 | if( nAddIELen && pAddIE ) |
| 2949 | { |
| 2950 | wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen); |
| 2951 | } |
| 2952 | if ( NULL == wpsIe ) |
| 2953 | { |
| 2954 | PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2955 | &frm.RSNOpaque ); |
| 2956 | PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2957 | &frm.WPAOpaque ); |
| 2958 | #if defined(FEATURE_WLAN_WAPI) |
| 2959 | PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ), |
| 2960 | &frm.WAPIOpaque ); |
| 2961 | #endif // defined(FEATURE_WLAN_WAPI) |
| 2962 | } |
| 2963 | |
| 2964 | // include WME EDCA IE as well |
| 2965 | if ( fWmeEnabled ) |
| 2966 | { |
| 2967 | if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) ) |
| 2968 | { |
| 2969 | PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation ); |
| 2970 | } |
| 2971 | |
| 2972 | if ( fWsmEnabled && |
| 2973 | ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap ))) |
| 2974 | { |
| 2975 | PopulateDot11fWMMCaps( &frm.WMMCaps ); |
| 2976 | } |
| 2977 | } |
| 2978 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2979 | if ( psessionEntry->htCapability && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2980 | pMac->lim.htCapabilityPresentInBeacon) |
| 2981 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2982 | PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2983 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2984 | #ifdef WLAN_FEATURE_11AC |
| 2985 | if ( psessionEntry->vhtCapability && |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 2986 | psessionEntry->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2987 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2988 | limLog( pMac, LOGW, FL("Populate VHT IEs in Re-Assoc Request")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2989 | PopulateDot11fVHTCaps( pMac, &frm.VHTCaps ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 2990 | PopulateDot11fExtCap( pMac, &frm.ExtCap); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2991 | } |
| 2992 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2993 | |
| 2994 | nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload ); |
| 2995 | if ( DOT11F_FAILED( nStatus ) ) |
| 2996 | { |
| 2997 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 2998 | "or a Re-Association Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2999 | nStatus ); |
| 3000 | // We'll fall back on the worst case scenario: |
| 3001 | nPayload = sizeof( tDot11fReAssocRequest ); |
| 3002 | } |
| 3003 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3004 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3005 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3006 | "the packed size for a Re-Association Re " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3007 | "quest(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3008 | } |
| 3009 | |
| 3010 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen; |
| 3011 | |
| 3012 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3013 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3014 | ( void** ) &pPacket ); |
| 3015 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3016 | { |
| 3017 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3018 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3019 | 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] | 3020 | "sociation Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3021 | goto end; |
| 3022 | } |
| 3023 | |
| 3024 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3025 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3026 | |
| 3027 | // Next, we fill out the buffer descriptor: |
| 3028 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3029 | SIR_MAC_MGMT_REASSOC_REQ, |
| 3030 | psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr); |
| 3031 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3032 | { |
| 3033 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3034 | "tor for an Association Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3035 | nSirStatus ); |
| 3036 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3037 | goto end; |
| 3038 | } |
| 3039 | |
| 3040 | |
| 3041 | // That done, pack the Probe Request: |
| 3042 | nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame + |
| 3043 | sizeof(tSirMacMgmtHdr), |
| 3044 | nPayload, &nPayload ); |
| 3045 | if ( DOT11F_FAILED( nStatus ) ) |
| 3046 | { |
| 3047 | limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3048 | "st (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3049 | nStatus ); |
| 3050 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3051 | goto end; |
| 3052 | } |
| 3053 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3054 | { |
| 3055 | limLog( pMac, LOGW, FL("There were warnings while packing a R" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3056 | "e-Association Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3057 | } |
| 3058 | |
| 3059 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3060 | "to "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3061 | nBytes );) |
| 3062 | |
| 3063 | if( psessionEntry->assocReq != NULL ) |
| 3064 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3065 | vos_mem_free(psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3066 | psessionEntry->assocReq = NULL; |
| 3067 | } |
| 3068 | |
| 3069 | if( nAddIELen ) |
| 3070 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3071 | vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload, |
| 3072 | pAddIE, |
| 3073 | nAddIELen ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3074 | nPayload += nAddIELen; |
| 3075 | } |
| 3076 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3077 | psessionEntry->assocReq = vos_mem_malloc(nPayload); |
| 3078 | if ( NULL == psessionEntry->assocReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3079 | { |
| 3080 | 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] | 3081 | } |
| 3082 | else |
| 3083 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3084 | //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] | 3085 | vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3086 | psessionEntry->assocReqLen = nPayload; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3087 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3088 | |
| 3089 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3090 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3091 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3092 | ) |
| 3093 | { |
| 3094 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3095 | } |
| 3096 | |
Gopichand Nakkala | d3918dd | 2012-12-31 16:27:55 -0800 | [diff] [blame] | 3097 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3098 | { |
| 3099 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3100 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3102 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload), |
| 3103 | HAL_TXRX_FRM_802_11_MGMT, |
| 3104 | ANI_TXDIR_TODS, |
| 3105 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3106 | limTxComplete, pFrame, txFlag ); |
| 3107 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3108 | { |
| 3109 | limLog( pMac, LOGE, FL("Failed to send Re-Association Request" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3110 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3111 | nSirStatus ); |
| 3112 | //Pkt will be freed up by the callback |
| 3113 | goto end; |
| 3114 | } |
| 3115 | |
| 3116 | end: |
| 3117 | // Free up buffer allocated for mlmAssocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3118 | vos_mem_free( pMlmReassocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3119 | psessionEntry->pLimMlmReassocReq = NULL; |
| 3120 | |
| 3121 | } // limSendReassocReqMgmtFrame |
| 3122 | |
| 3123 | /** |
| 3124 | * \brief Send an Authentication frame |
| 3125 | * |
| 3126 | * |
| 3127 | * \param pMac Pointer to Global MAC structure |
| 3128 | * |
| 3129 | * \param pAuthFrameBody Pointer to Authentication frame structure that need |
| 3130 | * to be sent |
| 3131 | * |
| 3132 | * \param peerMacAddr MAC address of the peer entity to which Authentication |
| 3133 | * frame is destined |
| 3134 | * |
| 3135 | * \param wepBit Indicates whether wep bit to be set in FC while sending |
| 3136 | * Authentication frame3 |
| 3137 | * |
| 3138 | * |
| 3139 | * This function is called by limProcessMlmMessages(). Authentication frame |
| 3140 | * is formatted and sent when this function is called. |
| 3141 | * |
| 3142 | * |
| 3143 | */ |
| 3144 | |
| 3145 | void |
| 3146 | limSendAuthMgmtFrame(tpAniSirGlobal pMac, |
| 3147 | tpSirMacAuthFrameBody pAuthFrameBody, |
| 3148 | tSirMacAddr peerMacAddr, |
| 3149 | tANI_U8 wepBit, |
| 3150 | tpPESession psessionEntry |
| 3151 | ) |
| 3152 | { |
| 3153 | tANI_U8 *pFrame, *pBody; |
| 3154 | tANI_U32 frameLen = 0, bodyLen = 0; |
| 3155 | tpSirMacMgmtHdr pMacHdr; |
| 3156 | tANI_U16 i; |
| 3157 | void *pPacket; |
| 3158 | eHalStatus halstatus; |
| 3159 | tANI_U8 txFlag = 0; |
| 3160 | |
| 3161 | if(NULL == psessionEntry) |
| 3162 | { |
| 3163 | return; |
| 3164 | } |
| 3165 | |
| 3166 | if (wepBit == LIM_WEP_IN_FC) |
| 3167 | { |
| 3168 | /// Auth frame3 to be sent with encrypted framebody |
| 3169 | /** |
| 3170 | * Allocate buffer for Authenticaton frame of size equal |
| 3171 | * to management frame header length plus 2 bytes each for |
| 3172 | * auth algorithm number, transaction number, status code, |
| 3173 | * 128 bytes for challenge text and 4 bytes each for |
| 3174 | * IV & ICV. |
| 3175 | */ |
| 3176 | |
| 3177 | frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN; |
| 3178 | |
| 3179 | bodyLen = LIM_ENCR_AUTH_BODY_LEN; |
| 3180 | } // if (wepBit == LIM_WEP_IN_FC) |
| 3181 | else |
| 3182 | { |
| 3183 | switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3184 | { |
| 3185 | case SIR_MAC_AUTH_FRAME_1: |
| 3186 | /** |
| 3187 | * Allocate buffer for Authenticaton frame of size |
| 3188 | * equal to management frame header length plus 2 bytes |
| 3189 | * each for auth algorithm number, transaction number |
| 3190 | * and status code. |
| 3191 | */ |
| 3192 | |
| 3193 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3194 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3195 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3196 | |
| 3197 | #if defined WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3198 | if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) |
| 3199 | { |
| 3200 | if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3201 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3202 | frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3203 | limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"), |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3204 | pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3205 | } |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3206 | else |
| 3207 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3208 | limLog(pMac, LOG3, FL("Auth frame, Does not contain FTIES!!!")); |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3209 | frameLen += (2+SIR_MDIE_SIZE); |
| 3210 | } |
| 3211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3212 | #endif |
| 3213 | break; |
| 3214 | |
| 3215 | case SIR_MAC_AUTH_FRAME_2: |
| 3216 | if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 3217 | ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) && |
| 3218 | (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS))) |
| 3219 | { |
| 3220 | /** |
| 3221 | * Allocate buffer for Authenticaton frame of size |
| 3222 | * equal to management frame header length plus |
| 3223 | * 2 bytes each for auth algorithm number, |
| 3224 | * transaction number and status code. |
| 3225 | */ |
| 3226 | |
| 3227 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3228 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3229 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3230 | } |
| 3231 | else |
| 3232 | { |
| 3233 | // Shared Key algorithm with challenge text |
| 3234 | // to be sent |
| 3235 | /** |
| 3236 | * Allocate buffer for Authenticaton frame of size |
| 3237 | * equal to management frame header length plus |
| 3238 | * 2 bytes each for auth algorithm number, |
| 3239 | * transaction number, status code and 128 bytes |
| 3240 | * for challenge text. |
| 3241 | */ |
| 3242 | |
| 3243 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3244 | sizeof(tSirMacAuthFrame); |
| 3245 | bodyLen = sizeof(tSirMacAuthFrameBody); |
| 3246 | } |
| 3247 | |
| 3248 | break; |
| 3249 | |
| 3250 | case SIR_MAC_AUTH_FRAME_3: |
| 3251 | /// Auth frame3 to be sent without encrypted framebody |
| 3252 | /** |
| 3253 | * Allocate buffer for Authenticaton frame of size equal |
| 3254 | * to management frame header length plus 2 bytes each |
| 3255 | * for auth algorithm number, transaction number and |
| 3256 | * status code. |
| 3257 | */ |
| 3258 | |
| 3259 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3260 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3261 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3262 | |
| 3263 | break; |
| 3264 | |
| 3265 | case SIR_MAC_AUTH_FRAME_4: |
| 3266 | /** |
| 3267 | * Allocate buffer for Authenticaton frame of size equal |
| 3268 | * to management frame header length plus 2 bytes each |
| 3269 | * for auth algorithm number, transaction number and |
| 3270 | * status code. |
| 3271 | */ |
| 3272 | |
| 3273 | frameLen = sizeof(tSirMacMgmtHdr) + |
| 3274 | SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3275 | bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET; |
| 3276 | |
| 3277 | break; |
| 3278 | } // switch (pAuthFrameBody->authTransactionSeqNumber) |
| 3279 | } // end if (wepBit == LIM_WEP_IN_FC) |
| 3280 | |
| 3281 | |
| 3282 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 3283 | |
| 3284 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3285 | { |
| 3286 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3287 | limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3288 | |
| 3289 | return; |
| 3290 | } |
| 3291 | |
| 3292 | for (i = 0; i < frameLen; i++) |
| 3293 | pFrame[i] = 0; |
| 3294 | |
| 3295 | // Prepare BD |
| 3296 | if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3297 | SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS) |
| 3298 | { |
| 3299 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 3300 | return; |
| 3301 | } |
| 3302 | |
| 3303 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3304 | pMacHdr->fc.wep = wepBit; |
| 3305 | |
| 3306 | // Prepare BSSId |
| 3307 | if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ) |
| 3308 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3309 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 3310 | (tANI_U8 *) psessionEntry->bssId, |
| 3311 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3312 | } |
| 3313 | |
| 3314 | /// Prepare Authentication frame body |
| 3315 | pBody = pFrame + sizeof(tSirMacMgmtHdr); |
| 3316 | |
| 3317 | if (wepBit == LIM_WEP_IN_FC) |
| 3318 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3319 | vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3320 | |
| 3321 | PELOG1(limLog(pMac, LOG1, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3322 | FL("*** Sending Auth seq# 3 status %d (%d) to"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3323 | pAuthFrameBody->authStatusCode, |
| 3324 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS)); |
| 3325 | |
| 3326 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 3327 | } |
| 3328 | else |
| 3329 | { |
| 3330 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber); |
| 3331 | pBody += sizeof(tANI_U16); |
| 3332 | bodyLen -= sizeof(tANI_U16); |
| 3333 | |
| 3334 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber); |
| 3335 | pBody += sizeof(tANI_U16); |
| 3336 | bodyLen -= sizeof(tANI_U16); |
| 3337 | |
| 3338 | *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode); |
| 3339 | pBody += sizeof(tANI_U16); |
| 3340 | bodyLen -= sizeof(tANI_U16); |
Leela Venkata Kiran Kumar Reddy Chirala | 7d3fa55 | 2013-08-28 10:52:21 -0700 | [diff] [blame] | 3341 | if ( bodyLen <= (sizeof (pAuthFrameBody->type) + |
| 3342 | sizeof (pAuthFrameBody->length) + |
| 3343 | sizeof (pAuthFrameBody->challengeText))) |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3344 | vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3345 | |
| 3346 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 3347 | if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) && |
| 3348 | (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1)) |
| 3349 | { |
| 3350 | |
| 3351 | { |
| 3352 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3353 | if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length) |
| 3354 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3355 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3356 | PELOGE(limLog(pMac, LOGE, FL("Auth1 Frame FTIE is: ")); |
| 3357 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE, |
| 3358 | (tANI_U8 *)pBody, |
| 3359 | (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3360 | #endif |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3361 | for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++) |
| 3362 | { |
Madan Mohan Koyyalamudi | 6a00a80 | 2012-11-28 16:12:11 -0800 | [diff] [blame] | 3363 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i]; |
| 3364 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3365 | } |
| 3366 | } |
| 3367 | else |
| 3368 | { |
| 3369 | /* MDID attr is 54*/ |
| 3370 | *pBody = 54; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3371 | pBody++; |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3372 | *pBody = SIR_MDIE_SIZE; |
| 3373 | pBody++; |
| 3374 | for(i=0;i<SIR_MDIE_SIZE;i++) |
| 3375 | { |
| 3376 | *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i]; |
| 3377 | pBody++; |
| 3378 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3379 | } |
| 3380 | } |
| 3381 | } |
| 3382 | #endif |
| 3383 | |
| 3384 | PELOG1(limLog(pMac, LOG1, |
| 3385 | FL("*** Sending Auth seq# %d status %d (%d) to "), |
| 3386 | pAuthFrameBody->authTransactionSeqNumber, |
| 3387 | pAuthFrameBody->authStatusCode, |
| 3388 | (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS)); |
| 3389 | |
| 3390 | limPrintMacAddr(pMac, pMacHdr->da, LOG1);) |
| 3391 | } |
| 3392 | PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);) |
| 3393 | |
| 3394 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3395 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3396 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3397 | #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] | 3398 | || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3399 | && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
| 3400 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3401 | ) |
| 3402 | { |
| 3403 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3404 | } |
| 3405 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3406 | if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) |
| 3407 | { |
| 3408 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3409 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3410 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3411 | /// Queue Authentication frame in high priority WQ |
| 3412 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen, |
| 3413 | HAL_TXRX_FRM_802_11_MGMT, |
| 3414 | ANI_TXDIR_TODS, |
| 3415 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3416 | limTxComplete, pFrame, txFlag ); |
| 3417 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3418 | { |
| 3419 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3420 | FL("*** Could not send Auth frame, retCode=%X ***"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3421 | halstatus); |
| 3422 | |
| 3423 | //Pkt will be freed up by the callback |
| 3424 | } |
| 3425 | |
| 3426 | return; |
| 3427 | } /*** end limSendAuthMgmtFrame() ***/ |
| 3428 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3429 | eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac) |
| 3430 | { |
| 3431 | tANI_U16 aid; |
| 3432 | tpDphHashNode pStaDs; |
| 3433 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3434 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3435 | tpPESession psessionEntry; |
| 3436 | |
| 3437 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3438 | if (pMlmDeauthReq) |
| 3439 | { |
| 3440 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3441 | { |
| 3442 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3443 | } |
| 3444 | |
| 3445 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL) |
| 3446 | { |
| 3447 | |
| 3448 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3449 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3450 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3451 | goto end; |
| 3452 | } |
| 3453 | |
| 3454 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3455 | if (pStaDs == NULL) |
| 3456 | { |
| 3457 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3458 | goto end; |
| 3459 | } |
| 3460 | |
| 3461 | |
| 3462 | /// Receive path cleanup with dummy packet |
| 3463 | limCleanupRxPath(pMac, pStaDs,psessionEntry); |
| 3464 | /// Free up buffer allocated for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3465 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3466 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3467 | } |
| 3468 | return eHAL_STATUS_SUCCESS; |
| 3469 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3470 | vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3471 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3472 | sizeof(tSirMacAddr)); |
| 3473 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3474 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3475 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3476 | |
| 3477 | // Free up buffer allocated |
| 3478 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3479 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3480 | |
| 3481 | limPostSmeMessage(pMac, |
| 3482 | LIM_MLM_DEAUTH_CNF, |
| 3483 | (tANI_U32 *) &mlmDeauthCnf); |
| 3484 | return eHAL_STATUS_SUCCESS; |
| 3485 | } |
| 3486 | |
| 3487 | eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac) |
| 3488 | { |
| 3489 | tANI_U16 aid; |
| 3490 | tpDphHashNode pStaDs; |
| 3491 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3492 | tpPESession psessionEntry; |
| 3493 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3494 | |
| 3495 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3496 | if (pMlmDisassocReq) |
| 3497 | { |
| 3498 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3499 | { |
| 3500 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3501 | } |
| 3502 | |
| 3503 | if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL) |
| 3504 | { |
| 3505 | |
| 3506 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3507 | FL("session does not exist for given sessionId"));) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3508 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3509 | goto end; |
| 3510 | } |
| 3511 | |
| 3512 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3513 | if (pStaDs == NULL) |
| 3514 | { |
| 3515 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3516 | goto end; |
| 3517 | } |
| 3518 | |
| 3519 | /// Receive path cleanup with dummy packet |
| 3520 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry)) |
| 3521 | { |
| 3522 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3523 | goto end; |
| 3524 | } |
| 3525 | |
| 3526 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3527 | if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3528 | ( |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3529 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3530 | (psessionEntry->isCCXconnection ) || |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3531 | #endif |
| 3532 | #ifdef FEATURE_WLAN_LFR |
| 3533 | (psessionEntry->isFastRoamIniFeatureEnabled ) || |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3534 | #endif |
| 3535 | (psessionEntry->is11Rconnection )) && |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3536 | (pMlmDisassocReq->reasonCode != |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3537 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3538 | { |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 3539 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3540 | FL("FT Preauth Session (%p,%d) Cleanup"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3541 | psessionEntry, psessionEntry->peSessionId);); |
| 3542 | limFTCleanup(pMac); |
| 3543 | } |
| 3544 | else |
| 3545 | { |
| 3546 | PELOGE(limLog(pMac, LOGE, |
| 3547 | FL("No FT Preauth Session Cleanup in role %d" |
| 3548 | #ifdef FEATURE_WLAN_CCX |
| 3549 | " isCCX %d" |
| 3550 | #endif |
| 3551 | #ifdef FEATURE_WLAN_LFR |
| 3552 | " isLFR %d" |
| 3553 | #endif |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3554 | " is11r %d reason %d"), |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3555 | psessionEntry->limSystemRole, |
| 3556 | #ifdef FEATURE_WLAN_CCX |
| 3557 | psessionEntry->isCCXconnection, |
| 3558 | #endif |
| 3559 | #ifdef FEATURE_WLAN_LFR |
| 3560 | psessionEntry->isFastRoamIniFeatureEnabled, |
| 3561 | #endif |
| 3562 | psessionEntry->is11Rconnection, |
| 3563 | pMlmDisassocReq->reasonCode);); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3564 | } |
| 3565 | #endif |
| 3566 | |
| 3567 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3568 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3569 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3570 | return eHAL_STATUS_SUCCESS; |
| 3571 | } |
| 3572 | else |
| 3573 | { |
| 3574 | return eHAL_STATUS_SUCCESS; |
| 3575 | } |
| 3576 | end: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3577 | vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3578 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3579 | sizeof(tSirMacAddr)); |
| 3580 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3581 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3582 | |
| 3583 | /* Update PE session ID*/ |
| 3584 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3585 | |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3586 | if(pMlmDisassocReq != NULL) |
| 3587 | { |
| 3588 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3589 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | b7f5a67 | 2012-11-29 11:17:46 -0800 | [diff] [blame] | 3590 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3591 | } |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3592 | |
| 3593 | limPostSmeMessage(pMac, |
| 3594 | LIM_MLM_DISASSOC_CNF, |
| 3595 | (tANI_U32 *) &mlmDisassocCnf); |
| 3596 | return eHAL_STATUS_SUCCESS; |
| 3597 | } |
| 3598 | |
| 3599 | eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3600 | { |
| 3601 | return limSendDisassocCnf(pMac); |
| 3602 | } |
| 3603 | |
| 3604 | eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 3605 | { |
| 3606 | return limSendDeauthCnf(pMac); |
| 3607 | } |
| 3608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3609 | /** |
| 3610 | * \brief This function is called to send Disassociate frame. |
| 3611 | * |
| 3612 | * |
| 3613 | * \param pMac Pointer to Global MAC structure |
| 3614 | * |
| 3615 | * \param nReason Indicates the reason that need to be sent in |
| 3616 | * Disassociation frame |
| 3617 | * |
| 3618 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 3619 | * sent |
| 3620 | * |
| 3621 | * |
| 3622 | */ |
| 3623 | |
| 3624 | void |
| 3625 | limSendDisassocMgmtFrame(tpAniSirGlobal pMac, |
| 3626 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3627 | tSirMacAddr peer, |
| 3628 | tpPESession psessionEntry, |
| 3629 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3630 | { |
| 3631 | tDot11fDisassociation frm; |
| 3632 | tANI_U8 *pFrame; |
| 3633 | tSirRetStatus nSirStatus; |
| 3634 | tpSirMacMgmtHdr pMacHdr; |
| 3635 | tANI_U32 nBytes, nPayload, nStatus; |
| 3636 | void *pPacket; |
| 3637 | eHalStatus halstatus; |
| 3638 | tANI_U8 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3639 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3640 | if(NULL == psessionEntry) |
| 3641 | { |
| 3642 | return; |
| 3643 | } |
| 3644 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3645 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3646 | |
| 3647 | frm.Reason.code = nReason; |
| 3648 | |
| 3649 | nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload ); |
| 3650 | if ( DOT11F_FAILED( nStatus ) ) |
| 3651 | { |
| 3652 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3653 | "or a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3654 | nStatus ); |
| 3655 | // We'll fall back on the worst case scenario: |
| 3656 | nPayload = sizeof( tDot11fDisassociation ); |
| 3657 | } |
| 3658 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3659 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3660 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3661 | "the packed size for a Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3662 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3663 | } |
| 3664 | |
| 3665 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 3666 | |
| 3667 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3668 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3669 | ( void** ) &pPacket ); |
| 3670 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3671 | { |
| 3672 | 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] | 3673 | "association."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3674 | return; |
| 3675 | } |
| 3676 | |
| 3677 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3678 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3679 | |
| 3680 | // Next, we fill out the buffer descriptor: |
| 3681 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3682 | SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr); |
| 3683 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3684 | { |
| 3685 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3686 | "tor for a Disassociation (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3687 | nSirStatus ); |
| 3688 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3689 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3690 | return; // just allocated... |
| 3691 | } |
| 3692 | |
| 3693 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3694 | |
| 3695 | // Prepare the BSSID |
| 3696 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 3697 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3698 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 3699 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3700 | #endif |
| 3701 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3702 | nStatus = dot11fPackDisassociation( pMac, &frm, pFrame + |
| 3703 | sizeof(tSirMacMgmtHdr), |
| 3704 | nPayload, &nPayload ); |
| 3705 | if ( DOT11F_FAILED( nStatus ) ) |
| 3706 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3707 | limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3708 | nStatus ); |
| 3709 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3710 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3711 | return; // allocated! |
| 3712 | } |
| 3713 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3714 | { |
| 3715 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3716 | "isassociation (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3717 | } |
| 3718 | |
| 3719 | PELOG1(limLog( pMac, LOG1, FL("*** Sending Disassociation frame with rea" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3720 | "son %d to"), nReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3721 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 3722 | |
| 3723 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3724 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3725 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3726 | ) |
| 3727 | { |
| 3728 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3729 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3730 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3731 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
| 3732 | (psessionEntry->pePersona == VOS_P2P_GO_MODE)) |
| 3733 | { |
| 3734 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3735 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3736 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3737 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3738 | { |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3739 | // Queue Disassociation frame in high priority WQ |
| 3740 | /* get the duration from the request */ |
| 3741 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3742 | HAL_TXRX_FRM_802_11_MGMT, |
| 3743 | ANI_TXDIR_TODS, |
| 3744 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3745 | limTxComplete, pFrame, limDisassocTxCompleteCnf, |
| 3746 | txFlag ); |
| 3747 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3748 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3749 | if (tx_timer_change( |
| 3750 | &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 3751 | != TX_SUCCESS) |
| 3752 | { |
| 3753 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3754 | FL("Unable to change Disassoc ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3755 | return; |
| 3756 | } |
| 3757 | else if(TX_SUCCESS != tx_timer_activate( |
| 3758 | &pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3759 | { |
| 3760 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3761 | FL("Unable to activate Disassoc ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3762 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3763 | return; |
| 3764 | } |
| 3765 | } |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3766 | else |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3767 | { |
| 3768 | // Queue Disassociation frame in high priority WQ |
| 3769 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3770 | HAL_TXRX_FRM_802_11_MGMT, |
| 3771 | ANI_TXDIR_TODS, |
| 3772 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3773 | limTxComplete, pFrame, txFlag ); |
| 3774 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3775 | { |
| 3776 | limLog( pMac, LOGE, FL("Failed to send Disassociation " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3777 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3778 | nSirStatus ); |
| 3779 | //Pkt will be freed up by the callback |
| 3780 | return; |
| 3781 | } |
| 3782 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3783 | } // End limSendDisassocMgmtFrame. |
| 3784 | |
| 3785 | /** |
| 3786 | * \brief This function is called to send a Deauthenticate frame |
| 3787 | * |
| 3788 | * |
| 3789 | * \param pMac Pointer to global MAC structure |
| 3790 | * |
| 3791 | * \param nReason Indicates the reason that need to be sent in the |
| 3792 | * Deauthenticate frame |
| 3793 | * |
| 3794 | * \param peeer address of the STA to which the frame is to be sent |
| 3795 | * |
| 3796 | * |
| 3797 | */ |
| 3798 | |
| 3799 | void |
| 3800 | limSendDeauthMgmtFrame(tpAniSirGlobal pMac, |
| 3801 | tANI_U16 nReason, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3802 | tSirMacAddr peer, |
| 3803 | tpPESession psessionEntry, |
| 3804 | tANI_BOOLEAN waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3805 | { |
| 3806 | tDot11fDeAuth frm; |
| 3807 | tANI_U8 *pFrame; |
| 3808 | tSirRetStatus nSirStatus; |
| 3809 | tpSirMacMgmtHdr pMacHdr; |
| 3810 | tANI_U32 nBytes, nPayload, nStatus; |
| 3811 | void *pPacket; |
| 3812 | eHalStatus halstatus; |
| 3813 | tANI_U8 txFlag = 0; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3814 | tANI_U32 val = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3815 | #ifdef FEATURE_WLAN_TDLS |
| 3816 | tANI_U16 aid; |
| 3817 | tpDphHashNode pStaDs; |
| 3818 | #endif |
| 3819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3820 | if(NULL == psessionEntry) |
| 3821 | { |
| 3822 | return; |
| 3823 | } |
| 3824 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3825 | vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3826 | |
| 3827 | frm.Reason.code = nReason; |
| 3828 | |
| 3829 | nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload ); |
| 3830 | if ( DOT11F_FAILED( nStatus ) ) |
| 3831 | { |
| 3832 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3833 | "or a De-Authentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3834 | nStatus ); |
| 3835 | // We'll fall back on the worst case scenario: |
| 3836 | nPayload = sizeof( tDot11fDeAuth ); |
| 3837 | } |
| 3838 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3839 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3840 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3841 | "the packed size for a De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3842 | "(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3843 | } |
| 3844 | |
| 3845 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 3846 | |
| 3847 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3848 | ( tANI_U16 )nBytes, ( void** ) &pFrame, |
| 3849 | ( void** ) &pPacket ); |
| 3850 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3851 | { |
| 3852 | 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] | 3853 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3854 | return; |
| 3855 | } |
| 3856 | |
| 3857 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 3858 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3859 | |
| 3860 | // Next, we fill out the buffer descriptor: |
| 3861 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3862 | SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr); |
| 3863 | if ( eSIR_SUCCESS != nSirStatus ) |
| 3864 | { |
| 3865 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3866 | "tor for a De-Authentication (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3867 | nSirStatus ); |
| 3868 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3869 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3870 | return; // just allocated... |
| 3871 | } |
| 3872 | |
| 3873 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 3874 | |
| 3875 | // Prepare the BSSID |
| 3876 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 3877 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3878 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 3879 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3880 | #endif |
| 3881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3882 | nStatus = dot11fPackDeAuth( pMac, &frm, pFrame + |
| 3883 | sizeof(tSirMacMgmtHdr), |
| 3884 | nPayload, &nPayload ); |
| 3885 | if ( DOT11F_FAILED( nStatus ) ) |
| 3886 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3887 | limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3888 | nStatus ); |
| 3889 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 3890 | ( void* ) pFrame, ( void* ) pPacket ); |
| 3891 | return; |
| 3892 | } |
| 3893 | else if ( DOT11F_WARNED( nStatus ) ) |
| 3894 | { |
| 3895 | limLog( pMac, LOGW, FL("There were warnings while packing a D" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 3896 | "e-Authentication (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3897 | } |
| 3898 | |
| 3899 | PELOG1(limLog( pMac, LOG1, FL("*** Sending De-Authentication frame with rea" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3900 | "son %d to"), nReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | limPrintMacAddr( pMac, pMacHdr->da, LOG1 );) |
| 3902 | |
| 3903 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3904 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 3905 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3906 | ) |
| 3907 | { |
| 3908 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3909 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3910 | |
Ganesh K | 08bce95 | 2012-12-13 15:04:41 -0800 | [diff] [blame] | 3911 | if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) || |
| 3912 | (psessionEntry->pePersona == VOS_P2P_GO_MODE)) |
| 3913 | { |
| 3914 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 3915 | } |
Madan Mohan Koyyalamudi | 7ff89c1 | 2012-11-28 15:50:13 -0800 | [diff] [blame] | 3916 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3917 | #ifdef FEATURE_WLAN_TDLS |
| 3918 | pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable); |
| 3919 | #endif |
| 3920 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3921 | if (waitForAck) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3922 | { |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3923 | // Queue Disassociation frame in high priority WQ |
| 3924 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3925 | HAL_TXRX_FRM_802_11_MGMT, |
| 3926 | ANI_TXDIR_TODS, |
| 3927 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3928 | limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag ); |
| 3929 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3930 | { |
| 3931 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3932 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3933 | nSirStatus ); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 3934 | //Pkt will be freed up by the callback limTxComplete |
| 3935 | |
| 3936 | /*Call limProcessDeauthAckTimeout which will send |
| 3937 | * DeauthCnf for this frame |
| 3938 | */ |
| 3939 | limProcessDeauthAckTimeout(pMac); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3940 | return; |
| 3941 | } |
| 3942 | |
| 3943 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3944 | |
| 3945 | if (tx_timer_change( |
| 3946 | &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 3947 | != TX_SUCCESS) |
| 3948 | { |
| 3949 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3950 | FL("Unable to change Deauth ack Timer val")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3951 | return; |
| 3952 | } |
| 3953 | else if(TX_SUCCESS != tx_timer_activate( |
| 3954 | &pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3955 | { |
| 3956 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3957 | FL("Unable to activate Deauth ack Timer")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3958 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3959 | return; |
| 3960 | } |
| 3961 | } |
| 3962 | else |
| 3963 | { |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3964 | #ifdef FEATURE_WLAN_TDLS |
| 3965 | if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) |
| 3966 | { |
| 3967 | // Queue Disassociation frame in high priority WQ |
| 3968 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3969 | HAL_TXRX_FRM_802_11_MGMT, |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3970 | ANI_TXDIR_IBSS, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3971 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3972 | limTxComplete, pFrame, txFlag ); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 3973 | } |
| 3974 | else |
| 3975 | { |
| 3976 | #endif |
| 3977 | // Queue Disassociation frame in high priority WQ |
| 3978 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 3979 | HAL_TXRX_FRM_802_11_MGMT, |
| 3980 | ANI_TXDIR_TODS, |
| 3981 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 3982 | limTxComplete, pFrame, txFlag ); |
| 3983 | #ifdef FEATURE_WLAN_TDLS |
| 3984 | } |
| 3985 | #endif |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3986 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 3987 | { |
| 3988 | limLog( pMac, LOGE, FL("Failed to send De-Authentication " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 3989 | "(%X)!"), |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3990 | nSirStatus ); |
| 3991 | //Pkt will be freed up by the callback |
| 3992 | return; |
| 3993 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3994 | } |
| 3995 | |
| 3996 | } // End limSendDeauthMgmtFrame. |
| 3997 | |
| 3998 | |
| 3999 | #ifdef ANI_SUPPORT_11H |
| 4000 | /** |
| 4001 | * \brief Send a Measurement Report Action frame |
| 4002 | * |
| 4003 | * |
| 4004 | * \param pMac Pointer to the global MAC structure |
| 4005 | * |
| 4006 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 4007 | * |
| 4008 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4009 | * |
| 4010 | * |
| 4011 | */ |
| 4012 | |
| 4013 | tSirRetStatus |
| 4014 | limSendMeasReportFrame(tpAniSirGlobal pMac, |
| 4015 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 4016 | tSirMacAddr peer) |
| 4017 | { |
| 4018 | tDot11fMeasurementReport frm; |
| 4019 | tANI_U8 *pFrame; |
| 4020 | tSirRetStatus nSirStatus; |
| 4021 | tpSirMacMgmtHdr pMacHdr; |
| 4022 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4023 | void *pPacket; |
| 4024 | eHalStatus halstatus; |
| 4025 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4026 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4027 | |
| 4028 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4029 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 4030 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 4031 | |
| 4032 | switch ( pMeasReqFrame->measReqIE.measType ) |
| 4033 | { |
| 4034 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 4035 | nSirStatus = |
| 4036 | PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame, |
| 4037 | &frm.MeasurementReport ); |
| 4038 | break; |
| 4039 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 4040 | nSirStatus = |
| 4041 | PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame, |
| 4042 | &frm.MeasurementReport ); |
| 4043 | break; |
| 4044 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 4045 | nSirStatus = |
| 4046 | PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame, |
| 4047 | &frm.MeasurementReport ); |
| 4048 | break; |
| 4049 | default: |
| 4050 | limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4051 | "dMeasReportFrame."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4052 | pMeasReqFrame->measReqIE.measType ); |
| 4053 | return eSIR_FAILURE; |
| 4054 | } |
| 4055 | |
| 4056 | if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE; |
| 4057 | |
| 4058 | nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload ); |
| 4059 | if ( DOT11F_FAILED( nStatus ) ) |
| 4060 | { |
| 4061 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4062 | "or a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4063 | nStatus ); |
| 4064 | // We'll fall back on the worst case scenario: |
| 4065 | nPayload = sizeof( tDot11fMeasurementReport ); |
| 4066 | } |
| 4067 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4068 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4069 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4070 | "the packed size for a Measurement Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4071 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4072 | } |
| 4073 | |
| 4074 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4075 | |
| 4076 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4077 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4078 | { |
| 4079 | 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] | 4080 | "Authentication."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4081 | return eSIR_FAILURE; |
| 4082 | } |
| 4083 | |
| 4084 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4085 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4086 | |
| 4087 | // Next, we fill out the buffer descriptor: |
| 4088 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4089 | SIR_MAC_MGMT_ACTION, peer); |
| 4090 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4091 | { |
| 4092 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4093 | "tor for a Measurement Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4094 | nSirStatus ); |
| 4095 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4096 | return eSIR_FAILURE; // just allocated... |
| 4097 | } |
| 4098 | |
| 4099 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4100 | |
| 4101 | nCfg = 6; |
| 4102 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4103 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4104 | { |
| 4105 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4106 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4107 | nSirStatus ); |
| 4108 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4109 | return eSIR_FAILURE; // just allocated... |
| 4110 | } |
| 4111 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4112 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4113 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4114 | #endif |
| 4115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4116 | nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame + |
| 4117 | sizeof(tSirMacMgmtHdr), |
| 4118 | nPayload, &nPayload ); |
| 4119 | if ( DOT11F_FAILED( nStatus ) ) |
| 4120 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4121 | limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4122 | nStatus ); |
| 4123 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4124 | return eSIR_FAILURE; // allocated! |
| 4125 | } |
| 4126 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4127 | { |
| 4128 | limLog( pMac, LOGW, FL("There were warnings while packing a M" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4129 | "easurement Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4130 | } |
| 4131 | |
| 4132 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4133 | HAL_TXRX_FRM_802_11_MGMT, |
| 4134 | ANI_TXDIR_TODS, |
| 4135 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4136 | limTxComplete, pFrame, 0 ); |
| 4137 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4138 | { |
| 4139 | limLog( pMac, LOGE, FL("Failed to send a Measurement Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4140 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4141 | nSirStatus ); |
| 4142 | //Pkt will be freed up by the callback |
| 4143 | return eSIR_FAILURE; // just allocated... |
| 4144 | } |
| 4145 | |
| 4146 | return eSIR_SUCCESS; |
| 4147 | |
| 4148 | } // End limSendMeasReportFrame. |
| 4149 | |
| 4150 | |
| 4151 | /** |
| 4152 | * \brief Send a TPC Request Action frame |
| 4153 | * |
| 4154 | * |
| 4155 | * \param pMac Pointer to the global MAC datastructure |
| 4156 | * |
| 4157 | * \param peer MAC address to which the frame should be sent |
| 4158 | * |
| 4159 | * |
| 4160 | */ |
| 4161 | |
| 4162 | void |
| 4163 | limSendTpcRequestFrame(tpAniSirGlobal pMac, |
| 4164 | tSirMacAddr peer) |
| 4165 | { |
| 4166 | tDot11fTPCRequest frm; |
| 4167 | tANI_U8 *pFrame; |
| 4168 | tSirRetStatus nSirStatus; |
| 4169 | tpSirMacMgmtHdr pMacHdr; |
| 4170 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4171 | void *pPacket; |
| 4172 | eHalStatus halstatus; |
| 4173 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4174 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4175 | |
| 4176 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4177 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 4178 | frm.DialogToken.token = 1; |
| 4179 | frm.TPCRequest.present = 1; |
| 4180 | |
| 4181 | nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload ); |
| 4182 | if ( DOT11F_FAILED( nStatus ) ) |
| 4183 | { |
| 4184 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4185 | "or a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4186 | nStatus ); |
| 4187 | // We'll fall back on the worst case scenario: |
| 4188 | nPayload = sizeof( tDot11fTPCRequest ); |
| 4189 | } |
| 4190 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4191 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4192 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4193 | "the packed size for a TPC Request (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4194 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4195 | } |
| 4196 | |
| 4197 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4198 | |
| 4199 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4200 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4201 | { |
| 4202 | 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] | 4203 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4204 | return; |
| 4205 | } |
| 4206 | |
| 4207 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4208 | vos_mem_set(pFrame, nBytes,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4209 | |
| 4210 | // Next, we fill out the buffer descriptor: |
| 4211 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4212 | SIR_MAC_MGMT_ACTION, peer); |
| 4213 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4214 | { |
| 4215 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4216 | "tor for a TPC Request (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4217 | nSirStatus ); |
| 4218 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4219 | return; // just allocated... |
| 4220 | } |
| 4221 | |
| 4222 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4223 | |
| 4224 | nCfg = 6; |
| 4225 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4226 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4227 | { |
| 4228 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4229 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4230 | nSirStatus ); |
| 4231 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4232 | return; // just allocated... |
| 4233 | } |
| 4234 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4235 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4236 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4237 | #endif |
| 4238 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4239 | nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame + |
| 4240 | sizeof(tSirMacMgmtHdr), |
| 4241 | nPayload, &nPayload ); |
| 4242 | if ( DOT11F_FAILED( nStatus ) ) |
| 4243 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4244 | limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4245 | nStatus ); |
| 4246 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4247 | return; // allocated! |
| 4248 | } |
| 4249 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4250 | { |
| 4251 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4252 | "PC Request (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4253 | } |
| 4254 | |
| 4255 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4256 | HAL_TXRX_FRM_802_11_MGMT, |
| 4257 | ANI_TXDIR_TODS, |
| 4258 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4259 | limTxComplete, pFrame, 0 ); |
| 4260 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4261 | { |
| 4262 | limLog( pMac, LOGE, FL("Failed to send a TPC Request " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4263 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4264 | nSirStatus ); |
| 4265 | //Pkt will be freed up by the callback |
| 4266 | return; |
| 4267 | } |
| 4268 | |
| 4269 | } // End limSendTpcRequestFrame. |
| 4270 | |
| 4271 | |
| 4272 | /** |
| 4273 | * \brief Send a TPC Report Action frame |
| 4274 | * |
| 4275 | * |
| 4276 | * \param pMac Pointer to the global MAC datastructure |
| 4277 | * |
| 4278 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 4279 | * |
| 4280 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4281 | * |
| 4282 | * |
| 4283 | */ |
| 4284 | |
| 4285 | tSirRetStatus |
| 4286 | limSendTpcReportFrame(tpAniSirGlobal pMac, |
| 4287 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 4288 | tSirMacAddr peer) |
| 4289 | { |
| 4290 | tDot11fTPCReport frm; |
| 4291 | tANI_U8 *pFrame; |
| 4292 | tSirRetStatus nSirStatus; |
| 4293 | tpSirMacMgmtHdr pMacHdr; |
| 4294 | tANI_U32 nBytes, nPayload, nStatus, nCfg; |
| 4295 | void *pPacket; |
| 4296 | eHalStatus halstatus; |
| 4297 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4298 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4299 | |
| 4300 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4301 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 4302 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 4303 | |
| 4304 | // FramesToDo: On the Gen4_TVM branch, there was a comment: |
| 4305 | // "misplaced this function, need to replace: |
| 4306 | // txPower = halGetRateToPwrValue(pMac, staid, |
| 4307 | // pMac->lim.gLimCurrentChannelId, 0); |
| 4308 | frm.TPCReport.tx_power = 0; |
| 4309 | frm.TPCReport.link_margin = 0; |
| 4310 | frm.TPCReport.present = 1; |
| 4311 | |
| 4312 | nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload ); |
| 4313 | if ( DOT11F_FAILED( nStatus ) ) |
| 4314 | { |
| 4315 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4316 | "or a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4317 | nStatus ); |
| 4318 | // We'll fall back on the worst case scenario: |
| 4319 | nPayload = sizeof( tDot11fTPCReport ); |
| 4320 | } |
| 4321 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4322 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4323 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4324 | "the packed size for a TPC Report (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4325 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4326 | } |
| 4327 | |
| 4328 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4329 | |
| 4330 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4331 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4332 | { |
| 4333 | 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] | 4334 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4335 | return eSIR_FAILURE; |
| 4336 | } |
| 4337 | |
| 4338 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4339 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4340 | |
| 4341 | // Next, we fill out the buffer descriptor: |
| 4342 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4343 | SIR_MAC_MGMT_ACTION, peer); |
| 4344 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4345 | { |
| 4346 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4347 | "tor for a TPC Report (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4348 | nSirStatus ); |
| 4349 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4350 | return eSIR_FAILURE; // just allocated... |
| 4351 | } |
| 4352 | |
| 4353 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4354 | |
| 4355 | nCfg = 6; |
| 4356 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4357 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4358 | { |
| 4359 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4360 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4361 | nSirStatus ); |
| 4362 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4363 | return eSIR_FAILURE; // just allocated... |
| 4364 | } |
| 4365 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4366 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4367 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4368 | #endif |
| 4369 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4370 | nStatus = dot11fPackTPCReport( pMac, &frm, pFrame + |
| 4371 | sizeof(tSirMacMgmtHdr), |
| 4372 | nPayload, &nPayload ); |
| 4373 | if ( DOT11F_FAILED( nStatus ) ) |
| 4374 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4375 | limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4376 | nStatus ); |
| 4377 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4378 | return eSIR_FAILURE; // allocated! |
| 4379 | } |
| 4380 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4381 | { |
| 4382 | limLog( pMac, LOGW, FL("There were warnings while packing a T" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4383 | "PC Report (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4384 | } |
| 4385 | |
| 4386 | |
| 4387 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4388 | HAL_TXRX_FRM_802_11_MGMT, |
| 4389 | ANI_TXDIR_TODS, |
| 4390 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4391 | limTxComplete, pFrame, 0 ); |
| 4392 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4393 | { |
| 4394 | limLog( pMac, LOGE, FL("Failed to send a TPC Report " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4395 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4396 | nSirStatus ); |
| 4397 | //Pkt will be freed up by the callback |
| 4398 | return eSIR_FAILURE; // just allocated... |
| 4399 | } |
| 4400 | |
| 4401 | return eSIR_SUCCESS; |
| 4402 | |
| 4403 | } // End limSendTpcReportFrame. |
| 4404 | #endif //ANI_SUPPORT_11H |
| 4405 | |
| 4406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4407 | /** |
| 4408 | * \brief Send a Channel Switch Announcement |
| 4409 | * |
| 4410 | * |
| 4411 | * \param pMac Pointer to the global MAC datastructure |
| 4412 | * |
| 4413 | * \param peer MAC address to which this frame will be sent |
| 4414 | * |
| 4415 | * \param nMode |
| 4416 | * |
| 4417 | * \param nNewChannel |
| 4418 | * |
| 4419 | * \param nCount |
| 4420 | * |
| 4421 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4422 | * |
| 4423 | * |
| 4424 | */ |
| 4425 | |
| 4426 | tSirRetStatus |
| 4427 | limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4428 | tSirMacAddr peer, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4429 | tANI_U8 nMode, |
| 4430 | tANI_U8 nNewChannel, |
| 4431 | tANI_U8 nCount, |
| 4432 | tpPESession psessionEntry ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4433 | { |
| 4434 | tDot11fChannelSwitch frm; |
| 4435 | tANI_U8 *pFrame; |
| 4436 | tSirRetStatus nSirStatus; |
| 4437 | tpSirMacMgmtHdr pMacHdr; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4438 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4439 | void *pPacket; |
| 4440 | eHalStatus halstatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4441 | tANI_U8 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4442 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4443 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4444 | |
| 4445 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4446 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4447 | frm.ChanSwitchAnn.switchMode = nMode; |
| 4448 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4449 | frm.ChanSwitchAnn.switchCount = nCount; |
| 4450 | frm.ChanSwitchAnn.present = 1; |
| 4451 | |
| 4452 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4453 | if ( DOT11F_FAILED( nStatus ) ) |
| 4454 | { |
| 4455 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4456 | "or a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4457 | nStatus ); |
| 4458 | // We'll fall back on the worst case scenario: |
| 4459 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4460 | } |
| 4461 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4462 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4463 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4464 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4465 | "%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4466 | } |
| 4467 | |
| 4468 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4469 | |
| 4470 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4471 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4472 | { |
| 4473 | 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] | 4474 | " Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4475 | return eSIR_FAILURE; |
| 4476 | } |
| 4477 | |
| 4478 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4479 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | |
| 4481 | // Next, we fill out the buffer descriptor: |
| 4482 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4483 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4484 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4485 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4486 | (tANI_U8 *) psessionEntry->bssId, |
| 4487 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4488 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4489 | { |
| 4490 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4491 | "tor for a Channel Switch (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4492 | nSirStatus ); |
| 4493 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4494 | return eSIR_FAILURE; // just allocated... |
| 4495 | } |
| 4496 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4497 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4498 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 4499 | |
| 4500 | nCfg = 6; |
| 4501 | nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg ); |
| 4502 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4503 | { |
| 4504 | limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4505 | " CFG (%d)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4506 | nSirStatus ); |
| 4507 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4508 | return eSIR_FAILURE; // just allocated... |
| 4509 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4510 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4511 | |
| 4512 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4513 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4514 | #endif |
| 4515 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4516 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4517 | sizeof(tSirMacMgmtHdr), |
| 4518 | nPayload, &nPayload ); |
| 4519 | if ( DOT11F_FAILED( nStatus ) ) |
| 4520 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4521 | limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4522 | nStatus ); |
| 4523 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4524 | return eSIR_FAILURE; // allocated! |
| 4525 | } |
| 4526 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4527 | { |
| 4528 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4529 | "hannel Switch (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4530 | } |
| 4531 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4532 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4533 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4534 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4535 | ) |
| 4536 | { |
| 4537 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4539 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4540 | HAL_TXRX_FRM_802_11_MGMT, |
| 4541 | ANI_TXDIR_TODS, |
| 4542 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4543 | limTxComplete, pFrame, txFlag ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4544 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4545 | { |
| 4546 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4547 | "(%X)!"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4548 | nSirStatus ); |
| 4549 | //Pkt will be freed up by the callback |
| 4550 | return eSIR_FAILURE; |
| 4551 | } |
| 4552 | |
| 4553 | return eSIR_SUCCESS; |
| 4554 | |
| 4555 | } // End limSendChannelSwitchMgmtFrame. |
| 4556 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4557 | |
| 4558 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4559 | #ifdef WLAN_FEATURE_11AC |
| 4560 | tSirRetStatus |
| 4561 | limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac, |
| 4562 | tSirMacAddr peer, |
| 4563 | tANI_U8 nMode, |
| 4564 | tpPESession psessionEntry ) |
| 4565 | { |
| 4566 | tDot11fOperatingMode frm; |
| 4567 | tANI_U8 *pFrame; |
| 4568 | tSirRetStatus nSirStatus; |
| 4569 | tpSirMacMgmtHdr pMacHdr; |
| 4570 | tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg; |
| 4571 | void *pPacket; |
| 4572 | eHalStatus halstatus; |
| 4573 | tANI_U8 txFlag = 0; |
| 4574 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4575 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4576 | |
| 4577 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 4578 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 4579 | frm.OperatingMode.chanWidth = nMode; |
| 4580 | frm.OperatingMode.rxNSS = 0; |
| 4581 | frm.OperatingMode.rxNSSType = 0; |
| 4582 | |
| 4583 | nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload ); |
| 4584 | if ( DOT11F_FAILED( nStatus ) ) |
| 4585 | { |
| 4586 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4587 | "or a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4588 | nStatus ); |
| 4589 | // We'll fall back on the worst case scenario: |
| 4590 | nPayload = sizeof( tDot11fOperatingMode); |
| 4591 | } |
| 4592 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4593 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4594 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4595 | "the packed size for a Operating Mode (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4596 | "%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4597 | } |
| 4598 | |
| 4599 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4600 | |
| 4601 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4602 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4603 | { |
| 4604 | 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] | 4605 | " Report."), nBytes ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4606 | return eSIR_FAILURE; |
| 4607 | } |
| 4608 | |
| 4609 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4610 | vos_mem_set( pFrame, nBytes, 0 ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4611 | |
| 4612 | |
| 4613 | // Next, we fill out the buffer descriptor: |
| 4614 | if(psessionEntry->pePersona == VOS_STA_SAP_MODE) { |
| 4615 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4616 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4617 | } else |
| 4618 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4619 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr); |
| 4620 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4621 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4622 | (tANI_U8 *) psessionEntry->bssId, |
| 4623 | sizeof( tSirMacAddr )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4624 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4625 | { |
| 4626 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4627 | "tor for a Operating Mode (%d)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4628 | nSirStatus ); |
| 4629 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4630 | return eSIR_FAILURE; // just allocated... |
| 4631 | } |
| 4632 | nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame + |
| 4633 | sizeof(tSirMacMgmtHdr), |
| 4634 | nPayload, &nPayload ); |
| 4635 | if ( DOT11F_FAILED( nStatus ) ) |
| 4636 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4637 | limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4638 | nStatus ); |
| 4639 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4640 | return eSIR_FAILURE; // allocated! |
| 4641 | } |
| 4642 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4643 | { |
| 4644 | limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4645 | " (0x%08x)."), nStatus ); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4646 | } |
| 4647 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4648 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4649 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4650 | ) |
| 4651 | { |
| 4652 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4653 | } |
| 4654 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4655 | HAL_TXRX_FRM_802_11_MGMT, |
| 4656 | ANI_TXDIR_TODS, |
| 4657 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4658 | limTxComplete, pFrame, txFlag ); |
| 4659 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4660 | { |
| 4661 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4662 | "(%X)!"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4663 | nSirStatus ); |
| 4664 | //Pkt will be freed up by the callback |
| 4665 | return eSIR_FAILURE; |
| 4666 | } |
| 4667 | |
| 4668 | return eSIR_SUCCESS; |
| 4669 | } |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4670 | |
| 4671 | /** |
| 4672 | * \brief Send a VHT Channel Switch Announcement |
| 4673 | * |
| 4674 | * |
| 4675 | * \param pMac Pointer to the global MAC datastructure |
| 4676 | * |
| 4677 | * \param peer MAC address to which this frame will be sent |
| 4678 | * |
| 4679 | * \param nChanWidth |
| 4680 | * |
| 4681 | * \param nNewChannel |
| 4682 | * |
| 4683 | * |
| 4684 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 4685 | * |
| 4686 | * |
| 4687 | */ |
| 4688 | |
| 4689 | tSirRetStatus |
| 4690 | limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac, |
| 4691 | tSirMacAddr peer, |
| 4692 | tANI_U8 nChanWidth, |
| 4693 | tANI_U8 nNewChannel, |
| 4694 | tANI_U8 ncbMode, |
| 4695 | tpPESession psessionEntry ) |
| 4696 | { |
| 4697 | tDot11fChannelSwitch frm; |
| 4698 | tANI_U8 *pFrame; |
| 4699 | tSirRetStatus nSirStatus; |
| 4700 | tpSirMacMgmtHdr pMacHdr; |
| 4701 | tANI_U32 nBytes, nPayload, nStatus;//, nCfg; |
| 4702 | void *pPacket; |
| 4703 | eHalStatus halstatus; |
| 4704 | tANI_U8 txFlag = 0; |
| 4705 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4706 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4707 | |
| 4708 | |
| 4709 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 4710 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 4711 | frm.ChanSwitchAnn.switchMode = 1; |
| 4712 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 4713 | frm.ChanSwitchAnn.switchCount = 1; |
| 4714 | frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode); |
| 4715 | frm.ExtChanSwitchAnn.present = 1; |
| 4716 | frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth; |
| 4717 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth); |
| 4718 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0; |
| 4719 | frm.ChanSwitchAnn.present = 1; |
| 4720 | frm.WiderBWChanSwitchAnn.present = 1; |
| 4721 | |
| 4722 | nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload ); |
| 4723 | if ( DOT11F_FAILED( nStatus ) ) |
| 4724 | { |
| 4725 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4726 | "or a Channel Switch (0x%08x)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4727 | nStatus ); |
| 4728 | // We'll fall back on the worst case scenario: |
| 4729 | nPayload = sizeof( tDot11fChannelSwitch ); |
| 4730 | } |
| 4731 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4732 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4733 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4734 | "the packed size for a Channel Switch (0x" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4735 | "%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4736 | } |
| 4737 | |
| 4738 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4739 | |
| 4740 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 4741 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4742 | { |
| 4743 | 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] | 4744 | " Report."), nBytes ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4745 | return eSIR_FAILURE; |
| 4746 | } |
| 4747 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4748 | vos_mem_set( pFrame, nBytes, 0 ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4749 | |
| 4750 | // Next, we fill out the buffer descriptor: |
| 4751 | nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4752 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4753 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4754 | vos_mem_copy( (tANI_U8 *) pMacHdr->bssId, |
| 4755 | (tANI_U8 *) psessionEntry->bssId, |
| 4756 | sizeof( tSirMacAddr )); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4757 | if ( eSIR_SUCCESS != nSirStatus ) |
| 4758 | { |
| 4759 | limLog( pMac, LOGE, FL("Failed to populate the buffer descrip" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4760 | "tor for a Channel Switch (%d)."), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4761 | nSirStatus ); |
| 4762 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4763 | return eSIR_FAILURE; // just allocated... |
| 4764 | } |
| 4765 | nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame + |
| 4766 | sizeof(tSirMacMgmtHdr), |
| 4767 | nPayload, &nPayload ); |
| 4768 | if ( DOT11F_FAILED( nStatus ) ) |
| 4769 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4770 | 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] | 4771 | nStatus ); |
| 4772 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 4773 | return eSIR_FAILURE; // allocated! |
| 4774 | } |
| 4775 | else if ( DOT11F_WARNED( nStatus ) ) |
| 4776 | { |
| 4777 | limLog( pMac, LOGW, FL("There were warnings while packing a C" |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4778 | "hannel Switch (0x%08x)."), nStatus ); |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4779 | } |
| 4780 | |
| 4781 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4782 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4783 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4784 | ) |
| 4785 | { |
| 4786 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4787 | } |
| 4788 | halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes, |
| 4789 | HAL_TXRX_FRM_802_11_MGMT, |
| 4790 | ANI_TXDIR_TODS, |
| 4791 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4792 | limTxComplete, pFrame, txFlag ); |
| 4793 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 4794 | { |
| 4795 | limLog( pMac, LOGE, FL("Failed to send a Channel Switch " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4796 | "(%X)!"), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 4797 | nSirStatus ); |
| 4798 | //Pkt will be freed up by the callback |
| 4799 | return eSIR_FAILURE; |
| 4800 | } |
| 4801 | |
| 4802 | return eSIR_SUCCESS; |
| 4803 | |
| 4804 | } // End limSendVHTChannelSwitchMgmtFrame. |
| 4805 | |
| 4806 | |
| 4807 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 4808 | #endif |
| 4809 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4810 | /** |
| 4811 | * \brief Send an ADDBA Req Action Frame to peer |
| 4812 | * |
| 4813 | * \sa limSendAddBAReq |
| 4814 | * |
| 4815 | * \param pMac The global tpAniSirGlobal object |
| 4816 | * |
| 4817 | * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains |
| 4818 | * the necessary parameters reqd by PE send the ADDBA Req Action |
| 4819 | * Frame to the peer |
| 4820 | * |
| 4821 | * \return eSIR_SUCCESS if setup completes successfully |
| 4822 | * eSIR_FAILURE is some problem is encountered |
| 4823 | */ |
| 4824 | tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4825 | tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4826 | { |
| 4827 | tDot11fAddBAReq frmAddBAReq; |
| 4828 | tANI_U8 *pAddBAReqBuffer = NULL; |
| 4829 | tpSirMacMgmtHdr pMacHdr; |
| 4830 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 4831 | tSirRetStatus statusCode; |
| 4832 | eHalStatus halStatus; |
| 4833 | void *pPacket; |
| 4834 | tANI_U8 txFlag = 0; |
| 4835 | |
| 4836 | if(NULL == psessionEntry) |
| 4837 | { |
| 4838 | return eSIR_FAILURE; |
| 4839 | } |
| 4840 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4841 | vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | |
| 4843 | // Category - 3 (BA) |
| 4844 | frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK; |
| 4845 | |
| 4846 | // Action - 0 (ADDBA Req) |
| 4847 | frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ; |
| 4848 | |
| 4849 | // FIXME - Dialog Token, generalize this... |
| 4850 | frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken; |
| 4851 | |
| 4852 | // Fill the ADDBA Parameter Set |
| 4853 | frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID; |
| 4854 | frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy; |
| 4855 | frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize; |
| 4856 | |
| 4857 | // BA timeout |
| 4858 | // 0 - indicates no BA timeout |
| 4859 | frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout; |
| 4860 | |
| 4861 | // BA Starting Sequence Number |
| 4862 | // Fragment number will always be zero |
| 4863 | if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) { |
| 4864 | pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 4865 | } |
| 4866 | |
| 4867 | frmAddBAReq.BAStartingSequenceControl.ssn = |
| 4868 | pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP; |
| 4869 | |
| 4870 | nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload ); |
| 4871 | |
| 4872 | if( DOT11F_FAILED( nStatus )) |
| 4873 | { |
| 4874 | limLog( pMac, LOGW, |
| 4875 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4876 | "an ADDBA Request (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4877 | nStatus ); |
| 4878 | |
| 4879 | // We'll fall back on the worst case scenario: |
| 4880 | nPayload = sizeof( tDot11fAddBAReq ); |
| 4881 | } |
| 4882 | else if( DOT11F_WARNED( nStatus )) |
| 4883 | { |
| 4884 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4885 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4886 | "the packed size for an ADDBA Req (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4887 | nStatus ); |
| 4888 | } |
| 4889 | |
| 4890 | // Add the MGMT header to frame length |
| 4891 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 4892 | |
| 4893 | // Need to allocate a buffer for ADDBA AF |
| 4894 | if( eHAL_STATUS_SUCCESS != |
| 4895 | (halStatus = palPktAlloc( pMac->hHdd, |
| 4896 | HAL_TXRX_FRM_802_11_MGMT, |
| 4897 | (tANI_U16) frameLen, |
| 4898 | (void **) &pAddBAReqBuffer, |
| 4899 | (void **) &pPacket ))) |
| 4900 | { |
| 4901 | // Log error |
| 4902 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4903 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4904 | frameLen, |
| 4905 | halStatus ); |
| 4906 | |
| 4907 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 4908 | goto returnAfterError; |
| 4909 | } |
| 4910 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 4911 | vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4912 | |
| 4913 | // Copy necessary info to BD |
| 4914 | if( eSIR_SUCCESS != |
| 4915 | (statusCode = limPopulateMacHeader( pMac, |
| 4916 | pAddBAReqBuffer, |
| 4917 | SIR_MAC_MGMT_FRAME, |
| 4918 | SIR_MAC_MGMT_ACTION, |
| 4919 | pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 4920 | goto returnAfterError; |
| 4921 | |
| 4922 | // Update A3 with the BSSID |
| 4923 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer; |
| 4924 | |
| 4925 | #if 0 |
| 4926 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 4927 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 4928 | WNI_CFG_BSSID, |
| 4929 | (tANI_U8 *) pMacHdr->bssId, |
| 4930 | &cfgLen )) |
| 4931 | { |
| 4932 | limLog( pMac, LOGP, |
| 4933 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4934 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4935 | |
| 4936 | // FIXME - Need to convert to tSirRetStatus |
| 4937 | statusCode = eSIR_FAILURE; |
| 4938 | goto returnAfterError; |
| 4939 | } |
| 4940 | #endif//TO SUPPORT BT-AMP |
| 4941 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 4942 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4943 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 4944 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4945 | #endif |
| 4946 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4947 | // Now, we're ready to "pack" the frames |
| 4948 | nStatus = dot11fPackAddBAReq( pMac, |
| 4949 | &frmAddBAReq, |
| 4950 | pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ), |
| 4951 | nPayload, |
| 4952 | &nPayload ); |
| 4953 | |
| 4954 | if( DOT11F_FAILED( nStatus )) |
| 4955 | { |
| 4956 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4957 | FL( "Failed to pack an ADDBA Req (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4958 | nStatus ); |
| 4959 | |
| 4960 | // FIXME - Need to convert to tSirRetStatus |
| 4961 | statusCode = eSIR_FAILURE; |
| 4962 | goto returnAfterError; |
| 4963 | } |
| 4964 | else if( DOT11F_WARNED( nStatus )) |
| 4965 | { |
| 4966 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 4967 | FL( "There were warnings while packing an ADDBA Req (0x%08x)."), |
| 4968 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4969 | } |
| 4970 | |
| 4971 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4972 | FL( "Sending an ADDBA REQ to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4973 | limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW ); |
| 4974 | |
| 4975 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4976 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 4977 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4978 | ) |
| 4979 | { |
| 4980 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4981 | } |
| 4982 | |
| 4983 | if( eHAL_STATUS_SUCCESS != |
| 4984 | (halStatus = halTxFrame( pMac, |
| 4985 | pPacket, |
| 4986 | (tANI_U16) frameLen, |
| 4987 | HAL_TXRX_FRM_802_11_MGMT, |
| 4988 | ANI_TXDIR_TODS, |
| 4989 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 4990 | limTxComplete, |
| 4991 | pAddBAReqBuffer, txFlag ))) |
| 4992 | { |
| 4993 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 4994 | FL( "halTxFrame FAILED! Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | halStatus ); |
| 4996 | |
| 4997 | // FIXME - Need to convert eHalStatus to tSirRetStatus |
| 4998 | statusCode = eSIR_FAILURE; |
| 4999 | //Pkt will be freed up by the callback |
| 5000 | return statusCode; |
| 5001 | } |
| 5002 | else |
| 5003 | return eSIR_SUCCESS; |
| 5004 | |
| 5005 | returnAfterError: |
| 5006 | |
| 5007 | // Release buffer, if allocated |
| 5008 | if( NULL != pAddBAReqBuffer ) |
| 5009 | palPktFree( pMac->hHdd, |
| 5010 | HAL_TXRX_FRM_802_11_MGMT, |
| 5011 | (void *) pAddBAReqBuffer, |
| 5012 | (void *) pPacket ); |
| 5013 | |
| 5014 | return statusCode; |
| 5015 | } |
| 5016 | |
| 5017 | /** |
| 5018 | * \brief Send an ADDBA Rsp Action Frame to peer |
| 5019 | * |
| 5020 | * \sa limSendAddBARsp |
| 5021 | * |
| 5022 | * \param pMac The global tpAniSirGlobal object |
| 5023 | * |
| 5024 | * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains |
| 5025 | * the necessary parameters reqd by PE send the ADDBA Rsp Action |
| 5026 | * Frame to the peer |
| 5027 | * |
| 5028 | * \return eSIR_SUCCESS if setup completes successfully |
| 5029 | * eSIR_FAILURE is some problem is encountered |
| 5030 | */ |
| 5031 | tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac, |
| 5032 | tpLimMlmAddBARsp pMlmAddBARsp, |
| 5033 | tpPESession psessionEntry) |
| 5034 | { |
| 5035 | tDot11fAddBARsp frmAddBARsp; |
| 5036 | tANI_U8 *pAddBARspBuffer = NULL; |
| 5037 | tpSirMacMgmtHdr pMacHdr; |
| 5038 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5039 | tSirRetStatus statusCode; |
| 5040 | eHalStatus halStatus; |
| 5041 | void *pPacket; |
| 5042 | tANI_U8 txFlag = 0; |
| 5043 | |
| 5044 | if(NULL == psessionEntry) |
| 5045 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5046 | PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5047 | return eSIR_FAILURE; |
| 5048 | } |
| 5049 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5050 | vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5051 | |
| 5052 | // Category - 3 (BA) |
| 5053 | frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5054 | // Action - 1 (ADDBA Rsp) |
| 5055 | frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP; |
| 5056 | |
| 5057 | // Should be same as the one we received in the ADDBA Req |
| 5058 | frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken; |
| 5059 | |
| 5060 | // ADDBA Req status |
| 5061 | frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode; |
| 5062 | |
| 5063 | // Fill the ADDBA Parameter Set as provided by caller |
| 5064 | frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID; |
| 5065 | frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy; |
| 5066 | frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 5067 | |
| 5068 | if(psessionEntry->isAmsduSupportInAMPDU) |
| 5069 | { |
| 5070 | frmAddBARsp.AddBAParameterSet.amsduSupported = |
| 5071 | psessionEntry->amsduSupportedInBA; |
| 5072 | } |
| 5073 | else |
| 5074 | { |
| 5075 | frmAddBARsp.AddBAParameterSet.amsduSupported = 0; |
| 5076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5077 | |
| 5078 | // BA timeout |
| 5079 | // 0 - indicates no BA timeout |
| 5080 | frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout; |
| 5081 | |
| 5082 | nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload ); |
| 5083 | |
| 5084 | if( DOT11F_FAILED( nStatus )) |
| 5085 | { |
| 5086 | limLog( pMac, LOGW, |
| 5087 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5088 | "an ADDBA Response (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5089 | nStatus ); |
| 5090 | |
| 5091 | // We'll fall back on the worst case scenario: |
| 5092 | nPayload = sizeof( tDot11fAddBARsp ); |
| 5093 | } |
| 5094 | else if( DOT11F_WARNED( nStatus )) |
| 5095 | { |
| 5096 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5097 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5098 | "the packed size for an ADDBA Rsp (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5099 | nStatus ); |
| 5100 | } |
| 5101 | |
| 5102 | // Need to allocate a buffer for ADDBA AF |
| 5103 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5104 | |
| 5105 | // Allocate shared memory |
| 5106 | if( eHAL_STATUS_SUCCESS != |
| 5107 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5108 | HAL_TXRX_FRM_802_11_MGMT, |
| 5109 | (tANI_U16) frameLen, |
| 5110 | (void **) &pAddBARspBuffer, |
| 5111 | (void **) &pPacket ))) |
| 5112 | { |
| 5113 | // Log error |
| 5114 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5115 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5116 | frameLen, |
| 5117 | halStatus ); |
| 5118 | |
| 5119 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5120 | goto returnAfterError; |
| 5121 | } |
| 5122 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5123 | vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5124 | |
| 5125 | // Copy necessary info to BD |
| 5126 | if( eSIR_SUCCESS != |
| 5127 | (statusCode = limPopulateMacHeader( pMac, |
| 5128 | pAddBARspBuffer, |
| 5129 | SIR_MAC_MGMT_FRAME, |
| 5130 | SIR_MAC_MGMT_ACTION, |
| 5131 | pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5132 | goto returnAfterError; |
| 5133 | |
| 5134 | // Update A3 with the BSSID |
| 5135 | |
| 5136 | pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer; |
| 5137 | |
| 5138 | #if 0 |
| 5139 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5140 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 5141 | WNI_CFG_BSSID, |
| 5142 | (tANI_U8 *) pMacHdr->bssId, |
| 5143 | &cfgLen )) |
| 5144 | { |
| 5145 | limLog( pMac, LOGP, |
| 5146 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5147 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5148 | |
| 5149 | // FIXME - Need to convert to tSirRetStatus |
| 5150 | statusCode = eSIR_FAILURE; |
| 5151 | goto returnAfterError; |
| 5152 | } |
| 5153 | #endif // TO SUPPORT BT-AMP |
| 5154 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5155 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5156 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5157 | limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5158 | #endif |
| 5159 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5160 | // Now, we're ready to "pack" the frames |
| 5161 | nStatus = dot11fPackAddBARsp( pMac, |
| 5162 | &frmAddBARsp, |
| 5163 | pAddBARspBuffer + sizeof( tSirMacMgmtHdr ), |
| 5164 | nPayload, |
| 5165 | &nPayload ); |
| 5166 | |
| 5167 | if( DOT11F_FAILED( nStatus )) |
| 5168 | { |
| 5169 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5170 | FL( "Failed to pack an ADDBA Rsp (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5171 | nStatus ); |
| 5172 | |
| 5173 | // FIXME - Need to convert to tSirRetStatus |
| 5174 | statusCode = eSIR_FAILURE; |
| 5175 | goto returnAfterError; |
| 5176 | } |
| 5177 | else if( DOT11F_WARNED( nStatus )) |
| 5178 | { |
| 5179 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5180 | FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ), |
| 5181 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5182 | } |
| 5183 | |
| 5184 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5185 | FL( "Sending an ADDBA RSP to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5186 | limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW ); |
| 5187 | |
| 5188 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5189 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5190 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5191 | ) |
| 5192 | { |
| 5193 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5194 | } |
| 5195 | |
| 5196 | if( eHAL_STATUS_SUCCESS != |
| 5197 | (halStatus = halTxFrame( pMac, |
| 5198 | pPacket, |
| 5199 | (tANI_U16) frameLen, |
| 5200 | HAL_TXRX_FRM_802_11_MGMT, |
| 5201 | ANI_TXDIR_TODS, |
| 5202 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5203 | limTxComplete, |
| 5204 | pAddBARspBuffer, txFlag ))) |
| 5205 | { |
| 5206 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5207 | FL( "halTxFrame FAILED! Status [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5208 | halStatus ); |
| 5209 | |
| 5210 | // FIXME - HAL error codes are different from PE error |
| 5211 | // codes!! And, this routine is returning tSirRetStatus |
| 5212 | statusCode = eSIR_FAILURE; |
| 5213 | //Pkt will be freed up by the callback |
| 5214 | return statusCode; |
| 5215 | } |
| 5216 | else |
| 5217 | return eSIR_SUCCESS; |
| 5218 | |
| 5219 | returnAfterError: |
| 5220 | |
| 5221 | // Release buffer, if allocated |
| 5222 | if( NULL != pAddBARspBuffer ) |
| 5223 | palPktFree( pMac->hHdd, |
| 5224 | HAL_TXRX_FRM_802_11_MGMT, |
| 5225 | (void *) pAddBARspBuffer, |
| 5226 | (void *) pPacket ); |
| 5227 | |
| 5228 | return statusCode; |
| 5229 | } |
| 5230 | |
| 5231 | /** |
| 5232 | * \brief Send a DELBA Indication Action Frame to peer |
| 5233 | * |
| 5234 | * \sa limSendDelBAInd |
| 5235 | * |
| 5236 | * \param pMac The global tpAniSirGlobal object |
| 5237 | * |
| 5238 | * \param peerMacAddr MAC Address of peer |
| 5239 | * |
| 5240 | * \param reasonCode Reason for the DELBA notification |
| 5241 | * |
| 5242 | * \param pBAParameterSet The DELBA Parameter Set. |
| 5243 | * This identifies the TID for which the BA session is |
| 5244 | * being deleted. |
| 5245 | * |
| 5246 | * \return eSIR_SUCCESS if setup completes successfully |
| 5247 | * eSIR_FAILURE is some problem is encountered |
| 5248 | */ |
| 5249 | tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac, |
| 5250 | tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry) |
| 5251 | { |
| 5252 | tDot11fDelBAInd frmDelBAInd; |
| 5253 | tANI_U8 *pDelBAIndBuffer = NULL; |
| 5254 | //tANI_U32 val; |
| 5255 | tpSirMacMgmtHdr pMacHdr; |
| 5256 | tANI_U32 frameLen = 0, nStatus, nPayload; |
| 5257 | tSirRetStatus statusCode; |
| 5258 | eHalStatus halStatus; |
| 5259 | void *pPacket; |
| 5260 | tANI_U8 txFlag = 0; |
| 5261 | |
| 5262 | if(NULL == psessionEntry) |
| 5263 | { |
| 5264 | return eSIR_FAILURE; |
| 5265 | } |
| 5266 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5267 | vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5268 | |
| 5269 | // Category - 3 (BA) |
| 5270 | frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK; |
| 5271 | // Action - 2 (DELBA) |
| 5272 | frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL; |
| 5273 | |
| 5274 | // Fill the DELBA Parameter Set as provided by caller |
| 5275 | frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID; |
| 5276 | frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection; |
| 5277 | |
| 5278 | // BA Starting Sequence Number |
| 5279 | // Fragment number will always be zero |
| 5280 | frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode; |
| 5281 | |
| 5282 | nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload ); |
| 5283 | |
| 5284 | if( DOT11F_FAILED( nStatus )) |
| 5285 | { |
| 5286 | limLog( pMac, LOGW, |
| 5287 | FL( "Failed to calculate the packed size for " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5288 | "an DELBA Indication (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5289 | nStatus ); |
| 5290 | |
| 5291 | // We'll fall back on the worst case scenario: |
| 5292 | nPayload = sizeof( tDot11fDelBAInd ); |
| 5293 | } |
| 5294 | else if( DOT11F_WARNED( nStatus )) |
| 5295 | { |
| 5296 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5297 | FL( "There were warnings while calculating " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5298 | "the packed size for an DELBA Ind (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5299 | nStatus ); |
| 5300 | } |
| 5301 | |
| 5302 | // Add the MGMT header to frame length |
| 5303 | frameLen = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5304 | |
| 5305 | // Allocate shared memory |
| 5306 | if( eHAL_STATUS_SUCCESS != |
| 5307 | (halStatus = palPktAlloc( pMac->hHdd, |
| 5308 | HAL_TXRX_FRM_802_11_MGMT, |
| 5309 | (tANI_U16) frameLen, |
| 5310 | (void **) &pDelBAIndBuffer, |
| 5311 | (void **) &pPacket ))) |
| 5312 | { |
| 5313 | // Log error |
| 5314 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5315 | FL("palPktAlloc FAILED! Length [%d], Status [%d]"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5316 | frameLen, |
| 5317 | halStatus ); |
| 5318 | |
| 5319 | statusCode = eSIR_MEM_ALLOC_FAILED; |
| 5320 | goto returnAfterError; |
| 5321 | } |
| 5322 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5323 | vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5324 | |
| 5325 | // Copy necessary info to BD |
| 5326 | if( eSIR_SUCCESS != |
| 5327 | (statusCode = limPopulateMacHeader( pMac, |
| 5328 | pDelBAIndBuffer, |
| 5329 | SIR_MAC_MGMT_FRAME, |
| 5330 | SIR_MAC_MGMT_ACTION, |
| 5331 | pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr))) |
| 5332 | goto returnAfterError; |
| 5333 | |
| 5334 | // Update A3 with the BSSID |
| 5335 | pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer; |
| 5336 | |
| 5337 | #if 0 |
| 5338 | cfgLen = SIR_MAC_ADDR_LENGTH; |
| 5339 | if( eSIR_SUCCESS != cfgGetStr( pMac, |
| 5340 | WNI_CFG_BSSID, |
| 5341 | (tANI_U8 *) pMacHdr->bssId, |
| 5342 | &cfgLen )) |
| 5343 | { |
| 5344 | limLog( pMac, LOGP, |
| 5345 | FL( "Failed to retrieve WNI_CFG_BSSID while" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5346 | "sending an ACTION Frame" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5347 | |
| 5348 | // FIXME - Need to convert to tSirRetStatus |
| 5349 | statusCode = eSIR_FAILURE; |
| 5350 | goto returnAfterError; |
| 5351 | } |
| 5352 | #endif //TO SUPPORT BT-AMP |
| 5353 | sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId); |
| 5354 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5355 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5356 | limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5357 | #endif |
| 5358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5359 | // Now, we're ready to "pack" the frames |
| 5360 | nStatus = dot11fPackDelBAInd( pMac, |
| 5361 | &frmDelBAInd, |
| 5362 | pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ), |
| 5363 | nPayload, |
| 5364 | &nPayload ); |
| 5365 | |
| 5366 | if( DOT11F_FAILED( nStatus )) |
| 5367 | { |
| 5368 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5369 | FL( "Failed to pack an DELBA Ind (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5370 | nStatus ); |
| 5371 | |
| 5372 | // FIXME - Need to convert to tSirRetStatus |
| 5373 | statusCode = eSIR_FAILURE; |
| 5374 | goto returnAfterError; |
| 5375 | } |
| 5376 | else if( DOT11F_WARNED( nStatus )) |
| 5377 | { |
| 5378 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5379 | FL( "There were warnings while packing an DELBA Ind (0x%08x)." ), |
| 5380 | nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | } |
| 5382 | |
| 5383 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5384 | FL( "Sending a DELBA IND to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5385 | limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW ); |
| 5386 | |
| 5387 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5388 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5389 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5390 | ) |
| 5391 | { |
| 5392 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5393 | } |
| 5394 | |
| 5395 | if( eHAL_STATUS_SUCCESS != |
| 5396 | (halStatus = halTxFrame( pMac, |
| 5397 | pPacket, |
| 5398 | (tANI_U16) frameLen, |
| 5399 | HAL_TXRX_FRM_802_11_MGMT, |
| 5400 | ANI_TXDIR_TODS, |
| 5401 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5402 | limTxComplete, |
| 5403 | pDelBAIndBuffer, txFlag ))) |
| 5404 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5405 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5406 | statusCode = eSIR_FAILURE; |
| 5407 | //Pkt will be freed up by the callback |
| 5408 | return statusCode; |
| 5409 | } |
| 5410 | else |
| 5411 | return eSIR_SUCCESS; |
| 5412 | |
| 5413 | returnAfterError: |
| 5414 | |
| 5415 | // Release buffer, if allocated |
| 5416 | if( NULL != pDelBAIndBuffer ) |
| 5417 | palPktFree( pMac->hHdd, |
| 5418 | HAL_TXRX_FRM_802_11_MGMT, |
| 5419 | (void *) pDelBAIndBuffer, |
| 5420 | (void *) pPacket ); |
| 5421 | |
| 5422 | return statusCode; |
| 5423 | } |
| 5424 | |
| 5425 | #if defined WLAN_FEATURE_VOWIFI |
| 5426 | |
| 5427 | /** |
| 5428 | * \brief Send a Neighbor Report Request Action frame |
| 5429 | * |
| 5430 | * |
| 5431 | * \param pMac Pointer to the global MAC structure |
| 5432 | * |
| 5433 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 5434 | * |
| 5435 | * \param peer mac address of peer station. |
| 5436 | * |
| 5437 | * \param psessionEntry address of session entry. |
| 5438 | * |
| 5439 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5440 | * |
| 5441 | * |
| 5442 | */ |
| 5443 | |
| 5444 | tSirRetStatus |
| 5445 | limSendNeighborReportRequestFrame(tpAniSirGlobal pMac, |
| 5446 | tpSirMacNeighborReportReq pNeighborReq, |
| 5447 | tSirMacAddr peer, |
| 5448 | tpPESession psessionEntry |
| 5449 | ) |
| 5450 | { |
| 5451 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 5452 | tDot11fNeighborReportRequest frm; |
| 5453 | tANI_U8 *pFrame; |
| 5454 | tpSirMacMgmtHdr pMacHdr; |
| 5455 | tANI_U32 nBytes, nPayload, nStatus; |
| 5456 | void *pPacket; |
| 5457 | eHalStatus halstatus; |
| 5458 | tANI_U8 txFlag = 0; |
| 5459 | |
| 5460 | if ( psessionEntry == NULL ) |
| 5461 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5462 | 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] | 5463 | return eSIR_FAILURE; |
| 5464 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5465 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5466 | |
| 5467 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5468 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 5469 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 5470 | |
| 5471 | |
| 5472 | if( pNeighborReq->ssid_present ) |
| 5473 | { |
| 5474 | PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID ); |
| 5475 | } |
| 5476 | |
| 5477 | nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload ); |
| 5478 | if ( DOT11F_FAILED( nStatus ) ) |
| 5479 | { |
| 5480 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5481 | "or a Neighbor Report Request(0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5482 | nStatus ); |
| 5483 | // We'll fall back on the worst case scenario: |
| 5484 | nPayload = sizeof( tDot11fNeighborReportRequest ); |
| 5485 | } |
| 5486 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5487 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5488 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5489 | "the packed size for a Neighbor Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5490 | "ort Request(0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5491 | } |
| 5492 | |
| 5493 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5494 | |
| 5495 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5496 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5497 | { |
| 5498 | 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] | 5499 | "Report Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5500 | return eSIR_FAILURE; |
| 5501 | } |
| 5502 | |
| 5503 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5504 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5505 | |
| 5506 | // Copy necessary info to BD |
| 5507 | if( eSIR_SUCCESS != |
| 5508 | (statusCode = limPopulateMacHeader( pMac, |
| 5509 | pFrame, |
| 5510 | SIR_MAC_MGMT_FRAME, |
| 5511 | SIR_MAC_MGMT_ACTION, |
| 5512 | peer, psessionEntry->selfMacAddr))) |
| 5513 | goto returnAfterError; |
| 5514 | |
| 5515 | // Update A3 with the BSSID |
| 5516 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5517 | |
| 5518 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5519 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5520 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5521 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5522 | #endif |
| 5523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5524 | // Now, we're ready to "pack" the frames |
| 5525 | nStatus = dot11fPackNeighborReportRequest( pMac, |
| 5526 | &frm, |
| 5527 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5528 | nPayload, |
| 5529 | &nPayload ); |
| 5530 | |
| 5531 | if( DOT11F_FAILED( nStatus )) |
| 5532 | { |
| 5533 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5534 | FL( "Failed to pack an Neighbor Report Request (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5535 | nStatus ); |
| 5536 | |
| 5537 | // FIXME - Need to convert to tSirRetStatus |
| 5538 | statusCode = eSIR_FAILURE; |
| 5539 | goto returnAfterError; |
| 5540 | } |
| 5541 | else if( DOT11F_WARNED( nStatus )) |
| 5542 | { |
| 5543 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5544 | FL( "There were warnings while packing Neighbor Report " |
| 5545 | "Request (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5546 | } |
| 5547 | |
| 5548 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5549 | FL( "Sending a Neighbor Report Request to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5550 | limPrintMacAddr( pMac, peer, LOGW ); |
| 5551 | |
| 5552 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5553 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5554 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5555 | ) |
| 5556 | { |
| 5557 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5558 | } |
| 5559 | |
| 5560 | if( eHAL_STATUS_SUCCESS != |
| 5561 | (halstatus = halTxFrame( pMac, |
| 5562 | pPacket, |
| 5563 | (tANI_U16) nBytes, |
| 5564 | HAL_TXRX_FRM_802_11_MGMT, |
| 5565 | ANI_TXDIR_TODS, |
| 5566 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5567 | limTxComplete, |
| 5568 | pFrame, txFlag ))) |
| 5569 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5570 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5571 | statusCode = eSIR_FAILURE; |
| 5572 | //Pkt will be freed up by the callback |
| 5573 | return statusCode; |
| 5574 | } |
| 5575 | else |
| 5576 | return eSIR_SUCCESS; |
| 5577 | |
| 5578 | returnAfterError: |
| 5579 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5580 | |
| 5581 | return statusCode; |
| 5582 | } // End limSendNeighborReportRequestFrame. |
| 5583 | |
| 5584 | /** |
| 5585 | * \brief Send a Link Report Action frame |
| 5586 | * |
| 5587 | * |
| 5588 | * \param pMac Pointer to the global MAC structure |
| 5589 | * |
| 5590 | * \param pLinkReport Address of a tSirMacLinkReport |
| 5591 | * |
| 5592 | * \param peer mac address of peer station. |
| 5593 | * |
| 5594 | * \param psessionEntry address of session entry. |
| 5595 | * |
| 5596 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5597 | * |
| 5598 | * |
| 5599 | */ |
| 5600 | |
| 5601 | tSirRetStatus |
| 5602 | limSendLinkReportActionFrame(tpAniSirGlobal pMac, |
| 5603 | tpSirMacLinkReport pLinkReport, |
| 5604 | tSirMacAddr peer, |
| 5605 | tpPESession psessionEntry |
| 5606 | ) |
| 5607 | { |
| 5608 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 5609 | tDot11fLinkMeasurementReport frm; |
| 5610 | tANI_U8 *pFrame; |
| 5611 | tpSirMacMgmtHdr pMacHdr; |
| 5612 | tANI_U32 nBytes, nPayload, nStatus; |
| 5613 | void *pPacket; |
| 5614 | eHalStatus halstatus; |
| 5615 | tANI_U8 txFlag = 0; |
| 5616 | |
| 5617 | |
| 5618 | if ( psessionEntry == NULL ) |
| 5619 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5620 | 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] | 5621 | return eSIR_FAILURE; |
| 5622 | } |
| 5623 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5624 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5625 | |
| 5626 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 5627 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 5628 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 5629 | |
| 5630 | |
| 5631 | //IEEE Std. 802.11 7.3.2.18. for the report element. |
| 5632 | //Even though TPC report an IE, it is represented using fixed fields since it is positioned |
| 5633 | //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 |
| 5634 | //and frame parser always expects IEs to come after all fixed fields. It is easier to handle |
| 5635 | //such case this way than changing the frame parser. |
| 5636 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 5637 | frm.TPCEleLen.TPCLen = 2; |
| 5638 | frm.TxPower.txPower = pLinkReport->txPower; |
| 5639 | frm.LinkMargin.linkMargin = 0; |
| 5640 | |
| 5641 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 5642 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 5643 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 5644 | frm.RSNI.rsni = pLinkReport->rsni; |
| 5645 | |
| 5646 | nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload ); |
| 5647 | if ( DOT11F_FAILED( nStatus ) ) |
| 5648 | { |
| 5649 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5650 | "or a Link Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | nStatus ); |
| 5652 | // We'll fall back on the worst case scenario: |
| 5653 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
| 5654 | } |
| 5655 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5656 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5657 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5658 | "the packed size for a Link Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5659 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5660 | } |
| 5661 | |
| 5662 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5663 | |
| 5664 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5665 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5666 | { |
| 5667 | 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] | 5668 | "Report."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | return eSIR_FAILURE; |
| 5670 | } |
| 5671 | |
| 5672 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5673 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5674 | |
| 5675 | // Copy necessary info to BD |
| 5676 | if( eSIR_SUCCESS != |
| 5677 | (statusCode = limPopulateMacHeader( pMac, |
| 5678 | pFrame, |
| 5679 | SIR_MAC_MGMT_FRAME, |
| 5680 | SIR_MAC_MGMT_ACTION, |
| 5681 | peer, psessionEntry->selfMacAddr))) |
| 5682 | goto returnAfterError; |
| 5683 | |
| 5684 | // Update A3 with the BSSID |
| 5685 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5686 | |
| 5687 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5688 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5689 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5690 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5691 | #endif |
| 5692 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5693 | // Now, we're ready to "pack" the frames |
| 5694 | nStatus = dot11fPackLinkMeasurementReport( pMac, |
| 5695 | &frm, |
| 5696 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5697 | nPayload, |
| 5698 | &nPayload ); |
| 5699 | |
| 5700 | if( DOT11F_FAILED( nStatus )) |
| 5701 | { |
| 5702 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5703 | FL( "Failed to pack an Link Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5704 | nStatus ); |
| 5705 | |
| 5706 | // FIXME - Need to convert to tSirRetStatus |
| 5707 | statusCode = eSIR_FAILURE; |
| 5708 | goto returnAfterError; |
| 5709 | } |
| 5710 | else if( DOT11F_WARNED( nStatus )) |
| 5711 | { |
| 5712 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5713 | FL( "There were warnings while packing Link Report (0x%08x)." ), |
| 5714 | nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5715 | } |
| 5716 | |
| 5717 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5718 | FL( "Sending a Link Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5719 | limPrintMacAddr( pMac, peer, LOGW ); |
| 5720 | |
| 5721 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5722 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5723 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | ) |
| 5725 | { |
| 5726 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5727 | } |
| 5728 | |
| 5729 | if( eHAL_STATUS_SUCCESS != |
| 5730 | (halstatus = halTxFrame( pMac, |
| 5731 | pPacket, |
| 5732 | (tANI_U16) nBytes, |
| 5733 | HAL_TXRX_FRM_802_11_MGMT, |
| 5734 | ANI_TXDIR_TODS, |
| 5735 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5736 | limTxComplete, |
| 5737 | pFrame, txFlag ))) |
| 5738 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5739 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5740 | statusCode = eSIR_FAILURE; |
| 5741 | //Pkt will be freed up by the callback |
| 5742 | return statusCode; |
| 5743 | } |
| 5744 | else |
| 5745 | return eSIR_SUCCESS; |
| 5746 | |
| 5747 | returnAfterError: |
| 5748 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 5749 | |
| 5750 | return statusCode; |
| 5751 | } // End limSendLinkReportActionFrame. |
| 5752 | |
| 5753 | /** |
| 5754 | * \brief Send a Beacon Report Action frame |
| 5755 | * |
| 5756 | * |
| 5757 | * \param pMac Pointer to the global MAC structure |
| 5758 | * |
| 5759 | * \param dialog_token dialog token to be used in the action frame. |
| 5760 | * |
| 5761 | * \param num_report number of reports in pRRMReport. |
| 5762 | * |
| 5763 | * \param pRRMReport Address of a tSirMacRadioMeasureReport. |
| 5764 | * |
| 5765 | * \param peer mac address of peer station. |
| 5766 | * |
| 5767 | * \param psessionEntry address of session entry. |
| 5768 | * |
| 5769 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 5770 | * |
| 5771 | * |
| 5772 | */ |
| 5773 | |
| 5774 | tSirRetStatus |
| 5775 | limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac, |
| 5776 | tANI_U8 dialog_token, |
| 5777 | tANI_U8 num_report, |
| 5778 | tpSirMacRadioMeasureReport pRRMReport, |
| 5779 | tSirMacAddr peer, |
| 5780 | tpPESession psessionEntry |
| 5781 | ) |
| 5782 | { |
| 5783 | tSirRetStatus statusCode = eSIR_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5784 | tANI_U8 *pFrame; |
| 5785 | tpSirMacMgmtHdr pMacHdr; |
| 5786 | tANI_U32 nBytes, nPayload, nStatus; |
| 5787 | void *pPacket; |
| 5788 | eHalStatus halstatus; |
| 5789 | tANI_U8 i; |
| 5790 | tANI_U8 txFlag = 0; |
| 5791 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5792 | tDot11fRadioMeasurementReport *frm = |
| 5793 | vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
| 5794 | if (!frm) { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5795 | limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5796 | return eSIR_FAILURE; |
| 5797 | } |
| 5798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5799 | if ( psessionEntry == NULL ) |
| 5800 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5801 | 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] | 5802 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5803 | return eSIR_FAILURE; |
| 5804 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5805 | vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5806 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5807 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 5808 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 5809 | frm->DialogToken.token = dialog_token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5810 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5811 | 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] | 5812 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5813 | for( i = 0 ; i < frm->num_MeasurementReport ; i++ ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5814 | { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5815 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 5816 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 5817 | 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] | 5818 | switch( pRRMReport[i].type ) |
| 5819 | { |
| 5820 | case SIR_MAC_RRM_BEACON_TYPE: |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5821 | PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport ); |
| 5822 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 5823 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
| 5824 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5825 | break; |
| 5826 | default: |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 5827 | frm->MeasurementReport[i].incapable = pRRMReport[i].incapable; |
| 5828 | frm->MeasurementReport[i].refused = pRRMReport[i].refused; |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5829 | frm->MeasurementReport[i].present = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5830 | break; |
| 5831 | } |
| 5832 | } |
| 5833 | |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5834 | nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5835 | if ( DOT11F_FAILED( nStatus ) ) |
| 5836 | { |
| 5837 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5838 | "or a Radio Measure Report (0x%08x)."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5839 | nStatus ); |
| 5840 | // We'll fall back on the worst case scenario: |
| 5841 | nPayload = sizeof( tDot11fLinkMeasurementReport ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5842 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5843 | return eSIR_FAILURE; |
| 5844 | } |
| 5845 | else if ( DOT11F_WARNED( nStatus ) ) |
| 5846 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5847 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5848 | "the packed size for a Radio Measure Rep" |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5849 | "ort (0x%08x)."), nStatus ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5850 | } |
| 5851 | |
| 5852 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 5853 | |
| 5854 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 5855 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 5856 | { |
| 5857 | 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] | 5858 | "Report."), nBytes ); |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5859 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | return eSIR_FAILURE; |
| 5861 | } |
| 5862 | |
| 5863 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5864 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5865 | |
| 5866 | // Copy necessary info to BD |
| 5867 | if( eSIR_SUCCESS != |
| 5868 | (statusCode = limPopulateMacHeader( pMac, |
| 5869 | pFrame, |
| 5870 | SIR_MAC_MGMT_FRAME, |
| 5871 | SIR_MAC_MGMT_ACTION, |
| 5872 | peer, psessionEntry->selfMacAddr))) |
| 5873 | goto returnAfterError; |
| 5874 | |
| 5875 | // Update A3 with the BSSID |
| 5876 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 5877 | |
| 5878 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
| 5879 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5880 | #ifdef WLAN_FEATURE_11W |
Chet Lanctot | 4b9abd7 | 2013-06-27 11:14:56 -0700 | [diff] [blame] | 5881 | limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5882 | #endif |
| 5883 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5884 | // Now, we're ready to "pack" the frames |
| 5885 | nStatus = dot11fPackRadioMeasurementReport( pMac, |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5886 | frm, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5887 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 5888 | nPayload, |
| 5889 | &nPayload ); |
| 5890 | |
| 5891 | if( DOT11F_FAILED( nStatus )) |
| 5892 | { |
| 5893 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5894 | FL( "Failed to pack an Radio Measure Report (0x%08x)." ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | nStatus ); |
| 5896 | |
| 5897 | // FIXME - Need to convert to tSirRetStatus |
| 5898 | statusCode = eSIR_FAILURE; |
| 5899 | goto returnAfterError; |
| 5900 | } |
| 5901 | else if( DOT11F_WARNED( nStatus )) |
| 5902 | { |
| 5903 | limLog( pMac, LOGW, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5904 | FL( "There were warnings while packing Radio " |
| 5905 | "Measure Report (0x%08x)." ), nStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5906 | } |
| 5907 | |
| 5908 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5909 | FL( "Sending a Radio Measure Report to " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5910 | limPrintMacAddr( pMac, peer, LOGW ); |
| 5911 | |
| 5912 | if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5913 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 5914 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5915 | ) |
| 5916 | { |
| 5917 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 5918 | } |
| 5919 | |
| 5920 | if( eHAL_STATUS_SUCCESS != |
| 5921 | (halstatus = halTxFrame( pMac, |
| 5922 | pPacket, |
| 5923 | (tANI_U16) nBytes, |
| 5924 | HAL_TXRX_FRM_802_11_MGMT, |
| 5925 | ANI_TXDIR_TODS, |
| 5926 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 5927 | limTxComplete, |
| 5928 | pFrame, txFlag ))) |
| 5929 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 5930 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5931 | statusCode = eSIR_FAILURE; |
| 5932 | //Pkt will be freed up by the callback |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5933 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5934 | return statusCode; |
| 5935 | } |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 5936 | else { |
Madan Mohan Koyyalamudi | 8f207c1 | 2012-10-30 18:18:38 -0700 | [diff] [blame] | 5937 | vos_mem_free(frm); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5938 | return eSIR_SUCCESS; |
Madan Mohan Koyyalamudi | eeb56b1 | 2012-10-31 15:10:04 -0700 | [diff] [blame] | 5939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | |
| 5941 | returnAfterError: |
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 | 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] | 5944 | return statusCode; |
| 5945 | } // End limSendBeaconReportActionFrame. |
| 5946 | |
| 5947 | #endif |
| 5948 | |
| 5949 | #ifdef WLAN_FEATURE_11W |
| 5950 | /** |
| 5951 | * \brief Send SA query response action frame to peer |
| 5952 | * |
| 5953 | * \sa limSendSaQueryResponseFrame |
| 5954 | * |
| 5955 | * |
| 5956 | * \param pMac The global tpAniSirGlobal object |
| 5957 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5958 | * \param transId Transaction identifier received in SA query request action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | * |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5960 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 5961 | * |
| 5962 | * \param psessionEntry The PE session entry |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5963 | * |
| 5964 | * \return eSIR_SUCCESS if setup completes successfully |
| 5965 | * eSIR_FAILURE is some problem is encountered |
| 5966 | */ |
| 5967 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5968 | tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5969 | tSirMacAddr peer,tpPESession psessionEntry) |
| 5970 | { |
| 5971 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5972 | tDot11fSaQueryRsp frm; // SA query reponse action frame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5973 | tANI_U8 *pFrame; |
| 5974 | tSirRetStatus nSirStatus; |
| 5975 | tpSirMacMgmtHdr pMacHdr; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5976 | tANI_U32 nBytes, nPayload, nStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5977 | void *pPacket; |
| 5978 | eHalStatus halstatus; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5979 | tANI_U8 txFlag = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5980 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 5981 | vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5982 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 5983 | /*11w action field is : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5984 | action: 0 --> SA query request action frame |
| 5985 | action: 1 --> SA query response action frame */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5986 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 5987 | /*11w SA query response transId is same as |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | SA query request transId*/ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5989 | vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5990 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5991 | nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload); |
| 5992 | if ( DOT11F_FAILED( nStatus ) ) |
| 5993 | { |
| 5994 | limLog( pMac, LOGP, FL("Failed to calculate the packed size f" |
| 5995 | "or a SA Query Response (0x%08x)."), |
| 5996 | nStatus ); |
| 5997 | // We'll fall back on the worst case scenario: |
| 5998 | nPayload = sizeof( tDot11fSaQueryRsp ); |
| 5999 | } |
| 6000 | else if ( DOT11F_WARNED( nStatus ) ) |
| 6001 | { |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 6002 | limLog( pMac, LOGW, FL("There were warnings while calculating " |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6003 | "the packed size for an SA Query Response" |
| 6004 | " (0x%08x)."), nStatus ); |
| 6005 | } |
| 6006 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6007 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 6008 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); |
| 6009 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 6010 | { |
| 6011 | 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] | 6012 | " action frame"), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6013 | return eSIR_FAILURE; |
| 6014 | } |
| 6015 | |
| 6016 | // Paranoia: |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 6017 | vos_mem_set( pFrame, nBytes, 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6018 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6019 | // Copy necessary info to BD |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6020 | nSirStatus = limPopulateMacHeader( pMac, |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6021 | pFrame, |
| 6022 | SIR_MAC_MGMT_FRAME, |
| 6023 | SIR_MAC_MGMT_ACTION, |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6024 | peer, psessionEntry->selfMacAddr ); |
| 6025 | if ( eSIR_SUCCESS != nSirStatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6026 | goto returnAfterError; |
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 | // Update A3 with the BSSID |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6029 | pMacHdr = ( tpSirMacMgmtHdr ) pFrame; |
| 6030 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6031 | sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6032 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6033 | // Since this is a SA Query Response, set the "protect" (aka WEP) bit |
| 6034 | // in the FC |
| 6035 | if ( psessionEntry->limRmfEnabled ) |
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 | pMacHdr->fc.wep = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | } |
| 6039 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6040 | // Pack 11w SA query response frame |
| 6041 | nStatus = dot11fPackSaQueryRsp( pMac, |
| 6042 | &frm, |
| 6043 | pFrame + sizeof( tSirMacMgmtHdr ), |
| 6044 | nPayload, |
| 6045 | &nPayload ); |
| 6046 | |
| 6047 | if ( DOT11F_FAILED( nStatus )) |
| 6048 | { |
| 6049 | limLog( pMac, LOGE, |
| 6050 | FL( "Failed to pack an SA Query Response (0x%08x)." ), |
| 6051 | nStatus ); |
| 6052 | // FIXME - Need to convert to tSirRetStatus |
| 6053 | nSirStatus = eSIR_FAILURE; |
| 6054 | goto returnAfterError; |
| 6055 | } |
| 6056 | else if ( DOT11F_WARNED( nStatus )) |
| 6057 | { |
| 6058 | limLog( pMac, LOGW, |
| 6059 | FL( "There were warnings while packing SA Query Response (0x%08x)." ), |
| 6060 | nStatus); |
| 6061 | } |
| 6062 | |
| 6063 | limLog( pMac, LOG1, |
| 6064 | FL( "Sending a SA Query Response to " )); |
| 6065 | limPrintMacAddr( pMac, peer, LOGW ); |
| 6066 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6067 | if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6068 | #ifdef WLAN_FEATURE_P2P |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6069 | || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) || |
| 6070 | ( psessionEntry->pePersona == VOS_P2P_GO_MODE ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6071 | #endif |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6072 | ) |
| 6073 | { |
| 6074 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 6075 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6076 | |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 6077 | halstatus = halTxFrame( pMac, |
| 6078 | pPacket, |
| 6079 | (tANI_U16) nBytes, |
| 6080 | HAL_TXRX_FRM_802_11_MGMT, |
| 6081 | ANI_TXDIR_TODS, |
| 6082 | 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, |
| 6083 | limTxComplete, |
| 6084 | pFrame, txFlag ); |
| 6085 | if ( eHAL_STATUS_SUCCESS != halstatus ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6086 | { |
| 6087 | PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );) |
| 6088 | nSirStatus = eSIR_FAILURE; |
| 6089 | //Pkt will be freed up by the callback |
| 6090 | return nSirStatus; |
| 6091 | } |
| 6092 | else { |
| 6093 | return eSIR_SUCCESS; |
| 6094 | } |
| 6095 | |
| 6096 | returnAfterError: |
| 6097 | palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); |
| 6098 | return nSirStatus; |
| 6099 | } // End limSendSaQueryResponseFrame |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6100 | #endif |