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