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