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