blob: ce05eaaf063d20cf91b5df667ff36305a2770c0e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kapil Gupta956c0c42017-06-16 19:24:31 +05302 * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Jeff Johnson295189b2012-06-20 16:38:30 -070026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/**
32 * \file limSendManagementFrames.c
33 *
34 * \brief Code for preparing and sending 802.11 Management frames
35 *
Kiet Lam842dad02014-02-18 18:44:02 -080036
Jeff Johnson295189b2012-06-20 16:38:30 -070037 *
38 */
39
40#include "sirApi.h"
41#include "aniGlobal.h"
42#include "sirMacProtDef.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070043#include "cfgApi.h"
44#include "utilsApi.h"
45#include "limTypes.h"
46#include "limUtils.h"
47#include "limSecurityUtils.h"
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -070048#include "limPropExtsUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070049#include "dot11f.h"
50#include "limStaHashApi.h"
51#include "schApi.h"
52#include "limSendMessages.h"
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -080053#include "limAssocUtils.h"
54#include "limFT.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080055#ifdef WLAN_FEATURE_11W
Satyanarayana Dash6f438272015-03-03 18:01:06 +053056#include "wniCfg.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080057#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -080058
Jeff Johnson295189b2012-06-20 16:38:30 -070059#if defined WLAN_FEATURE_VOWIFI
60#include "rrmApi.h"
61#endif
62
Jeff Johnson295189b2012-06-20 16:38:30 -070063#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070064
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +053065#define IS_BROADCAST_MAC(x) (((x[0] & x[1] & x[2] & x[3] & x[4] & x[5]) == 0xff) ? 1 : 0)
Jeff Johnson295189b2012-06-20 16:38:30 -070066////////////////////////////////////////////////////////////////////////
67
Kalikinkar dhara205da782014-03-21 15:49:32 -070068tSirRetStatus limStripOffExtCapIE(tpAniSirGlobal pMac,
69 tANI_U8 *addIE,
70 tANI_U16 *addnIELen,
71 tANI_U8 *pExtractedExtCapIEBuf )
72{
73 tANI_U8* tempbuf = NULL;
74 tANI_U16 tempLen = 0;
75 int left = *addnIELen;
76 tANI_U8 *ptr = addIE;
77 tANI_U8 elem_id, elem_len;
78
79 if (NULL == addIE)
80 {
81 PELOGE(limLog(pMac, LOG1, FL("NULL addIE pointer"));)
82 return eSIR_IGNORE_IE ;
83 }
84
85 tempbuf = vos_mem_malloc(left);
86 if ( NULL == tempbuf )
87 {
88 PELOGE(limLog(pMac, LOGE,
89 FL("Unable to allocate memory to store addn IE"));)
90 return eSIR_MEM_ALLOC_FAILED;
91 }
92
93 while(left >= 2)
94 {
95 elem_id = ptr[0];
96 elem_len = ptr[1];
97 left -= 2;
98 if (elem_len > left)
99 {
100 limLog( pMac, LOGE,
101 FL("Invalid IEs eid = %d elem_len=%d left=%d"),
102 elem_id,elem_len,left);
103 vos_mem_free(tempbuf);
104 return eSIR_FAILURE;
105 }
106 if ( !(DOT11F_EID_EXTCAP == elem_id) )
107 {
108 vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2);
109 tempLen += (elem_len + 2);
110 }
111 else
Hu Wangc12631c2016-08-11 09:57:03 +0800112 {
Kalikinkar dhara205da782014-03-21 15:49:32 -0700113 if ( NULL != pExtractedExtCapIEBuf )
114 {
115 vos_mem_set(pExtractedExtCapIEBuf,
116 DOT11F_IE_EXTCAP_MAX_LEN + 2, 0);
117 if (elem_len <= DOT11F_IE_EXTCAP_MAX_LEN )
118 {
119 vos_mem_copy (pExtractedExtCapIEBuf, &ptr[0],
120 elem_len + 2);
121 }
122 }
123 }
124 left -= elem_len;
125 ptr += (elem_len + 2);
126 }
127 vos_mem_copy (addIE, tempbuf, tempLen);
128 *addnIELen = tempLen;
129 vos_mem_free(tempbuf);
130 return eSIR_SUCCESS;
131}
132
133void limUpdateExtCapIEtoStruct(tpAniSirGlobal pMac,
134 tANI_U8 *pBuf,
135 tDot11fIEExtCap *pDst)
136{
137 tANI_U8 pOut[DOT11F_IE_EXTCAP_MAX_LEN];
Hu Wangc12631c2016-08-11 09:57:03 +0800138 tANI_U8 tag, len, *val;
Kalikinkar dhara205da782014-03-21 15:49:32 -0700139
140 if ( NULL == pBuf )
141 {
142 limLog( pMac, LOGE,
143 FL("Invalid Buffer Address"));
144 return;
145 }
146 if(NULL == pDst)
147 {
148 PELOGE(limLog(pMac, LOGE,
149 FL("NULL pDst pointer"));)
150 return ;
151 }
152
Hu Wangc12631c2016-08-11 09:57:03 +0800153 /* Get tlv */
154 tag = pBuf[0];
155 len = pBuf[1];
156 val = &pBuf[2];
157
158 if ( DOT11F_EID_EXTCAP != tag ||
159 len > DOT11F_IE_EXTCAP_MAX_LEN )
Kalikinkar dhara205da782014-03-21 15:49:32 -0700160 {
Mahesh A Saptasagare00ff532014-10-17 19:05:14 +0530161 limLog( pMac, LOG1,
Hu Wangc12631c2016-08-11 09:57:03 +0800162 FL("Invalid IEs eid = %d elem_len=%d "), tag, len);
Kalikinkar dhara205da782014-03-21 15:49:32 -0700163 return;
164 }
Kalikinkar dhara205da782014-03-21 15:49:32 -0700165
Hu Wangc12631c2016-08-11 09:57:03 +0800166 vos_mem_zero(pOut, DOT11F_IE_EXTCAP_MAX_LEN);
167 vos_mem_copy(pOut, val, len);
Kalikinkar dhara205da782014-03-21 15:49:32 -0700168 if ( DOT11F_PARSE_SUCCESS != dot11fUnpackIeExtCap( pMac,
Hu Wangc12631c2016-08-11 09:57:03 +0800169 pOut, len, pDst) )
Kalikinkar dhara205da782014-03-21 15:49:32 -0700170 {
171 limLog( pMac, LOGE,
172 FL("dot11fUnpackIeExtCap Parse Error "));
173 }
174}
175
176tSirRetStatus limStripOffExtCapIEAndUpdateStruct(tpAniSirGlobal pMac,
177 tANI_U8* addIE,
178 tANI_U16 *addnIELen,
179 tDot11fIEExtCap * pDst )
180{
181 tANI_U8 pExtractedExtCapIEBuf[DOT11F_IE_EXTCAP_MAX_LEN + 2];
182 tSirRetStatus nSirStatus;
183
184 vos_mem_set(( tANI_U8* )&pExtractedExtCapIEBuf[0],
185 DOT11F_IE_EXTCAP_MAX_LEN + 2, 0);
186 nSirStatus = limStripOffExtCapIE(pMac, addIE, addnIELen,
187 pExtractedExtCapIEBuf);
188 if ( eSIR_SUCCESS != nSirStatus )
189 {
190 limLog( pMac, LOG1, FL("Failed to strip off in"
191 "limStripOffExtCapIE status = (%d)."),
192 nSirStatus );
193 return nSirStatus;
194 }
195 /* update the extracted ExtCap to struct*/
196 limUpdateExtCapIEtoStruct(pMac, pExtractedExtCapIEBuf, pDst);
197 return nSirStatus;
198}
199
200void limMergeExtCapIEStruct(tDot11fIEExtCap *pDst,
Hu Wang5193b572016-08-11 10:04:47 +0800201 tDot11fIEExtCap *pSrc,
202 bool add)
Kalikinkar dhara205da782014-03-21 15:49:32 -0700203{
Hu Wang5193b572016-08-11 10:04:47 +0800204 tANI_U8 *tempDst = (tANI_U8 *)pDst->bytes;
205 tANI_U8 *tempSrc = (tANI_U8 *)pSrc->bytes;
206 tANI_U8 structlen = DOT11F_IE_EXTCAP_MAX_LEN;
Kalikinkar dhara205da782014-03-21 15:49:32 -0700207
Hu Wang5193b572016-08-11 10:04:47 +0800208 // if src is not present, nothing to do
209 if(!pSrc->present) {
210 return;
211 }
212
213 // if dst is not present, and add=false, nothing to do
214 if (!pDst->present && !add) {
215 return;
216 }
217
218 // in other cases, need to merge the bits
219 pDst->present = 1;
Kalikinkar dhara205da782014-03-21 15:49:32 -0700220 while(tempDst && tempSrc && structlen--)
221 {
Hu Wang5193b572016-08-11 10:04:47 +0800222 if (add) {
223 *tempDst |= *tempSrc;
224 } else {
225 *tempDst &= *tempSrc;
226 }
Kalikinkar dhara205da782014-03-21 15:49:32 -0700227 tempDst++;
228 tempSrc++;
229 }
Hu Wangc12631c2016-08-11 09:57:03 +0800230 pDst->num_bytes = lim_compute_ext_cap_ie_length(pDst);
Hu Wang5193b572016-08-11 10:04:47 +0800231
232 // if all bits are zero, it means it is not prsent.
233 if (pDst->num_bytes == 0) {
234 pDst->present = 0;
235 }
Kalikinkar dhara205da782014-03-21 15:49:32 -0700236}
Jeff Johnson295189b2012-06-20 16:38:30 -0700237
238/**
239 *
240 * \brief This function is called by various LIM modules to prepare the
241 * 802.11 frame MAC header
242 *
243 *
244 * \param pMac Pointer to Global MAC structure
245 *
246 * \param pBD Pointer to the frame buffer that needs to be populate
247 *
248 * \param type Type of the frame
249 *
250 * \param subType Subtype of the frame
251 *
252 * \return eHalStatus
253 *
254 *
255 * The pFrameBuf argument points to the beginning of the frame buffer to
256 * which - a) The 802.11 MAC header is set b) Following this MAC header
257 * will be the MGMT frame payload The payload itself is populated by the
258 * caller API
259 *
260 *
261 */
262
263tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac,
264 tANI_U8* pBD,
265 tANI_U8 type,
266 tANI_U8 subType,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530267 tSirMacAddr peerAddr, tSirMacAddr selfMacAddr)
Jeff Johnson295189b2012-06-20 16:38:30 -0700268{
269 tSirRetStatus statusCode = eSIR_SUCCESS;
270 tpSirMacMgmtHdr pMacHdr;
271
272 /// Prepare MAC management header
273 pMacHdr = (tpSirMacMgmtHdr) (pBD);
274
275 // Prepare FC
276 pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
277 pMacHdr->fc.type = type;
278 pMacHdr->fc.subType = subType;
279
280 // Prepare Address 1
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530281 vos_mem_copy( (tANI_U8 *) pMacHdr->da,
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 (tANI_U8 *) peerAddr,
283 sizeof( tSirMacAddr ));
284
285 // Prepare Address 2
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 sirCopyMacAddr(pMacHdr->sa,selfMacAddr);
287
288 // Prepare Address 3
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530289 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 (tANI_U8 *) peerAddr,
291 sizeof( tSirMacAddr ));
292 return statusCode;
293} /*** end limPopulateMacHeader() ***/
294
295/**
296 * \brief limSendProbeReqMgmtFrame
297 *
298 *
299 * \param pMac Pointer to Global MAC structure
300 *
301 * \param pSsid SSID to be sent in Probe Request frame
302 *
303 * \param bssid BSSID to be sent in Probe Request frame
304 *
305 * \param nProbeDelay probe delay to be used before sending Probe Request
306 * frame
307 *
308 * \param nChannelNum Channel # on which the Probe Request is going out
309 *
310 * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame
311 *
312 * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame
313 *
314 * This function is called by various LIM modules to send Probe Request frame
315 * during active scan/learn phase.
316 * Probe request is sent out in the following scenarios:
317 * --heartbeat failure: session needed
318 * --join req: session needed
319 * --foreground scan: no session
320 * --background scan: no session
321 * --schBeaconProcessing: to get EDCA parameters: session needed
322 *
323 *
324 */
325tSirRetStatus
326limSendProbeReqMgmtFrame(tpAniSirGlobal pMac,
327 tSirMacSSid *pSsid,
328 tSirMacAddr bssid,
329 tANI_U8 nChannelNum,
330 tSirMacAddr SelfMacAddr,
331 tANI_U32 dot11mode,
332 tANI_U32 nAdditionalIELen,
333 tANI_U8 *pAdditionalIE)
334{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530335 tDot11fProbeRequest pr;
336 tANI_U32 nStatus, nBytes, nPayload;
337 tSirRetStatus nSirStatus;
338 tANI_U8 *pFrame;
339 void *pPacket;
340 eHalStatus halstatus;
341 tpPESession psessionEntry;
342 tANI_U8 sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 tANI_U8 *p2pIe = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530344 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700345
346#ifndef GEN4_SCAN
347 return eSIR_FAILURE;
348#endif
349
350#if defined ( ANI_DVT_DEBUG )
351 return eSIR_FAILURE;
352#endif
353
Abhishek Singh4beed422014-02-03 16:47:17 +0530354 /* The probe req should not send 11ac capabilieties if band is 2.4GHz,
355 * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz
356 * is false and dot11mode is 11ac set it to 11n.
357 */
358 if ( nChannelNum <= SIR_11B_CHANNEL_END &&
359 ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) &&
360 ( WNI_CFG_DOT11_MODE_11AC == dot11mode ||
361 WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) )
362 dot11mode = WNI_CFG_DOT11_MODE_11N;
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 /*
364 * session context may or may not be present, when probe request needs to be sent out.
365 * following cases exist:
366 * --heartbeat failure: session needed
367 * --join req: session needed
368 * --foreground scan: no session
369 * --background scan: no session
370 * --schBeaconProcessing: to get EDCA parameters: session needed
371 * If session context does not exist, some IEs will be populated from CFGs,
372 * e.g. Supported and Extended rate set IEs
373 */
374 psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId);
375
376 // The scheme here is to fill out a 'tDot11fProbeRequest' structure
377 // and then hand it off to 'dot11fPackProbeRequest' (for
378 // serialization). We start by zero-initializing the structure:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530379 vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700380
381 // & delegating to assorted helpers:
382 PopulateDot11fSSID( pMac, pSsid, &pr.SSID );
383
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 if( nAdditionalIELen && pAdditionalIE )
385 {
386 p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen);
387 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700388 /* Don't include 11b rate only when device is doing P2P Search */
389 if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) &&
390 ( p2pIe != NULL ) &&
391 /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */
392 ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
393 pMac->lim.gpLimMlmScanReq->p2pSearch ) ||
394 ( ( psessionEntry != NULL ) &&
395 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
396 )
397 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 {
399 /* In the below API pass channel number > 14, do that it fills only
400 * 11a rates in supported rates */
401 PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry);
402 }
403 else
404 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 PopulateDot11fSuppRates( pMac, nChannelNum,
406 &pr.SuppRates,psessionEntry);
407
408 if ( WNI_CFG_DOT11_MODE_11B != dot11mode )
409 {
410 PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates );
411 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700413
414#if defined WLAN_FEATURE_VOWIFI
415 //Table 7-14 in IEEE Std. 802.11k-2008 says
416 //DS params "can" be present in RRM is disabled and "is" present if
417 //RRM is enabled. It should be ok even if we add it into probe req when
418 //RRM is not enabled.
419 PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry );
420 //Call RRM module to get the tx power for management used.
421 {
422 tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry );
423 PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 );
424 }
425#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700426
427 if (psessionEntry != NULL ) {
Jeff Johnsone7245742012-09-05 17:12:55 -0700428 psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 //Include HT Capability IE
Jeff Johnsone7245742012-09-05 17:12:55 -0700430 if (psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -0700431 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700432 PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700434 } else { //psessionEntry == NULL
435 if (IS_DOT11_MODE_HT(dot11mode))
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700437 PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 }
439 }
Gopichand Nakkala40bc6502012-12-20 16:55:36 -0800440
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +0530441 if((nChannelNum <= SIR_11B_CHANNEL_END)
442 && (!IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
443 && (!pMac->roam.configParam.channelBondingMode24GHz))
Gopichand Nakkala40bc6502012-12-20 16:55:36 -0800444 {
445 pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
446 pr.HTCaps.shortGI40MHz = 0;
447 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700448#ifdef WLAN_FEATURE_11AC
449 if (psessionEntry != NULL ) {
450 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode);
451 //Include HT Capability IE
452 if (psessionEntry->vhtCapability)
453 {
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530454 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps,
455 psessionEntry->currentOperChannel , eSIR_FALSE );
Jeff Johnsone7245742012-09-05 17:12:55 -0700456 }
457 } else {
458 if (IS_DOT11_MODE_VHT(dot11mode))
459 {
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530460 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, nChannelNum, eSIR_FALSE );
Jeff Johnsone7245742012-09-05 17:12:55 -0700461 }
462 }
463#endif
464
Jeff Johnson295189b2012-06-20 16:38:30 -0700465
466 // That's it-- now we pack it. First, how much space are we going to
467 // need?
468 nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload );
469 if ( DOT11F_FAILED( nStatus ) )
470 {
471 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700472 "or a Probe Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 // We'll fall back on the worst case scenario:
474 nPayload = sizeof( tDot11fProbeRequest );
475 }
476 else if ( DOT11F_WARNED( nStatus ) )
477 {
478 limLog( pMac, LOGW, FL("There were warnings while calculating"
479 "the packed size for a Probe Request ("
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700480 "0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 }
482
483 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen;
484
485 // Ok-- try to allocate some memory:
486 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
487 ( tANI_U16 )nBytes, ( void** ) &pFrame,
488 ( void** ) &pPacket );
489 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
490 {
491 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 "be Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 return eSIR_MEM_ALLOC_FAILED;
494 }
495
496 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530497 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700498
499 // Next, we fill out the buffer descriptor:
500 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530501 SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 if ( eSIR_SUCCESS != nSirStatus )
503 {
504 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700505 "tor for a Probe Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 nSirStatus );
507 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
508 ( void* ) pFrame, ( void* ) pPacket );
509 return nSirStatus; // allocated!
510 }
511
512 // That done, pack the Probe Request:
513 nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame +
514 sizeof( tSirMacMgmtHdr ),
515 nPayload, &nPayload );
516 if ( DOT11F_FAILED( nStatus ) )
517 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 nStatus );
520 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
521 return eSIR_FAILURE; // allocated!
522 }
523 else if ( DOT11F_WARNED( nStatus ) )
524 {
525 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800526 "robe Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 }
528
529 // Append any AddIE if present.
530 if( nAdditionalIELen )
531 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530532 vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 pAdditionalIE, nAdditionalIELen );
534 nPayload += nAdditionalIELen;
535 }
536
537 /* If this probe request is sent during P2P Search State, then we need
538 * to send it at OFDM rate.
539 */
540 if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum))
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 || (( pMac->lim.gpLimMlmScanReq != NULL) &&
542 pMac->lim.gpLimMlmScanReq->p2pSearch )
Gopichand Nakkala67967212013-02-15 17:31:15 +0530543 /* For unicast probe req mgmt from Join function
544 we don't set above variables. So we need to add
545 one more check whether it is pePersona is P2P_CLIENT or not */
546 || ( ( psessionEntry != NULL ) &&
547 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 )
549 {
550 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
551 }
552
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +0530553 if( ( psessionEntry != NULL ) && ( psessionEntry->is11Gonly == true ) &&
554 ( !IS_BROADCAST_MAC(bssid) ) ){
555 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
556 }
557
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload,
559 HAL_TXRX_FRM_802_11_MGMT,
560 ANI_TXDIR_TODS,
561 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
562 limTxComplete, pFrame, txFlag );
563 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
564 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700565 limLog( pMac, LOGE, FL("could not send Probe Request frame!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 //Pkt will be freed up by the callback
567 return eSIR_FAILURE;
568 }
569
570 return eSIR_SUCCESS;
571} // End limSendProbeReqMgmtFrame.
572
Jeff Johnson295189b2012-06-20 16:38:30 -0700573tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac,
574 tANI_U8* addIE, tANI_U16 *addnIELen,
575 tANI_U8 probeReqP2pIe)
576{
577 /* If Probe request doesn't have P2P IE, then take out P2P IE
578 from additional IE */
579 if(!probeReqP2pIe)
580 {
581 tANI_U8* tempbuf = NULL;
582 tANI_U16 tempLen = 0;
583 int left = *addnIELen;
584 v_U8_t *ptr = addIE;
585 v_U8_t elem_id, elem_len;
586
587 if(NULL == addIE)
588 {
589 PELOGE(limLog(pMac, LOGE,
590 FL(" NULL addIE pointer"));)
591 return eSIR_FAILURE;
592 }
593
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530594 tempbuf = vos_mem_malloc(left);
595 if ( NULL == tempbuf )
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 {
597 PELOGE(limLog(pMac, LOGE,
598 FL("Unable to allocate memory to store addn IE"));)
599 return eSIR_MEM_ALLOC_FAILED;
600 }
601
602 while(left >= 2)
603 {
604 elem_id = ptr[0];
605 elem_len = ptr[1];
606 left -= 2;
607 if(elem_len > left)
608 {
609 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700610 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 elem_id,elem_len,left);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530612 vos_mem_free(tempbuf);
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 return eSIR_FAILURE;
614 }
615 if ( !( (SIR_MAC_EID_VENDOR == elem_id) &&
616 (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) )
617 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530618 vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2);
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 tempLen += (elem_len + 2);
620 }
621 left -= elem_len;
622 ptr += (elem_len + 2);
623 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530624 vos_mem_copy (addIE, tempbuf, tempLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 *addnIELen = tempLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530626 vos_mem_free(tempbuf);
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 }
628 return eSIR_SUCCESS;
629}
Jeff Johnson295189b2012-06-20 16:38:30 -0700630
631void
632limSendProbeRspMgmtFrame(tpAniSirGlobal pMac,
633 tSirMacAddr peerMacAddr,
634 tpAniSSID pSsid,
635 short nStaId,
636 tANI_U8 nKeepAlive,
637 tpPESession psessionEntry,
638 tANI_U8 probeReqP2pIe)
639{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700640 tDot11fProbeResponse *pFrm;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530641 tSirRetStatus nSirStatus;
c_hpothubcd78652014-04-28 22:31:08 +0530642 tANI_U32 cfg, nPayload, nStatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530643 tpSirMacMgmtHdr pMacHdr;
644 tANI_U8 *pFrame;
645 void *pPacket;
646 eHalStatus halstatus;
647 tANI_U32 addnIEPresent;
648 tANI_U32 addnIE1Len=0;
649 tANI_U32 addnIE2Len=0;
650 tANI_U32 addnIE3Len=0;
651 tANI_U16 totalAddnIeLen = 0;
652 tANI_U32 wpsApEnable=0, tmp;
653 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 tANI_U8 *addIE = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530655 tANI_U8 *pP2pIe = NULL;
656 tANI_U8 noaLen = 0;
657 tANI_U8 total_noaLen = 0;
658 tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 + SIR_P2P_IE_HEADER_LEN];
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530660 tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
Kalikinkar dhara205da782014-03-21 15:49:32 -0700661 tDot11fIEExtCap extractedExtCap;
662 tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE;
c_hpothubcd78652014-04-28 22:31:08 +0530663 tANI_U32 nBytes = 0;
664
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests
666 {
667 return; // in this case.
668 }
669
670 if(NULL == psessionEntry)
671 {
672 return;
673 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530674
675 pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse));
676 if ( NULL == pFrm )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700677 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530678 limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700679 return;
680 }
681
Girish Gowli0e826792014-05-17 17:56:44 +0530682 vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0);
683
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 // Fill out 'frm', after which we'll just hand the struct off to
685 // 'dot11fPackProbeResponse'.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530686 vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700687
688 // Timestamp to be updated by TFP, below.
689
690 // Beacon Interval:
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
692 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700693 pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 }
695 else
696 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800697 nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg);
698 if (eSIR_SUCCESS != nSirStatus)
699 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700700 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BEACON_INTERVAL from CFG (%d)."),
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800701 nSirStatus );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530702 vos_mem_free(pFrm);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800703 return;
704 }
705 pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg;
Madan Mohan Koyyalamudic0d1b3f2012-11-13 10:41:07 -0800706 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700707
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700708 PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry );
709 PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700711 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700712
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700713 PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry);
714 PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700715
Jeff Johnson295189b2012-06-20 16:38:30 -0700716
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
718 {
719 if(psessionEntry->wps_state != SAP_WPS_DISABLED)
720 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700721 PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 }
723 }
724 else
725 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800726 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700727 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_ENABLE );
Jeff Johnson295189b2012-06-20 16:38:30 -0700728
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800729 wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
Jeff Johnson295189b2012-06-20 16:38:30 -0700730
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800731 if (wpsApEnable)
732 {
733 PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes);
734 }
735
736 if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
737 {
738 PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
739 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
740 }
741
742 if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
743 {
744 DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
745 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
746 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700748
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700749 PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry);
750 PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700751
Jeff Johnson295189b2012-06-20 16:38:30 -0700752
753 if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700754 PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700755
756
757 // N.B. In earlier implementations, the RSN IE would be placed in
758 // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined.
759 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700760 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700761
762 //Populate HT IEs, when operating in 11n or Taurus modes.
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700765 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700766 PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530768
769#ifdef WLAN_FEATURE_AP_HT40_24G
770 /* Populate Overlapping BSS Scan Parameters IEs,
771 * when operating in HT40 in 2.4GHz.
772 */
Hardik Kantilal Patel3c235242015-01-02 17:56:18 +0530773 if ((pMac->roam.configParam.apHT40_24GEnabled)
774 && (IS_DOT11_MODE_HT(psessionEntry->dot11mode)))
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530775 {
776 PopulateDot11fOBSSScanParameters( pMac, &pFrm->OBSSScanParameters,
777 psessionEntry);
Hardik Kantilal Patelee5874c2015-01-14 15:23:28 +0530778 /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in
779 * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK
780 * Mode in 40 MHz bit in HT capablity.
781 */
782 pFrm->HTCaps.dsssCckMode40MHz = 1;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530783 }
784#endif
785
786 PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
787
Jeff Johnsone7245742012-09-05 17:12:55 -0700788#ifdef WLAN_FEATURE_11AC
789 if(psessionEntry->vhtCapability)
790 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800791 limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530792 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps,
793 psessionEntry->currentOperChannel, eSIR_TRUE );
794 PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ,
795 psessionEntry->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -0700796 // we do not support multi users yet
797 //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad );
798 }
799#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700800
Sandeep Puligilla60342762014-01-30 21:05:37 +0530801
Hardik Kantilal Patelee5874c2015-01-14 15:23:28 +0530802 if ( psessionEntry->pLimStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 {
804 PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700805 &pFrm->WPA );
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700806 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
807 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 }
809
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700810 PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700811
812#if defined(FEATURE_WLAN_WAPI)
813 if( psessionEntry->pLimStartBssReq )
814 {
815 PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700816 &pFrm->WAPI );
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 }
818
819#endif // defined(FEATURE_WLAN_WAPI)
820
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 addnIEPresent = false;
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 if( pMac->lim.gpLimRemainOnChanReq )
823 {
824 nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) );
825 }
826 //Only use CFG for non-listen mode. This CFG is not working for concurrency
827 //In listening mode, probe rsp IEs is passed in the message from SME to PE
828 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 {
830
831 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
832 &addnIEPresent) != eSIR_SUCCESS)
833 {
834 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530835 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 return;
837 }
838 }
839
840 if (addnIEPresent)
841 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530842
843 addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3);
844 if ( NULL == addIE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 {
846 PELOGE(limLog(pMac, LOGE,
847 FL("Unable to allocate memory to store addn IE"));)
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530848 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 return;
850 }
851
852 //Probe rsp IE available
853 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
854 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) )
855 {
856 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530857 vos_mem_free(addIE);
858 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 return;
860 }
861 if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len &&
862 (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE)
863 {
864 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
865 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0],
866 &addnIE1Len) )
867 {
868 limLog(pMac, LOGP,
869 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530870 vos_mem_free(addIE);
871 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 return;
873 }
874 }
875
876 //Probe rsp IE available
877 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
878 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) )
879 {
880 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530881 vos_mem_free(addIE);
882 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 return;
884 }
885 if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len &&
886 (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE)
887 {
888 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
889 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len],
890 &addnIE2Len) )
891 {
892 limLog(pMac, LOGP,
893 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530894 vos_mem_free(addIE);
895 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 return;
897 }
898 }
899
900 //Probe rsp IE available
901 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
902 WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) )
903 {
904 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530905 vos_mem_free(addIE);
906 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 return;
908 }
909 if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len &&
910 (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE)
911 {
912 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
913 WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
914 &addIE[addnIE1Len + addnIE2Len],
915 &addnIE3Len) )
916 {
917 limLog(pMac, LOGP,
918 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530919 vos_mem_free(addIE);
920 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 return;
922 }
923 }
924 totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len;
925
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe))
927 {
928 limLog(pMac, LOGP,
929 FL("Unable to get final Additional IE for Probe Req"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530930 vos_mem_free(addIE);
931 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700932 return;
933 }
Kalikinkar dhara205da782014-03-21 15:49:32 -0700934
Kalikinkar dhara205da782014-03-21 15:49:32 -0700935 nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac,
936 addIE,
937 &totalAddnIeLen,
938 &extractedExtCap );
939 if(eSIR_SUCCESS != nSirStatus )
940 {
941 extractedExtCapFlag = eANI_BOOLEAN_FALSE;
942 limLog(pMac, LOG1,
943 FL("Unable to Stripoff ExtCap IE from Probe Rsp"));
944 }
945
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 nBytes = nBytes + totalAddnIeLen;
Kaushik, Sushanta5ee77a2014-07-30 19:35:25 +0530947 limLog(pMac, LOG1,
948 FL("probe rsp packet size is %d "), nBytes);
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 if (probeReqP2pIe)
950 {
951 pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen);
952 if (pP2pIe != NULL)
953 {
954 //get NoA attribute stream P2P IE
955 noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
956 if (noaLen != 0)
957 {
958 total_noaLen = limBuildP2pIe(pMac, &noaIe[0],
959 &noaStream[0], noaLen);
960 nBytes = nBytes + total_noaLen;
Kaushik, Sushanta5ee77a2014-07-30 19:35:25 +0530961 limLog(pMac, LOG1,
962 FL("p2p probe rsp packet size is %d, noalength is %d"),
963 nBytes, total_noaLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 }
965 }
966 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700967 }
968
c_hpothubcd78652014-04-28 22:31:08 +0530969 /*merge ExtCap IE*/
970 if (extractedExtCapFlag && extractedExtCap.present)
971 {
Hu Wang5193b572016-08-11 10:04:47 +0800972 limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap, true);
c_hpothubcd78652014-04-28 22:31:08 +0530973 }
974
975 nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload );
976 if ( DOT11F_FAILED( nStatus ) )
977 {
978 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
979 "or a Probe Response (0x%08x)."),
980 nStatus );
981 // We'll fall back on the worst case scenario:
982 nPayload = sizeof( tDot11fProbeResponse );
983 }
984 else if ( DOT11F_WARNED( nStatus ) )
985 {
986 limLog( pMac, LOGW, FL("There were warnings while calculating"
987 "the packed size for a Probe Response "
988 "(0x%08x)."), nStatus );
989 }
990
991 nBytes += nPayload + sizeof( tSirMacMgmtHdr );
992
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
994 ( tANI_U16 )nBytes, ( void** ) &pFrame,
995 ( void** ) &pPacket );
996 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
997 {
998 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700999 "be Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 if ( addIE != NULL )
1001 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301002 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301004 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 return;
1006 }
1007
1008 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301009 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001010
1011 // Next, we fill out the buffer descriptor:
1012 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1013 SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr);
1014 if ( eSIR_SUCCESS != nSirStatus )
1015 {
1016 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001017 "tor for a Probe Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001018 nSirStatus );
1019 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1020 ( void* ) pFrame, ( void* ) pPacket );
1021 if ( addIE != NULL )
1022 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301023 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301025 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 return;
1027 }
1028
1029 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1030
1031 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1032
1033 // That done, pack the Probe Response:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001034 nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr),
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 nPayload, &nPayload );
1036 if ( DOT11F_FAILED( nStatus ) )
1037 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001038 limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001039 nStatus );
1040 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1041 if ( addIE != NULL )
1042 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301043 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301045 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 return; // allocated!
1047 }
1048 else if ( DOT11F_WARNED( nStatus ) )
1049 {
1050 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001051 "robe Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001052 }
1053
1054 PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") );
1055 limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
1056
1057 pMac->sys.probeRespond++;
1058
Jeff Johnson295189b2012-06-20 16:38:30 -07001059 if( pMac->lim.gpLimRemainOnChanReq )
1060 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301061 vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) );
1063 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001064
1065 if ( addnIEPresent )
1066 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301067 vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 if (noaLen != 0)
1070 {
Krunal Soni81b24262013-05-15 17:46:41 -07001071 if (total_noaLen > (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN))
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 {
1073 limLog(pMac, LOGE,
Kaushik, Sushant96ac9d72013-12-11 19:28:10 +05301074 FL("Not able to insert NoA because of length constraint."
1075 "Total Length is :%d"),total_noaLen);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301076 vos_mem_free(addIE);
1077 vos_mem_free(pFrm);
Krunal Soni81b24262013-05-15 17:46:41 -07001078 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1079 ( void* ) pFrame, ( void* ) pPacket );
1080 return;
1081 }
1082 else
1083 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301084 vos_mem_copy( &pFrame[nBytes - (total_noaLen)],
Krunal Soni81b24262013-05-15 17:46:41 -07001085 &noaIe[0], total_noaLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001086 }
1087 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001088
1089 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1091 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 )
1093 {
1094 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1095 }
1096
1097 // Queue Probe Response frame in high priority WQ
1098 halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket,
1099 ( tANI_U16 ) nBytes,
1100 HAL_TXRX_FRM_802_11_MGMT,
1101 ANI_TXDIR_TODS,
1102 7,//SMAC_SWBD_TX_TID_MGMT_LOW,
1103 limTxComplete, pFrame, txFlag );
1104 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1105 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001106 limLog( pMac, LOGE, FL("Could not send Probe Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 //Pkt will be freed up by the callback
1108 }
1109
1110 if ( addIE != NULL )
1111 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301112 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 }
1114
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301115 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001116 return;
1117
1118
Jeff Johnson295189b2012-06-20 16:38:30 -07001119} // End limSendProbeRspMgmtFrame.
1120
1121void
1122limSendAddtsReqActionFrame(tpAniSirGlobal pMac,
1123 tSirMacAddr peerMacAddr,
1124 tSirAddtsReqInfo *pAddTS,
1125 tpPESession psessionEntry)
1126{
1127 tANI_U16 i;
1128 tANI_U8 *pFrame;
1129 tSirRetStatus nSirStatus;
1130 tDot11fAddTSRequest AddTSReq;
1131 tDot11fWMMAddTSRequest WMMAddTSReq;
1132 tANI_U32 nPayload, nBytes, nStatus;
1133 tpSirMacMgmtHdr pMacHdr;
1134 void *pPacket;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001135#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 tANI_U32 phyMode;
1137#endif
1138 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301139 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001140
1141 if(NULL == psessionEntry)
1142 {
1143 return;
1144 }
1145
1146 if ( ! pAddTS->wmeTspecPresent )
1147 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301148 vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001149
1150 AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
1151 AddTSReq.DialogToken.token = pAddTS->dialogToken;
1152 AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1153 if ( pAddTS->lleTspecPresent )
1154 {
1155 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC );
1156 }
1157 else
1158 {
1159 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC );
1160 }
1161
1162 if ( pAddTS->lleTspecPresent )
1163 {
1164 AddTSReq.num_WMMTCLAS = 0;
1165 AddTSReq.num_TCLAS = pAddTS->numTclas;
1166 for ( i = 0; i < pAddTS->numTclas; ++i)
1167 {
1168 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
1169 &AddTSReq.TCLAS[i] );
1170 }
1171 }
1172 else
1173 {
1174 AddTSReq.num_TCLAS = 0;
1175 AddTSReq.num_WMMTCLAS = pAddTS->numTclas;
1176 for ( i = 0; i < pAddTS->numTclas; ++i)
1177 {
1178 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1179 &AddTSReq.WMMTCLAS[i] );
1180 }
1181 }
1182
1183 if ( pAddTS->tclasProcPresent )
1184 {
1185 if ( pAddTS->lleTspecPresent )
1186 {
1187 AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc;
1188 AddTSReq.TCLASSPROC.present = 1;
1189 }
1190 else
1191 {
1192 AddTSReq.WMMTCLASPROC.version = 1;
1193 AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc;
1194 AddTSReq.WMMTCLASPROC.present = 1;
1195 }
1196 }
1197
1198 nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload );
1199 if ( DOT11F_FAILED( nStatus ) )
1200 {
1201 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001202 "or an Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 nStatus );
1204 // We'll fall back on the worst case scenario:
1205 nPayload = sizeof( tDot11fAddTSRequest );
1206 }
1207 else if ( DOT11F_WARNED( nStatus ) )
1208 {
1209 limLog( pMac, LOGW, FL("There were warnings while calculating"
1210 "the packed size for an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001211 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 }
1213 }
1214 else
1215 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301216 vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001217
1218 WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
1219 WMMAddTSReq.DialogToken.token = pAddTS->dialogToken;
1220 WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME;
1221
1222 // WMM spec 2.2.10 - status code is only filled in for ADDTS response
1223 WMMAddTSReq.StatusCode.statusCode = 0;
1224
1225 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001226#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 limGetPhyMode(pMac, &phyMode, psessionEntry);
1228
1229 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
1230 {
1231 pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
1232 }
1233 else
1234 {
1235 pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
1236 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001237 PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8));
Jeff Johnson295189b2012-06-20 16:38:30 -07001238#endif
1239 // fillWmeTspecIE
1240
1241 nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload );
1242 if ( DOT11F_FAILED( nStatus ) )
1243 {
1244 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001245 "or a WMM Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001246 nStatus );
1247 // We'll fall back on the worst case scenario:
1248 nPayload = sizeof( tDot11fAddTSRequest );
1249 }
1250 else if ( DOT11F_WARNED( nStatus ) )
1251 {
1252 limLog( pMac, LOGW, FL("There were warnings while calculating"
1253 "the packed size for a WMM Add TS Requ"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001254 "est (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 }
1256 }
1257
1258 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1259
1260 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1261 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1262 ( void** ) &pPacket );
1263 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1264 {
1265 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001266 "d TS Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001267 return;
1268 }
1269
1270 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301271 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001272
1273 // Next, we fill out the buffer descriptor:
1274 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1275 SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr);
1276 if ( eSIR_SUCCESS != nSirStatus )
1277 {
1278 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001279 "tor for an Add TS Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 nSirStatus );
1281 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1282 ( void* ) pFrame, ( void* ) pPacket );
1283 return;
1284 }
1285
1286 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1287
1288 #if 0
1289 cfgLen = SIR_MAC_ADDR_LENGTH;
1290 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1291 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1292 {
1293 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001294 "e sending an Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1296 ( void* ) pFrame, ( void* ) pPacket );
1297 return;
1298 }
1299 #endif //TO SUPPORT BT-AMP
1300
1301 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1302
Chet Lanctot186b5732013-03-18 10:26:30 -07001303#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001304 limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001305#endif
1306
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 // That done, pack the struct:
1308 if ( ! pAddTS->wmeTspecPresent )
1309 {
1310 nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq,
1311 pFrame + sizeof(tSirMacMgmtHdr),
1312 nPayload, &nPayload );
1313 if ( DOT11F_FAILED( nStatus ) )
1314 {
1315 limLog( pMac, LOGE, FL("Failed to pack an Add TS Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001316 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001317 nStatus );
1318 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1319 return; // allocated!
1320 }
1321 else if ( DOT11F_WARNED( nStatus ) )
1322 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001323 limLog( pMac, LOGW, FL("There were warnings while packing "
1324 "an Add TS Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 }
1326 }
1327 else
1328 {
1329 nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq,
1330 pFrame + sizeof(tSirMacMgmtHdr),
1331 nPayload, &nPayload );
1332 if ( DOT11F_FAILED( nStatus ) )
1333 {
1334 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001335 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 nStatus );
1337 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1338 return; // allocated!
1339 }
1340 else if ( DOT11F_WARNED( nStatus ) )
1341 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001342 limLog( pMac, LOGW, FL("There were warnings while packing "
1343 "a WMM Add TS Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 }
1345 }
1346
Abhishek Singh127a8442014-12-15 17:31:27 +05301347 limLog( pMac, LOG1, FL("Sending an Add TS Request frame to ") );
1348 limPrintMacAddr( pMac, peerMacAddr, LOG1 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001349
1350 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1352 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 )
1354 {
1355 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1356 }
1357
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301358 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
1359 psessionEntry->peSessionId,
1360 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07001361 // Queue Addts Response frame in high priority WQ
1362 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1363 HAL_TXRX_FRM_802_11_MGMT,
1364 ANI_TXDIR_TODS,
1365 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1366 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301367 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
1368 psessionEntry->peSessionId,
1369 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1371 {
1372 limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001373 " (%X) ***" ), halstatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 //Pkt will be freed up by the callback
1375 }
1376
1377} // End limSendAddtsReqActionFrame.
1378
Jeff Johnson295189b2012-06-20 16:38:30 -07001379
1380
1381void
1382limSendAssocRspMgmtFrame(tpAniSirGlobal pMac,
1383 tANI_U16 statusCode,
1384 tANI_U16 aid,
1385 tSirMacAddr peerMacAddr,
1386 tANI_U8 subType,
Kapil Gupta956c0c42017-06-16 19:24:31 +05301387 tpDphHashNode pSta,tpPESession psessionEntry,
1388 assoc_rsp_tx_context *tx_complete_context)
Jeff Johnson295189b2012-06-20 16:38:30 -07001389{
1390 static tDot11fAssocResponse frm;
1391 tANI_U8 *pFrame, *macAddr;
1392 tpSirMacMgmtHdr pMacHdr;
1393 tSirRetStatus nSirStatus;
1394 tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0;
1395 tHalBitVal qosMode, wmeMode;
c_hpothubcd78652014-04-28 22:31:08 +05301396 tANI_U32 nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 void *pPacket;
1398 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301399 tUpdateBeaconParams beaconParams;
1400 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 tANI_U32 addnIEPresent = false;
1402 tANI_U32 addnIELen=0;
1403 tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN];
1404 tpSirAssocReq pAssocReq = NULL;
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301405 tANI_U16 addStripoffIELen = 0;
1406 tDot11fIEExtCap extractedExtCap;
1407 tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE;
c_hpothubcd78652014-04-28 22:31:08 +05301408 tANI_U32 nBytes = 0;
Kalikinkar dhara205da782014-03-21 15:49:32 -07001409
Chet Lanctot8cecea22014-02-11 19:09:36 -08001410#ifdef WLAN_FEATURE_11W
1411 tANI_U32 retryInterval;
1412 tANI_U32 maxRetries;
1413#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001414
1415 if(NULL == psessionEntry)
1416 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301417 limLog( pMac, LOGE, FL("psessionEntry is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 return;
1419 }
1420
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301421 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001422
1423 limGetQosMode(psessionEntry, &qosMode);
1424 limGetWmeMode(psessionEntry, &wmeMode);
1425
1426 // An Add TS IE is added only if the AP supports it and the requesting
1427 // STA sent a traffic spec.
1428 fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0;
1429
1430 PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry );
1431
1432 frm.Status.status = statusCode;
1433
1434 frm.AID.associd = aid | LIM_AID_MASK;
1435
1436 if ( NULL == pSta )
1437 {
1438 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry);
1439 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry );
1440 }
1441 else
1442 {
1443 PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates,
1444 pSta->supportedRates.llbRates, pSta->supportedRates.llaRates );
1445 }
1446
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1448 {
1449 if( pSta != NULL && eSIR_SUCCESS == statusCode )
1450 {
1451 pAssocReq =
1452 (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001453 /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */
1454 if( pAssocReq != NULL && pAssocReq->addIEPresent ) {
1455 PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq);
1456 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 }
1458 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001459
1460 if ( NULL != pSta )
1461 {
1462 if ( eHAL_SET == qosMode )
1463 {
1464 if ( pSta->lleEnabled )
1465 {
1466 lleMode = 1;
1467 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) )
1468 {
1469 PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
1470
1471// FramesToDo:...
1472// if ( fAddTS )
1473// {
1474// tANI_U8 *pAf = pBody;
1475// *pAf++ = SIR_MAC_QOS_ACTION_EID;
1476// tANI_U32 tlen;
1477// status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL,
1478// &tlen, bufLen - frameLen);
1479// } // End if on Add TS.
1480 }
1481 } // End if on .11e enabled in 'pSta'.
1482 } // End if on QOS Mode on.
1483
1484 if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled )
1485 {
1486 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1487 {
1488
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001490
1491 if ( pSta->wsmEnabled )
1492 {
1493 PopulateDot11fWMMCaps(&frm.WMMCaps );
1494 }
1495 }
1496 }
1497
1498 if ( pSta->aniPeer )
1499 {
1500 if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ||
1501 ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1502 {
1503 edcaInclude = 1;
1504 }
1505
1506 } // End if on Airgo peer.
1507
1508 if ( pSta->mlmStaContext.htCapability &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001509 psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -07001510 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05301511 limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Response"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001512 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Sachin Ahujac3a26232014-09-23 22:27:30 +05301513 /*
1514 *Check the STA capability and update the HTCaps accordingly
1515 */
1516 frm.HTCaps.supportedChannelWidthSet =
1517 (pSta->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1518 pSta->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1519
1520 if (!frm.HTCaps.supportedChannelWidthSet)
1521 frm.HTCaps.shortGI40MHz = 0;
1522
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07001524 }
Agrawal Ashishb10d0392015-08-06 16:18:20 +05301525 limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
1526 "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
1527 frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave,
1528 frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz,
1529 frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor);
1530
1531
Jeff Johnsone7245742012-09-05 17:12:55 -07001532
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301533#ifdef WLAN_FEATURE_AP_HT40_24G
1534 /* Populate Overlapping BSS Scan Parameters IEs,
1535 * when operating in HT40 in 2.4GHz.
1536 */
Hardik Kantilal Patel3c235242015-01-02 17:56:18 +05301537 if ((pMac->roam.configParam.apHT40_24GEnabled)
1538 && (IS_DOT11_MODE_HT(psessionEntry->dot11mode)))
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301539 {
1540 PopulateDot11fOBSSScanParameters( pMac, &frm.OBSSScanParameters,
1541 psessionEntry);
Hardik Kantilal Patelee5874c2015-01-14 15:23:28 +05301542 /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in
1543 * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK
1544 * Mode in 40 MHz bit in HT capablity.
1545 */
1546 frm.HTCaps.dsssCckMode40MHz = 1;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301547 }
1548#endif
1549
1550 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001551#ifdef WLAN_FEATURE_11AC
1552 if( pSta->mlmStaContext.vhtCapability &&
1553 psessionEntry->vhtCapability )
1554 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -08001555 limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05301556 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
1557 psessionEntry->currentOperChannel, eSIR_TRUE );
1558 PopulateDot11fVHTOperation( pMac, &frm.VHTOperation,
1559 psessionEntry->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07001560 }
1561#endif
1562
Chet Lanctot8cecea22014-02-11 19:09:36 -08001563#ifdef WLAN_FEATURE_11W
Dino Myclea7f18452014-04-24 08:55:31 +05301564 if( eSIR_MAC_TRY_AGAIN_LATER == statusCode )
1565 {
Chet Lanctotfadc8e32014-04-24 14:50:52 -07001566 if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
1567 &maxRetries ) != eSIR_SUCCESS )
1568 limLog( pMac, LOGE,
1569 FL("Could not retrieve PMF SA Query maximum retries value") );
1570 else
1571 if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
1572 &retryInterval ) != eSIR_SUCCESS)
1573 limLog( pMac, LOGE,
1574 FL("Could not retrieve PMF SA Query timer interval value") );
Dino Myclea7f18452014-04-24 08:55:31 +05301575 else
Chet Lanctotfadc8e32014-04-24 14:50:52 -07001576 PopulateDot11fTimeoutInterval(
1577 pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK,
1578 (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval );
Dino Myclea7f18452014-04-24 08:55:31 +05301579 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08001580#endif
Dino Myclea7f18452014-04-24 08:55:31 +05301581 } // End if on non-NULL 'pSta'.
Jeff Johnson295189b2012-06-20 16:38:30 -07001582
Chet Lanctot8cecea22014-02-11 19:09:36 -08001583 vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001584
Jeff Johnson295189b2012-06-20 16:38:30 -07001585 if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1586 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
1587 limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry);
1588 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001589
1590 limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry);
1591 limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry);
1592
1593 beaconParams.bssIdx = psessionEntry->bssIdx;
1594
1595 //Send message to HAL about beacon parameter change.
1596 if(beaconParams.paramChangeBitmap)
1597 {
1598 schSetFixedBeaconFields(pMac,psessionEntry);
1599 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
1600 }
1601
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 if ( pAssocReq != NULL )
1603 {
1604 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
1605 &addnIEPresent) != eSIR_SUCCESS)
1606 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301607 limLog(pMac, LOGP, FL("Unable to get "
1608 "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 return;
1610 }
1611
1612 if (addnIEPresent)
1613 {
1614 //Assoc rsp IE available
1615 if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1616 &addnIELen) != eSIR_SUCCESS)
1617 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301618 limLog(pMac, LOGP, FL("Unable to get "
1619 "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001620 return;
1621 }
1622
1623 if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen &&
1624 (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE)
1625 {
1626 if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1627 &addIE[0], &addnIELen) == eSIR_SUCCESS)
1628 {
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301629
1630 vos_mem_set(( tANI_U8* )&extractedExtCap,
1631 sizeof( tDot11fIEExtCap ), 0);
Mahesh A Saptasagare00ff532014-10-17 19:05:14 +05301632 addStripoffIELen = addnIELen;
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301633 nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac,
1634 &addIE[0],
1635 &addStripoffIELen,
1636 &extractedExtCap );
1637 if(eSIR_SUCCESS != nSirStatus)
1638 {
1639 limLog(pMac, LOG1,
1640 FL("Unable to Stripoff ExtCap IE from Assoc Rsp"));
1641 }
1642 else
1643 {
1644 addnIELen = addStripoffIELen;
1645 extractedExtCapFlag = eANI_BOOLEAN_TRUE;
1646 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 nBytes = nBytes + addnIELen;
1648 }
1649 }
1650 }
1651 }
1652
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301653 /* merge the ExtCap struct*/
1654 if (extractedExtCapFlag && extractedExtCap.present)
1655 {
Hu Wang5193b572016-08-11 10:04:47 +08001656 limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap, true);
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301657 }
1658
c_hpothubcd78652014-04-28 22:31:08 +05301659 nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
1660 if ( DOT11F_FAILED( nStatus ) )
1661 {
1662 limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
1663 "or an Association Response (0x%08x)."),
1664 nStatus );
1665 return;
1666 }
1667 else if ( DOT11F_WARNED( nStatus ) )
1668 {
1669 limLog( pMac, LOGW, FL("There were warnings while calculating "
1670 "the packed size for an Association Re"
1671 "sponse (0x%08x)."), nStatus );
1672 }
1673
1674 nBytes += sizeof( tSirMacMgmtHdr ) + nPayload;
1675
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1677 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1678 ( void** ) &pPacket );
1679 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1680 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001681 limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 return;
1683 }
1684
1685 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301686 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001687
1688 // Next, we fill out the buffer descriptor:
1689 nSirStatus = limPopulateMacHeader( pMac,
1690 pFrame,
1691 SIR_MAC_MGMT_FRAME,
1692 ( LIM_ASSOC == subType ) ?
1693 SIR_MAC_MGMT_ASSOC_RSP :
1694 SIR_MAC_MGMT_REASSOC_RSP,
1695 peerMacAddr,psessionEntry->selfMacAddr);
1696 if ( eSIR_SUCCESS != nSirStatus )
1697 {
1698 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001699 "tor for an Association Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 nSirStatus );
1701 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1702 ( void* ) pFrame, ( void* ) pPacket );
1703 return;
1704 }
1705
1706 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1707
Jeff Johnson295189b2012-06-20 16:38:30 -07001708 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1709
1710 nStatus = dot11fPackAssocResponse( pMac, &frm,
1711 pFrame + sizeof( tSirMacMgmtHdr ),
1712 nPayload, &nPayload );
1713 if ( DOT11F_FAILED( nStatus ) )
1714 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301715 limLog( pMac, LOGE, FL("Failed to pack an Association Response"
1716 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001717 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1718 ( void* ) pFrame, ( void* ) pPacket );
1719 return; // allocated!
1720 }
1721 else if ( DOT11F_WARNED( nStatus ) )
1722 {
1723 limLog( pMac, LOGW, FL("There were warnings while packing an "
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001724 "Association Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 }
1726
1727 macAddr = pMacHdr->da;
1728
1729 if (subType == LIM_ASSOC)
1730 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301731 limLog(pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 FL("*** Sending Assoc Resp status %d aid %d to "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301733 statusCode, aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001734 }
1735 else{
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301736 limLog(pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 FL("*** Sending ReAssoc Resp status %d aid %d to "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301738 statusCode, aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001739 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301740 limPrintMacAddr(pMac, pMacHdr->da, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001741
1742 if ( addnIEPresent )
1743 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301744 vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 }
1746
1747 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1749 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 )
1751 {
1752 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1753 }
1754
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05301755 limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR
1756 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
1757 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
1758
1759 txFlag |= HAL_USE_FW_IN_TX_PATH;
1760
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301761 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
1762 psessionEntry->peSessionId,
1763 pMacHdr->fc.subType));
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05301764
1765 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
1766 {
Kapil Gupta956c0c42017-06-16 19:24:31 +05301767 limLog(pMac, LOG1, FL("Re/AssocRsp - txBdToken %u"),
1768 pMac->lim.txBdToken);
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05301769 /// Queue Association Response frame in high priority WQ
Kapil Gupta956c0c42017-06-16 19:24:31 +05301770 if (tx_complete_context)
1771 {
1772 tx_complete_context->txBdToken = pMac->lim.txBdToken;
1773 halstatus = halTxFrameWithTxComplete(pMac, pPacket,
1774 (tANI_U16) nBytes,
1775 HAL_TXRX_FRM_802_11_MGMT,
1776 ANI_TXDIR_TODS,
1777 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1778 limTxComplete, pFrame, limAssocRspTxCompleteCnf,
1779 txFlag, pMac->lim.txBdToken);
1780 }
1781 else
1782 halstatus = halTxFrameWithTxComplete(pMac, pPacket,
1783 (tANI_U16) nBytes,
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05301784 HAL_TXRX_FRM_802_11_MGMT,
1785 ANI_TXDIR_TODS,
1786 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1787 limTxComplete, pFrame, limTxBdComplete,
Kapil Gupta956c0c42017-06-16 19:24:31 +05301788 txFlag, pMac->lim.txBdToken);
1789
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05301790 pMac->lim.txBdToken++;
1791 }
1792 else
1793 {
1794 /// Queue Association Response frame in high priority WQ
1795 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1796 HAL_TXRX_FRM_802_11_MGMT,
1797 ANI_TXDIR_TODS,
1798 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1799 limTxComplete, pFrame, txFlag );
1800 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301801 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
1802 psessionEntry->peSessionId,
1803 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07001804 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1805 {
1806 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001807 FL("*** Could not Send Re/AssocRsp, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 nSirStatus);
1809
1810 //Pkt will be freed up by the callback
1811 }
1812
1813 // update the ANI peer station count
1814 //FIXME_PROTECTION : take care of different type of station
1815 // counter inside this function.
1816 limUtilCountStaAdd(pMac, pSta, psessionEntry);
1817
1818} // End limSendAssocRspMgmtFrame.
1819
1820
1821
1822void
1823limSendAddtsRspActionFrame(tpAniSirGlobal pMac,
1824 tSirMacAddr peer,
1825 tANI_U16 nStatusCode,
1826 tSirAddtsReqInfo *pAddTS,
1827 tSirMacScheduleIE *pSchedule,
1828 tpPESession psessionEntry)
1829{
1830 tANI_U8 *pFrame;
1831 tpSirMacMgmtHdr pMacHdr;
1832 tDot11fAddTSResponse AddTSRsp;
1833 tDot11fWMMAddTSResponse WMMAddTSRsp;
1834 tSirRetStatus nSirStatus;
1835 tANI_U32 i, nBytes, nPayload, nStatus;
1836 void *pPacket;
1837 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301838 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001839
1840 if(NULL == psessionEntry)
1841 {
1842 return;
1843 }
1844
1845 if ( ! pAddTS->wmeTspecPresent )
1846 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301847 vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001848
1849 AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1850 AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1851 AddTSRsp.DialogToken.token = pAddTS->dialogToken;
1852 AddTSRsp.Status.status = nStatusCode;
1853
1854 // The TsDelay information element is only filled in for a specific
1855 // status code:
1856 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode )
1857 {
1858 if ( pAddTS->wsmTspecPresent )
1859 {
1860 AddTSRsp.WMMTSDelay.version = 1;
1861 AddTSRsp.WMMTSDelay.delay = 10;
1862 AddTSRsp.WMMTSDelay.present = 1;
1863 }
1864 else
1865 {
1866 AddTSRsp.TSDelay.delay = 10;
1867 AddTSRsp.TSDelay.present = 1;
1868 }
1869 }
1870
1871 if ( pAddTS->wsmTspecPresent )
1872 {
1873 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC );
1874 }
1875 else
1876 {
1877 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC );
1878 }
1879
1880 if ( pAddTS->wsmTspecPresent )
1881 {
1882 AddTSRsp.num_WMMTCLAS = 0;
1883 AddTSRsp.num_TCLAS = pAddTS->numTclas;
1884 for ( i = 0; i < AddTSRsp.num_TCLAS; ++i)
1885 {
1886 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
1887 &AddTSRsp.TCLAS[i] );
1888 }
1889 }
1890 else
1891 {
1892 AddTSRsp.num_TCLAS = 0;
1893 AddTSRsp.num_WMMTCLAS = pAddTS->numTclas;
1894 for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i)
1895 {
1896 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1897 &AddTSRsp.WMMTCLAS[i] );
1898 }
1899 }
1900
1901 if ( pAddTS->tclasProcPresent )
1902 {
1903 if ( pAddTS->wsmTspecPresent )
1904 {
1905 AddTSRsp.WMMTCLASPROC.version = 1;
1906 AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc;
1907 AddTSRsp.WMMTCLASPROC.present = 1;
1908 }
1909 else
1910 {
1911 AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc;
1912 AddTSRsp.TCLASSPROC.present = 1;
1913 }
1914 }
1915
1916 // schedule element is included only if requested in the tspec and we are
1917 // using hcca (or both edca and hcca)
1918 // 11e-D8.0 is inconsistent on whether the schedule element is included
1919 // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but
1920 // pg 46, line 17-18 says something else. So just include it and let the
1921 // sta figure it out
1922 if ((pSchedule != NULL) &&
1923 ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
1924 (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)))
1925 {
1926 if ( pAddTS->wsmTspecPresent )
1927 {
1928 PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule );
1929 }
1930 else
1931 {
1932 PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule );
1933 }
1934 }
1935
1936 nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload );
1937 if ( DOT11F_FAILED( nStatus ) )
1938 {
1939 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001940 "ze for an Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 nStatus );
1942 // We'll fall back on the worst case scenario:
1943 nPayload = sizeof( tDot11fAddTSResponse );
1944 }
1945 else if ( DOT11F_WARNED( nStatus ) )
1946 {
1947 limLog( pMac, LOGW, FL("There were warnings while calcula"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001948 "ting the packed size for an Add TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001949 " Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001950 }
1951 }
1952 else
1953 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301954 vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001955
1956 WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME;
1957 WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1958 WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken;
1959 WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode;
1960
1961 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC );
1962
1963 nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload );
1964 if ( DOT11F_FAILED( nStatus ) )
1965 {
1966 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001967 "ze for a WMM Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 nStatus );
1969 // We'll fall back on the worst case scenario:
1970 nPayload = sizeof( tDot11fWMMAddTSResponse );
1971 }
1972 else if ( DOT11F_WARNED( nStatus ) )
1973 {
1974 limLog( pMac, LOGW, FL("There were warnings while calcula"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001975 "ting the packed size for a WMM Add"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001976 "TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 }
1978 }
1979
1980 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1981
1982 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
1983 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1984 {
1985 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001986 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 return;
1988 }
1989
1990 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301991 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001992
1993 // Next, we fill out the buffer descriptor:
1994 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1995 SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr);
1996 if ( eSIR_SUCCESS != nSirStatus )
1997 {
1998 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001999 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002000 nSirStatus );
2001 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2002 return; // allocated!
2003 }
2004
2005 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
2006
2007
2008 #if 0
2009 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
2010 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
2011 {
2012 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002013 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2015 return; // allocated!
2016 }
2017 #endif //TO SUPPORT BT-AMP
2018 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
2019
Chet Lanctot186b5732013-03-18 10:26:30 -07002020#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002021 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07002022#endif
2023
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 // That done, pack the struct:
2025 if ( ! pAddTS->wmeTspecPresent )
2026 {
2027 nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp,
2028 pFrame + sizeof( tSirMacMgmtHdr ),
2029 nPayload, &nPayload );
2030 if ( DOT11F_FAILED( nStatus ) )
2031 {
2032 limLog( pMac, LOGE, FL("Failed to pack an Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002033 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 nStatus );
2035 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2036 return;
2037 }
2038 else if ( DOT11F_WARNED( nStatus ) )
2039 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002040 limLog( pMac, LOGW, FL("There were warnings while packing "
2041 "an Add TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 }
2043 }
2044 else
2045 {
2046 nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp,
2047 pFrame + sizeof( tSirMacMgmtHdr ),
2048 nPayload, &nPayload );
2049 if ( DOT11F_FAILED( nStatus ) )
2050 {
2051 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002052 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 nStatus );
2054 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2055 return;
2056 }
2057 else if ( DOT11F_WARNED( nStatus ) )
2058 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002059 limLog( pMac, LOGW, FL("There were warnings while packing "
2060 "a WMM Add TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 }
2062 }
2063
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302064 limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 nStatusCode );
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302066 limPrintMacAddr( pMac, pMacHdr->da, LOG1 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002067
2068 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2070 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 )
2072 {
2073 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2074 }
2075
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302076 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
2077 psessionEntry->peSessionId,
2078 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 // Queue the frame in high priority WQ:
2080 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
2081 HAL_TXRX_FRM_802_11_MGMT,
2082 ANI_TXDIR_TODS,
2083 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2084 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302085 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
2086 psessionEntry->peSessionId,
2087 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2089 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002090 limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 nSirStatus );
2092 //Pkt will be freed up by the callback
2093 }
2094
2095} // End limSendAddtsRspActionFrame.
2096
2097void
2098limSendDeltsReqActionFrame(tpAniSirGlobal pMac,
2099 tSirMacAddr peer,
2100 tANI_U8 wmmTspecPresent,
2101 tSirMacTSInfo *pTsinfo,
2102 tSirMacTspecIE *pTspecIe,
2103 tpPESession psessionEntry)
2104{
2105 tANI_U8 *pFrame;
2106 tpSirMacMgmtHdr pMacHdr;
2107 tDot11fDelTS DelTS;
2108 tDot11fWMMDelTS WMMDelTS;
2109 tSirRetStatus nSirStatus;
2110 tANI_U32 nBytes, nPayload, nStatus;
2111 void *pPacket;
2112 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302113 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002114
2115 if(NULL == psessionEntry)
2116 {
2117 return;
2118 }
2119
2120 if ( ! wmmTspecPresent )
2121 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302122 vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002123
2124 DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT;
2125 DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
2126 PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo );
2127
2128 nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload );
2129 if ( DOT11F_FAILED( nStatus ) )
2130 {
2131 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002132 "ze for a Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 nStatus );
2134 // We'll fall back on the worst case scenario:
2135 nPayload = sizeof( tDot11fDelTS );
2136 }
2137 else if ( DOT11F_WARNED( nStatus ) )
2138 {
2139 limLog( pMac, LOGW, FL("There were warnings while calcula"
2140 "ting the packed size for a Del TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002141 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 }
2143 }
2144 else
2145 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302146 vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002147
2148 WMMDelTS.Category.category = SIR_MAC_ACTION_WME;
2149 WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
2150 WMMDelTS.DialogToken.token = 0;
2151 WMMDelTS.StatusCode.statusCode = 0;
2152 PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC );
2153 nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload );
2154 if ( DOT11F_FAILED( nStatus ) )
2155 {
2156 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002157 "ze for a WMM Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 nStatus );
2159 // We'll fall back on the worst case scenario:
2160 nPayload = sizeof( tDot11fDelTS );
2161 }
2162 else if ( DOT11F_WARNED( nStatus ) )
2163 {
2164 limLog( pMac, LOGW, FL("There were warnings while calcula"
2165 "ting the packed size for a WMM De"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002166 "l TS (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 }
2168 }
2169
2170 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
2171
2172 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
2173 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2174 {
2175 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002176 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 return;
2178 }
2179
2180 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302181 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002182
2183 // Next, we fill out the buffer descriptor:
2184 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2185 SIR_MAC_MGMT_ACTION, peer,
2186 psessionEntry->selfMacAddr);
2187 if ( eSIR_SUCCESS != nSirStatus )
2188 {
2189 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002190 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 nSirStatus );
2192 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2193 return; // allocated!
2194 }
2195
2196 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
2197
2198 #if 0
2199
2200 cfgLen = SIR_MAC_ADDR_LENGTH;
2201 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
2202 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
2203 {
2204 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002205 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2207 return; // allocated!
2208 }
2209 #endif //TO SUPPORT BT-AMP
2210 sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId);
2211
Chet Lanctot186b5732013-03-18 10:26:30 -07002212#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002213 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07002214#endif
2215
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 // That done, pack the struct:
2217 if ( !wmmTspecPresent )
2218 {
2219 nStatus = dot11fPackDelTS( pMac, &DelTS,
2220 pFrame + sizeof( tSirMacMgmtHdr ),
2221 nPayload, &nPayload );
2222 if ( DOT11F_FAILED( nStatus ) )
2223 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002224 limLog( pMac, LOGE, FL("Failed to pack a Del TS frame (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 nStatus );
2226 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2227 return; // allocated!
2228 }
2229 else if ( DOT11F_WARNED( nStatus ) )
2230 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002231 limLog( pMac, LOGW, FL("There were warnings while packing "
2232 "a Del TS frame (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 }
2234 }
2235 else
2236 {
2237 nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS,
2238 pFrame + sizeof( tSirMacMgmtHdr ),
2239 nPayload, &nPayload );
2240 if ( DOT11F_FAILED( nStatus ) )
2241 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002242 limLog( pMac, LOGE, FL("Failed to pack a WMM Del TS frame (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 nStatus );
2244 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2245 return; // allocated!
2246 }
2247 else if ( DOT11F_WARNED( nStatus ) )
2248 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002249 limLog( pMac, LOGW, FL("There were warnings while packing "
2250 "a WMM Del TS frame (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002251 }
2252 }
2253
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302254 limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes);
2255 limPrintMacAddr(pMac, pMacHdr->da, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002256
2257 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2259 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 )
2261 {
2262 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2263 }
2264
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302265 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
2266 psessionEntry->peSessionId,
2267 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
2269 HAL_TXRX_FRM_802_11_MGMT,
2270 ANI_TXDIR_TODS,
2271 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2272 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302273 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
2274 psessionEntry->peSessionId,
2275 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2277 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002278 limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 nSirStatus );
2280 //Pkt will be freed up by the callback
2281 }
2282
2283} // End limSendDeltsReqActionFrame.
2284
2285void
2286limSendAssocReqMgmtFrame(tpAniSirGlobal pMac,
2287 tLimMlmAssocReq *pMlmAssocReq,
2288 tpPESession psessionEntry)
2289{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002290 tDot11fAssocRequest *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 tANI_U16 caps;
2292 tANI_U8 *pFrame;
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302293 tSirRetStatus nSirStatus = eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 tLimMlmAssocCnf mlmAssocCnf;
c_hpothubcd78652014-04-28 22:31:08 +05302295 tANI_U32 nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2297 void *pPacket;
2298 eHalStatus halstatus;
2299 tANI_U16 nAddIELen;
2300 tANI_U8 *pAddIE;
2301 tANI_U8 *wpsIe = NULL;
2302#if defined WLAN_FEATURE_VOWIFI
2303 tANI_U8 PowerCapsPopulated = FALSE;
2304#endif
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302305 tANI_U32 txFlag = 0;
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302306 tpSirMacMgmtHdr pMacHdr;
Kalikinkar dhara205da782014-03-21 15:49:32 -07002307 tDot11fIEExtCap extractedExtCap;
2308 tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE;
c_hpothubcd78652014-04-28 22:31:08 +05302309 tANI_U32 nBytes = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002310
2311 if(NULL == psessionEntry)
2312 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302313 limLog(pMac, LOGE, FL("psessionEntry is NULL") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002314 return;
2315 }
2316
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 /* check this early to avoid unncessary operation */
2318 if(NULL == psessionEntry->pLimJoinReq)
2319 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302320 limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 return;
2322 }
2323 nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length;
2324 pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata;
2325
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302326 pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2327 if ( NULL == pFrm )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002328 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302329 limLog(pMac, LOGE, FL("Unable to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002330 return;
2331 }
2332
2333
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302334 vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002335
Kalikinkar dhara205da782014-03-21 15:49:32 -07002336 vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0);
Hu Wang5193b572016-08-11 10:04:47 +08002337 if (psessionEntry->ExtCap.present)
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302338 {
2339 nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE,
Kalikinkar dhara205da782014-03-21 15:49:32 -07002340 &nAddIELen,
2341 &extractedExtCap );
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302342 }
Kalikinkar dhara205da782014-03-21 15:49:32 -07002343 if(eSIR_SUCCESS != nSirStatus )
2344 {
2345 extractedExtCapFlag = eANI_BOOLEAN_FALSE;
2346 limLog(pMac, LOG1,
2347 FL("Unable to Stripoff ExtCap IE from Assoc Req"));
2348 }
Leela Venkata Kiran Kumar Reddy Chirala2f9b5712014-05-06 00:09:42 -07002349 /* TODO:remove this code once driver provides the call back function
2350 * to supplicant for set_qos_map
2351 */
2352 else
2353 {
Hu Wangc12631c2016-08-11 09:57:03 +08002354 struct s_ext_cap *p_ext_cap = (struct s_ext_cap *)extractedExtCap.bytes;
2355 if (p_ext_cap->interworkingService) {
2356 p_ext_cap->qosMap = 1;
2357 }
2358 extractedExtCap.num_bytes = lim_compute_ext_cap_ie_length(&extractedExtCap);
2359 extractedExtCapFlag = (extractedExtCap.num_bytes > 0);
Leela Venkata Kiran Kumar Reddy Chirala2f9b5712014-05-06 00:09:42 -07002360 }
Kalikinkar dhara205da782014-03-21 15:49:32 -07002361
Jeff Johnson295189b2012-06-20 16:38:30 -07002362 caps = pMlmAssocReq->capabilityInfo;
2363 if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) )
2364 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2365#if defined(FEATURE_WLAN_WAPI)
2366 /* CR: 262463 :
2367 According to WAPI standard:
2368 7.3.1.4 Capability Information field
2369 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2370 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2371 Reassociation management frames. */
2372 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2373 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2374#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002375 swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities );
Jeff Johnson295189b2012-06-20 16:38:30 -07002376
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002377 pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval;
2378 PopulateDot11fSSID2( pMac, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002380 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002381
2382 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2383 SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps );
2384
2385 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2386 LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps );
2387
2388 // We prefer .11e asociations:
2389 if ( fQosEnabled ) fWmeEnabled = false;
2390
2391 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2392 LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps );
2393
2394 if ( psessionEntry->lim11hEnable &&
2395 psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE )
2396 {
2397#if defined WLAN_FEATURE_VOWIFI
2398 PowerCapsPopulated = TRUE;
2399
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002400 PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002401#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002402 PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002403
2404 }
2405
2406#if defined WLAN_FEATURE_VOWIFI
2407 if( pMac->rrm.rrmPEContext.rrmEnable &&
2408 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2409 {
2410 if (PowerCapsPopulated == FALSE)
2411 {
2412 PowerCapsPopulated = TRUE;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002413 PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 }
2415 }
2416#endif
2417
2418 if ( fQosEnabled &&
2419 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap)))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002420 PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002421
2422 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002423 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002424
2425#if defined WLAN_FEATURE_VOWIFI
2426 if( pMac->rrm.rrmPEContext.rrmEnable &&
2427 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2428 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002429 PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 }
2431#endif
2432 // The join request *should* contain zero or one of the WPA and RSN
2433 // IEs. The payload send along with the request is a
2434 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2435
2436 // typedef struct sSirRSNie
2437 // {
2438 // tANI_U16 length;
2439 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2440 // } tSirRSNie, *tpSirRSNie;
2441
2442 // So, we should be able to make the following two calls harmlessly,
2443 // since they do nothing if they don't find the given IE in the
2444 // bytestream with which they're provided.
2445
2446 // The net effect of this will be to faithfully transmit whatever
2447 // security IE is in the join request.
2448
2449 // *However*, if we're associating for the purpose of WPS
2450 // enrollment, and we've been configured to indicate that by
2451 // eliding the WPA or RSN IE, we just skip this:
2452 if( nAddIELen && pAddIE )
2453 {
2454 wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen);
2455 }
2456 if ( NULL == wpsIe )
2457 {
2458 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002459 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002461 &pFrm->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002462#if defined(FEATURE_WLAN_WAPI)
2463 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002464 &pFrm->WAPIOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002465#endif // defined(FEATURE_WLAN_WAPI)
2466 }
2467
2468 // include WME EDCA IE as well
2469 if ( fWmeEnabled )
2470 {
2471 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) )
2472 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002473 PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 }
2475
2476 if ( fWsmEnabled &&
2477 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap )))
2478 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002479 PopulateDot11fWMMCaps( &pFrm->WMMCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 }
2481 }
2482
2483 //Populate HT IEs, when operating in 11n or Taurus modes AND
2484 //when AP is also operating in 11n mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07002485 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 pMac->lim.htCapabilityPresentInBeacon)
2487 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302488 limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Request"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002489 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002490#ifdef DISABLE_GF_FOR_INTEROP
2491
2492 /*
2493 * To resolve the interop problem with Broadcom AP,
2494 * where TQ STA could not pass traffic with GF enabled,
2495 * TQ STA will do Greenfield only with TQ AP, for
2496 * everybody else it will be turned off.
2497 */
2498
2499 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2500 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302501 limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP,"
2502 " Turning off Greenfield"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002503 pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 }
2505#endif
2506
2507 }
Agrawal Ashishb10d0392015-08-06 16:18:20 +05302508
2509 limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
2510 "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
2511 pFrm->HTCaps.supportedChannelWidthSet, pFrm->HTCaps.mimoPowerSave,
2512 pFrm->HTCaps.greenField, pFrm->HTCaps.shortGI20MHz, pFrm->HTCaps.shortGI40MHz,
2513 pFrm->HTCaps.dsssCckMode40MHz, pFrm->HTCaps.maxRxAMPDUFactor);
2514
2515
Jeff Johnsone7245742012-09-05 17:12:55 -07002516#ifdef WLAN_FEATURE_11AC
2517 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002518 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07002519 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002520 limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05302521 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps,
2522 psessionEntry->currentOperChannel, eSIR_FALSE );
Abhishek Singhe038dc62015-05-22 11:36:45 +05302523
Jeff Johnsone7245742012-09-05 17:12:55 -07002524 }
2525#endif
Hu Wang5193b572016-08-11 10:04:47 +08002526 if (psessionEntry->ExtCap.present)
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302527 PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002528
2529#if defined WLAN_FEATURE_VOWIFI_11R
2530 if (psessionEntry->pLimJoinReq->is11Rconnection)
2531 {
2532#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002533 limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002534 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0],
2535 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1],
2536 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]);
2537#endif
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302538 PopulateMDIE( pMac, &pFrm->MobilityDomain,
2539 psessionEntry->pLimJoinReq->bssDescription.mdie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002540 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302541 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002542 {
2543 // No 11r IEs dont send any MDIE
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302544 limLog( pMac, LOG1, FL("MDIE not present"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 }
2546#endif
2547
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002548#ifdef FEATURE_WLAN_ESE
2549 /* For ESE Associations fill the ESE IEs */
2550 if (psessionEntry->isESEconnection &&
2551 psessionEntry->pLimJoinReq->isESEFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002553#ifndef FEATURE_DISABLE_RM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002554 PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002555#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002556 PopulateDot11fESEVersion(&pFrm->ESEVersion);
Jeff Johnson295189b2012-06-20 16:38:30 -07002557 }
2558#endif
2559
c_hpothubcd78652014-04-28 22:31:08 +05302560 /* merge the ExtCap struct*/
2561 if (extractedExtCapFlag && extractedExtCap.present)
2562 {
Hu Wang5193b572016-08-11 10:04:47 +08002563 limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap, true);
2564 }
2565
2566 if (pFrm->ExtCap.present && psessionEntry->ExtCap.present) {
2567 limMergeExtCapIEStruct(&pFrm->ExtCap, &psessionEntry->ExtCap, false);
2568 limLog(pMac, LOG1,
2569 FL("Clear the bits in EXTCAP IE that AP don't support to avoid IoT issues."));
c_hpothubcd78652014-04-28 22:31:08 +05302570 }
2571
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002572 nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 if ( DOT11F_FAILED( nStatus ) )
2574 {
2575 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002576 "or an Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 nStatus );
2578 // We'll fall back on the worst case scenario:
2579 nPayload = sizeof( tDot11fAssocRequest );
2580 }
2581 else if ( DOT11F_WARNED( nStatus ) )
2582 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002583 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07002584 "the packed size for an Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002585 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 }
2587
2588 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
2589
2590 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2591 ( tANI_U16 )nBytes, ( void** ) &pFrame,
2592 ( void** ) &pPacket );
2593 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2594 {
2595 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002596 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002597
2598 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002599 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002600
2601
2602 /* Update PE session id*/
2603 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2604
2605 mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2606
2607 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2608 ( void* ) pFrame, ( void* ) pPacket );
2609
2610 limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF,
2611 ( tANI_U32* ) &mlmAssocCnf);
2612
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302613 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 return;
2615 }
2616
2617 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302618 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002619
2620 // Next, we fill out the buffer descriptor:
2621 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2622 SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr);
2623 if ( eSIR_SUCCESS != nSirStatus )
2624 {
2625 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002626 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 nSirStatus );
2628 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302629 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 return;
2631 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002632
Abhishek Singh57aebef2014-02-03 18:47:44 +05302633 // That done, pack the Assoc Request:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002634 nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame +
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 sizeof(tSirMacMgmtHdr),
2636 nPayload, &nPayload );
2637 if ( DOT11F_FAILED( nStatus ) )
2638 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302639 limLog( pMac, LOGE, FL("Failed to pack a Assoc Request (0x%0"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002640 "8x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 nStatus );
2642 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2643 ( void* ) pFrame, ( void* ) pPacket );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302644 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 return;
2646 }
2647 else if ( DOT11F_WARNED( nStatus ) )
2648 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302649 limLog( pMac, LOGW, FL("There were warnings while packing a Assoc"
2650 "Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 }
2652
2653 PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002654 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002655 nBytes );)
2656 // limPrintMacAddr( pMac, bssid, LOG1 );
2657
2658 if( psessionEntry->assocReq != NULL )
2659 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302660 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 psessionEntry->assocReq = NULL;
2662 }
2663
2664 if( nAddIELen )
2665 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302666 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
2667 pAddIE,
2668 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 nPayload += nAddIELen;
2670 }
2671
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302672 psessionEntry->assocReq = vos_mem_malloc(nPayload);
2673 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302675 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store "
2676 "assoc request"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 }
2678 else
2679 {
2680 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302681 vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 psessionEntry->assocReqLen = nPayload;
2683 }
2684
2685 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002686 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2687 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 )
2689 {
2690 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2691 }
2692
Sushant Kaushike8681d22015-04-21 12:08:25 +05302693 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
2694 psessionEntry->pePersona == VOS_STA_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08002695 {
2696 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
2697 }
Deepthi Gowri639d5042015-11-16 20:23:39 +05302698#ifdef FEATURE_WLAN_DIAG_SUPPORT
2699 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_START_EVENT, psessionEntry,
2700 eSIR_SUCCESS, eSIR_SUCCESS);
2701#endif
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302702 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05302703 limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR
2704 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
2705 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
2706 txFlag |= HAL_USE_FW_IN_TX_PATH;
2707
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302708 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
2709 psessionEntry->peSessionId,
2710 pMacHdr->fc.subType));
Katya Nigam63902932014-06-26 19:04:23 +05302711
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05302712 if( ( psessionEntry->is11Gonly == true ) &&
2713 ( !IS_BROADCAST_MAC(pMlmAssocReq->peerMacAddr) ) ){
2714 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2715 }
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05302716 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
2717 {
2718 limLog(pMac, LOG1, FL("Assoc Req - txBdToken %u"), pMac->lim.txBdToken);
2719 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
2720 ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
2721 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
2722 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2723 limTxComplete, pFrame, limTxBdComplete, txFlag,
2724 pMac->lim.txBdToken);
2725 pMac->lim.txBdToken++;
2726 }
2727 else
2728 {
2729 halstatus = halTxFrame( pMac, pPacket,
2730 ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
2731 HAL_TXRX_FRM_802_11_MGMT,
2732 ANI_TXDIR_TODS,
2733 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2734 limTxComplete, pFrame, txFlag );
2735 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302736 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
2737 psessionEntry->peSessionId,
2738 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07002739 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2740 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002741 limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 halstatus );
2743 //Pkt will be freed up by the callback
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302744 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 return;
2746 }
2747
Katya Nigamccaeda72015-04-20 18:51:22 +05302748 //Enable caching only if Assoc Request is successfully submitted to the h/w
2749 WLANTL_EnableCaching(psessionEntry->staId);
2750
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302752 vos_mem_free(pMlmAssocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002753 pMlmAssocReq = NULL;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302754 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002755 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002756} // End limSendAssocReqMgmtFrame
2757
2758
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002759#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002760/*------------------------------------------------------------------------------------
2761 *
2762 * Send Reassoc Req with FTIEs.
2763 *
2764 *-----------------------------------------------------------------------------------
2765 */
2766void
2767limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac,
2768 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
2769{
2770 static tDot11fReAssocRequest frm;
2771 tANI_U16 caps;
2772 tANI_U8 *pFrame;
2773 tSirRetStatus nSirStatus;
2774 tANI_U32 nBytes, nPayload, nStatus;
2775 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2776 void *pPacket;
2777 eHalStatus halstatus;
2778#if defined WLAN_FEATURE_VOWIFI
2779 tANI_U8 PowerCapsPopulated = FALSE;
2780#endif
2781 tANI_U16 ft_ies_length = 0;
2782 tANI_U8 *pBody;
2783 tANI_U16 nAddIELen;
2784 tANI_U8 *pAddIE;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002785#if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 tANI_U8 *wpsIe = NULL;
2787#endif
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302788 tANI_U32 txFlag = 0;
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302789 tpSirMacMgmtHdr pMacHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002790
2791 if (NULL == psessionEntry)
2792 {
2793 return;
2794 }
2795
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 /* check this early to avoid unncessary operation */
2797 if(NULL == psessionEntry->pLimReAssocReq)
2798 {
2799 return;
2800 }
2801 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
2802 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002803 limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in "
2804 "state (%d)."), psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002805
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302806 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002807
2808 caps = pMlmReassocReq->capabilityInfo;
2809 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
2810 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2811#if defined(FEATURE_WLAN_WAPI)
2812 /* CR: 262463 :
2813 According to WAPI standard:
2814 7.3.1.4 Capability Information field
2815 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2816 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2817 Reassociation management frames. */
2818 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2819 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2820#endif
2821 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
2822
2823 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
2824
2825 // Get the old bssid of the older AP.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302826 vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac,
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6);
2828
2829 PopulateDot11fSSID2( pMac, &frm.SSID );
2830 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2831 &frm.SuppRates,psessionEntry);
2832
2833 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2834 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
2835
2836 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2837 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
2838
2839 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2840 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
2841
2842 if ( psessionEntry->lim11hEnable &&
2843 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
2844 {
2845#if defined WLAN_FEATURE_VOWIFI
2846 PowerCapsPopulated = TRUE;
2847
2848 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
2849 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
2850#endif
2851 }
2852
2853#if defined WLAN_FEATURE_VOWIFI
2854 if( pMac->rrm.rrmPEContext.rrmEnable &&
2855 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2856 {
2857 if (PowerCapsPopulated == FALSE)
2858 {
2859 PowerCapsPopulated = TRUE;
2860 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
2861 }
2862 }
2863#endif
2864
2865 if ( fQosEnabled &&
2866 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
2867 {
2868 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
2869 }
2870
2871 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2872 &frm.ExtSuppRates, psessionEntry );
2873
2874#if defined WLAN_FEATURE_VOWIFI
2875 if( pMac->rrm.rrmPEContext.rrmEnable &&
2876 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
2877 {
2878 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
2879 }
2880#endif
2881
2882 // Ideally this should be enabled for 11r also. But 11r does
2883 // not follow the usual norm of using the Opaque object
2884 // for rsnie and fties. Instead we just add
2885 // the rsnie and fties at the end of the pack routine for 11r.
2886 // This should ideally! be fixed.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002887#if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002888 //
2889 // The join request *should* contain zero or one of the WPA and RSN
2890 // IEs. The payload send along with the request is a
2891 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2892
2893 // typedef struct sSirRSNie
2894 // {
2895 // tANI_U16 length;
2896 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2897 // } tSirRSNie, *tpSirRSNie;
2898
2899 // So, we should be able to make the following two calls harmlessly,
2900 // since they do nothing if they don't find the given IE in the
2901 // bytestream with which they're provided.
2902
2903 // The net effect of this will be to faithfully transmit whatever
2904 // security IE is in the join request.
2905
2906 // *However*, if we're associating for the purpose of WPS
2907 // enrollment, and we've been configured to indicate that by
2908 // eliding the WPA or RSN IE, we just skip this:
2909 if (!psessionEntry->is11Rconnection)
2910 {
2911 if( nAddIELen && pAddIE )
2912 {
2913 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
2914 }
2915 if ( NULL == wpsIe )
2916 {
2917 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2918 &frm.RSNOpaque );
2919 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2920 &frm.WPAOpaque );
2921 }
2922
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002923#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302924 if (psessionEntry->pLimReAssocReq->cckmIE.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002925 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002926 PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ),
2927 &frm.ESECckmOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002928 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002929#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 }
2931
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002932#ifdef FEATURE_WLAN_ESE
2933 // For ESE Associations fill the ESE IEs
2934 if (psessionEntry->isESEconnection &&
2935 psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002936 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002937#ifndef FEATURE_DISABLE_RM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002938 PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002939#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002940 PopulateDot11fESEVersion(&frm.ESEVersion);
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002942#endif //FEATURE_WLAN_ESE
2943#endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -07002944
2945 // include WME EDCA IE as well
2946 if ( fWmeEnabled )
2947 {
2948 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
2949 {
2950 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
2951 }
2952
2953 if ( fWsmEnabled &&
2954 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
2955 {
2956 PopulateDot11fWMMCaps( &frm.WMMCaps );
2957 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002958#ifdef FEATURE_WLAN_ESE
2959 if (psessionEntry->isESEconnection)
Jeff Johnson295189b2012-06-20 16:38:30 -07002960 {
2961 PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry);
2962
2963 // Populate the TSRS IE if TSPEC is included in the reassoc request
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002964 if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs)
Jeff Johnson295189b2012-06-20 16:38:30 -07002965 {
2966 tANI_U32 phyMode;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002967 tSirMacESETSRSIE tsrsIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002968 limGetPhyMode(pMac, &phyMode, psessionEntry);
2969
2970 tsrsIE.tsid = 0;
2971 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
2972 {
2973 tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
2974 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302975 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002976 {
2977 tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
2978 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002979 PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8));
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 }
2981 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302982#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002983 }
2984
Jeff Johnsone7245742012-09-05 17:12:55 -07002985 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002986 pMac->lim.htCapabilityPresentInBeacon)
2987 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002988 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 }
Agrawal Ashishb10d0392015-08-06 16:18:20 +05302990 limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
2991 "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
2992 frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave,
2993 frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz,
2994 frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor);
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002995#if defined WLAN_FEATURE_VOWIFI_11R
Kanchanapally, Vidyullatha4f84f682014-04-29 20:40:34 +05302996 if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent &&
2997 (pMac->ft.ftSmeContext.addMDIE == TRUE)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002998#if defined FEATURE_WLAN_ESE
2999 && !psessionEntry->isESEconnection
Gopichand Nakkala0ac55062013-04-08 14:43:07 +05303000#endif
3001 )
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003002 {
3003 PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie);
3004 }
3005#endif
3006
Chet Lanctotf19c1f62013-12-13 13:56:21 -08003007#ifdef WLAN_FEATURE_11AC
3008 if ( psessionEntry->vhtCapability &&
3009 psessionEntry->vhtCapabilityPresentInBeacon)
3010 {
3011 limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05303012 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
3013 psessionEntry->currentOperChannel, eSIR_FALSE );
Abhishek Singhe038dc62015-05-22 11:36:45 +05303014
Chet Lanctotf19c1f62013-12-13 13:56:21 -08003015 }
3016#endif
Hu Wang5193b572016-08-11 10:04:47 +08003017 if (psessionEntry->ExtCap.present)
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303018 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Chet Lanctotf19c1f62013-12-13 13:56:21 -08003019
Jeff Johnson295189b2012-06-20 16:38:30 -07003020 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
3021 if ( DOT11F_FAILED( nStatus ) )
3022 {
3023 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003024 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 nStatus );
3026 // We'll fall back on the worst case scenario:
3027 nPayload = sizeof( tDot11fReAssocRequest );
3028 }
3029 else if ( DOT11F_WARNED( nStatus ) )
3030 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003031 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003033 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003034 }
3035
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07003036 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
Jeff Johnson295189b2012-06-20 16:38:30 -07003037
3038#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08003039 limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 pMac->ft.ftSmeContext.reassoc_ft_ies_length);
3041#endif
3042
3043#if defined WLAN_FEATURE_VOWIFI_11R
3044 if (psessionEntry->is11Rconnection)
3045 {
3046 ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length;
3047 }
3048#endif
3049
3050 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3051 ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame,
3052 ( void** ) &pPacket );
3053 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3054 {
3055 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003056 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003058 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 goto end;
3060 }
3061
3062 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303063 vos_mem_set( pFrame, nBytes + ft_ies_length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003064
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003065#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08003066 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003067#endif
3068 // Next, we fill out the buffer descriptor:
3069 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3070 SIR_MAC_MGMT_REASSOC_REQ,
3071 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
3072 if ( eSIR_SUCCESS != nSirStatus )
3073 {
3074 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003075 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003076 nSirStatus );
3077 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3078 goto end;
3079 }
3080
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303081 pMacHdr = (tpSirMacMgmtHdr) pFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 // That done, pack the ReAssoc Request:
3083 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
3084 sizeof(tSirMacMgmtHdr),
3085 nPayload, &nPayload );
3086 if ( DOT11F_FAILED( nStatus ) )
3087 {
3088 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003089 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003090 nStatus );
3091 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3092 goto end;
3093 }
3094 else if ( DOT11F_WARNED( nStatus ) )
3095 {
3096 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003097 "e-Association Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003098 }
3099
3100 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003101 FL("*** Sending Re-Association Request length %d %d to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 nBytes, nPayload );)
3103 if( psessionEntry->assocReq != NULL )
3104 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303105 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003106 psessionEntry->assocReq = NULL;
3107 }
3108
3109 if( nAddIELen )
3110 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303111 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
3112 pAddIE,
3113 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07003114 nPayload += nAddIELen;
3115 }
3116
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303117 psessionEntry->assocReq = vos_mem_malloc(nPayload);
3118 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003119 {
3120 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07003121 }
3122 else
3123 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003124 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303125 vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07003127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003128
3129 if (psessionEntry->is11Rconnection)
3130 {
3131 {
3132 int i = 0;
3133
3134 pBody = pFrame + nBytes;
3135 for (i=0; i<ft_ies_length; i++)
3136 {
3137 *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i];
3138 pBody++;
3139 }
3140 }
3141 }
3142
3143#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003144 PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: "));
3145 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003146 (tANI_U8 *)pFrame,
3147 (nBytes + ft_ies_length));)
3148#endif
3149
3150
3151 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003152 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3153 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003154 )
3155 {
3156 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3157 }
3158
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003159 if( NULL != psessionEntry->assocReq )
3160 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303161 vos_mem_free(psessionEntry->assocReq);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003162 psessionEntry->assocReq = NULL;
3163 }
Agrawal Ashishad64dc22016-02-04 11:32:15 +05303164 if (ft_ies_length)
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003165 {
Agrawal Ashishad64dc22016-02-04 11:32:15 +05303166 psessionEntry->assocReq = vos_mem_malloc(ft_ies_length);
3167 if (NULL == psessionEntry->assocReq)
3168 {
3169 limLog(pMac, LOGE,
3170 FL("Unable to allocate memory for FT IEs"));
3171 psessionEntry->assocReqLen = 0;
3172 }
3173 else
3174 {
3175 /* Store the FT IEs. This is sent to csr/hdd in join cnf response.*/
3176 vos_mem_copy(psessionEntry->assocReq,
3177 pMac->ft.ftSmeContext.reassoc_ft_ies,
3178 (ft_ies_length));
3179 psessionEntry->assocReqLen = ft_ies_length;
3180 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003181 }
3182 else
3183 {
Agrawal Ashishad64dc22016-02-04 11:32:15 +05303184 limLog(pMac, LOG1, FL("FT IEs not present"));
3185 psessionEntry->assocReqLen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003186 }
Deepthi Gowri639d5042015-11-16 20:23:39 +05303187#ifdef FEATURE_WLAN_DIAG_SUPPORT
3188 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry,
3189 eSIR_SUCCESS, eSIR_SUCCESS);
3190#endif
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303191 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
3192 psessionEntry->peSessionId,
3193 pMacHdr->fc.subType));
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303194 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
3195 {
3196 limLog( pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken);
3197 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
3198 ( tANI_U16 ) (nBytes + ft_ies_length),
3199 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
3200 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3201 limTxComplete, pFrame, limTxBdComplete, txFlag,
3202 pMac->lim.txBdToken);
3203 pMac->lim.txBdToken++;
3204 }
3205 else
3206 {
3207 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length),
3208 HAL_TXRX_FRM_802_11_MGMT,
3209 ANI_TXDIR_TODS,
3210 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3211 limTxComplete, pFrame, txFlag );
3212 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303213 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
3214 psessionEntry->peSessionId,
3215 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07003216 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3217 {
3218 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003219 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003220 nSirStatus );
3221 //Pkt will be freed up by the callback
3222 goto end;
3223 }
3224
Katya Nigamccaeda72015-04-20 18:51:22 +05303225 // Enable TL cahching in case of roaming
3226 WLANTL_EnableCaching(psessionEntry->staId);
3227
Jeff Johnson295189b2012-06-20 16:38:30 -07003228end:
3229 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303230 vos_mem_free( pMlmReassocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -07003231 psessionEntry->pLimMlmReassocReq = NULL;
3232
3233}
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003234
3235void limSendRetryReassocReqFrame(tpAniSirGlobal pMac,
3236 tLimMlmReassocReq *pMlmReassocReq,
3237 tpPESession psessionEntry)
3238{
3239 tLimMlmReassocCnf mlmReassocCnf; // keep sme
3240 tLimMlmReassocReq *pTmpMlmReassocReq = NULL;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303241#ifdef FEATURE_WLAN_ESE
3242 tANI_U32 val=0;
3243#endif
3244 if (pMlmReassocReq == NULL)
3245 {
3246 limLog(pMac, LOGE,
3247 FL("Invalid pMlmReassocReq"));
3248 goto end;
3249 }
Hema Aparna Medicharla43d0f7b2015-02-12 17:07:59 +05303250
3251 pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
3252 if ( NULL == pTmpMlmReassocReq ) goto end;
3253 vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0);
3254 vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003255
3256 // Prepare and send Reassociation request frame
3257 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05303258#ifdef FEATURE_WLAN_ESE
3259 /*
3260 * In case of Ese Reassociation, change the reassoc timer
3261 * value.
3262 */
3263 val = pMlmReassocReq->reassocFailureTimeout;
3264 if (psessionEntry->isESEconnection)
3265 {
3266 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3267 }
3268 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3269 TX_SUCCESS)
3270 {
3271 limLog(pMac, LOGP,
3272 FL("unable to deactivate Reassoc failure timer"));
3273 }
3274 val = SYS_MS_TO_TICKS(val);
3275 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3276 val, 0) != TX_SUCCESS)
3277 {
3278 limLog(pMac, LOGP,
3279 FL("unable to change Reassociation failure timer"));
3280 }
3281#endif
3282
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003283 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
3284 // Start reassociation failure timer
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003285 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003286 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3287 != TX_SUCCESS)
3288 {
3289 // Could not start reassoc failure timer.
3290 // Log error
3291 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003292 FL("could not start Reassociation failure timer"));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003293 // Return Reassoc confirm with
3294 // Resources Unavailable
3295 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3296 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3297 goto end;
3298 }
3299
3300 limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry);
3301 return;
3302
3303end:
3304 // Free up buffer allocated for reassocReq
3305 if (pMlmReassocReq != NULL)
3306 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303307 vos_mem_free(pMlmReassocReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003308 pMlmReassocReq = NULL;
3309 }
3310 if (pTmpMlmReassocReq != NULL)
3311 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303312 vos_mem_free(pTmpMlmReassocReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003313 pTmpMlmReassocReq = NULL;
3314 }
3315 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3316 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3317 /* Update PE sessio Id*/
3318 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3319
3320 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3321}
3322
Jeff Johnson295189b2012-06-20 16:38:30 -07003323#endif /* WLAN_FEATURE_VOWIFI_11R */
3324
3325
3326void
3327limSendReassocReqMgmtFrame(tpAniSirGlobal pMac,
3328 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
3329{
3330 static tDot11fReAssocRequest frm;
3331 tANI_U16 caps;
3332 tANI_U8 *pFrame;
3333 tSirRetStatus nSirStatus;
3334 tANI_U32 nBytes, nPayload, nStatus;
3335 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
3336 void *pPacket;
3337 eHalStatus halstatus;
3338 tANI_U16 nAddIELen;
3339 tANI_U8 *pAddIE;
3340 tANI_U8 *wpsIe = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303341 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003342#if defined WLAN_FEATURE_VOWIFI
3343 tANI_U8 PowerCapsPopulated = FALSE;
3344#endif
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303345 tpSirMacMgmtHdr pMacHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07003346
3347 if(NULL == psessionEntry)
3348 {
3349 return;
3350 }
3351
3352 /* check this early to avoid unncessary operation */
3353 if(NULL == psessionEntry->pLimReAssocReq)
3354 {
3355 return;
3356 }
3357 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
3358 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
3359
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303360 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003361
3362 caps = pMlmReassocReq->capabilityInfo;
3363 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
3364 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
3365#if defined(FEATURE_WLAN_WAPI)
3366 /* CR: 262463 :
3367 According to WAPI standard:
3368 7.3.1.4 Capability Information field
3369 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
3370 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
3371 Reassociation management frames. */
3372 if ( psessionEntry->encryptType == eSIR_ED_WPI)
3373 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
3374#endif
3375 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
3376
3377 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
3378
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303379 vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac,
3380 ( tANI_U8* )psessionEntry->bssId, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003381
3382 PopulateDot11fSSID2( pMac, &frm.SSID );
3383 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
3384 &frm.SuppRates,psessionEntry);
3385
3386 fQosEnabled = ( psessionEntry->limQosEnabled ) &&
3387 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
3388
3389 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
3390 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
3391
3392 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
3393 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
3394
3395
3396 if ( psessionEntry->lim11hEnable &&
3397 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
3398 {
3399#if defined WLAN_FEATURE_VOWIFI
3400 PowerCapsPopulated = TRUE;
3401 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
3402 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
3403#endif
3404 }
3405
3406#if defined WLAN_FEATURE_VOWIFI
3407 if( pMac->rrm.rrmPEContext.rrmEnable &&
3408 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
3409 {
3410 if (PowerCapsPopulated == FALSE)
3411 {
3412 PowerCapsPopulated = TRUE;
3413 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
3414 }
3415 }
3416#endif
3417
3418 if ( fQosEnabled &&
3419 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
3420 {
3421 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
3422 }
3423
3424 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
3425 &frm.ExtSuppRates, psessionEntry );
3426
3427#if defined WLAN_FEATURE_VOWIFI
3428 if( pMac->rrm.rrmPEContext.rrmEnable &&
3429 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
3430 {
3431 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
3432 }
3433#endif
3434 // The join request *should* contain zero or one of the WPA and RSN
3435 // IEs. The payload send along with the request is a
3436 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
3437
3438 // typedef struct sSirRSNie
3439 // {
3440 // tANI_U16 length;
3441 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
3442 // } tSirRSNie, *tpSirRSNie;
3443
3444 // So, we should be able to make the following two calls harmlessly,
3445 // since they do nothing if they don't find the given IE in the
3446 // bytestream with which they're provided.
3447
3448 // The net effect of this will be to faithfully transmit whatever
3449 // security IE is in the join request.
3450
3451 // *However*, if we're associating for the purpose of WPS
3452 // enrollment, and we've been configured to indicate that by
3453 // eliding the WPA or RSN IE, we just skip this:
3454 if( nAddIELen && pAddIE )
3455 {
3456 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
3457 }
3458 if ( NULL == wpsIe )
3459 {
3460 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
3461 &frm.RSNOpaque );
3462 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
3463 &frm.WPAOpaque );
3464#if defined(FEATURE_WLAN_WAPI)
3465 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
3466 &frm.WAPIOpaque );
3467#endif // defined(FEATURE_WLAN_WAPI)
3468 }
3469
3470 // include WME EDCA IE as well
3471 if ( fWmeEnabled )
3472 {
3473 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
3474 {
3475 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
3476 }
3477
3478 if ( fWsmEnabled &&
3479 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
3480 {
3481 PopulateDot11fWMMCaps( &frm.WMMCaps );
3482 }
3483 }
3484
Jeff Johnsone7245742012-09-05 17:12:55 -07003485 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 pMac->lim.htCapabilityPresentInBeacon)
3487 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003488 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 }
Agrawal Ashishb10d0392015-08-06 16:18:20 +05303490 limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
3491 "shortGI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"),
3492 frm.HTCaps.supportedChannelWidthSet, frm.HTCaps.mimoPowerSave,
3493 frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, frm.HTCaps.shortGI40MHz,
3494 frm.HTCaps.dsssCckMode40MHz, frm.HTCaps.maxRxAMPDUFactor);
Jeff Johnsone7245742012-09-05 17:12:55 -07003495#ifdef WLAN_FEATURE_11AC
3496 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003497 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07003498 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -08003499 limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05303500 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
3501 psessionEntry->currentOperChannel, eSIR_FALSE );
Hu Wang5193b572016-08-11 10:04:47 +08003502 if (psessionEntry->ExtCap.present)
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303503 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003504 }
3505#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003506
3507 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
3508 if ( DOT11F_FAILED( nStatus ) )
3509 {
3510 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003511 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 nStatus );
3513 // We'll fall back on the worst case scenario:
3514 nPayload = sizeof( tDot11fReAssocRequest );
3515 }
3516 else if ( DOT11F_WARNED( nStatus ) )
3517 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003518 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07003519 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003520 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003521 }
3522
3523 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
3524
3525 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3526 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3527 ( void** ) &pPacket );
3528 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3529 {
3530 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003531 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003533 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 goto end;
3535 }
3536
3537 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303538 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003539
3540 // Next, we fill out the buffer descriptor:
3541 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3542 SIR_MAC_MGMT_REASSOC_REQ,
3543 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
3544 if ( eSIR_SUCCESS != nSirStatus )
3545 {
3546 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003547 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003548 nSirStatus );
3549 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3550 goto end;
3551 }
3552
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303553 pMacHdr = (tpSirMacMgmtHdr) pFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07003554 // That done, pack the Probe Request:
3555 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
3556 sizeof(tSirMacMgmtHdr),
3557 nPayload, &nPayload );
3558 if ( DOT11F_FAILED( nStatus ) )
3559 {
3560 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003561 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 nStatus );
3563 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3564 goto end;
3565 }
3566 else if ( DOT11F_WARNED( nStatus ) )
3567 {
3568 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003569 "e-Association Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 }
3571
3572 PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003573 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003574 nBytes );)
3575
3576 if( psessionEntry->assocReq != NULL )
3577 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303578 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 psessionEntry->assocReq = NULL;
3580 }
3581
3582 if( nAddIELen )
3583 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303584 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
3585 pAddIE,
3586 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07003587 nPayload += nAddIELen;
3588 }
3589
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303590 psessionEntry->assocReq = vos_mem_malloc(nPayload);
3591 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003592 {
3593 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07003594 }
3595 else
3596 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003597 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303598 vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07003600 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003601
3602 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3604 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 )
3606 {
3607 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3608 }
3609
Sushant Kaushike8681d22015-04-21 12:08:25 +05303610 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
3611 psessionEntry->pePersona == VOS_STA_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08003612 {
3613 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3614 }
Deepthi Gowri639d5042015-11-16 20:23:39 +05303615#ifdef FEATURE_WLAN_DIAG_SUPPORT
3616 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_START_EVENT, psessionEntry,
3617 eSIR_SUCCESS, eSIR_SUCCESS);
3618#endif
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003619
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303620 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
3621 psessionEntry->peSessionId,
3622 pMacHdr->fc.subType));
Katya Nigam63902932014-06-26 19:04:23 +05303623
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303624 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
3625 {
3626 limLog(pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken);
3627 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
3628 ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
3629 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
3630 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3631 limTxComplete, pFrame, limTxBdComplete,
3632 txFlag, pMac->lim.txBdToken );
3633 pMac->lim.txBdToken++;
3634 }
3635 else
3636 {
3637 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
3638 HAL_TXRX_FRM_802_11_MGMT,
3639 ANI_TXDIR_TODS,
3640 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3641 limTxComplete, pFrame, txFlag );
3642 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303643 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
3644 psessionEntry->peSessionId,
3645 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07003646 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3647 {
3648 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003649 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 nSirStatus );
3651 //Pkt will be freed up by the callback
3652 goto end;
3653 }
3654
Katya Nigamccaeda72015-04-20 18:51:22 +05303655 // enable caching
3656 WLANTL_EnableCaching(psessionEntry->staId);
3657
Jeff Johnson295189b2012-06-20 16:38:30 -07003658end:
3659 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303660 vos_mem_free( pMlmReassocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -07003661 psessionEntry->pLimMlmReassocReq = NULL;
3662
3663} // limSendReassocReqMgmtFrame
3664
Sushant Kaushik9e923872015-04-02 17:09:31 +05303665eHalStatus limAuthTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303666{
Sushant Kaushik9e923872015-04-02 17:09:31 +05303667 tANI_U32 txCompleteSuccess;
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303668 tpSirTxBdStatus pTxBdStatus;
Sushant Kaushik9e923872015-04-02 17:09:31 +05303669
3670 if (!pData)
3671 {
3672 limLog(pMac, LOG1,
3673 FL(" pData is NULL"));
3674 return eHAL_STATUS_FAILURE;
3675 }
Sushant Kaushik9e923872015-04-02 17:09:31 +05303676
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303677 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
3678 {
3679 pTxBdStatus = (tpSirTxBdStatus) pData;
3680 txCompleteSuccess = pTxBdStatus->txCompleteStatus;
3681 limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
3682 pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
3683 }
3684 else
3685 {
3686 txCompleteSuccess = *((tANI_U32*) pData);
3687 limLog(pMac, LOG1,
3688 FL("txCompleteSuccess= %d"), txCompleteSuccess);
3689 }
3690
Sushant Kaushik9e923872015-04-02 17:09:31 +05303691 if(txCompleteSuccess)
3692 {
3693 pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS;
3694 // 'Change' timer for future activations
3695 limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
3696 }
3697 else
3698 pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE;
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303699#ifdef FEATURE_WLAN_DIAG_SUPPORT
Deepthi Gowri639d5042015-11-16 20:23:39 +05303700 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_START_EVENT, NULL,
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303701 pMac->authAckStatus, eSIR_SUCCESS);
3702#endif
3703
Sushant Kaushik9e923872015-04-02 17:09:31 +05303704 return eHAL_STATUS_SUCCESS;
3705}
3706
Jeff Johnson295189b2012-06-20 16:38:30 -07003707/**
3708 * \brief Send an Authentication frame
3709 *
3710 *
3711 * \param pMac Pointer to Global MAC structure
3712 *
3713 * \param pAuthFrameBody Pointer to Authentication frame structure that need
3714 * to be sent
3715 *
3716 * \param peerMacAddr MAC address of the peer entity to which Authentication
3717 * frame is destined
3718 *
3719 * \param wepBit Indicates whether wep bit to be set in FC while sending
3720 * Authentication frame3
3721 *
3722 *
3723 * This function is called by limProcessMlmMessages(). Authentication frame
3724 * is formatted and sent when this function is called.
3725 *
3726 *
3727 */
3728
3729void
3730limSendAuthMgmtFrame(tpAniSirGlobal pMac,
3731 tpSirMacAuthFrameBody pAuthFrameBody,
3732 tSirMacAddr peerMacAddr,
yeshwanth sriram guntukaccf694b2017-08-14 13:30:56 +05303733 tANI_U8 wep_challenge_len,
Sushant Kaushik9e923872015-04-02 17:09:31 +05303734 tpPESession psessionEntry,
3735 tAniBool waitForAck
Jeff Johnson295189b2012-06-20 16:38:30 -07003736 )
3737{
3738 tANI_U8 *pFrame, *pBody;
3739 tANI_U32 frameLen = 0, bodyLen = 0;
3740 tpSirMacMgmtHdr pMacHdr;
3741 tANI_U16 i;
3742 void *pPacket;
3743 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303744 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003745
3746 if(NULL == psessionEntry)
3747 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303748 limLog(pMac, LOGE, FL("Error: psession Entry is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003749 return;
3750 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05303751
3752 limLog(pMac, LOG1,
3753 FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR),
3754 pAuthFrameBody->authTransactionSeqNumber,
3755 pAuthFrameBody->authStatusCode,
3756 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
3757 MAC_ADDR_ARRAY(peerMacAddr));
yeshwanth sriram guntukaccf694b2017-08-14 13:30:56 +05303758 if (wep_challenge_len)
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 {
3760 /// Auth frame3 to be sent with encrypted framebody
3761 /**
3762 * Allocate buffer for Authenticaton frame of size equal
3763 * to management frame header length plus 2 bytes each for
3764 * auth algorithm number, transaction number, status code,
3765 * 128 bytes for challenge text and 4 bytes each for
3766 * IV & ICV.
3767 */
yeshwanth sriram guntukaccf694b2017-08-14 13:30:56 +05303768 bodyLen = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN;
3769 frameLen = sizeof(tSirMacMgmtHdr) + bodyLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07003770 } // if (wepBit == LIM_WEP_IN_FC)
3771 else
3772 {
3773 switch (pAuthFrameBody->authTransactionSeqNumber)
3774 {
3775 case SIR_MAC_AUTH_FRAME_1:
3776 /**
3777 * Allocate buffer for Authenticaton frame of size
3778 * equal to management frame header length plus 2 bytes
3779 * each for auth algorithm number, transaction number
3780 * and status code.
3781 */
3782
3783 frameLen = sizeof(tSirMacMgmtHdr) +
3784 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3785 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3786
3787#if defined WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003788 if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH)
3789 {
3790 if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
Jeff Johnson295189b2012-06-20 16:38:30 -07003791 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003792 frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003793 limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"),
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003794 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003795 }
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003796 else
3797 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303798 limLog(pMac, LOG3, FL("Auth frame, Does not contain "
3799 "FTIES!!!"));
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003800 frameLen += (2+SIR_MDIE_SIZE);
3801 }
3802 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003803#endif
3804 break;
3805
3806 case SIR_MAC_AUTH_FRAME_2:
3807 if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) ||
3808 ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) &&
3809 (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS)))
3810 {
3811 /**
3812 * Allocate buffer for Authenticaton frame of size
3813 * equal to management frame header length plus
3814 * 2 bytes each for auth algorithm number,
3815 * transaction number and status code.
3816 */
3817
3818 frameLen = sizeof(tSirMacMgmtHdr) +
3819 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3820 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3821 }
3822 else
3823 {
3824 // Shared Key algorithm with challenge text
3825 // to be sent
3826 /**
3827 * Allocate buffer for Authenticaton frame of size
3828 * equal to management frame header length plus
3829 * 2 bytes each for auth algorithm number,
3830 * transaction number, status code and 128 bytes
3831 * for challenge text.
3832 */
3833
3834 frameLen = sizeof(tSirMacMgmtHdr) +
3835 sizeof(tSirMacAuthFrame);
3836 bodyLen = sizeof(tSirMacAuthFrameBody);
3837 }
3838
3839 break;
3840
3841 case SIR_MAC_AUTH_FRAME_3:
3842 /// Auth frame3 to be sent without encrypted framebody
3843 /**
3844 * Allocate buffer for Authenticaton frame of size equal
3845 * to management frame header length plus 2 bytes each
3846 * for auth algorithm number, transaction number and
3847 * status code.
3848 */
3849
3850 frameLen = sizeof(tSirMacMgmtHdr) +
3851 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3852 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3853
3854 break;
3855
3856 case SIR_MAC_AUTH_FRAME_4:
3857 /**
3858 * Allocate buffer for Authenticaton frame of size equal
3859 * to management frame header length plus 2 bytes each
3860 * for auth algorithm number, transaction number and
3861 * status code.
3862 */
3863
3864 frameLen = sizeof(tSirMacMgmtHdr) +
3865 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3866 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3867
3868 break;
3869 } // switch (pAuthFrameBody->authTransactionSeqNumber)
3870 } // end if (wepBit == LIM_WEP_IN_FC)
3871
3872
3873 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket );
3874
3875 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3876 {
3877 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003878 limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003879
3880 return;
3881 }
3882
3883 for (i = 0; i < frameLen; i++)
3884 pFrame[i] = 0;
3885
3886 // Prepare BD
3887 if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME,
3888 SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS)
3889 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303890 limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for "
3891 "AUTH frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003892 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3893 return;
3894 }
3895
3896 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
yeshwanth sriram guntukaccf694b2017-08-14 13:30:56 +05303897 if (wep_challenge_len)
3898 pMacHdr->fc.wep = LIM_WEP_IN_FC;
3899 else
3900 pMacHdr->fc.wep = LIM_NO_WEP_IN_FC;
Jeff Johnson295189b2012-06-20 16:38:30 -07003901
3902 // Prepare BSSId
3903 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
3904 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303905 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
3906 (tANI_U8 *) psessionEntry->bssId,
3907 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003908 }
3909
3910 /// Prepare Authentication frame body
3911 pBody = pFrame + sizeof(tSirMacMgmtHdr);
3912
yeshwanth sriram guntukaccf694b2017-08-14 13:30:56 +05303913 if (wep_challenge_len)
Jeff Johnson295189b2012-06-20 16:38:30 -07003914 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303915 vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07003916
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303917 limLog(pMac, LOG1,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303918 FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR),
Jeff Johnson295189b2012-06-20 16:38:30 -07003919 pAuthFrameBody->authStatusCode,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303920 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303921 MAC_ADDR_ARRAY(pMacHdr->da));
Jeff Johnson295189b2012-06-20 16:38:30 -07003922
Jeff Johnson295189b2012-06-20 16:38:30 -07003923 }
3924 else
3925 {
3926 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber);
3927 pBody += sizeof(tANI_U16);
3928 bodyLen -= sizeof(tANI_U16);
3929
3930 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber);
3931 pBody += sizeof(tANI_U16);
3932 bodyLen -= sizeof(tANI_U16);
3933
3934 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode);
3935 pBody += sizeof(tANI_U16);
3936 bodyLen -= sizeof(tANI_U16);
Leela Venkata Kiran Kumar Reddy Chirala7d3fa552013-08-28 10:52:21 -07003937 if ( bodyLen <= (sizeof (pAuthFrameBody->type) +
3938 sizeof (pAuthFrameBody->length) +
3939 sizeof (pAuthFrameBody->challengeText)))
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303940 vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07003941
3942#if defined WLAN_FEATURE_VOWIFI_11R
3943 if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) &&
3944 (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1))
3945 {
3946
3947 {
3948 int i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003949 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
3950 {
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003951#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowdad63eb492014-02-06 12:21:47 -08003952 PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: "));
3953 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -07003954 (tANI_U8 *)pBody,
3955 (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003956#endif
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003957 for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++)
3958 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003959 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i];
3960 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003961 }
3962 }
3963 else
3964 {
3965 /* MDID attr is 54*/
3966 *pBody = 54;
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003968 *pBody = SIR_MDIE_SIZE;
3969 pBody++;
3970 for(i=0;i<SIR_MDIE_SIZE;i++)
3971 {
3972 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i];
3973 pBody++;
3974 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003975 }
3976 }
3977 }
3978#endif
3979
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303980 limLog(pMac, LOG1,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303981 FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR),
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 pAuthFrameBody->authTransactionSeqNumber,
3983 pAuthFrameBody->authStatusCode,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303984 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303985 MAC_ADDR_ARRAY(pMacHdr->da));
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 }
3987 PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);)
3988
3989 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3991 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003992#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303993 || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq)
Jeff Johnsone7245742012-09-05 17:12:55 -07003994 && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)))
3995#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 )
3997 {
3998 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3999 }
4000
Sushant Kaushike8681d22015-04-21 12:08:25 +05304001 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
4002 psessionEntry->pePersona == VOS_STA_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08004003 {
4004 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
4005 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004006
Sushant Kaushik9e923872015-04-02 17:09:31 +05304007 limLog( pMac, LOG1,
4008 FL("Sending Auth Frame over WQ5 with waitForAck %d to "MAC_ADDRESS_STR
4009 " From " MAC_ADDRESS_STR), waitForAck, MAC_ADDR_ARRAY(pMacHdr->da),
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05304010 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
4011
4012 txFlag |= HAL_USE_FW_IN_TX_PATH;
4013
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304014 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4015 psessionEntry->peSessionId,
4016 pMacHdr->fc.subType));
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05304017
4018 if( ( psessionEntry->is11Gonly == true ) &&
4019 ( !IS_BROADCAST_MAC(peerMacAddr) ) ){
4020 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4021 }
Sushant Kaushik9e923872015-04-02 17:09:31 +05304022 if(eSIR_TRUE == waitForAck)
4023 {
4024 pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD;
Sushant Kaushik0b343422015-05-25 17:15:55 +05304025 limLog(pMac, LOG1, FL("Auth frame - txBdToken %u"),
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05304026 pMac->lim.txBdToken);
Sushant Kaushik9e923872015-04-02 17:09:31 +05304027 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
4028 ( tANI_U16 ) frameLen,
4029 HAL_TXRX_FRM_802_11_MGMT,
4030 ANI_TXDIR_TODS,
4031 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05304032 limTxComplete, pFrame, limAuthTxCompleteCnf, txFlag,
4033 pMac->lim.txBdToken);
4034 pMac->lim.txBdToken++;
Sushant Kaushik9e923872015-04-02 17:09:31 +05304035 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4036 psessionEntry->peSessionId,
4037 halstatus));
4038 if (!HAL_STATUS_SUCCESS(halstatus))
4039 {
4040 limLog( pMac, LOGE,
4041 FL("Could not send Auth frame, retCode=%X "),
4042 halstatus );
4043 pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE;
4044 //Pkt will be freed up by the callback
4045 }
4046 }
4047 else
4048 {
4049 /// Queue Authentication frame in high priority WQ
4050 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen,
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 HAL_TXRX_FRM_802_11_MGMT,
4052 ANI_TXDIR_TODS,
4053 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4054 limTxComplete, pFrame, txFlag );
Sushant Kaushik9e923872015-04-02 17:09:31 +05304055 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304056 psessionEntry->peSessionId,
4057 halstatus));
Sushant Kaushik9e923872015-04-02 17:09:31 +05304058 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4059 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004061 FL("*** Could not send Auth frame, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004062 halstatus);
4063
4064 //Pkt will be freed up by the callback
Sushant Kaushik9e923872015-04-02 17:09:31 +05304065 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 }
4067
4068 return;
4069} /*** end limSendAuthMgmtFrame() ***/
4070
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004071eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac)
4072{
4073 tANI_U16 aid;
4074 tpDphHashNode pStaDs;
4075 tLimMlmDeauthReq *pMlmDeauthReq;
4076 tLimMlmDeauthCnf mlmDeauthCnf;
4077 tpPESession psessionEntry;
4078
4079 pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq;
4080 if (pMlmDeauthReq)
4081 {
4082 if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer))
4083 {
4084 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
4085 }
4086
4087 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL)
4088 {
4089
4090 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004091 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004092 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4093 goto end;
4094 }
4095
4096 pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4097 if (pStaDs == NULL)
4098 {
4099 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4100 goto end;
4101 }
4102
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004103 /// Receive path cleanup with dummy packet
4104 limCleanupRxPath(pMac, pStaDs,psessionEntry);
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304105
4106#ifdef WLAN_FEATURE_VOWIFI_11R
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304107 if ( psessionEntry->limSystemRole == eLIM_STA_ROLE )
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304108 {
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304109 PELOGE(limLog(pMac, LOG1,
4110 FL("FT Preauth SessionId %d Cleanup"
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304111#ifdef FEATURE_WLAN_ESE
4112 " isESE %d"
4113#endif
4114#ifdef FEATURE_WLAN_LFR
4115 " isLFR %d"
4116#endif
4117 " is11r %d, Deauth reason %d Trigger = %d"),
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304118 psessionEntry->peSessionId,
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304119#ifdef FEATURE_WLAN_ESE
4120 psessionEntry->isESEconnection,
4121#endif
4122#ifdef FEATURE_WLAN_LFR
4123 psessionEntry->isFastRoamIniFeatureEnabled,
4124#endif
4125 psessionEntry->is11Rconnection,
4126 pMlmDeauthReq->reasonCode,
4127 pMlmDeauthReq->deauthTrigger););
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304128
4129 limFTCleanup(pMac);
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304130 }
4131#endif
4132
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004133 /// Free up buffer allocated for mlmDeauthReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304134 vos_mem_free(pMlmDeauthReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004135 pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL;
4136 }
4137 return eHAL_STATUS_SUCCESS;
4138end:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304139 vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004140 (tANI_U8 *) pMlmDeauthReq->peerMacAddr,
4141 sizeof(tSirMacAddr));
4142 mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger;
4143 mlmDeauthCnf.aid = pMlmDeauthReq->aid;
4144 mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId;
4145
4146 // Free up buffer allocated
4147 // for mlmDeauthReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304148 vos_mem_free(pMlmDeauthReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004149
4150 limPostSmeMessage(pMac,
4151 LIM_MLM_DEAUTH_CNF,
4152 (tANI_U32 *) &mlmDeauthCnf);
4153 return eHAL_STATUS_SUCCESS;
4154}
4155
4156eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac)
4157{
4158 tANI_U16 aid;
4159 tpDphHashNode pStaDs;
4160 tLimMlmDisassocCnf mlmDisassocCnf;
4161 tpPESession psessionEntry;
4162 tLimMlmDisassocReq *pMlmDisassocReq;
4163
4164 pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq;
4165 if (pMlmDisassocReq)
4166 {
4167 if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer))
4168 {
4169 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
4170 }
4171
4172 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL)
4173 {
4174
4175 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004176 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004177 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4178 goto end;
4179 }
4180
4181 pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4182 if (pStaDs == NULL)
4183 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304184 limLog(pMac, LOGE,
4185 FL("StaDs Null"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004186 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4187 goto end;
4188 }
4189
4190 /// Receive path cleanup with dummy packet
4191 if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry))
4192 {
4193 mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304194 limLog(pMac, LOGE,
4195 FL("CleanupRxPath error"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004196 goto end;
4197 }
4198
4199#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004200 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) &&
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05304201 (pMlmDisassocReq->reasonCode !=
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004202 eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004203 {
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304204 PELOGE(limLog(pMac, LOG1,
4205 FL("FT Preauth SessionId %d Cleanup"
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004206#ifdef FEATURE_WLAN_ESE
4207 " isESE %d"
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004208#endif
4209#ifdef FEATURE_WLAN_LFR
4210 " isLFR %d"
4211#endif
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004212 " is11r %d reason %d"),
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304213 psessionEntry->peSessionId,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004214#ifdef FEATURE_WLAN_ESE
4215 psessionEntry->isESEconnection,
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004216#endif
4217#ifdef FEATURE_WLAN_LFR
4218 psessionEntry->isFastRoamIniFeatureEnabled,
4219#endif
4220 psessionEntry->is11Rconnection,
4221 pMlmDisassocReq->reasonCode););
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304222 limFTCleanup(pMac);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004223 }
4224#endif
4225
4226 /// Free up buffer allocated for mlmDisassocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304227 vos_mem_free(pMlmDisassocReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004228 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
4229 return eHAL_STATUS_SUCCESS;
4230 }
4231 else
4232 {
4233 return eHAL_STATUS_SUCCESS;
4234 }
4235end:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304236 vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004237 (tANI_U8 *) pMlmDisassocReq->peerMacAddr,
4238 sizeof(tSirMacAddr));
4239 mlmDisassocCnf.aid = pMlmDisassocReq->aid;
4240 mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger;
4241
4242 /* Update PE session ID*/
4243 mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId;
4244
Madan Mohan Koyyalamudib7f5a672012-11-29 11:17:46 -08004245 if(pMlmDisassocReq != NULL)
4246 {
4247 /// Free up buffer allocated for mlmDisassocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304248 vos_mem_free(pMlmDisassocReq);
Madan Mohan Koyyalamudib7f5a672012-11-29 11:17:46 -08004249 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
4250 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004251
4252 limPostSmeMessage(pMac,
4253 LIM_MLM_DISASSOC_CNF,
4254 (tANI_U32 *) &mlmDisassocCnf);
4255 return eHAL_STATUS_SUCCESS;
4256}
4257
Ganesh Kondabattini358fc9b2015-03-11 16:14:25 +05304258eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004259{
Ganesh Kondabattinib18b3292015-03-16 16:59:26 +05304260 if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
4261 {
4262 tpSirTxBdStatus pTxBdStatus;
4263 pTxBdStatus = (tpSirTxBdStatus) pData;
4264 limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
4265 pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
4266 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004267 return limSendDisassocCnf(pMac);
4268}
4269
Ganesh Kondabattini358fc9b2015-03-11 16:14:25 +05304270eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004271{
Ganesh Kondabattinib18b3292015-03-16 16:59:26 +05304272 if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
4273 {
4274 tpSirTxBdStatus pTxBdStatus;
4275 pTxBdStatus = (tpSirTxBdStatus) pData;
4276 limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
4277 pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
4278 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004279 return limSendDeauthCnf(pMac);
4280}
4281
Jeff Johnson295189b2012-06-20 16:38:30 -07004282/**
4283 * \brief This function is called to send Disassociate frame.
4284 *
4285 *
4286 * \param pMac Pointer to Global MAC structure
4287 *
4288 * \param nReason Indicates the reason that need to be sent in
4289 * Disassociation frame
4290 *
4291 * \param peerMacAddr MAC address of the STA to which Disassociation frame is
4292 * sent
4293 *
4294 *
4295 */
4296
4297void
4298limSendDisassocMgmtFrame(tpAniSirGlobal pMac,
4299 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004300 tSirMacAddr peer,
4301 tpPESession psessionEntry,
4302 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004303{
4304 tDot11fDisassociation frm;
4305 tANI_U8 *pFrame;
4306 tSirRetStatus nSirStatus;
4307 tpSirMacMgmtHdr pMacHdr;
4308 tANI_U32 nBytes, nPayload, nStatus;
4309 void *pPacket;
4310 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304311 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004312 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 if(NULL == psessionEntry)
4314 {
4315 return;
4316 }
4317
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304318 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004319
4320 frm.Reason.code = nReason;
4321
4322 nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload );
4323 if ( DOT11F_FAILED( nStatus ) )
4324 {
4325 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004326 "or a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004327 nStatus );
4328 // We'll fall back on the worst case scenario:
4329 nPayload = sizeof( tDot11fDisassociation );
4330 }
4331 else if ( DOT11F_WARNED( nStatus ) )
4332 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004333 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 "the packed size for a Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004335 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004336 }
4337
4338 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4339
4340 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4341 ( tANI_U16 )nBytes, ( void** ) &pFrame,
4342 ( void** ) &pPacket );
4343 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4344 {
4345 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Dis"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004346 "association."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004347 return;
4348 }
4349
4350 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304351 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004352
4353 // Next, we fill out the buffer descriptor:
4354 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4355 SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr);
4356 if ( eSIR_SUCCESS != nSirStatus )
4357 {
4358 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004359 "tor for a Disassociation (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004360 nSirStatus );
4361 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4362 ( void* ) pFrame, ( void* ) pPacket );
4363 return; // just allocated...
4364 }
4365
4366 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4367
4368 // Prepare the BSSID
4369 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
4370
Chet Lanctot186b5732013-03-18 10:26:30 -07004371#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004372 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004373#endif
4374
Jeff Johnson295189b2012-06-20 16:38:30 -07004375 nStatus = dot11fPackDisassociation( pMac, &frm, pFrame +
4376 sizeof(tSirMacMgmtHdr),
4377 nPayload, &nPayload );
4378 if ( DOT11F_FAILED( nStatus ) )
4379 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004380 limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 nStatus );
4382 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4383 ( void* ) pFrame, ( void* ) pPacket );
4384 return; // allocated!
4385 }
4386 else if ( DOT11F_WARNED( nStatus ) )
4387 {
4388 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004389 "isassociation (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 }
4391
Abhishek Singhcd09b562013-12-24 16:02:20 +05304392 limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with "
4393 "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From "
4394 MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck,
4395 MAC_ADDR_ARRAY(pMacHdr->da),
4396 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004397
4398 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07004399 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4400 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004401 )
4402 {
4403 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4404 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004405
Sushant Kaushike8681d22015-04-21 12:08:25 +05304406 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004407
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304408 if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
4409 {
4410 /* This frame will be sent on air by firmware,
4411 which will ensure that this frame goes out
4412 even though DEL_STA is sent immediately */
4413 /* Without this for DEL_STA command there is
4414 risk of flushing frame in BTQM queue without
4415 sending on air */
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05304416 limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR
4417 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
4418 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304419 txFlag |= HAL_USE_FW_IN_TX_PATH;
4420 }
4421
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004422 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004423 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304424 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4425 psessionEntry->peSessionId,
4426 pMacHdr->fc.subType));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004427 // Queue Disassociation frame in high priority WQ
4428 /* get the duration from the request */
4429 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
4430 HAL_TXRX_FRM_802_11_MGMT,
4431 ANI_TXDIR_TODS,
4432 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4433 limTxComplete, pFrame, limDisassocTxCompleteCnf,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05304434 txFlag,
4435 pMac->lim.txBdToken++);
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304436 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4437 psessionEntry->peSessionId,
4438 halstatus));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004439 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
Jeff Johnson295189b2012-06-20 16:38:30 -07004440
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004441 if (tx_timer_change(
4442 &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0)
4443 != TX_SUCCESS)
4444 {
4445 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004446 FL("Unable to change Disassoc ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004447 return;
4448 }
4449 else if(TX_SUCCESS != tx_timer_activate(
4450 &pMac->lim.limTimers.gLimDisassocAckTimer))
4451 {
4452 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004453 FL("Unable to activate Disassoc ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004454 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
4455 return;
4456 }
4457 }
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004458 else
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004459 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304460 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4461 psessionEntry->peSessionId,
4462 pMacHdr->fc.subType));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004463 // Queue Disassociation frame in high priority WQ
4464 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4465 HAL_TXRX_FRM_802_11_MGMT,
4466 ANI_TXDIR_TODS,
4467 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4468 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304469 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4470 psessionEntry->peSessionId,
4471 halstatus));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004472 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4473 {
4474 limLog( pMac, LOGE, FL("Failed to send Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004475 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004476 nSirStatus );
4477 //Pkt will be freed up by the callback
4478 return;
4479 }
4480 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004481} // End limSendDisassocMgmtFrame.
4482
4483/**
4484 * \brief This function is called to send a Deauthenticate frame
4485 *
4486 *
4487 * \param pMac Pointer to global MAC structure
4488 *
4489 * \param nReason Indicates the reason that need to be sent in the
4490 * Deauthenticate frame
4491 *
4492 * \param peeer address of the STA to which the frame is to be sent
4493 *
4494 *
4495 */
4496
4497void
4498limSendDeauthMgmtFrame(tpAniSirGlobal pMac,
4499 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004500 tSirMacAddr peer,
4501 tpPESession psessionEntry,
4502 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004503{
4504 tDot11fDeAuth frm;
4505 tANI_U8 *pFrame;
4506 tSirRetStatus nSirStatus;
4507 tpSirMacMgmtHdr pMacHdr;
4508 tANI_U32 nBytes, nPayload, nStatus;
4509 void *pPacket;
4510 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304511 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004512 tANI_U32 val = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004513#ifdef FEATURE_WLAN_TDLS
4514 tANI_U16 aid;
4515 tpDphHashNode pStaDs;
4516#endif
4517
Jeff Johnson295189b2012-06-20 16:38:30 -07004518 if(NULL == psessionEntry)
4519 {
4520 return;
4521 }
4522
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304523 vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004524
4525 frm.Reason.code = nReason;
4526
4527 nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload );
4528 if ( DOT11F_FAILED( nStatus ) )
4529 {
4530 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004531 "or a De-Authentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 nStatus );
4533 // We'll fall back on the worst case scenario:
4534 nPayload = sizeof( tDot11fDeAuth );
4535 }
4536 else if ( DOT11F_WARNED( nStatus ) )
4537 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004538 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 "the packed size for a De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004540 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 }
4542
4543 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4544
4545 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4546 ( tANI_U16 )nBytes, ( void** ) &pFrame,
4547 ( void** ) &pPacket );
4548 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4549 {
4550 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004551 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 return;
4553 }
4554
4555 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304556 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004557
4558 // Next, we fill out the buffer descriptor:
4559 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4560 SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr);
4561 if ( eSIR_SUCCESS != nSirStatus )
4562 {
4563 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004564 "tor for a De-Authentication (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 nSirStatus );
4566 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4567 ( void* ) pFrame, ( void* ) pPacket );
4568 return; // just allocated...
4569 }
4570
4571 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4572
4573 // Prepare the BSSID
4574 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
4575
Chet Lanctot186b5732013-03-18 10:26:30 -07004576#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004577 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004578#endif
4579
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 nStatus = dot11fPackDeAuth( pMac, &frm, pFrame +
4581 sizeof(tSirMacMgmtHdr),
4582 nPayload, &nPayload );
4583 if ( DOT11F_FAILED( nStatus ) )
4584 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004585 limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004586 nStatus );
4587 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4588 ( void* ) pFrame, ( void* ) pPacket );
4589 return;
4590 }
4591 else if ( DOT11F_WARNED( nStatus ) )
4592 {
4593 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004594 "e-Authentication (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05304596 limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with "
4597 "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From "
4598 MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck,
4599 MAC_ADDR_ARRAY(pMacHdr->da),
4600 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004601
4602 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07004603 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4604 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004605 )
4606 {
4607 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4608 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004609
Sushant Kaushike8681d22015-04-21 12:08:25 +05304610 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004611
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304612 if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
4613 {
4614 /* This frame will be sent on air by firmware,
4615 which will ensure that this frame goes out
4616 even though DEL_STA is sent immediately */
4617 /* Without this for DEL_STA command there is
4618 risk of flushing frame in BTQM queue without
4619 sending on air */
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05304620 limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR
4621 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
4622 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304623 txFlag |= HAL_USE_FW_IN_TX_PATH;
4624 }
4625
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004626#ifdef FEATURE_WLAN_TDLS
4627 pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable);
4628#endif
4629
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004630 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004631 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304632 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4633 psessionEntry->peSessionId,
4634 pMacHdr->fc.subType));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004635 // Queue Disassociation frame in high priority WQ
4636 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
4637 HAL_TXRX_FRM_802_11_MGMT,
4638 ANI_TXDIR_TODS,
4639 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05304640 limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag,
4641 pMac->lim.txBdToken++);
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304642 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4643 psessionEntry->peSessionId,
4644 halstatus));
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304645 if (!HAL_STATUS_SUCCESS(halstatus))
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004646 {
4647 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304648 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004649 nSirStatus );
Gopichand Nakkala4261ea52012-12-31 16:43:00 -08004650 //Pkt will be freed up by the callback limTxComplete
4651
4652 /*Call limProcessDeauthAckTimeout which will send
4653 * DeauthCnf for this frame
4654 */
4655 limProcessDeauthAckTimeout(pMac);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004656 return;
4657 }
4658
4659 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
4660
4661 if (tx_timer_change(
4662 &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0)
4663 != TX_SUCCESS)
4664 {
4665 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004666 FL("Unable to change Deauth ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004667 return;
4668 }
4669 else if(TX_SUCCESS != tx_timer_activate(
4670 &pMac->lim.limTimers.gLimDeauthAckTimer))
4671 {
4672 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004673 FL("Unable to activate Deauth ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004674 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
4675 return;
4676 }
4677 }
4678 else
4679 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304680 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4681 psessionEntry->peSessionId,
4682 pMacHdr->fc.subType));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004683#ifdef FEATURE_WLAN_TDLS
4684 if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType))
4685 {
4686 // Queue Disassociation frame in high priority WQ
4687 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004688 HAL_TXRX_FRM_802_11_MGMT,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004689 ANI_TXDIR_IBSS,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004690 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4691 limTxComplete, pFrame, txFlag );
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004692 }
4693 else
4694 {
4695#endif
4696 // Queue Disassociation frame in high priority WQ
4697 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4698 HAL_TXRX_FRM_802_11_MGMT,
4699 ANI_TXDIR_TODS,
4700 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4701 limTxComplete, pFrame, txFlag );
4702#ifdef FEATURE_WLAN_TDLS
4703 }
4704#endif
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304705 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4706 psessionEntry->peSessionId,
4707 halstatus));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004708 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4709 {
4710 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004711 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004712 nSirStatus );
4713 //Pkt will be freed up by the callback
4714 return;
4715 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004716 }
4717
4718} // End limSendDeauthMgmtFrame.
4719
4720
4721#ifdef ANI_SUPPORT_11H
4722/**
4723 * \brief Send a Measurement Report Action frame
4724 *
4725 *
4726 * \param pMac Pointer to the global MAC structure
4727 *
4728 * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame
4729 *
4730 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4731 *
4732 *
4733 */
4734
4735tSirRetStatus
4736limSendMeasReportFrame(tpAniSirGlobal pMac,
4737 tpSirMacMeasReqActionFrame pMeasReqFrame,
4738 tSirMacAddr peer)
4739{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304740 tDot11fMeasurementReport frm;
4741 tANI_U8 *pFrame;
4742 tSirRetStatus nSirStatus;
4743 tpSirMacMgmtHdr pMacHdr;
4744 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4745 void *pPacket;
4746 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004747
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304748 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004749
4750 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4751 frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID;
4752 frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken;
4753
4754 switch ( pMeasReqFrame->measReqIE.measType )
4755 {
4756 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
4757 nSirStatus =
4758 PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame,
4759 &frm.MeasurementReport );
4760 break;
4761 case SIR_MAC_CCA_MEASUREMENT_TYPE:
4762 nSirStatus =
4763 PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame,
4764 &frm.MeasurementReport );
4765 break;
4766 case SIR_MAC_RPI_MEASUREMENT_TYPE:
4767 nSirStatus =
4768 PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame,
4769 &frm.MeasurementReport );
4770 break;
4771 default:
4772 limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004773 "dMeasReportFrame."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 pMeasReqFrame->measReqIE.measType );
4775 return eSIR_FAILURE;
4776 }
4777
4778 if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE;
4779
4780 nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload );
4781 if ( DOT11F_FAILED( nStatus ) )
4782 {
4783 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004784 "or a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 nStatus );
4786 // We'll fall back on the worst case scenario:
4787 nPayload = sizeof( tDot11fMeasurementReport );
4788 }
4789 else if ( DOT11F_WARNED( nStatus ) )
4790 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004791 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 "the packed size for a Measurement Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004793 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004794 }
4795
4796 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4797
4798 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4799 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4800 {
4801 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004802 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 return eSIR_FAILURE;
4804 }
4805
4806 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304807 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004808
4809 // Next, we fill out the buffer descriptor:
4810 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4811 SIR_MAC_MGMT_ACTION, peer);
4812 if ( eSIR_SUCCESS != nSirStatus )
4813 {
4814 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004815 "tor for a Measurement Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004816 nSirStatus );
4817 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4818 return eSIR_FAILURE; // just allocated...
4819 }
4820
4821 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4822
4823 nCfg = 6;
4824 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4825 if ( eSIR_SUCCESS != nSirStatus )
4826 {
4827 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004828 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004829 nSirStatus );
4830 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4831 return eSIR_FAILURE; // just allocated...
4832 }
4833
Chet Lanctot186b5732013-03-18 10:26:30 -07004834#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004835 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004836#endif
4837
Jeff Johnson295189b2012-06-20 16:38:30 -07004838 nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame +
4839 sizeof(tSirMacMgmtHdr),
4840 nPayload, &nPayload );
4841 if ( DOT11F_FAILED( nStatus ) )
4842 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004843 limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004844 nStatus );
4845 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4846 return eSIR_FAILURE; // allocated!
4847 }
4848 else if ( DOT11F_WARNED( nStatus ) )
4849 {
4850 limLog( pMac, LOGW, FL("There were warnings while packing a M"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004851 "easurement Report (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 }
4853
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304854 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4855 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4856 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4858 HAL_TXRX_FRM_802_11_MGMT,
4859 ANI_TXDIR_TODS,
4860 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4861 limTxComplete, pFrame, 0 );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304862 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4863 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4864 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4866 {
4867 limLog( pMac, LOGE, FL("Failed to send a Measurement Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004868 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004869 nSirStatus );
4870 //Pkt will be freed up by the callback
4871 return eSIR_FAILURE; // just allocated...
4872 }
4873
4874 return eSIR_SUCCESS;
4875
4876} // End limSendMeasReportFrame.
4877
4878
4879/**
4880 * \brief Send a TPC Request Action frame
4881 *
4882 *
4883 * \param pMac Pointer to the global MAC datastructure
4884 *
4885 * \param peer MAC address to which the frame should be sent
4886 *
4887 *
4888 */
4889
4890void
4891limSendTpcRequestFrame(tpAniSirGlobal pMac,
4892 tSirMacAddr peer)
4893{
4894 tDot11fTPCRequest frm;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304895 tANI_U8 *pFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07004896 tSirRetStatus nSirStatus;
4897 tpSirMacMgmtHdr pMacHdr;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304898 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4899 void *pPacket;
4900 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004901
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304902 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004903
4904 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4905 frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID;
4906 frm.DialogToken.token = 1;
4907 frm.TPCRequest.present = 1;
4908
4909 nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload );
4910 if ( DOT11F_FAILED( nStatus ) )
4911 {
4912 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004913 "or a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 nStatus );
4915 // We'll fall back on the worst case scenario:
4916 nPayload = sizeof( tDot11fTPCRequest );
4917 }
4918 else if ( DOT11F_WARNED( nStatus ) )
4919 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004920 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 "the packed size for a TPC Request (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004922 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004923 }
4924
4925 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4926
4927 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4928 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4929 {
4930 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004931 " Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 return;
4933 }
4934
4935 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304936 vos_mem_set(pFrame, nBytes,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004937
4938 // Next, we fill out the buffer descriptor:
4939 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4940 SIR_MAC_MGMT_ACTION, peer);
4941 if ( eSIR_SUCCESS != nSirStatus )
4942 {
4943 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004944 "tor for a TPC Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 nSirStatus );
4946 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4947 return; // just allocated...
4948 }
4949
4950 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4951
4952 nCfg = 6;
4953 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4954 if ( eSIR_SUCCESS != nSirStatus )
4955 {
4956 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004957 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004958 nSirStatus );
4959 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4960 return; // just allocated...
4961 }
4962
Chet Lanctot186b5732013-03-18 10:26:30 -07004963#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004964 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004965#endif
4966
Jeff Johnson295189b2012-06-20 16:38:30 -07004967 nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame +
4968 sizeof(tSirMacMgmtHdr),
4969 nPayload, &nPayload );
4970 if ( DOT11F_FAILED( nStatus ) )
4971 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004972 limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004973 nStatus );
4974 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4975 return; // allocated!
4976 }
4977 else if ( DOT11F_WARNED( nStatus ) )
4978 {
4979 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004980 "PC Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004981 }
4982
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304983 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4984 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4985 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07004986 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4987 HAL_TXRX_FRM_802_11_MGMT,
4988 ANI_TXDIR_TODS,
4989 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4990 limTxComplete, pFrame, 0 );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304991 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4992 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4993 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07004994 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4995 {
4996 limLog( pMac, LOGE, FL("Failed to send a TPC Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004997 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004998 nSirStatus );
4999 //Pkt will be freed up by the callback
5000 return;
5001 }
5002
5003} // End limSendTpcRequestFrame.
5004
5005
5006/**
5007 * \brief Send a TPC Report Action frame
5008 *
5009 *
5010 * \param pMac Pointer to the global MAC datastructure
5011 *
5012 * \param pTpcReqFrame Pointer to the received TPC Request
5013 *
5014 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5015 *
5016 *
5017 */
5018
5019tSirRetStatus
5020limSendTpcReportFrame(tpAniSirGlobal pMac,
5021 tpSirMacTpcReqActionFrame pTpcReqFrame,
5022 tSirMacAddr peer)
5023{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305024 tDot11fTPCReport frm;
5025 tANI_U8 *pFrame;
5026 tSirRetStatus nSirStatus;
5027 tpSirMacMgmtHdr pMacHdr;
5028 tANI_U32 nBytes, nPayload, nStatus, nCfg;
5029 void *pPacket;
5030 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07005031
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305032 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005033
5034 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
5035 frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID;
5036 frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken;
5037
5038 // FramesToDo: On the Gen4_TVM branch, there was a comment:
5039 // "misplaced this function, need to replace:
5040 // txPower = halGetRateToPwrValue(pMac, staid,
5041 // pMac->lim.gLimCurrentChannelId, 0);
5042 frm.TPCReport.tx_power = 0;
5043 frm.TPCReport.link_margin = 0;
5044 frm.TPCReport.present = 1;
5045
5046 nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload );
5047 if ( DOT11F_FAILED( nStatus ) )
5048 {
5049 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005050 "or a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005051 nStatus );
5052 // We'll fall back on the worst case scenario:
5053 nPayload = sizeof( tDot11fTPCReport );
5054 }
5055 else if ( DOT11F_WARNED( nStatus ) )
5056 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005057 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07005058 "the packed size for a TPC Report (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005059 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 }
5061
5062 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5063
5064 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5065 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5066 {
5067 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005068 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005069 return eSIR_FAILURE;
5070 }
5071
5072 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305073 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005074
5075 // Next, we fill out the buffer descriptor:
5076 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
5077 SIR_MAC_MGMT_ACTION, peer);
5078 if ( eSIR_SUCCESS != nSirStatus )
5079 {
5080 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005081 "tor for a TPC Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005082 nSirStatus );
5083 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5084 return eSIR_FAILURE; // just allocated...
5085 }
5086
5087 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5088
5089 nCfg = 6;
5090 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
5091 if ( eSIR_SUCCESS != nSirStatus )
5092 {
5093 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005094 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005095 nSirStatus );
5096 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5097 return eSIR_FAILURE; // just allocated...
5098 }
5099
Chet Lanctot186b5732013-03-18 10:26:30 -07005100#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005101 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005102#endif
5103
Jeff Johnson295189b2012-06-20 16:38:30 -07005104 nStatus = dot11fPackTPCReport( pMac, &frm, pFrame +
5105 sizeof(tSirMacMgmtHdr),
5106 nPayload, &nPayload );
5107 if ( DOT11F_FAILED( nStatus ) )
5108 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005109 limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005110 nStatus );
5111 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5112 return eSIR_FAILURE; // allocated!
5113 }
5114 else if ( DOT11F_WARNED( nStatus ) )
5115 {
5116 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005117 "PC Report (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005118 }
5119
5120
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305121 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5122 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
5123 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07005124 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5125 HAL_TXRX_FRM_802_11_MGMT,
5126 ANI_TXDIR_TODS,
5127 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5128 limTxComplete, pFrame, 0 );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305129 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5130 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
5131 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07005132 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5133 {
5134 limLog( pMac, LOGE, FL("Failed to send a TPC Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005135 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005136 nSirStatus );
5137 //Pkt will be freed up by the callback
5138 return eSIR_FAILURE; // just allocated...
5139 }
5140
5141 return eSIR_SUCCESS;
5142
5143} // End limSendTpcReportFrame.
5144#endif //ANI_SUPPORT_11H
5145
5146
Jeff Johnson295189b2012-06-20 16:38:30 -07005147/**
5148 * \brief Send a Channel Switch Announcement
5149 *
5150 *
5151 * \param pMac Pointer to the global MAC datastructure
5152 *
5153 * \param peer MAC address to which this frame will be sent
5154 *
5155 * \param nMode
5156 *
5157 * \param nNewChannel
5158 *
5159 * \param nCount
5160 *
5161 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5162 *
5163 *
5164 */
5165
5166tSirRetStatus
5167limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
5168 tSirMacAddr peer,
Jeff Johnsone7245742012-09-05 17:12:55 -07005169 tANI_U8 nMode,
5170 tANI_U8 nNewChannel,
5171 tANI_U8 nCount,
5172 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07005173{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305174 tDot11fChannelSwitch frm;
5175 tANI_U8 *pFrame;
5176 tSirRetStatus nSirStatus;
5177 tpSirMacMgmtHdr pMacHdr;
5178 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
5179 void *pPacket;
5180 eHalStatus halstatus;
5181 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005182
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305183 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005184
5185 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
5186 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
5187 frm.ChanSwitchAnn.switchMode = nMode;
5188 frm.ChanSwitchAnn.newChannel = nNewChannel;
5189 frm.ChanSwitchAnn.switchCount = nCount;
5190 frm.ChanSwitchAnn.present = 1;
5191
5192 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
5193 if ( DOT11F_FAILED( nStatus ) )
5194 {
5195 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005196 "or a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005197 nStatus );
5198 // We'll fall back on the worst case scenario:
5199 nPayload = sizeof( tDot11fChannelSwitch );
5200 }
5201 else if ( DOT11F_WARNED( nStatus ) )
5202 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005203 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07005204 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005205 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005206 }
5207
5208 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5209
5210 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5211 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5212 {
5213 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005214 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005215 return eSIR_FAILURE;
5216 }
5217
5218 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305219 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005220
5221 // Next, we fill out the buffer descriptor:
5222 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
Jeff Johnsone7245742012-09-05 17:12:55 -07005223 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
5224 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305225 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
5226 (tANI_U8 *) psessionEntry->bssId,
5227 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005228 if ( eSIR_SUCCESS != nSirStatus )
5229 {
5230 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005231 "tor for a Channel Switch (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005232 nSirStatus );
5233 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5234 return eSIR_FAILURE; // just allocated...
5235 }
5236
Jeff Johnsone7245742012-09-05 17:12:55 -07005237#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07005238 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5239
5240 nCfg = 6;
5241 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
5242 if ( eSIR_SUCCESS != nSirStatus )
5243 {
5244 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005245 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005246 nSirStatus );
5247 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5248 return eSIR_FAILURE; // just allocated...
5249 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005250#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07005251
5252#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005253 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005254#endif
5255
Jeff Johnson295189b2012-06-20 16:38:30 -07005256 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
5257 sizeof(tSirMacMgmtHdr),
5258 nPayload, &nPayload );
5259 if ( DOT11F_FAILED( nStatus ) )
5260 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005261 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005262 nStatus );
5263 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5264 return eSIR_FAILURE; // allocated!
5265 }
5266 else if ( DOT11F_WARNED( nStatus ) )
5267 {
5268 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005269 "hannel Switch (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005270 }
5271
Jeff Johnsone7245742012-09-05 17:12:55 -07005272 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnsone7245742012-09-05 17:12:55 -07005273 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5274 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnsone7245742012-09-05 17:12:55 -07005275 )
5276 {
5277 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5278 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305279
5280 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5281 psessionEntry->peSessionId,
5282 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07005283 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5284 HAL_TXRX_FRM_802_11_MGMT,
5285 ANI_TXDIR_TODS,
5286 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Jeff Johnsone7245742012-09-05 17:12:55 -07005287 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305288 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5289 psessionEntry->peSessionId,
5290 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07005291 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5292 {
5293 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005294 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005295 nSirStatus );
5296 //Pkt will be freed up by the callback
5297 return eSIR_FAILURE;
5298 }
5299
5300 return eSIR_SUCCESS;
5301
5302} // End limSendChannelSwitchMgmtFrame.
5303
Jeff Johnson295189b2012-06-20 16:38:30 -07005304
5305
Mohit Khanna4a70d262012-09-11 16:30:12 -07005306#ifdef WLAN_FEATURE_11AC
5307tSirRetStatus
5308limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac,
5309 tSirMacAddr peer,
5310 tANI_U8 nMode,
5311 tpPESession psessionEntry )
5312{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305313 tDot11fOperatingMode frm;
5314 tANI_U8 *pFrame;
5315 tSirRetStatus nSirStatus;
5316 tpSirMacMgmtHdr pMacHdr;
5317 tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg;
5318 void *pPacket;
5319 eHalStatus halstatus;
5320 tANI_U32 txFlag = 0;
Mohit Khanna4a70d262012-09-11 16:30:12 -07005321
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305322 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005323
5324 frm.Category.category = SIR_MAC_ACTION_VHT;
5325 frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION;
5326 frm.OperatingMode.chanWidth = nMode;
5327 frm.OperatingMode.rxNSS = 0;
5328 frm.OperatingMode.rxNSSType = 0;
5329
5330 nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload );
5331 if ( DOT11F_FAILED( nStatus ) )
5332 {
5333 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005334 "or a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005335 nStatus );
5336 // We'll fall back on the worst case scenario:
5337 nPayload = sizeof( tDot11fOperatingMode);
5338 }
5339 else if ( DOT11F_WARNED( nStatus ) )
5340 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005341 limLog( pMac, LOGW, FL("There were warnings while calculating "
Mohit Khanna4a70d262012-09-11 16:30:12 -07005342 "the packed size for a Operating Mode (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005343 "%08x)."), nStatus );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005344 }
5345
5346 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5347
5348 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5349 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5350 {
5351 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Operating Mode"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005352 " Report."), nBytes );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005353 return eSIR_FAILURE;
5354 }
5355
5356 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305357 vos_mem_set( pFrame, nBytes, 0 );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005358
5359
5360 // Next, we fill out the buffer descriptor:
5361 if(psessionEntry->pePersona == VOS_STA_SAP_MODE) {
5362 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
5363 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
5364 } else
5365 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
5366 SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr);
5367 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305368 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
5369 (tANI_U8 *) psessionEntry->bssId,
5370 sizeof( tSirMacAddr ));
Mohit Khanna4a70d262012-09-11 16:30:12 -07005371 if ( eSIR_SUCCESS != nSirStatus )
5372 {
5373 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005374 "tor for a Operating Mode (%d)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005375 nSirStatus );
5376 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5377 return eSIR_FAILURE; // just allocated...
5378 }
5379 nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame +
5380 sizeof(tSirMacMgmtHdr),
5381 nPayload, &nPayload );
5382 if ( DOT11F_FAILED( nStatus ) )
5383 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005384 limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005385 nStatus );
5386 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5387 return eSIR_FAILURE; // allocated!
5388 }
5389 else if ( DOT11F_WARNED( nStatus ) )
5390 {
5391 limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005392 " (0x%08x)."), nStatus );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005393 }
5394 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Mohit Khanna4a70d262012-09-11 16:30:12 -07005395 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5396 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Mohit Khanna4a70d262012-09-11 16:30:12 -07005397 )
5398 {
5399 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5400 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305401
5402 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5403 psessionEntry->peSessionId,
5404 pMacHdr->fc.subType));
Mohit Khanna4a70d262012-09-11 16:30:12 -07005405 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5406 HAL_TXRX_FRM_802_11_MGMT,
5407 ANI_TXDIR_TODS,
5408 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5409 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305410 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5411 psessionEntry->peSessionId,
5412 halstatus));
Mohit Khanna4a70d262012-09-11 16:30:12 -07005413 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5414 {
5415 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005416 "(%X)!"),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005417 nSirStatus );
5418 //Pkt will be freed up by the callback
5419 return eSIR_FAILURE;
5420 }
5421
5422 return eSIR_SUCCESS;
5423}
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005424
5425/**
5426 * \brief Send a VHT Channel Switch Announcement
5427 *
5428 *
5429 * \param pMac Pointer to the global MAC datastructure
5430 *
5431 * \param peer MAC address to which this frame will be sent
5432 *
5433 * \param nChanWidth
5434 *
5435 * \param nNewChannel
5436 *
5437 *
5438 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5439 *
5440 *
5441 */
5442
5443tSirRetStatus
5444limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
5445 tSirMacAddr peer,
5446 tANI_U8 nChanWidth,
5447 tANI_U8 nNewChannel,
5448 tANI_U8 ncbMode,
5449 tpPESession psessionEntry )
5450{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305451 tDot11fChannelSwitch frm;
5452 tANI_U8 *pFrame;
5453 tSirRetStatus nSirStatus;
5454 tpSirMacMgmtHdr pMacHdr;
5455 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
5456 void *pPacket;
5457 eHalStatus halstatus;
5458 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005459
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305460 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005461
5462
5463 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
5464 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
5465 frm.ChanSwitchAnn.switchMode = 1;
5466 frm.ChanSwitchAnn.newChannel = nNewChannel;
5467 frm.ChanSwitchAnn.switchCount = 1;
5468 frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode);
5469 frm.ExtChanSwitchAnn.present = 1;
5470 frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth;
5471 frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth);
5472 frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0;
5473 frm.ChanSwitchAnn.present = 1;
5474 frm.WiderBWChanSwitchAnn.present = 1;
5475
5476 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
5477 if ( DOT11F_FAILED( nStatus ) )
5478 {
5479 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005480 "or a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005481 nStatus );
5482 // We'll fall back on the worst case scenario:
5483 nPayload = sizeof( tDot11fChannelSwitch );
5484 }
5485 else if ( DOT11F_WARNED( nStatus ) )
5486 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005487 limLog( pMac, LOGW, FL("There were warnings while calculating "
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005488 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005489 "%08x)."), nStatus );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005490 }
5491
5492 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5493
5494 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5495 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5496 {
5497 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005498 " Report."), nBytes );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005499 return eSIR_FAILURE;
5500 }
5501 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305502 vos_mem_set( pFrame, nBytes, 0 );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005503
5504 // Next, we fill out the buffer descriptor:
5505 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
5506 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
5507 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305508 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
5509 (tANI_U8 *) psessionEntry->bssId,
5510 sizeof( tSirMacAddr ));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005511 if ( eSIR_SUCCESS != nSirStatus )
5512 {
5513 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005514 "tor for a Channel Switch (%d)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005515 nSirStatus );
5516 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5517 return eSIR_FAILURE; // just allocated...
5518 }
5519 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
5520 sizeof(tSirMacMgmtHdr),
5521 nPayload, &nPayload );
5522 if ( DOT11F_FAILED( nStatus ) )
5523 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005524 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005525 nStatus );
5526 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5527 return eSIR_FAILURE; // allocated!
5528 }
5529 else if ( DOT11F_WARNED( nStatus ) )
5530 {
5531 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005532 "hannel Switch (0x%08x)."), nStatus );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005533 }
5534
5535 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005536 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5537 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005538 )
5539 {
5540 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5541 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305542
5543 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5544 psessionEntry->peSessionId,
5545 pMacHdr->fc.subType));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005546 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5547 HAL_TXRX_FRM_802_11_MGMT,
5548 ANI_TXDIR_TODS,
5549 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5550 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305551 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5552 psessionEntry->peSessionId,
5553 halstatus));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005554 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5555 {
5556 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005557 "(%X)!"),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005558 nSirStatus );
5559 //Pkt will be freed up by the callback
5560 return eSIR_FAILURE;
5561 }
5562
5563 return eSIR_SUCCESS;
5564
5565} // End limSendVHTChannelSwitchMgmtFrame.
5566
5567
5568
Mohit Khanna4a70d262012-09-11 16:30:12 -07005569#endif
5570
Jeff Johnson295189b2012-06-20 16:38:30 -07005571/**
5572 * \brief Send an ADDBA Req Action Frame to peer
5573 *
5574 * \sa limSendAddBAReq
5575 *
5576 * \param pMac The global tpAniSirGlobal object
5577 *
5578 * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains
5579 * the necessary parameters reqd by PE send the ADDBA Req Action
5580 * Frame to the peer
5581 *
5582 * \return eSIR_SUCCESS if setup completes successfully
5583 * eSIR_FAILURE is some problem is encountered
5584 */
5585tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305586 tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005587{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305588 tDot11fAddBAReq frmAddBAReq;
5589 tANI_U8 *pAddBAReqBuffer = NULL;
5590 tpSirMacMgmtHdr pMacHdr;
5591 tANI_U32 frameLen = 0, nStatus, nPayload;
5592 tSirRetStatus statusCode;
5593 eHalStatus halStatus;
5594 void *pPacket;
5595 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005596
5597 if(NULL == psessionEntry)
5598 {
5599 return eSIR_FAILURE;
5600 }
5601
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305602 vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005603
5604 // Category - 3 (BA)
5605 frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK;
5606
5607 // Action - 0 (ADDBA Req)
5608 frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ;
5609
5610 // FIXME - Dialog Token, generalize this...
5611 frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken;
5612
5613 // Fill the ADDBA Parameter Set
5614 frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID;
5615 frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy;
5616 frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize;
5617
5618 // BA timeout
5619 // 0 - indicates no BA timeout
5620 frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout;
5621
Abhishek Singh1f6e6532014-06-05 17:35:08 +05305622 /* Send SSN whatever we get from FW.
5623 */
5624 frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN;
Jeff Johnson295189b2012-06-20 16:38:30 -07005625
5626 nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload );
5627
5628 if( DOT11F_FAILED( nStatus ))
5629 {
5630 limLog( pMac, LOGW,
5631 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005632 "an ADDBA Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005633 nStatus );
5634
5635 // We'll fall back on the worst case scenario:
5636 nPayload = sizeof( tDot11fAddBAReq );
5637 }
5638 else if( DOT11F_WARNED( nStatus ))
5639 {
5640 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005641 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005642 "the packed size for an ADDBA Req (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005643 nStatus );
5644 }
5645
5646 // Add the MGMT header to frame length
5647 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5648
5649 // Need to allocate a buffer for ADDBA AF
5650 if( eHAL_STATUS_SUCCESS !=
5651 (halStatus = palPktAlloc( pMac->hHdd,
5652 HAL_TXRX_FRM_802_11_MGMT,
5653 (tANI_U16) frameLen,
5654 (void **) &pAddBAReqBuffer,
5655 (void **) &pPacket )))
5656 {
5657 // Log error
5658 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005659 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005660 frameLen,
5661 halStatus );
5662
5663 statusCode = eSIR_MEM_ALLOC_FAILED;
5664 goto returnAfterError;
5665 }
5666
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305667 vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005668
5669 // Copy necessary info to BD
5670 if( eSIR_SUCCESS !=
5671 (statusCode = limPopulateMacHeader( pMac,
5672 pAddBAReqBuffer,
5673 SIR_MAC_MGMT_FRAME,
5674 SIR_MAC_MGMT_ACTION,
5675 pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
5676 goto returnAfterError;
5677
5678 // Update A3 with the BSSID
5679 pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer;
5680
5681 #if 0
5682 cfgLen = SIR_MAC_ADDR_LENGTH;
5683 if( eSIR_SUCCESS != cfgGetStr( pMac,
5684 WNI_CFG_BSSID,
5685 (tANI_U8 *) pMacHdr->bssId,
5686 &cfgLen ))
5687 {
5688 limLog( pMac, LOGP,
5689 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005690 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005691
5692 // FIXME - Need to convert to tSirRetStatus
5693 statusCode = eSIR_FAILURE;
5694 goto returnAfterError;
5695 }
5696 #endif//TO SUPPORT BT-AMP
5697 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5698
Chet Lanctot186b5732013-03-18 10:26:30 -07005699#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005700 limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005701#endif
5702
Jeff Johnson295189b2012-06-20 16:38:30 -07005703 // Now, we're ready to "pack" the frames
5704 nStatus = dot11fPackAddBAReq( pMac,
5705 &frmAddBAReq,
5706 pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ),
5707 nPayload,
5708 &nPayload );
5709
5710 if( DOT11F_FAILED( nStatus ))
5711 {
5712 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005713 FL( "Failed to pack an ADDBA Req (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005714 nStatus );
5715
5716 // FIXME - Need to convert to tSirRetStatus
5717 statusCode = eSIR_FAILURE;
5718 goto returnAfterError;
5719 }
5720 else if( DOT11F_WARNED( nStatus ))
5721 {
5722 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005723 FL( "There were warnings while packing an ADDBA Req (0x%08x)."),
5724 nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005725 }
5726
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05305727 limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with"
5728 " tid = %d policy = %d buffsize = %d "
5729 " amsduSupported = %d"),
5730 MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr),
5731 frmAddBAReq.AddBAParameterSet.tid,
5732 frmAddBAReq.AddBAParameterSet.policy,
5733 frmAddBAReq.AddBAParameterSet.bufferSize,
5734 frmAddBAReq.AddBAParameterSet.amsduSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -07005735
Abhishek Singh1f6e6532014-06-05 17:35:08 +05305736 limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ),
5737 frmAddBAReq.BAStartingSequenceControl.ssn,
5738 frmAddBAReq.BAStartingSequenceControl.fragNumber);
5739
Jeff Johnson295189b2012-06-20 16:38:30 -07005740 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005741 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5742 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005743 )
5744 {
5745 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5746 }
5747
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305748 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5749 psessionEntry->peSessionId,
5750 pMacHdr->fc.subType));
5751 halStatus = halTxFrame( pMac,
5752 pPacket,
5753 (tANI_U16) frameLen,
5754 HAL_TXRX_FRM_802_11_MGMT,
5755 ANI_TXDIR_TODS,
5756 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5757 limTxComplete,
5758 pAddBAReqBuffer, txFlag );
5759 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5760 psessionEntry->peSessionId,
5761 halStatus));
5762 if( eHAL_STATUS_SUCCESS != halStatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07005763 {
5764 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005765 FL( "halTxFrame FAILED! Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005766 halStatus );
5767
5768 // FIXME - Need to convert eHalStatus to tSirRetStatus
5769 statusCode = eSIR_FAILURE;
5770 //Pkt will be freed up by the callback
5771 return statusCode;
5772 }
5773 else
5774 return eSIR_SUCCESS;
5775
5776returnAfterError:
5777
5778 // Release buffer, if allocated
5779 if( NULL != pAddBAReqBuffer )
5780 palPktFree( pMac->hHdd,
5781 HAL_TXRX_FRM_802_11_MGMT,
5782 (void *) pAddBAReqBuffer,
5783 (void *) pPacket );
5784
5785 return statusCode;
5786}
5787
5788/**
5789 * \brief Send an ADDBA Rsp Action Frame to peer
5790 *
5791 * \sa limSendAddBARsp
5792 *
5793 * \param pMac The global tpAniSirGlobal object
5794 *
5795 * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains
5796 * the necessary parameters reqd by PE send the ADDBA Rsp Action
5797 * Frame to the peer
5798 *
5799 * \return eSIR_SUCCESS if setup completes successfully
5800 * eSIR_FAILURE is some problem is encountered
5801 */
5802tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac,
5803 tpLimMlmAddBARsp pMlmAddBARsp,
5804 tpPESession psessionEntry)
5805{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305806 tDot11fAddBARsp frmAddBARsp;
5807 tANI_U8 *pAddBARspBuffer = NULL;
5808 tpSirMacMgmtHdr pMacHdr;
5809 tANI_U32 frameLen = 0, nStatus, nPayload;
5810 tSirRetStatus statusCode;
5811 eHalStatus halStatus;
5812 void *pPacket;
5813 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005814
5815 if(NULL == psessionEntry)
5816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005817 PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005818 return eSIR_FAILURE;
5819 }
5820
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305821 vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005822
5823 // Category - 3 (BA)
5824 frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK;
5825 // Action - 1 (ADDBA Rsp)
5826 frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP;
5827
5828 // Should be same as the one we received in the ADDBA Req
5829 frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken;
5830
5831 // ADDBA Req status
5832 frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode;
5833
5834 // Fill the ADDBA Parameter Set as provided by caller
5835 frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID;
5836 frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy;
5837 frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize;
krunal soni5afa96c2013-09-06 22:19:02 -07005838
5839 if(psessionEntry->isAmsduSupportInAMPDU)
5840 {
5841 frmAddBARsp.AddBAParameterSet.amsduSupported =
5842 psessionEntry->amsduSupportedInBA;
5843 }
5844 else
5845 {
5846 frmAddBARsp.AddBAParameterSet.amsduSupported = 0;
5847 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005848
5849 // BA timeout
5850 // 0 - indicates no BA timeout
5851 frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout;
5852
5853 nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload );
5854
5855 if( DOT11F_FAILED( nStatus ))
5856 {
5857 limLog( pMac, LOGW,
5858 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005859 "an ADDBA Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005860 nStatus );
5861
5862 // We'll fall back on the worst case scenario:
5863 nPayload = sizeof( tDot11fAddBARsp );
5864 }
5865 else if( DOT11F_WARNED( nStatus ))
5866 {
5867 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005868 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005869 "the packed size for an ADDBA Rsp (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005870 nStatus );
5871 }
5872
5873 // Need to allocate a buffer for ADDBA AF
5874 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5875
5876 // Allocate shared memory
5877 if( eHAL_STATUS_SUCCESS !=
5878 (halStatus = palPktAlloc( pMac->hHdd,
5879 HAL_TXRX_FRM_802_11_MGMT,
5880 (tANI_U16) frameLen,
5881 (void **) &pAddBARspBuffer,
5882 (void **) &pPacket )))
5883 {
5884 // Log error
5885 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005886 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005887 frameLen,
5888 halStatus );
5889
5890 statusCode = eSIR_MEM_ALLOC_FAILED;
5891 goto returnAfterError;
5892 }
5893
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305894 vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005895
5896 // Copy necessary info to BD
5897 if( eSIR_SUCCESS !=
5898 (statusCode = limPopulateMacHeader( pMac,
5899 pAddBARspBuffer,
5900 SIR_MAC_MGMT_FRAME,
5901 SIR_MAC_MGMT_ACTION,
5902 pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr)))
5903 goto returnAfterError;
5904
5905 // Update A3 with the BSSID
5906
5907 pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer;
5908
5909 #if 0
5910 cfgLen = SIR_MAC_ADDR_LENGTH;
5911 if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
5912 WNI_CFG_BSSID,
5913 (tANI_U8 *) pMacHdr->bssId,
5914 &cfgLen ))
5915 {
5916 limLog( pMac, LOGP,
5917 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005918 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005919
5920 // FIXME - Need to convert to tSirRetStatus
5921 statusCode = eSIR_FAILURE;
5922 goto returnAfterError;
5923 }
5924 #endif // TO SUPPORT BT-AMP
5925 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5926
Chet Lanctot186b5732013-03-18 10:26:30 -07005927#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005928 limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005929#endif
5930
Jeff Johnson295189b2012-06-20 16:38:30 -07005931 // Now, we're ready to "pack" the frames
5932 nStatus = dot11fPackAddBARsp( pMac,
5933 &frmAddBARsp,
5934 pAddBARspBuffer + sizeof( tSirMacMgmtHdr ),
5935 nPayload,
5936 &nPayload );
5937
5938 if( DOT11F_FAILED( nStatus ))
5939 {
5940 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005941 FL( "Failed to pack an ADDBA Rsp (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 nStatus );
5943
5944 // FIXME - Need to convert to tSirRetStatus
5945 statusCode = eSIR_FAILURE;
5946 goto returnAfterError;
5947 }
5948 else if( DOT11F_WARNED( nStatus ))
5949 {
5950 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005951 FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ),
5952 nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07005953 }
5954
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05305955 limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with"
5956 " tid = %d policy = %d buffsize = %d"
5957 " amsduSupported = %d status %d"),
5958 MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr),
5959 frmAddBARsp.AddBAParameterSet.tid,
5960 frmAddBARsp.AddBAParameterSet.policy,
5961 frmAddBARsp.AddBAParameterSet.bufferSize,
5962 frmAddBARsp.AddBAParameterSet.amsduSupported,
5963 frmAddBARsp.Status.status);
5964
Jeff Johnson295189b2012-06-20 16:38:30 -07005965
5966 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005967 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5968 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005969 )
5970 {
5971 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5972 }
5973
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305974 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5975 psessionEntry->peSessionId,
5976 pMacHdr->fc.subType));
5977 halStatus = halTxFrame( pMac,
5978 pPacket,
5979 (tANI_U16) frameLen,
5980 HAL_TXRX_FRM_802_11_MGMT,
5981 ANI_TXDIR_TODS,
5982 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5983 limTxComplete,
5984 pAddBARspBuffer, txFlag );
5985 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5986 psessionEntry->peSessionId,
5987 halStatus));
5988 if( eHAL_STATUS_SUCCESS != halStatus )
5989 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005990 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005991 FL( "halTxFrame FAILED! Status [%d]" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005992 halStatus );
5993
5994 // FIXME - HAL error codes are different from PE error
5995 // codes!! And, this routine is returning tSirRetStatus
5996 statusCode = eSIR_FAILURE;
5997 //Pkt will be freed up by the callback
5998 return statusCode;
5999 }
6000 else
6001 return eSIR_SUCCESS;
6002
6003 returnAfterError:
Jeff Johnson295189b2012-06-20 16:38:30 -07006004 // Release buffer, if allocated
6005 if( NULL != pAddBARspBuffer )
6006 palPktFree( pMac->hHdd,
6007 HAL_TXRX_FRM_802_11_MGMT,
6008 (void *) pAddBARspBuffer,
6009 (void *) pPacket );
6010
6011 return statusCode;
6012}
6013
6014/**
6015 * \brief Send a DELBA Indication Action Frame to peer
6016 *
6017 * \sa limSendDelBAInd
6018 *
6019 * \param pMac The global tpAniSirGlobal object
6020 *
6021 * \param peerMacAddr MAC Address of peer
6022 *
6023 * \param reasonCode Reason for the DELBA notification
6024 *
6025 * \param pBAParameterSet The DELBA Parameter Set.
6026 * This identifies the TID for which the BA session is
6027 * being deleted.
6028 *
6029 * \return eSIR_SUCCESS if setup completes successfully
6030 * eSIR_FAILURE is some problem is encountered
6031 */
6032tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac,
6033 tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry)
6034{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306035 tDot11fDelBAInd frmDelBAInd;
6036 tANI_U8 *pDelBAIndBuffer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006037 //tANI_U32 val;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306038 tpSirMacMgmtHdr pMacHdr;
6039 tANI_U32 frameLen = 0, nStatus, nPayload;
6040 tSirRetStatus statusCode;
6041 eHalStatus halStatus;
6042 void *pPacket;
6043 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006044
6045 if(NULL == psessionEntry)
6046 {
6047 return eSIR_FAILURE;
6048 }
6049
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306050 vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006051
6052 // Category - 3 (BA)
6053 frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK;
6054 // Action - 2 (DELBA)
6055 frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL;
6056
6057 // Fill the DELBA Parameter Set as provided by caller
6058 frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID;
6059 frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection;
6060
6061 // BA Starting Sequence Number
6062 // Fragment number will always be zero
6063 frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode;
6064
6065 nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload );
6066
6067 if( DOT11F_FAILED( nStatus ))
6068 {
6069 limLog( pMac, LOGW,
6070 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006071 "an DELBA Indication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006072 nStatus );
6073
6074 // We'll fall back on the worst case scenario:
6075 nPayload = sizeof( tDot11fDelBAInd );
6076 }
6077 else if( DOT11F_WARNED( nStatus ))
6078 {
6079 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006080 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006081 "the packed size for an DELBA Ind (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006082 nStatus );
6083 }
6084
6085 // Add the MGMT header to frame length
6086 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
6087
6088 // Allocate shared memory
6089 if( eHAL_STATUS_SUCCESS !=
6090 (halStatus = palPktAlloc( pMac->hHdd,
6091 HAL_TXRX_FRM_802_11_MGMT,
6092 (tANI_U16) frameLen,
6093 (void **) &pDelBAIndBuffer,
6094 (void **) &pPacket )))
6095 {
6096 // Log error
6097 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006098 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006099 frameLen,
6100 halStatus );
6101
6102 statusCode = eSIR_MEM_ALLOC_FAILED;
6103 goto returnAfterError;
6104 }
6105
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306106 vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006107
6108 // Copy necessary info to BD
6109 if( eSIR_SUCCESS !=
6110 (statusCode = limPopulateMacHeader( pMac,
6111 pDelBAIndBuffer,
6112 SIR_MAC_MGMT_FRAME,
6113 SIR_MAC_MGMT_ACTION,
6114 pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
6115 goto returnAfterError;
6116
6117 // Update A3 with the BSSID
6118 pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer;
6119
6120 #if 0
6121 cfgLen = SIR_MAC_ADDR_LENGTH;
6122 if( eSIR_SUCCESS != cfgGetStr( pMac,
6123 WNI_CFG_BSSID,
6124 (tANI_U8 *) pMacHdr->bssId,
6125 &cfgLen ))
6126 {
6127 limLog( pMac, LOGP,
6128 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006129 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006130
6131 // FIXME - Need to convert to tSirRetStatus
6132 statusCode = eSIR_FAILURE;
6133 goto returnAfterError;
6134 }
6135 #endif //TO SUPPORT BT-AMP
6136 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
6137
Chet Lanctot186b5732013-03-18 10:26:30 -07006138#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006139 limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006140#endif
6141
Jeff Johnson295189b2012-06-20 16:38:30 -07006142 // Now, we're ready to "pack" the frames
6143 nStatus = dot11fPackDelBAInd( pMac,
6144 &frmDelBAInd,
6145 pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ),
6146 nPayload,
6147 &nPayload );
6148
6149 if( DOT11F_FAILED( nStatus ))
6150 {
6151 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006152 FL( "Failed to pack an DELBA Ind (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006153 nStatus );
6154
6155 // FIXME - Need to convert to tSirRetStatus
6156 statusCode = eSIR_FAILURE;
6157 goto returnAfterError;
6158 }
6159 else if( DOT11F_WARNED( nStatus ))
6160 {
6161 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006162 FL( "There were warnings while packing an DELBA Ind (0x%08x)." ),
6163 nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07006164 }
6165
Abhishek Singh1f6e6532014-06-05 17:35:08 +05306166 limLog( pMac, LOG1,
6167 FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d"
6168 " initiator = %d reason = %d" ),
6169 MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr),
6170 frmDelBAInd.DelBAParameterSet.tid,
6171 frmDelBAInd.DelBAParameterSet.initiator,
6172 frmDelBAInd.Reason.code);
6173
Jeff Johnson295189b2012-06-20 16:38:30 -07006174
6175 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006176 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6177 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006178 )
6179 {
6180 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6181 }
6182
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306183 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6184 psessionEntry->peSessionId,
6185 pMacHdr->fc.subType));
6186 halStatus = halTxFrame( pMac,
6187 pPacket,
6188 (tANI_U16) frameLen,
6189 HAL_TXRX_FRM_802_11_MGMT,
6190 ANI_TXDIR_TODS,
6191 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6192 limTxComplete,
6193 pDelBAIndBuffer, txFlag );
6194 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6195 psessionEntry->peSessionId,
6196 halStatus));
6197 if( eHAL_STATUS_SUCCESS != halStatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006198 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006199 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006200 statusCode = eSIR_FAILURE;
6201 //Pkt will be freed up by the callback
6202 return statusCode;
6203 }
6204 else
6205 return eSIR_SUCCESS;
6206
6207 returnAfterError:
6208
6209 // Release buffer, if allocated
6210 if( NULL != pDelBAIndBuffer )
6211 palPktFree( pMac->hHdd,
6212 HAL_TXRX_FRM_802_11_MGMT,
6213 (void *) pDelBAIndBuffer,
6214 (void *) pPacket );
6215
6216 return statusCode;
6217}
6218
6219#if defined WLAN_FEATURE_VOWIFI
6220
6221/**
6222 * \brief Send a Neighbor Report Request Action frame
6223 *
6224 *
6225 * \param pMac Pointer to the global MAC structure
6226 *
6227 * \param pNeighborReq Address of a tSirMacNeighborReportReq
6228 *
6229 * \param peer mac address of peer station.
6230 *
6231 * \param psessionEntry address of session entry.
6232 *
6233 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
6234 *
6235 *
6236 */
6237
6238tSirRetStatus
6239limSendNeighborReportRequestFrame(tpAniSirGlobal pMac,
6240 tpSirMacNeighborReportReq pNeighborReq,
6241 tSirMacAddr peer,
6242 tpPESession psessionEntry
6243 )
6244{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306245 tSirRetStatus statusCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006246 tDot11fNeighborReportRequest frm;
6247 tANI_U8 *pFrame;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306248 tpSirMacMgmtHdr pMacHdr;
6249 tANI_U32 nBytes, nPayload, nStatus;
6250 void *pPacket;
6251 eHalStatus halstatus;
6252 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006253
6254 if ( psessionEntry == NULL )
6255 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006256 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Neighbor Report request action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07006257 return eSIR_FAILURE;
6258 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306259 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006260
6261 frm.Category.category = SIR_MAC_ACTION_RRM;
6262 frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ;
6263 frm.DialogToken.token = pNeighborReq->dialogToken;
6264
6265
6266 if( pNeighborReq->ssid_present )
6267 {
6268 PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID );
6269 }
6270
6271 nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload );
6272 if ( DOT11F_FAILED( nStatus ) )
6273 {
6274 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006275 "or a Neighbor Report Request(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006276 nStatus );
6277 // We'll fall back on the worst case scenario:
6278 nPayload = sizeof( tDot11fNeighborReportRequest );
6279 }
6280 else if ( DOT11F_WARNED( nStatus ) )
6281 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006282 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07006283 "the packed size for a Neighbor Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006284 "ort Request(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006285 }
6286
6287 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6288
6289 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6290 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6291 {
6292 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Neighbor "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006293 "Report Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006294 return eSIR_FAILURE;
6295 }
6296
6297 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306298 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006299
6300 // Copy necessary info to BD
6301 if( eSIR_SUCCESS !=
6302 (statusCode = limPopulateMacHeader( pMac,
6303 pFrame,
6304 SIR_MAC_MGMT_FRAME,
6305 SIR_MAC_MGMT_ACTION,
6306 peer, psessionEntry->selfMacAddr)))
6307 goto returnAfterError;
6308
6309 // Update A3 with the BSSID
6310 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6311
6312 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6313
Chet Lanctot186b5732013-03-18 10:26:30 -07006314#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006315 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006316#endif
6317
Jeff Johnson295189b2012-06-20 16:38:30 -07006318 // Now, we're ready to "pack" the frames
6319 nStatus = dot11fPackNeighborReportRequest( pMac,
6320 &frm,
6321 pFrame + sizeof( tSirMacMgmtHdr ),
6322 nPayload,
6323 &nPayload );
6324
6325 if( DOT11F_FAILED( nStatus ))
6326 {
6327 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006328 FL( "Failed to pack an Neighbor Report Request (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006329 nStatus );
6330
6331 // FIXME - Need to convert to tSirRetStatus
6332 statusCode = eSIR_FAILURE;
6333 goto returnAfterError;
6334 }
6335 else if( DOT11F_WARNED( nStatus ))
6336 {
6337 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006338 FL( "There were warnings while packing Neighbor Report "
6339 "Request (0x%08x)." ), nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07006340 }
6341
6342 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006343 FL( "Sending a Neighbor Report Request to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006344 limPrintMacAddr( pMac, peer, LOGW );
6345
6346 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006347 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6348 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006349 )
6350 {
6351 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6352 }
6353
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306354 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6355 psessionEntry->peSessionId,
6356 pMacHdr->fc.subType));
6357 halstatus = halTxFrame( pMac,
6358 pPacket,
6359 (tANI_U16) nBytes,
6360 HAL_TXRX_FRM_802_11_MGMT,
6361 ANI_TXDIR_TODS,
6362 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6363 limTxComplete,
6364 pFrame, txFlag );
6365 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6366 psessionEntry->peSessionId,
6367 halstatus));
6368 if( eHAL_STATUS_SUCCESS != halstatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006369 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006370 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006371 statusCode = eSIR_FAILURE;
6372 //Pkt will be freed up by the callback
6373 return statusCode;
6374 }
6375 else
6376 return eSIR_SUCCESS;
6377
6378returnAfterError:
6379 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6380
6381 return statusCode;
6382} // End limSendNeighborReportRequestFrame.
6383
6384/**
6385 * \brief Send a Link Report Action frame
6386 *
6387 *
6388 * \param pMac Pointer to the global MAC structure
6389 *
6390 * \param pLinkReport Address of a tSirMacLinkReport
6391 *
6392 * \param peer mac address of peer station.
6393 *
6394 * \param psessionEntry address of session entry.
6395 *
6396 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
6397 *
6398 *
6399 */
6400
6401tSirRetStatus
6402limSendLinkReportActionFrame(tpAniSirGlobal pMac,
6403 tpSirMacLinkReport pLinkReport,
6404 tSirMacAddr peer,
6405 tpPESession psessionEntry
6406 )
6407{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306408 tSirRetStatus statusCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006409 tDot11fLinkMeasurementReport frm;
6410 tANI_U8 *pFrame;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306411 tpSirMacMgmtHdr pMacHdr;
6412 tANI_U32 nBytes, nPayload, nStatus;
6413 void *pPacket;
6414 eHalStatus halstatus;
6415 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006416
6417
6418 if ( psessionEntry == NULL )
6419 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006420 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Link Report action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07006421 return eSIR_FAILURE;
6422 }
6423
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306424 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006425
6426 frm.Category.category = SIR_MAC_ACTION_RRM;
6427 frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT;
6428 frm.DialogToken.token = pLinkReport->dialogToken;
6429
6430
6431 //IEEE Std. 802.11 7.3.2.18. for the report element.
6432 //Even though TPC report an IE, it is represented using fixed fields since it is positioned
6433 //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4
6434 //and frame parser always expects IEs to come after all fixed fields. It is easier to handle
6435 //such case this way than changing the frame parser.
6436 frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID;
6437 frm.TPCEleLen.TPCLen = 2;
6438 frm.TxPower.txPower = pLinkReport->txPower;
6439 frm.LinkMargin.linkMargin = 0;
6440
6441 frm.RxAntennaId.antennaId = pLinkReport->rxAntenna;
6442 frm.TxAntennaId.antennaId = pLinkReport->txAntenna;
6443 frm.RCPI.rcpi = pLinkReport->rcpi;
6444 frm.RSNI.rsni = pLinkReport->rsni;
6445
6446 nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload );
6447 if ( DOT11F_FAILED( nStatus ) )
6448 {
6449 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006450 "or a Link Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006451 nStatus );
6452 // We'll fall back on the worst case scenario:
6453 nPayload = sizeof( tDot11fLinkMeasurementReport );
6454 }
6455 else if ( DOT11F_WARNED( nStatus ) )
6456 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006457 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07006458 "the packed size for a Link Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006459 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006460 }
6461
6462 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6463
6464 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6465 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6466 {
6467 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Link "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006468 "Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006469 return eSIR_FAILURE;
6470 }
6471
6472 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306473 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006474
6475 // Copy necessary info to BD
6476 if( eSIR_SUCCESS !=
6477 (statusCode = limPopulateMacHeader( pMac,
6478 pFrame,
6479 SIR_MAC_MGMT_FRAME,
6480 SIR_MAC_MGMT_ACTION,
6481 peer, psessionEntry->selfMacAddr)))
6482 goto returnAfterError;
6483
6484 // Update A3 with the BSSID
6485 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6486
6487 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6488
Chet Lanctot186b5732013-03-18 10:26:30 -07006489#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006490 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006491#endif
6492
Jeff Johnson295189b2012-06-20 16:38:30 -07006493 // Now, we're ready to "pack" the frames
6494 nStatus = dot11fPackLinkMeasurementReport( pMac,
6495 &frm,
6496 pFrame + sizeof( tSirMacMgmtHdr ),
6497 nPayload,
6498 &nPayload );
6499
6500 if( DOT11F_FAILED( nStatus ))
6501 {
6502 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006503 FL( "Failed to pack an Link Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006504 nStatus );
6505
6506 // FIXME - Need to convert to tSirRetStatus
6507 statusCode = eSIR_FAILURE;
6508 goto returnAfterError;
6509 }
6510 else if( DOT11F_WARNED( nStatus ))
6511 {
6512 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006513 FL( "There were warnings while packing Link Report (0x%08x)." ),
6514 nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006515 }
6516
6517 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006518 FL( "Sending a Link Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006519 limPrintMacAddr( pMac, peer, LOGW );
6520
6521 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006522 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6523 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006524 )
6525 {
6526 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6527 }
6528
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306529 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6530 psessionEntry->peSessionId,
6531 pMacHdr->fc.subType));
6532 halstatus = halTxFrame( pMac,
6533 pPacket,
6534 (tANI_U16) nBytes,
6535 HAL_TXRX_FRM_802_11_MGMT,
6536 ANI_TXDIR_TODS,
6537 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6538 limTxComplete,
6539 pFrame, txFlag );
6540 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6541 psessionEntry->peSessionId,
6542 halstatus));
6543 if( eHAL_STATUS_SUCCESS != halstatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006544 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006545 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006546 statusCode = eSIR_FAILURE;
6547 //Pkt will be freed up by the callback
6548 return statusCode;
6549 }
6550 else
6551 return eSIR_SUCCESS;
6552
6553returnAfterError:
6554 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6555
6556 return statusCode;
6557} // End limSendLinkReportActionFrame.
6558
6559/**
6560 * \brief Send a Beacon Report Action frame
6561 *
6562 *
6563 * \param pMac Pointer to the global MAC structure
6564 *
6565 * \param dialog_token dialog token to be used in the action frame.
6566 *
6567 * \param num_report number of reports in pRRMReport.
6568 *
6569 * \param pRRMReport Address of a tSirMacRadioMeasureReport.
6570 *
6571 * \param peer mac address of peer station.
6572 *
6573 * \param psessionEntry address of session entry.
6574 *
6575 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
6576 *
6577 *
6578 */
6579
6580tSirRetStatus
6581limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac,
6582 tANI_U8 dialog_token,
6583 tANI_U8 num_report,
6584 tpSirMacRadioMeasureReport pRRMReport,
6585 tSirMacAddr peer,
6586 tpPESession psessionEntry
6587 )
6588{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306589 tSirRetStatus statusCode = eSIR_SUCCESS;
6590 tANI_U8 *pFrame;
6591 tpSirMacMgmtHdr pMacHdr;
6592 tANI_U32 nBytes, nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07006593 void *pPacket;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306594 eHalStatus halstatus;
6595 tANI_U8 i;
6596 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006597
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006598 tDot11fRadioMeasurementReport *frm =
6599 vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport));
6600 if (!frm) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006601 limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006602 return eSIR_FAILURE;
6603 }
6604
Jeff Johnson295189b2012-06-20 16:38:30 -07006605 if ( psessionEntry == NULL )
6606 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006607 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006608 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006609 return eSIR_FAILURE;
6610 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306611 vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006612
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006613 frm->Category.category = SIR_MAC_ACTION_RRM;
6614 frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT;
6615 frm->DialogToken.token = dialog_token;
Jeff Johnson295189b2012-06-20 16:38:30 -07006616
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006617 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 -07006618
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006619 for( i = 0 ; i < frm->num_MeasurementReport ; i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07006620 {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006621 frm->MeasurementReport[i].type = pRRMReport[i].type;
6622 frm->MeasurementReport[i].token = pRRMReport[i].token;
6623 frm->MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm)
Jeff Johnson295189b2012-06-20 16:38:30 -07006624 switch( pRRMReport[i].type )
6625 {
6626 case SIR_MAC_RRM_BEACON_TYPE:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006627 PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport );
6628 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
6629 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
6630 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07006631 break;
6632 default:
Gopichand Nakkala72717fd2013-02-08 12:23:45 +05306633 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
6634 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006635 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07006636 break;
6637 }
6638 }
6639
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006640 nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07006641 if ( DOT11F_FAILED( nStatus ) )
6642 {
6643 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006644 "or a Radio Measure Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006645 nStatus );
6646 // We'll fall back on the worst case scenario:
6647 nPayload = sizeof( tDot11fLinkMeasurementReport );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006648 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006649 return eSIR_FAILURE;
6650 }
6651 else if ( DOT11F_WARNED( nStatus ) )
6652 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006653 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07006654 "the packed size for a Radio Measure Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006655 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006656 }
6657
6658 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6659
6660 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6661 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6662 {
6663 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006664 "Report."), nBytes );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006665 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006666 return eSIR_FAILURE;
6667 }
6668
6669 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306670 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006671
6672 // Copy necessary info to BD
6673 if( eSIR_SUCCESS !=
6674 (statusCode = limPopulateMacHeader( pMac,
6675 pFrame,
6676 SIR_MAC_MGMT_FRAME,
6677 SIR_MAC_MGMT_ACTION,
6678 peer, psessionEntry->selfMacAddr)))
6679 goto returnAfterError;
6680
6681 // Update A3 with the BSSID
6682 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6683
6684 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6685
Chet Lanctot186b5732013-03-18 10:26:30 -07006686#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006687 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006688#endif
6689
Jeff Johnson295189b2012-06-20 16:38:30 -07006690 // Now, we're ready to "pack" the frames
6691 nStatus = dot11fPackRadioMeasurementReport( pMac,
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006692 frm,
Jeff Johnson295189b2012-06-20 16:38:30 -07006693 pFrame + sizeof( tSirMacMgmtHdr ),
6694 nPayload,
6695 &nPayload );
6696
6697 if( DOT11F_FAILED( nStatus ))
6698 {
6699 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006700 FL( "Failed to pack an Radio Measure Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006701 nStatus );
6702
6703 // FIXME - Need to convert to tSirRetStatus
6704 statusCode = eSIR_FAILURE;
6705 goto returnAfterError;
6706 }
6707 else if( DOT11F_WARNED( nStatus ))
6708 {
6709 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006710 FL( "There were warnings while packing Radio "
6711 "Measure Report (0x%08x)." ), nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07006712 }
6713
6714 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006715 FL( "Sending a Radio Measure Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006716 limPrintMacAddr( pMac, peer, LOGW );
6717
6718 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006719 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6720 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006721 )
6722 {
6723 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6724 }
6725
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306726 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6727 psessionEntry->peSessionId,
6728 pMacHdr->fc.subType));
6729 halstatus = halTxFrame( pMac,
6730 pPacket,
6731 (tANI_U16) nBytes,
6732 HAL_TXRX_FRM_802_11_MGMT,
6733 ANI_TXDIR_TODS,
6734 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6735 limTxComplete,
6736 pFrame, txFlag );
6737 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6738 psessionEntry->peSessionId,
6739 halstatus));
6740 if( eHAL_STATUS_SUCCESS != halstatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006741 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006742 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 statusCode = eSIR_FAILURE;
6744 //Pkt will be freed up by the callback
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006745 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006746 return statusCode;
6747 }
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07006748 else {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006749 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006750 return eSIR_SUCCESS;
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07006751 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006752
6753returnAfterError:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006754 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006755 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Jeff Johnson295189b2012-06-20 16:38:30 -07006756 return statusCode;
6757} // End limSendBeaconReportActionFrame.
6758
6759#endif
6760
6761#ifdef WLAN_FEATURE_11W
6762/**
Chet Lanctot8cecea22014-02-11 19:09:36 -08006763 * \brief Send SA query request action frame to peer
6764 *
6765 * \sa limSendSaQueryRequestFrame
6766 *
6767 *
6768 * \param pMac The global tpAniSirGlobal object
6769 *
6770 * \param transId Transaction identifier
6771 *
6772 * \param peer The Mac address of the station to which this action frame is addressed
6773 *
6774 * \param psessionEntry The PE session entry
6775 *
6776 * \return eSIR_SUCCESS if setup completes successfully
6777 * eSIR_FAILURE is some problem is encountered
6778 */
6779
6780tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId,
6781 tSirMacAddr peer, tpPESession psessionEntry )
6782{
6783
6784 tDot11fSaQueryReq frm; // SA query request action frame
6785 tANI_U8 *pFrame;
6786 tSirRetStatus nSirStatus;
6787 tpSirMacMgmtHdr pMacHdr;
6788 tANI_U32 nBytes, nPayload, nStatus;
6789 void *pPacket;
6790 eHalStatus halstatus;
6791 tANI_U8 txFlag = 0;
6792
6793 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
6794 frm.Category.category = SIR_MAC_ACTION_SA_QUERY;
6795 /* 11w action field is :
6796 action: 0 --> SA Query Request action frame
6797 action: 1 --> SA Query Response action frame */
6798 frm.Action.action = SIR_MAC_SA_QUERY_REQ;
6799 /* 11w SA Query Request transId */
6800 vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 );
6801
6802 nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload);
6803 if ( DOT11F_FAILED( nStatus ) )
6804 {
6805 limLog( pMac, LOGP, FL("Failed to calculate the packed size "
6806 "for an SA Query Request (0x%08x)."),
6807 nStatus );
6808 // We'll fall back on the worst case scenario:
6809 nPayload = sizeof( tDot11fSaQueryReq );
6810 }
6811 else if ( DOT11F_WARNED( nStatus ) )
6812 {
6813 limLog( pMac, LOGW, FL("There were warnings while calculating "
6814 "the packed size for an SA Query Request"
6815 " (0x%08x)."), nStatus );
6816 }
6817
6818 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6819 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6820 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6821 {
6822 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request "
6823 "action frame"), nBytes );
6824 return eSIR_FAILURE;
6825 }
6826
6827 // Paranoia:
6828 vos_mem_set( pFrame, nBytes, 0 );
6829
6830 // Copy necessary info to BD
6831 nSirStatus = limPopulateMacHeader( pMac,
6832 pFrame,
6833 SIR_MAC_MGMT_FRAME,
6834 SIR_MAC_MGMT_ACTION,
6835 peer, psessionEntry->selfMacAddr );
6836 if ( eSIR_SUCCESS != nSirStatus )
6837 goto returnAfterError;
6838
6839 // Update A3 with the BSSID
6840 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6841
6842 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6843
6844 // Since this is a SA Query Request, set the "protect" (aka WEP) bit
6845 // in the FC
6846 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
6847
6848 // Pack 11w SA Query Request frame
6849 nStatus = dot11fPackSaQueryReq( pMac,
6850 &frm,
6851 pFrame + sizeof( tSirMacMgmtHdr ),
6852 nPayload,
6853 &nPayload );
6854
6855 if ( DOT11F_FAILED( nStatus ))
6856 {
6857 limLog( pMac, LOGE,
6858 FL( "Failed to pack an SA Query Request (0x%08x)." ),
6859 nStatus );
6860 // FIXME - Need to convert to tSirRetStatus
6861 nSirStatus = eSIR_FAILURE;
6862 goto returnAfterError;
6863 }
6864 else if ( DOT11F_WARNED( nStatus ))
6865 {
6866 limLog( pMac, LOGW,
6867 FL( "There were warnings while packing SA Query Request (0x%08x)." ),
6868 nStatus);
6869 }
6870
6871 limLog( pMac, LOG1,
6872 FL( "Sending an SA Query Request to " ));
6873 limPrintMacAddr( pMac, peer, LOG1 );
6874 limPrintMacAddr( pMac, peer, LOGE );
6875 limLog( pMac, LOGE,
6876 FL( "Sending an SA Query Request from " ));
6877 limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE );
6878
6879 if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) )
6880#ifdef WLAN_FEATURE_P2P
6881 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6882 ( psessionEntry->pePersona == VOS_P2P_GO_MODE )
6883#endif
6884 )
6885 {
6886 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6887 }
6888
6889 halstatus = halTxFrame( pMac,
6890 pPacket,
6891 (tANI_U16) nBytes,
6892 HAL_TXRX_FRM_802_11_MGMT,
6893 ANI_TXDIR_TODS,
6894 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6895 limTxComplete,
6896 pFrame, txFlag );
6897 if ( eHAL_STATUS_SUCCESS != halstatus )
6898 {
6899 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
6900 nSirStatus = eSIR_FAILURE;
6901 //Pkt will be freed up by the callback
6902 return nSirStatus;
6903 }
6904 else {
6905 return eSIR_SUCCESS;
6906 }
6907
6908returnAfterError:
6909 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6910 return nSirStatus;
6911} // End limSendSaQueryRequestFrame
6912
6913/**
Jeff Johnson295189b2012-06-20 16:38:30 -07006914 * \brief Send SA query response action frame to peer
6915 *
6916 * \sa limSendSaQueryResponseFrame
6917 *
6918 *
6919 * \param pMac The global tpAniSirGlobal object
6920 *
Chet Lanctot186b5732013-03-18 10:26:30 -07006921 * \param transId Transaction identifier received in SA query request action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07006922 *
Chet Lanctot186b5732013-03-18 10:26:30 -07006923 * \param peer The Mac address of the AP to which this action frame is addressed
6924 *
6925 * \param psessionEntry The PE session entry
Jeff Johnson295189b2012-06-20 16:38:30 -07006926 *
6927 * \return eSIR_SUCCESS if setup completes successfully
6928 * eSIR_FAILURE is some problem is encountered
6929 */
6930
Chet Lanctot186b5732013-03-18 10:26:30 -07006931tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006932tSirMacAddr peer,tpPESession psessionEntry)
6933{
6934
Chet Lanctot186b5732013-03-18 10:26:30 -07006935 tDot11fSaQueryRsp frm; // SA query reponse action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07006936 tANI_U8 *pFrame;
6937 tSirRetStatus nSirStatus;
6938 tpSirMacMgmtHdr pMacHdr;
Chet Lanctot186b5732013-03-18 10:26:30 -07006939 tANI_U32 nBytes, nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07006940 void *pPacket;
6941 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306942 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006943
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306944 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Chet Lanctot186b5732013-03-18 10:26:30 -07006945 frm.Category.category = SIR_MAC_ACTION_SA_QUERY;
6946 /*11w action field is :
Jeff Johnson295189b2012-06-20 16:38:30 -07006947 action: 0 --> SA query request action frame
6948 action: 1 --> SA query response action frame */
Chet Lanctot186b5732013-03-18 10:26:30 -07006949 frm.Action.action = SIR_MAC_SA_QUERY_RSP;
6950 /*11w SA query response transId is same as
Jeff Johnson295189b2012-06-20 16:38:30 -07006951 SA query request transId*/
Chet Lanctot186b5732013-03-18 10:26:30 -07006952 vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006953
Chet Lanctot186b5732013-03-18 10:26:30 -07006954 nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload);
6955 if ( DOT11F_FAILED( nStatus ) )
6956 {
6957 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
6958 "or a SA Query Response (0x%08x)."),
6959 nStatus );
6960 // We'll fall back on the worst case scenario:
6961 nPayload = sizeof( tDot11fSaQueryRsp );
6962 }
6963 else if ( DOT11F_WARNED( nStatus ) )
6964 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006965 limLog( pMac, LOGW, FL("There were warnings while calculating "
Chet Lanctot186b5732013-03-18 10:26:30 -07006966 "the packed size for an SA Query Response"
6967 " (0x%08x)."), nStatus );
6968 }
6969
Jeff Johnson295189b2012-06-20 16:38:30 -07006970 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6971 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6972 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6973 {
6974 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA query response"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006975 " action frame"), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006976 return eSIR_FAILURE;
6977 }
6978
6979 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306980 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006981
Chet Lanctot186b5732013-03-18 10:26:30 -07006982 // Copy necessary info to BD
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006983 nSirStatus = limPopulateMacHeader( pMac,
Chet Lanctot186b5732013-03-18 10:26:30 -07006984 pFrame,
6985 SIR_MAC_MGMT_FRAME,
6986 SIR_MAC_MGMT_ACTION,
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006987 peer, psessionEntry->selfMacAddr );
6988 if ( eSIR_SUCCESS != nSirStatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07006989 goto returnAfterError;
Jeff Johnson295189b2012-06-20 16:38:30 -07006990
Chet Lanctot186b5732013-03-18 10:26:30 -07006991 // Update A3 with the BSSID
Jeff Johnson295189b2012-06-20 16:38:30 -07006992 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6993
Chet Lanctot186b5732013-03-18 10:26:30 -07006994 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006995
Chet Lanctot186b5732013-03-18 10:26:30 -07006996 // Since this is a SA Query Response, set the "protect" (aka WEP) bit
6997 // in the FC
Chet Lanctot8cecea22014-02-11 19:09:36 -08006998 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Jeff Johnson295189b2012-06-20 16:38:30 -07006999
Chet Lanctot186b5732013-03-18 10:26:30 -07007000 // Pack 11w SA query response frame
7001 nStatus = dot11fPackSaQueryRsp( pMac,
7002 &frm,
7003 pFrame + sizeof( tSirMacMgmtHdr ),
7004 nPayload,
7005 &nPayload );
7006
7007 if ( DOT11F_FAILED( nStatus ))
7008 {
7009 limLog( pMac, LOGE,
7010 FL( "Failed to pack an SA Query Response (0x%08x)." ),
7011 nStatus );
7012 // FIXME - Need to convert to tSirRetStatus
7013 nSirStatus = eSIR_FAILURE;
7014 goto returnAfterError;
7015 }
7016 else if ( DOT11F_WARNED( nStatus ))
7017 {
7018 limLog( pMac, LOGW,
7019 FL( "There were warnings while packing SA Query Response (0x%08x)." ),
7020 nStatus);
7021 }
7022
7023 limLog( pMac, LOG1,
7024 FL( "Sending a SA Query Response to " ));
7025 limPrintMacAddr( pMac, peer, LOGW );
7026
Chet Lanctotb2b0d552013-03-22 16:58:44 -07007027 if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) )
Chet Lanctot186b5732013-03-18 10:26:30 -07007028#ifdef WLAN_FEATURE_P2P
Chet Lanctotb2b0d552013-03-22 16:58:44 -07007029 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
7030 ( psessionEntry->pePersona == VOS_P2P_GO_MODE )
Chet Lanctot186b5732013-03-18 10:26:30 -07007031#endif
Chet Lanctotb2b0d552013-03-22 16:58:44 -07007032 )
7033 {
7034 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
7035 }
Chet Lanctot186b5732013-03-18 10:26:30 -07007036
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05307037 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
7038 psessionEntry->peSessionId,
7039 pMacHdr->fc.subType));
Chet Lanctotb2b0d552013-03-22 16:58:44 -07007040 halstatus = halTxFrame( pMac,
7041 pPacket,
7042 (tANI_U16) nBytes,
7043 HAL_TXRX_FRM_802_11_MGMT,
7044 ANI_TXDIR_TODS,
7045 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
7046 limTxComplete,
7047 pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05307048 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
7049 psessionEntry->peSessionId,
7050 halstatus));
Chet Lanctotb2b0d552013-03-22 16:58:44 -07007051 if ( eHAL_STATUS_SUCCESS != halstatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07007052 {
7053 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
7054 nSirStatus = eSIR_FAILURE;
7055 //Pkt will be freed up by the callback
7056 return nSirStatus;
7057 }
7058 else {
7059 return eSIR_SUCCESS;
7060 }
7061
7062returnAfterError:
7063 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
7064 return nSirStatus;
7065} // End limSendSaQueryResponseFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07007066#endif
Abhishek Singh00b71972016-01-07 10:51:04 +05307067
7068#ifdef WLAN_FEATURE_RMC
7069tSirRetStatus
7070limSendRMCActionFrame(tpAniSirGlobal pMac,
7071 tSirMacAddr peerMacAddr,
7072 tSirRMCInfo *pRMC,
7073 tpPESession psessionEntry)
7074{
7075 tSirRetStatus nSirStatus;
7076 tANI_U8 *pFrame;
7077 tDot11fRMC RMC;
7078 tANI_U32 nPayload, nBytes, nStatus;
7079 tpSirMacMgmtHdr pMacHdr;
7080 void *pPacket;
7081 eHalStatus halstatus;
7082 tANI_U8 txFlag = 0;
7083 tANI_U8 MagicCode[] = { 0x4f, 0x58, 0x59, 0x47, 0x45, 0x4e };
7084
7085 if (NULL == psessionEntry)
7086 {
7087 return eSIR_FAILURE;
7088 }
7089
7090 vos_mem_set(( tANI_U8* )&RMC, sizeof( RMC ), 0);
7091
7092 RMC.Action.action = pRMC->action;
7093 RMC.RMCDialogToken.token = pRMC->dialogToken;
7094 RMC.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY;
7095 RMC.RMCVersion.version = SIR_MAC_RMC_VER;
7096
7097 vos_mem_copy(&RMC.RMCOUI.oui, SIR_MAC_RMC_OUI, SIR_MAC_RMC_OUI_SIZE);
7098 vos_mem_copy(&RMC.MagicCode.magic, MagicCode, sizeof(MagicCode));
7099
7100 vos_mem_copy(&RMC.Ruler.mac, pRMC->mcastRuler, sizeof(tSirMacAddr));
7101
7102 nStatus = dot11fGetPackedRMCSize( pMac, &RMC, &nPayload );
7103 if ( DOT11F_FAILED( nStatus ) )
7104 {
7105 limLog( pMac, LOGE, FL("Failed to calculate the packed size for "
7106 "an RMC (0x%08x)."),
7107 nStatus );
7108 // We'll fall back on the worst case scenario:
7109 nPayload = sizeof( tDot11fRMC );
7110 }
7111 else if ( DOT11F_WARNED( nStatus ) )
7112 {
7113 limLog( pMac, LOGW, FL("There were warnings while calculating "
7114 "the packed size for an RMC Action Frame"
7115 " (0x%08x)."), nStatus );
7116 }
7117
7118 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
7119
7120 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
7121 ( tANI_U16 )nBytes, ( void** ) &pFrame,
7122 ( void** ) &pPacket );
7123 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
7124 {
7125 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an RMC "
7126 "Action Frame."), nBytes );
7127 return eSIR_FAILURE;
7128 }
7129
7130 // Paranoia:
7131 vos_mem_set( pFrame, nBytes, 0 );
7132
7133 // Next, we fill out the buffer descriptor:
7134 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
7135 SIR_MAC_MGMT_ACTION, peerMacAddr,
7136 psessionEntry->selfMacAddr);
7137 if ( eSIR_SUCCESS != nSirStatus )
7138 {
7139 limLog( pMac, LOGE, FL("Failed to populate the buffer descriptor "
7140 "for an RMC Action Frame (%d)."),
7141 nSirStatus );
7142 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
7143 ( void* ) pFrame, ( void* ) pPacket );
7144 return nSirStatus;
7145 }
7146
7147 // Update A3 with the BSSID
7148 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
7149 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
7150
7151 // That done, pack the struct:
7152 nStatus = dot11fPackRMC( pMac, &RMC,
7153 pFrame + sizeof(tSirMacMgmtHdr),
7154 nPayload, &nPayload );
7155 if ( DOT11F_FAILED( nStatus ) )
7156 {
7157 limLog( pMac, LOGE, FL("Failed to pack an RMC "
7158 "(0x%08x)."),
7159 nStatus );
7160 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame,
7161 ( void* ) pPacket );
7162 return eSIR_FAILURE;
7163 }
7164 else if ( DOT11F_WARNED( nStatus ) )
7165 {
7166 limLog( pMac, LOGW, FL("There were warnings while packing "
7167 "an RMC (0x%08x)."), nStatus );
7168 }
7169
7170 limLog( pMac, LOG1, FL("Sending an RMC Action frame to "
7171 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMacAddr));
7172
7173 /*
7174 * With this masking, RMC action frames will be sent
7175 * at self-sta rates for both 2G and 5G bands.
7176 */
7177 txFlag |= HAL_USE_SELF_STA_REQUESTED_MASK;
7178
7179 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
7180 psessionEntry->peSessionId,
7181 pMacHdr->fc.subType));
7182 // Queue RMC Action frame in high priority WQ
7183 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
7184 HAL_TXRX_FRM_802_11_MGMT,
7185 ANI_TXDIR_TODS,
7186 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
7187 limTxComplete, pFrame, txFlag );
7188 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
7189 psessionEntry->peSessionId,
7190 halstatus));
7191 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
7192 {
7193 limLog( pMac, LOGE, FL( "*** Could not send an RMC Action frame"
7194 " (%X) ***" ), halstatus );
7195 //Pkt will be freed up by the callback
7196 return eSIR_FAILURE;
7197 }
7198
7199 return eSIR_SUCCESS;
7200
7201} // End limSendRMCActionFrame.
7202
7203#endif /* WLAN_FEATURE_RMC */