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