blob: 5573d39713bbfc5d514c63ae0c82fbbc70867f4d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08003 *
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 Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
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 Johnson295189b2012-06-20 16:38:30 -070041/**
42 * \file limSendManagementFrames.c
43 *
44 * \brief Code for preparing and sending 802.11 Management frames
45 *
Jeff Johnson295189b2012-06-20 16:38:30 -070046 *
47 */
48
49#include "sirApi.h"
50#include "aniGlobal.h"
51#include "sirMacProtDef.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070052#include "cfgApi.h"
53#include "utilsApi.h"
54#include "limTypes.h"
55#include "limUtils.h"
56#include "limSecurityUtils.h"
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -070057#include "limPropExtsUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070058#include "dot11f.h"
59#include "limStaHashApi.h"
60#include "schApi.h"
61#include "limSendMessages.h"
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -080062#include "limAssocUtils.h"
63#include "limFT.h"
64
Jeff Johnson295189b2012-06-20 16:38:30 -070065#if defined WLAN_FEATURE_VOWIFI
66#include "rrmApi.h"
67#endif
68
Jeff Johnson295189b2012-06-20 16:38:30 -070069#include "wlan_qct_wda.h"
70#ifdef WLAN_FEATURE_11W
71#include "dot11fdefs.h"
72#endif
73
74
75////////////////////////////////////////////////////////////////////////
76
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78/**
79 *
80 * \brief This function is called by various LIM modules to prepare the
81 * 802.11 frame MAC header
82 *
83 *
84 * \param pMac Pointer to Global MAC structure
85 *
86 * \param pBD Pointer to the frame buffer that needs to be populate
87 *
88 * \param type Type of the frame
89 *
90 * \param subType Subtype of the frame
91 *
92 * \return eHalStatus
93 *
94 *
95 * The pFrameBuf argument points to the beginning of the frame buffer to
96 * which - a) The 802.11 MAC header is set b) Following this MAC header
97 * will be the MGMT frame payload The payload itself is populated by the
98 * caller API
99 *
100 *
101 */
102
103tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac,
104 tANI_U8* pBD,
105 tANI_U8 type,
106 tANI_U8 subType,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530107 tSirMacAddr peerAddr, tSirMacAddr selfMacAddr)
Jeff Johnson295189b2012-06-20 16:38:30 -0700108{
109 tSirRetStatus statusCode = eSIR_SUCCESS;
110 tpSirMacMgmtHdr pMacHdr;
111
112 /// Prepare MAC management header
113 pMacHdr = (tpSirMacMgmtHdr) (pBD);
114
115 // Prepare FC
116 pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
117 pMacHdr->fc.type = type;
118 pMacHdr->fc.subType = subType;
119
120 // Prepare Address 1
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530121 vos_mem_copy( (tANI_U8 *) pMacHdr->da,
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 (tANI_U8 *) peerAddr,
123 sizeof( tSirMacAddr ));
124
125 // Prepare Address 2
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 sirCopyMacAddr(pMacHdr->sa,selfMacAddr);
127
128 // Prepare Address 3
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530129 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 (tANI_U8 *) peerAddr,
131 sizeof( tSirMacAddr ));
132 return statusCode;
133} /*** end limPopulateMacHeader() ***/
134
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700135#ifdef WLAN_FEATURE_11W
136/**
137 *
138 * \brief This function is called by various LIM modules to correctly set
139 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
140 *
141 *
142 * \param pMac Pointer to Global MAC structure
143 *
144 * \param psessionEntry Pointer to session corresponding to the connection
145 *
146 * \param peer Peer address of the STA to which the frame is to be sent
147 *
148 * \param pMacHdr Pointer to the frame MAC header
149 *
150 * \return nothing
151 *
152 *
153 */
154void
155limSetProtectedBit(tpAniSirGlobal pMac,
156 tpPESession psessionEntry,
157 tSirMacAddr peer,
158 tpSirMacMgmtHdr pMacHdr)
159{
160 tANI_U16 aid;
161 tpDphHashNode pStaDs;
162
163 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
164 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
165 {
166
167 pStaDs = dphLookupHashEntry( pMac, peer, &aid, &psessionEntry->dph.dphHashTable );
168 if( pStaDs != NULL )
169 if( pStaDs->rmfEnabled )
170 pMacHdr->fc.wep = 1;
171 }
172 else if ( psessionEntry->limRmfEnabled )
173 pMacHdr->fc.wep = 1;
174} /*** end limSetProtectedBit() ***/
175#endif
176
Jeff Johnson295189b2012-06-20 16:38:30 -0700177/**
178 * \brief limSendProbeReqMgmtFrame
179 *
180 *
181 * \param pMac Pointer to Global MAC structure
182 *
183 * \param pSsid SSID to be sent in Probe Request frame
184 *
185 * \param bssid BSSID to be sent in Probe Request frame
186 *
187 * \param nProbeDelay probe delay to be used before sending Probe Request
188 * frame
189 *
190 * \param nChannelNum Channel # on which the Probe Request is going out
191 *
192 * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame
193 *
194 * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame
195 *
196 * This function is called by various LIM modules to send Probe Request frame
197 * during active scan/learn phase.
198 * Probe request is sent out in the following scenarios:
199 * --heartbeat failure: session needed
200 * --join req: session needed
201 * --foreground scan: no session
202 * --background scan: no session
203 * --schBeaconProcessing: to get EDCA parameters: session needed
204 *
205 *
206 */
207tSirRetStatus
208limSendProbeReqMgmtFrame(tpAniSirGlobal pMac,
209 tSirMacSSid *pSsid,
210 tSirMacAddr bssid,
211 tANI_U8 nChannelNum,
212 tSirMacAddr SelfMacAddr,
213 tANI_U32 dot11mode,
214 tANI_U32 nAdditionalIELen,
215 tANI_U8 *pAdditionalIE)
216{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530217 tDot11fProbeRequest pr;
218 tANI_U32 nStatus, nBytes, nPayload;
219 tSirRetStatus nSirStatus;
220 tANI_U8 *pFrame;
221 void *pPacket;
222 eHalStatus halstatus;
223 tpPESession psessionEntry;
224 tANI_U8 sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 tANI_U8 *p2pIe = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530226 tANI_U32 txFlag = 0;
Sandeep Puligilla60342762014-01-30 21:05:37 +0530227 tANI_U32 chanbond24G = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700228
229#ifndef GEN4_SCAN
230 return eSIR_FAILURE;
231#endif
232
233#if defined ( ANI_DVT_DEBUG )
234 return eSIR_FAILURE;
235#endif
236
237 /*
238 * session context may or may not be present, when probe request needs to be sent out.
239 * following cases exist:
240 * --heartbeat failure: session needed
241 * --join req: session needed
242 * --foreground scan: no session
243 * --background scan: no session
244 * --schBeaconProcessing: to get EDCA parameters: session needed
245 * If session context does not exist, some IEs will be populated from CFGs,
246 * e.g. Supported and Extended rate set IEs
247 */
248 psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId);
249
250 // The scheme here is to fill out a 'tDot11fProbeRequest' structure
251 // and then hand it off to 'dot11fPackProbeRequest' (for
252 // serialization). We start by zero-initializing the structure:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530253 vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700254
255 // & delegating to assorted helpers:
256 PopulateDot11fSSID( pMac, pSsid, &pr.SSID );
257
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 if( nAdditionalIELen && pAdditionalIE )
259 {
260 p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen);
261 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700262 /* Don't include 11b rate only when device is doing P2P Search */
263 if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) &&
264 ( p2pIe != NULL ) &&
265 /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */
266 ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
267 pMac->lim.gpLimMlmScanReq->p2pSearch ) ||
268 ( ( psessionEntry != NULL ) &&
269 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
270 )
271 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 {
273 /* In the below API pass channel number > 14, do that it fills only
274 * 11a rates in supported rates */
275 PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry);
276 }
277 else
278 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 PopulateDot11fSuppRates( pMac, nChannelNum,
280 &pr.SuppRates,psessionEntry);
281
282 if ( WNI_CFG_DOT11_MODE_11B != dot11mode )
283 {
284 PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates );
285 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700287
288#if defined WLAN_FEATURE_VOWIFI
289 //Table 7-14 in IEEE Std. 802.11k-2008 says
290 //DS params "can" be present in RRM is disabled and "is" present if
291 //RRM is enabled. It should be ok even if we add it into probe req when
292 //RRM is not enabled.
293 PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry );
294 //Call RRM module to get the tx power for management used.
295 {
296 tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry );
297 PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 );
298 }
299#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700300
301 if (psessionEntry != NULL ) {
Jeff Johnsone7245742012-09-05 17:12:55 -0700302 psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 //Include HT Capability IE
Jeff Johnsone7245742012-09-05 17:12:55 -0700304 if (psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700306 PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700308 } else { //psessionEntry == NULL
309 if (IS_DOT11_MODE_HT(dot11mode))
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700311 PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 }
313 }
Gopichand Nakkala40bc6502012-12-20 16:55:36 -0800314
Sandeep Puligilla60342762014-01-30 21:05:37 +0530315 /* Get HT40 capability for 2.4GHz band */
316 wlan_cfgGetInt(pMac,WNI_CFG_CHANNEL_BONDING_24G,&chanbond24G);
317 if( (nChannelNum <= SIR_11B_CHANNEL_END) && chanbond24G != TRUE)
Gopichand Nakkala40bc6502012-12-20 16:55:36 -0800318 {
319 pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
320 pr.HTCaps.shortGI40MHz = 0;
321 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700322#ifdef WLAN_FEATURE_11AC
323 if (psessionEntry != NULL ) {
324 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode);
325 //Include HT Capability IE
326 if (psessionEntry->vhtCapability)
327 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700328 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
329 }
330 } else {
331 if (IS_DOT11_MODE_VHT(dot11mode))
332 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700333 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
334 }
335 }
336#endif
337
Jeff Johnson295189b2012-06-20 16:38:30 -0700338
339 // That's it-- now we pack it. First, how much space are we going to
340 // need?
341 nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload );
342 if ( DOT11F_FAILED( nStatus ) )
343 {
344 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 "or a Probe Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 // We'll fall back on the worst case scenario:
347 nPayload = sizeof( tDot11fProbeRequest );
348 }
349 else if ( DOT11F_WARNED( nStatus ) )
350 {
351 limLog( pMac, LOGW, FL("There were warnings while calculating"
352 "the packed size for a Probe Request ("
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 "0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 }
355
356 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen;
357
358 // Ok-- try to allocate some memory:
359 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
360 ( tANI_U16 )nBytes, ( void** ) &pFrame,
361 ( void** ) &pPacket );
362 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
363 {
364 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 "be Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 return eSIR_MEM_ALLOC_FAILED;
367 }
368
369 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530370 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700371
372 // Next, we fill out the buffer descriptor:
373 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530374 SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 if ( eSIR_SUCCESS != nSirStatus )
376 {
377 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700378 "tor for a Probe Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 nSirStatus );
380 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
381 ( void* ) pFrame, ( void* ) pPacket );
382 return nSirStatus; // allocated!
383 }
384
385 // That done, pack the Probe Request:
386 nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame +
387 sizeof( tSirMacMgmtHdr ),
388 nPayload, &nPayload );
389 if ( DOT11F_FAILED( nStatus ) )
390 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700391 limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 nStatus );
393 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
394 return eSIR_FAILURE; // allocated!
395 }
396 else if ( DOT11F_WARNED( nStatus ) )
397 {
398 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800399 "robe Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 }
401
402 // Append any AddIE if present.
403 if( nAdditionalIELen )
404 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530405 vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 pAdditionalIE, nAdditionalIELen );
407 nPayload += nAdditionalIELen;
408 }
409
410 /* If this probe request is sent during P2P Search State, then we need
411 * to send it at OFDM rate.
412 */
413 if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum))
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 || (( pMac->lim.gpLimMlmScanReq != NULL) &&
415 pMac->lim.gpLimMlmScanReq->p2pSearch )
Gopichand Nakkala67967212013-02-15 17:31:15 +0530416 /* For unicast probe req mgmt from Join function
417 we don't set above variables. So we need to add
418 one more check whether it is pePersona is P2P_CLIENT or not */
419 || ( ( psessionEntry != NULL ) &&
420 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 )
422 {
423 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
424 }
425
426
427 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload,
428 HAL_TXRX_FRM_802_11_MGMT,
429 ANI_TXDIR_TODS,
430 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
431 limTxComplete, pFrame, txFlag );
432 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
433 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700434 limLog( pMac, LOGE, FL("could not send Probe Request frame!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 //Pkt will be freed up by the callback
436 return eSIR_FAILURE;
437 }
438
439 return eSIR_SUCCESS;
440} // End limSendProbeReqMgmtFrame.
441
Jeff Johnson295189b2012-06-20 16:38:30 -0700442tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac,
443 tANI_U8* addIE, tANI_U16 *addnIELen,
444 tANI_U8 probeReqP2pIe)
445{
446 /* If Probe request doesn't have P2P IE, then take out P2P IE
447 from additional IE */
448 if(!probeReqP2pIe)
449 {
450 tANI_U8* tempbuf = NULL;
451 tANI_U16 tempLen = 0;
452 int left = *addnIELen;
453 v_U8_t *ptr = addIE;
454 v_U8_t elem_id, elem_len;
455
456 if(NULL == addIE)
457 {
458 PELOGE(limLog(pMac, LOGE,
459 FL(" NULL addIE pointer"));)
460 return eSIR_FAILURE;
461 }
462
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530463 tempbuf = vos_mem_malloc(left);
464 if ( NULL == tempbuf )
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 {
466 PELOGE(limLog(pMac, LOGE,
467 FL("Unable to allocate memory to store addn IE"));)
468 return eSIR_MEM_ALLOC_FAILED;
469 }
470
471 while(left >= 2)
472 {
473 elem_id = ptr[0];
474 elem_len = ptr[1];
475 left -= 2;
476 if(elem_len > left)
477 {
478 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700479 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 elem_id,elem_len,left);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530481 vos_mem_free(tempbuf);
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 return eSIR_FAILURE;
483 }
484 if ( !( (SIR_MAC_EID_VENDOR == elem_id) &&
485 (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) )
486 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530487 vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2);
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 tempLen += (elem_len + 2);
489 }
490 left -= elem_len;
491 ptr += (elem_len + 2);
492 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530493 vos_mem_copy (addIE, tempbuf, tempLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 *addnIELen = tempLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530495 vos_mem_free(tempbuf);
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 }
497 return eSIR_SUCCESS;
498}
Jeff Johnson295189b2012-06-20 16:38:30 -0700499
500void
501limSendProbeRspMgmtFrame(tpAniSirGlobal pMac,
502 tSirMacAddr peerMacAddr,
503 tpAniSSID pSsid,
504 short nStaId,
505 tANI_U8 nKeepAlive,
506 tpPESession psessionEntry,
507 tANI_U8 probeReqP2pIe)
508{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700509 tDot11fProbeResponse *pFrm;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530510 tSirRetStatus nSirStatus;
511 tANI_U32 cfg, nPayload, nBytes, nStatus;
512 tpSirMacMgmtHdr pMacHdr;
513 tANI_U8 *pFrame;
514 void *pPacket;
515 eHalStatus halstatus;
516 tANI_U32 addnIEPresent;
517 tANI_U32 addnIE1Len=0;
518 tANI_U32 addnIE2Len=0;
519 tANI_U32 addnIE3Len=0;
520 tANI_U16 totalAddnIeLen = 0;
521 tANI_U32 wpsApEnable=0, tmp;
522 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 tANI_U8 *addIE = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530524 tANI_U8 *pP2pIe = NULL;
525 tANI_U8 noaLen = 0;
526 tANI_U8 total_noaLen = 0;
527 tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 + SIR_P2P_IE_HEADER_LEN];
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530529 tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
Jeff Johnson295189b2012-06-20 16:38:30 -0700530
531 if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests
532 {
533 return; // in this case.
534 }
535
536 if(NULL == psessionEntry)
537 {
538 return;
539 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530540
541 pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse));
542 if ( NULL == pFrm )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700543 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530544 limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700545 return;
546 }
547
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 // Fill out 'frm', after which we'll just hand the struct off to
549 // 'dot11fPackProbeResponse'.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530550 vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700551
552 // Timestamp to be updated by TFP, below.
553
554 // Beacon Interval:
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
556 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700557 pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 }
559 else
560 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800561 nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg);
562 if (eSIR_SUCCESS != nSirStatus)
563 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BEACON_INTERVAL from CFG (%d)."),
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800565 nSirStatus );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530566 vos_mem_free(pFrm);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800567 return;
568 }
569 pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg;
Madan Mohan Koyyalamudic0d1b3f2012-11-13 10:41:07 -0800570 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700571
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700572 PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry );
573 PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700575 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700576
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700577 PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry);
578 PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700579
Jeff Johnson295189b2012-06-20 16:38:30 -0700580
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
582 {
583 if(psessionEntry->wps_state != SAP_WPS_DISABLED)
584 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700585 PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 }
587 }
588 else
589 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800590 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_ENABLE );
Jeff Johnson295189b2012-06-20 16:38:30 -0700592
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800593 wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
Jeff Johnson295189b2012-06-20 16:38:30 -0700594
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800595 if (wpsApEnable)
596 {
597 PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes);
598 }
599
600 if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
601 {
602 PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
603 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
604 }
605
606 if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
607 {
608 DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
609 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
610 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700612
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700613 PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry);
614 PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700615
Jeff Johnson295189b2012-06-20 16:38:30 -0700616
617 if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700618 PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700619
620
621 // N.B. In earlier implementations, the RSN IE would be placed in
622 // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined.
623 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700624 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700625
626 //Populate HT IEs, when operating in 11n or Taurus modes.
Jeff Johnsone7245742012-09-05 17:12:55 -0700627 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700629 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700630 PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700632#ifdef WLAN_FEATURE_11AC
633 if(psessionEntry->vhtCapability)
634 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800635 limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700636 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps );
637 PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation );
Jeff Johnsone7245742012-09-05 17:12:55 -0700638 // we do not support multi users yet
639 //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad );
Sandeep Puligilla60342762014-01-30 21:05:37 +0530640 PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700641 }
642#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700643
Sandeep Puligilla60342762014-01-30 21:05:37 +0530644
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 if ( psessionEntry->pLimStartBssReq )
646 {
647 PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700648 &pFrm->WPA );
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700649 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
650 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 }
652
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700653 PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700654
655#if defined(FEATURE_WLAN_WAPI)
656 if( psessionEntry->pLimStartBssReq )
657 {
658 PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700659 &pFrm->WAPI );
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 }
661
662#endif // defined(FEATURE_WLAN_WAPI)
663
664
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700665 nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 if ( DOT11F_FAILED( nStatus ) )
667 {
668 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 "or a Probe Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 nStatus );
671 // We'll fall back on the worst case scenario:
672 nPayload = sizeof( tDot11fProbeResponse );
673 }
674 else if ( DOT11F_WARNED( nStatus ) )
675 {
676 limLog( pMac, LOGW, FL("There were warnings while calculating"
677 "the packed size for a Probe Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700678 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 }
680
681 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
682
683 addnIEPresent = false;
684
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 if( pMac->lim.gpLimRemainOnChanReq )
686 {
687 nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) );
688 }
689 //Only use CFG for non-listen mode. This CFG is not working for concurrency
690 //In listening mode, probe rsp IEs is passed in the message from SME to PE
691 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 {
693
694 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
695 &addnIEPresent) != eSIR_SUCCESS)
696 {
697 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530698 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 return;
700 }
701 }
702
703 if (addnIEPresent)
704 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530705
706 addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3);
707 if ( NULL == addIE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 {
709 PELOGE(limLog(pMac, LOGE,
710 FL("Unable to allocate memory to store addn IE"));)
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530711 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 return;
713 }
714
715 //Probe rsp IE available
716 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
717 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) )
718 {
719 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530720 vos_mem_free(addIE);
721 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 return;
723 }
724 if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len &&
725 (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE)
726 {
727 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
728 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0],
729 &addnIE1Len) )
730 {
731 limLog(pMac, LOGP,
732 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530733 vos_mem_free(addIE);
734 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 return;
736 }
737 }
738
739 //Probe rsp IE available
740 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
741 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) )
742 {
743 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530744 vos_mem_free(addIE);
745 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 return;
747 }
748 if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len &&
749 (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE)
750 {
751 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
752 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len],
753 &addnIE2Len) )
754 {
755 limLog(pMac, LOGP,
756 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530757 vos_mem_free(addIE);
758 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 return;
760 }
761 }
762
763 //Probe rsp IE available
764 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
765 WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) )
766 {
767 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530768 vos_mem_free(addIE);
769 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 return;
771 }
772 if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len &&
773 (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE)
774 {
775 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
776 WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
777 &addIE[addnIE1Len + addnIE2Len],
778 &addnIE3Len) )
779 {
780 limLog(pMac, LOGP,
781 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530782 vos_mem_free(addIE);
783 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 return;
785 }
786 }
787 totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len;
788
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe))
790 {
791 limLog(pMac, LOGP,
792 FL("Unable to get final Additional IE for Probe Req"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530793 vos_mem_free(addIE);
794 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 return;
796 }
797 nBytes = nBytes + totalAddnIeLen;
798
799 if (probeReqP2pIe)
800 {
801 pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen);
802 if (pP2pIe != NULL)
803 {
804 //get NoA attribute stream P2P IE
805 noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
806 if (noaLen != 0)
807 {
808 total_noaLen = limBuildP2pIe(pMac, &noaIe[0],
809 &noaStream[0], noaLen);
810 nBytes = nBytes + total_noaLen;
811 }
812 }
813 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 }
815
816 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
817 ( tANI_U16 )nBytes, ( void** ) &pFrame,
818 ( void** ) &pPacket );
819 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
820 {
821 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 "be Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 if ( addIE != NULL )
824 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530825 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530827 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 return;
829 }
830
831 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530832 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700833
834 // Next, we fill out the buffer descriptor:
835 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
836 SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr);
837 if ( eSIR_SUCCESS != nSirStatus )
838 {
839 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 "tor for a Probe Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 nSirStatus );
842 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
843 ( void* ) pFrame, ( void* ) pPacket );
844 if ( addIE != NULL )
845 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530846 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530848 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 return;
850 }
851
852 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
853
854 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
855
856 // That done, pack the Probe Response:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700857 nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr),
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 nPayload, &nPayload );
859 if ( DOT11F_FAILED( nStatus ) )
860 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700861 limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 nStatus );
863 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
864 if ( addIE != NULL )
865 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530866 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530868 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 return; // allocated!
870 }
871 else if ( DOT11F_WARNED( nStatus ) )
872 {
873 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800874 "robe Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 }
876
877 PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") );
878 limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
879
880 pMac->sys.probeRespond++;
881
Jeff Johnson295189b2012-06-20 16:38:30 -0700882 if( pMac->lim.gpLimRemainOnChanReq )
883 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530884 vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) );
886 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700887
888 if ( addnIEPresent )
889 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530890 vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700892 if (noaLen != 0)
893 {
Krunal Soni81b24262013-05-15 17:46:41 -0700894 if (total_noaLen > (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN))
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 {
896 limLog(pMac, LOGE,
Kaushik, Sushant96ac9d72013-12-11 19:28:10 +0530897 FL("Not able to insert NoA because of length constraint."
898 "Total Length is :%d"),total_noaLen);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530899 vos_mem_free(addIE);
900 vos_mem_free(pFrm);
Krunal Soni81b24262013-05-15 17:46:41 -0700901 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
902 ( void* ) pFrame, ( void* ) pPacket );
903 return;
904 }
905 else
906 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530907 vos_mem_copy( &pFrame[nBytes - (total_noaLen)],
Krunal Soni81b24262013-05-15 17:46:41 -0700908 &noaIe[0], total_noaLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 }
910 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700911
912 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
914 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700915 )
916 {
917 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
918 }
919
920 // Queue Probe Response frame in high priority WQ
921 halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket,
922 ( tANI_U16 ) nBytes,
923 HAL_TXRX_FRM_802_11_MGMT,
924 ANI_TXDIR_TODS,
925 7,//SMAC_SWBD_TX_TID_MGMT_LOW,
926 limTxComplete, pFrame, txFlag );
927 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
928 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700929 limLog( pMac, LOGE, FL("Could not send Probe Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 //Pkt will be freed up by the callback
931 }
932
933 if ( addIE != NULL )
934 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530935 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 }
937
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530938 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700939 return;
940
941
Jeff Johnson295189b2012-06-20 16:38:30 -0700942} // End limSendProbeRspMgmtFrame.
943
944void
945limSendAddtsReqActionFrame(tpAniSirGlobal pMac,
946 tSirMacAddr peerMacAddr,
947 tSirAddtsReqInfo *pAddTS,
948 tpPESession psessionEntry)
949{
950 tANI_U16 i;
951 tANI_U8 *pFrame;
952 tSirRetStatus nSirStatus;
953 tDot11fAddTSRequest AddTSReq;
954 tDot11fWMMAddTSRequest WMMAddTSReq;
955 tANI_U32 nPayload, nBytes, nStatus;
956 tpSirMacMgmtHdr pMacHdr;
957 void *pPacket;
958#ifdef FEATURE_WLAN_CCX
959 tANI_U32 phyMode;
960#endif
961 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530962 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700963
964 if(NULL == psessionEntry)
965 {
966 return;
967 }
968
969 if ( ! pAddTS->wmeTspecPresent )
970 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530971 vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700972
973 AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
974 AddTSReq.DialogToken.token = pAddTS->dialogToken;
975 AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT;
976 if ( pAddTS->lleTspecPresent )
977 {
978 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC );
979 }
980 else
981 {
982 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC );
983 }
984
985 if ( pAddTS->lleTspecPresent )
986 {
987 AddTSReq.num_WMMTCLAS = 0;
988 AddTSReq.num_TCLAS = pAddTS->numTclas;
989 for ( i = 0; i < pAddTS->numTclas; ++i)
990 {
991 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
992 &AddTSReq.TCLAS[i] );
993 }
994 }
995 else
996 {
997 AddTSReq.num_TCLAS = 0;
998 AddTSReq.num_WMMTCLAS = pAddTS->numTclas;
999 for ( i = 0; i < pAddTS->numTclas; ++i)
1000 {
1001 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1002 &AddTSReq.WMMTCLAS[i] );
1003 }
1004 }
1005
1006 if ( pAddTS->tclasProcPresent )
1007 {
1008 if ( pAddTS->lleTspecPresent )
1009 {
1010 AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc;
1011 AddTSReq.TCLASSPROC.present = 1;
1012 }
1013 else
1014 {
1015 AddTSReq.WMMTCLASPROC.version = 1;
1016 AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc;
1017 AddTSReq.WMMTCLASPROC.present = 1;
1018 }
1019 }
1020
1021 nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload );
1022 if ( DOT11F_FAILED( nStatus ) )
1023 {
1024 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001025 "or an Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 nStatus );
1027 // We'll fall back on the worst case scenario:
1028 nPayload = sizeof( tDot11fAddTSRequest );
1029 }
1030 else if ( DOT11F_WARNED( nStatus ) )
1031 {
1032 limLog( pMac, LOGW, FL("There were warnings while calculating"
1033 "the packed size for an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001034 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 }
1036 }
1037 else
1038 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301039 vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001040
1041 WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
1042 WMMAddTSReq.DialogToken.token = pAddTS->dialogToken;
1043 WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME;
1044
1045 // WMM spec 2.2.10 - status code is only filled in for ADDTS response
1046 WMMAddTSReq.StatusCode.statusCode = 0;
1047
1048 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC );
1049#ifdef FEATURE_WLAN_CCX
1050 limGetPhyMode(pMac, &phyMode, psessionEntry);
1051
1052 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
1053 {
1054 pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
1055 }
1056 else
1057 {
1058 pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
1059 }
1060 PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.CCXTrafStrmRateSet,sizeof(tANI_U8));
1061#endif
1062 // fillWmeTspecIE
1063
1064 nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload );
1065 if ( DOT11F_FAILED( nStatus ) )
1066 {
1067 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001068 "or a WMM Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 nStatus );
1070 // We'll fall back on the worst case scenario:
1071 nPayload = sizeof( tDot11fAddTSRequest );
1072 }
1073 else if ( DOT11F_WARNED( nStatus ) )
1074 {
1075 limLog( pMac, LOGW, FL("There were warnings while calculating"
1076 "the packed size for a WMM Add TS Requ"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001077 "est (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 }
1079 }
1080
1081 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1082
1083 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1084 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1085 ( void** ) &pPacket );
1086 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1087 {
1088 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001089 "d TS Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 return;
1091 }
1092
1093 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301094 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001095
1096 // Next, we fill out the buffer descriptor:
1097 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1098 SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr);
1099 if ( eSIR_SUCCESS != nSirStatus )
1100 {
1101 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001102 "tor for an Add TS Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 nSirStatus );
1104 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1105 ( void* ) pFrame, ( void* ) pPacket );
1106 return;
1107 }
1108
1109 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1110
1111 #if 0
1112 cfgLen = SIR_MAC_ADDR_LENGTH;
1113 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1114 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1115 {
1116 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001117 "e sending an Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1119 ( void* ) pFrame, ( void* ) pPacket );
1120 return;
1121 }
1122 #endif //TO SUPPORT BT-AMP
1123
1124 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1125
Chet Lanctot186b5732013-03-18 10:26:30 -07001126#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001127 limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001128#endif
1129
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 // That done, pack the struct:
1131 if ( ! pAddTS->wmeTspecPresent )
1132 {
1133 nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq,
1134 pFrame + sizeof(tSirMacMgmtHdr),
1135 nPayload, &nPayload );
1136 if ( DOT11F_FAILED( nStatus ) )
1137 {
1138 limLog( pMac, LOGE, FL("Failed to pack an Add TS Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001139 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 nStatus );
1141 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1142 return; // allocated!
1143 }
1144 else if ( DOT11F_WARNED( nStatus ) )
1145 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001146 limLog( pMac, LOGW, FL("There were warnings while packing "
1147 "an Add TS Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001148 }
1149 }
1150 else
1151 {
1152 nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq,
1153 pFrame + sizeof(tSirMacMgmtHdr),
1154 nPayload, &nPayload );
1155 if ( DOT11F_FAILED( nStatus ) )
1156 {
1157 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001158 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 nStatus );
1160 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1161 return; // allocated!
1162 }
1163 else if ( DOT11F_WARNED( nStatus ) )
1164 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001165 limLog( pMac, LOGW, FL("There were warnings while packing "
1166 "a WMM Add TS Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 }
1168 }
1169
1170 PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") );
1171 limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
1172
1173 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1175 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001176 )
1177 {
1178 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1179 }
1180
1181 // Queue Addts Response frame in high priority WQ
1182 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1183 HAL_TXRX_FRM_802_11_MGMT,
1184 ANI_TXDIR_TODS,
1185 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1186 limTxComplete, pFrame, txFlag );
1187 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1188 {
1189 limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001190 " (%X) ***" ), halstatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 //Pkt will be freed up by the callback
1192 }
1193
1194} // End limSendAddtsReqActionFrame.
1195
Jeff Johnson295189b2012-06-20 16:38:30 -07001196
1197
1198void
1199limSendAssocRspMgmtFrame(tpAniSirGlobal pMac,
1200 tANI_U16 statusCode,
1201 tANI_U16 aid,
1202 tSirMacAddr peerMacAddr,
1203 tANI_U8 subType,
1204 tpDphHashNode pSta,tpPESession psessionEntry)
1205{
1206 static tDot11fAssocResponse frm;
1207 tANI_U8 *pFrame, *macAddr;
1208 tpSirMacMgmtHdr pMacHdr;
1209 tSirRetStatus nSirStatus;
1210 tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0;
1211 tHalBitVal qosMode, wmeMode;
1212 tANI_U32 nPayload, nBytes, nStatus;
1213 void *pPacket;
1214 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301215 tUpdateBeaconParams beaconParams;
1216 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 tANI_U32 addnIEPresent = false;
1218 tANI_U32 addnIELen=0;
1219 tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN];
1220 tpSirAssocReq pAssocReq = NULL;
1221
1222 if(NULL == psessionEntry)
1223 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301224 limLog( pMac, LOGE, FL("psessionEntry is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001225 return;
1226 }
1227
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301228 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001229
1230 limGetQosMode(psessionEntry, &qosMode);
1231 limGetWmeMode(psessionEntry, &wmeMode);
1232
1233 // An Add TS IE is added only if the AP supports it and the requesting
1234 // STA sent a traffic spec.
1235 fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0;
1236
1237 PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry );
1238
1239 frm.Status.status = statusCode;
1240
1241 frm.AID.associd = aid | LIM_AID_MASK;
1242
1243 if ( NULL == pSta )
1244 {
1245 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry);
1246 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry );
1247 }
1248 else
1249 {
1250 PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates,
1251 pSta->supportedRates.llbRates, pSta->supportedRates.llaRates );
1252 }
1253
Jeff Johnson295189b2012-06-20 16:38:30 -07001254 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1255 {
1256 if( pSta != NULL && eSIR_SUCCESS == statusCode )
1257 {
1258 pAssocReq =
1259 (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */
1261 if( pAssocReq != NULL && pAssocReq->addIEPresent ) {
1262 PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq);
1263 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 }
1265 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001266
1267 if ( NULL != pSta )
1268 {
1269 if ( eHAL_SET == qosMode )
1270 {
1271 if ( pSta->lleEnabled )
1272 {
1273 lleMode = 1;
1274 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) )
1275 {
1276 PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
1277
1278// FramesToDo:...
1279// if ( fAddTS )
1280// {
1281// tANI_U8 *pAf = pBody;
1282// *pAf++ = SIR_MAC_QOS_ACTION_EID;
1283// tANI_U32 tlen;
1284// status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL,
1285// &tlen, bufLen - frameLen);
1286// } // End if on Add TS.
1287 }
1288 } // End if on .11e enabled in 'pSta'.
1289 } // End if on QOS Mode on.
1290
1291 if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled )
1292 {
1293 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1294 {
1295
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001297
1298 if ( pSta->wsmEnabled )
1299 {
1300 PopulateDot11fWMMCaps(&frm.WMMCaps );
1301 }
1302 }
1303 }
1304
1305 if ( pSta->aniPeer )
1306 {
1307 if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ||
1308 ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1309 {
1310 edcaInclude = 1;
1311 }
1312
1313 } // End if on Airgo peer.
1314
1315 if ( pSta->mlmStaContext.htCapability &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001316 psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -07001317 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001318 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07001320 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001321
1322#ifdef WLAN_FEATURE_11AC
1323 if( pSta->mlmStaContext.vhtCapability &&
1324 psessionEntry->vhtCapability )
1325 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -08001326 limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001327 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
1328 PopulateDot11fVHTOperation( pMac, &frm.VHTOperation);
Sandeep Puligilla60342762014-01-30 21:05:37 +05301329 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001330 }
1331#endif
1332
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 } // End if on non-NULL 'pSta'.
1334
1335
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301336 vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001337
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1339 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
1340 limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry);
1341 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001342
1343 limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry);
1344 limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry);
1345
1346 beaconParams.bssIdx = psessionEntry->bssIdx;
1347
1348 //Send message to HAL about beacon parameter change.
1349 if(beaconParams.paramChangeBitmap)
1350 {
1351 schSetFixedBeaconFields(pMac,psessionEntry);
1352 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
1353 }
1354
1355 // Allocate a buffer for this frame:
1356 nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
1357 if ( DOT11F_FAILED( nStatus ) )
1358 {
1359 limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001360 "or an Association Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001361 nStatus );
1362 return;
1363 }
1364 else if ( DOT11F_WARNED( nStatus ) )
1365 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001366 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07001367 "the packed size for an Association Re"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001368 "sponse (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001369 }
1370
1371 nBytes = sizeof( tSirMacMgmtHdr ) + nPayload;
1372
1373 if ( pAssocReq != NULL )
1374 {
1375 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
1376 &addnIEPresent) != eSIR_SUCCESS)
1377 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301378 limLog(pMac, LOGP, FL("Unable to get "
1379 "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001380 return;
1381 }
1382
1383 if (addnIEPresent)
1384 {
1385 //Assoc rsp IE available
1386 if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1387 &addnIELen) != eSIR_SUCCESS)
1388 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301389 limLog(pMac, LOGP, FL("Unable to get "
1390 "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 return;
1392 }
1393
1394 if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen &&
1395 (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE)
1396 {
1397 if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1398 &addIE[0], &addnIELen) == eSIR_SUCCESS)
1399 {
1400 nBytes = nBytes + addnIELen;
1401 }
1402 }
1403 }
1404 }
1405
1406 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1407 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1408 ( void** ) &pPacket );
1409 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1410 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001411 limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 return;
1413 }
1414
1415 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301416 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001417
1418 // Next, we fill out the buffer descriptor:
1419 nSirStatus = limPopulateMacHeader( pMac,
1420 pFrame,
1421 SIR_MAC_MGMT_FRAME,
1422 ( LIM_ASSOC == subType ) ?
1423 SIR_MAC_MGMT_ASSOC_RSP :
1424 SIR_MAC_MGMT_REASSOC_RSP,
1425 peerMacAddr,psessionEntry->selfMacAddr);
1426 if ( eSIR_SUCCESS != nSirStatus )
1427 {
1428 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001429 "tor for an Association Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001430 nSirStatus );
1431 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1432 ( void* ) pFrame, ( void* ) pPacket );
1433 return;
1434 }
1435
1436 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1437
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1439
1440 nStatus = dot11fPackAssocResponse( pMac, &frm,
1441 pFrame + sizeof( tSirMacMgmtHdr ),
1442 nPayload, &nPayload );
1443 if ( DOT11F_FAILED( nStatus ) )
1444 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301445 limLog( pMac, LOGE, FL("Failed to pack an Association Response"
1446 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1448 ( void* ) pFrame, ( void* ) pPacket );
1449 return; // allocated!
1450 }
1451 else if ( DOT11F_WARNED( nStatus ) )
1452 {
1453 limLog( pMac, LOGW, FL("There were warnings while packing an "
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001454 "Association Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 }
1456
1457 macAddr = pMacHdr->da;
1458
1459 if (subType == LIM_ASSOC)
1460 {
1461 PELOG1(limLog(pMac, LOG1,
1462 FL("*** Sending Assoc Resp status %d aid %d to "),
1463 statusCode, aid);)
1464 }
1465 else{
1466 PELOG1(limLog(pMac, LOG1,
1467 FL("*** Sending ReAssoc Resp status %d aid %d to "),
1468 statusCode, aid);)
1469 }
1470 PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
1471
1472 if ( addnIEPresent )
1473 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301474 vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 }
1476
1477 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1479 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 )
1481 {
1482 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1483 }
1484
1485 /// Queue Association Response frame in high priority WQ
1486 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1487 HAL_TXRX_FRM_802_11_MGMT,
1488 ANI_TXDIR_TODS,
1489 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1490 limTxComplete, pFrame, txFlag );
1491 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1492 {
1493 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001494 FL("*** Could not Send Re/AssocRsp, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 nSirStatus);
1496
1497 //Pkt will be freed up by the callback
1498 }
1499
1500 // update the ANI peer station count
1501 //FIXME_PROTECTION : take care of different type of station
1502 // counter inside this function.
1503 limUtilCountStaAdd(pMac, pSta, psessionEntry);
1504
1505} // End limSendAssocRspMgmtFrame.
1506
1507
1508
1509void
1510limSendAddtsRspActionFrame(tpAniSirGlobal pMac,
1511 tSirMacAddr peer,
1512 tANI_U16 nStatusCode,
1513 tSirAddtsReqInfo *pAddTS,
1514 tSirMacScheduleIE *pSchedule,
1515 tpPESession psessionEntry)
1516{
1517 tANI_U8 *pFrame;
1518 tpSirMacMgmtHdr pMacHdr;
1519 tDot11fAddTSResponse AddTSRsp;
1520 tDot11fWMMAddTSResponse WMMAddTSRsp;
1521 tSirRetStatus nSirStatus;
1522 tANI_U32 i, nBytes, nPayload, nStatus;
1523 void *pPacket;
1524 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301525 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001526
1527 if(NULL == psessionEntry)
1528 {
1529 return;
1530 }
1531
1532 if ( ! pAddTS->wmeTspecPresent )
1533 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301534 vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001535
1536 AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1537 AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1538 AddTSRsp.DialogToken.token = pAddTS->dialogToken;
1539 AddTSRsp.Status.status = nStatusCode;
1540
1541 // The TsDelay information element is only filled in for a specific
1542 // status code:
1543 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode )
1544 {
1545 if ( pAddTS->wsmTspecPresent )
1546 {
1547 AddTSRsp.WMMTSDelay.version = 1;
1548 AddTSRsp.WMMTSDelay.delay = 10;
1549 AddTSRsp.WMMTSDelay.present = 1;
1550 }
1551 else
1552 {
1553 AddTSRsp.TSDelay.delay = 10;
1554 AddTSRsp.TSDelay.present = 1;
1555 }
1556 }
1557
1558 if ( pAddTS->wsmTspecPresent )
1559 {
1560 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC );
1561 }
1562 else
1563 {
1564 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC );
1565 }
1566
1567 if ( pAddTS->wsmTspecPresent )
1568 {
1569 AddTSRsp.num_WMMTCLAS = 0;
1570 AddTSRsp.num_TCLAS = pAddTS->numTclas;
1571 for ( i = 0; i < AddTSRsp.num_TCLAS; ++i)
1572 {
1573 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
1574 &AddTSRsp.TCLAS[i] );
1575 }
1576 }
1577 else
1578 {
1579 AddTSRsp.num_TCLAS = 0;
1580 AddTSRsp.num_WMMTCLAS = pAddTS->numTclas;
1581 for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i)
1582 {
1583 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1584 &AddTSRsp.WMMTCLAS[i] );
1585 }
1586 }
1587
1588 if ( pAddTS->tclasProcPresent )
1589 {
1590 if ( pAddTS->wsmTspecPresent )
1591 {
1592 AddTSRsp.WMMTCLASPROC.version = 1;
1593 AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc;
1594 AddTSRsp.WMMTCLASPROC.present = 1;
1595 }
1596 else
1597 {
1598 AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc;
1599 AddTSRsp.TCLASSPROC.present = 1;
1600 }
1601 }
1602
1603 // schedule element is included only if requested in the tspec and we are
1604 // using hcca (or both edca and hcca)
1605 // 11e-D8.0 is inconsistent on whether the schedule element is included
1606 // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but
1607 // pg 46, line 17-18 says something else. So just include it and let the
1608 // sta figure it out
1609 if ((pSchedule != NULL) &&
1610 ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
1611 (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)))
1612 {
1613 if ( pAddTS->wsmTspecPresent )
1614 {
1615 PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule );
1616 }
1617 else
1618 {
1619 PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule );
1620 }
1621 }
1622
1623 nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload );
1624 if ( DOT11F_FAILED( nStatus ) )
1625 {
1626 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001627 "ze for an Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 nStatus );
1629 // We'll fall back on the worst case scenario:
1630 nPayload = sizeof( tDot11fAddTSResponse );
1631 }
1632 else if ( DOT11F_WARNED( nStatus ) )
1633 {
1634 limLog( pMac, LOGW, FL("There were warnings while calcula"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001635 "ting the packed size for an Add TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001636 " Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 }
1638 }
1639 else
1640 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301641 vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001642
1643 WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME;
1644 WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1645 WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken;
1646 WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode;
1647
1648 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC );
1649
1650 nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload );
1651 if ( DOT11F_FAILED( nStatus ) )
1652 {
1653 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001654 "ze for a WMM Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 nStatus );
1656 // We'll fall back on the worst case scenario:
1657 nPayload = sizeof( tDot11fWMMAddTSResponse );
1658 }
1659 else if ( DOT11F_WARNED( nStatus ) )
1660 {
1661 limLog( pMac, LOGW, FL("There were warnings while calcula"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001662 "ting the packed size for a WMM Add"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001663 "TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 }
1665 }
1666
1667 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1668
1669 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
1670 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1671 {
1672 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001673 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 return;
1675 }
1676
1677 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301678 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001679
1680 // Next, we fill out the buffer descriptor:
1681 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1682 SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr);
1683 if ( eSIR_SUCCESS != nSirStatus )
1684 {
1685 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001686 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 nSirStatus );
1688 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1689 return; // allocated!
1690 }
1691
1692 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1693
1694
1695 #if 0
1696 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1697 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1698 {
1699 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001700 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1702 return; // allocated!
1703 }
1704 #endif //TO SUPPORT BT-AMP
1705 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1706
Chet Lanctot186b5732013-03-18 10:26:30 -07001707#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001708 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001709#endif
1710
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 // That done, pack the struct:
1712 if ( ! pAddTS->wmeTspecPresent )
1713 {
1714 nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp,
1715 pFrame + sizeof( tSirMacMgmtHdr ),
1716 nPayload, &nPayload );
1717 if ( DOT11F_FAILED( nStatus ) )
1718 {
1719 limLog( pMac, LOGE, FL("Failed to pack an Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001720 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 nStatus );
1722 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1723 return;
1724 }
1725 else if ( DOT11F_WARNED( nStatus ) )
1726 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001727 limLog( pMac, LOGW, FL("There were warnings while packing "
1728 "an Add TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 }
1730 }
1731 else
1732 {
1733 nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp,
1734 pFrame + sizeof( tSirMacMgmtHdr ),
1735 nPayload, &nPayload );
1736 if ( DOT11F_FAILED( nStatus ) )
1737 {
1738 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001739 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 nStatus );
1741 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1742 return;
1743 }
1744 else if ( DOT11F_WARNED( nStatus ) )
1745 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001746 limLog( pMac, LOGW, FL("There were warnings while packing "
1747 "a WMM Add TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 }
1749 }
1750
1751 PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "),
1752 nStatusCode );
1753 limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
1754
1755 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1757 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 )
1759 {
1760 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1761 }
1762
1763 // Queue the frame in high priority WQ:
1764 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1765 HAL_TXRX_FRM_802_11_MGMT,
1766 ANI_TXDIR_TODS,
1767 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1768 limTxComplete, pFrame, txFlag );
1769 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1770 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001771 limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 nSirStatus );
1773 //Pkt will be freed up by the callback
1774 }
1775
1776} // End limSendAddtsRspActionFrame.
1777
1778void
1779limSendDeltsReqActionFrame(tpAniSirGlobal pMac,
1780 tSirMacAddr peer,
1781 tANI_U8 wmmTspecPresent,
1782 tSirMacTSInfo *pTsinfo,
1783 tSirMacTspecIE *pTspecIe,
1784 tpPESession psessionEntry)
1785{
1786 tANI_U8 *pFrame;
1787 tpSirMacMgmtHdr pMacHdr;
1788 tDot11fDelTS DelTS;
1789 tDot11fWMMDelTS WMMDelTS;
1790 tSirRetStatus nSirStatus;
1791 tANI_U32 nBytes, nPayload, nStatus;
1792 void *pPacket;
1793 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301794 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001795
1796 if(NULL == psessionEntry)
1797 {
1798 return;
1799 }
1800
1801 if ( ! wmmTspecPresent )
1802 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301803 vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001804
1805 DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1806 DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
1807 PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo );
1808
1809 nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload );
1810 if ( DOT11F_FAILED( nStatus ) )
1811 {
1812 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001813 "ze for a Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 nStatus );
1815 // We'll fall back on the worst case scenario:
1816 nPayload = sizeof( tDot11fDelTS );
1817 }
1818 else if ( DOT11F_WARNED( nStatus ) )
1819 {
1820 limLog( pMac, LOGW, FL("There were warnings while calcula"
1821 "ting the packed size for a Del TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001822 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 }
1824 }
1825 else
1826 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301827 vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001828
1829 WMMDelTS.Category.category = SIR_MAC_ACTION_WME;
1830 WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
1831 WMMDelTS.DialogToken.token = 0;
1832 WMMDelTS.StatusCode.statusCode = 0;
1833 PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC );
1834 nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload );
1835 if ( DOT11F_FAILED( nStatus ) )
1836 {
1837 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001838 "ze for a WMM Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 nStatus );
1840 // We'll fall back on the worst case scenario:
1841 nPayload = sizeof( tDot11fDelTS );
1842 }
1843 else if ( DOT11F_WARNED( nStatus ) )
1844 {
1845 limLog( pMac, LOGW, FL("There were warnings while calcula"
1846 "ting the packed size for a WMM De"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001847 "l TS (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 }
1849 }
1850
1851 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1852
1853 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
1854 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1855 {
1856 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001857 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 return;
1859 }
1860
1861 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301862 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001863
1864 // Next, we fill out the buffer descriptor:
1865 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1866 SIR_MAC_MGMT_ACTION, peer,
1867 psessionEntry->selfMacAddr);
1868 if ( eSIR_SUCCESS != nSirStatus )
1869 {
1870 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001871 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 nSirStatus );
1873 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1874 return; // allocated!
1875 }
1876
1877 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1878
1879 #if 0
1880
1881 cfgLen = SIR_MAC_ADDR_LENGTH;
1882 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1883 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1884 {
1885 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001886 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001887 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1888 return; // allocated!
1889 }
1890 #endif //TO SUPPORT BT-AMP
1891 sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId);
1892
Chet Lanctot186b5732013-03-18 10:26:30 -07001893#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001894 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001895#endif
1896
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 // That done, pack the struct:
1898 if ( !wmmTspecPresent )
1899 {
1900 nStatus = dot11fPackDelTS( pMac, &DelTS,
1901 pFrame + sizeof( tSirMacMgmtHdr ),
1902 nPayload, &nPayload );
1903 if ( DOT11F_FAILED( nStatus ) )
1904 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001905 limLog( pMac, LOGE, FL("Failed to pack a Del TS frame (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 nStatus );
1907 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1908 return; // allocated!
1909 }
1910 else if ( DOT11F_WARNED( nStatus ) )
1911 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001912 limLog( pMac, LOGW, FL("There were warnings while packing "
1913 "a Del TS frame (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 }
1915 }
1916 else
1917 {
1918 nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS,
1919 pFrame + sizeof( tSirMacMgmtHdr ),
1920 nPayload, &nPayload );
1921 if ( DOT11F_FAILED( nStatus ) )
1922 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001923 limLog( pMac, LOGE, FL("Failed to pack a WMM Del TS frame (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 nStatus );
1925 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1926 return; // allocated!
1927 }
1928 else if ( DOT11F_WARNED( nStatus ) )
1929 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001930 limLog( pMac, LOGW, FL("There were warnings while packing "
1931 "a WMM Del TS frame (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 }
1933 }
1934
1935 PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes);
1936 limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
1937
1938 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1940 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 )
1942 {
1943 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1944 }
1945
1946 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1947 HAL_TXRX_FRM_802_11_MGMT,
1948 ANI_TXDIR_TODS,
1949 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1950 limTxComplete, pFrame, txFlag );
1951 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1952 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001953 limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 nSirStatus );
1955 //Pkt will be freed up by the callback
1956 }
1957
1958} // End limSendDeltsReqActionFrame.
1959
1960void
1961limSendAssocReqMgmtFrame(tpAniSirGlobal pMac,
1962 tLimMlmAssocReq *pMlmAssocReq,
1963 tpPESession psessionEntry)
1964{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001965 tDot11fAssocRequest *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 tANI_U16 caps;
1967 tANI_U8 *pFrame;
1968 tSirRetStatus nSirStatus;
1969 tLimMlmAssocCnf mlmAssocCnf;
1970 tANI_U32 nBytes, nPayload, nStatus;
1971 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
1972 void *pPacket;
1973 eHalStatus halstatus;
1974 tANI_U16 nAddIELen;
1975 tANI_U8 *pAddIE;
1976 tANI_U8 *wpsIe = NULL;
1977#if defined WLAN_FEATURE_VOWIFI
1978 tANI_U8 PowerCapsPopulated = FALSE;
1979#endif
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301980 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001981
1982 if(NULL == psessionEntry)
1983 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301984 limLog(pMac, LOGE, FL("psessionEntry is NULL") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001985 return;
1986 }
1987
Jeff Johnson295189b2012-06-20 16:38:30 -07001988 /* check this early to avoid unncessary operation */
1989 if(NULL == psessionEntry->pLimJoinReq)
1990 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301991 limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 return;
1993 }
1994 nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length;
1995 pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata;
1996
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301997 pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest));
1998 if ( NULL == pFrm )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001999 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302000 limLog(pMac, LOGE, FL("Unable to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002001 return;
2002 }
2003
2004
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302005 vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002006
2007 caps = pMlmAssocReq->capabilityInfo;
2008 if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) )
2009 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2010#if defined(FEATURE_WLAN_WAPI)
2011 /* CR: 262463 :
2012 According to WAPI standard:
2013 7.3.1.4 Capability Information field
2014 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2015 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2016 Reassociation management frames. */
2017 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2018 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2019#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002020 swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities );
Jeff Johnson295189b2012-06-20 16:38:30 -07002021
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002022 pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval;
2023 PopulateDot11fSSID2( pMac, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002025 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002026
2027 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2028 SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps );
2029
2030 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2031 LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps );
2032
2033 // We prefer .11e asociations:
2034 if ( fQosEnabled ) fWmeEnabled = false;
2035
2036 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2037 LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps );
2038
2039 if ( psessionEntry->lim11hEnable &&
2040 psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE )
2041 {
2042#if defined WLAN_FEATURE_VOWIFI
2043 PowerCapsPopulated = TRUE;
2044
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002045 PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002046#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002047 PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002048
2049 }
2050
2051#if defined WLAN_FEATURE_VOWIFI
2052 if( pMac->rrm.rrmPEContext.rrmEnable &&
2053 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2054 {
2055 if (PowerCapsPopulated == FALSE)
2056 {
2057 PowerCapsPopulated = TRUE;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002058 PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 }
2060 }
2061#endif
2062
2063 if ( fQosEnabled &&
2064 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap)))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002065 PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002066
2067 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002068 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002069
2070#if defined WLAN_FEATURE_VOWIFI
2071 if( pMac->rrm.rrmPEContext.rrmEnable &&
2072 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2073 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002074 PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 }
2076#endif
2077 // The join request *should* contain zero or one of the WPA and RSN
2078 // IEs. The payload send along with the request is a
2079 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2080
2081 // typedef struct sSirRSNie
2082 // {
2083 // tANI_U16 length;
2084 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2085 // } tSirRSNie, *tpSirRSNie;
2086
2087 // So, we should be able to make the following two calls harmlessly,
2088 // since they do nothing if they don't find the given IE in the
2089 // bytestream with which they're provided.
2090
2091 // The net effect of this will be to faithfully transmit whatever
2092 // security IE is in the join request.
2093
2094 // *However*, if we're associating for the purpose of WPS
2095 // enrollment, and we've been configured to indicate that by
2096 // eliding the WPA or RSN IE, we just skip this:
2097 if( nAddIELen && pAddIE )
2098 {
2099 wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen);
2100 }
2101 if ( NULL == wpsIe )
2102 {
2103 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002104 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002106 &pFrm->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002107#if defined(FEATURE_WLAN_WAPI)
2108 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002109 &pFrm->WAPIOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002110#endif // defined(FEATURE_WLAN_WAPI)
2111 }
2112
2113 // include WME EDCA IE as well
2114 if ( fWmeEnabled )
2115 {
2116 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) )
2117 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002118 PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 }
2120
2121 if ( fWsmEnabled &&
2122 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap )))
2123 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002124 PopulateDot11fWMMCaps( &pFrm->WMMCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 }
2126 }
2127
2128 //Populate HT IEs, when operating in 11n or Taurus modes AND
2129 //when AP is also operating in 11n mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07002130 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 pMac->lim.htCapabilityPresentInBeacon)
2132 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002133 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002134#ifdef DISABLE_GF_FOR_INTEROP
2135
2136 /*
2137 * To resolve the interop problem with Broadcom AP,
2138 * where TQ STA could not pass traffic with GF enabled,
2139 * TQ STA will do Greenfield only with TQ AP, for
2140 * everybody else it will be turned off.
2141 */
2142
2143 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2144 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302145 limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP,"
2146 " Turning off Greenfield"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002147 pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 }
2149#endif
2150
2151 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002152#ifdef WLAN_FEATURE_11AC
2153 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002154 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07002155 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002156 limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002157 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps );
Jeff Johnsone7245742012-09-05 17:12:55 -07002158 }
2159#endif
Sandeep Puligilla60342762014-01-30 21:05:37 +05302160 PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002161
2162#if defined WLAN_FEATURE_VOWIFI_11R
2163 if (psessionEntry->pLimJoinReq->is11Rconnection)
2164 {
2165#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002166 limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0],
2168 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1],
2169 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]);
2170#endif
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302171 PopulateMDIE( pMac, &pFrm->MobilityDomain,
2172 psessionEntry->pLimJoinReq->bssDescription.mdie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302174 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 {
2176 // No 11r IEs dont send any MDIE
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302177 limLog( pMac, LOG1, FL("MDIE not present"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 }
2179#endif
2180
2181#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302182 /* For CCX Associations fill the CCX IEs */
2183 if (psessionEntry->isCCXconnection &&
2184 psessionEntry->pLimJoinReq->isCCXFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002186#ifndef FEATURE_DISABLE_RM
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002187 PopulateDot11fCCXRadMgmtCap(&pFrm->CCXRadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002188#endif
Sandeep Puligillae9ffdf62013-11-23 18:23:00 +05302189 PopulateDot11fCCXVersion(&pFrm->CCXVersion);
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 }
2191#endif
2192
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002193 nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 if ( DOT11F_FAILED( nStatus ) )
2195 {
2196 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002197 "or an Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 nStatus );
2199 // We'll fall back on the worst case scenario:
2200 nPayload = sizeof( tDot11fAssocRequest );
2201 }
2202 else if ( DOT11F_WARNED( nStatus ) )
2203 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002204 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 "the packed size for an Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002206 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 }
2208
2209 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
2210
2211 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2212 ( tANI_U16 )nBytes, ( void** ) &pFrame,
2213 ( void** ) &pPacket );
2214 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2215 {
2216 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002217 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002218
2219 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002220 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002221
2222
2223 /* Update PE session id*/
2224 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2225
2226 mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2227
2228 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2229 ( void* ) pFrame, ( void* ) pPacket );
2230
2231 limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF,
2232 ( tANI_U32* ) &mlmAssocCnf);
2233
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302234 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 return;
2236 }
2237
2238 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302239 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002240
2241 // Next, we fill out the buffer descriptor:
2242 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2243 SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr);
2244 if ( eSIR_SUCCESS != nSirStatus )
2245 {
2246 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002247 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 nSirStatus );
2249 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302250 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002251 return;
2252 }
2253
2254
Abhishek Singh57aebef2014-02-03 18:47:44 +05302255 // That done, pack the Assoc Request:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002256 nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame +
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 sizeof(tSirMacMgmtHdr),
2258 nPayload, &nPayload );
2259 if ( DOT11F_FAILED( nStatus ) )
2260 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302261 limLog( pMac, LOGE, FL("Failed to pack a Assoc Request (0x%0"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002262 "8x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 nStatus );
2264 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2265 ( void* ) pFrame, ( void* ) pPacket );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302266 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 return;
2268 }
2269 else if ( DOT11F_WARNED( nStatus ) )
2270 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302271 limLog( pMac, LOGW, FL("There were warnings while packing a Assoc"
2272 "Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 }
2274
2275 PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002276 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 nBytes );)
2278 // limPrintMacAddr( pMac, bssid, LOG1 );
2279
2280 if( psessionEntry->assocReq != NULL )
2281 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302282 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 psessionEntry->assocReq = NULL;
2284 }
2285
2286 if( nAddIELen )
2287 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302288 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
2289 pAddIE,
2290 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 nPayload += nAddIELen;
2292 }
2293
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302294 psessionEntry->assocReq = vos_mem_malloc(nPayload);
2295 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302297 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store "
2298 "assoc request"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 }
2300 else
2301 {
2302 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302303 vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 psessionEntry->assocReqLen = nPayload;
2305 }
2306
2307 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2309 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 )
2311 {
2312 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2313 }
2314
Ganesh K08bce952012-12-13 15:04:41 -08002315 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
2316 {
2317 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
2318 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
2320 HAL_TXRX_FRM_802_11_MGMT,
2321 ANI_TXDIR_TODS,
2322 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2323 limTxComplete, pFrame, txFlag );
2324 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2325 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002326 limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 halstatus );
2328 //Pkt will be freed up by the callback
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302329 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 return;
2331 }
2332
2333 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302334 vos_mem_free(pMlmAssocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002335 pMlmAssocReq = NULL;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302336 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002337 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002338} // End limSendAssocReqMgmtFrame
2339
2340
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002341#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002342/*------------------------------------------------------------------------------------
2343 *
2344 * Send Reassoc Req with FTIEs.
2345 *
2346 *-----------------------------------------------------------------------------------
2347 */
2348void
2349limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac,
2350 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
2351{
2352 static tDot11fReAssocRequest frm;
2353 tANI_U16 caps;
2354 tANI_U8 *pFrame;
2355 tSirRetStatus nSirStatus;
2356 tANI_U32 nBytes, nPayload, nStatus;
2357 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2358 void *pPacket;
2359 eHalStatus halstatus;
2360#if defined WLAN_FEATURE_VOWIFI
2361 tANI_U8 PowerCapsPopulated = FALSE;
2362#endif
2363 tANI_U16 ft_ies_length = 0;
2364 tANI_U8 *pBody;
2365 tANI_U16 nAddIELen;
2366 tANI_U8 *pAddIE;
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002367#if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 tANI_U8 *wpsIe = NULL;
2369#endif
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302370 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002371
2372 if (NULL == psessionEntry)
2373 {
2374 return;
2375 }
2376
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 /* check this early to avoid unncessary operation */
2378 if(NULL == psessionEntry->pLimReAssocReq)
2379 {
2380 return;
2381 }
2382 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
2383 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002384 limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in "
2385 "state (%d)."), psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002386
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302387 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002388
2389 caps = pMlmReassocReq->capabilityInfo;
2390 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
2391 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2392#if defined(FEATURE_WLAN_WAPI)
2393 /* CR: 262463 :
2394 According to WAPI standard:
2395 7.3.1.4 Capability Information field
2396 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2397 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2398 Reassociation management frames. */
2399 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2400 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2401#endif
2402 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
2403
2404 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
2405
2406 // Get the old bssid of the older AP.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302407 vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac,
Jeff Johnson295189b2012-06-20 16:38:30 -07002408 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6);
2409
2410 PopulateDot11fSSID2( pMac, &frm.SSID );
2411 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2412 &frm.SuppRates,psessionEntry);
2413
2414 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2415 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
2416
2417 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2418 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
2419
2420 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2421 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
2422
2423 if ( psessionEntry->lim11hEnable &&
2424 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
2425 {
2426#if defined WLAN_FEATURE_VOWIFI
2427 PowerCapsPopulated = TRUE;
2428
2429 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
2430 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
2431#endif
2432 }
2433
2434#if defined WLAN_FEATURE_VOWIFI
2435 if( pMac->rrm.rrmPEContext.rrmEnable &&
2436 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2437 {
2438 if (PowerCapsPopulated == FALSE)
2439 {
2440 PowerCapsPopulated = TRUE;
2441 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
2442 }
2443 }
2444#endif
2445
2446 if ( fQosEnabled &&
2447 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
2448 {
2449 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
2450 }
2451
2452 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2453 &frm.ExtSuppRates, psessionEntry );
2454
2455#if defined WLAN_FEATURE_VOWIFI
2456 if( pMac->rrm.rrmPEContext.rrmEnable &&
2457 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
2458 {
2459 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
2460 }
2461#endif
2462
2463 // Ideally this should be enabled for 11r also. But 11r does
2464 // not follow the usual norm of using the Opaque object
2465 // for rsnie and fties. Instead we just add
2466 // the rsnie and fties at the end of the pack routine for 11r.
2467 // This should ideally! be fixed.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002468#if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 //
2470 // The join request *should* contain zero or one of the WPA and RSN
2471 // IEs. The payload send along with the request is a
2472 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2473
2474 // typedef struct sSirRSNie
2475 // {
2476 // tANI_U16 length;
2477 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2478 // } tSirRSNie, *tpSirRSNie;
2479
2480 // So, we should be able to make the following two calls harmlessly,
2481 // since they do nothing if they don't find the given IE in the
2482 // bytestream with which they're provided.
2483
2484 // The net effect of this will be to faithfully transmit whatever
2485 // security IE is in the join request.
2486
2487 // *However*, if we're associating for the purpose of WPS
2488 // enrollment, and we've been configured to indicate that by
2489 // eliding the WPA or RSN IE, we just skip this:
2490 if (!psessionEntry->is11Rconnection)
2491 {
2492 if( nAddIELen && pAddIE )
2493 {
2494 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
2495 }
2496 if ( NULL == wpsIe )
2497 {
2498 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2499 &frm.RSNOpaque );
2500 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2501 &frm.WPAOpaque );
2502 }
2503
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002504#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302505 if (psessionEntry->pLimReAssocReq->cckmIE.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002506 {
2507 PopulateDot11fCCXCckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ),
2508 &frm.CCXCckmOpaque );
2509 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002510#endif //FEATURE_WLAN_CCX
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 }
2512
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002513#ifdef FEATURE_WLAN_CCX
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 // For CCX Associations fill the CCX IEs
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302515 if (psessionEntry->isCCXconnection &&
2516 psessionEntry->pLimReAssocReq->isCCXFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002518#ifndef FEATURE_DISABLE_RM
Jeff Johnson295189b2012-06-20 16:38:30 -07002519 PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002520#endif
Sandeep Puligillae9ffdf62013-11-23 18:23:00 +05302521 PopulateDot11fCCXVersion(&frm.CCXVersion);
Jeff Johnson295189b2012-06-20 16:38:30 -07002522 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302523#endif //FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002524#endif //FEATURE_WLAN_CCX || FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -07002525
2526 // include WME EDCA IE as well
2527 if ( fWmeEnabled )
2528 {
2529 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
2530 {
2531 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
2532 }
2533
2534 if ( fWsmEnabled &&
2535 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
2536 {
2537 PopulateDot11fWMMCaps( &frm.WMMCaps );
2538 }
2539#ifdef FEATURE_WLAN_CCX
2540 if (psessionEntry->isCCXconnection)
2541 {
2542 PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry);
2543
2544 // Populate the TSRS IE if TSPEC is included in the reassoc request
2545 if (psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs)
2546 {
2547 tANI_U32 phyMode;
2548 tSirMacCCXTSRSIE tsrsIE;
2549 limGetPhyMode(pMac, &phyMode, psessionEntry);
2550
2551 tsrsIE.tsid = 0;
2552 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
2553 {
2554 tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
2555 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302556 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002557 {
2558 tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
2559 }
2560 PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.CCXTrafStrmRateSet, sizeof(tANI_U8));
2561 }
2562 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302563#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 }
2565
Jeff Johnsone7245742012-09-05 17:12:55 -07002566 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 pMac->lim.htCapabilityPresentInBeacon)
2568 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002569 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 }
2571
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002572#if defined WLAN_FEATURE_VOWIFI_11R
Gopichand Nakkala0ac55062013-04-08 14:43:07 +05302573 if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && (0 == pMac->ft.ftSmeContext.reassoc_ft_ies_length)
2574#if defined FEATURE_WLAN_CCX
2575 && !psessionEntry->isCCXconnection
2576#endif
2577 )
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002578 {
2579 PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie);
2580 }
2581#endif
2582
Chet Lanctotf19c1f62013-12-13 13:56:21 -08002583#ifdef WLAN_FEATURE_11AC
2584 if ( psessionEntry->vhtCapability &&
2585 psessionEntry->vhtCapabilityPresentInBeacon)
2586 {
2587 limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
2588 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
Chet Lanctotf19c1f62013-12-13 13:56:21 -08002589 }
2590#endif
Sandeep Puligilla60342762014-01-30 21:05:37 +05302591 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Chet Lanctotf19c1f62013-12-13 13:56:21 -08002592
Jeff Johnson295189b2012-06-20 16:38:30 -07002593 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
2594 if ( DOT11F_FAILED( nStatus ) )
2595 {
2596 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002597 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002598 nStatus );
2599 // We'll fall back on the worst case scenario:
2600 nPayload = sizeof( tDot11fReAssocRequest );
2601 }
2602 else if ( DOT11F_WARNED( nStatus ) )
2603 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002604 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002606 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 }
2608
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07002609 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002610
2611#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002612 limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 pMac->ft.ftSmeContext.reassoc_ft_ies_length);
2614#endif
2615
2616#if defined WLAN_FEATURE_VOWIFI_11R
2617 if (psessionEntry->is11Rconnection)
2618 {
2619 ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length;
2620 }
2621#endif
2622
2623 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2624 ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame,
2625 ( void** ) &pPacket );
2626 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2627 {
2628 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002629 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002631 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 goto end;
2633 }
2634
2635 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302636 vos_mem_set( pFrame, nBytes + ft_ies_length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002637
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002638#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002639 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002640#endif
2641 // Next, we fill out the buffer descriptor:
2642 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2643 SIR_MAC_MGMT_REASSOC_REQ,
2644 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
2645 if ( eSIR_SUCCESS != nSirStatus )
2646 {
2647 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002648 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 nSirStatus );
2650 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2651 goto end;
2652 }
2653
2654
2655 // That done, pack the ReAssoc Request:
2656 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
2657 sizeof(tSirMacMgmtHdr),
2658 nPayload, &nPayload );
2659 if ( DOT11F_FAILED( nStatus ) )
2660 {
2661 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002662 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002663 nStatus );
2664 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2665 goto end;
2666 }
2667 else if ( DOT11F_WARNED( nStatus ) )
2668 {
2669 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002670 "e-Association Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 }
2672
2673 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002674 FL("*** Sending Re-Association Request length %d %d to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002675 nBytes, nPayload );)
2676 if( psessionEntry->assocReq != NULL )
2677 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302678 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 psessionEntry->assocReq = NULL;
2680 }
2681
2682 if( nAddIELen )
2683 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302684 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
2685 pAddIE,
2686 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 nPayload += nAddIELen;
2688 }
2689
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302690 psessionEntry->assocReq = vos_mem_malloc(nPayload);
2691 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 {
2693 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07002694 }
2695 else
2696 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002697 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302698 vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07002699 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07002700 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002701
2702 if (psessionEntry->is11Rconnection)
2703 {
2704 {
2705 int i = 0;
2706
2707 pBody = pFrame + nBytes;
2708 for (i=0; i<ft_ies_length; i++)
2709 {
2710 *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i];
2711 pBody++;
2712 }
2713 }
2714 }
2715
2716#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002717 PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: "));
2718 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 (tANI_U8 *)pFrame,
2720 (nBytes + ft_ies_length));)
2721#endif
2722
2723
2724 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2726 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 )
2728 {
2729 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2730 }
2731
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002732 if( NULL != psessionEntry->assocReq )
2733 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302734 vos_mem_free(psessionEntry->assocReq);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002735 psessionEntry->assocReq = NULL;
2736 }
2737
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302738 psessionEntry->assocReq = vos_mem_malloc(ft_ies_length);
2739 if ( NULL == psessionEntry->assocReq )
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002740 {
2741 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002742 psessionEntry->assocReqLen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002743 }
2744 else
2745 {
2746 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302747 vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies,
2748 (ft_ies_length));
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002749 psessionEntry->assocReqLen = (ft_ies_length);
2750 }
2751
2752
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length),
2754 HAL_TXRX_FRM_802_11_MGMT,
2755 ANI_TXDIR_TODS,
2756 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2757 limTxComplete, pFrame, txFlag );
2758 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2759 {
2760 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002761 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 nSirStatus );
2763 //Pkt will be freed up by the callback
2764 goto end;
2765 }
2766
2767end:
2768 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302769 vos_mem_free( pMlmReassocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 psessionEntry->pLimMlmReassocReq = NULL;
2771
2772}
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002773
2774void limSendRetryReassocReqFrame(tpAniSirGlobal pMac,
2775 tLimMlmReassocReq *pMlmReassocReq,
2776 tpPESession psessionEntry)
2777{
2778 tLimMlmReassocCnf mlmReassocCnf; // keep sme
2779 tLimMlmReassocReq *pTmpMlmReassocReq = NULL;
2780 if(NULL == pTmpMlmReassocReq)
2781 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302782 pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2783 if ( NULL == pTmpMlmReassocReq ) goto end;
2784 vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0);
2785 vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002786 }
2787
2788 // Prepare and send Reassociation request frame
2789 // start reassoc timer.
2790 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2791 // Start reassociation failure timer
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002792 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002793 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2794 != TX_SUCCESS)
2795 {
2796 // Could not start reassoc failure timer.
2797 // Log error
2798 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002799 FL("could not start Reassociation failure timer"));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002800 // Return Reassoc confirm with
2801 // Resources Unavailable
2802 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2803 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2804 goto end;
2805 }
2806
2807 limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry);
2808 return;
2809
2810end:
2811 // Free up buffer allocated for reassocReq
2812 if (pMlmReassocReq != NULL)
2813 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302814 vos_mem_free(pMlmReassocReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002815 pMlmReassocReq = NULL;
2816 }
2817 if (pTmpMlmReassocReq != NULL)
2818 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302819 vos_mem_free(pTmpMlmReassocReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002820 pTmpMlmReassocReq = NULL;
2821 }
2822 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2823 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2824 /* Update PE sessio Id*/
2825 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
2826
2827 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2828}
2829
Jeff Johnson295189b2012-06-20 16:38:30 -07002830#endif /* WLAN_FEATURE_VOWIFI_11R */
2831
2832
2833void
2834limSendReassocReqMgmtFrame(tpAniSirGlobal pMac,
2835 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
2836{
2837 static tDot11fReAssocRequest frm;
2838 tANI_U16 caps;
2839 tANI_U8 *pFrame;
2840 tSirRetStatus nSirStatus;
2841 tANI_U32 nBytes, nPayload, nStatus;
2842 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2843 void *pPacket;
2844 eHalStatus halstatus;
2845 tANI_U16 nAddIELen;
2846 tANI_U8 *pAddIE;
2847 tANI_U8 *wpsIe = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302848 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002849#if defined WLAN_FEATURE_VOWIFI
2850 tANI_U8 PowerCapsPopulated = FALSE;
2851#endif
2852
2853 if(NULL == psessionEntry)
2854 {
2855 return;
2856 }
2857
2858 /* check this early to avoid unncessary operation */
2859 if(NULL == psessionEntry->pLimReAssocReq)
2860 {
2861 return;
2862 }
2863 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
2864 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
2865
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302866 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002867
2868 caps = pMlmReassocReq->capabilityInfo;
2869 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
2870 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2871#if defined(FEATURE_WLAN_WAPI)
2872 /* CR: 262463 :
2873 According to WAPI standard:
2874 7.3.1.4 Capability Information field
2875 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2876 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2877 Reassociation management frames. */
2878 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2879 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2880#endif
2881 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
2882
2883 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
2884
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302885 vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac,
2886 ( tANI_U8* )psessionEntry->bssId, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002887
2888 PopulateDot11fSSID2( pMac, &frm.SSID );
2889 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2890 &frm.SuppRates,psessionEntry);
2891
2892 fQosEnabled = ( psessionEntry->limQosEnabled ) &&
2893 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
2894
2895 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2896 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
2897
2898 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2899 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
2900
2901
2902 if ( psessionEntry->lim11hEnable &&
2903 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
2904 {
2905#if defined WLAN_FEATURE_VOWIFI
2906 PowerCapsPopulated = TRUE;
2907 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
2908 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
2909#endif
2910 }
2911
2912#if defined WLAN_FEATURE_VOWIFI
2913 if( pMac->rrm.rrmPEContext.rrmEnable &&
2914 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2915 {
2916 if (PowerCapsPopulated == FALSE)
2917 {
2918 PowerCapsPopulated = TRUE;
2919 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
2920 }
2921 }
2922#endif
2923
2924 if ( fQosEnabled &&
2925 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
2926 {
2927 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
2928 }
2929
2930 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2931 &frm.ExtSuppRates, psessionEntry );
2932
2933#if defined WLAN_FEATURE_VOWIFI
2934 if( pMac->rrm.rrmPEContext.rrmEnable &&
2935 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
2936 {
2937 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
2938 }
2939#endif
2940 // The join request *should* contain zero or one of the WPA and RSN
2941 // IEs. The payload send along with the request is a
2942 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2943
2944 // typedef struct sSirRSNie
2945 // {
2946 // tANI_U16 length;
2947 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2948 // } tSirRSNie, *tpSirRSNie;
2949
2950 // So, we should be able to make the following two calls harmlessly,
2951 // since they do nothing if they don't find the given IE in the
2952 // bytestream with which they're provided.
2953
2954 // The net effect of this will be to faithfully transmit whatever
2955 // security IE is in the join request.
2956
2957 // *However*, if we're associating for the purpose of WPS
2958 // enrollment, and we've been configured to indicate that by
2959 // eliding the WPA or RSN IE, we just skip this:
2960 if( nAddIELen && pAddIE )
2961 {
2962 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
2963 }
2964 if ( NULL == wpsIe )
2965 {
2966 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2967 &frm.RSNOpaque );
2968 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2969 &frm.WPAOpaque );
2970#if defined(FEATURE_WLAN_WAPI)
2971 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2972 &frm.WAPIOpaque );
2973#endif // defined(FEATURE_WLAN_WAPI)
2974 }
2975
2976 // include WME EDCA IE as well
2977 if ( fWmeEnabled )
2978 {
2979 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
2980 {
2981 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
2982 }
2983
2984 if ( fWsmEnabled &&
2985 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
2986 {
2987 PopulateDot11fWMMCaps( &frm.WMMCaps );
2988 }
2989 }
2990
Jeff Johnsone7245742012-09-05 17:12:55 -07002991 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002992 pMac->lim.htCapabilityPresentInBeacon)
2993 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002994 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002995 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002996#ifdef WLAN_FEATURE_11AC
2997 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002998 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07002999 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -08003000 limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003001 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
Sandeep Puligilla60342762014-01-30 21:05:37 +05303002 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003003 }
3004#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003005
3006 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
3007 if ( DOT11F_FAILED( nStatus ) )
3008 {
3009 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003010 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 nStatus );
3012 // We'll fall back on the worst case scenario:
3013 nPayload = sizeof( tDot11fReAssocRequest );
3014 }
3015 else if ( DOT11F_WARNED( nStatus ) )
3016 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003017 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003019 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003020 }
3021
3022 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
3023
3024 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3025 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3026 ( void** ) &pPacket );
3027 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3028 {
3029 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003030 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003032 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 goto end;
3034 }
3035
3036 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303037 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003038
3039 // Next, we fill out the buffer descriptor:
3040 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3041 SIR_MAC_MGMT_REASSOC_REQ,
3042 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
3043 if ( eSIR_SUCCESS != nSirStatus )
3044 {
3045 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003046 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 nSirStatus );
3048 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3049 goto end;
3050 }
3051
3052
3053 // That done, pack the Probe Request:
3054 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
3055 sizeof(tSirMacMgmtHdr),
3056 nPayload, &nPayload );
3057 if ( DOT11F_FAILED( nStatus ) )
3058 {
3059 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003060 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 nStatus );
3062 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3063 goto end;
3064 }
3065 else if ( DOT11F_WARNED( nStatus ) )
3066 {
3067 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003068 "e-Association Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003069 }
3070
3071 PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003072 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003073 nBytes );)
3074
3075 if( psessionEntry->assocReq != NULL )
3076 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303077 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 psessionEntry->assocReq = NULL;
3079 }
3080
3081 if( nAddIELen )
3082 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303083 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
3084 pAddIE,
3085 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07003086 nPayload += nAddIELen;
3087 }
3088
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303089 psessionEntry->assocReq = vos_mem_malloc(nPayload);
3090 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003091 {
3092 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07003093 }
3094 else
3095 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003096 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303097 vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07003098 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07003099 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003100
3101 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3103 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003104 )
3105 {
3106 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3107 }
3108
Gopichand Nakkalad3918dd2012-12-31 16:27:55 -08003109 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08003110 {
3111 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3112 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003113
Jeff Johnson295189b2012-06-20 16:38:30 -07003114 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
3115 HAL_TXRX_FRM_802_11_MGMT,
3116 ANI_TXDIR_TODS,
3117 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3118 limTxComplete, pFrame, txFlag );
3119 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3120 {
3121 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003122 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003123 nSirStatus );
3124 //Pkt will be freed up by the callback
3125 goto end;
3126 }
3127
3128end:
3129 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303130 vos_mem_free( pMlmReassocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 psessionEntry->pLimMlmReassocReq = NULL;
3132
3133} // limSendReassocReqMgmtFrame
3134
3135/**
3136 * \brief Send an Authentication frame
3137 *
3138 *
3139 * \param pMac Pointer to Global MAC structure
3140 *
3141 * \param pAuthFrameBody Pointer to Authentication frame structure that need
3142 * to be sent
3143 *
3144 * \param peerMacAddr MAC address of the peer entity to which Authentication
3145 * frame is destined
3146 *
3147 * \param wepBit Indicates whether wep bit to be set in FC while sending
3148 * Authentication frame3
3149 *
3150 *
3151 * This function is called by limProcessMlmMessages(). Authentication frame
3152 * is formatted and sent when this function is called.
3153 *
3154 *
3155 */
3156
3157void
3158limSendAuthMgmtFrame(tpAniSirGlobal pMac,
3159 tpSirMacAuthFrameBody pAuthFrameBody,
3160 tSirMacAddr peerMacAddr,
3161 tANI_U8 wepBit,
3162 tpPESession psessionEntry
3163 )
3164{
3165 tANI_U8 *pFrame, *pBody;
3166 tANI_U32 frameLen = 0, bodyLen = 0;
3167 tpSirMacMgmtHdr pMacHdr;
3168 tANI_U16 i;
3169 void *pPacket;
3170 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303171 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003172
3173 if(NULL == psessionEntry)
3174 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303175 limLog(pMac, LOGE, FL("Error: psession Entry is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 return;
3177 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05303178
3179 limLog(pMac, LOG1,
3180 FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR),
3181 pAuthFrameBody->authTransactionSeqNumber,
3182 pAuthFrameBody->authStatusCode,
3183 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
3184 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 if (wepBit == LIM_WEP_IN_FC)
3186 {
3187 /// Auth frame3 to be sent with encrypted framebody
3188 /**
3189 * Allocate buffer for Authenticaton frame of size equal
3190 * to management frame header length plus 2 bytes each for
3191 * auth algorithm number, transaction number, status code,
3192 * 128 bytes for challenge text and 4 bytes each for
3193 * IV & ICV.
3194 */
3195
3196 frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN;
3197
3198 bodyLen = LIM_ENCR_AUTH_BODY_LEN;
3199 } // if (wepBit == LIM_WEP_IN_FC)
3200 else
3201 {
3202 switch (pAuthFrameBody->authTransactionSeqNumber)
3203 {
3204 case SIR_MAC_AUTH_FRAME_1:
3205 /**
3206 * Allocate buffer for Authenticaton frame of size
3207 * equal to management frame header length plus 2 bytes
3208 * each for auth algorithm number, transaction number
3209 * and status code.
3210 */
3211
3212 frameLen = sizeof(tSirMacMgmtHdr) +
3213 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3214 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3215
3216#if defined WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003217 if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH)
3218 {
3219 if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
Jeff Johnson295189b2012-06-20 16:38:30 -07003220 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003221 frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003222 limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"),
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003223 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003224 }
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003225 else
3226 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303227 limLog(pMac, LOG3, FL("Auth frame, Does not contain "
3228 "FTIES!!!"));
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003229 frameLen += (2+SIR_MDIE_SIZE);
3230 }
3231 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003232#endif
3233 break;
3234
3235 case SIR_MAC_AUTH_FRAME_2:
3236 if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) ||
3237 ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) &&
3238 (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS)))
3239 {
3240 /**
3241 * Allocate buffer for Authenticaton frame of size
3242 * equal to management frame header length plus
3243 * 2 bytes each for auth algorithm number,
3244 * transaction number and status code.
3245 */
3246
3247 frameLen = sizeof(tSirMacMgmtHdr) +
3248 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3249 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3250 }
3251 else
3252 {
3253 // Shared Key algorithm with challenge text
3254 // to be sent
3255 /**
3256 * Allocate buffer for Authenticaton frame of size
3257 * equal to management frame header length plus
3258 * 2 bytes each for auth algorithm number,
3259 * transaction number, status code and 128 bytes
3260 * for challenge text.
3261 */
3262
3263 frameLen = sizeof(tSirMacMgmtHdr) +
3264 sizeof(tSirMacAuthFrame);
3265 bodyLen = sizeof(tSirMacAuthFrameBody);
3266 }
3267
3268 break;
3269
3270 case SIR_MAC_AUTH_FRAME_3:
3271 /// Auth frame3 to be sent without encrypted framebody
3272 /**
3273 * Allocate buffer for Authenticaton frame of size equal
3274 * to management frame header length plus 2 bytes each
3275 * for auth algorithm number, transaction number and
3276 * status code.
3277 */
3278
3279 frameLen = sizeof(tSirMacMgmtHdr) +
3280 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3281 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3282
3283 break;
3284
3285 case SIR_MAC_AUTH_FRAME_4:
3286 /**
3287 * Allocate buffer for Authenticaton frame of size equal
3288 * to management frame header length plus 2 bytes each
3289 * for auth algorithm number, transaction number and
3290 * status code.
3291 */
3292
3293 frameLen = sizeof(tSirMacMgmtHdr) +
3294 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3295 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3296
3297 break;
3298 } // switch (pAuthFrameBody->authTransactionSeqNumber)
3299 } // end if (wepBit == LIM_WEP_IN_FC)
3300
3301
3302 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket );
3303
3304 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3305 {
3306 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003307 limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003308
3309 return;
3310 }
3311
3312 for (i = 0; i < frameLen; i++)
3313 pFrame[i] = 0;
3314
3315 // Prepare BD
3316 if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME,
3317 SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS)
3318 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303319 limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for "
3320 "AUTH frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3322 return;
3323 }
3324
3325 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
3326 pMacHdr->fc.wep = wepBit;
3327
3328 // Prepare BSSId
3329 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
3330 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303331 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
3332 (tANI_U8 *) psessionEntry->bssId,
3333 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003334 }
3335
3336 /// Prepare Authentication frame body
3337 pBody = pFrame + sizeof(tSirMacMgmtHdr);
3338
3339 if (wepBit == LIM_WEP_IN_FC)
3340 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303341 vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07003342
3343 PELOG1(limLog(pMac, LOG1,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303344 FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR),
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 pAuthFrameBody->authStatusCode,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303346 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
3347 MAC_ADDR_ARRAY(pMacHdr->da));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003348
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 }
3350 else
3351 {
3352 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber);
3353 pBody += sizeof(tANI_U16);
3354 bodyLen -= sizeof(tANI_U16);
3355
3356 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber);
3357 pBody += sizeof(tANI_U16);
3358 bodyLen -= sizeof(tANI_U16);
3359
3360 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode);
3361 pBody += sizeof(tANI_U16);
3362 bodyLen -= sizeof(tANI_U16);
Leela Venkata Kiran Kumar Reddy Chirala7d3fa552013-08-28 10:52:21 -07003363 if ( bodyLen <= (sizeof (pAuthFrameBody->type) +
3364 sizeof (pAuthFrameBody->length) +
3365 sizeof (pAuthFrameBody->challengeText)))
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303366 vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07003367
3368#if defined WLAN_FEATURE_VOWIFI_11R
3369 if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) &&
3370 (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1))
3371 {
3372
3373 {
3374 int i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
3376 {
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003377#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 PELOGE(limLog(pMac, LOGE, FL("Auth1 Frame FTIE is: "));
3379 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE,
3380 (tANI_U8 *)pBody,
3381 (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003382#endif
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003383 for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++)
3384 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003385 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i];
3386 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003387 }
3388 }
3389 else
3390 {
3391 /* MDID attr is 54*/
3392 *pBody = 54;
Jeff Johnson295189b2012-06-20 16:38:30 -07003393 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003394 *pBody = SIR_MDIE_SIZE;
3395 pBody++;
3396 for(i=0;i<SIR_MDIE_SIZE;i++)
3397 {
3398 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i];
3399 pBody++;
3400 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003401 }
3402 }
3403 }
3404#endif
3405
3406 PELOG1(limLog(pMac, LOG1,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303407 FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR),
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 pAuthFrameBody->authTransactionSeqNumber,
3409 pAuthFrameBody->authStatusCode,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303410 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
3411 MAC_ADDR_ARRAY(pMacHdr->da));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 }
3413 PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);)
3414
3415 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3417 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnsone7245742012-09-05 17:12:55 -07003418#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303419 || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq)
Jeff Johnsone7245742012-09-05 17:12:55 -07003420 && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)))
3421#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 )
3423 {
3424 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3425 }
3426
Ganesh K08bce952012-12-13 15:04:41 -08003427 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
3428 {
3429 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3430 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003431
Jeff Johnson295189b2012-06-20 16:38:30 -07003432 /// Queue Authentication frame in high priority WQ
3433 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen,
3434 HAL_TXRX_FRM_802_11_MGMT,
3435 ANI_TXDIR_TODS,
3436 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3437 limTxComplete, pFrame, txFlag );
3438 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3439 {
3440 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003441 FL("*** Could not send Auth frame, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003442 halstatus);
3443
3444 //Pkt will be freed up by the callback
3445 }
3446
3447 return;
3448} /*** end limSendAuthMgmtFrame() ***/
3449
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003450eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac)
3451{
3452 tANI_U16 aid;
3453 tpDphHashNode pStaDs;
3454 tLimMlmDeauthReq *pMlmDeauthReq;
3455 tLimMlmDeauthCnf mlmDeauthCnf;
3456 tpPESession psessionEntry;
3457
3458 pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq;
3459 if (pMlmDeauthReq)
3460 {
3461 if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer))
3462 {
3463 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
3464 }
3465
3466 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL)
3467 {
3468
3469 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003470 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003471 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3472 goto end;
3473 }
3474
3475 pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
3476 if (pStaDs == NULL)
3477 {
3478 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3479 goto end;
3480 }
3481
3482
3483 /// Receive path cleanup with dummy packet
3484 limCleanupRxPath(pMac, pStaDs,psessionEntry);
3485 /// Free up buffer allocated for mlmDeauthReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303486 vos_mem_free(pMlmDeauthReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003487 pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL;
3488 }
3489 return eHAL_STATUS_SUCCESS;
3490end:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303491 vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003492 (tANI_U8 *) pMlmDeauthReq->peerMacAddr,
3493 sizeof(tSirMacAddr));
3494 mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger;
3495 mlmDeauthCnf.aid = pMlmDeauthReq->aid;
3496 mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId;
3497
3498 // Free up buffer allocated
3499 // for mlmDeauthReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303500 vos_mem_free(pMlmDeauthReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003501
3502 limPostSmeMessage(pMac,
3503 LIM_MLM_DEAUTH_CNF,
3504 (tANI_U32 *) &mlmDeauthCnf);
3505 return eHAL_STATUS_SUCCESS;
3506}
3507
3508eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac)
3509{
3510 tANI_U16 aid;
3511 tpDphHashNode pStaDs;
3512 tLimMlmDisassocCnf mlmDisassocCnf;
3513 tpPESession psessionEntry;
3514 tLimMlmDisassocReq *pMlmDisassocReq;
3515
3516 pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq;
3517 if (pMlmDisassocReq)
3518 {
3519 if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer))
3520 {
3521 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
3522 }
3523
3524 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL)
3525 {
3526
3527 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003528 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003529 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3530 goto end;
3531 }
3532
3533 pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
3534 if (pStaDs == NULL)
3535 {
3536 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3537 goto end;
3538 }
3539
3540 /// Receive path cleanup with dummy packet
3541 if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry))
3542 {
3543 mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3544 goto end;
3545 }
3546
3547#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003548 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) &&
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303549 (
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003550#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303551 (psessionEntry->isCCXconnection ) ||
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003552#endif
3553#ifdef FEATURE_WLAN_LFR
3554 (psessionEntry->isFastRoamIniFeatureEnabled ) ||
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003555#endif
3556 (psessionEntry->is11Rconnection )) &&
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303557 (pMlmDisassocReq->reasonCode !=
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003558 eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003559 {
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303560 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003561 FL("FT Preauth Session (%p,%d) Cleanup"),
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003562 psessionEntry, psessionEntry->peSessionId););
3563 limFTCleanup(pMac);
3564 }
3565 else
3566 {
3567 PELOGE(limLog(pMac, LOGE,
3568 FL("No FT Preauth Session Cleanup in role %d"
3569#ifdef FEATURE_WLAN_CCX
3570 " isCCX %d"
3571#endif
3572#ifdef FEATURE_WLAN_LFR
3573 " isLFR %d"
3574#endif
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003575 " is11r %d reason %d"),
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003576 psessionEntry->limSystemRole,
3577#ifdef FEATURE_WLAN_CCX
3578 psessionEntry->isCCXconnection,
3579#endif
3580#ifdef FEATURE_WLAN_LFR
3581 psessionEntry->isFastRoamIniFeatureEnabled,
3582#endif
3583 psessionEntry->is11Rconnection,
3584 pMlmDisassocReq->reasonCode););
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003585 }
3586#endif
3587
3588 /// Free up buffer allocated for mlmDisassocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303589 vos_mem_free(pMlmDisassocReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003590 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
3591 return eHAL_STATUS_SUCCESS;
3592 }
3593 else
3594 {
3595 return eHAL_STATUS_SUCCESS;
3596 }
3597end:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303598 vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003599 (tANI_U8 *) pMlmDisassocReq->peerMacAddr,
3600 sizeof(tSirMacAddr));
3601 mlmDisassocCnf.aid = pMlmDisassocReq->aid;
3602 mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger;
3603
3604 /* Update PE session ID*/
3605 mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId;
3606
Madan Mohan Koyyalamudib7f5a672012-11-29 11:17:46 -08003607 if(pMlmDisassocReq != NULL)
3608 {
3609 /// Free up buffer allocated for mlmDisassocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303610 vos_mem_free(pMlmDisassocReq);
Madan Mohan Koyyalamudib7f5a672012-11-29 11:17:46 -08003611 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
3612 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003613
3614 limPostSmeMessage(pMac,
3615 LIM_MLM_DISASSOC_CNF,
3616 (tANI_U32 *) &mlmDisassocCnf);
3617 return eHAL_STATUS_SUCCESS;
3618}
3619
3620eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
3621{
3622 return limSendDisassocCnf(pMac);
3623}
3624
3625eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
3626{
3627 return limSendDeauthCnf(pMac);
3628}
3629
Jeff Johnson295189b2012-06-20 16:38:30 -07003630/**
3631 * \brief This function is called to send Disassociate frame.
3632 *
3633 *
3634 * \param pMac Pointer to Global MAC structure
3635 *
3636 * \param nReason Indicates the reason that need to be sent in
3637 * Disassociation frame
3638 *
3639 * \param peerMacAddr MAC address of the STA to which Disassociation frame is
3640 * sent
3641 *
3642 *
3643 */
3644
3645void
3646limSendDisassocMgmtFrame(tpAniSirGlobal pMac,
3647 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003648 tSirMacAddr peer,
3649 tpPESession psessionEntry,
3650 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003651{
3652 tDot11fDisassociation frm;
3653 tANI_U8 *pFrame;
3654 tSirRetStatus nSirStatus;
3655 tpSirMacMgmtHdr pMacHdr;
3656 tANI_U32 nBytes, nPayload, nStatus;
3657 void *pPacket;
3658 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303659 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003660 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003661 if(NULL == psessionEntry)
3662 {
3663 return;
3664 }
3665
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303666 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003667
3668 frm.Reason.code = nReason;
3669
3670 nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload );
3671 if ( DOT11F_FAILED( nStatus ) )
3672 {
3673 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003674 "or a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003675 nStatus );
3676 // We'll fall back on the worst case scenario:
3677 nPayload = sizeof( tDot11fDisassociation );
3678 }
3679 else if ( DOT11F_WARNED( nStatus ) )
3680 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003681 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 "the packed size for a Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003683 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 }
3685
3686 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
3687
3688 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3689 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3690 ( void** ) &pPacket );
3691 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3692 {
3693 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Dis"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003694 "association."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 return;
3696 }
3697
3698 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303699 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003700
3701 // Next, we fill out the buffer descriptor:
3702 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3703 SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr);
3704 if ( eSIR_SUCCESS != nSirStatus )
3705 {
3706 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003707 "tor for a Disassociation (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003708 nSirStatus );
3709 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3710 ( void* ) pFrame, ( void* ) pPacket );
3711 return; // just allocated...
3712 }
3713
3714 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
3715
3716 // Prepare the BSSID
3717 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
3718
Chet Lanctot186b5732013-03-18 10:26:30 -07003719#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07003720 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07003721#endif
3722
Jeff Johnson295189b2012-06-20 16:38:30 -07003723 nStatus = dot11fPackDisassociation( pMac, &frm, pFrame +
3724 sizeof(tSirMacMgmtHdr),
3725 nPayload, &nPayload );
3726 if ( DOT11F_FAILED( nStatus ) )
3727 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003728 limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003729 nStatus );
3730 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3731 ( void* ) pFrame, ( void* ) pPacket );
3732 return; // allocated!
3733 }
3734 else if ( DOT11F_WARNED( nStatus ) )
3735 {
3736 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003737 "isassociation (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003738 }
3739
Abhishek Singhcd09b562013-12-24 16:02:20 +05303740 limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with "
3741 "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From "
3742 MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck,
3743 MAC_ADDR_ARRAY(pMacHdr->da),
3744 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003745
3746 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003747 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3748 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003749 )
3750 {
3751 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3752 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003753
Ganesh K08bce952012-12-13 15:04:41 -08003754 if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303755 (psessionEntry->pePersona == VOS_P2P_GO_MODE) ||
3756 (psessionEntry->pePersona == VOS_STA_SAP_MODE))
Ganesh K08bce952012-12-13 15:04:41 -08003757 {
3758 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3759 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003760
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303761 if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
3762 {
3763 /* This frame will be sent on air by firmware,
3764 which will ensure that this frame goes out
3765 even though DEL_STA is sent immediately */
3766 /* Without this for DEL_STA command there is
3767 risk of flushing frame in BTQM queue without
3768 sending on air */
3769 txFlag |= HAL_USE_FW_IN_TX_PATH;
3770 }
3771
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003772 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003773 {
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003774 // Queue Disassociation frame in high priority WQ
3775 /* get the duration from the request */
3776 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
3777 HAL_TXRX_FRM_802_11_MGMT,
3778 ANI_TXDIR_TODS,
3779 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3780 limTxComplete, pFrame, limDisassocTxCompleteCnf,
3781 txFlag );
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303782
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003783 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
Jeff Johnson295189b2012-06-20 16:38:30 -07003784
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003785 if (tx_timer_change(
3786 &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0)
3787 != TX_SUCCESS)
3788 {
3789 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003790 FL("Unable to change Disassoc ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003791 return;
3792 }
3793 else if(TX_SUCCESS != tx_timer_activate(
3794 &pMac->lim.limTimers.gLimDisassocAckTimer))
3795 {
3796 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003797 FL("Unable to activate Disassoc ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003798 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
3799 return;
3800 }
3801 }
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003802 else
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003803 {
3804 // Queue Disassociation frame in high priority WQ
3805 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
3806 HAL_TXRX_FRM_802_11_MGMT,
3807 ANI_TXDIR_TODS,
3808 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3809 limTxComplete, pFrame, txFlag );
3810 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3811 {
3812 limLog( pMac, LOGE, FL("Failed to send Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003813 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003814 nSirStatus );
3815 //Pkt will be freed up by the callback
3816 return;
3817 }
3818 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003819} // End limSendDisassocMgmtFrame.
3820
3821/**
3822 * \brief This function is called to send a Deauthenticate frame
3823 *
3824 *
3825 * \param pMac Pointer to global MAC structure
3826 *
3827 * \param nReason Indicates the reason that need to be sent in the
3828 * Deauthenticate frame
3829 *
3830 * \param peeer address of the STA to which the frame is to be sent
3831 *
3832 *
3833 */
3834
3835void
3836limSendDeauthMgmtFrame(tpAniSirGlobal pMac,
3837 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003838 tSirMacAddr peer,
3839 tpPESession psessionEntry,
3840 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003841{
3842 tDot11fDeAuth frm;
3843 tANI_U8 *pFrame;
3844 tSirRetStatus nSirStatus;
3845 tpSirMacMgmtHdr pMacHdr;
3846 tANI_U32 nBytes, nPayload, nStatus;
3847 void *pPacket;
3848 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303849 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003850 tANI_U32 val = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003851#ifdef FEATURE_WLAN_TDLS
3852 tANI_U16 aid;
3853 tpDphHashNode pStaDs;
3854#endif
3855
Jeff Johnson295189b2012-06-20 16:38:30 -07003856 if(NULL == psessionEntry)
3857 {
3858 return;
3859 }
3860
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303861 vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003862
3863 frm.Reason.code = nReason;
3864
3865 nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload );
3866 if ( DOT11F_FAILED( nStatus ) )
3867 {
3868 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003869 "or a De-Authentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 nStatus );
3871 // We'll fall back on the worst case scenario:
3872 nPayload = sizeof( tDot11fDeAuth );
3873 }
3874 else if ( DOT11F_WARNED( nStatus ) )
3875 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003876 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 "the packed size for a De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003878 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 }
3880
3881 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
3882
3883 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3884 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3885 ( void** ) &pPacket );
3886 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3887 {
3888 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003889 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 return;
3891 }
3892
3893 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303894 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003895
3896 // Next, we fill out the buffer descriptor:
3897 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3898 SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr);
3899 if ( eSIR_SUCCESS != nSirStatus )
3900 {
3901 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003902 "tor for a De-Authentication (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 nSirStatus );
3904 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3905 ( void* ) pFrame, ( void* ) pPacket );
3906 return; // just allocated...
3907 }
3908
3909 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
3910
3911 // Prepare the BSSID
3912 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
3913
Chet Lanctot186b5732013-03-18 10:26:30 -07003914#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07003915 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07003916#endif
3917
Jeff Johnson295189b2012-06-20 16:38:30 -07003918 nStatus = dot11fPackDeAuth( pMac, &frm, pFrame +
3919 sizeof(tSirMacMgmtHdr),
3920 nPayload, &nPayload );
3921 if ( DOT11F_FAILED( nStatus ) )
3922 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003923 limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 nStatus );
3925 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3926 ( void* ) pFrame, ( void* ) pPacket );
3927 return;
3928 }
3929 else if ( DOT11F_WARNED( nStatus ) )
3930 {
3931 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003932 "e-Authentication (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003933 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05303934 limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with "
3935 "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From "
3936 MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck,
3937 MAC_ADDR_ARRAY(pMacHdr->da),
3938 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003939
3940 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3942 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003943 )
3944 {
3945 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3946 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003947
Ganesh K08bce952012-12-13 15:04:41 -08003948 if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303949 (psessionEntry->pePersona == VOS_P2P_GO_MODE) ||
3950 (psessionEntry->pePersona == VOS_STA_SAP_MODE))
Ganesh K08bce952012-12-13 15:04:41 -08003951 {
3952 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3953 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003954
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303955 if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
3956 {
3957 /* This frame will be sent on air by firmware,
3958 which will ensure that this frame goes out
3959 even though DEL_STA is sent immediately */
3960 /* Without this for DEL_STA command there is
3961 risk of flushing frame in BTQM queue without
3962 sending on air */
3963 txFlag |= HAL_USE_FW_IN_TX_PATH;
3964 }
3965
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003966#ifdef FEATURE_WLAN_TDLS
3967 pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable);
3968#endif
3969
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003970 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 {
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003972 // Queue Disassociation frame in high priority WQ
3973 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
3974 HAL_TXRX_FRM_802_11_MGMT,
3975 ANI_TXDIR_TODS,
3976 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3977 limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag );
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303978
3979 if (!HAL_STATUS_SUCCESS(halstatus))
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003980 {
3981 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303982 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003983 nSirStatus );
Gopichand Nakkala4261ea52012-12-31 16:43:00 -08003984 //Pkt will be freed up by the callback limTxComplete
3985
3986 /*Call limProcessDeauthAckTimeout which will send
3987 * DeauthCnf for this frame
3988 */
3989 limProcessDeauthAckTimeout(pMac);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003990 return;
3991 }
3992
3993 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
3994
3995 if (tx_timer_change(
3996 &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0)
3997 != TX_SUCCESS)
3998 {
3999 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004000 FL("Unable to change Deauth ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004001 return;
4002 }
4003 else if(TX_SUCCESS != tx_timer_activate(
4004 &pMac->lim.limTimers.gLimDeauthAckTimer))
4005 {
4006 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004007 FL("Unable to activate Deauth ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004008 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
4009 return;
4010 }
4011 }
4012 else
4013 {
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004014#ifdef FEATURE_WLAN_TDLS
4015 if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType))
4016 {
4017 // Queue Disassociation frame in high priority WQ
4018 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004019 HAL_TXRX_FRM_802_11_MGMT,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004020 ANI_TXDIR_IBSS,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004021 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4022 limTxComplete, pFrame, txFlag );
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004023 }
4024 else
4025 {
4026#endif
4027 // Queue Disassociation frame in high priority WQ
4028 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4029 HAL_TXRX_FRM_802_11_MGMT,
4030 ANI_TXDIR_TODS,
4031 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4032 limTxComplete, pFrame, txFlag );
4033#ifdef FEATURE_WLAN_TDLS
4034 }
4035#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004036 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4037 {
4038 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004039 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004040 nSirStatus );
4041 //Pkt will be freed up by the callback
4042 return;
4043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004044 }
4045
4046} // End limSendDeauthMgmtFrame.
4047
4048
4049#ifdef ANI_SUPPORT_11H
4050/**
4051 * \brief Send a Measurement Report Action frame
4052 *
4053 *
4054 * \param pMac Pointer to the global MAC structure
4055 *
4056 * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame
4057 *
4058 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4059 *
4060 *
4061 */
4062
4063tSirRetStatus
4064limSendMeasReportFrame(tpAniSirGlobal pMac,
4065 tpSirMacMeasReqActionFrame pMeasReqFrame,
4066 tSirMacAddr peer)
4067{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304068 tDot11fMeasurementReport frm;
4069 tANI_U8 *pFrame;
4070 tSirRetStatus nSirStatus;
4071 tpSirMacMgmtHdr pMacHdr;
4072 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4073 void *pPacket;
4074 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004075
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304076 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004077
4078 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4079 frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID;
4080 frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken;
4081
4082 switch ( pMeasReqFrame->measReqIE.measType )
4083 {
4084 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
4085 nSirStatus =
4086 PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame,
4087 &frm.MeasurementReport );
4088 break;
4089 case SIR_MAC_CCA_MEASUREMENT_TYPE:
4090 nSirStatus =
4091 PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame,
4092 &frm.MeasurementReport );
4093 break;
4094 case SIR_MAC_RPI_MEASUREMENT_TYPE:
4095 nSirStatus =
4096 PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame,
4097 &frm.MeasurementReport );
4098 break;
4099 default:
4100 limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004101 "dMeasReportFrame."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004102 pMeasReqFrame->measReqIE.measType );
4103 return eSIR_FAILURE;
4104 }
4105
4106 if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE;
4107
4108 nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload );
4109 if ( DOT11F_FAILED( nStatus ) )
4110 {
4111 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004112 "or a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 nStatus );
4114 // We'll fall back on the worst case scenario:
4115 nPayload = sizeof( tDot11fMeasurementReport );
4116 }
4117 else if ( DOT11F_WARNED( nStatus ) )
4118 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004119 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004120 "the packed size for a Measurement Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004121 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004122 }
4123
4124 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4125
4126 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4127 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4128 {
4129 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004130 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 return eSIR_FAILURE;
4132 }
4133
4134 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304135 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004136
4137 // Next, we fill out the buffer descriptor:
4138 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4139 SIR_MAC_MGMT_ACTION, peer);
4140 if ( eSIR_SUCCESS != nSirStatus )
4141 {
4142 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004143 "tor for a Measurement Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004144 nSirStatus );
4145 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4146 return eSIR_FAILURE; // just allocated...
4147 }
4148
4149 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4150
4151 nCfg = 6;
4152 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4153 if ( eSIR_SUCCESS != nSirStatus )
4154 {
4155 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004156 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004157 nSirStatus );
4158 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4159 return eSIR_FAILURE; // just allocated...
4160 }
4161
Chet Lanctot186b5732013-03-18 10:26:30 -07004162#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004163 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004164#endif
4165
Jeff Johnson295189b2012-06-20 16:38:30 -07004166 nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame +
4167 sizeof(tSirMacMgmtHdr),
4168 nPayload, &nPayload );
4169 if ( DOT11F_FAILED( nStatus ) )
4170 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004171 limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004172 nStatus );
4173 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4174 return eSIR_FAILURE; // allocated!
4175 }
4176 else if ( DOT11F_WARNED( nStatus ) )
4177 {
4178 limLog( pMac, LOGW, FL("There were warnings while packing a M"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004179 "easurement Report (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 }
4181
4182 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4183 HAL_TXRX_FRM_802_11_MGMT,
4184 ANI_TXDIR_TODS,
4185 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4186 limTxComplete, pFrame, 0 );
4187 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4188 {
4189 limLog( pMac, LOGE, FL("Failed to send a Measurement Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004190 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004191 nSirStatus );
4192 //Pkt will be freed up by the callback
4193 return eSIR_FAILURE; // just allocated...
4194 }
4195
4196 return eSIR_SUCCESS;
4197
4198} // End limSendMeasReportFrame.
4199
4200
4201/**
4202 * \brief Send a TPC Request Action frame
4203 *
4204 *
4205 * \param pMac Pointer to the global MAC datastructure
4206 *
4207 * \param peer MAC address to which the frame should be sent
4208 *
4209 *
4210 */
4211
4212void
4213limSendTpcRequestFrame(tpAniSirGlobal pMac,
4214 tSirMacAddr peer)
4215{
4216 tDot11fTPCRequest frm;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304217 tANI_U8 *pFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 tSirRetStatus nSirStatus;
4219 tpSirMacMgmtHdr pMacHdr;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304220 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4221 void *pPacket;
4222 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004223
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304224 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004225
4226 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4227 frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID;
4228 frm.DialogToken.token = 1;
4229 frm.TPCRequest.present = 1;
4230
4231 nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload );
4232 if ( DOT11F_FAILED( nStatus ) )
4233 {
4234 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004235 "or a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004236 nStatus );
4237 // We'll fall back on the worst case scenario:
4238 nPayload = sizeof( tDot11fTPCRequest );
4239 }
4240 else if ( DOT11F_WARNED( nStatus ) )
4241 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004242 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004243 "the packed size for a TPC Request (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004244 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004245 }
4246
4247 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4248
4249 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4250 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4251 {
4252 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004253 " Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 return;
4255 }
4256
4257 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304258 vos_mem_set(pFrame, nBytes,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004259
4260 // Next, we fill out the buffer descriptor:
4261 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4262 SIR_MAC_MGMT_ACTION, peer);
4263 if ( eSIR_SUCCESS != nSirStatus )
4264 {
4265 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004266 "tor for a TPC Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 nSirStatus );
4268 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4269 return; // just allocated...
4270 }
4271
4272 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4273
4274 nCfg = 6;
4275 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4276 if ( eSIR_SUCCESS != nSirStatus )
4277 {
4278 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004279 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 nSirStatus );
4281 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4282 return; // just allocated...
4283 }
4284
Chet Lanctot186b5732013-03-18 10:26:30 -07004285#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004286 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004287#endif
4288
Jeff Johnson295189b2012-06-20 16:38:30 -07004289 nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame +
4290 sizeof(tSirMacMgmtHdr),
4291 nPayload, &nPayload );
4292 if ( DOT11F_FAILED( nStatus ) )
4293 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004294 limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 nStatus );
4296 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4297 return; // allocated!
4298 }
4299 else if ( DOT11F_WARNED( nStatus ) )
4300 {
4301 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004302 "PC Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004303 }
4304
4305 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4306 HAL_TXRX_FRM_802_11_MGMT,
4307 ANI_TXDIR_TODS,
4308 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4309 limTxComplete, pFrame, 0 );
4310 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4311 {
4312 limLog( pMac, LOGE, FL("Failed to send a TPC Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004313 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 nSirStatus );
4315 //Pkt will be freed up by the callback
4316 return;
4317 }
4318
4319} // End limSendTpcRequestFrame.
4320
4321
4322/**
4323 * \brief Send a TPC Report Action frame
4324 *
4325 *
4326 * \param pMac Pointer to the global MAC datastructure
4327 *
4328 * \param pTpcReqFrame Pointer to the received TPC Request
4329 *
4330 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4331 *
4332 *
4333 */
4334
4335tSirRetStatus
4336limSendTpcReportFrame(tpAniSirGlobal pMac,
4337 tpSirMacTpcReqActionFrame pTpcReqFrame,
4338 tSirMacAddr peer)
4339{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304340 tDot11fTPCReport frm;
4341 tANI_U8 *pFrame;
4342 tSirRetStatus nSirStatus;
4343 tpSirMacMgmtHdr pMacHdr;
4344 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4345 void *pPacket;
4346 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004347
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304348 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004349
4350 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4351 frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID;
4352 frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken;
4353
4354 // FramesToDo: On the Gen4_TVM branch, there was a comment:
4355 // "misplaced this function, need to replace:
4356 // txPower = halGetRateToPwrValue(pMac, staid,
4357 // pMac->lim.gLimCurrentChannelId, 0);
4358 frm.TPCReport.tx_power = 0;
4359 frm.TPCReport.link_margin = 0;
4360 frm.TPCReport.present = 1;
4361
4362 nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload );
4363 if ( DOT11F_FAILED( nStatus ) )
4364 {
4365 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004366 "or a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004367 nStatus );
4368 // We'll fall back on the worst case scenario:
4369 nPayload = sizeof( tDot11fTPCReport );
4370 }
4371 else if ( DOT11F_WARNED( nStatus ) )
4372 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004373 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 "the packed size for a TPC Report (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004375 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 }
4377
4378 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4379
4380 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4381 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4382 {
4383 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004384 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004385 return eSIR_FAILURE;
4386 }
4387
4388 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304389 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004390
4391 // Next, we fill out the buffer descriptor:
4392 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4393 SIR_MAC_MGMT_ACTION, peer);
4394 if ( eSIR_SUCCESS != nSirStatus )
4395 {
4396 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004397 "tor for a TPC Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004398 nSirStatus );
4399 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4400 return eSIR_FAILURE; // just allocated...
4401 }
4402
4403 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4404
4405 nCfg = 6;
4406 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4407 if ( eSIR_SUCCESS != nSirStatus )
4408 {
4409 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004410 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 nSirStatus );
4412 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4413 return eSIR_FAILURE; // just allocated...
4414 }
4415
Chet Lanctot186b5732013-03-18 10:26:30 -07004416#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004417 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004418#endif
4419
Jeff Johnson295189b2012-06-20 16:38:30 -07004420 nStatus = dot11fPackTPCReport( pMac, &frm, pFrame +
4421 sizeof(tSirMacMgmtHdr),
4422 nPayload, &nPayload );
4423 if ( DOT11F_FAILED( nStatus ) )
4424 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004425 limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 nStatus );
4427 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4428 return eSIR_FAILURE; // allocated!
4429 }
4430 else if ( DOT11F_WARNED( nStatus ) )
4431 {
4432 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004433 "PC Report (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004434 }
4435
4436
4437 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4438 HAL_TXRX_FRM_802_11_MGMT,
4439 ANI_TXDIR_TODS,
4440 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4441 limTxComplete, pFrame, 0 );
4442 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4443 {
4444 limLog( pMac, LOGE, FL("Failed to send a TPC Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004445 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004446 nSirStatus );
4447 //Pkt will be freed up by the callback
4448 return eSIR_FAILURE; // just allocated...
4449 }
4450
4451 return eSIR_SUCCESS;
4452
4453} // End limSendTpcReportFrame.
4454#endif //ANI_SUPPORT_11H
4455
4456
Jeff Johnson295189b2012-06-20 16:38:30 -07004457/**
4458 * \brief Send a Channel Switch Announcement
4459 *
4460 *
4461 * \param pMac Pointer to the global MAC datastructure
4462 *
4463 * \param peer MAC address to which this frame will be sent
4464 *
4465 * \param nMode
4466 *
4467 * \param nNewChannel
4468 *
4469 * \param nCount
4470 *
4471 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4472 *
4473 *
4474 */
4475
4476tSirRetStatus
4477limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
4478 tSirMacAddr peer,
Jeff Johnsone7245742012-09-05 17:12:55 -07004479 tANI_U8 nMode,
4480 tANI_U8 nNewChannel,
4481 tANI_U8 nCount,
4482 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07004483{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304484 tDot11fChannelSwitch frm;
4485 tANI_U8 *pFrame;
4486 tSirRetStatus nSirStatus;
4487 tpSirMacMgmtHdr pMacHdr;
4488 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
4489 void *pPacket;
4490 eHalStatus halstatus;
4491 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004492
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304493 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004494
4495 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4496 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
4497 frm.ChanSwitchAnn.switchMode = nMode;
4498 frm.ChanSwitchAnn.newChannel = nNewChannel;
4499 frm.ChanSwitchAnn.switchCount = nCount;
4500 frm.ChanSwitchAnn.present = 1;
4501
4502 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
4503 if ( DOT11F_FAILED( nStatus ) )
4504 {
4505 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004506 "or a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004507 nStatus );
4508 // We'll fall back on the worst case scenario:
4509 nPayload = sizeof( tDot11fChannelSwitch );
4510 }
4511 else if ( DOT11F_WARNED( nStatus ) )
4512 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004513 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004515 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004516 }
4517
4518 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4519
4520 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4521 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4522 {
4523 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004524 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 return eSIR_FAILURE;
4526 }
4527
4528 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304529 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004530
4531 // Next, we fill out the buffer descriptor:
4532 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
Jeff Johnsone7245742012-09-05 17:12:55 -07004533 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
4534 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304535 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
4536 (tANI_U8 *) psessionEntry->bssId,
4537 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 if ( eSIR_SUCCESS != nSirStatus )
4539 {
4540 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004541 "tor for a Channel Switch (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004542 nSirStatus );
4543 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4544 return eSIR_FAILURE; // just allocated...
4545 }
4546
Jeff Johnsone7245742012-09-05 17:12:55 -07004547#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4549
4550 nCfg = 6;
4551 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4552 if ( eSIR_SUCCESS != nSirStatus )
4553 {
4554 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004555 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 nSirStatus );
4557 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4558 return eSIR_FAILURE; // just allocated...
4559 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004560#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07004561
4562#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004563 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004564#endif
4565
Jeff Johnson295189b2012-06-20 16:38:30 -07004566 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
4567 sizeof(tSirMacMgmtHdr),
4568 nPayload, &nPayload );
4569 if ( DOT11F_FAILED( nStatus ) )
4570 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004571 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004572 nStatus );
4573 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4574 return eSIR_FAILURE; // allocated!
4575 }
4576 else if ( DOT11F_WARNED( nStatus ) )
4577 {
4578 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004579 "hannel Switch (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 }
4581
Jeff Johnsone7245742012-09-05 17:12:55 -07004582 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnsone7245742012-09-05 17:12:55 -07004583 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4584 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnsone7245742012-09-05 17:12:55 -07004585 )
4586 {
4587 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4588 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4590 HAL_TXRX_FRM_802_11_MGMT,
4591 ANI_TXDIR_TODS,
4592 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Jeff Johnsone7245742012-09-05 17:12:55 -07004593 limTxComplete, pFrame, txFlag );
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4595 {
4596 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004597 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 nSirStatus );
4599 //Pkt will be freed up by the callback
4600 return eSIR_FAILURE;
4601 }
4602
4603 return eSIR_SUCCESS;
4604
4605} // End limSendChannelSwitchMgmtFrame.
4606
Jeff Johnson295189b2012-06-20 16:38:30 -07004607
4608
Mohit Khanna4a70d262012-09-11 16:30:12 -07004609#ifdef WLAN_FEATURE_11AC
4610tSirRetStatus
4611limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac,
4612 tSirMacAddr peer,
4613 tANI_U8 nMode,
4614 tpPESession psessionEntry )
4615{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304616 tDot11fOperatingMode frm;
4617 tANI_U8 *pFrame;
4618 tSirRetStatus nSirStatus;
4619 tpSirMacMgmtHdr pMacHdr;
4620 tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg;
4621 void *pPacket;
4622 eHalStatus halstatus;
4623 tANI_U32 txFlag = 0;
Mohit Khanna4a70d262012-09-11 16:30:12 -07004624
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304625 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004626
4627 frm.Category.category = SIR_MAC_ACTION_VHT;
4628 frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION;
4629 frm.OperatingMode.chanWidth = nMode;
4630 frm.OperatingMode.rxNSS = 0;
4631 frm.OperatingMode.rxNSSType = 0;
4632
4633 nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload );
4634 if ( DOT11F_FAILED( nStatus ) )
4635 {
4636 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004637 "or a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004638 nStatus );
4639 // We'll fall back on the worst case scenario:
4640 nPayload = sizeof( tDot11fOperatingMode);
4641 }
4642 else if ( DOT11F_WARNED( nStatus ) )
4643 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004644 limLog( pMac, LOGW, FL("There were warnings while calculating "
Mohit Khanna4a70d262012-09-11 16:30:12 -07004645 "the packed size for a Operating Mode (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004646 "%08x)."), nStatus );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004647 }
4648
4649 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4650
4651 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4652 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4653 {
4654 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Operating Mode"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004655 " Report."), nBytes );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004656 return eSIR_FAILURE;
4657 }
4658
4659 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304660 vos_mem_set( pFrame, nBytes, 0 );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004661
4662
4663 // Next, we fill out the buffer descriptor:
4664 if(psessionEntry->pePersona == VOS_STA_SAP_MODE) {
4665 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4666 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
4667 } else
4668 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4669 SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr);
4670 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304671 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
4672 (tANI_U8 *) psessionEntry->bssId,
4673 sizeof( tSirMacAddr ));
Mohit Khanna4a70d262012-09-11 16:30:12 -07004674 if ( eSIR_SUCCESS != nSirStatus )
4675 {
4676 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004677 "tor for a Operating Mode (%d)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004678 nSirStatus );
4679 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4680 return eSIR_FAILURE; // just allocated...
4681 }
4682 nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame +
4683 sizeof(tSirMacMgmtHdr),
4684 nPayload, &nPayload );
4685 if ( DOT11F_FAILED( nStatus ) )
4686 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004687 limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004688 nStatus );
4689 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4690 return eSIR_FAILURE; // allocated!
4691 }
4692 else if ( DOT11F_WARNED( nStatus ) )
4693 {
4694 limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004695 " (0x%08x)."), nStatus );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004696 }
4697 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Mohit Khanna4a70d262012-09-11 16:30:12 -07004698 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4699 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Mohit Khanna4a70d262012-09-11 16:30:12 -07004700 )
4701 {
4702 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4703 }
4704 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4705 HAL_TXRX_FRM_802_11_MGMT,
4706 ANI_TXDIR_TODS,
4707 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4708 limTxComplete, pFrame, txFlag );
4709 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4710 {
4711 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004712 "(%X)!"),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004713 nSirStatus );
4714 //Pkt will be freed up by the callback
4715 return eSIR_FAILURE;
4716 }
4717
4718 return eSIR_SUCCESS;
4719}
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004720
4721/**
4722 * \brief Send a VHT Channel Switch Announcement
4723 *
4724 *
4725 * \param pMac Pointer to the global MAC datastructure
4726 *
4727 * \param peer MAC address to which this frame will be sent
4728 *
4729 * \param nChanWidth
4730 *
4731 * \param nNewChannel
4732 *
4733 *
4734 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4735 *
4736 *
4737 */
4738
4739tSirRetStatus
4740limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
4741 tSirMacAddr peer,
4742 tANI_U8 nChanWidth,
4743 tANI_U8 nNewChannel,
4744 tANI_U8 ncbMode,
4745 tpPESession psessionEntry )
4746{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304747 tDot11fChannelSwitch frm;
4748 tANI_U8 *pFrame;
4749 tSirRetStatus nSirStatus;
4750 tpSirMacMgmtHdr pMacHdr;
4751 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
4752 void *pPacket;
4753 eHalStatus halstatus;
4754 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004755
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304756 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004757
4758
4759 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4760 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
4761 frm.ChanSwitchAnn.switchMode = 1;
4762 frm.ChanSwitchAnn.newChannel = nNewChannel;
4763 frm.ChanSwitchAnn.switchCount = 1;
4764 frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode);
4765 frm.ExtChanSwitchAnn.present = 1;
4766 frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth;
4767 frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth);
4768 frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0;
4769 frm.ChanSwitchAnn.present = 1;
4770 frm.WiderBWChanSwitchAnn.present = 1;
4771
4772 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
4773 if ( DOT11F_FAILED( nStatus ) )
4774 {
4775 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004776 "or a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004777 nStatus );
4778 // We'll fall back on the worst case scenario:
4779 nPayload = sizeof( tDot11fChannelSwitch );
4780 }
4781 else if ( DOT11F_WARNED( nStatus ) )
4782 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004783 limLog( pMac, LOGW, FL("There were warnings while calculating "
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004784 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004785 "%08x)."), nStatus );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004786 }
4787
4788 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4789
4790 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4791 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4792 {
4793 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004794 " Report."), nBytes );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004795 return eSIR_FAILURE;
4796 }
4797 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304798 vos_mem_set( pFrame, nBytes, 0 );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004799
4800 // Next, we fill out the buffer descriptor:
4801 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4802 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
4803 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304804 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
4805 (tANI_U8 *) psessionEntry->bssId,
4806 sizeof( tSirMacAddr ));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004807 if ( eSIR_SUCCESS != nSirStatus )
4808 {
4809 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004810 "tor for a Channel Switch (%d)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004811 nSirStatus );
4812 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4813 return eSIR_FAILURE; // just allocated...
4814 }
4815 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
4816 sizeof(tSirMacMgmtHdr),
4817 nPayload, &nPayload );
4818 if ( DOT11F_FAILED( nStatus ) )
4819 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004820 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004821 nStatus );
4822 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4823 return eSIR_FAILURE; // allocated!
4824 }
4825 else if ( DOT11F_WARNED( nStatus ) )
4826 {
4827 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004828 "hannel Switch (0x%08x)."), nStatus );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004829 }
4830
4831 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004832 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4833 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004834 )
4835 {
4836 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4837 }
4838 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4839 HAL_TXRX_FRM_802_11_MGMT,
4840 ANI_TXDIR_TODS,
4841 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4842 limTxComplete, pFrame, txFlag );
4843 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4844 {
4845 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004846 "(%X)!"),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004847 nSirStatus );
4848 //Pkt will be freed up by the callback
4849 return eSIR_FAILURE;
4850 }
4851
4852 return eSIR_SUCCESS;
4853
4854} // End limSendVHTChannelSwitchMgmtFrame.
4855
4856
4857
Mohit Khanna4a70d262012-09-11 16:30:12 -07004858#endif
4859
Jeff Johnson295189b2012-06-20 16:38:30 -07004860/**
4861 * \brief Send an ADDBA Req Action Frame to peer
4862 *
4863 * \sa limSendAddBAReq
4864 *
4865 * \param pMac The global tpAniSirGlobal object
4866 *
4867 * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains
4868 * the necessary parameters reqd by PE send the ADDBA Req Action
4869 * Frame to the peer
4870 *
4871 * \return eSIR_SUCCESS if setup completes successfully
4872 * eSIR_FAILURE is some problem is encountered
4873 */
4874tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304875 tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07004876{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304877 tDot11fAddBAReq frmAddBAReq;
4878 tANI_U8 *pAddBAReqBuffer = NULL;
4879 tpSirMacMgmtHdr pMacHdr;
4880 tANI_U32 frameLen = 0, nStatus, nPayload;
4881 tSirRetStatus statusCode;
4882 eHalStatus halStatus;
4883 void *pPacket;
4884 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004885
4886 if(NULL == psessionEntry)
4887 {
4888 return eSIR_FAILURE;
4889 }
4890
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304891 vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004892
4893 // Category - 3 (BA)
4894 frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK;
4895
4896 // Action - 0 (ADDBA Req)
4897 frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ;
4898
4899 // FIXME - Dialog Token, generalize this...
4900 frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken;
4901
4902 // Fill the ADDBA Parameter Set
4903 frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID;
4904 frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy;
4905 frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize;
4906
4907 // BA timeout
4908 // 0 - indicates no BA timeout
4909 frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout;
4910
4911 // BA Starting Sequence Number
4912 // Fragment number will always be zero
4913 if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) {
4914 pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP;
4915 }
4916
4917 frmAddBAReq.BAStartingSequenceControl.ssn =
4918 pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP;
4919
4920 nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload );
4921
4922 if( DOT11F_FAILED( nStatus ))
4923 {
4924 limLog( pMac, LOGW,
4925 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004926 "an ADDBA Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 nStatus );
4928
4929 // We'll fall back on the worst case scenario:
4930 nPayload = sizeof( tDot11fAddBAReq );
4931 }
4932 else if( DOT11F_WARNED( nStatus ))
4933 {
4934 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004935 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004936 "the packed size for an ADDBA Req (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004937 nStatus );
4938 }
4939
4940 // Add the MGMT header to frame length
4941 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
4942
4943 // Need to allocate a buffer for ADDBA AF
4944 if( eHAL_STATUS_SUCCESS !=
4945 (halStatus = palPktAlloc( pMac->hHdd,
4946 HAL_TXRX_FRM_802_11_MGMT,
4947 (tANI_U16) frameLen,
4948 (void **) &pAddBAReqBuffer,
4949 (void **) &pPacket )))
4950 {
4951 // Log error
4952 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004953 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 frameLen,
4955 halStatus );
4956
4957 statusCode = eSIR_MEM_ALLOC_FAILED;
4958 goto returnAfterError;
4959 }
4960
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304961 vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004962
4963 // Copy necessary info to BD
4964 if( eSIR_SUCCESS !=
4965 (statusCode = limPopulateMacHeader( pMac,
4966 pAddBAReqBuffer,
4967 SIR_MAC_MGMT_FRAME,
4968 SIR_MAC_MGMT_ACTION,
4969 pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
4970 goto returnAfterError;
4971
4972 // Update A3 with the BSSID
4973 pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer;
4974
4975 #if 0
4976 cfgLen = SIR_MAC_ADDR_LENGTH;
4977 if( eSIR_SUCCESS != cfgGetStr( pMac,
4978 WNI_CFG_BSSID,
4979 (tANI_U8 *) pMacHdr->bssId,
4980 &cfgLen ))
4981 {
4982 limLog( pMac, LOGP,
4983 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004984 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004985
4986 // FIXME - Need to convert to tSirRetStatus
4987 statusCode = eSIR_FAILURE;
4988 goto returnAfterError;
4989 }
4990 #endif//TO SUPPORT BT-AMP
4991 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
4992
Chet Lanctot186b5732013-03-18 10:26:30 -07004993#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004994 limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004995#endif
4996
Jeff Johnson295189b2012-06-20 16:38:30 -07004997 // Now, we're ready to "pack" the frames
4998 nStatus = dot11fPackAddBAReq( pMac,
4999 &frmAddBAReq,
5000 pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ),
5001 nPayload,
5002 &nPayload );
5003
5004 if( DOT11F_FAILED( nStatus ))
5005 {
5006 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005007 FL( "Failed to pack an ADDBA Req (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005008 nStatus );
5009
5010 // FIXME - Need to convert to tSirRetStatus
5011 statusCode = eSIR_FAILURE;
5012 goto returnAfterError;
5013 }
5014 else if( DOT11F_WARNED( nStatus ))
5015 {
5016 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005017 FL( "There were warnings while packing an ADDBA Req (0x%08x)."),
5018 nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 }
5020
5021 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005022 FL( "Sending an ADDBA REQ to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005023 limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW );
5024
5025 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005026 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5027 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005028 )
5029 {
5030 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5031 }
5032
5033 if( eHAL_STATUS_SUCCESS !=
5034 (halStatus = halTxFrame( pMac,
5035 pPacket,
5036 (tANI_U16) frameLen,
5037 HAL_TXRX_FRM_802_11_MGMT,
5038 ANI_TXDIR_TODS,
5039 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5040 limTxComplete,
5041 pAddBAReqBuffer, txFlag )))
5042 {
5043 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005044 FL( "halTxFrame FAILED! Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005045 halStatus );
5046
5047 // FIXME - Need to convert eHalStatus to tSirRetStatus
5048 statusCode = eSIR_FAILURE;
5049 //Pkt will be freed up by the callback
5050 return statusCode;
5051 }
5052 else
5053 return eSIR_SUCCESS;
5054
5055returnAfterError:
5056
5057 // Release buffer, if allocated
5058 if( NULL != pAddBAReqBuffer )
5059 palPktFree( pMac->hHdd,
5060 HAL_TXRX_FRM_802_11_MGMT,
5061 (void *) pAddBAReqBuffer,
5062 (void *) pPacket );
5063
5064 return statusCode;
5065}
5066
5067/**
5068 * \brief Send an ADDBA Rsp Action Frame to peer
5069 *
5070 * \sa limSendAddBARsp
5071 *
5072 * \param pMac The global tpAniSirGlobal object
5073 *
5074 * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains
5075 * the necessary parameters reqd by PE send the ADDBA Rsp Action
5076 * Frame to the peer
5077 *
5078 * \return eSIR_SUCCESS if setup completes successfully
5079 * eSIR_FAILURE is some problem is encountered
5080 */
5081tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac,
5082 tpLimMlmAddBARsp pMlmAddBARsp,
5083 tpPESession psessionEntry)
5084{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305085 tDot11fAddBARsp frmAddBARsp;
5086 tANI_U8 *pAddBARspBuffer = NULL;
5087 tpSirMacMgmtHdr pMacHdr;
5088 tANI_U32 frameLen = 0, nStatus, nPayload;
5089 tSirRetStatus statusCode;
5090 eHalStatus halStatus;
5091 void *pPacket;
5092 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005093
5094 if(NULL == psessionEntry)
5095 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005096 PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005097 return eSIR_FAILURE;
5098 }
5099
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305100 vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005101
5102 // Category - 3 (BA)
5103 frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK;
5104 // Action - 1 (ADDBA Rsp)
5105 frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP;
5106
5107 // Should be same as the one we received in the ADDBA Req
5108 frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken;
5109
5110 // ADDBA Req status
5111 frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode;
5112
5113 // Fill the ADDBA Parameter Set as provided by caller
5114 frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID;
5115 frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy;
5116 frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize;
krunal soni5afa96c2013-09-06 22:19:02 -07005117
5118 if(psessionEntry->isAmsduSupportInAMPDU)
5119 {
5120 frmAddBARsp.AddBAParameterSet.amsduSupported =
5121 psessionEntry->amsduSupportedInBA;
5122 }
5123 else
5124 {
5125 frmAddBARsp.AddBAParameterSet.amsduSupported = 0;
5126 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005127
5128 // BA timeout
5129 // 0 - indicates no BA timeout
5130 frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout;
5131
5132 nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload );
5133
5134 if( DOT11F_FAILED( nStatus ))
5135 {
5136 limLog( pMac, LOGW,
5137 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005138 "an ADDBA Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 nStatus );
5140
5141 // We'll fall back on the worst case scenario:
5142 nPayload = sizeof( tDot11fAddBARsp );
5143 }
5144 else if( DOT11F_WARNED( nStatus ))
5145 {
5146 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005147 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005148 "the packed size for an ADDBA Rsp (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005149 nStatus );
5150 }
5151
5152 // Need to allocate a buffer for ADDBA AF
5153 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5154
5155 // Allocate shared memory
5156 if( eHAL_STATUS_SUCCESS !=
5157 (halStatus = palPktAlloc( pMac->hHdd,
5158 HAL_TXRX_FRM_802_11_MGMT,
5159 (tANI_U16) frameLen,
5160 (void **) &pAddBARspBuffer,
5161 (void **) &pPacket )))
5162 {
5163 // Log error
5164 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005165 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005166 frameLen,
5167 halStatus );
5168
5169 statusCode = eSIR_MEM_ALLOC_FAILED;
5170 goto returnAfterError;
5171 }
5172
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305173 vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005174
5175 // Copy necessary info to BD
5176 if( eSIR_SUCCESS !=
5177 (statusCode = limPopulateMacHeader( pMac,
5178 pAddBARspBuffer,
5179 SIR_MAC_MGMT_FRAME,
5180 SIR_MAC_MGMT_ACTION,
5181 pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr)))
5182 goto returnAfterError;
5183
5184 // Update A3 with the BSSID
5185
5186 pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer;
5187
5188 #if 0
5189 cfgLen = SIR_MAC_ADDR_LENGTH;
5190 if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
5191 WNI_CFG_BSSID,
5192 (tANI_U8 *) pMacHdr->bssId,
5193 &cfgLen ))
5194 {
5195 limLog( pMac, LOGP,
5196 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005197 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005198
5199 // FIXME - Need to convert to tSirRetStatus
5200 statusCode = eSIR_FAILURE;
5201 goto returnAfterError;
5202 }
5203 #endif // TO SUPPORT BT-AMP
5204 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5205
Chet Lanctot186b5732013-03-18 10:26:30 -07005206#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005207 limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005208#endif
5209
Jeff Johnson295189b2012-06-20 16:38:30 -07005210 // Now, we're ready to "pack" the frames
5211 nStatus = dot11fPackAddBARsp( pMac,
5212 &frmAddBARsp,
5213 pAddBARspBuffer + sizeof( tSirMacMgmtHdr ),
5214 nPayload,
5215 &nPayload );
5216
5217 if( DOT11F_FAILED( nStatus ))
5218 {
5219 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005220 FL( "Failed to pack an ADDBA Rsp (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005221 nStatus );
5222
5223 // FIXME - Need to convert to tSirRetStatus
5224 statusCode = eSIR_FAILURE;
5225 goto returnAfterError;
5226 }
5227 else if( DOT11F_WARNED( nStatus ))
5228 {
5229 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005230 FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ),
5231 nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07005232 }
5233
5234 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005235 FL( "Sending an ADDBA RSP to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005236 limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW );
5237
5238 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005239 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5240 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005241 )
5242 {
5243 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5244 }
5245
5246 if( eHAL_STATUS_SUCCESS !=
5247 (halStatus = halTxFrame( pMac,
5248 pPacket,
5249 (tANI_U16) frameLen,
5250 HAL_TXRX_FRM_802_11_MGMT,
5251 ANI_TXDIR_TODS,
5252 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5253 limTxComplete,
5254 pAddBARspBuffer, txFlag )))
5255 {
5256 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005257 FL( "halTxFrame FAILED! Status [%d]" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005258 halStatus );
5259
5260 // FIXME - HAL error codes are different from PE error
5261 // codes!! And, this routine is returning tSirRetStatus
5262 statusCode = eSIR_FAILURE;
5263 //Pkt will be freed up by the callback
5264 return statusCode;
5265 }
5266 else
5267 return eSIR_SUCCESS;
5268
5269 returnAfterError:
5270
5271 // Release buffer, if allocated
5272 if( NULL != pAddBARspBuffer )
5273 palPktFree( pMac->hHdd,
5274 HAL_TXRX_FRM_802_11_MGMT,
5275 (void *) pAddBARspBuffer,
5276 (void *) pPacket );
5277
5278 return statusCode;
5279}
5280
5281/**
5282 * \brief Send a DELBA Indication Action Frame to peer
5283 *
5284 * \sa limSendDelBAInd
5285 *
5286 * \param pMac The global tpAniSirGlobal object
5287 *
5288 * \param peerMacAddr MAC Address of peer
5289 *
5290 * \param reasonCode Reason for the DELBA notification
5291 *
5292 * \param pBAParameterSet The DELBA Parameter Set.
5293 * This identifies the TID for which the BA session is
5294 * being deleted.
5295 *
5296 * \return eSIR_SUCCESS if setup completes successfully
5297 * eSIR_FAILURE is some problem is encountered
5298 */
5299tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac,
5300 tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry)
5301{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305302 tDot11fDelBAInd frmDelBAInd;
5303 tANI_U8 *pDelBAIndBuffer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005304 //tANI_U32 val;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305305 tpSirMacMgmtHdr pMacHdr;
5306 tANI_U32 frameLen = 0, nStatus, nPayload;
5307 tSirRetStatus statusCode;
5308 eHalStatus halStatus;
5309 void *pPacket;
5310 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005311
5312 if(NULL == psessionEntry)
5313 {
5314 return eSIR_FAILURE;
5315 }
5316
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305317 vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005318
5319 // Category - 3 (BA)
5320 frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK;
5321 // Action - 2 (DELBA)
5322 frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL;
5323
5324 // Fill the DELBA Parameter Set as provided by caller
5325 frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID;
5326 frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection;
5327
5328 // BA Starting Sequence Number
5329 // Fragment number will always be zero
5330 frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode;
5331
5332 nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload );
5333
5334 if( DOT11F_FAILED( nStatus ))
5335 {
5336 limLog( pMac, LOGW,
5337 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005338 "an DELBA Indication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005339 nStatus );
5340
5341 // We'll fall back on the worst case scenario:
5342 nPayload = sizeof( tDot11fDelBAInd );
5343 }
5344 else if( DOT11F_WARNED( nStatus ))
5345 {
5346 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005347 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005348 "the packed size for an DELBA Ind (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005349 nStatus );
5350 }
5351
5352 // Add the MGMT header to frame length
5353 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5354
5355 // Allocate shared memory
5356 if( eHAL_STATUS_SUCCESS !=
5357 (halStatus = palPktAlloc( pMac->hHdd,
5358 HAL_TXRX_FRM_802_11_MGMT,
5359 (tANI_U16) frameLen,
5360 (void **) &pDelBAIndBuffer,
5361 (void **) &pPacket )))
5362 {
5363 // Log error
5364 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005365 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005366 frameLen,
5367 halStatus );
5368
5369 statusCode = eSIR_MEM_ALLOC_FAILED;
5370 goto returnAfterError;
5371 }
5372
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305373 vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005374
5375 // Copy necessary info to BD
5376 if( eSIR_SUCCESS !=
5377 (statusCode = limPopulateMacHeader( pMac,
5378 pDelBAIndBuffer,
5379 SIR_MAC_MGMT_FRAME,
5380 SIR_MAC_MGMT_ACTION,
5381 pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
5382 goto returnAfterError;
5383
5384 // Update A3 with the BSSID
5385 pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer;
5386
5387 #if 0
5388 cfgLen = SIR_MAC_ADDR_LENGTH;
5389 if( eSIR_SUCCESS != cfgGetStr( pMac,
5390 WNI_CFG_BSSID,
5391 (tANI_U8 *) pMacHdr->bssId,
5392 &cfgLen ))
5393 {
5394 limLog( pMac, LOGP,
5395 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005396 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005397
5398 // FIXME - Need to convert to tSirRetStatus
5399 statusCode = eSIR_FAILURE;
5400 goto returnAfterError;
5401 }
5402 #endif //TO SUPPORT BT-AMP
5403 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5404
Chet Lanctot186b5732013-03-18 10:26:30 -07005405#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005406 limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005407#endif
5408
Jeff Johnson295189b2012-06-20 16:38:30 -07005409 // Now, we're ready to "pack" the frames
5410 nStatus = dot11fPackDelBAInd( pMac,
5411 &frmDelBAInd,
5412 pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ),
5413 nPayload,
5414 &nPayload );
5415
5416 if( DOT11F_FAILED( nStatus ))
5417 {
5418 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005419 FL( "Failed to pack an DELBA Ind (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005420 nStatus );
5421
5422 // FIXME - Need to convert to tSirRetStatus
5423 statusCode = eSIR_FAILURE;
5424 goto returnAfterError;
5425 }
5426 else if( DOT11F_WARNED( nStatus ))
5427 {
5428 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005429 FL( "There were warnings while packing an DELBA Ind (0x%08x)." ),
5430 nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07005431 }
5432
5433 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005434 FL( "Sending a DELBA IND to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005435 limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW );
5436
5437 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005438 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5439 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005440 )
5441 {
5442 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5443 }
5444
5445 if( eHAL_STATUS_SUCCESS !=
5446 (halStatus = halTxFrame( pMac,
5447 pPacket,
5448 (tANI_U16) frameLen,
5449 HAL_TXRX_FRM_802_11_MGMT,
5450 ANI_TXDIR_TODS,
5451 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5452 limTxComplete,
5453 pDelBAIndBuffer, txFlag )))
5454 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005455 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005456 statusCode = eSIR_FAILURE;
5457 //Pkt will be freed up by the callback
5458 return statusCode;
5459 }
5460 else
5461 return eSIR_SUCCESS;
5462
5463 returnAfterError:
5464
5465 // Release buffer, if allocated
5466 if( NULL != pDelBAIndBuffer )
5467 palPktFree( pMac->hHdd,
5468 HAL_TXRX_FRM_802_11_MGMT,
5469 (void *) pDelBAIndBuffer,
5470 (void *) pPacket );
5471
5472 return statusCode;
5473}
5474
5475#if defined WLAN_FEATURE_VOWIFI
5476
5477/**
5478 * \brief Send a Neighbor Report Request Action frame
5479 *
5480 *
5481 * \param pMac Pointer to the global MAC structure
5482 *
5483 * \param pNeighborReq Address of a tSirMacNeighborReportReq
5484 *
5485 * \param peer mac address of peer station.
5486 *
5487 * \param psessionEntry address of session entry.
5488 *
5489 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5490 *
5491 *
5492 */
5493
5494tSirRetStatus
5495limSendNeighborReportRequestFrame(tpAniSirGlobal pMac,
5496 tpSirMacNeighborReportReq pNeighborReq,
5497 tSirMacAddr peer,
5498 tpPESession psessionEntry
5499 )
5500{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305501 tSirRetStatus statusCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005502 tDot11fNeighborReportRequest frm;
5503 tANI_U8 *pFrame;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305504 tpSirMacMgmtHdr pMacHdr;
5505 tANI_U32 nBytes, nPayload, nStatus;
5506 void *pPacket;
5507 eHalStatus halstatus;
5508 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005509
5510 if ( psessionEntry == NULL )
5511 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005512 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Neighbor Report request action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07005513 return eSIR_FAILURE;
5514 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305515 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005516
5517 frm.Category.category = SIR_MAC_ACTION_RRM;
5518 frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ;
5519 frm.DialogToken.token = pNeighborReq->dialogToken;
5520
5521
5522 if( pNeighborReq->ssid_present )
5523 {
5524 PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID );
5525 }
5526
5527 nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload );
5528 if ( DOT11F_FAILED( nStatus ) )
5529 {
5530 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005531 "or a Neighbor Report Request(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005532 nStatus );
5533 // We'll fall back on the worst case scenario:
5534 nPayload = sizeof( tDot11fNeighborReportRequest );
5535 }
5536 else if ( DOT11F_WARNED( nStatus ) )
5537 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005538 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07005539 "the packed size for a Neighbor Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005540 "ort Request(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005541 }
5542
5543 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5544
5545 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5546 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5547 {
5548 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Neighbor "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005549 "Report Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005550 return eSIR_FAILURE;
5551 }
5552
5553 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305554 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005555
5556 // Copy necessary info to BD
5557 if( eSIR_SUCCESS !=
5558 (statusCode = limPopulateMacHeader( pMac,
5559 pFrame,
5560 SIR_MAC_MGMT_FRAME,
5561 SIR_MAC_MGMT_ACTION,
5562 peer, psessionEntry->selfMacAddr)))
5563 goto returnAfterError;
5564
5565 // Update A3 with the BSSID
5566 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5567
5568 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
5569
Chet Lanctot186b5732013-03-18 10:26:30 -07005570#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005571 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005572#endif
5573
Jeff Johnson295189b2012-06-20 16:38:30 -07005574 // Now, we're ready to "pack" the frames
5575 nStatus = dot11fPackNeighborReportRequest( pMac,
5576 &frm,
5577 pFrame + sizeof( tSirMacMgmtHdr ),
5578 nPayload,
5579 &nPayload );
5580
5581 if( DOT11F_FAILED( nStatus ))
5582 {
5583 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005584 FL( "Failed to pack an Neighbor Report Request (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005585 nStatus );
5586
5587 // FIXME - Need to convert to tSirRetStatus
5588 statusCode = eSIR_FAILURE;
5589 goto returnAfterError;
5590 }
5591 else if( DOT11F_WARNED( nStatus ))
5592 {
5593 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005594 FL( "There were warnings while packing Neighbor Report "
5595 "Request (0x%08x)." ), nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07005596 }
5597
5598 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005599 FL( "Sending a Neighbor Report Request to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005600 limPrintMacAddr( pMac, peer, LOGW );
5601
5602 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005603 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5604 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005605 )
5606 {
5607 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5608 }
5609
5610 if( eHAL_STATUS_SUCCESS !=
5611 (halstatus = halTxFrame( pMac,
5612 pPacket,
5613 (tANI_U16) nBytes,
5614 HAL_TXRX_FRM_802_11_MGMT,
5615 ANI_TXDIR_TODS,
5616 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5617 limTxComplete,
5618 pFrame, txFlag )))
5619 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005620 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005621 statusCode = eSIR_FAILURE;
5622 //Pkt will be freed up by the callback
5623 return statusCode;
5624 }
5625 else
5626 return eSIR_SUCCESS;
5627
5628returnAfterError:
5629 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5630
5631 return statusCode;
5632} // End limSendNeighborReportRequestFrame.
5633
5634/**
5635 * \brief Send a Link Report Action frame
5636 *
5637 *
5638 * \param pMac Pointer to the global MAC structure
5639 *
5640 * \param pLinkReport Address of a tSirMacLinkReport
5641 *
5642 * \param peer mac address of peer station.
5643 *
5644 * \param psessionEntry address of session entry.
5645 *
5646 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5647 *
5648 *
5649 */
5650
5651tSirRetStatus
5652limSendLinkReportActionFrame(tpAniSirGlobal pMac,
5653 tpSirMacLinkReport pLinkReport,
5654 tSirMacAddr peer,
5655 tpPESession psessionEntry
5656 )
5657{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305658 tSirRetStatus statusCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005659 tDot11fLinkMeasurementReport frm;
5660 tANI_U8 *pFrame;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305661 tpSirMacMgmtHdr pMacHdr;
5662 tANI_U32 nBytes, nPayload, nStatus;
5663 void *pPacket;
5664 eHalStatus halstatus;
5665 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005666
5667
5668 if ( psessionEntry == NULL )
5669 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005670 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Link Report action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07005671 return eSIR_FAILURE;
5672 }
5673
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305674 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005675
5676 frm.Category.category = SIR_MAC_ACTION_RRM;
5677 frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT;
5678 frm.DialogToken.token = pLinkReport->dialogToken;
5679
5680
5681 //IEEE Std. 802.11 7.3.2.18. for the report element.
5682 //Even though TPC report an IE, it is represented using fixed fields since it is positioned
5683 //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4
5684 //and frame parser always expects IEs to come after all fixed fields. It is easier to handle
5685 //such case this way than changing the frame parser.
5686 frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID;
5687 frm.TPCEleLen.TPCLen = 2;
5688 frm.TxPower.txPower = pLinkReport->txPower;
5689 frm.LinkMargin.linkMargin = 0;
5690
5691 frm.RxAntennaId.antennaId = pLinkReport->rxAntenna;
5692 frm.TxAntennaId.antennaId = pLinkReport->txAntenna;
5693 frm.RCPI.rcpi = pLinkReport->rcpi;
5694 frm.RSNI.rsni = pLinkReport->rsni;
5695
5696 nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload );
5697 if ( DOT11F_FAILED( nStatus ) )
5698 {
5699 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005700 "or a Link Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005701 nStatus );
5702 // We'll fall back on the worst case scenario:
5703 nPayload = sizeof( tDot11fLinkMeasurementReport );
5704 }
5705 else if ( DOT11F_WARNED( nStatus ) )
5706 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005707 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07005708 "the packed size for a Link Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005709 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005710 }
5711
5712 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5713
5714 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5715 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5716 {
5717 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Link "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005718 "Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005719 return eSIR_FAILURE;
5720 }
5721
5722 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305723 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005724
5725 // Copy necessary info to BD
5726 if( eSIR_SUCCESS !=
5727 (statusCode = limPopulateMacHeader( pMac,
5728 pFrame,
5729 SIR_MAC_MGMT_FRAME,
5730 SIR_MAC_MGMT_ACTION,
5731 peer, psessionEntry->selfMacAddr)))
5732 goto returnAfterError;
5733
5734 // Update A3 with the BSSID
5735 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5736
5737 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
5738
Chet Lanctot186b5732013-03-18 10:26:30 -07005739#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005740 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005741#endif
5742
Jeff Johnson295189b2012-06-20 16:38:30 -07005743 // Now, we're ready to "pack" the frames
5744 nStatus = dot11fPackLinkMeasurementReport( pMac,
5745 &frm,
5746 pFrame + sizeof( tSirMacMgmtHdr ),
5747 nPayload,
5748 &nPayload );
5749
5750 if( DOT11F_FAILED( nStatus ))
5751 {
5752 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005753 FL( "Failed to pack an Link Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005754 nStatus );
5755
5756 // FIXME - Need to convert to tSirRetStatus
5757 statusCode = eSIR_FAILURE;
5758 goto returnAfterError;
5759 }
5760 else if( DOT11F_WARNED( nStatus ))
5761 {
5762 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005763 FL( "There were warnings while packing Link Report (0x%08x)." ),
5764 nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005765 }
5766
5767 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005768 FL( "Sending a Link Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005769 limPrintMacAddr( pMac, peer, LOGW );
5770
5771 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005772 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5773 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005774 )
5775 {
5776 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5777 }
5778
5779 if( eHAL_STATUS_SUCCESS !=
5780 (halstatus = halTxFrame( pMac,
5781 pPacket,
5782 (tANI_U16) nBytes,
5783 HAL_TXRX_FRM_802_11_MGMT,
5784 ANI_TXDIR_TODS,
5785 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5786 limTxComplete,
5787 pFrame, txFlag )))
5788 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005789 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005790 statusCode = eSIR_FAILURE;
5791 //Pkt will be freed up by the callback
5792 return statusCode;
5793 }
5794 else
5795 return eSIR_SUCCESS;
5796
5797returnAfterError:
5798 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5799
5800 return statusCode;
5801} // End limSendLinkReportActionFrame.
5802
5803/**
5804 * \brief Send a Beacon Report Action frame
5805 *
5806 *
5807 * \param pMac Pointer to the global MAC structure
5808 *
5809 * \param dialog_token dialog token to be used in the action frame.
5810 *
5811 * \param num_report number of reports in pRRMReport.
5812 *
5813 * \param pRRMReport Address of a tSirMacRadioMeasureReport.
5814 *
5815 * \param peer mac address of peer station.
5816 *
5817 * \param psessionEntry address of session entry.
5818 *
5819 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5820 *
5821 *
5822 */
5823
5824tSirRetStatus
5825limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac,
5826 tANI_U8 dialog_token,
5827 tANI_U8 num_report,
5828 tpSirMacRadioMeasureReport pRRMReport,
5829 tSirMacAddr peer,
5830 tpPESession psessionEntry
5831 )
5832{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305833 tSirRetStatus statusCode = eSIR_SUCCESS;
5834 tANI_U8 *pFrame;
5835 tpSirMacMgmtHdr pMacHdr;
5836 tANI_U32 nBytes, nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07005837 void *pPacket;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305838 eHalStatus halstatus;
5839 tANI_U8 i;
5840 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005841
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005842 tDot11fRadioMeasurementReport *frm =
5843 vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport));
5844 if (!frm) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005845 limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005846 return eSIR_FAILURE;
5847 }
5848
Jeff Johnson295189b2012-06-20 16:38:30 -07005849 if ( psessionEntry == NULL )
5850 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005851 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005852 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005853 return eSIR_FAILURE;
5854 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305855 vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005856
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005857 frm->Category.category = SIR_MAC_ACTION_RRM;
5858 frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT;
5859 frm->DialogToken.token = dialog_token;
Jeff Johnson295189b2012-06-20 16:38:30 -07005860
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005861 frm->num_MeasurementReport = (num_report > RADIO_REPORTS_MAX_IN_A_FRAME ) ? RADIO_REPORTS_MAX_IN_A_FRAME : num_report;
Jeff Johnson295189b2012-06-20 16:38:30 -07005862
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005863 for( i = 0 ; i < frm->num_MeasurementReport ; i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07005864 {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005865 frm->MeasurementReport[i].type = pRRMReport[i].type;
5866 frm->MeasurementReport[i].token = pRRMReport[i].token;
5867 frm->MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm)
Jeff Johnson295189b2012-06-20 16:38:30 -07005868 switch( pRRMReport[i].type )
5869 {
5870 case SIR_MAC_RRM_BEACON_TYPE:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005871 PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport );
5872 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
5873 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
5874 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07005875 break;
5876 default:
Gopichand Nakkala72717fd2013-02-08 12:23:45 +05305877 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
5878 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005879 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07005880 break;
5881 }
5882 }
5883
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005884 nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07005885 if ( DOT11F_FAILED( nStatus ) )
5886 {
5887 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005888 "or a Radio Measure Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005889 nStatus );
5890 // We'll fall back on the worst case scenario:
5891 nPayload = sizeof( tDot11fLinkMeasurementReport );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005892 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005893 return eSIR_FAILURE;
5894 }
5895 else if ( DOT11F_WARNED( nStatus ) )
5896 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005897 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07005898 "the packed size for a Radio Measure Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005899 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005900 }
5901
5902 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5903
5904 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5905 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5906 {
5907 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005908 "Report."), nBytes );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005909 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005910 return eSIR_FAILURE;
5911 }
5912
5913 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305914 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005915
5916 // Copy necessary info to BD
5917 if( eSIR_SUCCESS !=
5918 (statusCode = limPopulateMacHeader( pMac,
5919 pFrame,
5920 SIR_MAC_MGMT_FRAME,
5921 SIR_MAC_MGMT_ACTION,
5922 peer, psessionEntry->selfMacAddr)))
5923 goto returnAfterError;
5924
5925 // Update A3 with the BSSID
5926 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5927
5928 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
5929
Chet Lanctot186b5732013-03-18 10:26:30 -07005930#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005931 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005932#endif
5933
Jeff Johnson295189b2012-06-20 16:38:30 -07005934 // Now, we're ready to "pack" the frames
5935 nStatus = dot11fPackRadioMeasurementReport( pMac,
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005936 frm,
Jeff Johnson295189b2012-06-20 16:38:30 -07005937 pFrame + sizeof( tSirMacMgmtHdr ),
5938 nPayload,
5939 &nPayload );
5940
5941 if( DOT11F_FAILED( nStatus ))
5942 {
5943 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005944 FL( "Failed to pack an Radio Measure Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005945 nStatus );
5946
5947 // FIXME - Need to convert to tSirRetStatus
5948 statusCode = eSIR_FAILURE;
5949 goto returnAfterError;
5950 }
5951 else if( DOT11F_WARNED( nStatus ))
5952 {
5953 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005954 FL( "There were warnings while packing Radio "
5955 "Measure Report (0x%08x)." ), nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07005956 }
5957
5958 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005959 FL( "Sending a Radio Measure Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 limPrintMacAddr( pMac, peer, LOGW );
5961
5962 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005963 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5964 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 )
5966 {
5967 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5968 }
5969
5970 if( eHAL_STATUS_SUCCESS !=
5971 (halstatus = halTxFrame( pMac,
5972 pPacket,
5973 (tANI_U16) nBytes,
5974 HAL_TXRX_FRM_802_11_MGMT,
5975 ANI_TXDIR_TODS,
5976 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5977 limTxComplete,
5978 pFrame, txFlag )))
5979 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005980 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005981 statusCode = eSIR_FAILURE;
5982 //Pkt will be freed up by the callback
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005983 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005984 return statusCode;
5985 }
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07005986 else {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005987 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005988 return eSIR_SUCCESS;
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07005989 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005990
5991returnAfterError:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005992 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005993 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Jeff Johnson295189b2012-06-20 16:38:30 -07005994 return statusCode;
5995} // End limSendBeaconReportActionFrame.
5996
5997#endif
5998
5999#ifdef WLAN_FEATURE_11W
6000/**
6001 * \brief Send SA query response action frame to peer
6002 *
6003 * \sa limSendSaQueryResponseFrame
6004 *
6005 *
6006 * \param pMac The global tpAniSirGlobal object
6007 *
Chet Lanctot186b5732013-03-18 10:26:30 -07006008 * \param transId Transaction identifier received in SA query request action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07006009 *
Chet Lanctot186b5732013-03-18 10:26:30 -07006010 * \param peer The Mac address of the AP to which this action frame is addressed
6011 *
6012 * \param psessionEntry The PE session entry
Jeff Johnson295189b2012-06-20 16:38:30 -07006013 *
6014 * \return eSIR_SUCCESS if setup completes successfully
6015 * eSIR_FAILURE is some problem is encountered
6016 */
6017
Chet Lanctot186b5732013-03-18 10:26:30 -07006018tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006019tSirMacAddr peer,tpPESession psessionEntry)
6020{
6021
Chet Lanctot186b5732013-03-18 10:26:30 -07006022 tDot11fSaQueryRsp frm; // SA query reponse action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07006023 tANI_U8 *pFrame;
6024 tSirRetStatus nSirStatus;
6025 tpSirMacMgmtHdr pMacHdr;
Chet Lanctot186b5732013-03-18 10:26:30 -07006026 tANI_U32 nBytes, nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07006027 void *pPacket;
6028 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306029 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006030
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306031 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Chet Lanctot186b5732013-03-18 10:26:30 -07006032 frm.Category.category = SIR_MAC_ACTION_SA_QUERY;
6033 /*11w action field is :
Jeff Johnson295189b2012-06-20 16:38:30 -07006034 action: 0 --> SA query request action frame
6035 action: 1 --> SA query response action frame */
Chet Lanctot186b5732013-03-18 10:26:30 -07006036 frm.Action.action = SIR_MAC_SA_QUERY_RSP;
6037 /*11w SA query response transId is same as
Jeff Johnson295189b2012-06-20 16:38:30 -07006038 SA query request transId*/
Chet Lanctot186b5732013-03-18 10:26:30 -07006039 vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006040
Chet Lanctot186b5732013-03-18 10:26:30 -07006041 nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload);
6042 if ( DOT11F_FAILED( nStatus ) )
6043 {
6044 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
6045 "or a SA Query Response (0x%08x)."),
6046 nStatus );
6047 // We'll fall back on the worst case scenario:
6048 nPayload = sizeof( tDot11fSaQueryRsp );
6049 }
6050 else if ( DOT11F_WARNED( nStatus ) )
6051 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006052 limLog( pMac, LOGW, FL("There were warnings while calculating "
Chet Lanctot186b5732013-03-18 10:26:30 -07006053 "the packed size for an SA Query Response"
6054 " (0x%08x)."), nStatus );
6055 }
6056
Jeff Johnson295189b2012-06-20 16:38:30 -07006057 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6058 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6059 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6060 {
6061 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA query response"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006062 " action frame"), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006063 return eSIR_FAILURE;
6064 }
6065
6066 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306067 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006068
Chet Lanctot186b5732013-03-18 10:26:30 -07006069 // Copy necessary info to BD
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006070 nSirStatus = limPopulateMacHeader( pMac,
Chet Lanctot186b5732013-03-18 10:26:30 -07006071 pFrame,
6072 SIR_MAC_MGMT_FRAME,
6073 SIR_MAC_MGMT_ACTION,
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006074 peer, psessionEntry->selfMacAddr );
6075 if ( eSIR_SUCCESS != nSirStatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07006076 goto returnAfterError;
Jeff Johnson295189b2012-06-20 16:38:30 -07006077
Chet Lanctot186b5732013-03-18 10:26:30 -07006078 // Update A3 with the BSSID
Jeff Johnson295189b2012-06-20 16:38:30 -07006079 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6080
Chet Lanctot186b5732013-03-18 10:26:30 -07006081 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006082
Chet Lanctot186b5732013-03-18 10:26:30 -07006083 // Since this is a SA Query Response, set the "protect" (aka WEP) bit
6084 // in the FC
6085 if ( psessionEntry->limRmfEnabled )
Jeff Johnson295189b2012-06-20 16:38:30 -07006086 {
Chet Lanctot186b5732013-03-18 10:26:30 -07006087 pMacHdr->fc.wep = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07006088 }
6089
Chet Lanctot186b5732013-03-18 10:26:30 -07006090 // Pack 11w SA query response frame
6091 nStatus = dot11fPackSaQueryRsp( pMac,
6092 &frm,
6093 pFrame + sizeof( tSirMacMgmtHdr ),
6094 nPayload,
6095 &nPayload );
6096
6097 if ( DOT11F_FAILED( nStatus ))
6098 {
6099 limLog( pMac, LOGE,
6100 FL( "Failed to pack an SA Query Response (0x%08x)." ),
6101 nStatus );
6102 // FIXME - Need to convert to tSirRetStatus
6103 nSirStatus = eSIR_FAILURE;
6104 goto returnAfterError;
6105 }
6106 else if ( DOT11F_WARNED( nStatus ))
6107 {
6108 limLog( pMac, LOGW,
6109 FL( "There were warnings while packing SA Query Response (0x%08x)." ),
6110 nStatus);
6111 }
6112
6113 limLog( pMac, LOG1,
6114 FL( "Sending a SA Query Response to " ));
6115 limPrintMacAddr( pMac, peer, LOGW );
6116
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006117 if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) )
Chet Lanctot186b5732013-03-18 10:26:30 -07006118#ifdef WLAN_FEATURE_P2P
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006119 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6120 ( psessionEntry->pePersona == VOS_P2P_GO_MODE )
Chet Lanctot186b5732013-03-18 10:26:30 -07006121#endif
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006122 )
6123 {
6124 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6125 }
Chet Lanctot186b5732013-03-18 10:26:30 -07006126
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006127 halstatus = halTxFrame( pMac,
6128 pPacket,
6129 (tANI_U16) nBytes,
6130 HAL_TXRX_FRM_802_11_MGMT,
6131 ANI_TXDIR_TODS,
6132 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6133 limTxComplete,
6134 pFrame, txFlag );
6135 if ( eHAL_STATUS_SUCCESS != halstatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07006136 {
6137 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
6138 nSirStatus = eSIR_FAILURE;
6139 //Pkt will be freed up by the callback
6140 return nSirStatus;
6141 }
6142 else {
6143 return eSIR_SUCCESS;
6144 }
6145
6146returnAfterError:
6147 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6148 return nSirStatus;
6149} // End limSendSaQueryResponseFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07006150#endif