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