blob: dfee03d2ec8883ec17aa809d77b088a3976a8cbb [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff 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 *
46 * Copyright (C) 2005-2007 Airgo Networks, Incorporated
47 *
48 */
49
50#include "sirApi.h"
51#include "aniGlobal.h"
52#include "sirMacProtDef.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070053#include "cfgApi.h"
54#include "utilsApi.h"
55#include "limTypes.h"
56#include "limUtils.h"
57#include "limSecurityUtils.h"
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -070058#include "limPropExtsUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070059#include "dot11f.h"
60#include "limStaHashApi.h"
61#include "schApi.h"
62#include "limSendMessages.h"
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -080063#include "limAssocUtils.h"
64#include "limFT.h"
65
Jeff Johnson295189b2012-06-20 16:38:30 -070066#if defined WLAN_FEATURE_VOWIFI
67#include "rrmApi.h"
68#endif
69
70#ifdef FEATURE_WLAN_CCX
71#include <limCcxparserApi.h>
72#endif
73#include "wlan_qct_wda.h"
74#ifdef WLAN_FEATURE_11W
75#include "dot11fdefs.h"
76#endif
77
78
79////////////////////////////////////////////////////////////////////////
80
Jeff Johnson295189b2012-06-20 16:38:30 -070081
82/**
83 *
84 * \brief This function is called by various LIM modules to prepare the
85 * 802.11 frame MAC header
86 *
87 *
88 * \param pMac Pointer to Global MAC structure
89 *
90 * \param pBD Pointer to the frame buffer that needs to be populate
91 *
92 * \param type Type of the frame
93 *
94 * \param subType Subtype of the frame
95 *
96 * \return eHalStatus
97 *
98 *
99 * The pFrameBuf argument points to the beginning of the frame buffer to
100 * which - a) The 802.11 MAC header is set b) Following this MAC header
101 * will be the MGMT frame payload The payload itself is populated by the
102 * caller API
103 *
104 *
105 */
106
107tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac,
108 tANI_U8* pBD,
109 tANI_U8 type,
110 tANI_U8 subType,
111 tSirMacAddr peerAddr ,tSirMacAddr selfMacAddr)
112{
113 tSirRetStatus statusCode = eSIR_SUCCESS;
114 tpSirMacMgmtHdr pMacHdr;
115
116 /// Prepare MAC management header
117 pMacHdr = (tpSirMacMgmtHdr) (pBD);
118
119 // Prepare FC
120 pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
121 pMacHdr->fc.type = type;
122 pMacHdr->fc.subType = subType;
123
124 // Prepare Address 1
125 palCopyMemory( pMac->hHdd,
126 (tANI_U8 *) pMacHdr->da,
127 (tANI_U8 *) peerAddr,
128 sizeof( tSirMacAddr ));
129
130 // Prepare Address 2
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 sirCopyMacAddr(pMacHdr->sa,selfMacAddr);
132
133 // Prepare Address 3
134 palCopyMemory( pMac->hHdd,
135 (tANI_U8 *) pMacHdr->bssId,
136 (tANI_U8 *) peerAddr,
137 sizeof( tSirMacAddr ));
138 return statusCode;
139} /*** end limPopulateMacHeader() ***/
140
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700141#ifdef WLAN_FEATURE_11W
142/**
143 *
144 * \brief This function is called by various LIM modules to correctly set
145 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
146 *
147 *
148 * \param pMac Pointer to Global MAC structure
149 *
150 * \param psessionEntry Pointer to session corresponding to the connection
151 *
152 * \param peer Peer address of the STA to which the frame is to be sent
153 *
154 * \param pMacHdr Pointer to the frame MAC header
155 *
156 * \return nothing
157 *
158 *
159 */
160void
161limSetProtectedBit(tpAniSirGlobal pMac,
162 tpPESession psessionEntry,
163 tSirMacAddr peer,
164 tpSirMacMgmtHdr pMacHdr)
165{
166 tANI_U16 aid;
167 tpDphHashNode pStaDs;
168
169 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
170 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
171 {
172
173 pStaDs = dphLookupHashEntry( pMac, peer, &aid, &psessionEntry->dph.dphHashTable );
174 if( pStaDs != NULL )
175 if( pStaDs->rmfEnabled )
176 pMacHdr->fc.wep = 1;
177 }
178 else if ( psessionEntry->limRmfEnabled )
179 pMacHdr->fc.wep = 1;
180} /*** end limSetProtectedBit() ***/
181#endif
182
Jeff Johnson295189b2012-06-20 16:38:30 -0700183/**
184 * \brief limSendProbeReqMgmtFrame
185 *
186 *
187 * \param pMac Pointer to Global MAC structure
188 *
189 * \param pSsid SSID to be sent in Probe Request frame
190 *
191 * \param bssid BSSID to be sent in Probe Request frame
192 *
193 * \param nProbeDelay probe delay to be used before sending Probe Request
194 * frame
195 *
196 * \param nChannelNum Channel # on which the Probe Request is going out
197 *
198 * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame
199 *
200 * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame
201 *
202 * This function is called by various LIM modules to send Probe Request frame
203 * during active scan/learn phase.
204 * Probe request is sent out in the following scenarios:
205 * --heartbeat failure: session needed
206 * --join req: session needed
207 * --foreground scan: no session
208 * --background scan: no session
209 * --schBeaconProcessing: to get EDCA parameters: session needed
210 *
211 *
212 */
213tSirRetStatus
214limSendProbeReqMgmtFrame(tpAniSirGlobal pMac,
215 tSirMacSSid *pSsid,
216 tSirMacAddr bssid,
217 tANI_U8 nChannelNum,
218 tSirMacAddr SelfMacAddr,
219 tANI_U32 dot11mode,
220 tANI_U32 nAdditionalIELen,
221 tANI_U8 *pAdditionalIE)
222{
223 tDot11fProbeRequest pr;
224 tANI_U32 nStatus, nBytes, nPayload;
225 tSirRetStatus nSirStatus;
226 tANI_U8 *pFrame;
227 void *pPacket;
228 eHalStatus halstatus;
229 tpPESession psessionEntry;
230 tANI_U8 sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 tANI_U8 *p2pIe = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700232 tANI_U8 txFlag = 0;
233
234#ifndef GEN4_SCAN
235 return eSIR_FAILURE;
236#endif
237
238#if defined ( ANI_DVT_DEBUG )
239 return eSIR_FAILURE;
240#endif
241
242 /*
243 * session context may or may not be present, when probe request needs to be sent out.
244 * following cases exist:
245 * --heartbeat failure: session needed
246 * --join req: session needed
247 * --foreground scan: no session
248 * --background scan: no session
249 * --schBeaconProcessing: to get EDCA parameters: session needed
250 * If session context does not exist, some IEs will be populated from CFGs,
251 * e.g. Supported and Extended rate set IEs
252 */
253 psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId);
254
255 // The scheme here is to fill out a 'tDot11fProbeRequest' structure
256 // and then hand it off to 'dot11fPackProbeRequest' (for
257 // serialization). We start by zero-initializing the structure:
258 palZeroMemory( pMac->hHdd, ( tANI_U8* )&pr, sizeof( pr ) );
259
260 // & delegating to assorted helpers:
261 PopulateDot11fSSID( pMac, pSsid, &pr.SSID );
262
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 if( nAdditionalIELen && pAdditionalIE )
264 {
265 p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen);
266 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700267 /* Don't include 11b rate only when device is doing P2P Search */
268 if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) &&
269 ( p2pIe != NULL ) &&
270 /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */
271 ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
272 pMac->lim.gpLimMlmScanReq->p2pSearch ) ||
273 ( ( psessionEntry != NULL ) &&
274 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
275 )
276 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 {
278 /* In the below API pass channel number > 14, do that it fills only
279 * 11a rates in supported rates */
280 PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry);
281 }
282 else
283 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700284 PopulateDot11fSuppRates( pMac, nChannelNum,
285 &pr.SuppRates,psessionEntry);
286
287 if ( WNI_CFG_DOT11_MODE_11B != dot11mode )
288 {
289 PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates );
290 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700292
293#if defined WLAN_FEATURE_VOWIFI
294 //Table 7-14 in IEEE Std. 802.11k-2008 says
295 //DS params "can" be present in RRM is disabled and "is" present if
296 //RRM is enabled. It should be ok even if we add it into probe req when
297 //RRM is not enabled.
298 PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry );
299 //Call RRM module to get the tx power for management used.
300 {
301 tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry );
302 PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 );
303 }
304#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700305
306 if (psessionEntry != NULL ) {
Jeff Johnsone7245742012-09-05 17:12:55 -0700307 psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 //Include HT Capability IE
Jeff Johnsone7245742012-09-05 17:12:55 -0700309 if (psessionEntry->htCapability)
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 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700313 } else { //psessionEntry == NULL
314 if (IS_DOT11_MODE_HT(dot11mode))
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700316 PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 }
318 }
Gopichand Nakkala40bc6502012-12-20 16:55:36 -0800319
320 /* Set channelbonding information as "disabled" when tunned to a 2.4 GHz channel */
321 if( nChannelNum <= SIR_11B_CHANNEL_END)
322 {
323 pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
324 pr.HTCaps.shortGI40MHz = 0;
325 }
326
Jeff Johnsone7245742012-09-05 17:12:55 -0700327#ifdef WLAN_FEATURE_11AC
328 if (psessionEntry != NULL ) {
329 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode);
330 //Include HT Capability IE
331 if (psessionEntry->vhtCapability)
332 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700333 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
334 }
335 } else {
336 if (IS_DOT11_MODE_VHT(dot11mode))
337 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700338 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps );
339 }
340 }
341#endif
342
Jeff Johnson295189b2012-06-20 16:38:30 -0700343
344 // That's it-- now we pack it. First, how much space are we going to
345 // need?
346 nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload );
347 if ( DOT11F_FAILED( nStatus ) )
348 {
349 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700350 "or a Probe Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 // We'll fall back on the worst case scenario:
352 nPayload = sizeof( tDot11fProbeRequest );
353 }
354 else if ( DOT11F_WARNED( nStatus ) )
355 {
356 limLog( pMac, LOGW, FL("There were warnings while calculating"
357 "the packed size for a Probe Request ("
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700358 "0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 }
360
361 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen;
362
363 // Ok-- try to allocate some memory:
364 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
365 ( tANI_U16 )nBytes, ( void** ) &pFrame,
366 ( void** ) &pPacket );
367 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
368 {
369 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700370 "be Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 return eSIR_MEM_ALLOC_FAILED;
372 }
373
374 // Paranoia:
375 palZeroMemory( pMac->hHdd, pFrame, nBytes );
376
377 // Next, we fill out the buffer descriptor:
378 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
379 SIR_MAC_MGMT_PROBE_REQ, bssid ,SelfMacAddr);
380 if ( eSIR_SUCCESS != nSirStatus )
381 {
382 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700383 "tor for a Probe Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 nSirStatus );
385 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
386 ( void* ) pFrame, ( void* ) pPacket );
387 return nSirStatus; // allocated!
388 }
389
390 // That done, pack the Probe Request:
391 nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame +
392 sizeof( tSirMacMgmtHdr ),
393 nPayload, &nPayload );
394 if ( DOT11F_FAILED( nStatus ) )
395 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700396 limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 nStatus );
398 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
399 return eSIR_FAILURE; // allocated!
400 }
401 else if ( DOT11F_WARNED( nStatus ) )
402 {
403 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700404 "robe Request (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 }
406
407 // Append any AddIE if present.
408 if( nAdditionalIELen )
409 {
410 palCopyMemory( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
411 pAdditionalIE, nAdditionalIELen );
412 nPayload += nAdditionalIELen;
413 }
414
415 /* If this probe request is sent during P2P Search State, then we need
416 * to send it at OFDM rate.
417 */
418 if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum))
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 || (( pMac->lim.gpLimMlmScanReq != NULL) &&
420 pMac->lim.gpLimMlmScanReq->p2pSearch )
Gopichand Nakkala67967212013-02-15 17:31:15 +0530421 /* For unicast probe req mgmt from Join function
422 we don't set above variables. So we need to add
423 one more check whether it is pePersona is P2P_CLIENT or not */
424 || ( ( psessionEntry != NULL ) &&
425 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 )
427 {
428 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
429 }
430
431
432 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload,
433 HAL_TXRX_FRM_802_11_MGMT,
434 ANI_TXDIR_TODS,
435 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
436 limTxComplete, pFrame, txFlag );
437 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
438 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700439 limLog( pMac, LOGE, FL("could not send Probe Request frame!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 //Pkt will be freed up by the callback
441 return eSIR_FAILURE;
442 }
443
444 return eSIR_SUCCESS;
445} // End limSendProbeReqMgmtFrame.
446
Jeff Johnson295189b2012-06-20 16:38:30 -0700447tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac,
448 tANI_U8* addIE, tANI_U16 *addnIELen,
449 tANI_U8 probeReqP2pIe)
450{
451 /* If Probe request doesn't have P2P IE, then take out P2P IE
452 from additional IE */
453 if(!probeReqP2pIe)
454 {
455 tANI_U8* tempbuf = NULL;
456 tANI_U16 tempLen = 0;
457 int left = *addnIELen;
458 v_U8_t *ptr = addIE;
459 v_U8_t elem_id, elem_len;
460
461 if(NULL == addIE)
462 {
463 PELOGE(limLog(pMac, LOGE,
464 FL(" NULL addIE pointer"));)
465 return eSIR_FAILURE;
466 }
467
468 if( (palAllocateMemory(pMac->hHdd, (void**)&tempbuf,
Jeff Johnson43971f52012-07-17 12:26:56 -0700469 left)) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 {
471 PELOGE(limLog(pMac, LOGE,
472 FL("Unable to allocate memory to store addn IE"));)
473 return eSIR_MEM_ALLOC_FAILED;
474 }
475
476 while(left >= 2)
477 {
478 elem_id = ptr[0];
479 elem_len = ptr[1];
480 left -= 2;
481 if(elem_len > left)
482 {
483 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 elem_id,elem_len,left);
486 palFreeMemory(pMac->hHdd, tempbuf);
487 return eSIR_FAILURE;
488 }
489 if ( !( (SIR_MAC_EID_VENDOR == elem_id) &&
490 (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) )
491 {
492 palCopyMemory ( pMac->hHdd, tempbuf + tempLen, &ptr[0], elem_len + 2);
493 tempLen += (elem_len + 2);
494 }
495 left -= elem_len;
496 ptr += (elem_len + 2);
497 }
498 palCopyMemory ( pMac->hHdd, addIE, tempbuf, tempLen);
499 *addnIELen = tempLen;
500 palFreeMemory(pMac->hHdd, tempbuf);
501 }
502 return eSIR_SUCCESS;
503}
Jeff Johnson295189b2012-06-20 16:38:30 -0700504
505void
506limSendProbeRspMgmtFrame(tpAniSirGlobal pMac,
507 tSirMacAddr peerMacAddr,
508 tpAniSSID pSsid,
509 short nStaId,
510 tANI_U8 nKeepAlive,
511 tpPESession psessionEntry,
512 tANI_U8 probeReqP2pIe)
513{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700514 tDot11fProbeResponse *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 tSirRetStatus nSirStatus;
516 tANI_U32 cfg, nPayload, nBytes, nStatus;
517 tpSirMacMgmtHdr pMacHdr;
518 tANI_U8 *pFrame;
519 void *pPacket;
520 eHalStatus halstatus;
521 tANI_U32 addnIEPresent;
522 tANI_U32 addnIE1Len=0;
523 tANI_U32 addnIE2Len=0;
524 tANI_U32 addnIE3Len=0;
525 tANI_U16 totalAddnIeLen = 0;
526 tANI_U32 wpsApEnable=0, tmp;
527 tANI_U8 txFlag = 0;
528 tANI_U8 *addIE = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 tANI_U8 *pP2pIe = NULL;
530 tANI_U8 noaLen = 0;
531 tANI_U8 total_noaLen = 0;
532 tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN
533 + SIR_P2P_IE_HEADER_LEN];
534 tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
Jeff Johnson295189b2012-06-20 16:38:30 -0700535
536 if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests
537 {
538 return; // in this case.
539 }
540
541 if(NULL == psessionEntry)
542 {
543 return;
544 }
545
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700546 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
547 (void **)&pFrm, sizeof(tDot11fProbeResponse)))
548 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700549 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limSendProbeRspMgmtFrame") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700550 return;
551 }
552
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 // Fill out 'frm', after which we'll just hand the struct off to
554 // 'dot11fPackProbeResponse'.
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700555 palZeroMemory( pMac->hHdd, ( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700556
557 // Timestamp to be updated by TFP, below.
558
559 // Beacon Interval:
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
561 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700562 pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 }
564 else
565 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800566 nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg);
567 if (eSIR_SUCCESS != nSirStatus)
568 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700569 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BEACON_INTERVAL from CFG (%d)."),
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800570 nSirStatus );
Gopichand Nakkalafa9e2982013-03-29 00:48:18 +0530571 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800572 return;
573 }
574 pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg;
Madan Mohan Koyyalamudic0d1b3f2012-11-13 10:41:07 -0800575 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700576
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700577 PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry );
578 PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700580 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700581
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700582 PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry);
583 PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700584
Jeff Johnson295189b2012-06-20 16:38:30 -0700585
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
587 {
588 if(psessionEntry->wps_state != SAP_WPS_DISABLED)
589 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700590 PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 }
592 }
593 else
594 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800595 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700596 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_ENABLE );
Jeff Johnson295189b2012-06-20 16:38:30 -0700597
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800598 wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
Jeff Johnson295189b2012-06-20 16:38:30 -0700599
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800600 if (wpsApEnable)
601 {
602 PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes);
603 }
604
605 if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
606 {
607 PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
608 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
609 }
610
611 if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
612 {
613 DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
614 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
615 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700617
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700618 PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry);
619 PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700620
Jeff Johnson295189b2012-06-20 16:38:30 -0700621
622 if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700623 PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700624
625
626 // N.B. In earlier implementations, the RSN IE would be placed in
627 // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined.
628 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700629 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700630
631 //Populate HT IEs, when operating in 11n or Taurus modes.
Jeff Johnsone7245742012-09-05 17:12:55 -0700632 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700634 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700635 PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700637#ifdef WLAN_FEATURE_11AC
638 if(psessionEntry->vhtCapability)
639 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 limLog( pMac, LOGW, FL("Populate VHT IE in Probe Response"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700641 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps );
642 PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation );
Jeff Johnsone7245742012-09-05 17:12:55 -0700643 // we do not support multi users yet
644 //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700645 PopulateDot11fExtCap( pMac, &pFrm->ExtCap);
Jeff Johnsone7245742012-09-05 17:12:55 -0700646 }
647#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700648
649 if ( psessionEntry->pLimStartBssReq )
650 {
651 PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700652 &pFrm->WPA );
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700653 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
654 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 }
656
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700657 PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700658
659#if defined(FEATURE_WLAN_WAPI)
660 if( psessionEntry->pLimStartBssReq )
661 {
662 PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700663 &pFrm->WAPI );
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 }
665
666#endif // defined(FEATURE_WLAN_WAPI)
667
668
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700669 nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 if ( DOT11F_FAILED( nStatus ) )
671 {
672 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 "or a Probe Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 nStatus );
675 // We'll fall back on the worst case scenario:
676 nPayload = sizeof( tDot11fProbeResponse );
677 }
678 else if ( DOT11F_WARNED( nStatus ) )
679 {
680 limLog( pMac, LOGW, FL("There were warnings while calculating"
681 "the packed size for a Probe Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700682 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 }
684
685 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
686
687 addnIEPresent = false;
688
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 if( pMac->lim.gpLimRemainOnChanReq )
690 {
691 nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) );
692 }
693 //Only use CFG for non-listen mode. This CFG is not working for concurrency
694 //In listening mode, probe rsp IEs is passed in the message from SME to PE
695 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 {
697
698 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
699 &addnIEPresent) != eSIR_SUCCESS)
700 {
701 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700702 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 return;
704 }
705 }
706
707 if (addnIEPresent)
708 {
709 if( (palAllocateMemory(pMac->hHdd, (void**)&addIE,
Jeff Johnson43971f52012-07-17 12:26:56 -0700710 WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3 )) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 {
712 PELOGE(limLog(pMac, LOGE,
713 FL("Unable to allocate memory to store addn IE"));)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700714 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 return;
716 }
717
718 //Probe rsp IE available
719 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
720 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) )
721 {
722 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length"));
723 palFreeMemory(pMac->hHdd, addIE);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700724 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 return;
726 }
727 if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len &&
728 (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE)
729 {
730 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
731 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0],
732 &addnIE1Len) )
733 {
734 limLog(pMac, LOGP,
735 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String"));
736 palFreeMemory(pMac->hHdd, addIE);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700737 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 return;
739 }
740 }
741
742 //Probe rsp IE available
743 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
744 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) )
745 {
746 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length"));
747 palFreeMemory(pMac->hHdd, addIE);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700748 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 return;
750 }
751 if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len &&
752 (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE)
753 {
754 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
755 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len],
756 &addnIE2Len) )
757 {
758 limLog(pMac, LOGP,
759 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String"));
760 palFreeMemory(pMac->hHdd, addIE);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700761 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 return;
763 }
764 }
765
766 //Probe rsp IE available
767 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
768 WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) )
769 {
770 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length"));
771 palFreeMemory(pMac->hHdd, addIE);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700772 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 return;
774 }
775 if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len &&
776 (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE)
777 {
778 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
779 WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
780 &addIE[addnIE1Len + addnIE2Len],
781 &addnIE3Len) )
782 {
783 limLog(pMac, LOGP,
784 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String"));
785 palFreeMemory(pMac->hHdd, addIE);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700786 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 return;
788 }
789 }
790 totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len;
791
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe))
793 {
794 limLog(pMac, LOGP,
795 FL("Unable to get final Additional IE for Probe Req"));
796 palFreeMemory(pMac->hHdd, addIE);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700797 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 return;
799 }
800 nBytes = nBytes + totalAddnIeLen;
801
802 if (probeReqP2pIe)
803 {
804 pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen);
805 if (pP2pIe != NULL)
806 {
807 //get NoA attribute stream P2P IE
808 noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
809 if (noaLen != 0)
810 {
811 total_noaLen = limBuildP2pIe(pMac, &noaIe[0],
812 &noaStream[0], noaLen);
813 nBytes = nBytes + total_noaLen;
814 }
815 }
816 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 }
818
819 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
820 ( tANI_U16 )nBytes, ( void** ) &pFrame,
821 ( void** ) &pPacket );
822 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
823 {
824 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 "be Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 if ( addIE != NULL )
827 {
828 palFreeMemory(pMac->hHdd, addIE);
829 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700830 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 return;
832 }
833
834 // Paranoia:
835 palZeroMemory( pMac->hHdd, pFrame, nBytes );
836
837 // Next, we fill out the buffer descriptor:
838 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
839 SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr);
840 if ( eSIR_SUCCESS != nSirStatus )
841 {
842 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 "tor for a Probe Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 nSirStatus );
845 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
846 ( void* ) pFrame, ( void* ) pPacket );
847 if ( addIE != NULL )
848 {
849 palFreeMemory(pMac->hHdd, addIE);
850 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700851 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 return;
853 }
854
855 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
856
857 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
858
859 // That done, pack the Probe Response:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700860 nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr),
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 nPayload, &nPayload );
862 if ( DOT11F_FAILED( nStatus ) )
863 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700864 limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 nStatus );
866 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
867 if ( addIE != NULL )
868 {
869 palFreeMemory(pMac->hHdd, addIE);
870 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700871 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 return; // allocated!
873 }
874 else if ( DOT11F_WARNED( nStatus ) )
875 {
876 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700877 "robe Response (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 }
879
880 PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") );
881 limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
882
883 pMac->sys.probeRespond++;
884
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 if( pMac->lim.gpLimRemainOnChanReq )
886 {
887 palCopyMemory ( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
888 pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) );
889 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700890
891 if ( addnIEPresent )
892 {
893 if (palCopyMemory ( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson43971f52012-07-17 12:26:56 -0700894 &addIE[0], totalAddnIeLen) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 {
896 limLog(pMac, LOGP, FL("Additional Probe Rp IE request failed while Appending: %x"),halstatus);
897 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
898 ( void* ) pFrame, ( void* ) pPacket );
899 if ( addIE != NULL )
900 {
901 palFreeMemory(pMac->hHdd, addIE);
902 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700903 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 return;
905 }
906 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 if (noaLen != 0)
908 {
Krunal Soni81b24262013-05-15 17:46:41 -0700909 if (total_noaLen > (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN))
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 {
911 limLog(pMac, LOGE,
912 FL("Not able to insert NoA because of length constraint"));
Krunal Soni81b24262013-05-15 17:46:41 -0700913 palFreeMemory(pMac->hHdd, addIE);
914 palFreeMemory(pMac->hHdd, pFrm);
915 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
916 ( void* ) pFrame, ( void* ) pPacket );
917 return;
918 }
919 else
920 {
921 palCopyMemory(pMac->hHdd, &pFrame[nBytes - (total_noaLen)],
922 &noaIe[0], total_noaLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 }
924 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700925
926 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
928 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 )
930 {
931 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
932 }
933
934 // Queue Probe Response frame in high priority WQ
935 halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket,
936 ( tANI_U16 ) nBytes,
937 HAL_TXRX_FRM_802_11_MGMT,
938 ANI_TXDIR_TODS,
939 7,//SMAC_SWBD_TX_TID_MGMT_LOW,
940 limTxComplete, pFrame, txFlag );
941 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
942 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700943 limLog( pMac, LOGE, FL("Could not send Probe Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 //Pkt will be freed up by the callback
945 }
946
947 if ( addIE != NULL )
948 {
949 palFreeMemory(pMac->hHdd, addIE);
950 }
951
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700952 palFreeMemory(pMac->hHdd, pFrm);
953 return;
954
955
Jeff Johnson295189b2012-06-20 16:38:30 -0700956} // End limSendProbeRspMgmtFrame.
957
958void
959limSendAddtsReqActionFrame(tpAniSirGlobal pMac,
960 tSirMacAddr peerMacAddr,
961 tSirAddtsReqInfo *pAddTS,
962 tpPESession psessionEntry)
963{
964 tANI_U16 i;
965 tANI_U8 *pFrame;
966 tSirRetStatus nSirStatus;
967 tDot11fAddTSRequest AddTSReq;
968 tDot11fWMMAddTSRequest WMMAddTSReq;
969 tANI_U32 nPayload, nBytes, nStatus;
970 tpSirMacMgmtHdr pMacHdr;
971 void *pPacket;
972#ifdef FEATURE_WLAN_CCX
973 tANI_U32 phyMode;
974#endif
975 eHalStatus halstatus;
976 tANI_U8 txFlag = 0;
977
978 if(NULL == psessionEntry)
979 {
980 return;
981 }
982
983 if ( ! pAddTS->wmeTspecPresent )
984 {
985 palZeroMemory( pMac->hHdd, ( tANI_U8* )&AddTSReq, sizeof( AddTSReq ) );
986
987 AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
988 AddTSReq.DialogToken.token = pAddTS->dialogToken;
989 AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT;
990 if ( pAddTS->lleTspecPresent )
991 {
992 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC );
993 }
994 else
995 {
996 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC );
997 }
998
999 if ( pAddTS->lleTspecPresent )
1000 {
1001 AddTSReq.num_WMMTCLAS = 0;
1002 AddTSReq.num_TCLAS = pAddTS->numTclas;
1003 for ( i = 0; i < pAddTS->numTclas; ++i)
1004 {
1005 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
1006 &AddTSReq.TCLAS[i] );
1007 }
1008 }
1009 else
1010 {
1011 AddTSReq.num_TCLAS = 0;
1012 AddTSReq.num_WMMTCLAS = pAddTS->numTclas;
1013 for ( i = 0; i < pAddTS->numTclas; ++i)
1014 {
1015 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1016 &AddTSReq.WMMTCLAS[i] );
1017 }
1018 }
1019
1020 if ( pAddTS->tclasProcPresent )
1021 {
1022 if ( pAddTS->lleTspecPresent )
1023 {
1024 AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc;
1025 AddTSReq.TCLASSPROC.present = 1;
1026 }
1027 else
1028 {
1029 AddTSReq.WMMTCLASPROC.version = 1;
1030 AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc;
1031 AddTSReq.WMMTCLASPROC.present = 1;
1032 }
1033 }
1034
1035 nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload );
1036 if ( DOT11F_FAILED( nStatus ) )
1037 {
1038 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001039 "or an Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 nStatus );
1041 // We'll fall back on the worst case scenario:
1042 nPayload = sizeof( tDot11fAddTSRequest );
1043 }
1044 else if ( DOT11F_WARNED( nStatus ) )
1045 {
1046 limLog( pMac, LOGW, FL("There were warnings while calculating"
1047 "the packed size for an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001048 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 }
1050 }
1051 else
1052 {
1053 palZeroMemory( pMac->hHdd, ( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ) );
1054
1055 WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
1056 WMMAddTSReq.DialogToken.token = pAddTS->dialogToken;
1057 WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME;
1058
1059 // WMM spec 2.2.10 - status code is only filled in for ADDTS response
1060 WMMAddTSReq.StatusCode.statusCode = 0;
1061
1062 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC );
1063#ifdef FEATURE_WLAN_CCX
1064 limGetPhyMode(pMac, &phyMode, psessionEntry);
1065
1066 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
1067 {
1068 pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
1069 }
1070 else
1071 {
1072 pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
1073 }
1074 PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.CCXTrafStrmRateSet,sizeof(tANI_U8));
1075#endif
1076 // fillWmeTspecIE
1077
1078 nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload );
1079 if ( DOT11F_FAILED( nStatus ) )
1080 {
1081 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001082 "or a WMM Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 nStatus );
1084 // We'll fall back on the worst case scenario:
1085 nPayload = sizeof( tDot11fAddTSRequest );
1086 }
1087 else if ( DOT11F_WARNED( nStatus ) )
1088 {
1089 limLog( pMac, LOGW, FL("There were warnings while calculating"
1090 "the packed size for a WMM Add TS Requ"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001091 "est (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 }
1093 }
1094
1095 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1096
1097 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1098 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1099 ( void** ) &pPacket );
1100 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1101 {
1102 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001103 "d TS Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 return;
1105 }
1106
1107 // Paranoia:
1108 palZeroMemory( pMac->hHdd, pFrame, nBytes );
1109
1110 // Next, we fill out the buffer descriptor:
1111 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1112 SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr);
1113 if ( eSIR_SUCCESS != nSirStatus )
1114 {
1115 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001116 "tor for an Add TS Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001117 nSirStatus );
1118 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1119 ( void* ) pFrame, ( void* ) pPacket );
1120 return;
1121 }
1122
1123 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1124
1125 #if 0
1126 cfgLen = SIR_MAC_ADDR_LENGTH;
1127 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1128 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1129 {
1130 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001131 "e sending an Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1133 ( void* ) pFrame, ( void* ) pPacket );
1134 return;
1135 }
1136 #endif //TO SUPPORT BT-AMP
1137
1138 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1139
Chet Lanctot186b5732013-03-18 10:26:30 -07001140#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001141 limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001142#endif
1143
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 // That done, pack the struct:
1145 if ( ! pAddTS->wmeTspecPresent )
1146 {
1147 nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq,
1148 pFrame + sizeof(tSirMacMgmtHdr),
1149 nPayload, &nPayload );
1150 if ( DOT11F_FAILED( nStatus ) )
1151 {
1152 limLog( pMac, LOGE, FL("Failed to pack an Add TS Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001153 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 nStatus );
1155 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1156 return; // allocated!
1157 }
1158 else if ( DOT11F_WARNED( nStatus ) )
1159 {
1160 limLog( pMac, LOGW, FL("There were warnings while packing"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001161 "an Add TS Request (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 }
1163 }
1164 else
1165 {
1166 nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq,
1167 pFrame + sizeof(tSirMacMgmtHdr),
1168 nPayload, &nPayload );
1169 if ( DOT11F_FAILED( nStatus ) )
1170 {
1171 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001172 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001173 nStatus );
1174 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1175 return; // allocated!
1176 }
1177 else if ( DOT11F_WARNED( nStatus ) )
1178 {
1179 limLog( pMac, LOGW, FL("There were warnings while packing"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001180 "a WMM Add TS Request (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 }
1182 }
1183
1184 PELOG3(limLog( pMac, LOG3, FL("Sending an Add TS Request frame to ") );
1185 limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
1186
1187 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1189 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 )
1191 {
1192 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1193 }
1194
1195 // Queue Addts Response frame in high priority WQ
1196 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1197 HAL_TXRX_FRM_802_11_MGMT,
1198 ANI_TXDIR_TODS,
1199 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1200 limTxComplete, pFrame, txFlag );
1201 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1202 {
1203 limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001204 " (%X) ***" ), halstatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 //Pkt will be freed up by the callback
1206 }
1207
1208} // End limSendAddtsReqActionFrame.
1209
Jeff Johnson295189b2012-06-20 16:38:30 -07001210
1211
1212void
1213limSendAssocRspMgmtFrame(tpAniSirGlobal pMac,
1214 tANI_U16 statusCode,
1215 tANI_U16 aid,
1216 tSirMacAddr peerMacAddr,
1217 tANI_U8 subType,
1218 tpDphHashNode pSta,tpPESession psessionEntry)
1219{
1220 static tDot11fAssocResponse frm;
1221 tANI_U8 *pFrame, *macAddr;
1222 tpSirMacMgmtHdr pMacHdr;
1223 tSirRetStatus nSirStatus;
1224 tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0;
1225 tHalBitVal qosMode, wmeMode;
1226 tANI_U32 nPayload, nBytes, nStatus;
1227 void *pPacket;
1228 eHalStatus halstatus;
1229 tUpdateBeaconParams beaconParams;
1230 tANI_U8 txFlag = 0;
1231 tANI_U32 addnIEPresent = false;
1232 tANI_U32 addnIELen=0;
1233 tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN];
1234 tpSirAssocReq pAssocReq = NULL;
1235
1236 if(NULL == psessionEntry)
1237 {
1238 return;
1239 }
1240
1241 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
1242
1243 limGetQosMode(psessionEntry, &qosMode);
1244 limGetWmeMode(psessionEntry, &wmeMode);
1245
1246 // An Add TS IE is added only if the AP supports it and the requesting
1247 // STA sent a traffic spec.
1248 fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0;
1249
1250 PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry );
1251
1252 frm.Status.status = statusCode;
1253
1254 frm.AID.associd = aid | LIM_AID_MASK;
1255
1256 if ( NULL == pSta )
1257 {
1258 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry);
1259 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry );
1260 }
1261 else
1262 {
1263 PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates,
1264 pSta->supportedRates.llbRates, pSta->supportedRates.llaRates );
1265 }
1266
Jeff Johnson295189b2012-06-20 16:38:30 -07001267 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1268 {
1269 if( pSta != NULL && eSIR_SUCCESS == statusCode )
1270 {
1271 pAssocReq =
1272 (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */
1274 if( pAssocReq != NULL && pAssocReq->addIEPresent ) {
1275 PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq);
1276 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 }
1278 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001279
1280 if ( NULL != pSta )
1281 {
1282 if ( eHAL_SET == qosMode )
1283 {
1284 if ( pSta->lleEnabled )
1285 {
1286 lleMode = 1;
1287 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) )
1288 {
1289 PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
1290
1291// FramesToDo:...
1292// if ( fAddTS )
1293// {
1294// tANI_U8 *pAf = pBody;
1295// *pAf++ = SIR_MAC_QOS_ACTION_EID;
1296// tANI_U32 tlen;
1297// status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL,
1298// &tlen, bufLen - frameLen);
1299// } // End if on Add TS.
1300 }
1301 } // End if on .11e enabled in 'pSta'.
1302 } // End if on QOS Mode on.
1303
1304 if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled )
1305 {
1306 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1307 {
1308
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001310
1311 if ( pSta->wsmEnabled )
1312 {
1313 PopulateDot11fWMMCaps(&frm.WMMCaps );
1314 }
1315 }
1316 }
1317
1318 if ( pSta->aniPeer )
1319 {
1320 if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ||
1321 ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1322 {
1323 edcaInclude = 1;
1324 }
1325
1326 } // End if on Airgo peer.
1327
1328 if ( pSta->mlmStaContext.htCapability &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001329 psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001331 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001334
1335#ifdef WLAN_FEATURE_11AC
1336 if( pSta->mlmStaContext.vhtCapability &&
1337 psessionEntry->vhtCapability )
1338 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001339 limLog( pMac, LOGW, FL("Populate VHT IEs in Assoc Response"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001340 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
1341 PopulateDot11fVHTOperation( pMac, &frm.VHTOperation);
Mohit Khanna4a70d262012-09-11 16:30:12 -07001342 PopulateDot11fExtCap( pMac, &frm.ExtCap);
Jeff Johnsone7245742012-09-05 17:12:55 -07001343 }
1344#endif
1345
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 } // End if on non-NULL 'pSta'.
1347
1348
1349 palZeroMemory( pMac->hHdd, ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams) );
1350
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1352 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
1353 limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry);
1354 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001355
1356 limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry);
1357 limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry);
1358
1359 beaconParams.bssIdx = psessionEntry->bssIdx;
1360
1361 //Send message to HAL about beacon parameter change.
1362 if(beaconParams.paramChangeBitmap)
1363 {
1364 schSetFixedBeaconFields(pMac,psessionEntry);
1365 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
1366 }
1367
1368 // Allocate a buffer for this frame:
1369 nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
1370 if ( DOT11F_FAILED( nStatus ) )
1371 {
1372 limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001373 "or an Association Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 nStatus );
1375 return;
1376 }
1377 else if ( DOT11F_WARNED( nStatus ) )
1378 {
1379 limLog( pMac, LOGW, FL("There were warnings while calculating"
1380 "the packed size for an Association Re"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001381 "sponse (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001382 }
1383
1384 nBytes = sizeof( tSirMacMgmtHdr ) + nPayload;
1385
1386 if ( pAssocReq != NULL )
1387 {
1388 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
1389 &addnIEPresent) != eSIR_SUCCESS)
1390 {
1391 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_ASSOC_RSP_ADDNIE_FLAG"));
1392 return;
1393 }
1394
1395 if (addnIEPresent)
1396 {
1397 //Assoc rsp IE available
1398 if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1399 &addnIELen) != eSIR_SUCCESS)
1400 {
1401 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_ASSOC_RSP_ADDNIE_DATA length"));
1402 return;
1403 }
1404
1405 if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen &&
1406 (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE)
1407 {
1408 if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1409 &addIE[0], &addnIELen) == eSIR_SUCCESS)
1410 {
1411 nBytes = nBytes + addnIELen;
1412 }
1413 }
1414 }
1415 }
1416
1417 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1418 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1419 ( void** ) &pPacket );
1420 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1421 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001422 limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 return;
1424 }
1425
1426 // Paranoia:
1427 palZeroMemory( pMac->hHdd, pFrame, nBytes );
1428
1429 // Next, we fill out the buffer descriptor:
1430 nSirStatus = limPopulateMacHeader( pMac,
1431 pFrame,
1432 SIR_MAC_MGMT_FRAME,
1433 ( LIM_ASSOC == subType ) ?
1434 SIR_MAC_MGMT_ASSOC_RSP :
1435 SIR_MAC_MGMT_REASSOC_RSP,
1436 peerMacAddr,psessionEntry->selfMacAddr);
1437 if ( eSIR_SUCCESS != nSirStatus )
1438 {
1439 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001440 "tor for an Association Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 nSirStatus );
1442 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1443 ( void* ) pFrame, ( void* ) pPacket );
1444 return;
1445 }
1446
1447 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1448
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1450
1451 nStatus = dot11fPackAssocResponse( pMac, &frm,
1452 pFrame + sizeof( tSirMacMgmtHdr ),
1453 nPayload, &nPayload );
1454 if ( DOT11F_FAILED( nStatus ) )
1455 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001456 limLog( pMac, LOGE, FL("Failed to pack an Association Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 nStatus );
1458 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1459 ( void* ) pFrame, ( void* ) pPacket );
1460 return; // allocated!
1461 }
1462 else if ( DOT11F_WARNED( nStatus ) )
1463 {
1464 limLog( pMac, LOGW, FL("There were warnings while packing an "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001465 "Association Response (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 }
1467
1468 macAddr = pMacHdr->da;
1469
1470 if (subType == LIM_ASSOC)
1471 {
1472 PELOG1(limLog(pMac, LOG1,
1473 FL("*** Sending Assoc Resp status %d aid %d to "),
1474 statusCode, aid);)
1475 }
1476 else{
1477 PELOG1(limLog(pMac, LOG1,
1478 FL("*** Sending ReAssoc Resp status %d aid %d to "),
1479 statusCode, aid);)
1480 }
1481 PELOG1(limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
1482
1483 if ( addnIEPresent )
1484 {
1485 if (palCopyMemory ( pMac->hHdd, pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson43971f52012-07-17 12:26:56 -07001486 &addIE[0], addnIELen ) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001488 limLog(pMac, LOGP, FL("Additional Assoc IEs request failed while Appending: %x"),halstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1490 ( void* ) pFrame, ( void* ) pPacket );
1491 return;
1492 }
1493 }
1494
1495 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001496 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1497 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 )
1499 {
1500 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1501 }
1502
1503 /// Queue Association Response frame in high priority WQ
1504 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1505 HAL_TXRX_FRM_802_11_MGMT,
1506 ANI_TXDIR_TODS,
1507 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1508 limTxComplete, pFrame, txFlag );
1509 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1510 {
1511 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001512 FL("*** Could not Send Re/AssocRsp, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 nSirStatus);
1514
1515 //Pkt will be freed up by the callback
1516 }
1517
1518 // update the ANI peer station count
1519 //FIXME_PROTECTION : take care of different type of station
1520 // counter inside this function.
1521 limUtilCountStaAdd(pMac, pSta, psessionEntry);
1522
1523} // End limSendAssocRspMgmtFrame.
1524
1525
1526
1527void
1528limSendAddtsRspActionFrame(tpAniSirGlobal pMac,
1529 tSirMacAddr peer,
1530 tANI_U16 nStatusCode,
1531 tSirAddtsReqInfo *pAddTS,
1532 tSirMacScheduleIE *pSchedule,
1533 tpPESession psessionEntry)
1534{
1535 tANI_U8 *pFrame;
1536 tpSirMacMgmtHdr pMacHdr;
1537 tDot11fAddTSResponse AddTSRsp;
1538 tDot11fWMMAddTSResponse WMMAddTSRsp;
1539 tSirRetStatus nSirStatus;
1540 tANI_U32 i, nBytes, nPayload, nStatus;
1541 void *pPacket;
1542 eHalStatus halstatus;
1543 tANI_U8 txFlag = 0;
1544
1545 if(NULL == psessionEntry)
1546 {
1547 return;
1548 }
1549
1550 if ( ! pAddTS->wmeTspecPresent )
1551 {
1552 palZeroMemory( pMac->hHdd, ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ) );
1553
1554 AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1555 AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1556 AddTSRsp.DialogToken.token = pAddTS->dialogToken;
1557 AddTSRsp.Status.status = nStatusCode;
1558
1559 // The TsDelay information element is only filled in for a specific
1560 // status code:
1561 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode )
1562 {
1563 if ( pAddTS->wsmTspecPresent )
1564 {
1565 AddTSRsp.WMMTSDelay.version = 1;
1566 AddTSRsp.WMMTSDelay.delay = 10;
1567 AddTSRsp.WMMTSDelay.present = 1;
1568 }
1569 else
1570 {
1571 AddTSRsp.TSDelay.delay = 10;
1572 AddTSRsp.TSDelay.present = 1;
1573 }
1574 }
1575
1576 if ( pAddTS->wsmTspecPresent )
1577 {
1578 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC );
1579 }
1580 else
1581 {
1582 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC );
1583 }
1584
1585 if ( pAddTS->wsmTspecPresent )
1586 {
1587 AddTSRsp.num_WMMTCLAS = 0;
1588 AddTSRsp.num_TCLAS = pAddTS->numTclas;
1589 for ( i = 0; i < AddTSRsp.num_TCLAS; ++i)
1590 {
1591 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
1592 &AddTSRsp.TCLAS[i] );
1593 }
1594 }
1595 else
1596 {
1597 AddTSRsp.num_TCLAS = 0;
1598 AddTSRsp.num_WMMTCLAS = pAddTS->numTclas;
1599 for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i)
1600 {
1601 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1602 &AddTSRsp.WMMTCLAS[i] );
1603 }
1604 }
1605
1606 if ( pAddTS->tclasProcPresent )
1607 {
1608 if ( pAddTS->wsmTspecPresent )
1609 {
1610 AddTSRsp.WMMTCLASPROC.version = 1;
1611 AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc;
1612 AddTSRsp.WMMTCLASPROC.present = 1;
1613 }
1614 else
1615 {
1616 AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc;
1617 AddTSRsp.TCLASSPROC.present = 1;
1618 }
1619 }
1620
1621 // schedule element is included only if requested in the tspec and we are
1622 // using hcca (or both edca and hcca)
1623 // 11e-D8.0 is inconsistent on whether the schedule element is included
1624 // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but
1625 // pg 46, line 17-18 says something else. So just include it and let the
1626 // sta figure it out
1627 if ((pSchedule != NULL) &&
1628 ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
1629 (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)))
1630 {
1631 if ( pAddTS->wsmTspecPresent )
1632 {
1633 PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule );
1634 }
1635 else
1636 {
1637 PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule );
1638 }
1639 }
1640
1641 nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload );
1642 if ( DOT11F_FAILED( nStatus ) )
1643 {
1644 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001645 "ze for an Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 nStatus );
1647 // We'll fall back on the worst case scenario:
1648 nPayload = sizeof( tDot11fAddTSResponse );
1649 }
1650 else if ( DOT11F_WARNED( nStatus ) )
1651 {
1652 limLog( pMac, LOGW, FL("There were warnings while calcula"
1653 "tingthe packed size for an Add TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001654 " Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 }
1656 }
1657 else
1658 {
1659 palZeroMemory( pMac->hHdd, ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ) );
1660
1661 WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME;
1662 WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1663 WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken;
1664 WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode;
1665
1666 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC );
1667
1668 nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload );
1669 if ( DOT11F_FAILED( nStatus ) )
1670 {
1671 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001672 "ze for a WMM Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 nStatus );
1674 // We'll fall back on the worst case scenario:
1675 nPayload = sizeof( tDot11fWMMAddTSResponse );
1676 }
1677 else if ( DOT11F_WARNED( nStatus ) )
1678 {
1679 limLog( pMac, LOGW, FL("There were warnings while calcula"
1680 "tingthe packed size for a WMM Add"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001681 "TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 }
1683 }
1684
1685 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1686
1687 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
1688 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1689 {
1690 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001691 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 return;
1693 }
1694
1695 // Paranoia:
1696 palZeroMemory( pMac->hHdd, pFrame, nBytes );
1697
1698 // Next, we fill out the buffer descriptor:
1699 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1700 SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr);
1701 if ( eSIR_SUCCESS != nSirStatus )
1702 {
1703 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001704 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 nSirStatus );
1706 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1707 return; // allocated!
1708 }
1709
1710 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1711
1712
1713 #if 0
1714 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1715 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1716 {
1717 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001718 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1720 return; // allocated!
1721 }
1722 #endif //TO SUPPORT BT-AMP
1723 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1724
Chet Lanctot186b5732013-03-18 10:26:30 -07001725#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001726 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001727#endif
1728
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 // That done, pack the struct:
1730 if ( ! pAddTS->wmeTspecPresent )
1731 {
1732 nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp,
1733 pFrame + sizeof( tSirMacMgmtHdr ),
1734 nPayload, &nPayload );
1735 if ( DOT11F_FAILED( nStatus ) )
1736 {
1737 limLog( pMac, LOGE, FL("Failed to pack an Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001738 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001739 nStatus );
1740 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1741 return;
1742 }
1743 else if ( DOT11F_WARNED( nStatus ) )
1744 {
1745 limLog( pMac, LOGW, FL("There were warnings while packing"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001746 "an Add TS Response (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 }
1748 }
1749 else
1750 {
1751 nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp,
1752 pFrame + sizeof( tSirMacMgmtHdr ),
1753 nPayload, &nPayload );
1754 if ( DOT11F_FAILED( nStatus ) )
1755 {
1756 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001757 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 nStatus );
1759 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1760 return;
1761 }
1762 else if ( DOT11F_WARNED( nStatus ) )
1763 {
1764 limLog( pMac, LOGW, FL("There were warnings while packing"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001765 "a WMM Add TS Response (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 }
1767 }
1768
1769 PELOG1(limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "),
1770 nStatusCode );
1771 limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
1772
1773 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001774 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1775 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 )
1777 {
1778 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1779 }
1780
1781 // Queue the frame in high priority WQ:
1782 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1783 HAL_TXRX_FRM_802_11_MGMT,
1784 ANI_TXDIR_TODS,
1785 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1786 limTxComplete, pFrame, txFlag );
1787 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1788 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001789 limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001790 nSirStatus );
1791 //Pkt will be freed up by the callback
1792 }
1793
1794} // End limSendAddtsRspActionFrame.
1795
1796void
1797limSendDeltsReqActionFrame(tpAniSirGlobal pMac,
1798 tSirMacAddr peer,
1799 tANI_U8 wmmTspecPresent,
1800 tSirMacTSInfo *pTsinfo,
1801 tSirMacTspecIE *pTspecIe,
1802 tpPESession psessionEntry)
1803{
1804 tANI_U8 *pFrame;
1805 tpSirMacMgmtHdr pMacHdr;
1806 tDot11fDelTS DelTS;
1807 tDot11fWMMDelTS WMMDelTS;
1808 tSirRetStatus nSirStatus;
1809 tANI_U32 nBytes, nPayload, nStatus;
1810 void *pPacket;
1811 eHalStatus halstatus;
1812 tANI_U8 txFlag = 0;
1813
1814 if(NULL == psessionEntry)
1815 {
1816 return;
1817 }
1818
1819 if ( ! wmmTspecPresent )
1820 {
1821 palZeroMemory( pMac->hHdd, ( tANI_U8* )&DelTS, sizeof( DelTS ) );
1822
1823 DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1824 DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
1825 PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo );
1826
1827 nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload );
1828 if ( DOT11F_FAILED( nStatus ) )
1829 {
1830 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001831 "ze for a Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 nStatus );
1833 // We'll fall back on the worst case scenario:
1834 nPayload = sizeof( tDot11fDelTS );
1835 }
1836 else if ( DOT11F_WARNED( nStatus ) )
1837 {
1838 limLog( pMac, LOGW, FL("There were warnings while calcula"
1839 "ting the packed size for a Del TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001840 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 }
1842 }
1843 else
1844 {
1845 palZeroMemory( pMac->hHdd, ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ) );
1846
1847 WMMDelTS.Category.category = SIR_MAC_ACTION_WME;
1848 WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
1849 WMMDelTS.DialogToken.token = 0;
1850 WMMDelTS.StatusCode.statusCode = 0;
1851 PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC );
1852 nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload );
1853 if ( DOT11F_FAILED( nStatus ) )
1854 {
1855 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001856 "ze for a WMM Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 nStatus );
1858 // We'll fall back on the worst case scenario:
1859 nPayload = sizeof( tDot11fDelTS );
1860 }
1861 else if ( DOT11F_WARNED( nStatus ) )
1862 {
1863 limLog( pMac, LOGW, FL("There were warnings while calcula"
1864 "ting the packed size for a WMM De"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001865 "l TS (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 }
1867 }
1868
1869 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1870
1871 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
1872 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1873 {
1874 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001875 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 return;
1877 }
1878
1879 // Paranoia:
1880 palZeroMemory( pMac->hHdd, pFrame, nBytes );
1881
1882 // Next, we fill out the buffer descriptor:
1883 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1884 SIR_MAC_MGMT_ACTION, peer,
1885 psessionEntry->selfMacAddr);
1886 if ( eSIR_SUCCESS != nSirStatus )
1887 {
1888 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001889 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 nSirStatus );
1891 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1892 return; // allocated!
1893 }
1894
1895 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1896
1897 #if 0
1898
1899 cfgLen = SIR_MAC_ADDR_LENGTH;
1900 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1901 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1902 {
1903 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001904 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1906 return; // allocated!
1907 }
1908 #endif //TO SUPPORT BT-AMP
1909 sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId);
1910
Chet Lanctot186b5732013-03-18 10:26:30 -07001911#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001912 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001913#endif
1914
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 // That done, pack the struct:
1916 if ( !wmmTspecPresent )
1917 {
1918 nStatus = dot11fPackDelTS( pMac, &DelTS,
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 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 {
1930 limLog( pMac, LOGW, FL("There were warnings while packing"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001931 "a Del TS frame (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 }
1933 }
1934 else
1935 {
1936 nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS,
1937 pFrame + sizeof( tSirMacMgmtHdr ),
1938 nPayload, &nPayload );
1939 if ( DOT11F_FAILED( nStatus ) )
1940 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001941 limLog( pMac, LOGE, FL("Failed to pack a WMM Del TS frame (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 nStatus );
1943 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1944 return; // allocated!
1945 }
1946 else if ( DOT11F_WARNED( nStatus ) )
1947 {
1948 limLog( pMac, LOGW, FL("There were warnings while packing"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001949 "a WMM Del TS frame (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001950 }
1951 }
1952
1953 PELOG1(limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes);
1954 limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
1955
1956 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1958 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 )
1960 {
1961 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1962 }
1963
1964 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1965 HAL_TXRX_FRM_802_11_MGMT,
1966 ANI_TXDIR_TODS,
1967 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1968 limTxComplete, pFrame, txFlag );
1969 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1970 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001971 limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 nSirStatus );
1973 //Pkt will be freed up by the callback
1974 }
1975
1976} // End limSendDeltsReqActionFrame.
1977
1978void
1979limSendAssocReqMgmtFrame(tpAniSirGlobal pMac,
1980 tLimMlmAssocReq *pMlmAssocReq,
1981 tpPESession psessionEntry)
1982{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001983 tDot11fAssocRequest *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 tANI_U16 caps;
1985 tANI_U8 *pFrame;
1986 tSirRetStatus nSirStatus;
1987 tLimMlmAssocCnf mlmAssocCnf;
1988 tANI_U32 nBytes, nPayload, nStatus;
1989 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
1990 void *pPacket;
1991 eHalStatus halstatus;
1992 tANI_U16 nAddIELen;
1993 tANI_U8 *pAddIE;
1994 tANI_U8 *wpsIe = NULL;
1995#if defined WLAN_FEATURE_VOWIFI
1996 tANI_U8 PowerCapsPopulated = FALSE;
1997#endif
1998 tANI_U8 txFlag = 0;
1999
2000 if(NULL == psessionEntry)
2001 {
2002 return;
2003 }
2004
2005 if(NULL == psessionEntry->pLimJoinReq)
2006 {
2007 return;
2008 }
2009
2010 /* check this early to avoid unncessary operation */
2011 if(NULL == psessionEntry->pLimJoinReq)
2012 {
2013 return;
2014 }
2015 nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length;
2016 pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata;
2017
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002018 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
2019 (void **)&pFrm, sizeof(tDot11fAssocRequest)))
2020 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002021 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limSendAssocReqMgmtFrame") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002022 return;
2023 }
2024
2025
2026 palZeroMemory( pMac->hHdd, ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002027
2028 caps = pMlmAssocReq->capabilityInfo;
2029 if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) )
2030 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2031#if defined(FEATURE_WLAN_WAPI)
2032 /* CR: 262463 :
2033 According to WAPI standard:
2034 7.3.1.4 Capability Information field
2035 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2036 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2037 Reassociation management frames. */
2038 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2039 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2040#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002041 swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities );
Jeff Johnson295189b2012-06-20 16:38:30 -07002042
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002043 pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval;
2044 PopulateDot11fSSID2( pMac, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002046 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002047
2048 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2049 SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps );
2050
2051 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2052 LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps );
2053
2054 // We prefer .11e asociations:
2055 if ( fQosEnabled ) fWmeEnabled = false;
2056
2057 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2058 LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps );
2059
2060 if ( psessionEntry->lim11hEnable &&
2061 psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE )
2062 {
2063#if defined WLAN_FEATURE_VOWIFI
2064 PowerCapsPopulated = TRUE;
2065
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002066 PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002067#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002068 PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002069
2070 }
2071
2072#if defined WLAN_FEATURE_VOWIFI
2073 if( pMac->rrm.rrmPEContext.rrmEnable &&
2074 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2075 {
2076 if (PowerCapsPopulated == FALSE)
2077 {
2078 PowerCapsPopulated = TRUE;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002079 PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 }
2081 }
2082#endif
2083
2084 if ( fQosEnabled &&
2085 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap)))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002086 PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002087
2088 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002089 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002090
2091#if defined WLAN_FEATURE_VOWIFI
2092 if( pMac->rrm.rrmPEContext.rrmEnable &&
2093 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2094 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002095 PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 }
2097#endif
2098 // The join request *should* contain zero or one of the WPA and RSN
2099 // IEs. The payload send along with the request is a
2100 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2101
2102 // typedef struct sSirRSNie
2103 // {
2104 // tANI_U16 length;
2105 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2106 // } tSirRSNie, *tpSirRSNie;
2107
2108 // So, we should be able to make the following two calls harmlessly,
2109 // since they do nothing if they don't find the given IE in the
2110 // bytestream with which they're provided.
2111
2112 // The net effect of this will be to faithfully transmit whatever
2113 // security IE is in the join request.
2114
2115 // *However*, if we're associating for the purpose of WPS
2116 // enrollment, and we've been configured to indicate that by
2117 // eliding the WPA or RSN IE, we just skip this:
2118 if( nAddIELen && pAddIE )
2119 {
2120 wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen);
2121 }
2122 if ( NULL == wpsIe )
2123 {
2124 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002125 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002127 &pFrm->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002128#if defined(FEATURE_WLAN_WAPI)
2129 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002130 &pFrm->WAPIOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002131#endif // defined(FEATURE_WLAN_WAPI)
2132 }
2133
2134 // include WME EDCA IE as well
2135 if ( fWmeEnabled )
2136 {
2137 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) )
2138 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002139 PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 }
2141
2142 if ( fWsmEnabled &&
2143 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap )))
2144 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002145 PopulateDot11fWMMCaps( &pFrm->WMMCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 }
2147 }
2148
2149 //Populate HT IEs, when operating in 11n or Taurus modes AND
2150 //when AP is also operating in 11n mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07002151 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 pMac->lim.htCapabilityPresentInBeacon)
2153 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002154 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002155#ifdef DISABLE_GF_FOR_INTEROP
2156
2157 /*
2158 * To resolve the interop problem with Broadcom AP,
2159 * where TQ STA could not pass traffic with GF enabled,
2160 * TQ STA will do Greenfield only with TQ AP, for
2161 * everybody else it will be turned off.
2162 */
2163
2164 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2165 {
2166 limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP, Turning off Greenfield"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002167 pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 }
2169#endif
2170
2171 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002172#ifdef WLAN_FEATURE_11AC
2173 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002174 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07002175 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002176 limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002177 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps );
2178 PopulateDot11fExtCap( pMac, &pFrm->ExtCap);
Jeff Johnsone7245742012-09-05 17:12:55 -07002179 }
2180#endif
2181
Jeff Johnson295189b2012-06-20 16:38:30 -07002182
2183#if defined WLAN_FEATURE_VOWIFI_11R
2184 if (psessionEntry->pLimJoinReq->is11Rconnection)
2185 {
2186#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002187 limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0],
2189 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1],
2190 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]);
2191#endif
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302192 PopulateMDIE( pMac, &pFrm->MobilityDomain,
2193 psessionEntry->pLimJoinReq->bssDescription.mdie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302195 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 {
2197 // No 11r IEs dont send any MDIE
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302198 limLog( pMac, LOG1, FL("MDIE not present"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 }
2200#endif
2201
2202#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302203 /* CCX Version IE will be included in association request
2204 when CCX is enabled on DUT through ini */
2205 if (psessionEntry->pLimJoinReq->isCCXFeatureIniEnabled)
2206 {
2207 PopulateDot11fCCXVersion(&pFrm->CCXVersion);
2208 }
2209 /* For CCX Associations fill the CCX IEs */
2210 if (psessionEntry->isCCXconnection &&
2211 psessionEntry->pLimJoinReq->isCCXFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002213#ifndef FEATURE_DISABLE_RM
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002214 PopulateDot11fCCXRadMgmtCap(&pFrm->CCXRadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002215#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 }
2217#endif
2218
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002219 nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 if ( DOT11F_FAILED( nStatus ) )
2221 {
2222 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002223 "or an Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 nStatus );
2225 // We'll fall back on the worst case scenario:
2226 nPayload = sizeof( tDot11fAssocRequest );
2227 }
2228 else if ( DOT11F_WARNED( nStatus ) )
2229 {
2230 limLog( pMac, LOGW, FL("There were warnings while calculating"
2231 "the packed size for an Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002232 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 }
2234
2235 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
2236
2237 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2238 ( tANI_U16 )nBytes, ( void** ) &pFrame,
2239 ( void** ) &pPacket );
2240 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2241 {
2242 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002243 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002244
2245 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002246 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002247
2248
2249 /* Update PE session id*/
2250 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2251
2252 mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2253
2254 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2255 ( void* ) pFrame, ( void* ) pPacket );
2256
2257 limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF,
2258 ( tANI_U32* ) &mlmAssocCnf);
2259
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002260 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 return;
2262 }
2263
2264 // Paranoia:
2265 palZeroMemory( pMac->hHdd, pFrame, nBytes );
2266
2267 // Next, we fill out the buffer descriptor:
2268 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2269 SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr);
2270 if ( eSIR_SUCCESS != nSirStatus )
2271 {
2272 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002273 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 nSirStatus );
2275 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002276 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 return;
2278 }
2279
2280
2281 // That done, pack the Probe Request:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002282 nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame +
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 sizeof(tSirMacMgmtHdr),
2284 nPayload, &nPayload );
2285 if ( DOT11F_FAILED( nStatus ) )
2286 {
2287 limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%0"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002288 "8x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 nStatus );
2290 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2291 ( void* ) pFrame, ( void* ) pPacket );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002292 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 return;
2294 }
2295 else if ( DOT11F_WARNED( nStatus ) )
2296 {
2297 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002298 "robe Response (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 }
2300
2301 PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002302 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 nBytes );)
2304 // limPrintMacAddr( pMac, bssid, LOG1 );
2305
2306 if( psessionEntry->assocReq != NULL )
2307 {
2308 palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
2309 psessionEntry->assocReq = NULL;
2310 }
2311
2312 if( nAddIELen )
2313 {
2314 palCopyMemory( pMac->hHdd, pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
2315 pAddIE,
2316 nAddIELen );
2317 nPayload += nAddIELen;
2318 }
2319
Jeff Johnson43971f52012-07-17 12:26:56 -07002320 if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocReq,
2321 nPayload)) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 {
2323 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
2324 }
2325 else
2326 {
2327 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
2328 palCopyMemory(pMac->hHdd, psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
2329 psessionEntry->assocReqLen = nPayload;
2330 }
2331
2332 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2334 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 )
2336 {
2337 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2338 }
2339
Ganesh K08bce952012-12-13 15:04:41 -08002340 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
2341 {
2342 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
2343 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08002344
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
2346 HAL_TXRX_FRM_802_11_MGMT,
2347 ANI_TXDIR_TODS,
2348 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2349 limTxComplete, pFrame, txFlag );
2350 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2351 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002352 limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 halstatus );
2354 //Pkt will be freed up by the callback
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002355 palFreeMemory(pMac->hHdd, pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002356 return;
2357 }
2358
2359 // Free up buffer allocated for mlmAssocReq
2360 palFreeMemory( pMac->hHdd, ( tANI_U8* ) pMlmAssocReq );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002361 palFreeMemory(pMac->hHdd, pFrm);
2362 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002363} // End limSendAssocReqMgmtFrame
2364
2365
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002366#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002367/*------------------------------------------------------------------------------------
2368 *
2369 * Send Reassoc Req with FTIEs.
2370 *
2371 *-----------------------------------------------------------------------------------
2372 */
2373void
2374limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac,
2375 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
2376{
2377 static tDot11fReAssocRequest frm;
2378 tANI_U16 caps;
2379 tANI_U8 *pFrame;
2380 tSirRetStatus nSirStatus;
2381 tANI_U32 nBytes, nPayload, nStatus;
2382 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2383 void *pPacket;
2384 eHalStatus halstatus;
2385#if defined WLAN_FEATURE_VOWIFI
2386 tANI_U8 PowerCapsPopulated = FALSE;
2387#endif
2388 tANI_U16 ft_ies_length = 0;
2389 tANI_U8 *pBody;
2390 tANI_U16 nAddIELen;
2391 tANI_U8 *pAddIE;
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002392#if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 tANI_U8 *wpsIe = NULL;
2394#endif
2395 tANI_U8 txFlag = 0;
2396
2397 if (NULL == psessionEntry)
2398 {
2399 return;
2400 }
2401
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 /* check this early to avoid unncessary operation */
2403 if(NULL == psessionEntry->pLimReAssocReq)
2404 {
2405 return;
2406 }
2407 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
2408 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002409 limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in "
2410 "state (%d)."), psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002411
2412 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
2413
2414 caps = pMlmReassocReq->capabilityInfo;
2415 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
2416 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2417#if defined(FEATURE_WLAN_WAPI)
2418 /* CR: 262463 :
2419 According to WAPI standard:
2420 7.3.1.4 Capability Information field
2421 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2422 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2423 Reassociation management frames. */
2424 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2425 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2426#endif
2427 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
2428
2429 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
2430
2431 // Get the old bssid of the older AP.
2432 palCopyMemory( pMac->hHdd, ( tANI_U8* )frm.CurrentAPAddress.mac,
2433 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6);
2434
2435 PopulateDot11fSSID2( pMac, &frm.SSID );
2436 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2437 &frm.SuppRates,psessionEntry);
2438
2439 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2440 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
2441
2442 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2443 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
2444
2445 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2446 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
2447
2448 if ( psessionEntry->lim11hEnable &&
2449 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
2450 {
2451#if defined WLAN_FEATURE_VOWIFI
2452 PowerCapsPopulated = TRUE;
2453
2454 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
2455 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
2456#endif
2457 }
2458
2459#if defined WLAN_FEATURE_VOWIFI
2460 if( pMac->rrm.rrmPEContext.rrmEnable &&
2461 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2462 {
2463 if (PowerCapsPopulated == FALSE)
2464 {
2465 PowerCapsPopulated = TRUE;
2466 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
2467 }
2468 }
2469#endif
2470
2471 if ( fQosEnabled &&
2472 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
2473 {
2474 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
2475 }
2476
2477 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2478 &frm.ExtSuppRates, psessionEntry );
2479
2480#if defined WLAN_FEATURE_VOWIFI
2481 if( pMac->rrm.rrmPEContext.rrmEnable &&
2482 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
2483 {
2484 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
2485 }
2486#endif
2487
2488 // Ideally this should be enabled for 11r also. But 11r does
2489 // not follow the usual norm of using the Opaque object
2490 // for rsnie and fties. Instead we just add
2491 // the rsnie and fties at the end of the pack routine for 11r.
2492 // This should ideally! be fixed.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002493#if defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 //
2495 // The join request *should* contain zero or one of the WPA and RSN
2496 // IEs. The payload send along with the request is a
2497 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2498
2499 // typedef struct sSirRSNie
2500 // {
2501 // tANI_U16 length;
2502 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2503 // } tSirRSNie, *tpSirRSNie;
2504
2505 // So, we should be able to make the following two calls harmlessly,
2506 // since they do nothing if they don't find the given IE in the
2507 // bytestream with which they're provided.
2508
2509 // The net effect of this will be to faithfully transmit whatever
2510 // security IE is in the join request.
2511
2512 // *However*, if we're associating for the purpose of WPS
2513 // enrollment, and we've been configured to indicate that by
2514 // eliding the WPA or RSN IE, we just skip this:
2515 if (!psessionEntry->is11Rconnection)
2516 {
2517 if( nAddIELen && pAddIE )
2518 {
2519 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
2520 }
2521 if ( NULL == wpsIe )
2522 {
2523 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2524 &frm.RSNOpaque );
2525 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2526 &frm.WPAOpaque );
2527 }
2528
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002529#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302530 if (psessionEntry->pLimReAssocReq->cckmIE.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002531 {
2532 PopulateDot11fCCXCckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ),
2533 &frm.CCXCckmOpaque );
2534 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002535#endif //FEATURE_WLAN_CCX
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 }
2537
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002538#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302539 /* CCX Version IE will be included in reassociation request
2540 when CCX is enabled on DUT through ini */
2541 if (psessionEntry->pLimReAssocReq->isCCXFeatureIniEnabled)
2542 {
2543 PopulateDot11fCCXVersion(&frm.CCXVersion);
2544 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 // For CCX Associations fill the CCX IEs
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302546 if (psessionEntry->isCCXconnection &&
2547 psessionEntry->pLimReAssocReq->isCCXFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002549#ifndef FEATURE_DISABLE_RM
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 PopulateDot11fCCXRadMgmtCap(&frm.CCXRadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002551#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302553#endif //FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002554#endif //FEATURE_WLAN_CCX || FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -07002555
2556 // include WME EDCA IE as well
2557 if ( fWmeEnabled )
2558 {
2559 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
2560 {
2561 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
2562 }
2563
2564 if ( fWsmEnabled &&
2565 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
2566 {
2567 PopulateDot11fWMMCaps( &frm.WMMCaps );
2568 }
2569#ifdef FEATURE_WLAN_CCX
2570 if (psessionEntry->isCCXconnection)
2571 {
2572 PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry);
2573
2574 // Populate the TSRS IE if TSPEC is included in the reassoc request
2575 if (psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs)
2576 {
2577 tANI_U32 phyMode;
2578 tSirMacCCXTSRSIE tsrsIE;
2579 limGetPhyMode(pMac, &phyMode, psessionEntry);
2580
2581 tsrsIE.tsid = 0;
2582 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
2583 {
2584 tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
2585 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302586 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 {
2588 tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
2589 }
2590 PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.CCXTrafStrmRateSet, sizeof(tANI_U8));
2591 }
2592 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302593#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 }
2595
Jeff Johnsone7245742012-09-05 17:12:55 -07002596 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 pMac->lim.htCapabilityPresentInBeacon)
2598 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002599 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002600 }
2601
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002602#if defined WLAN_FEATURE_VOWIFI_11R
Gopichand Nakkala0ac55062013-04-08 14:43:07 +05302603 if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent && (0 == pMac->ft.ftSmeContext.reassoc_ft_ies_length)
2604#if defined FEATURE_WLAN_CCX
2605 && !psessionEntry->isCCXconnection
2606#endif
2607 )
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002608 {
2609 PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie);
2610 }
2611#endif
2612
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
2614 if ( DOT11F_FAILED( nStatus ) )
2615 {
2616 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002617 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 nStatus );
2619 // We'll fall back on the worst case scenario:
2620 nPayload = sizeof( tDot11fReAssocRequest );
2621 }
2622 else if ( DOT11F_WARNED( nStatus ) )
2623 {
2624 limLog( pMac, LOGW, FL("There were warnings while calculating"
2625 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002626 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 }
2628
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07002629 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002630
2631#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002632 limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002633 pMac->ft.ftSmeContext.reassoc_ft_ies_length);
2634#endif
2635
2636#if defined WLAN_FEATURE_VOWIFI_11R
2637 if (psessionEntry->is11Rconnection)
2638 {
2639 ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length;
2640 }
2641#endif
2642
2643 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2644 ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame,
2645 ( void** ) &pPacket );
2646 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2647 {
2648 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002649 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002651 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002652 goto end;
2653 }
2654
2655 // Paranoia:
2656 palZeroMemory( pMac->hHdd, pFrame, nBytes + ft_ies_length);
2657
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002658#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002659 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002660#endif
2661 // Next, we fill out the buffer descriptor:
2662 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2663 SIR_MAC_MGMT_REASSOC_REQ,
2664 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
2665 if ( eSIR_SUCCESS != nSirStatus )
2666 {
2667 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002668 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 nSirStatus );
2670 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2671 goto end;
2672 }
2673
2674
2675 // That done, pack the ReAssoc Request:
2676 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
2677 sizeof(tSirMacMgmtHdr),
2678 nPayload, &nPayload );
2679 if ( DOT11F_FAILED( nStatus ) )
2680 {
2681 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002682 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 nStatus );
2684 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2685 goto end;
2686 }
2687 else if ( DOT11F_WARNED( nStatus ) )
2688 {
2689 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002690 "e-Association Request (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 }
2692
2693 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002694 FL("*** Sending Re-Association Request length %d %d to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 nBytes, nPayload );)
2696 if( psessionEntry->assocReq != NULL )
2697 {
2698 palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
2699 psessionEntry->assocReq = NULL;
2700 }
2701
2702 if( nAddIELen )
2703 {
2704 palCopyMemory( pMac->hHdd, pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
2705 pAddIE,
2706 nAddIELen );
2707 nPayload += nAddIELen;
2708 }
2709
Jeff Johnson43971f52012-07-17 12:26:56 -07002710 if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocReq,
2711 nPayload)) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 {
2713 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07002714 }
2715 else
2716 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
2718 palCopyMemory(pMac->hHdd, psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
2719 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07002720 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002721
2722 if (psessionEntry->is11Rconnection)
2723 {
2724 {
2725 int i = 0;
2726
2727 pBody = pFrame + nBytes;
2728 for (i=0; i<ft_ies_length; i++)
2729 {
2730 *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i];
2731 pBody++;
2732 }
2733 }
2734 }
2735
2736#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002737 PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: "));
2738 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002739 (tANI_U8 *)pFrame,
2740 (nBytes + ft_ies_length));)
2741#endif
2742
2743
2744 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2746 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002747 )
2748 {
2749 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2750 }
2751
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002752 if( NULL != psessionEntry->assocReq )
2753 {
2754 palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
2755 psessionEntry->assocReq = NULL;
2756 }
2757
2758 if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocReq,
2759 (ft_ies_length))) != eHAL_STATUS_SUCCESS )
2760 {
2761 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002762 psessionEntry->assocReqLen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07002763 }
2764 else
2765 {
2766 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
2767 palCopyMemory(pMac->hHdd, psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies,
2768 (ft_ies_length));
2769 psessionEntry->assocReqLen = (ft_ies_length);
2770 }
2771
2772
Jeff Johnson295189b2012-06-20 16:38:30 -07002773 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length),
2774 HAL_TXRX_FRM_802_11_MGMT,
2775 ANI_TXDIR_TODS,
2776 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2777 limTxComplete, pFrame, txFlag );
2778 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2779 {
2780 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002781 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 nSirStatus );
2783 //Pkt will be freed up by the callback
2784 goto end;
2785 }
2786
2787end:
2788 // Free up buffer allocated for mlmAssocReq
2789 palFreeMemory( pMac->hHdd, ( tANI_U8* ) pMlmReassocReq );
2790 psessionEntry->pLimMlmReassocReq = NULL;
2791
2792}
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002793
2794void limSendRetryReassocReqFrame(tpAniSirGlobal pMac,
2795 tLimMlmReassocReq *pMlmReassocReq,
2796 tpPESession psessionEntry)
2797{
2798 tLimMlmReassocCnf mlmReassocCnf; // keep sme
2799 tLimMlmReassocReq *pTmpMlmReassocReq = NULL;
2800 if(NULL == pTmpMlmReassocReq)
2801 {
2802 if ( !HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pTmpMlmReassocReq, sizeof(tLimMlmReassocReq))) ) goto end;
2803 palZeroMemory(pMac->hHdd, pTmpMlmReassocReq, sizeof(tLimMlmReassocReq));
2804 palCopyMemory( pMac->hHdd, pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq));
2805 }
2806
2807 // Prepare and send Reassociation request frame
2808 // start reassoc timer.
2809 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2810 // Start reassociation failure timer
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002811 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002812 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2813 != TX_SUCCESS)
2814 {
2815 // Could not start reassoc failure timer.
2816 // Log error
2817 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002818 FL("could not start Reassociation failure timer"));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002819 // Return Reassoc confirm with
2820 // Resources Unavailable
2821 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2822 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2823 goto end;
2824 }
2825
2826 limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry);
2827 return;
2828
2829end:
2830 // Free up buffer allocated for reassocReq
2831 if (pMlmReassocReq != NULL)
2832 {
2833 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
2834 pMlmReassocReq = NULL;
2835 }
2836 if (pTmpMlmReassocReq != NULL)
2837 {
2838 palFreeMemory( pMac->hHdd, (tANI_U8 *) pTmpMlmReassocReq);
2839 pTmpMlmReassocReq = NULL;
2840 }
2841 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2842 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2843 /* Update PE sessio Id*/
2844 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
2845
2846 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2847}
2848
Jeff Johnson295189b2012-06-20 16:38:30 -07002849#endif /* WLAN_FEATURE_VOWIFI_11R */
2850
2851
2852void
2853limSendReassocReqMgmtFrame(tpAniSirGlobal pMac,
2854 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
2855{
2856 static tDot11fReAssocRequest frm;
2857 tANI_U16 caps;
2858 tANI_U8 *pFrame;
2859 tSirRetStatus nSirStatus;
2860 tANI_U32 nBytes, nPayload, nStatus;
2861 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2862 void *pPacket;
2863 eHalStatus halstatus;
2864 tANI_U16 nAddIELen;
2865 tANI_U8 *pAddIE;
2866 tANI_U8 *wpsIe = NULL;
2867 tANI_U8 txFlag = 0;
2868#if defined WLAN_FEATURE_VOWIFI
2869 tANI_U8 PowerCapsPopulated = FALSE;
2870#endif
2871
2872 if(NULL == psessionEntry)
2873 {
2874 return;
2875 }
2876
2877 /* check this early to avoid unncessary operation */
2878 if(NULL == psessionEntry->pLimReAssocReq)
2879 {
2880 return;
2881 }
2882 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
2883 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
2884
2885 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
2886
2887 caps = pMlmReassocReq->capabilityInfo;
2888 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
2889 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2890#if defined(FEATURE_WLAN_WAPI)
2891 /* CR: 262463 :
2892 According to WAPI standard:
2893 7.3.1.4 Capability Information field
2894 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2895 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2896 Reassociation management frames. */
2897 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2898 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2899#endif
2900 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
2901
2902 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
2903
2904 palCopyMemory( pMac->hHdd, ( tANI_U8* )frm.CurrentAPAddress.mac,
2905 ( tANI_U8* )psessionEntry->bssId, 6 );
2906
2907 PopulateDot11fSSID2( pMac, &frm.SSID );
2908 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2909 &frm.SuppRates,psessionEntry);
2910
2911 fQosEnabled = ( psessionEntry->limQosEnabled ) &&
2912 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
2913
2914 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2915 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
2916
2917 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2918 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
2919
2920
2921 if ( psessionEntry->lim11hEnable &&
2922 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
2923 {
2924#if defined WLAN_FEATURE_VOWIFI
2925 PowerCapsPopulated = TRUE;
2926 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
2927 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
2928#endif
2929 }
2930
2931#if defined WLAN_FEATURE_VOWIFI
2932 if( pMac->rrm.rrmPEContext.rrmEnable &&
2933 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2934 {
2935 if (PowerCapsPopulated == FALSE)
2936 {
2937 PowerCapsPopulated = TRUE;
2938 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
2939 }
2940 }
2941#endif
2942
2943 if ( fQosEnabled &&
2944 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
2945 {
2946 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
2947 }
2948
2949 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2950 &frm.ExtSuppRates, psessionEntry );
2951
2952#if defined WLAN_FEATURE_VOWIFI
2953 if( pMac->rrm.rrmPEContext.rrmEnable &&
2954 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
2955 {
2956 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
2957 }
2958#endif
2959 // The join request *should* contain zero or one of the WPA and RSN
2960 // IEs. The payload send along with the request is a
2961 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2962
2963 // typedef struct sSirRSNie
2964 // {
2965 // tANI_U16 length;
2966 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2967 // } tSirRSNie, *tpSirRSNie;
2968
2969 // So, we should be able to make the following two calls harmlessly,
2970 // since they do nothing if they don't find the given IE in the
2971 // bytestream with which they're provided.
2972
2973 // The net effect of this will be to faithfully transmit whatever
2974 // security IE is in the join request.
2975
2976 // *However*, if we're associating for the purpose of WPS
2977 // enrollment, and we've been configured to indicate that by
2978 // eliding the WPA or RSN IE, we just skip this:
2979 if( nAddIELen && pAddIE )
2980 {
2981 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
2982 }
2983 if ( NULL == wpsIe )
2984 {
2985 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2986 &frm.RSNOpaque );
2987 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2988 &frm.WPAOpaque );
2989#if defined(FEATURE_WLAN_WAPI)
2990 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2991 &frm.WAPIOpaque );
2992#endif // defined(FEATURE_WLAN_WAPI)
2993 }
2994
2995 // include WME EDCA IE as well
2996 if ( fWmeEnabled )
2997 {
2998 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
2999 {
3000 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
3001 }
3002
3003 if ( fWsmEnabled &&
3004 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
3005 {
3006 PopulateDot11fWMMCaps( &frm.WMMCaps );
3007 }
3008 }
3009
Jeff Johnsone7245742012-09-05 17:12:55 -07003010 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 pMac->lim.htCapabilityPresentInBeacon)
3012 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003013 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003015#ifdef WLAN_FEATURE_11AC
3016 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003017 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07003018 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003019 limLog( pMac, LOGW, FL("Populate VHT IEs in Re-Assoc Request"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003020 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003021 PopulateDot11fExtCap( pMac, &frm.ExtCap);
Jeff Johnsone7245742012-09-05 17:12:55 -07003022 }
3023#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003024
3025 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
3026 if ( DOT11F_FAILED( nStatus ) )
3027 {
3028 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003029 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 nStatus );
3031 // We'll fall back on the worst case scenario:
3032 nPayload = sizeof( tDot11fReAssocRequest );
3033 }
3034 else if ( DOT11F_WARNED( nStatus ) )
3035 {
3036 limLog( pMac, LOGW, FL("There were warnings while calculating"
3037 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003038 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 }
3040
3041 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
3042
3043 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3044 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3045 ( void** ) &pPacket );
3046 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3047 {
3048 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003049 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003051 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003052 goto end;
3053 }
3054
3055 // Paranoia:
3056 palZeroMemory( pMac->hHdd, pFrame, nBytes );
3057
3058 // Next, we fill out the buffer descriptor:
3059 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3060 SIR_MAC_MGMT_REASSOC_REQ,
3061 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
3062 if ( eSIR_SUCCESS != nSirStatus )
3063 {
3064 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003065 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 nSirStatus );
3067 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3068 goto end;
3069 }
3070
3071
3072 // That done, pack the Probe Request:
3073 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
3074 sizeof(tSirMacMgmtHdr),
3075 nPayload, &nPayload );
3076 if ( DOT11F_FAILED( nStatus ) )
3077 {
3078 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003079 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003080 nStatus );
3081 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3082 goto end;
3083 }
3084 else if ( DOT11F_WARNED( nStatus ) )
3085 {
3086 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003087 "e-Association Request (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003088 }
3089
3090 PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003091 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 nBytes );)
3093
3094 if( psessionEntry->assocReq != NULL )
3095 {
3096 palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
3097 psessionEntry->assocReq = NULL;
3098 }
3099
3100 if( nAddIELen )
3101 {
3102 palCopyMemory( pMac->hHdd, pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
3103 pAddIE,
3104 nAddIELen );
3105 nPayload += nAddIELen;
3106 }
3107
Jeff Johnson43971f52012-07-17 12:26:56 -07003108 if( (palAllocateMemory(pMac->hHdd, (void**)&psessionEntry->assocReq,
3109 nPayload)) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07003110 {
3111 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07003112 }
3113 else
3114 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003115 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
3116 palCopyMemory(pMac->hHdd, psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
3117 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07003118 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003119
3120 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3122 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003123 )
3124 {
3125 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3126 }
3127
Gopichand Nakkalad3918dd2012-12-31 16:27:55 -08003128 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08003129 {
3130 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3131 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003132
Jeff Johnson295189b2012-06-20 16:38:30 -07003133 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
3134 HAL_TXRX_FRM_802_11_MGMT,
3135 ANI_TXDIR_TODS,
3136 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3137 limTxComplete, pFrame, txFlag );
3138 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3139 {
3140 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003141 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003142 nSirStatus );
3143 //Pkt will be freed up by the callback
3144 goto end;
3145 }
3146
3147end:
3148 // Free up buffer allocated for mlmAssocReq
3149 palFreeMemory( pMac->hHdd, ( tANI_U8* ) pMlmReassocReq );
3150 psessionEntry->pLimMlmReassocReq = NULL;
3151
3152} // limSendReassocReqMgmtFrame
3153
3154/**
3155 * \brief Send an Authentication frame
3156 *
3157 *
3158 * \param pMac Pointer to Global MAC structure
3159 *
3160 * \param pAuthFrameBody Pointer to Authentication frame structure that need
3161 * to be sent
3162 *
3163 * \param peerMacAddr MAC address of the peer entity to which Authentication
3164 * frame is destined
3165 *
3166 * \param wepBit Indicates whether wep bit to be set in FC while sending
3167 * Authentication frame3
3168 *
3169 *
3170 * This function is called by limProcessMlmMessages(). Authentication frame
3171 * is formatted and sent when this function is called.
3172 *
3173 *
3174 */
3175
3176void
3177limSendAuthMgmtFrame(tpAniSirGlobal pMac,
3178 tpSirMacAuthFrameBody pAuthFrameBody,
3179 tSirMacAddr peerMacAddr,
3180 tANI_U8 wepBit,
3181 tpPESession psessionEntry
3182 )
3183{
3184 tANI_U8 *pFrame, *pBody;
3185 tANI_U32 frameLen = 0, bodyLen = 0;
3186 tpSirMacMgmtHdr pMacHdr;
3187 tANI_U16 i;
3188 void *pPacket;
3189 eHalStatus halstatus;
3190 tANI_U8 txFlag = 0;
3191
3192 if(NULL == psessionEntry)
3193 {
3194 return;
3195 }
3196
3197 if (wepBit == LIM_WEP_IN_FC)
3198 {
3199 /// Auth frame3 to be sent with encrypted framebody
3200 /**
3201 * Allocate buffer for Authenticaton frame of size equal
3202 * to management frame header length plus 2 bytes each for
3203 * auth algorithm number, transaction number, status code,
3204 * 128 bytes for challenge text and 4 bytes each for
3205 * IV & ICV.
3206 */
3207
3208 frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN;
3209
3210 bodyLen = LIM_ENCR_AUTH_BODY_LEN;
3211 } // if (wepBit == LIM_WEP_IN_FC)
3212 else
3213 {
3214 switch (pAuthFrameBody->authTransactionSeqNumber)
3215 {
3216 case SIR_MAC_AUTH_FRAME_1:
3217 /**
3218 * Allocate buffer for Authenticaton frame of size
3219 * equal to management frame header length plus 2 bytes
3220 * each for auth algorithm number, transaction number
3221 * and status code.
3222 */
3223
3224 frameLen = sizeof(tSirMacMgmtHdr) +
3225 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3226 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3227
3228#if defined WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003229 if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH)
3230 {
3231 if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003233 frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003234 limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"),
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003235 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003236 }
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003237 else
3238 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003239 limLog(pMac, LOG3, FL("Auth frame, Does not contain FTIES!!!"));
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003240 frameLen += (2+SIR_MDIE_SIZE);
3241 }
3242 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003243#endif
3244 break;
3245
3246 case SIR_MAC_AUTH_FRAME_2:
3247 if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) ||
3248 ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) &&
3249 (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS)))
3250 {
3251 /**
3252 * Allocate buffer for Authenticaton frame of size
3253 * equal to management frame header length plus
3254 * 2 bytes each for auth algorithm number,
3255 * transaction number and status code.
3256 */
3257
3258 frameLen = sizeof(tSirMacMgmtHdr) +
3259 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3260 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3261 }
3262 else
3263 {
3264 // Shared Key algorithm with challenge text
3265 // to be sent
3266 /**
3267 * Allocate buffer for Authenticaton frame of size
3268 * equal to management frame header length plus
3269 * 2 bytes each for auth algorithm number,
3270 * transaction number, status code and 128 bytes
3271 * for challenge text.
3272 */
3273
3274 frameLen = sizeof(tSirMacMgmtHdr) +
3275 sizeof(tSirMacAuthFrame);
3276 bodyLen = sizeof(tSirMacAuthFrameBody);
3277 }
3278
3279 break;
3280
3281 case SIR_MAC_AUTH_FRAME_3:
3282 /// Auth frame3 to be sent without encrypted framebody
3283 /**
3284 * Allocate buffer for Authenticaton frame of size equal
3285 * to management frame header length plus 2 bytes each
3286 * for auth algorithm number, transaction number and
3287 * status code.
3288 */
3289
3290 frameLen = sizeof(tSirMacMgmtHdr) +
3291 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3292 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3293
3294 break;
3295
3296 case SIR_MAC_AUTH_FRAME_4:
3297 /**
3298 * Allocate buffer for Authenticaton frame of size equal
3299 * to management frame header length plus 2 bytes each
3300 * for auth algorithm number, transaction number and
3301 * status code.
3302 */
3303
3304 frameLen = sizeof(tSirMacMgmtHdr) +
3305 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3306 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3307
3308 break;
3309 } // switch (pAuthFrameBody->authTransactionSeqNumber)
3310 } // end if (wepBit == LIM_WEP_IN_FC)
3311
3312
3313 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket );
3314
3315 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3316 {
3317 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003318 limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003319
3320 return;
3321 }
3322
3323 for (i = 0; i < frameLen; i++)
3324 pFrame[i] = 0;
3325
3326 // Prepare BD
3327 if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME,
3328 SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS)
3329 {
3330 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3331 return;
3332 }
3333
3334 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
3335 pMacHdr->fc.wep = wepBit;
3336
3337 // Prepare BSSId
3338 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
3339 {
3340 palCopyMemory( pMac->hHdd,(tANI_U8 *) pMacHdr->bssId,
3341 (tANI_U8 *) psessionEntry->bssId,
3342 sizeof( tSirMacAddr ));
3343 }
3344
3345 /// Prepare Authentication frame body
3346 pBody = pFrame + sizeof(tSirMacMgmtHdr);
3347
3348 if (wepBit == LIM_WEP_IN_FC)
3349 {
3350 palCopyMemory( pMac->hHdd, pBody, (tANI_U8 *) pAuthFrameBody, bodyLen);
3351
3352 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003353 FL("*** Sending Auth seq# 3 status %d (%d) to"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 pAuthFrameBody->authStatusCode,
3355 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS));
3356
3357 limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
3358 }
3359 else
3360 {
3361 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber);
3362 pBody += sizeof(tANI_U16);
3363 bodyLen -= sizeof(tANI_U16);
3364
3365 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber);
3366 pBody += sizeof(tANI_U16);
3367 bodyLen -= sizeof(tANI_U16);
3368
3369 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode);
3370 pBody += sizeof(tANI_U16);
3371 bodyLen -= sizeof(tANI_U16);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003372 if ( bodyLen < sizeof (pAuthFrameBody->type) + sizeof (pAuthFrameBody->length) + sizeof (pAuthFrameBody->challengeText))
3373 palCopyMemory( pMac->hHdd, pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07003374
3375#if defined WLAN_FEATURE_VOWIFI_11R
3376 if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) &&
3377 (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1))
3378 {
3379
3380 {
3381 int i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003382 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
3383 {
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003384#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 PELOGE(limLog(pMac, LOGE, FL("Auth1 Frame FTIE is: "));
3386 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOGE,
3387 (tANI_U8 *)pBody,
3388 (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003389#endif
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003390 for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++)
3391 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003392 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i];
3393 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003394 }
3395 }
3396 else
3397 {
3398 /* MDID attr is 54*/
3399 *pBody = 54;
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003401 *pBody = SIR_MDIE_SIZE;
3402 pBody++;
3403 for(i=0;i<SIR_MDIE_SIZE;i++)
3404 {
3405 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i];
3406 pBody++;
3407 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 }
3409 }
3410 }
3411#endif
3412
3413 PELOG1(limLog(pMac, LOG1,
3414 FL("*** Sending Auth seq# %d status %d (%d) to "),
3415 pAuthFrameBody->authTransactionSeqNumber,
3416 pAuthFrameBody->authStatusCode,
3417 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS));
3418
3419 limPrintMacAddr(pMac, pMacHdr->da, LOG1);)
3420 }
3421 PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);)
3422
3423 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003424 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3425 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnsone7245742012-09-05 17:12:55 -07003426#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303427 || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq)
Jeff Johnsone7245742012-09-05 17:12:55 -07003428 && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)))
3429#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 )
3431 {
3432 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3433 }
3434
Ganesh K08bce952012-12-13 15:04:41 -08003435 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE)
3436 {
3437 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3438 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003439
Jeff Johnson295189b2012-06-20 16:38:30 -07003440 /// Queue Authentication frame in high priority WQ
3441 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen,
3442 HAL_TXRX_FRM_802_11_MGMT,
3443 ANI_TXDIR_TODS,
3444 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3445 limTxComplete, pFrame, txFlag );
3446 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3447 {
3448 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003449 FL("*** Could not send Auth frame, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 halstatus);
3451
3452 //Pkt will be freed up by the callback
3453 }
3454
3455 return;
3456} /*** end limSendAuthMgmtFrame() ***/
3457
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003458eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac)
3459{
3460 tANI_U16 aid;
3461 tpDphHashNode pStaDs;
3462 tLimMlmDeauthReq *pMlmDeauthReq;
3463 tLimMlmDeauthCnf mlmDeauthCnf;
3464 tpPESession psessionEntry;
3465
3466 pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq;
3467 if (pMlmDeauthReq)
3468 {
3469 if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer))
3470 {
3471 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
3472 }
3473
3474 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL)
3475 {
3476
3477 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003478 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003479 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3480 goto end;
3481 }
3482
3483 pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
3484 if (pStaDs == NULL)
3485 {
3486 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3487 goto end;
3488 }
3489
3490
3491 /// Receive path cleanup with dummy packet
3492 limCleanupRxPath(pMac, pStaDs,psessionEntry);
3493 /// Free up buffer allocated for mlmDeauthReq
3494 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
3495 pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL;
3496 }
3497 return eHAL_STATUS_SUCCESS;
3498end:
3499 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
3500 (tANI_U8 *) pMlmDeauthReq->peerMacAddr,
3501 sizeof(tSirMacAddr));
3502 mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger;
3503 mlmDeauthCnf.aid = pMlmDeauthReq->aid;
3504 mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId;
3505
3506 // Free up buffer allocated
3507 // for mlmDeauthReq
3508 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
3509
3510 limPostSmeMessage(pMac,
3511 LIM_MLM_DEAUTH_CNF,
3512 (tANI_U32 *) &mlmDeauthCnf);
3513 return eHAL_STATUS_SUCCESS;
3514}
3515
3516eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac)
3517{
3518 tANI_U16 aid;
3519 tpDphHashNode pStaDs;
3520 tLimMlmDisassocCnf mlmDisassocCnf;
3521 tpPESession psessionEntry;
3522 tLimMlmDisassocReq *pMlmDisassocReq;
3523
3524 pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq;
3525 if (pMlmDisassocReq)
3526 {
3527 if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer))
3528 {
3529 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
3530 }
3531
3532 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL)
3533 {
3534
3535 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003536 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003537 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3538 goto end;
3539 }
3540
3541 pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
3542 if (pStaDs == NULL)
3543 {
3544 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3545 goto end;
3546 }
3547
3548 /// Receive path cleanup with dummy packet
3549 if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry))
3550 {
3551 mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3552 goto end;
3553 }
3554
3555#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003556 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) &&
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303557 (
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003558#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303559 (psessionEntry->isCCXconnection ) ||
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003560#endif
3561#ifdef FEATURE_WLAN_LFR
3562 (psessionEntry->isFastRoamIniFeatureEnabled ) ||
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003563#endif
3564 (psessionEntry->is11Rconnection )) &&
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303565 (pMlmDisassocReq->reasonCode !=
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003566 eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003567 {
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303568 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003569 FL("FT Preauth Session (%p,%d) Cleanup"),
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003570 psessionEntry, psessionEntry->peSessionId););
3571 limFTCleanup(pMac);
3572 }
3573 else
3574 {
3575 PELOGE(limLog(pMac, LOGE,
3576 FL("No FT Preauth Session Cleanup in role %d"
3577#ifdef FEATURE_WLAN_CCX
3578 " isCCX %d"
3579#endif
3580#ifdef FEATURE_WLAN_LFR
3581 " isLFR %d"
3582#endif
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003583 " is11r %d reason %d"),
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003584 psessionEntry->limSystemRole,
3585#ifdef FEATURE_WLAN_CCX
3586 psessionEntry->isCCXconnection,
3587#endif
3588#ifdef FEATURE_WLAN_LFR
3589 psessionEntry->isFastRoamIniFeatureEnabled,
3590#endif
3591 psessionEntry->is11Rconnection,
3592 pMlmDisassocReq->reasonCode););
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003593 }
3594#endif
3595
3596 /// Free up buffer allocated for mlmDisassocReq
3597 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDisassocReq);
3598 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
3599 return eHAL_STATUS_SUCCESS;
3600 }
3601 else
3602 {
3603 return eHAL_STATUS_SUCCESS;
3604 }
3605end:
3606 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
3607 (tANI_U8 *) pMlmDisassocReq->peerMacAddr,
3608 sizeof(tSirMacAddr));
3609 mlmDisassocCnf.aid = pMlmDisassocReq->aid;
3610 mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger;
3611
3612 /* Update PE session ID*/
3613 mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId;
3614
Madan Mohan Koyyalamudib7f5a672012-11-29 11:17:46 -08003615 if(pMlmDisassocReq != NULL)
3616 {
3617 /// Free up buffer allocated for mlmDisassocReq
3618 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDisassocReq);
3619 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
3620 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003621
3622 limPostSmeMessage(pMac,
3623 LIM_MLM_DISASSOC_CNF,
3624 (tANI_U32 *) &mlmDisassocCnf);
3625 return eHAL_STATUS_SUCCESS;
3626}
3627
3628eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
3629{
3630 return limSendDisassocCnf(pMac);
3631}
3632
3633eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
3634{
3635 return limSendDeauthCnf(pMac);
3636}
3637
Jeff Johnson295189b2012-06-20 16:38:30 -07003638/**
3639 * \brief This function is called to send Disassociate frame.
3640 *
3641 *
3642 * \param pMac Pointer to Global MAC structure
3643 *
3644 * \param nReason Indicates the reason that need to be sent in
3645 * Disassociation frame
3646 *
3647 * \param peerMacAddr MAC address of the STA to which Disassociation frame is
3648 * sent
3649 *
3650 *
3651 */
3652
3653void
3654limSendDisassocMgmtFrame(tpAniSirGlobal pMac,
3655 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003656 tSirMacAddr peer,
3657 tpPESession psessionEntry,
3658 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003659{
3660 tDot11fDisassociation frm;
3661 tANI_U8 *pFrame;
3662 tSirRetStatus nSirStatus;
3663 tpSirMacMgmtHdr pMacHdr;
3664 tANI_U32 nBytes, nPayload, nStatus;
3665 void *pPacket;
3666 eHalStatus halstatus;
3667 tANI_U8 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003668 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 if(NULL == psessionEntry)
3670 {
3671 return;
3672 }
3673
3674 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
3675
3676 frm.Reason.code = nReason;
3677
3678 nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload );
3679 if ( DOT11F_FAILED( nStatus ) )
3680 {
3681 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003682 "or a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 nStatus );
3684 // We'll fall back on the worst case scenario:
3685 nPayload = sizeof( tDot11fDisassociation );
3686 }
3687 else if ( DOT11F_WARNED( nStatus ) )
3688 {
3689 limLog( pMac, LOGW, FL("There were warnings while calculating"
3690 "the packed size for a Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003691 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 }
3693
3694 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
3695
3696 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3697 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3698 ( void** ) &pPacket );
3699 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3700 {
3701 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Dis"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003702 "association."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 return;
3704 }
3705
3706 // Paranoia:
3707 palZeroMemory( pMac->hHdd, pFrame, nBytes );
3708
3709 // Next, we fill out the buffer descriptor:
3710 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3711 SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr);
3712 if ( eSIR_SUCCESS != nSirStatus )
3713 {
3714 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003715 "tor for a Disassociation (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003716 nSirStatus );
3717 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3718 ( void* ) pFrame, ( void* ) pPacket );
3719 return; // just allocated...
3720 }
3721
3722 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
3723
3724 // Prepare the BSSID
3725 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
3726
Chet Lanctot186b5732013-03-18 10:26:30 -07003727#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07003728 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07003729#endif
3730
Jeff Johnson295189b2012-06-20 16:38:30 -07003731 nStatus = dot11fPackDisassociation( pMac, &frm, pFrame +
3732 sizeof(tSirMacMgmtHdr),
3733 nPayload, &nPayload );
3734 if ( DOT11F_FAILED( nStatus ) )
3735 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003736 limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003737 nStatus );
3738 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3739 ( void* ) pFrame, ( void* ) pPacket );
3740 return; // allocated!
3741 }
3742 else if ( DOT11F_WARNED( nStatus ) )
3743 {
3744 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003745 "isassociation (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003746 }
3747
3748 PELOG1(limLog( pMac, LOG1, FL("*** Sending Disassociation frame with rea"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003749 "son %d to"), nReason );
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
3751
3752 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3754 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003755 )
3756 {
3757 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3758 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003759
Ganesh K08bce952012-12-13 15:04:41 -08003760 if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
3761 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
3762 {
3763 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3764 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003765
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003766 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003767 {
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003768 // Queue Disassociation frame in high priority WQ
3769 /* get the duration from the request */
3770 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
3771 HAL_TXRX_FRM_802_11_MGMT,
3772 ANI_TXDIR_TODS,
3773 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3774 limTxComplete, pFrame, limDisassocTxCompleteCnf,
3775 txFlag );
3776 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
Jeff Johnson295189b2012-06-20 16:38:30 -07003777
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003778 if (tx_timer_change(
3779 &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0)
3780 != TX_SUCCESS)
3781 {
3782 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003783 FL("Unable to change Disassoc ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003784 return;
3785 }
3786 else if(TX_SUCCESS != tx_timer_activate(
3787 &pMac->lim.limTimers.gLimDisassocAckTimer))
3788 {
3789 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003790 FL("Unable to activate Disassoc ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003791 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
3792 return;
3793 }
3794 }
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08003795 else
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003796 {
3797 // Queue Disassociation frame in high priority WQ
3798 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
3799 HAL_TXRX_FRM_802_11_MGMT,
3800 ANI_TXDIR_TODS,
3801 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3802 limTxComplete, pFrame, txFlag );
3803 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3804 {
3805 limLog( pMac, LOGE, FL("Failed to send Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003806 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003807 nSirStatus );
3808 //Pkt will be freed up by the callback
3809 return;
3810 }
3811 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003812} // End limSendDisassocMgmtFrame.
3813
3814/**
3815 * \brief This function is called to send a Deauthenticate frame
3816 *
3817 *
3818 * \param pMac Pointer to global MAC structure
3819 *
3820 * \param nReason Indicates the reason that need to be sent in the
3821 * Deauthenticate frame
3822 *
3823 * \param peeer address of the STA to which the frame is to be sent
3824 *
3825 *
3826 */
3827
3828void
3829limSendDeauthMgmtFrame(tpAniSirGlobal pMac,
3830 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003831 tSirMacAddr peer,
3832 tpPESession psessionEntry,
3833 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003834{
3835 tDot11fDeAuth frm;
3836 tANI_U8 *pFrame;
3837 tSirRetStatus nSirStatus;
3838 tpSirMacMgmtHdr pMacHdr;
3839 tANI_U32 nBytes, nPayload, nStatus;
3840 void *pPacket;
3841 eHalStatus halstatus;
3842 tANI_U8 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003843 tANI_U32 val = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003844#ifdef FEATURE_WLAN_TDLS
3845 tANI_U16 aid;
3846 tpDphHashNode pStaDs;
3847#endif
3848
Jeff Johnson295189b2012-06-20 16:38:30 -07003849 if(NULL == psessionEntry)
3850 {
3851 return;
3852 }
3853
3854 palZeroMemory( pMac->hHdd, ( tANI_U8* ) &frm, sizeof( frm ) );
3855
3856 frm.Reason.code = nReason;
3857
3858 nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload );
3859 if ( DOT11F_FAILED( nStatus ) )
3860 {
3861 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003862 "or a De-Authentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003863 nStatus );
3864 // We'll fall back on the worst case scenario:
3865 nPayload = sizeof( tDot11fDeAuth );
3866 }
3867 else if ( DOT11F_WARNED( nStatus ) )
3868 {
3869 limLog( pMac, LOGW, FL("There were warnings while calculating"
3870 "the packed size for a De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003871 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003872 }
3873
3874 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
3875
3876 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3877 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3878 ( void** ) &pPacket );
3879 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3880 {
3881 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003882 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 return;
3884 }
3885
3886 // Paranoia:
3887 palZeroMemory( pMac->hHdd, pFrame, nBytes );
3888
3889 // Next, we fill out the buffer descriptor:
3890 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3891 SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr);
3892 if ( eSIR_SUCCESS != nSirStatus )
3893 {
3894 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003895 "tor for a De-Authentication (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003896 nSirStatus );
3897 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3898 ( void* ) pFrame, ( void* ) pPacket );
3899 return; // just allocated...
3900 }
3901
3902 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
3903
3904 // Prepare the BSSID
3905 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
3906
Chet Lanctot186b5732013-03-18 10:26:30 -07003907#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07003908 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07003909#endif
3910
Jeff Johnson295189b2012-06-20 16:38:30 -07003911 nStatus = dot11fPackDeAuth( pMac, &frm, pFrame +
3912 sizeof(tSirMacMgmtHdr),
3913 nPayload, &nPayload );
3914 if ( DOT11F_FAILED( nStatus ) )
3915 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003916 limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 nStatus );
3918 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3919 ( void* ) pFrame, ( void* ) pPacket );
3920 return;
3921 }
3922 else if ( DOT11F_WARNED( nStatus ) )
3923 {
3924 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003925 "e-Authentication (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 }
3927
3928 PELOG1(limLog( pMac, LOG1, FL("*** Sending De-Authentication frame with rea"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003929 "son %d to"), nReason );
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 limPrintMacAddr( pMac, pMacHdr->da, LOG1 );)
3931
3932 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003933 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3934 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 )
3936 {
3937 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3938 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003939
Ganesh K08bce952012-12-13 15:04:41 -08003940 if((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
3941 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
3942 {
3943 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3944 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003945
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003946#ifdef FEATURE_WLAN_TDLS
3947 pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable);
3948#endif
3949
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003950 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07003951 {
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003952 // Queue Disassociation frame in high priority WQ
3953 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
3954 HAL_TXRX_FRM_802_11_MGMT,
3955 ANI_TXDIR_TODS,
3956 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3957 limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag );
3958 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3959 {
3960 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003961 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003962 nSirStatus );
Gopichand Nakkala4261ea52012-12-31 16:43:00 -08003963 //Pkt will be freed up by the callback limTxComplete
3964
3965 /*Call limProcessDeauthAckTimeout which will send
3966 * DeauthCnf for this frame
3967 */
3968 limProcessDeauthAckTimeout(pMac);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003969 return;
3970 }
3971
3972 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
3973
3974 if (tx_timer_change(
3975 &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0)
3976 != TX_SUCCESS)
3977 {
3978 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003979 FL("Unable to change Deauth ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003980 return;
3981 }
3982 else if(TX_SUCCESS != tx_timer_activate(
3983 &pMac->lim.limTimers.gLimDeauthAckTimer))
3984 {
3985 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003986 FL("Unable to activate Deauth ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003987 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
3988 return;
3989 }
3990 }
3991 else
3992 {
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003993#ifdef FEATURE_WLAN_TDLS
3994 if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType))
3995 {
3996 // Queue Disassociation frame in high priority WQ
3997 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003998 HAL_TXRX_FRM_802_11_MGMT,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08003999 ANI_TXDIR_IBSS,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004000 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4001 limTxComplete, pFrame, txFlag );
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004002 }
4003 else
4004 {
4005#endif
4006 // Queue Disassociation frame in high priority WQ
4007 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4008 HAL_TXRX_FRM_802_11_MGMT,
4009 ANI_TXDIR_TODS,
4010 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4011 limTxComplete, pFrame, txFlag );
4012#ifdef FEATURE_WLAN_TDLS
4013 }
4014#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004015 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4016 {
4017 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004018 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004019 nSirStatus );
4020 //Pkt will be freed up by the callback
4021 return;
4022 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004023 }
4024
4025} // End limSendDeauthMgmtFrame.
4026
4027
4028#ifdef ANI_SUPPORT_11H
4029/**
4030 * \brief Send a Measurement Report Action frame
4031 *
4032 *
4033 * \param pMac Pointer to the global MAC structure
4034 *
4035 * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame
4036 *
4037 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4038 *
4039 *
4040 */
4041
4042tSirRetStatus
4043limSendMeasReportFrame(tpAniSirGlobal pMac,
4044 tpSirMacMeasReqActionFrame pMeasReqFrame,
4045 tSirMacAddr peer)
4046{
4047 tDot11fMeasurementReport frm;
4048 tANI_U8 *pFrame;
4049 tSirRetStatus nSirStatus;
4050 tpSirMacMgmtHdr pMacHdr;
4051 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4052 void *pPacket;
4053 eHalStatus halstatus;
4054
4055 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
4056
4057 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4058 frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID;
4059 frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken;
4060
4061 switch ( pMeasReqFrame->measReqIE.measType )
4062 {
4063 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
4064 nSirStatus =
4065 PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame,
4066 &frm.MeasurementReport );
4067 break;
4068 case SIR_MAC_CCA_MEASUREMENT_TYPE:
4069 nSirStatus =
4070 PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame,
4071 &frm.MeasurementReport );
4072 break;
4073 case SIR_MAC_RPI_MEASUREMENT_TYPE:
4074 nSirStatus =
4075 PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame,
4076 &frm.MeasurementReport );
4077 break;
4078 default:
4079 limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004080 "dMeasReportFrame."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 pMeasReqFrame->measReqIE.measType );
4082 return eSIR_FAILURE;
4083 }
4084
4085 if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE;
4086
4087 nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload );
4088 if ( DOT11F_FAILED( nStatus ) )
4089 {
4090 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004091 "or a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004092 nStatus );
4093 // We'll fall back on the worst case scenario:
4094 nPayload = sizeof( tDot11fMeasurementReport );
4095 }
4096 else if ( DOT11F_WARNED( nStatus ) )
4097 {
4098 limLog( pMac, LOGW, FL("There were warnings while calculating"
4099 "the packed size for a Measurement Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004100 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 }
4102
4103 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4104
4105 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4106 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4107 {
4108 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004109 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004110 return eSIR_FAILURE;
4111 }
4112
4113 // Paranoia:
4114 palZeroMemory( pMac->hHdd, pFrame, nBytes );
4115
4116 // Next, we fill out the buffer descriptor:
4117 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4118 SIR_MAC_MGMT_ACTION, peer);
4119 if ( eSIR_SUCCESS != nSirStatus )
4120 {
4121 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004122 "tor for a Measurement Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004123 nSirStatus );
4124 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4125 return eSIR_FAILURE; // just allocated...
4126 }
4127
4128 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4129
4130 nCfg = 6;
4131 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4132 if ( eSIR_SUCCESS != nSirStatus )
4133 {
4134 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004135 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004136 nSirStatus );
4137 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4138 return eSIR_FAILURE; // just allocated...
4139 }
4140
Chet Lanctot186b5732013-03-18 10:26:30 -07004141#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004142 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004143#endif
4144
Jeff Johnson295189b2012-06-20 16:38:30 -07004145 nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame +
4146 sizeof(tSirMacMgmtHdr),
4147 nPayload, &nPayload );
4148 if ( DOT11F_FAILED( nStatus ) )
4149 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004150 limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 nStatus );
4152 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4153 return eSIR_FAILURE; // allocated!
4154 }
4155 else if ( DOT11F_WARNED( nStatus ) )
4156 {
4157 limLog( pMac, LOGW, FL("There were warnings while packing a M"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004158 "easurement Report (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004159 }
4160
4161 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4162 HAL_TXRX_FRM_802_11_MGMT,
4163 ANI_TXDIR_TODS,
4164 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4165 limTxComplete, pFrame, 0 );
4166 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4167 {
4168 limLog( pMac, LOGE, FL("Failed to send a Measurement Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004169 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004170 nSirStatus );
4171 //Pkt will be freed up by the callback
4172 return eSIR_FAILURE; // just allocated...
4173 }
4174
4175 return eSIR_SUCCESS;
4176
4177} // End limSendMeasReportFrame.
4178
4179
4180/**
4181 * \brief Send a TPC Request Action frame
4182 *
4183 *
4184 * \param pMac Pointer to the global MAC datastructure
4185 *
4186 * \param peer MAC address to which the frame should be sent
4187 *
4188 *
4189 */
4190
4191void
4192limSendTpcRequestFrame(tpAniSirGlobal pMac,
4193 tSirMacAddr peer)
4194{
4195 tDot11fTPCRequest frm;
4196 tANI_U8 *pFrame;
4197 tSirRetStatus nSirStatus;
4198 tpSirMacMgmtHdr pMacHdr;
4199 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4200 void *pPacket;
4201 eHalStatus halstatus;
4202
4203 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
4204
4205 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4206 frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID;
4207 frm.DialogToken.token = 1;
4208 frm.TPCRequest.present = 1;
4209
4210 nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload );
4211 if ( DOT11F_FAILED( nStatus ) )
4212 {
4213 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004214 "or a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004215 nStatus );
4216 // We'll fall back on the worst case scenario:
4217 nPayload = sizeof( tDot11fTPCRequest );
4218 }
4219 else if ( DOT11F_WARNED( nStatus ) )
4220 {
4221 limLog( pMac, LOGW, FL("There were warnings while calculating"
4222 "the packed size for a TPC Request (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004223 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004224 }
4225
4226 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4227
4228 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4229 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4230 {
4231 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004232 " Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004233 return;
4234 }
4235
4236 // Paranoia:
4237 palZeroMemory( pMac->hHdd, pFrame, nBytes );
4238
4239 // Next, we fill out the buffer descriptor:
4240 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4241 SIR_MAC_MGMT_ACTION, peer);
4242 if ( eSIR_SUCCESS != nSirStatus )
4243 {
4244 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004245 "tor for a TPC Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004246 nSirStatus );
4247 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4248 return; // just allocated...
4249 }
4250
4251 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4252
4253 nCfg = 6;
4254 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4255 if ( eSIR_SUCCESS != nSirStatus )
4256 {
4257 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004258 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 nSirStatus );
4260 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4261 return; // just allocated...
4262 }
4263
Chet Lanctot186b5732013-03-18 10:26:30 -07004264#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004265 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004266#endif
4267
Jeff Johnson295189b2012-06-20 16:38:30 -07004268 nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame +
4269 sizeof(tSirMacMgmtHdr),
4270 nPayload, &nPayload );
4271 if ( DOT11F_FAILED( nStatus ) )
4272 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004273 limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004274 nStatus );
4275 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4276 return; // allocated!
4277 }
4278 else if ( DOT11F_WARNED( nStatus ) )
4279 {
4280 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004281 "PC Request (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 }
4283
4284 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4285 HAL_TXRX_FRM_802_11_MGMT,
4286 ANI_TXDIR_TODS,
4287 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4288 limTxComplete, pFrame, 0 );
4289 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4290 {
4291 limLog( pMac, LOGE, FL("Failed to send a TPC Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004292 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 nSirStatus );
4294 //Pkt will be freed up by the callback
4295 return;
4296 }
4297
4298} // End limSendTpcRequestFrame.
4299
4300
4301/**
4302 * \brief Send a TPC Report Action frame
4303 *
4304 *
4305 * \param pMac Pointer to the global MAC datastructure
4306 *
4307 * \param pTpcReqFrame Pointer to the received TPC Request
4308 *
4309 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4310 *
4311 *
4312 */
4313
4314tSirRetStatus
4315limSendTpcReportFrame(tpAniSirGlobal pMac,
4316 tpSirMacTpcReqActionFrame pTpcReqFrame,
4317 tSirMacAddr peer)
4318{
4319 tDot11fTPCReport frm;
4320 tANI_U8 *pFrame;
4321 tSirRetStatus nSirStatus;
4322 tpSirMacMgmtHdr pMacHdr;
4323 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4324 void *pPacket;
4325 eHalStatus halstatus;
4326
4327 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
4328
4329 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4330 frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID;
4331 frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken;
4332
4333 // FramesToDo: On the Gen4_TVM branch, there was a comment:
4334 // "misplaced this function, need to replace:
4335 // txPower = halGetRateToPwrValue(pMac, staid,
4336 // pMac->lim.gLimCurrentChannelId, 0);
4337 frm.TPCReport.tx_power = 0;
4338 frm.TPCReport.link_margin = 0;
4339 frm.TPCReport.present = 1;
4340
4341 nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload );
4342 if ( DOT11F_FAILED( nStatus ) )
4343 {
4344 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004345 "or a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004346 nStatus );
4347 // We'll fall back on the worst case scenario:
4348 nPayload = sizeof( tDot11fTPCReport );
4349 }
4350 else if ( DOT11F_WARNED( nStatus ) )
4351 {
4352 limLog( pMac, LOGW, FL("There were warnings while calculating"
4353 "the packed size for a TPC Report (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004354 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004355 }
4356
4357 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4358
4359 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4360 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4361 {
4362 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004363 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004364 return eSIR_FAILURE;
4365 }
4366
4367 // Paranoia:
4368 palZeroMemory( pMac->hHdd, pFrame, nBytes );
4369
4370 // Next, we fill out the buffer descriptor:
4371 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4372 SIR_MAC_MGMT_ACTION, peer);
4373 if ( eSIR_SUCCESS != nSirStatus )
4374 {
4375 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004376 "tor for a TPC Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 nSirStatus );
4378 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4379 return eSIR_FAILURE; // just allocated...
4380 }
4381
4382 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4383
4384 nCfg = 6;
4385 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4386 if ( eSIR_SUCCESS != nSirStatus )
4387 {
4388 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004389 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 nSirStatus );
4391 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4392 return eSIR_FAILURE; // just allocated...
4393 }
4394
Chet Lanctot186b5732013-03-18 10:26:30 -07004395#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004396 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004397#endif
4398
Jeff Johnson295189b2012-06-20 16:38:30 -07004399 nStatus = dot11fPackTPCReport( pMac, &frm, pFrame +
4400 sizeof(tSirMacMgmtHdr),
4401 nPayload, &nPayload );
4402 if ( DOT11F_FAILED( nStatus ) )
4403 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004404 limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004405 nStatus );
4406 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4407 return eSIR_FAILURE; // allocated!
4408 }
4409 else if ( DOT11F_WARNED( nStatus ) )
4410 {
4411 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004412 "PC Report (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 }
4414
4415
4416 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4417 HAL_TXRX_FRM_802_11_MGMT,
4418 ANI_TXDIR_TODS,
4419 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4420 limTxComplete, pFrame, 0 );
4421 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4422 {
4423 limLog( pMac, LOGE, FL("Failed to send a TPC Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004424 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004425 nSirStatus );
4426 //Pkt will be freed up by the callback
4427 return eSIR_FAILURE; // just allocated...
4428 }
4429
4430 return eSIR_SUCCESS;
4431
4432} // End limSendTpcReportFrame.
4433#endif //ANI_SUPPORT_11H
4434
4435
Jeff Johnson295189b2012-06-20 16:38:30 -07004436/**
4437 * \brief Send a Channel Switch Announcement
4438 *
4439 *
4440 * \param pMac Pointer to the global MAC datastructure
4441 *
4442 * \param peer MAC address to which this frame will be sent
4443 *
4444 * \param nMode
4445 *
4446 * \param nNewChannel
4447 *
4448 * \param nCount
4449 *
4450 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4451 *
4452 *
4453 */
4454
4455tSirRetStatus
4456limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
4457 tSirMacAddr peer,
Jeff Johnsone7245742012-09-05 17:12:55 -07004458 tANI_U8 nMode,
4459 tANI_U8 nNewChannel,
4460 tANI_U8 nCount,
4461 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07004462{
4463 tDot11fChannelSwitch frm;
4464 tANI_U8 *pFrame;
4465 tSirRetStatus nSirStatus;
4466 tpSirMacMgmtHdr pMacHdr;
Jeff Johnsone7245742012-09-05 17:12:55 -07004467 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004468 void *pPacket;
4469 eHalStatus halstatus;
Jeff Johnsone7245742012-09-05 17:12:55 -07004470 tANI_U8 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004471
4472 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
4473
4474 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4475 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
4476 frm.ChanSwitchAnn.switchMode = nMode;
4477 frm.ChanSwitchAnn.newChannel = nNewChannel;
4478 frm.ChanSwitchAnn.switchCount = nCount;
4479 frm.ChanSwitchAnn.present = 1;
4480
4481 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
4482 if ( DOT11F_FAILED( nStatus ) )
4483 {
4484 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004485 "or a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 nStatus );
4487 // We'll fall back on the worst case scenario:
4488 nPayload = sizeof( tDot11fChannelSwitch );
4489 }
4490 else if ( DOT11F_WARNED( nStatus ) )
4491 {
4492 limLog( pMac, LOGW, FL("There were warnings while calculating"
4493 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004494 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004495 }
4496
4497 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4498
4499 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4500 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4501 {
4502 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004503 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004504 return eSIR_FAILURE;
4505 }
4506
4507 // Paranoia:
4508 palZeroMemory( pMac->hHdd, pFrame, nBytes );
4509
4510 // Next, we fill out the buffer descriptor:
4511 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
Jeff Johnsone7245742012-09-05 17:12:55 -07004512 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
4513 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4514 palCopyMemory( pMac->hHdd,
4515 (tANI_U8 *) pMacHdr->bssId,
4516 (tANI_U8 *) psessionEntry->bssId,
4517 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004518 if ( eSIR_SUCCESS != nSirStatus )
4519 {
4520 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004521 "tor for a Channel Switch (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 nSirStatus );
4523 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4524 return eSIR_FAILURE; // just allocated...
4525 }
4526
Jeff Johnsone7245742012-09-05 17:12:55 -07004527#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07004528 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4529
4530 nCfg = 6;
4531 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4532 if ( eSIR_SUCCESS != nSirStatus )
4533 {
4534 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004535 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 nSirStatus );
4537 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4538 return eSIR_FAILURE; // just allocated...
4539 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004540#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07004541
4542#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004543 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004544#endif
4545
Jeff Johnson295189b2012-06-20 16:38:30 -07004546 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
4547 sizeof(tSirMacMgmtHdr),
4548 nPayload, &nPayload );
4549 if ( DOT11F_FAILED( nStatus ) )
4550 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004551 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 nStatus );
4553 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4554 return eSIR_FAILURE; // allocated!
4555 }
4556 else if ( DOT11F_WARNED( nStatus ) )
4557 {
4558 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004559 "hannel Switch (0x%08x).") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 }
4561
Jeff Johnsone7245742012-09-05 17:12:55 -07004562 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnsone7245742012-09-05 17:12:55 -07004563 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4564 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnsone7245742012-09-05 17:12:55 -07004565 )
4566 {
4567 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4568 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4570 HAL_TXRX_FRM_802_11_MGMT,
4571 ANI_TXDIR_TODS,
4572 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Jeff Johnsone7245742012-09-05 17:12:55 -07004573 limTxComplete, pFrame, txFlag );
Jeff Johnson295189b2012-06-20 16:38:30 -07004574 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4575 {
4576 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004577 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 nSirStatus );
4579 //Pkt will be freed up by the callback
4580 return eSIR_FAILURE;
4581 }
4582
4583 return eSIR_SUCCESS;
4584
4585} // End limSendChannelSwitchMgmtFrame.
4586
Jeff Johnson295189b2012-06-20 16:38:30 -07004587
4588
Mohit Khanna4a70d262012-09-11 16:30:12 -07004589#ifdef WLAN_FEATURE_11AC
4590tSirRetStatus
4591limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac,
4592 tSirMacAddr peer,
4593 tANI_U8 nMode,
4594 tpPESession psessionEntry )
4595{
4596 tDot11fOperatingMode frm;
4597 tANI_U8 *pFrame;
4598 tSirRetStatus nSirStatus;
4599 tpSirMacMgmtHdr pMacHdr;
4600 tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg;
4601 void *pPacket;
4602 eHalStatus halstatus;
4603 tANI_U8 txFlag = 0;
4604
4605 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
4606
4607 frm.Category.category = SIR_MAC_ACTION_VHT;
4608 frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION;
4609 frm.OperatingMode.chanWidth = nMode;
4610 frm.OperatingMode.rxNSS = 0;
4611 frm.OperatingMode.rxNSSType = 0;
4612
4613 nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload );
4614 if ( DOT11F_FAILED( nStatus ) )
4615 {
4616 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004617 "or a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004618 nStatus );
4619 // We'll fall back on the worst case scenario:
4620 nPayload = sizeof( tDot11fOperatingMode);
4621 }
4622 else if ( DOT11F_WARNED( nStatus ) )
4623 {
4624 limLog( pMac, LOGW, FL("There were warnings while calculating"
4625 "the packed size for a Operating Mode (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004626 "%08x)."), nStatus );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004627 }
4628
4629 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4630
4631 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4632 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4633 {
4634 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Operating Mode"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004635 " Report."), nBytes );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004636 return eSIR_FAILURE;
4637 }
4638
4639 // Paranoia:
4640 palZeroMemory( pMac->hHdd, pFrame, nBytes );
4641
4642
4643 // Next, we fill out the buffer descriptor:
4644 if(psessionEntry->pePersona == VOS_STA_SAP_MODE) {
4645 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4646 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
4647 } else
4648 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4649 SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr);
4650 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4651 palCopyMemory( pMac->hHdd,
4652 (tANI_U8 *) pMacHdr->bssId,
4653 (tANI_U8 *) psessionEntry->bssId,
4654 sizeof( tSirMacAddr ));
4655 if ( eSIR_SUCCESS != nSirStatus )
4656 {
4657 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004658 "tor for a Operating Mode (%d)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004659 nSirStatus );
4660 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4661 return eSIR_FAILURE; // just allocated...
4662 }
4663 nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame +
4664 sizeof(tSirMacMgmtHdr),
4665 nPayload, &nPayload );
4666 if ( DOT11F_FAILED( nStatus ) )
4667 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004668 limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004669 nStatus );
4670 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4671 return eSIR_FAILURE; // allocated!
4672 }
4673 else if ( DOT11F_WARNED( nStatus ) )
4674 {
4675 limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004676 " (0x%08x).") );
Mohit Khanna4a70d262012-09-11 16:30:12 -07004677 }
4678 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Mohit Khanna4a70d262012-09-11 16:30:12 -07004679 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4680 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Mohit Khanna4a70d262012-09-11 16:30:12 -07004681 )
4682 {
4683 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4684 }
4685 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4686 HAL_TXRX_FRM_802_11_MGMT,
4687 ANI_TXDIR_TODS,
4688 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4689 limTxComplete, pFrame, txFlag );
4690 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4691 {
4692 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004693 "(%X)!"),
Mohit Khanna4a70d262012-09-11 16:30:12 -07004694 nSirStatus );
4695 //Pkt will be freed up by the callback
4696 return eSIR_FAILURE;
4697 }
4698
4699 return eSIR_SUCCESS;
4700}
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004701
4702/**
4703 * \brief Send a VHT Channel Switch Announcement
4704 *
4705 *
4706 * \param pMac Pointer to the global MAC datastructure
4707 *
4708 * \param peer MAC address to which this frame will be sent
4709 *
4710 * \param nChanWidth
4711 *
4712 * \param nNewChannel
4713 *
4714 *
4715 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4716 *
4717 *
4718 */
4719
4720tSirRetStatus
4721limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
4722 tSirMacAddr peer,
4723 tANI_U8 nChanWidth,
4724 tANI_U8 nNewChannel,
4725 tANI_U8 ncbMode,
4726 tpPESession psessionEntry )
4727{
4728 tDot11fChannelSwitch frm;
4729 tANI_U8 *pFrame;
4730 tSirRetStatus nSirStatus;
4731 tpSirMacMgmtHdr pMacHdr;
4732 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
4733 void *pPacket;
4734 eHalStatus halstatus;
4735 tANI_U8 txFlag = 0;
4736
4737 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
4738
4739
4740 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4741 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
4742 frm.ChanSwitchAnn.switchMode = 1;
4743 frm.ChanSwitchAnn.newChannel = nNewChannel;
4744 frm.ChanSwitchAnn.switchCount = 1;
4745 frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode);
4746 frm.ExtChanSwitchAnn.present = 1;
4747 frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth;
4748 frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth);
4749 frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0;
4750 frm.ChanSwitchAnn.present = 1;
4751 frm.WiderBWChanSwitchAnn.present = 1;
4752
4753 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
4754 if ( DOT11F_FAILED( nStatus ) )
4755 {
4756 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004757 "or a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004758 nStatus );
4759 // We'll fall back on the worst case scenario:
4760 nPayload = sizeof( tDot11fChannelSwitch );
4761 }
4762 else if ( DOT11F_WARNED( nStatus ) )
4763 {
4764 limLog( pMac, LOGW, FL("There were warnings while calculating"
4765 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004766 "%08x)."), nStatus );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004767 }
4768
4769 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4770
4771 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4772 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4773 {
4774 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004775 " Report."), nBytes );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004776 return eSIR_FAILURE;
4777 }
4778 // Paranoia:
4779 palZeroMemory( pMac->hHdd, pFrame, nBytes );
4780
4781 // Next, we fill out the buffer descriptor:
4782 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4783 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
4784 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4785 palCopyMemory( pMac->hHdd,
4786 (tANI_U8 *) pMacHdr->bssId,
4787 (tANI_U8 *) psessionEntry->bssId,
4788 sizeof( tSirMacAddr ));
4789 if ( eSIR_SUCCESS != nSirStatus )
4790 {
4791 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004792 "tor for a Channel Switch (%d)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004793 nSirStatus );
4794 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4795 return eSIR_FAILURE; // just allocated...
4796 }
4797 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
4798 sizeof(tSirMacMgmtHdr),
4799 nPayload, &nPayload );
4800 if ( DOT11F_FAILED( nStatus ) )
4801 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004802 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004803 nStatus );
4804 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4805 return eSIR_FAILURE; // allocated!
4806 }
4807 else if ( DOT11F_WARNED( nStatus ) )
4808 {
4809 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004810 "hannel Switch (0x%08x).") );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004811 }
4812
4813 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004814 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4815 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004816 )
4817 {
4818 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4819 }
4820 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4821 HAL_TXRX_FRM_802_11_MGMT,
4822 ANI_TXDIR_TODS,
4823 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4824 limTxComplete, pFrame, txFlag );
4825 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4826 {
4827 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004828 "(%X)!"),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004829 nSirStatus );
4830 //Pkt will be freed up by the callback
4831 return eSIR_FAILURE;
4832 }
4833
4834 return eSIR_SUCCESS;
4835
4836} // End limSendVHTChannelSwitchMgmtFrame.
4837
4838
4839
Mohit Khanna4a70d262012-09-11 16:30:12 -07004840#endif
4841
Jeff Johnson295189b2012-06-20 16:38:30 -07004842/**
4843 * \brief Send an ADDBA Req Action Frame to peer
4844 *
4845 * \sa limSendAddBAReq
4846 *
4847 * \param pMac The global tpAniSirGlobal object
4848 *
4849 * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains
4850 * the necessary parameters reqd by PE send the ADDBA Req Action
4851 * Frame to the peer
4852 *
4853 * \return eSIR_SUCCESS if setup completes successfully
4854 * eSIR_FAILURE is some problem is encountered
4855 */
4856tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac,
4857 tpLimMlmAddBAReq pMlmAddBAReq ,tpPESession psessionEntry)
4858{
4859 tDot11fAddBAReq frmAddBAReq;
4860 tANI_U8 *pAddBAReqBuffer = NULL;
4861 tpSirMacMgmtHdr pMacHdr;
4862 tANI_U32 frameLen = 0, nStatus, nPayload;
4863 tSirRetStatus statusCode;
4864 eHalStatus halStatus;
4865 void *pPacket;
4866 tANI_U8 txFlag = 0;
4867
4868 if(NULL == psessionEntry)
4869 {
4870 return eSIR_FAILURE;
4871 }
4872
4873 palZeroMemory( pMac->hHdd, (void *) &frmAddBAReq, sizeof( frmAddBAReq ));
4874
4875 // Category - 3 (BA)
4876 frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK;
4877
4878 // Action - 0 (ADDBA Req)
4879 frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ;
4880
4881 // FIXME - Dialog Token, generalize this...
4882 frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken;
4883
4884 // Fill the ADDBA Parameter Set
4885 frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID;
4886 frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy;
4887 frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize;
4888
4889 // BA timeout
4890 // 0 - indicates no BA timeout
4891 frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout;
4892
4893 // BA Starting Sequence Number
4894 // Fragment number will always be zero
4895 if (pMlmAddBAReq->baSSN < LIM_TX_FRAMES_THRESHOLD_ON_CHIP) {
4896 pMlmAddBAReq->baSSN = LIM_TX_FRAMES_THRESHOLD_ON_CHIP;
4897 }
4898
4899 frmAddBAReq.BAStartingSequenceControl.ssn =
4900 pMlmAddBAReq->baSSN - LIM_TX_FRAMES_THRESHOLD_ON_CHIP;
4901
4902 nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload );
4903
4904 if( DOT11F_FAILED( nStatus ))
4905 {
4906 limLog( pMac, LOGW,
4907 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004908 "an ADDBA Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 nStatus );
4910
4911 // We'll fall back on the worst case scenario:
4912 nPayload = sizeof( tDot11fAddBAReq );
4913 }
4914 else if( DOT11F_WARNED( nStatus ))
4915 {
4916 limLog( pMac, LOGW,
4917 FL( "There were warnings while calculating"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004918 "the packed size for an ADDBA Req (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004919 nStatus );
4920 }
4921
4922 // Add the MGMT header to frame length
4923 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
4924
4925 // Need to allocate a buffer for ADDBA AF
4926 if( eHAL_STATUS_SUCCESS !=
4927 (halStatus = palPktAlloc( pMac->hHdd,
4928 HAL_TXRX_FRM_802_11_MGMT,
4929 (tANI_U16) frameLen,
4930 (void **) &pAddBAReqBuffer,
4931 (void **) &pPacket )))
4932 {
4933 // Log error
4934 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004935 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004936 frameLen,
4937 halStatus );
4938
4939 statusCode = eSIR_MEM_ALLOC_FAILED;
4940 goto returnAfterError;
4941 }
4942
4943 palZeroMemory( pMac->hHdd, (void *) pAddBAReqBuffer, frameLen );
4944
4945 // Copy necessary info to BD
4946 if( eSIR_SUCCESS !=
4947 (statusCode = limPopulateMacHeader( pMac,
4948 pAddBAReqBuffer,
4949 SIR_MAC_MGMT_FRAME,
4950 SIR_MAC_MGMT_ACTION,
4951 pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
4952 goto returnAfterError;
4953
4954 // Update A3 with the BSSID
4955 pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer;
4956
4957 #if 0
4958 cfgLen = SIR_MAC_ADDR_LENGTH;
4959 if( eSIR_SUCCESS != cfgGetStr( pMac,
4960 WNI_CFG_BSSID,
4961 (tANI_U8 *) pMacHdr->bssId,
4962 &cfgLen ))
4963 {
4964 limLog( pMac, LOGP,
4965 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004966 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004967
4968 // FIXME - Need to convert to tSirRetStatus
4969 statusCode = eSIR_FAILURE;
4970 goto returnAfterError;
4971 }
4972 #endif//TO SUPPORT BT-AMP
4973 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
4974
Chet Lanctot186b5732013-03-18 10:26:30 -07004975#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004976 limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004977#endif
4978
Jeff Johnson295189b2012-06-20 16:38:30 -07004979 // Now, we're ready to "pack" the frames
4980 nStatus = dot11fPackAddBAReq( pMac,
4981 &frmAddBAReq,
4982 pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ),
4983 nPayload,
4984 &nPayload );
4985
4986 if( DOT11F_FAILED( nStatus ))
4987 {
4988 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004989 FL( "Failed to pack an ADDBA Req (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004990 nStatus );
4991
4992 // FIXME - Need to convert to tSirRetStatus
4993 statusCode = eSIR_FAILURE;
4994 goto returnAfterError;
4995 }
4996 else if( DOT11F_WARNED( nStatus ))
4997 {
4998 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004999 FL( "There were warnings while packing an ADDBA Req (0x%08x)." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005000 }
5001
5002 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005003 FL( "Sending an ADDBA REQ to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005004 limPrintMacAddr( pMac, pMlmAddBAReq->peerMacAddr, LOGW );
5005
5006 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5008 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005009 )
5010 {
5011 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5012 }
5013
5014 if( eHAL_STATUS_SUCCESS !=
5015 (halStatus = halTxFrame( pMac,
5016 pPacket,
5017 (tANI_U16) frameLen,
5018 HAL_TXRX_FRM_802_11_MGMT,
5019 ANI_TXDIR_TODS,
5020 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5021 limTxComplete,
5022 pAddBAReqBuffer, txFlag )))
5023 {
5024 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005025 FL( "halTxFrame FAILED! Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005026 halStatus );
5027
5028 // FIXME - Need to convert eHalStatus to tSirRetStatus
5029 statusCode = eSIR_FAILURE;
5030 //Pkt will be freed up by the callback
5031 return statusCode;
5032 }
5033 else
5034 return eSIR_SUCCESS;
5035
5036returnAfterError:
5037
5038 // Release buffer, if allocated
5039 if( NULL != pAddBAReqBuffer )
5040 palPktFree( pMac->hHdd,
5041 HAL_TXRX_FRM_802_11_MGMT,
5042 (void *) pAddBAReqBuffer,
5043 (void *) pPacket );
5044
5045 return statusCode;
5046}
5047
5048/**
5049 * \brief Send an ADDBA Rsp Action Frame to peer
5050 *
5051 * \sa limSendAddBARsp
5052 *
5053 * \param pMac The global tpAniSirGlobal object
5054 *
5055 * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains
5056 * the necessary parameters reqd by PE send the ADDBA Rsp Action
5057 * Frame to the peer
5058 *
5059 * \return eSIR_SUCCESS if setup completes successfully
5060 * eSIR_FAILURE is some problem is encountered
5061 */
5062tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac,
5063 tpLimMlmAddBARsp pMlmAddBARsp,
5064 tpPESession psessionEntry)
5065{
5066 tDot11fAddBARsp frmAddBARsp;
5067 tANI_U8 *pAddBARspBuffer = NULL;
5068 tpSirMacMgmtHdr pMacHdr;
5069 tANI_U32 frameLen = 0, nStatus, nPayload;
5070 tSirRetStatus statusCode;
5071 eHalStatus halStatus;
5072 void *pPacket;
5073 tANI_U8 txFlag = 0;
5074
5075 if(NULL == psessionEntry)
5076 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005077 PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 return eSIR_FAILURE;
5079 }
5080
5081 palZeroMemory( pMac->hHdd, (void *) &frmAddBARsp, sizeof( frmAddBARsp ));
5082
5083 // Category - 3 (BA)
5084 frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK;
5085 // Action - 1 (ADDBA Rsp)
5086 frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP;
5087
5088 // Should be same as the one we received in the ADDBA Req
5089 frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken;
5090
5091 // ADDBA Req status
5092 frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode;
5093
5094 // Fill the ADDBA Parameter Set as provided by caller
5095 frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID;
5096 frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy;
5097 frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize;
Kiran Kumar Lokere2ac471f2013-05-30 16:08:48 -07005098 frmAddBARsp.AddBAParameterSet.amsduSupported = psessionEntry->amsduSupportedInBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07005099
5100 // BA timeout
5101 // 0 - indicates no BA timeout
5102 frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout;
5103
5104 nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload );
5105
5106 if( DOT11F_FAILED( nStatus ))
5107 {
5108 limLog( pMac, LOGW,
5109 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005110 "an ADDBA Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005111 nStatus );
5112
5113 // We'll fall back on the worst case scenario:
5114 nPayload = sizeof( tDot11fAddBARsp );
5115 }
5116 else if( DOT11F_WARNED( nStatus ))
5117 {
5118 limLog( pMac, LOGW,
5119 FL( "There were warnings while calculating"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005120 "the packed size for an ADDBA Rsp (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005121 nStatus );
5122 }
5123
5124 // Need to allocate a buffer for ADDBA AF
5125 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5126
5127 // Allocate shared memory
5128 if( eHAL_STATUS_SUCCESS !=
5129 (halStatus = palPktAlloc( pMac->hHdd,
5130 HAL_TXRX_FRM_802_11_MGMT,
5131 (tANI_U16) frameLen,
5132 (void **) &pAddBARspBuffer,
5133 (void **) &pPacket )))
5134 {
5135 // Log error
5136 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005137 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 frameLen,
5139 halStatus );
5140
5141 statusCode = eSIR_MEM_ALLOC_FAILED;
5142 goto returnAfterError;
5143 }
5144
5145 palZeroMemory( pMac->hHdd, (void *) pAddBARspBuffer, frameLen );
5146
5147 // Copy necessary info to BD
5148 if( eSIR_SUCCESS !=
5149 (statusCode = limPopulateMacHeader( pMac,
5150 pAddBARspBuffer,
5151 SIR_MAC_MGMT_FRAME,
5152 SIR_MAC_MGMT_ACTION,
5153 pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr)))
5154 goto returnAfterError;
5155
5156 // Update A3 with the BSSID
5157
5158 pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer;
5159
5160 #if 0
5161 cfgLen = SIR_MAC_ADDR_LENGTH;
5162 if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
5163 WNI_CFG_BSSID,
5164 (tANI_U8 *) pMacHdr->bssId,
5165 &cfgLen ))
5166 {
5167 limLog( pMac, LOGP,
5168 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005169 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005170
5171 // FIXME - Need to convert to tSirRetStatus
5172 statusCode = eSIR_FAILURE;
5173 goto returnAfterError;
5174 }
5175 #endif // TO SUPPORT BT-AMP
5176 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5177
Chet Lanctot186b5732013-03-18 10:26:30 -07005178#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005179 limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005180#endif
5181
Jeff Johnson295189b2012-06-20 16:38:30 -07005182 // Now, we're ready to "pack" the frames
5183 nStatus = dot11fPackAddBARsp( pMac,
5184 &frmAddBARsp,
5185 pAddBARspBuffer + sizeof( tSirMacMgmtHdr ),
5186 nPayload,
5187 &nPayload );
5188
5189 if( DOT11F_FAILED( nStatus ))
5190 {
5191 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005192 FL( "Failed to pack an ADDBA Rsp (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005193 nStatus );
5194
5195 // FIXME - Need to convert to tSirRetStatus
5196 statusCode = eSIR_FAILURE;
5197 goto returnAfterError;
5198 }
5199 else if( DOT11F_WARNED( nStatus ))
5200 {
5201 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005202 FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005203 }
5204
5205 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005206 FL( "Sending an ADDBA RSP to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005207 limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGW );
5208
5209 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005210 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5211 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005212 )
5213 {
5214 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5215 }
5216
5217 if( eHAL_STATUS_SUCCESS !=
5218 (halStatus = halTxFrame( pMac,
5219 pPacket,
5220 (tANI_U16) frameLen,
5221 HAL_TXRX_FRM_802_11_MGMT,
5222 ANI_TXDIR_TODS,
5223 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5224 limTxComplete,
5225 pAddBARspBuffer, txFlag )))
5226 {
5227 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005228 FL( "halTxFrame FAILED! Status [%d]" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005229 halStatus );
5230
5231 // FIXME - HAL error codes are different from PE error
5232 // codes!! And, this routine is returning tSirRetStatus
5233 statusCode = eSIR_FAILURE;
5234 //Pkt will be freed up by the callback
5235 return statusCode;
5236 }
5237 else
5238 return eSIR_SUCCESS;
5239
5240 returnAfterError:
5241
5242 // Release buffer, if allocated
5243 if( NULL != pAddBARspBuffer )
5244 palPktFree( pMac->hHdd,
5245 HAL_TXRX_FRM_802_11_MGMT,
5246 (void *) pAddBARspBuffer,
5247 (void *) pPacket );
5248
5249 return statusCode;
5250}
5251
5252/**
5253 * \brief Send a DELBA Indication Action Frame to peer
5254 *
5255 * \sa limSendDelBAInd
5256 *
5257 * \param pMac The global tpAniSirGlobal object
5258 *
5259 * \param peerMacAddr MAC Address of peer
5260 *
5261 * \param reasonCode Reason for the DELBA notification
5262 *
5263 * \param pBAParameterSet The DELBA Parameter Set.
5264 * This identifies the TID for which the BA session is
5265 * being deleted.
5266 *
5267 * \return eSIR_SUCCESS if setup completes successfully
5268 * eSIR_FAILURE is some problem is encountered
5269 */
5270tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac,
5271 tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry)
5272{
5273 tDot11fDelBAInd frmDelBAInd;
5274 tANI_U8 *pDelBAIndBuffer = NULL;
5275 //tANI_U32 val;
5276 tpSirMacMgmtHdr pMacHdr;
5277 tANI_U32 frameLen = 0, nStatus, nPayload;
5278 tSirRetStatus statusCode;
5279 eHalStatus halStatus;
5280 void *pPacket;
5281 tANI_U8 txFlag = 0;
5282
5283 if(NULL == psessionEntry)
5284 {
5285 return eSIR_FAILURE;
5286 }
5287
5288 palZeroMemory( pMac->hHdd, (void *) &frmDelBAInd, sizeof( frmDelBAInd ));
5289
5290 // Category - 3 (BA)
5291 frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK;
5292 // Action - 2 (DELBA)
5293 frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL;
5294
5295 // Fill the DELBA Parameter Set as provided by caller
5296 frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID;
5297 frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection;
5298
5299 // BA Starting Sequence Number
5300 // Fragment number will always be zero
5301 frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode;
5302
5303 nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload );
5304
5305 if( DOT11F_FAILED( nStatus ))
5306 {
5307 limLog( pMac, LOGW,
5308 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005309 "an DELBA Indication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005310 nStatus );
5311
5312 // We'll fall back on the worst case scenario:
5313 nPayload = sizeof( tDot11fDelBAInd );
5314 }
5315 else if( DOT11F_WARNED( nStatus ))
5316 {
5317 limLog( pMac, LOGW,
5318 FL( "There were warnings while calculating"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005319 "the packed size for an DELBA Ind (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005320 nStatus );
5321 }
5322
5323 // Add the MGMT header to frame length
5324 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5325
5326 // Allocate shared memory
5327 if( eHAL_STATUS_SUCCESS !=
5328 (halStatus = palPktAlloc( pMac->hHdd,
5329 HAL_TXRX_FRM_802_11_MGMT,
5330 (tANI_U16) frameLen,
5331 (void **) &pDelBAIndBuffer,
5332 (void **) &pPacket )))
5333 {
5334 // Log error
5335 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005336 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005337 frameLen,
5338 halStatus );
5339
5340 statusCode = eSIR_MEM_ALLOC_FAILED;
5341 goto returnAfterError;
5342 }
5343
5344 palZeroMemory( pMac->hHdd, (void *) pDelBAIndBuffer, frameLen );
5345
5346 // Copy necessary info to BD
5347 if( eSIR_SUCCESS !=
5348 (statusCode = limPopulateMacHeader( pMac,
5349 pDelBAIndBuffer,
5350 SIR_MAC_MGMT_FRAME,
5351 SIR_MAC_MGMT_ACTION,
5352 pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
5353 goto returnAfterError;
5354
5355 // Update A3 with the BSSID
5356 pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer;
5357
5358 #if 0
5359 cfgLen = SIR_MAC_ADDR_LENGTH;
5360 if( eSIR_SUCCESS != cfgGetStr( pMac,
5361 WNI_CFG_BSSID,
5362 (tANI_U8 *) pMacHdr->bssId,
5363 &cfgLen ))
5364 {
5365 limLog( pMac, LOGP,
5366 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005367 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005368
5369 // FIXME - Need to convert to tSirRetStatus
5370 statusCode = eSIR_FAILURE;
5371 goto returnAfterError;
5372 }
5373 #endif //TO SUPPORT BT-AMP
5374 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5375
Chet Lanctot186b5732013-03-18 10:26:30 -07005376#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005377 limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005378#endif
5379
Jeff Johnson295189b2012-06-20 16:38:30 -07005380 // Now, we're ready to "pack" the frames
5381 nStatus = dot11fPackDelBAInd( pMac,
5382 &frmDelBAInd,
5383 pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ),
5384 nPayload,
5385 &nPayload );
5386
5387 if( DOT11F_FAILED( nStatus ))
5388 {
5389 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005390 FL( "Failed to pack an DELBA Ind (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005391 nStatus );
5392
5393 // FIXME - Need to convert to tSirRetStatus
5394 statusCode = eSIR_FAILURE;
5395 goto returnAfterError;
5396 }
5397 else if( DOT11F_WARNED( nStatus ))
5398 {
5399 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005400 FL( "There were warnings while packing an DELBA Ind (0x%08x)." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005401 }
5402
5403 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005404 FL( "Sending a DELBA IND to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005405 limPrintMacAddr( pMac, pMlmDelBAReq->peerMacAddr, LOGW );
5406
5407 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005408 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5409 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005410 )
5411 {
5412 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5413 }
5414
5415 if( eHAL_STATUS_SUCCESS !=
5416 (halStatus = halTxFrame( pMac,
5417 pPacket,
5418 (tANI_U16) frameLen,
5419 HAL_TXRX_FRM_802_11_MGMT,
5420 ANI_TXDIR_TODS,
5421 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5422 limTxComplete,
5423 pDelBAIndBuffer, txFlag )))
5424 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005425 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005426 statusCode = eSIR_FAILURE;
5427 //Pkt will be freed up by the callback
5428 return statusCode;
5429 }
5430 else
5431 return eSIR_SUCCESS;
5432
5433 returnAfterError:
5434
5435 // Release buffer, if allocated
5436 if( NULL != pDelBAIndBuffer )
5437 palPktFree( pMac->hHdd,
5438 HAL_TXRX_FRM_802_11_MGMT,
5439 (void *) pDelBAIndBuffer,
5440 (void *) pPacket );
5441
5442 return statusCode;
5443}
5444
5445#if defined WLAN_FEATURE_VOWIFI
5446
5447/**
5448 * \brief Send a Neighbor Report Request Action frame
5449 *
5450 *
5451 * \param pMac Pointer to the global MAC structure
5452 *
5453 * \param pNeighborReq Address of a tSirMacNeighborReportReq
5454 *
5455 * \param peer mac address of peer station.
5456 *
5457 * \param psessionEntry address of session entry.
5458 *
5459 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5460 *
5461 *
5462 */
5463
5464tSirRetStatus
5465limSendNeighborReportRequestFrame(tpAniSirGlobal pMac,
5466 tpSirMacNeighborReportReq pNeighborReq,
5467 tSirMacAddr peer,
5468 tpPESession psessionEntry
5469 )
5470{
5471 tSirRetStatus statusCode = eSIR_SUCCESS;
5472 tDot11fNeighborReportRequest frm;
5473 tANI_U8 *pFrame;
5474 tpSirMacMgmtHdr pMacHdr;
5475 tANI_U32 nBytes, nPayload, nStatus;
5476 void *pPacket;
5477 eHalStatus halstatus;
5478 tANI_U8 txFlag = 0;
5479
5480 if ( psessionEntry == NULL )
5481 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005482 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Neighbor Report request action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07005483 return eSIR_FAILURE;
5484 }
5485 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
5486
5487 frm.Category.category = SIR_MAC_ACTION_RRM;
5488 frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ;
5489 frm.DialogToken.token = pNeighborReq->dialogToken;
5490
5491
5492 if( pNeighborReq->ssid_present )
5493 {
5494 PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID );
5495 }
5496
5497 nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload );
5498 if ( DOT11F_FAILED( nStatus ) )
5499 {
5500 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005501 "or a Neighbor Report Request(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005502 nStatus );
5503 // We'll fall back on the worst case scenario:
5504 nPayload = sizeof( tDot11fNeighborReportRequest );
5505 }
5506 else if ( DOT11F_WARNED( nStatus ) )
5507 {
5508 limLog( pMac, LOGW, FL("There were warnings while calculating"
5509 "the packed size for a Neighbor Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005510 "ort Request(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005511 }
5512
5513 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5514
5515 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5516 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5517 {
5518 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Neighbor "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005519 "Report Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005520 return eSIR_FAILURE;
5521 }
5522
5523 // Paranoia:
5524 palZeroMemory( pMac->hHdd, pFrame, nBytes );
5525
5526 // Copy necessary info to BD
5527 if( eSIR_SUCCESS !=
5528 (statusCode = limPopulateMacHeader( pMac,
5529 pFrame,
5530 SIR_MAC_MGMT_FRAME,
5531 SIR_MAC_MGMT_ACTION,
5532 peer, psessionEntry->selfMacAddr)))
5533 goto returnAfterError;
5534
5535 // Update A3 with the BSSID
5536 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5537
5538 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
5539
Chet Lanctot186b5732013-03-18 10:26:30 -07005540#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005541 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005542#endif
5543
Jeff Johnson295189b2012-06-20 16:38:30 -07005544 // Now, we're ready to "pack" the frames
5545 nStatus = dot11fPackNeighborReportRequest( pMac,
5546 &frm,
5547 pFrame + sizeof( tSirMacMgmtHdr ),
5548 nPayload,
5549 &nPayload );
5550
5551 if( DOT11F_FAILED( nStatus ))
5552 {
5553 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005554 FL( "Failed to pack an Neighbor Report Request (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005555 nStatus );
5556
5557 // FIXME - Need to convert to tSirRetStatus
5558 statusCode = eSIR_FAILURE;
5559 goto returnAfterError;
5560 }
5561 else if( DOT11F_WARNED( nStatus ))
5562 {
5563 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005564 FL( "There were warnings while packing Neighbor Report Request (0x%08x)." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005565 }
5566
5567 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005568 FL( "Sending a Neighbor Report Request to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 limPrintMacAddr( pMac, peer, LOGW );
5570
5571 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005572 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5573 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005574 )
5575 {
5576 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5577 }
5578
5579 if( eHAL_STATUS_SUCCESS !=
5580 (halstatus = halTxFrame( pMac,
5581 pPacket,
5582 (tANI_U16) nBytes,
5583 HAL_TXRX_FRM_802_11_MGMT,
5584 ANI_TXDIR_TODS,
5585 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5586 limTxComplete,
5587 pFrame, txFlag )))
5588 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005589 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005590 statusCode = eSIR_FAILURE;
5591 //Pkt will be freed up by the callback
5592 return statusCode;
5593 }
5594 else
5595 return eSIR_SUCCESS;
5596
5597returnAfterError:
5598 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5599
5600 return statusCode;
5601} // End limSendNeighborReportRequestFrame.
5602
5603/**
5604 * \brief Send a Link Report Action frame
5605 *
5606 *
5607 * \param pMac Pointer to the global MAC structure
5608 *
5609 * \param pLinkReport Address of a tSirMacLinkReport
5610 *
5611 * \param peer mac address of peer station.
5612 *
5613 * \param psessionEntry address of session entry.
5614 *
5615 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5616 *
5617 *
5618 */
5619
5620tSirRetStatus
5621limSendLinkReportActionFrame(tpAniSirGlobal pMac,
5622 tpSirMacLinkReport pLinkReport,
5623 tSirMacAddr peer,
5624 tpPESession psessionEntry
5625 )
5626{
5627 tSirRetStatus statusCode = eSIR_SUCCESS;
5628 tDot11fLinkMeasurementReport frm;
5629 tANI_U8 *pFrame;
5630 tpSirMacMgmtHdr pMacHdr;
5631 tANI_U32 nBytes, nPayload, nStatus;
5632 void *pPacket;
5633 eHalStatus halstatus;
5634 tANI_U8 txFlag = 0;
5635
5636
5637 if ( psessionEntry == NULL )
5638 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005639 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Link Report action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07005640 return eSIR_FAILURE;
5641 }
5642
5643 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
5644
5645 frm.Category.category = SIR_MAC_ACTION_RRM;
5646 frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT;
5647 frm.DialogToken.token = pLinkReport->dialogToken;
5648
5649
5650 //IEEE Std. 802.11 7.3.2.18. for the report element.
5651 //Even though TPC report an IE, it is represented using fixed fields since it is positioned
5652 //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4
5653 //and frame parser always expects IEs to come after all fixed fields. It is easier to handle
5654 //such case this way than changing the frame parser.
5655 frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID;
5656 frm.TPCEleLen.TPCLen = 2;
5657 frm.TxPower.txPower = pLinkReport->txPower;
5658 frm.LinkMargin.linkMargin = 0;
5659
5660 frm.RxAntennaId.antennaId = pLinkReport->rxAntenna;
5661 frm.TxAntennaId.antennaId = pLinkReport->txAntenna;
5662 frm.RCPI.rcpi = pLinkReport->rcpi;
5663 frm.RSNI.rsni = pLinkReport->rsni;
5664
5665 nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload );
5666 if ( DOT11F_FAILED( nStatus ) )
5667 {
5668 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005669 "or a Link Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005670 nStatus );
5671 // We'll fall back on the worst case scenario:
5672 nPayload = sizeof( tDot11fLinkMeasurementReport );
5673 }
5674 else if ( DOT11F_WARNED( nStatus ) )
5675 {
5676 limLog( pMac, LOGW, FL("There were warnings while calculating"
5677 "the packed size for a Link Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005678 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005679 }
5680
5681 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5682
5683 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5684 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5685 {
5686 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Link "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005687 "Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005688 return eSIR_FAILURE;
5689 }
5690
5691 // Paranoia:
5692 palZeroMemory( pMac->hHdd, pFrame, nBytes );
5693
5694 // Copy necessary info to BD
5695 if( eSIR_SUCCESS !=
5696 (statusCode = limPopulateMacHeader( pMac,
5697 pFrame,
5698 SIR_MAC_MGMT_FRAME,
5699 SIR_MAC_MGMT_ACTION,
5700 peer, psessionEntry->selfMacAddr)))
5701 goto returnAfterError;
5702
5703 // Update A3 with the BSSID
5704 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5705
5706 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
5707
Chet Lanctot186b5732013-03-18 10:26:30 -07005708#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005709 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005710#endif
5711
Jeff Johnson295189b2012-06-20 16:38:30 -07005712 // Now, we're ready to "pack" the frames
5713 nStatus = dot11fPackLinkMeasurementReport( pMac,
5714 &frm,
5715 pFrame + sizeof( tSirMacMgmtHdr ),
5716 nPayload,
5717 &nPayload );
5718
5719 if( DOT11F_FAILED( nStatus ))
5720 {
5721 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005722 FL( "Failed to pack an Link Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005723 nStatus );
5724
5725 // FIXME - Need to convert to tSirRetStatus
5726 statusCode = eSIR_FAILURE;
5727 goto returnAfterError;
5728 }
5729 else if( DOT11F_WARNED( nStatus ))
5730 {
5731 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005732 FL( "There were warnings while packing Link Report (0x%08x)." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005733 }
5734
5735 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005736 FL( "Sending a Link Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005737 limPrintMacAddr( pMac, peer, LOGW );
5738
5739 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005740 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5741 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005742 )
5743 {
5744 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5745 }
5746
5747 if( eHAL_STATUS_SUCCESS !=
5748 (halstatus = halTxFrame( pMac,
5749 pPacket,
5750 (tANI_U16) nBytes,
5751 HAL_TXRX_FRM_802_11_MGMT,
5752 ANI_TXDIR_TODS,
5753 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5754 limTxComplete,
5755 pFrame, txFlag )))
5756 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005757 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005758 statusCode = eSIR_FAILURE;
5759 //Pkt will be freed up by the callback
5760 return statusCode;
5761 }
5762 else
5763 return eSIR_SUCCESS;
5764
5765returnAfterError:
5766 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5767
5768 return statusCode;
5769} // End limSendLinkReportActionFrame.
5770
5771/**
5772 * \brief Send a Beacon Report Action frame
5773 *
5774 *
5775 * \param pMac Pointer to the global MAC structure
5776 *
5777 * \param dialog_token dialog token to be used in the action frame.
5778 *
5779 * \param num_report number of reports in pRRMReport.
5780 *
5781 * \param pRRMReport Address of a tSirMacRadioMeasureReport.
5782 *
5783 * \param peer mac address of peer station.
5784 *
5785 * \param psessionEntry address of session entry.
5786 *
5787 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5788 *
5789 *
5790 */
5791
5792tSirRetStatus
5793limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac,
5794 tANI_U8 dialog_token,
5795 tANI_U8 num_report,
5796 tpSirMacRadioMeasureReport pRRMReport,
5797 tSirMacAddr peer,
5798 tpPESession psessionEntry
5799 )
5800{
5801 tSirRetStatus statusCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005802 tANI_U8 *pFrame;
5803 tpSirMacMgmtHdr pMacHdr;
5804 tANI_U32 nBytes, nPayload, nStatus;
5805 void *pPacket;
5806 eHalStatus halstatus;
5807 tANI_U8 i;
5808 tANI_U8 txFlag = 0;
5809
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005810 tDot11fRadioMeasurementReport *frm =
5811 vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport));
5812 if (!frm) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005813 limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005814 return eSIR_FAILURE;
5815 }
5816
Jeff Johnson295189b2012-06-20 16:38:30 -07005817 if ( psessionEntry == NULL )
5818 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005819 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005820 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005821 return eSIR_FAILURE;
5822 }
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005823 palZeroMemory( pMac->hHdd, ( tANI_U8* )frm, sizeof( *frm ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005824
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005825 frm->Category.category = SIR_MAC_ACTION_RRM;
5826 frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT;
5827 frm->DialogToken.token = dialog_token;
Jeff Johnson295189b2012-06-20 16:38:30 -07005828
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005829 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 -07005830
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005831 for( i = 0 ; i < frm->num_MeasurementReport ; i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07005832 {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005833 frm->MeasurementReport[i].type = pRRMReport[i].type;
5834 frm->MeasurementReport[i].token = pRRMReport[i].token;
5835 frm->MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm)
Jeff Johnson295189b2012-06-20 16:38:30 -07005836 switch( pRRMReport[i].type )
5837 {
5838 case SIR_MAC_RRM_BEACON_TYPE:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005839 PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport );
5840 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
5841 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
5842 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07005843 break;
5844 default:
Gopichand Nakkala72717fd2013-02-08 12:23:45 +05305845 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
5846 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005847 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07005848 break;
5849 }
5850 }
5851
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005852 nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07005853 if ( DOT11F_FAILED( nStatus ) )
5854 {
5855 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005856 "or a Radio Measure Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005857 nStatus );
5858 // We'll fall back on the worst case scenario:
5859 nPayload = sizeof( tDot11fLinkMeasurementReport );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005860 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005861 return eSIR_FAILURE;
5862 }
5863 else if ( DOT11F_WARNED( nStatus ) )
5864 {
5865 limLog( pMac, LOGW, FL("There were warnings while calculating"
5866 "the packed size for a Radio Measure Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005867 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005868 }
5869
5870 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5871
5872 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5873 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5874 {
5875 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005876 "Report."), nBytes );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005877 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005878 return eSIR_FAILURE;
5879 }
5880
5881 // Paranoia:
5882 palZeroMemory( pMac->hHdd, pFrame, nBytes );
5883
5884 // Copy necessary info to BD
5885 if( eSIR_SUCCESS !=
5886 (statusCode = limPopulateMacHeader( pMac,
5887 pFrame,
5888 SIR_MAC_MGMT_FRAME,
5889 SIR_MAC_MGMT_ACTION,
5890 peer, psessionEntry->selfMacAddr)))
5891 goto returnAfterError;
5892
5893 // Update A3 with the BSSID
5894 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5895
5896 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
5897
Chet Lanctot186b5732013-03-18 10:26:30 -07005898#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005899 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005900#endif
5901
Jeff Johnson295189b2012-06-20 16:38:30 -07005902 // Now, we're ready to "pack" the frames
5903 nStatus = dot11fPackRadioMeasurementReport( pMac,
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005904 frm,
Jeff Johnson295189b2012-06-20 16:38:30 -07005905 pFrame + sizeof( tSirMacMgmtHdr ),
5906 nPayload,
5907 &nPayload );
5908
5909 if( DOT11F_FAILED( nStatus ))
5910 {
5911 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005912 FL( "Failed to pack an Radio Measure Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005913 nStatus );
5914
5915 // FIXME - Need to convert to tSirRetStatus
5916 statusCode = eSIR_FAILURE;
5917 goto returnAfterError;
5918 }
5919 else if( DOT11F_WARNED( nStatus ))
5920 {
5921 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005922 FL( "There were warnings while packing Radio Measure Report (0x%08x)." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005923 }
5924
5925 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005926 FL( "Sending a Radio Measure Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005927 limPrintMacAddr( pMac, peer, LOGW );
5928
5929 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005930 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5931 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005932 )
5933 {
5934 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5935 }
5936
5937 if( eHAL_STATUS_SUCCESS !=
5938 (halstatus = halTxFrame( pMac,
5939 pPacket,
5940 (tANI_U16) nBytes,
5941 HAL_TXRX_FRM_802_11_MGMT,
5942 ANI_TXDIR_TODS,
5943 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5944 limTxComplete,
5945 pFrame, txFlag )))
5946 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005947 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005948 statusCode = eSIR_FAILURE;
5949 //Pkt will be freed up by the callback
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005950 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005951 return statusCode;
5952 }
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07005953 else {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005954 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005955 return eSIR_SUCCESS;
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07005956 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005957
5958returnAfterError:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07005959 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Jeff Johnson295189b2012-06-20 16:38:30 -07005961 return statusCode;
5962} // End limSendBeaconReportActionFrame.
5963
5964#endif
5965
5966#ifdef WLAN_FEATURE_11W
5967/**
5968 * \brief Send SA query response action frame to peer
5969 *
5970 * \sa limSendSaQueryResponseFrame
5971 *
5972 *
5973 * \param pMac The global tpAniSirGlobal object
5974 *
Chet Lanctot186b5732013-03-18 10:26:30 -07005975 * \param transId Transaction identifier received in SA query request action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07005976 *
Chet Lanctot186b5732013-03-18 10:26:30 -07005977 * \param peer The Mac address of the AP to which this action frame is addressed
5978 *
5979 * \param psessionEntry The PE session entry
Jeff Johnson295189b2012-06-20 16:38:30 -07005980 *
5981 * \return eSIR_SUCCESS if setup completes successfully
5982 * eSIR_FAILURE is some problem is encountered
5983 */
5984
Chet Lanctot186b5732013-03-18 10:26:30 -07005985tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId,
Jeff Johnson295189b2012-06-20 16:38:30 -07005986tSirMacAddr peer,tpPESession psessionEntry)
5987{
5988
Chet Lanctot186b5732013-03-18 10:26:30 -07005989 tDot11fSaQueryRsp frm; // SA query reponse action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07005990 tANI_U8 *pFrame;
5991 tSirRetStatus nSirStatus;
5992 tpSirMacMgmtHdr pMacHdr;
Chet Lanctot186b5732013-03-18 10:26:30 -07005993 tANI_U32 nBytes, nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07005994 void *pPacket;
5995 eHalStatus halstatus;
Chet Lanctot186b5732013-03-18 10:26:30 -07005996 tANI_U8 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005997
5998 palZeroMemory( pMac->hHdd, ( tANI_U8* )&frm, sizeof( frm ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07005999 frm.Category.category = SIR_MAC_ACTION_SA_QUERY;
6000 /*11w action field is :
Jeff Johnson295189b2012-06-20 16:38:30 -07006001 action: 0 --> SA query request action frame
6002 action: 1 --> SA query response action frame */
Chet Lanctot186b5732013-03-18 10:26:30 -07006003 frm.Action.action = SIR_MAC_SA_QUERY_RSP;
6004 /*11w SA query response transId is same as
Jeff Johnson295189b2012-06-20 16:38:30 -07006005 SA query request transId*/
Chet Lanctot186b5732013-03-18 10:26:30 -07006006 vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006007
Chet Lanctot186b5732013-03-18 10:26:30 -07006008 nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload);
6009 if ( DOT11F_FAILED( nStatus ) )
6010 {
6011 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
6012 "or a SA Query Response (0x%08x)."),
6013 nStatus );
6014 // We'll fall back on the worst case scenario:
6015 nPayload = sizeof( tDot11fSaQueryRsp );
6016 }
6017 else if ( DOT11F_WARNED( nStatus ) )
6018 {
6019 limLog( pMac, LOGW, FL("There were warnings while calculating"
6020 "the packed size for an SA Query Response"
6021 " (0x%08x)."), nStatus );
6022 }
6023
Jeff Johnson295189b2012-06-20 16:38:30 -07006024 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6025 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6026 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6027 {
6028 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA query response"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006029 " action frame"), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006030 return eSIR_FAILURE;
6031 }
6032
6033 // Paranoia:
6034 palZeroMemory( pMac->hHdd, pFrame, nBytes );
6035
Chet Lanctot186b5732013-03-18 10:26:30 -07006036 // Copy necessary info to BD
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006037 nSirStatus = limPopulateMacHeader( pMac,
Chet Lanctot186b5732013-03-18 10:26:30 -07006038 pFrame,
6039 SIR_MAC_MGMT_FRAME,
6040 SIR_MAC_MGMT_ACTION,
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006041 peer, psessionEntry->selfMacAddr );
6042 if ( eSIR_SUCCESS != nSirStatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07006043 goto returnAfterError;
Jeff Johnson295189b2012-06-20 16:38:30 -07006044
Chet Lanctot186b5732013-03-18 10:26:30 -07006045 // Update A3 with the BSSID
Jeff Johnson295189b2012-06-20 16:38:30 -07006046 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6047
Chet Lanctot186b5732013-03-18 10:26:30 -07006048 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006049
Chet Lanctot186b5732013-03-18 10:26:30 -07006050 // Since this is a SA Query Response, set the "protect" (aka WEP) bit
6051 // in the FC
6052 if ( psessionEntry->limRmfEnabled )
Jeff Johnson295189b2012-06-20 16:38:30 -07006053 {
Chet Lanctot186b5732013-03-18 10:26:30 -07006054 pMacHdr->fc.wep = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07006055 }
6056
Chet Lanctot186b5732013-03-18 10:26:30 -07006057 // Pack 11w SA query response frame
6058 nStatus = dot11fPackSaQueryRsp( pMac,
6059 &frm,
6060 pFrame + sizeof( tSirMacMgmtHdr ),
6061 nPayload,
6062 &nPayload );
6063
6064 if ( DOT11F_FAILED( nStatus ))
6065 {
6066 limLog( pMac, LOGE,
6067 FL( "Failed to pack an SA Query Response (0x%08x)." ),
6068 nStatus );
6069 // FIXME - Need to convert to tSirRetStatus
6070 nSirStatus = eSIR_FAILURE;
6071 goto returnAfterError;
6072 }
6073 else if ( DOT11F_WARNED( nStatus ))
6074 {
6075 limLog( pMac, LOGW,
6076 FL( "There were warnings while packing SA Query Response (0x%08x)." ),
6077 nStatus);
6078 }
6079
6080 limLog( pMac, LOG1,
6081 FL( "Sending a SA Query Response to " ));
6082 limPrintMacAddr( pMac, peer, LOGW );
6083
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006084 if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) )
Chet Lanctot186b5732013-03-18 10:26:30 -07006085#ifdef WLAN_FEATURE_P2P
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006086 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6087 ( psessionEntry->pePersona == VOS_P2P_GO_MODE )
Chet Lanctot186b5732013-03-18 10:26:30 -07006088#endif
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006089 )
6090 {
6091 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6092 }
Chet Lanctot186b5732013-03-18 10:26:30 -07006093
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006094 halstatus = halTxFrame( pMac,
6095 pPacket,
6096 (tANI_U16) nBytes,
6097 HAL_TXRX_FRM_802_11_MGMT,
6098 ANI_TXDIR_TODS,
6099 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6100 limTxComplete,
6101 pFrame, txFlag );
6102 if ( eHAL_STATUS_SUCCESS != halstatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07006103 {
6104 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
6105 nSirStatus = eSIR_FAILURE;
6106 //Pkt will be freed up by the callback
6107 return nSirStatus;
6108 }
6109 else {
6110 return eSIR_SUCCESS;
6111 }
6112
6113returnAfterError:
6114 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6115 return nSirStatus;
6116} // End limSendSaQueryResponseFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07006117#endif