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